@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
|
@@ -24,100 +24,111 @@
|
|
|
24
24
|
import * as fs from "node:fs";
|
|
25
25
|
import os from "node:os";
|
|
26
26
|
import path from "node:path";
|
|
27
|
+
import {
|
|
28
|
+
clearWorkspaceFolderConfig,
|
|
29
|
+
writeWorkspaceFolderConfig,
|
|
30
|
+
} from "@elizaos/core";
|
|
27
31
|
import Electrobun, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
type ApplicationMenuItemConfig,
|
|
33
|
+
BrowserView,
|
|
34
|
+
type BrowserWindow,
|
|
35
|
+
BuildConfig,
|
|
36
|
+
ContextMenu,
|
|
37
|
+
GlobalShortcut,
|
|
38
|
+
type MenuItemConfig,
|
|
39
|
+
Screen,
|
|
40
|
+
Session,
|
|
41
|
+
Tray,
|
|
42
|
+
Updater,
|
|
43
|
+
Utils,
|
|
40
44
|
} from "electrobun/bun";
|
|
41
45
|
import { getBrandConfig } from "../brand-config";
|
|
46
|
+
import type { DatabaseSnapshot } from "../database";
|
|
42
47
|
import { logger } from "../logger";
|
|
43
48
|
import type {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
49
|
+
ClipboardReadResult,
|
|
50
|
+
ClipboardWriteOptions,
|
|
51
|
+
CursorPosition,
|
|
52
|
+
DesktopBuildInfo,
|
|
53
|
+
DesktopManagedWindowSnapshot,
|
|
54
|
+
DesktopReleaseNotesWindowInfo,
|
|
55
|
+
DesktopSessionSnapshot,
|
|
56
|
+
DesktopSessionStorageType,
|
|
57
|
+
DesktopUpdaterSnapshot,
|
|
58
|
+
DisplayInfo,
|
|
59
|
+
FileDialogOptions,
|
|
60
|
+
FileDialogResult,
|
|
61
|
+
MessageBoxOptions,
|
|
62
|
+
MessageBoxResult,
|
|
63
|
+
NotificationOptions,
|
|
64
|
+
PowerState,
|
|
65
|
+
ShortcutOptions,
|
|
66
|
+
TrayMenuItem,
|
|
67
|
+
TrayOptions,
|
|
68
|
+
VersionInfo,
|
|
69
|
+
WindowBounds,
|
|
70
|
+
WindowOptions,
|
|
66
71
|
} from "../rpc-schema";
|
|
67
72
|
import type { SendToWebview } from "../types.js";
|
|
73
|
+
import { resolveDesktopUpdateAvailability } from "../update-availability";
|
|
68
74
|
import {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
createBugReportBundle,
|
|
76
|
+
getStartupDiagnosticLogTail,
|
|
77
|
+
getStartupDiagnosticsSnapshot,
|
|
72
78
|
} from "./agent";
|
|
73
79
|
import {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
createSecurityScopedBookmark,
|
|
81
|
+
isAppActive,
|
|
82
|
+
isKeyWindow,
|
|
83
|
+
makeKeyAndOrderFront,
|
|
84
|
+
orderOut,
|
|
85
|
+
startAccessingSecurityScopedBookmark,
|
|
86
|
+
stopAccessingSecurityScopedBookmarks,
|
|
81
87
|
} from "./mac-window-effects";
|
|
82
88
|
import {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
linuxSysfsOnBattery,
|
|
90
|
+
parseLinuxLockedHintOutput,
|
|
91
|
+
parseMacOsHidIdleTimeOutput,
|
|
92
|
+
parseMacOsPowerSourceOutput,
|
|
93
|
+
parseMacOsSessionLockedOutput,
|
|
94
|
+
parseWindowsIdleTimeOutput,
|
|
95
|
+
parseWindowsLockStateOutput,
|
|
96
|
+
parseWindowsPowerLineOutput,
|
|
97
|
+
parseXprintidleOutput,
|
|
92
98
|
} from "./power-state";
|
|
93
99
|
import { checkWebGpuSupport } from "./webgpu-browser-support";
|
|
94
100
|
|
|
95
101
|
interface SetAlwaysOnTopOptions {
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
flag: boolean;
|
|
103
|
+
level?: string;
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
interface SetFullscreenOptions {
|
|
101
|
-
|
|
107
|
+
flag: boolean;
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
interface SetOpacityOptions {
|
|
105
|
-
|
|
111
|
+
opacity: number;
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
interface OpenExternalOptions {
|
|
109
|
-
|
|
115
|
+
url: string;
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
interface ShowItemInFolderOptions {
|
|
113
|
-
|
|
119
|
+
path: string;
|
|
114
120
|
}
|
|
115
121
|
|
|
122
|
+
const FALLBACK_TRAY_MENU_ITEMS: TrayMenuItem[] = [
|
|
123
|
+
{ id: "tray-show-window", label: "Show Window" },
|
|
124
|
+
{ id: "quit", label: "Quit" },
|
|
125
|
+
];
|
|
126
|
+
|
|
116
127
|
type ElectrobunEventHandler = (...args: unknown[]) => void;
|
|
117
128
|
|
|
118
129
|
interface ElectrobunEventTarget {
|
|
119
|
-
|
|
120
|
-
|
|
130
|
+
off?: (event: string, handler: ElectrobunEventHandler) => void;
|
|
131
|
+
removeListener?: (event: string, handler: ElectrobunEventHandler) => void;
|
|
121
132
|
}
|
|
122
133
|
|
|
123
134
|
// ============================================================================
|
|
@@ -125,28 +136,28 @@ interface ElectrobunEventTarget {
|
|
|
125
136
|
// ============================================================================
|
|
126
137
|
|
|
127
138
|
const PATH_NAME_MAP: Record<string, string | (() => string)> = {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
home: Utils.paths.home,
|
|
140
|
+
appData: Utils.paths.appData,
|
|
141
|
+
userData: Utils.paths.userData,
|
|
142
|
+
userCache: Utils.paths.userCache,
|
|
143
|
+
userLogs: Utils.paths.userLogs,
|
|
144
|
+
temp: Utils.paths.temp,
|
|
145
|
+
cache: Utils.paths.cache,
|
|
146
|
+
logs: Utils.paths.logs,
|
|
147
|
+
config: Utils.paths.config,
|
|
148
|
+
documents: Utils.paths.documents,
|
|
149
|
+
downloads: Utils.paths.downloads,
|
|
150
|
+
desktop: Utils.paths.desktop,
|
|
151
|
+
pictures: Utils.paths.pictures,
|
|
152
|
+
music: Utils.paths.music,
|
|
153
|
+
videos: Utils.paths.videos,
|
|
143
154
|
};
|
|
144
155
|
|
|
145
156
|
const DEFAULT_RELEASE_NOTES_URL = getBrandConfig().releaseUrl;
|
|
146
157
|
const RELEASE_NOTES_PARTITION = getBrandConfig().releaseNotesPartition;
|
|
147
158
|
const MACOS_IDLE_THRESHOLD_SECONDS = 60;
|
|
148
159
|
const MACOS_CGSESSION_PATH =
|
|
149
|
-
|
|
160
|
+
"/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession";
|
|
150
161
|
const LINUX_IDLE_THRESHOLD_SECONDS = 60;
|
|
151
162
|
const WINDOWS_IDLE_THRESHOLD_SECONDS = 60;
|
|
152
163
|
const POWER_STATE_PROBE_TIMEOUT_MS = 1_500;
|
|
@@ -155,8 +166,8 @@ let activeDesktopManager: DesktopManager | null = null;
|
|
|
155
166
|
let nativeContextMenuEventsInstalled = false;
|
|
156
167
|
|
|
157
168
|
export function resetDesktopManagerForTesting(): void {
|
|
158
|
-
|
|
159
|
-
|
|
169
|
+
activeDesktopManager = null;
|
|
170
|
+
nativeContextMenuEventsInstalled = false;
|
|
160
171
|
}
|
|
161
172
|
|
|
162
173
|
/**
|
|
@@ -167,44 +178,44 @@ export function resetDesktopManagerForTesting(): void {
|
|
|
167
178
|
* unit / integration runs.
|
|
168
179
|
*/
|
|
169
180
|
export interface NativeShellRunner {
|
|
170
|
-
|
|
171
|
-
|
|
181
|
+
read(argv: string[]): Promise<string>;
|
|
182
|
+
readSafe(argv: string[], timeoutMs?: number): Promise<string | null>;
|
|
172
183
|
}
|
|
173
184
|
|
|
174
185
|
const realNativeShellRunner: NativeShellRunner = {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
186
|
+
async read(argv) {
|
|
187
|
+
const proc = Bun.spawn(argv, {
|
|
188
|
+
stdout: "pipe",
|
|
189
|
+
stderr: "ignore",
|
|
190
|
+
});
|
|
191
|
+
const text = await new Response(proc.stdout).text();
|
|
192
|
+
await proc.exited;
|
|
193
|
+
return text;
|
|
194
|
+
},
|
|
195
|
+
async readSafe(argv, timeoutMs = POWER_STATE_PROBE_TIMEOUT_MS) {
|
|
196
|
+
try {
|
|
197
|
+
const proc = Bun.spawn(argv, {
|
|
198
|
+
stdout: "pipe",
|
|
199
|
+
stderr: "ignore",
|
|
200
|
+
});
|
|
201
|
+
const timer = setTimeout(() => {
|
|
202
|
+
try {
|
|
203
|
+
proc.kill();
|
|
204
|
+
} catch {
|
|
205
|
+
// already exited
|
|
206
|
+
}
|
|
207
|
+
}, timeoutMs);
|
|
208
|
+
const text = await new Response(proc.stdout).text();
|
|
209
|
+
await proc.exited;
|
|
210
|
+
clearTimeout(timer);
|
|
211
|
+
if (typeof proc.exitCode === "number" && proc.exitCode !== 0) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
return text;
|
|
215
|
+
} catch {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
},
|
|
208
219
|
};
|
|
209
220
|
|
|
210
221
|
let activeNativeShellRunner: NativeShellRunner = realNativeShellRunner;
|
|
@@ -214,49 +225,49 @@ let activeNativeShellRunner: NativeShellRunner = realNativeShellRunner;
|
|
|
214
225
|
* Pass `null` to restore the real `Bun.spawn`-backed implementation.
|
|
215
226
|
*/
|
|
216
227
|
export function setNativeShellRunnerForTesting(
|
|
217
|
-
|
|
228
|
+
runner: NativeShellRunner | null,
|
|
218
229
|
): void {
|
|
219
|
-
|
|
230
|
+
activeNativeShellRunner = runner ?? realNativeShellRunner;
|
|
220
231
|
}
|
|
221
232
|
|
|
222
233
|
function readProcessStdout(argv: string[]): Promise<string> {
|
|
223
|
-
|
|
234
|
+
return activeNativeShellRunner.read(argv);
|
|
224
235
|
}
|
|
225
236
|
|
|
226
237
|
function readProcessStdoutSafe(
|
|
227
|
-
|
|
228
|
-
|
|
238
|
+
argv: string[],
|
|
239
|
+
timeoutMs = POWER_STATE_PROBE_TIMEOUT_MS,
|
|
229
240
|
): Promise<string | null> {
|
|
230
|
-
|
|
241
|
+
return activeNativeShellRunner.readSafe(argv, timeoutMs);
|
|
231
242
|
}
|
|
232
243
|
|
|
233
244
|
async function readLinuxLockedHint(): Promise<boolean | null> {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
const sessionId = process.env.XDG_SESSION_ID?.trim();
|
|
246
|
+
if (!sessionId) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
const output = await readProcessStdoutSafe([
|
|
250
|
+
"loginctl",
|
|
251
|
+
"show-session",
|
|
252
|
+
sessionId,
|
|
253
|
+
"-p",
|
|
254
|
+
"LockedHint",
|
|
255
|
+
]);
|
|
256
|
+
return output ? parseLinuxLockedHintOutput(output) : null;
|
|
246
257
|
}
|
|
247
258
|
|
|
248
259
|
const WINDOWS_IDLE_POWERSHELL_SCRIPT = [
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
+
"Add-Type -Namespace W -Name U32 -MemberDefinition @'",
|
|
261
|
+
' [DllImport("user32.dll")] public static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);',
|
|
262
|
+
" [StructLayout(LayoutKind.Sequential)] public struct LASTINPUTINFO {",
|
|
263
|
+
" public uint cbSize; public uint dwTime;",
|
|
264
|
+
" }",
|
|
265
|
+
"'@;",
|
|
266
|
+
"$info = New-Object W.U32+LASTINPUTINFO;",
|
|
267
|
+
"$info.cbSize = [System.Runtime.InteropServices.Marshal]::SizeOf($info);",
|
|
268
|
+
"[void][W.U32]::GetLastInputInfo([ref]$info);",
|
|
269
|
+
"[int]($env:COMPUTERNAME | Out-Null);",
|
|
270
|
+
"[int][System.Environment]::TickCount - [int]$info.dwTime",
|
|
260
271
|
].join(" ");
|
|
261
272
|
|
|
262
273
|
// ============================================================================
|
|
@@ -271,620 +282,624 @@ const WINDOWS_IDLE_POWERSHELL_SCRIPT = [
|
|
|
271
282
|
* webview are sent via the sendToWebview callback.
|
|
272
283
|
*/
|
|
273
284
|
export class DesktopManager {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
285
|
+
private mainWindow: BrowserWindow | null = null;
|
|
286
|
+
private tray: Tray | null = null;
|
|
287
|
+
private releaseNotesWindow: BrowserWindow | null = null;
|
|
288
|
+
private releaseNotesView: BrowserView | null = null;
|
|
289
|
+
private shortcuts: Map<string, ShortcutOptions> = new Map();
|
|
290
|
+
private notificationCounter = 0;
|
|
291
|
+
private sendToWebview: SendToWebview | null = null;
|
|
292
|
+
private _windowFocused = true;
|
|
293
|
+
private _windowHidden = false;
|
|
294
|
+
private _focusPoller: ReturnType<typeof setInterval> | null = null;
|
|
295
|
+
private _appActive = false;
|
|
296
|
+
|
|
297
|
+
// Callback to open the settings window (set by index.ts)
|
|
298
|
+
private openSettingsCallback: ((tabHint?: string) => void) | null = null;
|
|
299
|
+
private openSurfaceWindowCallback:
|
|
300
|
+
| ((
|
|
301
|
+
surface:
|
|
302
|
+
| "chat"
|
|
303
|
+
| "browser"
|
|
304
|
+
| "release"
|
|
305
|
+
| "triggers"
|
|
306
|
+
| "plugins"
|
|
307
|
+
| "connectors"
|
|
308
|
+
| "cloud",
|
|
309
|
+
browse?: string,
|
|
310
|
+
alwaysOnTop?: boolean,
|
|
311
|
+
) => Promise<DesktopManagedWindowSnapshot> | DesktopManagedWindowSnapshot)
|
|
312
|
+
| null = null;
|
|
313
|
+
private openAppWindowCallback:
|
|
314
|
+
| ((options: {
|
|
315
|
+
slug?: string;
|
|
316
|
+
title: string;
|
|
317
|
+
path: string;
|
|
318
|
+
alwaysOnTop?: boolean;
|
|
319
|
+
}) =>
|
|
320
|
+
| Promise<DesktopManagedWindowSnapshot>
|
|
321
|
+
| DesktopManagedWindowSnapshot)
|
|
322
|
+
| null = null;
|
|
323
|
+
private managedWindowAlwaysOnTopCallback:
|
|
324
|
+
| ((id: string, flag: boolean) => boolean)
|
|
325
|
+
| null = null;
|
|
326
|
+
private openExternalHandler:
|
|
327
|
+
| ((url: string) => boolean | Promise<boolean>)
|
|
328
|
+
| null = null;
|
|
329
|
+
private requestQuitCallback: (() => void | Promise<void>) | null = null;
|
|
330
|
+
private restoreMainWindowCallback: (() => void | Promise<void>) | null = null;
|
|
331
|
+
/** Tray-first mode: Dock icon follows main-window presence (macOS). */
|
|
332
|
+
private trayFirstMode = false;
|
|
333
|
+
|
|
334
|
+
// Track menu items for context-menu-clicked matching
|
|
335
|
+
private trayMenuItems: Map<string, TrayMenuItem> = new Map();
|
|
336
|
+
private trayClickHandler: (() => void) | null = null;
|
|
337
|
+
private contextMenuHandler: ElectrobunEventHandler | null = null;
|
|
338
|
+
private windowEventHandlers: Partial<
|
|
339
|
+
Record<"focus" | "blur" | "close" | "resize" | "move", () => void>
|
|
340
|
+
> = {};
|
|
341
|
+
private appExitStarted = false;
|
|
342
|
+
|
|
343
|
+
constructor() {
|
|
344
|
+
activeDesktopManager = this;
|
|
345
|
+
this.ensureNativeContextMenuEvents();
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// MARK: - Configuration
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Set the main BrowserWindow reference and wire up window events.
|
|
352
|
+
*/
|
|
353
|
+
setMainWindow(window: BrowserWindow): void {
|
|
354
|
+
if (this.mainWindow === window) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
this.teardownWindowEvents(this.mainWindow);
|
|
359
|
+
this.mainWindow = window;
|
|
360
|
+
this.setupWindowEvents();
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
async getShellDiagnosticsState(): Promise<{
|
|
364
|
+
trayPresent: boolean;
|
|
365
|
+
mainWindowPresent: boolean;
|
|
366
|
+
windowVisible: boolean;
|
|
367
|
+
windowFocused: boolean;
|
|
368
|
+
}> {
|
|
369
|
+
return {
|
|
370
|
+
trayPresent: Boolean(this.tray),
|
|
371
|
+
mainWindowPresent: Boolean(this.mainWindow),
|
|
372
|
+
windowVisible: (await this.isWindowVisible()).visible,
|
|
373
|
+
windowFocused: this._windowFocused,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Set the callback used to push messages to the webview renderer.
|
|
379
|
+
*/
|
|
380
|
+
setSendToWebview(fn: SendToWebview): void {
|
|
381
|
+
this.sendToWebview = fn;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Set the callback used to open the settings window from menus.
|
|
386
|
+
*/
|
|
387
|
+
setOpenSettingsCallback(cb: (tabHint?: string) => void): void {
|
|
388
|
+
this.openSettingsCallback = cb;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Set the callback used to open detached surface windows from RPC or menus.
|
|
393
|
+
*/
|
|
394
|
+
setOpenSurfaceWindowCallback(
|
|
395
|
+
cb: (
|
|
396
|
+
surface:
|
|
397
|
+
| "chat"
|
|
398
|
+
| "browser"
|
|
399
|
+
| "release"
|
|
400
|
+
| "triggers"
|
|
401
|
+
| "plugins"
|
|
402
|
+
| "connectors"
|
|
403
|
+
| "cloud",
|
|
404
|
+
browse?: string,
|
|
405
|
+
alwaysOnTop?: boolean,
|
|
406
|
+
) => Promise<DesktopManagedWindowSnapshot> | DesktopManagedWindowSnapshot,
|
|
407
|
+
): void {
|
|
408
|
+
this.openSurfaceWindowCallback = cb;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
setOpenAppWindowCallback(
|
|
412
|
+
cb:
|
|
413
|
+
| ((options: {
|
|
414
|
+
slug?: string;
|
|
415
|
+
title: string;
|
|
416
|
+
path: string;
|
|
417
|
+
alwaysOnTop?: boolean;
|
|
418
|
+
}) =>
|
|
419
|
+
| Promise<DesktopManagedWindowSnapshot>
|
|
420
|
+
| DesktopManagedWindowSnapshot)
|
|
421
|
+
| null,
|
|
422
|
+
): void {
|
|
423
|
+
this.openAppWindowCallback = cb;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
setManagedWindowAlwaysOnTopCallback(
|
|
427
|
+
cb: ((id: string, flag: boolean) => boolean) | null,
|
|
428
|
+
): void {
|
|
429
|
+
this.managedWindowAlwaysOnTopCallback = cb;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Optionally handle trusted external URLs inside an app-managed window.
|
|
434
|
+
*/
|
|
435
|
+
setOpenExternalHandler(
|
|
436
|
+
cb: ((url: string) => boolean | Promise<boolean>) | null,
|
|
437
|
+
): void {
|
|
438
|
+
this.openExternalHandler = cb;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
setRequestQuitCallback(cb: (() => void | Promise<void>) | null): void {
|
|
442
|
+
this.requestQuitCallback = cb;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
setRestoreMainWindowCallback(cb: (() => void | Promise<void>) | null): void {
|
|
446
|
+
this.restoreMainWindowCallback = cb;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
clearMainWindow(window?: BrowserWindow | null): void {
|
|
450
|
+
if (!window || this.mainWindow === window) {
|
|
451
|
+
this.teardownWindowEvents(this.mainWindow);
|
|
452
|
+
this.mainWindow = null;
|
|
453
|
+
this.syncTrayFirstDock(false);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Open the settings window via the registered callback.
|
|
459
|
+
*/
|
|
460
|
+
openSettings(tabHint?: string): void {
|
|
461
|
+
this.openSettingsCallback?.(tabHint);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Open a detached surface window via the registered callback.
|
|
466
|
+
*/
|
|
467
|
+
openSurfaceWindow(
|
|
468
|
+
surface:
|
|
469
|
+
| "chat"
|
|
470
|
+
| "browser"
|
|
471
|
+
| "release"
|
|
472
|
+
| "triggers"
|
|
473
|
+
| "plugins"
|
|
474
|
+
| "connectors"
|
|
475
|
+
| "cloud",
|
|
476
|
+
browse?: string,
|
|
477
|
+
alwaysOnTop?: boolean,
|
|
478
|
+
): Promise<DesktopManagedWindowSnapshot | null> {
|
|
479
|
+
return Promise.resolve(
|
|
480
|
+
this.openSurfaceWindowCallback?.(surface, browse, alwaysOnTop) ?? null,
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
async openAppWindow(options: {
|
|
485
|
+
slug?: string;
|
|
486
|
+
title: string;
|
|
487
|
+
path: string;
|
|
488
|
+
alwaysOnTop?: boolean;
|
|
489
|
+
}): Promise<DesktopManagedWindowSnapshot | null> {
|
|
490
|
+
return this.openAppWindowCallback?.(options) ?? null;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
setManagedWindowAlwaysOnTop(id: string, flag: boolean): boolean {
|
|
494
|
+
return this.managedWindowAlwaysOnTopCallback?.(id, flag) ?? false;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
private getWindow(): BrowserWindow | null {
|
|
498
|
+
return this.mainWindow ?? null;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
private send(message: string, payload?: unknown): void {
|
|
502
|
+
if (this.sendToWebview) {
|
|
503
|
+
this.sendToWebview(message, payload);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
private ensureNativeContextMenuEvents(): void {
|
|
508
|
+
activeDesktopManager = this;
|
|
509
|
+
if (nativeContextMenuEventsInstalled) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
nativeContextMenuEventsInstalled = true;
|
|
514
|
+
ContextMenu.on("context-menu-clicked", (event) => {
|
|
515
|
+
activeDesktopManager?.handleNativeContextMenuClick(
|
|
516
|
+
event as {
|
|
517
|
+
data?: {
|
|
518
|
+
action?: string;
|
|
519
|
+
data?: { text?: string };
|
|
520
|
+
};
|
|
521
|
+
},
|
|
522
|
+
);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
private handleNativeContextMenuClick(event: {
|
|
527
|
+
data?: { action?: string; data?: { text?: string } };
|
|
528
|
+
}): void {
|
|
529
|
+
const action = event.data?.action;
|
|
530
|
+
const text = event.data?.data?.text?.trim();
|
|
531
|
+
|
|
532
|
+
if (!action) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
if (action === "copy-selection") {
|
|
537
|
+
if (text) {
|
|
538
|
+
Utils.clipboardWriteText(text);
|
|
539
|
+
}
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (!text) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
if (action === "ask-agent") {
|
|
548
|
+
this.send("contextMenuAskAgent", { text });
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (action === "quote-in-chat") {
|
|
553
|
+
this.send("contextMenuQuoteInChat", { text });
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
if (action === "create-skill") {
|
|
558
|
+
this.send("contextMenuCreateSkill", { text });
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
if (action === "save-as-command") {
|
|
563
|
+
this.send("contextMenuSaveAsCommand", { text });
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// MARK: - System Tray
|
|
568
|
+
|
|
569
|
+
async createTray(options: TrayOptions): Promise<void> {
|
|
570
|
+
if (this.tray) {
|
|
571
|
+
await this.destroyTray();
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const iconPath = this.resolveIconPath(options.icon);
|
|
575
|
+
|
|
576
|
+
this.tray = new Tray({
|
|
577
|
+
title: options.tooltip ?? options.title ?? "",
|
|
578
|
+
image: iconPath,
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
if (options.title && process.platform === "darwin") {
|
|
582
|
+
this.tray.setTitle(options.title);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
this.setTrayMenu({ menu: options.menu ?? FALLBACK_TRAY_MENU_ITEMS });
|
|
586
|
+
|
|
587
|
+
this.setupTrayEvents();
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async updateTray(options: Partial<TrayOptions>): Promise<void> {
|
|
591
|
+
if (!this.tray) return;
|
|
592
|
+
|
|
593
|
+
if (options.icon) {
|
|
594
|
+
const iconPath = this.resolveIconPath(options.icon);
|
|
595
|
+
this.tray.setImage(iconPath);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if (options.title !== undefined && process.platform === "darwin") {
|
|
599
|
+
this.tray.setTitle(options.title);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (options.menu) {
|
|
603
|
+
this.setTrayMenu({ menu: options.menu });
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
async destroyTray(): Promise<void> {
|
|
608
|
+
this.teardownTrayEvents();
|
|
609
|
+
if (this.tray) {
|
|
610
|
+
this.tray.remove();
|
|
611
|
+
this.tray = null;
|
|
612
|
+
}
|
|
613
|
+
this.trayMenuItems.clear();
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
setTrayMenu(options: { menu: TrayMenuItem[] }): void {
|
|
617
|
+
if (!this.tray) return;
|
|
618
|
+
|
|
619
|
+
const menu =
|
|
620
|
+
options.menu.length > 0 ? options.menu : FALLBACK_TRAY_MENU_ITEMS;
|
|
621
|
+
|
|
622
|
+
// Store menu items for action matching
|
|
623
|
+
this.trayMenuItems.clear();
|
|
624
|
+
this.indexMenuItems(menu);
|
|
625
|
+
|
|
626
|
+
const template = this.buildMenuTemplate(menu);
|
|
627
|
+
this.tray.setMenu(template);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Recursively index menu items by id for context-menu-clicked matching.
|
|
632
|
+
*/
|
|
633
|
+
private indexMenuItems(items: TrayMenuItem[]): void {
|
|
634
|
+
for (const item of items) {
|
|
635
|
+
if (item.id) {
|
|
636
|
+
this.trayMenuItems.set(item.id, item);
|
|
637
|
+
}
|
|
638
|
+
if (item.submenu) {
|
|
639
|
+
this.indexMenuItems(item.submenu);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Convert TrayMenuItem[] to Electrobun's menu format.
|
|
646
|
+
* Electrobun uses { type, label, action, submenu? }.
|
|
647
|
+
*/
|
|
648
|
+
private buildMenuTemplate(items: TrayMenuItem[]): MenuItemConfig[] {
|
|
649
|
+
return items.map((item): MenuItemConfig => {
|
|
650
|
+
if (item.type === "separator") {
|
|
651
|
+
return { type: "separator" };
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
const menuItem: MenuItemConfig & { type: "normal" } = {
|
|
655
|
+
type: "normal",
|
|
656
|
+
label: item.label ?? "",
|
|
657
|
+
// Use the item id as the action identifier for matching clicks
|
|
658
|
+
action: item.id,
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
if (item.enabled === false) {
|
|
662
|
+
menuItem.enabled = false;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (item.submenu) {
|
|
666
|
+
menuItem.submenu = this.buildMenuTemplate(item.submenu);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
return menuItem;
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
private setupTrayEvents(): void {
|
|
674
|
+
if (!this.tray) return;
|
|
675
|
+
|
|
676
|
+
this.teardownTrayEvents();
|
|
677
|
+
|
|
678
|
+
// Electrobun tray click is simpler — no bounds/modifiers
|
|
679
|
+
this.trayClickHandler = () => {
|
|
680
|
+
void this.showWindow().catch((err: unknown) => {
|
|
681
|
+
logger.warn(
|
|
682
|
+
`[Desktop] Failed to show window from tray click: ${err instanceof Error ? err.message : String(err)}`,
|
|
683
|
+
);
|
|
684
|
+
});
|
|
685
|
+
this.send("desktopTrayClick", {
|
|
686
|
+
x: 0,
|
|
687
|
+
y: 0,
|
|
688
|
+
button: "left",
|
|
689
|
+
modifiers: { alt: false, shift: false, ctrl: false, meta: false },
|
|
690
|
+
});
|
|
691
|
+
};
|
|
692
|
+
this.tray.on("tray-clicked", this.trayClickHandler);
|
|
693
|
+
|
|
694
|
+
const triggerAgentRestart = () => {
|
|
695
|
+
// Lazy import to avoid circular dependency (agent → desktop → agent).
|
|
696
|
+
import("./agent").then(({ getAgentManager }) => {
|
|
697
|
+
getAgentManager()
|
|
698
|
+
.restart()
|
|
699
|
+
.catch((err: unknown) => {
|
|
700
|
+
logger.error(
|
|
701
|
+
`[Desktop] Agent restart failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
702
|
+
);
|
|
703
|
+
});
|
|
704
|
+
});
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
// Tray menu item clicks fire "tray-clicked" on the global event bus
|
|
708
|
+
// (NOT "context-menu-clicked" — that's for right-click context menus).
|
|
709
|
+
// The event data shape is { data: { id, action, data? } }.
|
|
710
|
+
// Electrobun emits ElectrobunEvent<TrayClickedData> for tray-clicked;
|
|
711
|
+
// the shape carries { data: { action, id, data? } }.
|
|
712
|
+
this.contextMenuHandler = ((e: { data?: { action?: string } }): void => {
|
|
713
|
+
const action = e.data?.action;
|
|
714
|
+
if (!action) return;
|
|
715
|
+
|
|
716
|
+
// Native actions — these must work even when the renderer RPC bridge
|
|
717
|
+
// is not yet connected (e.g. PGLite init on Windows can take 240s).
|
|
718
|
+
if (action === "show" || action === "tray-show-window") {
|
|
719
|
+
void this.showWindow().catch((err: unknown) => {
|
|
720
|
+
logger.warn(
|
|
721
|
+
`[Desktop] Failed to show window from tray menu: ${err instanceof Error ? err.message : String(err)}`,
|
|
722
|
+
);
|
|
723
|
+
});
|
|
724
|
+
} else if (action === "tray-hide-window") {
|
|
725
|
+
void this.hideWindow().catch((err: unknown) => {
|
|
726
|
+
logger.warn(
|
|
727
|
+
`[Desktop] Failed to hide window from tray menu: ${err instanceof Error ? err.message : String(err)}`,
|
|
728
|
+
);
|
|
729
|
+
});
|
|
730
|
+
} else if (action === "restart-agent" || action === "tray-restart") {
|
|
731
|
+
triggerAgentRestart();
|
|
732
|
+
} else if (action === "quit") {
|
|
733
|
+
Utils.quit();
|
|
734
|
+
} else if (action === "open-settings") {
|
|
735
|
+
this.openSettingsCallback?.();
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// Renderer notification for all items
|
|
739
|
+
const menuItem = this.trayMenuItems.get(action);
|
|
740
|
+
if (menuItem) {
|
|
741
|
+
this.send("desktopTrayMenuClick", {
|
|
742
|
+
itemId: menuItem.id,
|
|
743
|
+
checked:
|
|
744
|
+
menuItem.type === "checkbox" ? !menuItem.checked : menuItem.checked,
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
}) as ElectrobunEventHandler;
|
|
748
|
+
Electrobun.events.on(
|
|
749
|
+
"tray-clicked",
|
|
750
|
+
this.contextMenuHandler as ElectrobunEventHandler,
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
private teardownTrayEvents(): void {
|
|
755
|
+
this.removeEventHandler(this.tray, "tray-clicked", this.trayClickHandler);
|
|
756
|
+
this.removeEventHandler(
|
|
757
|
+
Electrobun.events,
|
|
758
|
+
"tray-clicked",
|
|
759
|
+
this.contextMenuHandler,
|
|
760
|
+
);
|
|
761
|
+
this.trayClickHandler = null;
|
|
762
|
+
this.contextMenuHandler = null;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
private removeEventHandler(
|
|
766
|
+
target: unknown,
|
|
767
|
+
event: string,
|
|
768
|
+
handler: ElectrobunEventHandler | null | undefined,
|
|
769
|
+
): void {
|
|
770
|
+
const eventTarget = target as ElectrobunEventTarget | null | undefined;
|
|
771
|
+
if (!eventTarget || !handler) {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if (typeof eventTarget.off === "function") {
|
|
776
|
+
eventTarget.off(event, handler);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
if (typeof eventTarget.removeListener === "function") {
|
|
781
|
+
eventTarget.removeListener(event, handler);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// MARK: - Global Shortcuts
|
|
786
|
+
|
|
787
|
+
async registerShortcut(
|
|
788
|
+
options: ShortcutOptions,
|
|
789
|
+
): Promise<{ success: boolean }> {
|
|
790
|
+
// Unregister existing shortcut with same id
|
|
791
|
+
if (this.shortcuts.has(options.id)) {
|
|
792
|
+
const existing = this.shortcuts.get(options.id);
|
|
793
|
+
if (existing) {
|
|
794
|
+
GlobalShortcut.unregister(existing.accelerator);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
try {
|
|
799
|
+
GlobalShortcut.register(options.accelerator, () => {
|
|
800
|
+
this.send("desktopShortcutPressed", {
|
|
801
|
+
id: options.id,
|
|
802
|
+
accelerator: options.accelerator,
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
this.shortcuts.set(options.id, options);
|
|
806
|
+
return { success: true };
|
|
807
|
+
} catch {
|
|
808
|
+
return { success: false };
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
async unregisterShortcut(options: { id: string }): Promise<void> {
|
|
813
|
+
const shortcut = this.shortcuts.get(options.id);
|
|
814
|
+
if (shortcut) {
|
|
815
|
+
GlobalShortcut.unregister(shortcut.accelerator);
|
|
816
|
+
this.shortcuts.delete(options.id);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
async unregisterAllShortcuts(): Promise<void> {
|
|
821
|
+
GlobalShortcut.unregisterAll();
|
|
822
|
+
this.shortcuts.clear();
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
async isShortcutRegistered(options: {
|
|
826
|
+
accelerator: string;
|
|
827
|
+
}): Promise<{ registered: boolean }> {
|
|
828
|
+
return { registered: GlobalShortcut.isRegistered(options.accelerator) };
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// MARK: - Auto Launch
|
|
832
|
+
|
|
833
|
+
async setAutoLaunch(options: {
|
|
834
|
+
enabled: boolean;
|
|
835
|
+
openAsHidden?: boolean;
|
|
836
|
+
}): Promise<void> {
|
|
837
|
+
const appPath = process.execPath;
|
|
838
|
+
|
|
839
|
+
const openAsHidden = options.openAsHidden ?? false;
|
|
840
|
+
|
|
841
|
+
if (process.platform === "darwin") {
|
|
842
|
+
await this.setAutoLaunchMac(options.enabled, appPath, openAsHidden);
|
|
843
|
+
} else if (process.platform === "linux") {
|
|
844
|
+
this.setAutoLaunchLinux(options.enabled, appPath, openAsHidden);
|
|
845
|
+
} else if (process.platform === "win32") {
|
|
846
|
+
await this.setAutoLaunchWin(options.enabled, appPath, openAsHidden);
|
|
847
|
+
} else {
|
|
848
|
+
logger.warn(
|
|
849
|
+
`[DesktopManager] setAutoLaunch: unsupported platform ${process.platform}`,
|
|
850
|
+
);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
async getAutoLaunchStatus(): Promise<{
|
|
855
|
+
enabled: boolean;
|
|
856
|
+
openAsHidden: boolean;
|
|
857
|
+
}> {
|
|
858
|
+
if (process.platform === "darwin") {
|
|
859
|
+
const plistPath = this.getMacLaunchAgentPath();
|
|
860
|
+
if (!fs.existsSync(plistPath))
|
|
861
|
+
return { enabled: false, openAsHidden: false };
|
|
862
|
+
const content = fs.readFileSync(plistPath, "utf8");
|
|
863
|
+
return { enabled: true, openAsHidden: content.includes("--hidden") };
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
if (process.platform === "linux") {
|
|
867
|
+
const desktopPath = this.getLinuxAutostartPath();
|
|
868
|
+
if (!fs.existsSync(desktopPath))
|
|
869
|
+
return { enabled: false, openAsHidden: false };
|
|
870
|
+
const content = fs.readFileSync(desktopPath, "utf8");
|
|
871
|
+
return { enabled: true, openAsHidden: content.includes("--hidden") };
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
if (process.platform === "win32") {
|
|
875
|
+
const { enabled, openAsHidden } = await this.getAutoLaunchStatusWin();
|
|
876
|
+
return { enabled, openAsHidden };
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
return { enabled: false, openAsHidden: false };
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// MARK: - Auto-launch helpers (macOS)
|
|
883
|
+
|
|
884
|
+
private getMacLaunchAgentPath(): string {
|
|
885
|
+
return path.join(
|
|
886
|
+
os.homedir(),
|
|
887
|
+
"Library",
|
|
888
|
+
"LaunchAgents",
|
|
889
|
+
getBrandConfig().macLaunchAgentPlist,
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
private async setAutoLaunchMac(
|
|
894
|
+
enabled: boolean,
|
|
895
|
+
appPath: string,
|
|
896
|
+
openAsHidden = false,
|
|
897
|
+
): Promise<void> {
|
|
898
|
+
const plistPath = this.getMacLaunchAgentPath();
|
|
899
|
+
|
|
900
|
+
if (enabled) {
|
|
901
|
+
const hiddenArg = openAsHidden ? "\n <string>--hidden</string>" : "";
|
|
902
|
+
const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
888
903
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
889
904
|
<plist version="1.0">
|
|
890
905
|
<dict>
|
|
@@ -901,1406 +916,1431 @@ export class DesktopManager {
|
|
|
901
916
|
</dict>
|
|
902
917
|
</plist>
|
|
903
918
|
`;
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
919
|
+
const dir = path.dirname(plistPath);
|
|
920
|
+
if (!fs.existsSync(dir)) {
|
|
921
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
922
|
+
}
|
|
923
|
+
fs.writeFileSync(plistPath, plistContent, "utf8");
|
|
924
|
+
|
|
925
|
+
const proc = Bun.spawn(["launchctl", "load", plistPath], {
|
|
926
|
+
stdout: "pipe",
|
|
927
|
+
stderr: "pipe",
|
|
928
|
+
});
|
|
929
|
+
await proc.exited;
|
|
930
|
+
} else {
|
|
931
|
+
if (fs.existsSync(plistPath)) {
|
|
932
|
+
const proc = Bun.spawn(["launchctl", "unload", plistPath], {
|
|
933
|
+
stdout: "pipe",
|
|
934
|
+
stderr: "pipe",
|
|
935
|
+
});
|
|
936
|
+
await proc.exited;
|
|
937
|
+
fs.unlinkSync(plistPath);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// MARK: - Auto-launch helpers (Linux)
|
|
943
|
+
|
|
944
|
+
private getLinuxAutostartPath(): string {
|
|
945
|
+
return path.join(
|
|
946
|
+
os.homedir(),
|
|
947
|
+
".config",
|
|
948
|
+
"autostart",
|
|
949
|
+
getBrandConfig().linuxDesktopFileName,
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
private setAutoLaunchLinux(
|
|
954
|
+
enabled: boolean,
|
|
955
|
+
appPath: string,
|
|
956
|
+
openAsHidden = false,
|
|
957
|
+
): void {
|
|
958
|
+
const desktopPath = this.getLinuxAutostartPath();
|
|
959
|
+
|
|
960
|
+
if (enabled) {
|
|
961
|
+
const execLine = openAsHidden ? `${appPath} --hidden` : appPath;
|
|
962
|
+
const desktopContent = `[Desktop Entry]
|
|
948
963
|
Type=Application
|
|
949
964
|
Name=${getBrandConfig().linuxDesktopEntryName}
|
|
950
965
|
Exec=${execLine}
|
|
951
966
|
X-GNOME-Autostart-enabled=true
|
|
952
967
|
`;
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
968
|
+
const dir = path.dirname(desktopPath);
|
|
969
|
+
if (!fs.existsSync(dir)) {
|
|
970
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
971
|
+
}
|
|
972
|
+
fs.writeFileSync(desktopPath, desktopContent, "utf8");
|
|
973
|
+
} else {
|
|
974
|
+
if (fs.existsSync(desktopPath)) {
|
|
975
|
+
fs.unlinkSync(desktopPath);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
// MARK: - Auto-launch helpers (Windows)
|
|
981
|
+
|
|
982
|
+
private readonly WIN_REG_KEY =
|
|
983
|
+
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
|
|
984
|
+
|
|
985
|
+
private async setAutoLaunchWin(
|
|
986
|
+
enabled: boolean,
|
|
987
|
+
appPath: string,
|
|
988
|
+
openAsHidden = false,
|
|
989
|
+
): Promise<void> {
|
|
990
|
+
if (enabled) {
|
|
991
|
+
const launchValue = openAsHidden ? `${appPath} --hidden` : appPath;
|
|
992
|
+
const proc = Bun.spawn(
|
|
993
|
+
[
|
|
994
|
+
"reg",
|
|
995
|
+
"add",
|
|
996
|
+
this.WIN_REG_KEY,
|
|
997
|
+
"/v",
|
|
998
|
+
getBrandConfig().windowsRegistryValueName,
|
|
999
|
+
"/t",
|
|
1000
|
+
"REG_SZ",
|
|
1001
|
+
"/d",
|
|
1002
|
+
launchValue,
|
|
1003
|
+
"/f",
|
|
1004
|
+
],
|
|
1005
|
+
{ stdout: "pipe", stderr: "pipe" },
|
|
1006
|
+
);
|
|
1007
|
+
await proc.exited;
|
|
1008
|
+
} else {
|
|
1009
|
+
const proc = Bun.spawn(
|
|
1010
|
+
[
|
|
1011
|
+
"reg",
|
|
1012
|
+
"delete",
|
|
1013
|
+
this.WIN_REG_KEY,
|
|
1014
|
+
"/v",
|
|
1015
|
+
getBrandConfig().windowsRegistryValueName,
|
|
1016
|
+
"/f",
|
|
1017
|
+
],
|
|
1018
|
+
{ stdout: "pipe", stderr: "pipe" },
|
|
1019
|
+
);
|
|
1020
|
+
await proc.exited;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
private async getAutoLaunchStatusWin(): Promise<{
|
|
1025
|
+
enabled: boolean;
|
|
1026
|
+
openAsHidden: boolean;
|
|
1027
|
+
}> {
|
|
1028
|
+
try {
|
|
1029
|
+
const proc = Bun.spawn(
|
|
1030
|
+
[
|
|
1031
|
+
"reg",
|
|
1032
|
+
"query",
|
|
1033
|
+
this.WIN_REG_KEY,
|
|
1034
|
+
"/v",
|
|
1035
|
+
getBrandConfig().windowsRegistryValueName,
|
|
1036
|
+
],
|
|
1037
|
+
{ stdout: "pipe", stderr: "pipe" },
|
|
1038
|
+
);
|
|
1039
|
+
const [stdout] = await Promise.all([
|
|
1040
|
+
new Response(proc.stdout).text(),
|
|
1041
|
+
proc.exited,
|
|
1042
|
+
]);
|
|
1043
|
+
if (!stdout.includes(getBrandConfig().windowsRegistryValueName))
|
|
1044
|
+
return { enabled: false, openAsHidden: false };
|
|
1045
|
+
return { enabled: true, openAsHidden: stdout.includes("--hidden") };
|
|
1046
|
+
} catch {
|
|
1047
|
+
return { enabled: false, openAsHidden: false };
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
// MARK: - Window Management
|
|
1052
|
+
|
|
1053
|
+
async setWindowOptions(options: WindowOptions): Promise<void> {
|
|
1054
|
+
const win = this.getWindow();
|
|
1055
|
+
if (!win) return;
|
|
1056
|
+
|
|
1057
|
+
if (options.width !== undefined || options.height !== undefined) {
|
|
1058
|
+
const { width: currentW, height: currentH } = win.getSize();
|
|
1059
|
+
win.setSize(options.width ?? currentW, options.height ?? currentH);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
if (options.x !== undefined || options.y !== undefined) {
|
|
1063
|
+
const { x: currentX, y: currentY } = win.getPosition();
|
|
1064
|
+
win.setPosition(options.x ?? currentX, options.y ?? currentY);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
// minWidth/minHeight/maxWidth/maxHeight — not directly supported
|
|
1068
|
+
// in Electrobun BrowserWindow. Skip silently.
|
|
1069
|
+
|
|
1070
|
+
if (options.alwaysOnTop !== undefined) {
|
|
1071
|
+
win.setAlwaysOnTop(options.alwaysOnTop);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
if (options.fullscreen !== undefined) {
|
|
1075
|
+
win.setFullScreen(options.fullscreen);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// opacity — no setOpacity in Electrobun (no-op)
|
|
1079
|
+
if (options.opacity !== undefined) {
|
|
1080
|
+
// No-op: Electrobun BrowserWindow does not support setOpacity
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
if (options.title !== undefined) {
|
|
1084
|
+
win.setTitle(options.title);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// resizable — not directly settable post-creation in Electrobun.
|
|
1088
|
+
// Skip silently.
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
async getWindowBounds(): Promise<WindowBounds> {
|
|
1092
|
+
const win = this.getWindow();
|
|
1093
|
+
if (!win) return { x: 0, y: 0, width: 0, height: 0 };
|
|
1094
|
+
const { x, y } = win.getPosition();
|
|
1095
|
+
const { width, height } = win.getSize();
|
|
1096
|
+
return { x, y, width, height };
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
async setWindowBounds(options: WindowBounds): Promise<void> {
|
|
1100
|
+
const win = this.getWindow();
|
|
1101
|
+
if (!win) return;
|
|
1102
|
+
win.setPosition(options.x, options.y);
|
|
1103
|
+
win.setSize(options.width, options.height);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
async minimizeWindow(): Promise<void> {
|
|
1107
|
+
this.getWindow()?.minimize();
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
async unminimizeWindow(): Promise<void> {
|
|
1111
|
+
this.getWindow()?.unminimize();
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
async maximizeWindow(): Promise<void> {
|
|
1115
|
+
this.getWindow()?.maximize();
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
async unmaximizeWindow(): Promise<void> {
|
|
1119
|
+
this.getWindow()?.unmaximize();
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
async closeWindow(): Promise<void> {
|
|
1123
|
+
if (process.env.ELIZAOS_CLOSE_MINIMIZES_TO_TRAY !== "0") {
|
|
1124
|
+
await this.hideWindow();
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
this.getWindow()?.close();
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
async showWindow(): Promise<void> {
|
|
1131
|
+
let win = this.mainWindow;
|
|
1132
|
+
if (!win) {
|
|
1133
|
+
await this.restoreMainWindowCallback?.();
|
|
1134
|
+
win = this.mainWindow;
|
|
1135
|
+
}
|
|
1136
|
+
if (!win) return;
|
|
1137
|
+
try {
|
|
1138
|
+
this.showMainWindow(win);
|
|
1139
|
+
} catch {
|
|
1140
|
+
this.clearMainWindow(win);
|
|
1141
|
+
await this.restoreMainWindowCallback?.();
|
|
1142
|
+
win = this.mainWindow;
|
|
1143
|
+
if (!win) return;
|
|
1144
|
+
this.showMainWindow(win);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
async hideWindow(): Promise<void> {
|
|
1149
|
+
const win = this.mainWindow;
|
|
1150
|
+
if (!win) return;
|
|
1151
|
+
const ptr = (win as { ptr?: unknown }).ptr;
|
|
1152
|
+
if (ptr && process.platform === "darwin") {
|
|
1153
|
+
// orderOut removes the window from screen AND Cmd+Tab / Mission Control
|
|
1154
|
+
orderOut(ptr as Parameters<typeof orderOut>[0]);
|
|
1155
|
+
} else {
|
|
1156
|
+
// Non-macOS fallback: minimize
|
|
1157
|
+
win.minimize();
|
|
1158
|
+
}
|
|
1159
|
+
this._windowHidden = true;
|
|
1160
|
+
this.syncTrayFirstDock(false);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
async focusWindow(): Promise<void> {
|
|
1164
|
+
this.getWindow()?.focus();
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
async isWindowMaximized(): Promise<{ maximized: boolean }> {
|
|
1168
|
+
const win = this.getWindow();
|
|
1169
|
+
return { maximized: win ? win.isMaximized() : false };
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
async isWindowMinimized(): Promise<{ minimized: boolean }> {
|
|
1173
|
+
const win = this.getWindow();
|
|
1174
|
+
return { minimized: win ? win.isMinimized() : false };
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
async isWindowVisible(): Promise<{ visible: boolean }> {
|
|
1178
|
+
if (this._windowHidden) return { visible: false };
|
|
1179
|
+
const win = this.getWindow();
|
|
1180
|
+
if (!win) return { visible: false };
|
|
1181
|
+
return { visible: !win.isMinimized() };
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
async isWindowFocused(): Promise<{ focused: boolean }> {
|
|
1185
|
+
return { focused: this._windowFocused };
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
async setAlwaysOnTop(options: SetAlwaysOnTopOptions): Promise<void> {
|
|
1189
|
+
// Electrobun setAlwaysOnTop takes a boolean — ignore level
|
|
1190
|
+
this.getWindow()?.setAlwaysOnTop(options.flag);
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
async setFullscreen(options: SetFullscreenOptions): Promise<void> {
|
|
1194
|
+
this.getWindow()?.setFullScreen(options.flag);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
async setOpacity(_options: SetOpacityOptions): Promise<void> {
|
|
1198
|
+
// No-op: Electrobun BrowserWindow does not support setOpacity
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
private showMainWindow(win: BrowserWindow): void {
|
|
1202
|
+
const ptr = (win as { ptr?: unknown }).ptr;
|
|
1203
|
+
if (ptr && process.platform === "darwin") {
|
|
1204
|
+
makeKeyAndOrderFront(ptr as Parameters<typeof makeKeyAndOrderFront>[0]);
|
|
1205
|
+
} else {
|
|
1206
|
+
win.show();
|
|
1207
|
+
win.focus();
|
|
1208
|
+
}
|
|
1209
|
+
this._windowHidden = false;
|
|
1210
|
+
this.syncTrayFirstDock(true);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
private setupWindowEvents(): void {
|
|
1214
|
+
const win = this.mainWindow;
|
|
1215
|
+
if (!win) return;
|
|
1216
|
+
|
|
1217
|
+
const focusHandler = () => {
|
|
1218
|
+
this._windowFocused = true;
|
|
1219
|
+
this.send("desktopWindowFocus");
|
|
1220
|
+
};
|
|
1221
|
+
this.windowEventHandlers.focus = focusHandler;
|
|
1222
|
+
win.on("focus", focusHandler);
|
|
1223
|
+
|
|
1224
|
+
// Blur via native event (Electrobun may not surface this, but try it for free)
|
|
1225
|
+
const blurHandler = () => {
|
|
1226
|
+
this._windowFocused = false;
|
|
1227
|
+
this.send("desktopWindowBlur");
|
|
1228
|
+
};
|
|
1229
|
+
this.windowEventHandlers.blur = blurHandler;
|
|
1230
|
+
win.on("blur", blurHandler);
|
|
1231
|
+
|
|
1232
|
+
const closeHandler = () => {
|
|
1233
|
+
this.send("desktopWindowClose");
|
|
1234
|
+
};
|
|
1235
|
+
this.windowEventHandlers.close = closeHandler;
|
|
1236
|
+
win.on("close", closeHandler);
|
|
1237
|
+
|
|
1238
|
+
const resizeHandler = () => {
|
|
1239
|
+
// Electrobun fires resize but doesn't distinguish maximize/unmaximize.
|
|
1240
|
+
// We detect state changes to emit the right event.
|
|
1241
|
+
if (win.isMaximized()) {
|
|
1242
|
+
this.send("desktopWindowMaximize");
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1245
|
+
this.windowEventHandlers.resize = resizeHandler;
|
|
1246
|
+
win.on("resize", resizeHandler);
|
|
1247
|
+
|
|
1248
|
+
let wasMaximized = false;
|
|
1249
|
+
const moveHandler = () => {
|
|
1250
|
+
// Only emit desktopWindowUnmaximize when transitioning FROM maximized
|
|
1251
|
+
// to not-maximized, not on every move during a normal window drag.
|
|
1252
|
+
const isMaximized = win.isMaximized();
|
|
1253
|
+
if (wasMaximized && !isMaximized) {
|
|
1254
|
+
this.send("desktopWindowUnmaximize");
|
|
1255
|
+
}
|
|
1256
|
+
wasMaximized = isMaximized;
|
|
1257
|
+
};
|
|
1258
|
+
this.windowEventHandlers.move = moveHandler;
|
|
1259
|
+
win.on("move", moveHandler);
|
|
1260
|
+
|
|
1261
|
+
// Blur fallback: poll [NSWindow isKeyWindow] at 2Hz on macOS.
|
|
1262
|
+
// Electrobun does not guarantee blur events, so this gives bounded
|
|
1263
|
+
// ≤500ms latency for focus-loss detection.
|
|
1264
|
+
if (process.platform === "darwin") {
|
|
1265
|
+
this._startFocusPoller();
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
private teardownWindowEvents(window: BrowserWindow | null): void {
|
|
1270
|
+
if (!window) {
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
this.removeEventHandler(window, "focus", this.windowEventHandlers.focus);
|
|
1275
|
+
this.removeEventHandler(window, "blur", this.windowEventHandlers.blur);
|
|
1276
|
+
this.removeEventHandler(window, "close", this.windowEventHandlers.close);
|
|
1277
|
+
this.removeEventHandler(window, "resize", this.windowEventHandlers.resize);
|
|
1278
|
+
this.removeEventHandler(window, "move", this.windowEventHandlers.move);
|
|
1279
|
+
this.windowEventHandlers = {};
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
private _startFocusPoller(): void {
|
|
1283
|
+
if (this._focusPoller) return;
|
|
1284
|
+
this._focusPoller = setInterval(() => {
|
|
1285
|
+
const win = this.mainWindow;
|
|
1286
|
+
if (!win) return;
|
|
1287
|
+
|
|
1288
|
+
// Electrobun does not expose an application activation callback.
|
|
1289
|
+
// When the app becomes foreground again with only a minimized window
|
|
1290
|
+
// (for example via Dock click), restore it automatically.
|
|
1291
|
+
const appActive = isAppActive();
|
|
1292
|
+
if (!this._appActive && appActive && win.isMinimized()) {
|
|
1293
|
+
void this.showWindow();
|
|
1294
|
+
}
|
|
1295
|
+
this._appActive = appActive;
|
|
1296
|
+
|
|
1297
|
+
const ptr = (win as { ptr?: unknown }).ptr;
|
|
1298
|
+
if (!ptr) return;
|
|
1299
|
+
const focused = isKeyWindow(ptr as Parameters<typeof isKeyWindow>[0]);
|
|
1300
|
+
if (focused !== this._windowFocused) {
|
|
1301
|
+
this._windowFocused = focused;
|
|
1302
|
+
if (!focused) {
|
|
1303
|
+
this.send("desktopWindowBlur");
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
}, 500);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
// MARK: - Notifications
|
|
1310
|
+
|
|
1311
|
+
async showNotification(
|
|
1312
|
+
options: NotificationOptions,
|
|
1313
|
+
): Promise<{ id: string }> {
|
|
1314
|
+
const id = `notification_${++this.notificationCounter}`;
|
|
1315
|
+
|
|
1316
|
+
// Electrobun Utils.showNotification — fire-and-forget, no event callbacks
|
|
1317
|
+
Utils.showNotification({
|
|
1318
|
+
title: options.title,
|
|
1319
|
+
body: options.body,
|
|
1320
|
+
subtitle: undefined,
|
|
1321
|
+
silent: options.silent,
|
|
1322
|
+
});
|
|
1323
|
+
|
|
1324
|
+
return { id };
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
async closeNotification(_options: { id: string }): Promise<void> {
|
|
1328
|
+
// Electrobun does not support programmatic notification dismissal.
|
|
1329
|
+
// No-op.
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
// MARK: - Power Monitor
|
|
1333
|
+
|
|
1334
|
+
async getPowerState(): Promise<PowerState> {
|
|
1335
|
+
try {
|
|
1336
|
+
if (process.platform === "darwin") {
|
|
1337
|
+
const powerSource = parseMacOsPowerSourceOutput(
|
|
1338
|
+
await readProcessStdout(["pmset", "-g", "batt"]),
|
|
1339
|
+
);
|
|
1340
|
+
const idleTime =
|
|
1341
|
+
parseMacOsHidIdleTimeOutput(
|
|
1342
|
+
await readProcessStdout(["ioreg", "-c", "IOHIDSystem"]),
|
|
1343
|
+
) ?? 0;
|
|
1344
|
+
const locked = fs.existsSync(MACOS_CGSESSION_PATH)
|
|
1345
|
+
? parseMacOsSessionLockedOutput(
|
|
1346
|
+
await readProcessStdout([
|
|
1347
|
+
MACOS_CGSESSION_PATH,
|
|
1348
|
+
"-currentSession",
|
|
1349
|
+
]),
|
|
1350
|
+
)
|
|
1351
|
+
: null;
|
|
1352
|
+
const idleState =
|
|
1353
|
+
locked === true
|
|
1354
|
+
? "locked"
|
|
1355
|
+
: idleTime >= MACOS_IDLE_THRESHOLD_SECONDS
|
|
1356
|
+
? "idle"
|
|
1357
|
+
: locked === false
|
|
1358
|
+
? "active"
|
|
1359
|
+
: "unknown";
|
|
1360
|
+
return {
|
|
1361
|
+
onBattery: powerSource.known ? powerSource.onBattery : false,
|
|
1362
|
+
idleState,
|
|
1363
|
+
idleTime,
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
if (process.platform === "linux") {
|
|
1367
|
+
const idleOutput = await readProcessStdoutSafe(["xprintidle"]);
|
|
1368
|
+
const idleTime =
|
|
1369
|
+
idleOutput !== null ? (parseXprintidleOutput(idleOutput) ?? 0) : 0;
|
|
1370
|
+
const locked = await readLinuxLockedHint();
|
|
1371
|
+
const idleState =
|
|
1372
|
+
locked === true
|
|
1373
|
+
? "locked"
|
|
1374
|
+
: idleOutput === null
|
|
1375
|
+
? "unknown"
|
|
1376
|
+
: idleTime >= LINUX_IDLE_THRESHOLD_SECONDS
|
|
1377
|
+
? "idle"
|
|
1378
|
+
: locked === false
|
|
1379
|
+
? "active"
|
|
1380
|
+
: "active";
|
|
1381
|
+
return {
|
|
1382
|
+
onBattery: linuxSysfsOnBattery(),
|
|
1383
|
+
idleState,
|
|
1384
|
+
idleTime,
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
if (process.platform === "win32") {
|
|
1388
|
+
const batteryOutput = await readProcessStdoutSafe([
|
|
1389
|
+
"powershell",
|
|
1390
|
+
"-NoProfile",
|
|
1391
|
+
"-NoLogo",
|
|
1392
|
+
"-Command",
|
|
1393
|
+
"Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::PowerStatus.PowerLineStatus.ToString()",
|
|
1394
|
+
]);
|
|
1395
|
+
const batteryParsed = batteryOutput
|
|
1396
|
+
? parseWindowsPowerLineOutput(batteryOutput)
|
|
1397
|
+
: { onBattery: false, known: false };
|
|
1398
|
+
const idleOutput = await readProcessStdoutSafe([
|
|
1399
|
+
"powershell",
|
|
1400
|
+
"-NoProfile",
|
|
1401
|
+
"-NoLogo",
|
|
1402
|
+
"-Command",
|
|
1403
|
+
WINDOWS_IDLE_POWERSHELL_SCRIPT,
|
|
1404
|
+
]);
|
|
1405
|
+
const idleTime =
|
|
1406
|
+
idleOutput !== null
|
|
1407
|
+
? (parseWindowsIdleTimeOutput(idleOutput) ?? 0)
|
|
1408
|
+
: 0;
|
|
1409
|
+
const lockOutput = await readProcessStdoutSafe([
|
|
1410
|
+
"powershell",
|
|
1411
|
+
"-NoProfile",
|
|
1412
|
+
"-NoLogo",
|
|
1413
|
+
"-Command",
|
|
1414
|
+
"(Get-Process logonui -ErrorAction SilentlyContinue).Count",
|
|
1415
|
+
]);
|
|
1416
|
+
const locked = lockOutput
|
|
1417
|
+
? parseWindowsLockStateOutput(lockOutput)
|
|
1418
|
+
: null;
|
|
1419
|
+
const idleState =
|
|
1420
|
+
locked === true
|
|
1421
|
+
? "locked"
|
|
1422
|
+
: idleOutput === null
|
|
1423
|
+
? "unknown"
|
|
1424
|
+
: idleTime >= WINDOWS_IDLE_THRESHOLD_SECONDS
|
|
1425
|
+
? "idle"
|
|
1426
|
+
: "active";
|
|
1427
|
+
return {
|
|
1428
|
+
onBattery: batteryParsed.known ? batteryParsed.onBattery : false,
|
|
1429
|
+
idleState,
|
|
1430
|
+
idleTime,
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
} catch {
|
|
1434
|
+
// Fall through to stub below
|
|
1435
|
+
}
|
|
1436
|
+
return { onBattery: false, idleState: "unknown", idleTime: 0 };
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
// MARK: - App
|
|
1440
|
+
|
|
1441
|
+
private async beginAppExit(reason: string): Promise<void> {
|
|
1442
|
+
if (this.appExitStarted) {
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
this.appExitStarted = true;
|
|
1446
|
+
await this.showWindow().catch(() => {});
|
|
1447
|
+
this.send("desktopShutdownStarted", { reason });
|
|
1448
|
+
await new Promise((resolve) => setTimeout(resolve, 150));
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
async quit(): Promise<void> {
|
|
1452
|
+
await this.beginAppExit("desktop-quit");
|
|
1453
|
+
if (this.requestQuitCallback) {
|
|
1454
|
+
await this.requestQuitCallback();
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
Utils.quit();
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
async relaunch(): Promise<void> {
|
|
1461
|
+
await this.beginAppExit("desktop-relaunch");
|
|
1462
|
+
try {
|
|
1463
|
+
const child = Bun.spawn([process.execPath, ...process.argv.slice(1)], {
|
|
1464
|
+
detached: true,
|
|
1465
|
+
stdout: "ignore",
|
|
1466
|
+
stderr: "ignore",
|
|
1467
|
+
stdin: "ignore",
|
|
1468
|
+
});
|
|
1469
|
+
// Detach so the new instance survives the parent quitting
|
|
1470
|
+
child.unref();
|
|
1471
|
+
} catch (err) {
|
|
1472
|
+
logger.error(
|
|
1473
|
+
`[DesktopManager] relaunch: failed to spawn new instance: ${err instanceof Error ? err.message : String(err)}`,
|
|
1474
|
+
);
|
|
1475
|
+
}
|
|
1476
|
+
Utils.quit();
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
async getVersion(): Promise<VersionInfo> {
|
|
1480
|
+
let version = "0.0.0";
|
|
1481
|
+
try {
|
|
1482
|
+
version = await Updater.localInfo.version();
|
|
1483
|
+
} catch {
|
|
1484
|
+
// Updater may not be available in dev
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
return {
|
|
1488
|
+
version,
|
|
1489
|
+
name: getBrandConfig().appName,
|
|
1490
|
+
runtime: `electrobun/${Bun.version}`,
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
async isPackaged(): Promise<{ packaged: boolean }> {
|
|
1495
|
+
// In Electrobun, check if running from a built bundle
|
|
1496
|
+
// DEV mode typically has specific env flags
|
|
1497
|
+
return {
|
|
1498
|
+
packaged:
|
|
1499
|
+
process.env.NODE_ENV === "production" || !process.env.ELECTROBUN_DEV,
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
async getPath(options: { name: string }): Promise<{ path: string }> {
|
|
1504
|
+
const mapped = PATH_NAME_MAP[options.name];
|
|
1505
|
+
if (typeof mapped === "function") {
|
|
1506
|
+
return { path: mapped() };
|
|
1507
|
+
}
|
|
1508
|
+
if (typeof mapped === "string") {
|
|
1509
|
+
return { path: mapped };
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
// Fallback: try to return a sensible default under userData
|
|
1513
|
+
logger.warn(
|
|
1514
|
+
`[DesktopManager] Unknown path name "${options.name}", falling back to userData`,
|
|
1515
|
+
);
|
|
1516
|
+
return { path: Utils.paths.userData };
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
async getStartupDiagnostics(): Promise<{
|
|
1520
|
+
state: "not_started" | "starting" | "running" | "stopped" | "error";
|
|
1521
|
+
phase: string;
|
|
1522
|
+
updatedAt: string;
|
|
1523
|
+
lastError: string | null;
|
|
1524
|
+
agentName: string | null;
|
|
1525
|
+
port: number | null;
|
|
1526
|
+
startedAt: number | null;
|
|
1527
|
+
platform: string;
|
|
1528
|
+
arch: string;
|
|
1529
|
+
configDir: string;
|
|
1530
|
+
logPath: string;
|
|
1531
|
+
statusPath: string;
|
|
1532
|
+
database: DatabaseSnapshot;
|
|
1533
|
+
logTail: string;
|
|
1534
|
+
appVersion?: string;
|
|
1535
|
+
appRuntime?: string;
|
|
1536
|
+
packaged?: boolean;
|
|
1537
|
+
locale?: string;
|
|
1538
|
+
}> {
|
|
1539
|
+
const snapshot = getStartupDiagnosticsSnapshot();
|
|
1540
|
+
const version = await this.getVersion();
|
|
1541
|
+
const packaged = await this.isPackaged();
|
|
1542
|
+
const locale = Intl.DateTimeFormat().resolvedOptions().locale;
|
|
1543
|
+
return {
|
|
1544
|
+
...snapshot,
|
|
1545
|
+
logTail: getStartupDiagnosticLogTail(),
|
|
1546
|
+
appVersion: version.version,
|
|
1547
|
+
appRuntime: version.runtime,
|
|
1548
|
+
packaged: packaged.packaged,
|
|
1549
|
+
locale,
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
async openLogsFolder(): Promise<void> {
|
|
1554
|
+
const diagnostics = getStartupDiagnosticsSnapshot();
|
|
1555
|
+
const folderPath = path.dirname(diagnostics.logPath);
|
|
1556
|
+
Utils.openPath(folderPath);
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
async createBugReportBundle(options: {
|
|
1560
|
+
reportMarkdown: string;
|
|
1561
|
+
reportJson: Record<string, unknown>;
|
|
1562
|
+
prefix?: string;
|
|
1563
|
+
}): Promise<{
|
|
1564
|
+
directory: string;
|
|
1565
|
+
reportMarkdownPath: string;
|
|
1566
|
+
reportJsonPath: string;
|
|
1567
|
+
startupLogPath: string | null;
|
|
1568
|
+
startupStatusPath: string | null;
|
|
1569
|
+
}> {
|
|
1570
|
+
return createBugReportBundle(options);
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
async checkForUpdates(): Promise<DesktopUpdaterSnapshot> {
|
|
1574
|
+
const availability = this.getUpdaterAvailability();
|
|
1575
|
+
if (!availability.canAutoUpdate) {
|
|
1576
|
+
return this.buildUpdaterSnapshot(undefined, availability);
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
try {
|
|
1580
|
+
const result = await Updater.checkForUpdate();
|
|
1581
|
+
if (result.updateAvailable) {
|
|
1582
|
+
void this.downloadUpdateWithRetry().catch((error: unknown) => {
|
|
1583
|
+
logger.warn(
|
|
1584
|
+
`[Desktop] Update download failed after retries: ${error instanceof Error ? error.message : String(error)}`,
|
|
1585
|
+
);
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
return await this.getUpdaterState();
|
|
1589
|
+
} catch (error) {
|
|
1590
|
+
return this.buildUpdaterSnapshot(error, availability);
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
async getUpdaterState(): Promise<DesktopUpdaterSnapshot> {
|
|
1595
|
+
return this.buildUpdaterSnapshot();
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
private async downloadUpdateWithRetry(
|
|
1599
|
+
maxAttempts = 3,
|
|
1600
|
+
baseDelayMs = 2_000,
|
|
1601
|
+
): Promise<void> {
|
|
1602
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
1603
|
+
try {
|
|
1604
|
+
await Updater.downloadUpdate();
|
|
1605
|
+
return;
|
|
1606
|
+
} catch (error) {
|
|
1607
|
+
const isLastAttempt = attempt === maxAttempts;
|
|
1608
|
+
if (isLastAttempt) throw error;
|
|
1609
|
+
const delay = baseDelayMs * 2 ** (attempt - 1);
|
|
1610
|
+
logger.warn(
|
|
1611
|
+
`[Desktop] Update download attempt ${attempt}/${maxAttempts} failed, retrying in ${delay}ms: ${error instanceof Error ? error.message : String(error)}`,
|
|
1612
|
+
);
|
|
1613
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
async applyUpdate(): Promise<void> {
|
|
1619
|
+
const availability = this.getUpdaterAvailability();
|
|
1620
|
+
if (!availability.canAutoUpdate) {
|
|
1621
|
+
throw new Error(
|
|
1622
|
+
availability.autoUpdateDisabledReason ??
|
|
1623
|
+
"Auto-update is unavailable for this installation.",
|
|
1624
|
+
);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
Updater.applyUpdate();
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
async getBuildInfo(): Promise<DesktopBuildInfo> {
|
|
1631
|
+
const config = await BuildConfig.get();
|
|
1632
|
+
return {
|
|
1633
|
+
platform: process.platform,
|
|
1634
|
+
arch: process.arch,
|
|
1635
|
+
defaultRenderer: config.defaultRenderer,
|
|
1636
|
+
availableRenderers: config.availableRenderers,
|
|
1637
|
+
cefVersion: config.cefVersion,
|
|
1638
|
+
bunVersion: config.bunVersion,
|
|
1639
|
+
runtime: config.runtime,
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
async getDockIconVisibility(): Promise<{ visible: boolean }> {
|
|
1644
|
+
if (process.platform !== "darwin") {
|
|
1645
|
+
return { visible: true };
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
return {
|
|
1649
|
+
visible: Utils.isDockIconVisible(),
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
async setDockIconVisibility(options: {
|
|
1654
|
+
visible: boolean;
|
|
1655
|
+
}): Promise<{ visible: boolean }> {
|
|
1656
|
+
if (process.platform === "darwin") {
|
|
1657
|
+
Utils.setDockIconVisible(options.visible);
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
return this.getDockIconVisibility();
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
/**
|
|
1664
|
+
* Enable tray-first mode: the Dock icon is hidden until a main window is
|
|
1665
|
+
* shown, then follows window presence (hidden when the window is hidden or
|
|
1666
|
+
* closed). Call once at startup. No-op off macOS (setDockIconVisibility
|
|
1667
|
+
* guards the native call).
|
|
1668
|
+
*/
|
|
1669
|
+
setTrayFirstMode(enabled: boolean): void {
|
|
1670
|
+
this.trayFirstMode = enabled;
|
|
1671
|
+
if (enabled) {
|
|
1672
|
+
void this.setDockIconVisibility({ visible: false }).catch(() => {});
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Signal that a main window has been attached/shown. Reveals the Dock icon in
|
|
1678
|
+
* tray-first mode regardless of how the window was opened — including
|
|
1679
|
+
* createMainWindow()/attachMainWindow() paths (boot, restoreWindow() from a
|
|
1680
|
+
* deep link) that bypass showWindow()/showMainWindow(). No-op outside
|
|
1681
|
+
* tray-first.
|
|
1682
|
+
*/
|
|
1683
|
+
markMainWindowShown(): void {
|
|
1684
|
+
this.syncTrayFirstDock(true);
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Toggle the Dock icon to match window presence, only in tray-first mode.
|
|
1689
|
+
* Routed through every show/hide path so reopen-from-tray (which bypasses
|
|
1690
|
+
* the window create path) keeps the Dock icon correct.
|
|
1691
|
+
*/
|
|
1692
|
+
private syncTrayFirstDock(visible: boolean): void {
|
|
1693
|
+
if (!this.trayFirstMode) return;
|
|
1694
|
+
void this.setDockIconVisibility({ visible }).catch(() => {});
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
async showSelectionContextMenu(options: {
|
|
1698
|
+
text: string;
|
|
1699
|
+
}): Promise<{ shown: boolean }> {
|
|
1700
|
+
const text = options.text.trim();
|
|
1701
|
+
if (!text) {
|
|
1702
|
+
return { shown: false };
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
const menu: ApplicationMenuItemConfig[] = [
|
|
1706
|
+
{
|
|
1707
|
+
type: "normal",
|
|
1708
|
+
label: "Ask Agent",
|
|
1709
|
+
action: "ask-agent",
|
|
1710
|
+
data: { text },
|
|
1711
|
+
},
|
|
1712
|
+
{
|
|
1713
|
+
type: "normal",
|
|
1714
|
+
label: "Quote in Chat",
|
|
1715
|
+
action: "quote-in-chat",
|
|
1716
|
+
data: { text },
|
|
1717
|
+
},
|
|
1718
|
+
{
|
|
1719
|
+
type: "normal",
|
|
1720
|
+
label: "Create Skill",
|
|
1721
|
+
action: "create-skill",
|
|
1722
|
+
data: { text },
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
type: "normal",
|
|
1726
|
+
label: "Save as Command",
|
|
1727
|
+
action: "save-as-command",
|
|
1728
|
+
data: { text },
|
|
1729
|
+
},
|
|
1730
|
+
{ type: "separator" },
|
|
1731
|
+
{
|
|
1732
|
+
type: "normal",
|
|
1733
|
+
label: "Copy Selection",
|
|
1734
|
+
action: "copy-selection",
|
|
1735
|
+
data: { text },
|
|
1736
|
+
},
|
|
1737
|
+
];
|
|
1738
|
+
|
|
1739
|
+
ContextMenu.showContextMenu(menu);
|
|
1740
|
+
return { shown: true };
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
async getSessionSnapshot(options: {
|
|
1744
|
+
partition: string;
|
|
1745
|
+
}): Promise<DesktopSessionSnapshot> {
|
|
1746
|
+
return this.readSessionSnapshot(options.partition);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
async clearSessionData(options: {
|
|
1750
|
+
partition: string;
|
|
1751
|
+
storageTypes?: DesktopSessionStorageType[] | "all";
|
|
1752
|
+
clearCookies?: boolean;
|
|
1753
|
+
}): Promise<DesktopSessionSnapshot> {
|
|
1754
|
+
const session = this.getSession(options.partition);
|
|
1755
|
+
const shouldClearCookies =
|
|
1756
|
+
options.clearCookies === true ||
|
|
1757
|
+
options.storageTypes === "all" ||
|
|
1758
|
+
options.storageTypes?.includes("cookies");
|
|
1759
|
+
|
|
1760
|
+
if (shouldClearCookies) {
|
|
1761
|
+
session.cookies.clear();
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
if (options.storageTypes === "all") {
|
|
1765
|
+
session.clearStorageData("all");
|
|
1766
|
+
} else if (options.storageTypes) {
|
|
1767
|
+
const storageTypes = options.storageTypes.filter(
|
|
1768
|
+
(type) => type !== "cookies",
|
|
1769
|
+
);
|
|
1770
|
+
if (storageTypes.length > 0) {
|
|
1771
|
+
session.clearStorageData(
|
|
1772
|
+
storageTypes as Exclude<DesktopSessionStorageType, "cookies">[],
|
|
1773
|
+
);
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
return this.readSessionSnapshot(options.partition);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
async getWebGpuBrowserStatus(): Promise<
|
|
1781
|
+
ReturnType<typeof checkWebGpuSupport>
|
|
1782
|
+
> {
|
|
1783
|
+
const config = await BuildConfig.get();
|
|
1784
|
+
return checkWebGpuSupport(this.resolvePreferredBrowserRenderer(config));
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
async openReleaseNotesWindow(options: {
|
|
1788
|
+
url: string;
|
|
1789
|
+
title?: string;
|
|
1790
|
+
}): Promise<DesktopReleaseNotesWindowInfo> {
|
|
1791
|
+
const url = this.normalizeReleaseNotesUrl(options.url);
|
|
1792
|
+
const title =
|
|
1793
|
+
options.title?.trim() || `${getBrandConfig().appName} Release Notes`;
|
|
1794
|
+
|
|
1795
|
+
if (this.releaseNotesWindow && this.releaseNotesView) {
|
|
1796
|
+
this.releaseNotesWindow.setTitle(title);
|
|
1797
|
+
if (this.releaseNotesView.url !== url) {
|
|
1798
|
+
this.releaseNotesView.loadURL(url);
|
|
1799
|
+
}
|
|
1800
|
+
this.releaseNotesWindow.focus();
|
|
1801
|
+
return {
|
|
1802
|
+
url,
|
|
1803
|
+
windowId: this.releaseNotesWindow.id,
|
|
1804
|
+
webviewId: this.releaseNotesView.id,
|
|
1805
|
+
};
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
const buildConfig = await BuildConfig.get();
|
|
1809
|
+
const renderer = this.resolvePreferredBrowserRenderer(buildConfig);
|
|
1810
|
+
const win = new Electrobun.BrowserWindow({
|
|
1811
|
+
title,
|
|
1812
|
+
frame: {
|
|
1813
|
+
x: 170,
|
|
1814
|
+
y: 110,
|
|
1815
|
+
width: 1180,
|
|
1816
|
+
height: 860,
|
|
1817
|
+
},
|
|
1818
|
+
renderer,
|
|
1819
|
+
transparent: false,
|
|
1820
|
+
titleBarStyle: "default",
|
|
1821
|
+
});
|
|
1822
|
+
|
|
1823
|
+
// BrowserWindow always creates a default webview. Remove it so the
|
|
1824
|
+
// manual BrowserView becomes the only live browsing surface.
|
|
1825
|
+
win.webview.remove();
|
|
1826
|
+
|
|
1827
|
+
const view = new BrowserView({
|
|
1828
|
+
url,
|
|
1829
|
+
renderer,
|
|
1830
|
+
windowId: win.id,
|
|
1831
|
+
partition: RELEASE_NOTES_PARTITION,
|
|
1832
|
+
sandbox: true,
|
|
1833
|
+
navigationRules: JSON.stringify(
|
|
1834
|
+
this.buildReleaseNotesNavigationRules(url),
|
|
1835
|
+
),
|
|
1836
|
+
frame: {
|
|
1837
|
+
x: 0,
|
|
1838
|
+
y: 0,
|
|
1839
|
+
width: win.frame.width,
|
|
1840
|
+
height: win.frame.height,
|
|
1841
|
+
},
|
|
1842
|
+
});
|
|
1843
|
+
|
|
1844
|
+
win.on("close", () => {
|
|
1845
|
+
this.releaseNotesView?.remove();
|
|
1846
|
+
this.releaseNotesWindow = null;
|
|
1847
|
+
this.releaseNotesView = null;
|
|
1848
|
+
});
|
|
1849
|
+
|
|
1850
|
+
this.releaseNotesWindow = win;
|
|
1851
|
+
this.releaseNotesView = view;
|
|
1852
|
+
win.focus();
|
|
1853
|
+
|
|
1854
|
+
return {
|
|
1855
|
+
url,
|
|
1856
|
+
windowId: win.id,
|
|
1857
|
+
webviewId: view.id,
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
// MARK: - Clipboard
|
|
1862
|
+
|
|
1863
|
+
async writeToClipboard(options: ClipboardWriteOptions): Promise<void> {
|
|
1864
|
+
if (options.text) {
|
|
1865
|
+
Utils.clipboardWriteText(options.text);
|
|
1866
|
+
} else if (options.image) {
|
|
1867
|
+
// clipboardWriteImage expects a Uint8Array — decode base64 before passing.
|
|
1868
|
+
const bytes = Buffer.from(options.image, "base64");
|
|
1869
|
+
Utils.clipboardWriteImage(new Uint8Array(bytes));
|
|
1870
|
+
}
|
|
1871
|
+
// html/rtf not supported by Electrobun clipboard — drop silently
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
async readFromClipboard(): Promise<ClipboardReadResult> {
|
|
1875
|
+
const text = Utils.clipboardReadText();
|
|
1876
|
+
let hasImage = false;
|
|
1877
|
+
try {
|
|
1878
|
+
const imgData = Utils.clipboardReadImage();
|
|
1879
|
+
hasImage = !!imgData && imgData.length > 0;
|
|
1880
|
+
} catch {
|
|
1881
|
+
// clipboardReadImage may throw if no image data
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
return {
|
|
1885
|
+
text: text || undefined,
|
|
1886
|
+
// html/rtf not supported by Electrobun clipboard
|
|
1887
|
+
hasImage,
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
async clearClipboard(): Promise<void> {
|
|
1892
|
+
Utils.clipboardClear();
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
async clipboardAvailableFormats(): Promise<{ formats: string[] }> {
|
|
1896
|
+
const formats = Utils.clipboardAvailableFormats();
|
|
1897
|
+
return { formats: Array.isArray(formats) ? formats : [] };
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
// MARK: - Shell
|
|
1901
|
+
|
|
1902
|
+
/**
|
|
1903
|
+
* Open an external URL in the default browser.
|
|
1904
|
+
* SECURITY: restricted to http/https to prevent opening arbitrary protocols.
|
|
1905
|
+
*/
|
|
1906
|
+
async openExternal(options: OpenExternalOptions): Promise<void> {
|
|
1907
|
+
const url = typeof options.url === "string" ? options.url.trim() : "";
|
|
1908
|
+
try {
|
|
1909
|
+
const parsed = new URL(url);
|
|
1910
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
1911
|
+
throw new Error(
|
|
1912
|
+
`Blocked openExternal for non-http(s) URL: ${parsed.protocol}`,
|
|
1913
|
+
);
|
|
1914
|
+
}
|
|
1915
|
+
} catch (err) {
|
|
1916
|
+
if (err instanceof TypeError) {
|
|
1917
|
+
throw new Error(`Invalid URL passed to openExternal: ${url}`);
|
|
1918
|
+
}
|
|
1919
|
+
throw err;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
if (this.openExternalHandler) {
|
|
1923
|
+
try {
|
|
1924
|
+
const handled = await this.openExternalHandler(url);
|
|
1925
|
+
if (handled) {
|
|
1926
|
+
return;
|
|
1927
|
+
}
|
|
1928
|
+
} catch (err) {
|
|
1929
|
+
logger.warn(
|
|
1930
|
+
`[Desktop] openExternal handler failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
1931
|
+
);
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
Utils.openExternal(url);
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Reveal a file in the OS file manager.
|
|
1940
|
+
* SECURITY: requires an absolute path.
|
|
1941
|
+
*/
|
|
1942
|
+
async showItemInFolder(options: ShowItemInFolderOptions): Promise<void> {
|
|
1943
|
+
const p = typeof options.path === "string" ? options.path.trim() : "";
|
|
1944
|
+
if (!p || !path.isAbsolute(p)) {
|
|
1945
|
+
throw new Error("showItemInFolder requires an absolute path");
|
|
1946
|
+
}
|
|
1947
|
+
Utils.showItemInFolder(p);
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
async openPath(options: { path: string }): Promise<void> {
|
|
1951
|
+
const p = typeof options.path === "string" ? options.path.trim() : "";
|
|
1952
|
+
if (!p) {
|
|
1953
|
+
throw new Error("openPath requires a non-empty path");
|
|
1954
|
+
}
|
|
1955
|
+
Utils.openPath(p);
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
async beep(): Promise<void> {
|
|
1959
|
+
try {
|
|
1960
|
+
if (process.platform === "darwin") {
|
|
1961
|
+
Bun.spawn(["afplay", "/System/Library/Sounds/Funk.aiff"], {
|
|
1962
|
+
stdout: "ignore",
|
|
1963
|
+
stderr: "ignore",
|
|
1964
|
+
});
|
|
1965
|
+
} else if (process.platform === "linux") {
|
|
1966
|
+
// Try paplay (PulseAudio), fall back to terminal bell
|
|
1967
|
+
try {
|
|
1968
|
+
const proc = Bun.spawn(
|
|
1969
|
+
["paplay", "/usr/share/sounds/freedesktop/stereo/bell.oga"],
|
|
1970
|
+
{ stdout: "ignore", stderr: "ignore" },
|
|
1971
|
+
);
|
|
1972
|
+
await proc.exited;
|
|
1973
|
+
} catch {
|
|
1974
|
+
process.stdout.write("\x07");
|
|
1975
|
+
}
|
|
1976
|
+
} else if (process.platform === "win32") {
|
|
1977
|
+
const proc = Bun.spawn(
|
|
1978
|
+
["powershell", "-NoProfile", "-Command", "[Console]::Beep(800, 200)"],
|
|
1979
|
+
{ stdout: "ignore", stderr: "ignore" },
|
|
1980
|
+
);
|
|
1981
|
+
await proc.exited;
|
|
1982
|
+
}
|
|
1983
|
+
} catch {
|
|
1984
|
+
// beep is best-effort — never throw
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
// MARK: - Screen / Display
|
|
1989
|
+
|
|
1990
|
+
async getPrimaryDisplay(): Promise<DisplayInfo> {
|
|
1991
|
+
const display = Screen.getPrimaryDisplay();
|
|
1992
|
+
return {
|
|
1993
|
+
id: display.id,
|
|
1994
|
+
bounds: display.bounds,
|
|
1995
|
+
workArea: display.workArea,
|
|
1996
|
+
scaleFactor: display.scaleFactor,
|
|
1997
|
+
isPrimary: display.isPrimary,
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
async getAllDisplays(): Promise<{ displays: DisplayInfo[] }> {
|
|
2002
|
+
const displays = Screen.getAllDisplays();
|
|
2003
|
+
return {
|
|
2004
|
+
displays: displays.map((d) => ({
|
|
2005
|
+
id: d.id,
|
|
2006
|
+
bounds: d.bounds,
|
|
2007
|
+
workArea: d.workArea,
|
|
2008
|
+
scaleFactor: d.scaleFactor,
|
|
2009
|
+
isPrimary: d.isPrimary,
|
|
2010
|
+
})),
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
async getCursorPosition(): Promise<CursorPosition> {
|
|
2015
|
+
return Screen.getCursorScreenPoint();
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
// MARK: - Message Box
|
|
2019
|
+
|
|
2020
|
+
async showMessageBox(options: MessageBoxOptions): Promise<MessageBoxResult> {
|
|
2021
|
+
const autoConfirm =
|
|
2022
|
+
process.env.ELIZA_DESKTOP_TEST_AUTO_CONFIRM_DIALOGS === "1" ||
|
|
2023
|
+
process.env.ELIZA_DESKTOP_TEST_AUTO_CONFIRM_RESET === "1";
|
|
2024
|
+
if (autoConfirm) {
|
|
2025
|
+
return { response: options.defaultId ?? 0 };
|
|
2026
|
+
}
|
|
2027
|
+
const result = await Utils.showMessageBox({
|
|
2028
|
+
type: options.type ?? "info",
|
|
2029
|
+
title: options.title,
|
|
2030
|
+
message: options.message,
|
|
2031
|
+
detail: options.detail,
|
|
2032
|
+
buttons: options.buttons ?? ["OK"],
|
|
2033
|
+
defaultId: options.defaultId ?? 0,
|
|
2034
|
+
cancelId: options.cancelId,
|
|
2035
|
+
});
|
|
2036
|
+
return { response: result.response };
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
// MARK: - File Dialogs
|
|
2040
|
+
|
|
2041
|
+
/**
|
|
2042
|
+
* Show a native file/directory open picker.
|
|
2043
|
+
* Maps to Electrobun's Utils.openFileDialog.
|
|
2044
|
+
*/
|
|
2045
|
+
async showOpenDialog(options: FileDialogOptions): Promise<FileDialogResult> {
|
|
2046
|
+
const filePaths = await Utils.openFileDialog({
|
|
2047
|
+
startingFolder: options.defaultPath,
|
|
2048
|
+
allowedFileTypes: options.allowedFileTypes,
|
|
2049
|
+
canChooseFiles: options.canChooseFiles ?? true,
|
|
2050
|
+
canChooseDirectory: options.canChooseDirectory ?? false,
|
|
2051
|
+
allowsMultipleSelection: options.allowsMultipleSelection ?? false,
|
|
2052
|
+
});
|
|
2053
|
+
const canceled = filePaths.length === 0 || filePaths[0] === "";
|
|
2054
|
+
return { canceled, filePaths: canceled ? [] : filePaths };
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
/**
|
|
2058
|
+
* Show a native directory picker for save operations.
|
|
2059
|
+
* Electrobun has no separate save dialog — we pick a directory and the
|
|
2060
|
+
* caller appends the filename. Returns the chosen directory path.
|
|
2061
|
+
*/
|
|
2062
|
+
async showSaveDialog(options: FileDialogOptions): Promise<FileDialogResult> {
|
|
2063
|
+
const filePaths = await Utils.openFileDialog({
|
|
2064
|
+
startingFolder: options.defaultPath,
|
|
2065
|
+
allowedFileTypes: options.allowedFileTypes,
|
|
2066
|
+
canChooseFiles: false,
|
|
2067
|
+
canChooseDirectory: true,
|
|
2068
|
+
allowsMultipleSelection: false,
|
|
2069
|
+
});
|
|
2070
|
+
const canceled = filePaths.length === 0 || filePaths[0] === "";
|
|
2071
|
+
return { canceled, filePaths: canceled ? [] : filePaths };
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Pick a workspace folder for store-distributed builds. Maps to a directory-only
|
|
2076
|
+
* NSOpenPanel on macOS (via Electrobun's openFileDialog).
|
|
2077
|
+
*
|
|
2078
|
+
* The `bookmark` field is the OS-specific persistence handle: on macOS, a
|
|
2079
|
+
* base64 NSURLBookmarkCreationOptions.WithSecurityScope blob the caller
|
|
2080
|
+
* stores and re-resolves on next launch. Non-macOS platforms return null
|
|
2081
|
+
* because portals / AppContainer do not use NSURL bookmarks.
|
|
2082
|
+
*/
|
|
2083
|
+
async pickWorkspaceFolder(options: {
|
|
2084
|
+
defaultPath?: string;
|
|
2085
|
+
promptTitle?: string;
|
|
2086
|
+
}): Promise<{ canceled: boolean; path: string; bookmark: string | null }> {
|
|
2087
|
+
const filePaths = await Utils.openFileDialog({
|
|
2088
|
+
startingFolder: options.defaultPath,
|
|
2089
|
+
canChooseFiles: false,
|
|
2090
|
+
canChooseDirectory: true,
|
|
2091
|
+
allowsMultipleSelection: false,
|
|
2092
|
+
});
|
|
2093
|
+
const canceled = filePaths.length === 0 || filePaths[0] === "";
|
|
2094
|
+
if (canceled) {
|
|
2095
|
+
return { canceled: true, path: "", bookmark: null };
|
|
2096
|
+
}
|
|
2097
|
+
const selectedPath = filePaths[0] ?? "";
|
|
2098
|
+
if (!selectedPath) {
|
|
2099
|
+
return { canceled: true, path: "", bookmark: null };
|
|
2100
|
+
}
|
|
2101
|
+
const bookmark =
|
|
2102
|
+
process.platform === "darwin"
|
|
2103
|
+
? createSecurityScopedBookmark(selectedPath)
|
|
2104
|
+
: null;
|
|
2105
|
+
// Bridge to the agent runtime via the shared state-dir JSON file so
|
|
2106
|
+
// the separate Node process honors the user's pick when resolving
|
|
2107
|
+
// ELIZA_WORKSPACE_DIR at boot. Renderer-side localStorage is a
|
|
2108
|
+
// separate copy for its own UX (button states, re-prompt logic).
|
|
2109
|
+
try {
|
|
2110
|
+
writeWorkspaceFolderConfig({ path: selectedPath, bookmark });
|
|
2111
|
+
} catch (err) {
|
|
2112
|
+
logger.warn(
|
|
2113
|
+
`[desktop:pickWorkspaceFolder] writeWorkspaceFolderConfig failed: ${
|
|
2114
|
+
err instanceof Error ? err.message : String(err)
|
|
2115
|
+
}`,
|
|
2116
|
+
);
|
|
2117
|
+
}
|
|
2118
|
+
return { canceled: false, path: selectedPath, bookmark };
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
resolveWorkspaceFolderBookmark(options: { bookmark: string }): {
|
|
2122
|
+
ok: boolean;
|
|
2123
|
+
path: string;
|
|
2124
|
+
stale?: boolean;
|
|
2125
|
+
error?: string;
|
|
2126
|
+
} {
|
|
2127
|
+
if (process.platform !== "darwin") {
|
|
2128
|
+
return { ok: true, path: "" };
|
|
2129
|
+
}
|
|
2130
|
+
const path = startAccessingSecurityScopedBookmark(options.bookmark);
|
|
2131
|
+
if (!path) {
|
|
2132
|
+
// Bookmark went stale (target moved/trashed). Wipe the shared
|
|
2133
|
+
// config so the agent runtime falls back to the container
|
|
2134
|
+
// default on next boot until the user re-picks.
|
|
2135
|
+
try {
|
|
2136
|
+
clearWorkspaceFolderConfig();
|
|
2137
|
+
} catch (err) {
|
|
2138
|
+
logger.warn(
|
|
2139
|
+
`[desktop:resolveWorkspaceFolderBookmark] clearWorkspaceFolderConfig failed: ${
|
|
2140
|
+
err instanceof Error ? err.message : String(err)
|
|
2141
|
+
}`,
|
|
2142
|
+
);
|
|
2143
|
+
}
|
|
2144
|
+
return {
|
|
2145
|
+
ok: false,
|
|
2146
|
+
path: "",
|
|
2147
|
+
error: "Unable to resolve security-scoped bookmark.",
|
|
2148
|
+
};
|
|
2149
|
+
}
|
|
2150
|
+
// Refresh the shared config with the freshly-resolved path (it
|
|
2151
|
+
// may differ from the originally-picked path if the user renamed
|
|
2152
|
+
// the folder since the bookmark was created).
|
|
2153
|
+
try {
|
|
2154
|
+
writeWorkspaceFolderConfig({ path, bookmark: options.bookmark });
|
|
2155
|
+
} catch (err) {
|
|
2156
|
+
logger.warn(
|
|
2157
|
+
`[desktop:resolveWorkspaceFolderBookmark] writeWorkspaceFolderConfig failed: ${
|
|
2158
|
+
err instanceof Error ? err.message : String(err)
|
|
2159
|
+
}`,
|
|
2160
|
+
);
|
|
2161
|
+
}
|
|
2162
|
+
return { ok: true, path };
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
releaseWorkspaceFolderBookmarks(): { ok: true } {
|
|
2166
|
+
stopAccessingSecurityScopedBookmarks();
|
|
2167
|
+
return { ok: true };
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
// MARK: - Helpers
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* Resolve an icon path, trying absolute, then relative to known asset dirs.
|
|
2174
|
+
*/
|
|
2175
|
+
private resolveIconPath(iconPath: string): string {
|
|
2176
|
+
if (path.isAbsolute(iconPath)) {
|
|
2177
|
+
return iconPath;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
// Try relative to the electrobun assets directory
|
|
2181
|
+
const assetsPath = path.join(import.meta.dir, "../../assets", iconPath);
|
|
2182
|
+
if (fs.existsSync(assetsPath)) {
|
|
2183
|
+
return assetsPath;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
// Try relative to cwd
|
|
2187
|
+
const cwdPath = path.join(process.cwd(), iconPath);
|
|
2188
|
+
if (fs.existsSync(cwdPath)) {
|
|
2189
|
+
return cwdPath;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
// Return as-is and let Electrobun handle it
|
|
2193
|
+
return iconPath;
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
private getSession(partition: string) {
|
|
2197
|
+
const normalized = partition.trim() || "persist:default";
|
|
2198
|
+
if (normalized === "persist:default") {
|
|
2199
|
+
return Session.defaultSession;
|
|
2200
|
+
}
|
|
2201
|
+
return Session.fromPartition(normalized);
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
private readSessionSnapshot(partition: string): DesktopSessionSnapshot {
|
|
2205
|
+
const session = this.getSession(partition);
|
|
2206
|
+
const cookies = session.cookies.get().map((cookie) => ({
|
|
2207
|
+
name: cookie.name,
|
|
2208
|
+
domain: cookie.domain,
|
|
2209
|
+
path: cookie.path,
|
|
2210
|
+
secure: cookie.secure,
|
|
2211
|
+
httpOnly: cookie.httpOnly,
|
|
2212
|
+
session: (cookie as typeof cookie & { session?: boolean }).session,
|
|
2213
|
+
expirationDate: cookie.expirationDate,
|
|
2214
|
+
}));
|
|
2215
|
+
|
|
2216
|
+
return {
|
|
2217
|
+
partition: session.partition,
|
|
2218
|
+
persistent: session.partition.startsWith("persist:"),
|
|
2219
|
+
cookieCount: cookies.length,
|
|
2220
|
+
cookies,
|
|
2221
|
+
};
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
private normalizeReleaseNotesUrl(url: string): string {
|
|
2225
|
+
const trimmed = url.trim() || DEFAULT_RELEASE_NOTES_URL;
|
|
2226
|
+
const parsed = new URL(trimmed);
|
|
2227
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
2228
|
+
throw new Error("Release notes URL must use http or https");
|
|
2229
|
+
}
|
|
2230
|
+
return parsed.toString();
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
private buildReleaseNotesNavigationRules(url: string): string[] {
|
|
2234
|
+
const parsed = new URL(url);
|
|
2235
|
+
const origin = parsed.origin.replace(/\/+$/, "");
|
|
2236
|
+
return [parsed.toString(), `${origin}/*`];
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
private async buildUpdaterSnapshot(
|
|
2240
|
+
error?: unknown,
|
|
2241
|
+
availability = this.getUpdaterAvailability(),
|
|
2242
|
+
): Promise<DesktopUpdaterSnapshot> {
|
|
2243
|
+
let currentVersion = "unknown";
|
|
2244
|
+
let currentHash: string | undefined;
|
|
2245
|
+
let channel: string | undefined;
|
|
2246
|
+
let baseUrl: string | undefined;
|
|
2247
|
+
let snapshotError =
|
|
2248
|
+
error instanceof Error ? error.message : error ? String(error) : null;
|
|
2249
|
+
|
|
2250
|
+
try {
|
|
2251
|
+
const localInfo = await Updater.getLocallocalInfo();
|
|
2252
|
+
currentVersion = localInfo.version;
|
|
2253
|
+
currentHash = localInfo.hash;
|
|
2254
|
+
channel = localInfo.channel;
|
|
2255
|
+
baseUrl = localInfo.baseUrl;
|
|
2256
|
+
} catch (localError) {
|
|
2257
|
+
if (!snapshotError) {
|
|
2258
|
+
snapshotError =
|
|
2259
|
+
localError instanceof Error
|
|
2260
|
+
? localError.message
|
|
2261
|
+
: String(localError ?? "Unknown updater error");
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
const updateInfo =
|
|
2266
|
+
(Updater.updateInfo() as Partial<{
|
|
2267
|
+
version: string;
|
|
2268
|
+
hash: string;
|
|
2269
|
+
updateAvailable: boolean;
|
|
2270
|
+
updateReady: boolean;
|
|
2271
|
+
error: string;
|
|
2272
|
+
}>) ?? {};
|
|
2273
|
+
const lastStatusEntry = Updater.getStatusHistory().at(-1) ?? null;
|
|
2274
|
+
|
|
2275
|
+
return {
|
|
2276
|
+
currentVersion,
|
|
2277
|
+
currentHash,
|
|
2278
|
+
channel,
|
|
2279
|
+
baseUrl,
|
|
2280
|
+
appBundlePath: availability.appBundlePath,
|
|
2281
|
+
canAutoUpdate: availability.canAutoUpdate,
|
|
2282
|
+
autoUpdateDisabledReason: availability.autoUpdateDisabledReason,
|
|
2283
|
+
updateAvailable: Boolean(updateInfo.updateAvailable),
|
|
2284
|
+
updateReady: Boolean(updateInfo.updateReady),
|
|
2285
|
+
latestVersion: updateInfo.version ?? null,
|
|
2286
|
+
latestHash: updateInfo.hash ?? null,
|
|
2287
|
+
error: updateInfo.error || snapshotError,
|
|
2288
|
+
lastStatus: lastStatusEntry
|
|
2289
|
+
? {
|
|
2290
|
+
status: lastStatusEntry.status,
|
|
2291
|
+
message: lastStatusEntry.message,
|
|
2292
|
+
timestamp: lastStatusEntry.timestamp,
|
|
2293
|
+
}
|
|
2294
|
+
: null,
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
private getUpdaterAvailability(): {
|
|
2299
|
+
appBundlePath: string | null;
|
|
2300
|
+
canAutoUpdate: boolean;
|
|
2301
|
+
autoUpdateDisabledReason: string | null;
|
|
2302
|
+
} {
|
|
2303
|
+
const brand = getBrandConfig();
|
|
2304
|
+
return resolveDesktopUpdateAvailability({
|
|
2305
|
+
platform: process.platform,
|
|
2306
|
+
execPath: process.execPath,
|
|
2307
|
+
homeDir: Utils.paths.home,
|
|
2308
|
+
appName: brand.appName,
|
|
2309
|
+
buildVariant: brand.buildVariant,
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
private resolvePreferredBrowserRenderer(
|
|
2314
|
+
buildInfo: Awaited<ReturnType<typeof BuildConfig.get>>,
|
|
2315
|
+
): "native" | "cef" {
|
|
2316
|
+
if (
|
|
2317
|
+
process.platform === "linux" &&
|
|
2318
|
+
buildInfo.availableRenderers.includes("cef")
|
|
2319
|
+
) {
|
|
2320
|
+
return "cef";
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
return buildInfo.defaultRenderer;
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
/**
|
|
2327
|
+
* Clean up all resources.
|
|
2328
|
+
*/
|
|
2329
|
+
dispose(): void {
|
|
2330
|
+
if (this._focusPoller) {
|
|
2331
|
+
clearInterval(this._focusPoller);
|
|
2332
|
+
this._focusPoller = null;
|
|
2333
|
+
}
|
|
2334
|
+
this.teardownWindowEvents(this.mainWindow);
|
|
2335
|
+
this.mainWindow = null;
|
|
2336
|
+
this.releaseNotesView?.remove();
|
|
2337
|
+
this.releaseNotesView = null;
|
|
2338
|
+
this.releaseNotesWindow = null;
|
|
2339
|
+
this.unregisterAllShortcuts();
|
|
2340
|
+
void this.destroyTray();
|
|
2341
|
+
this.trayMenuItems.clear();
|
|
2342
|
+
this.sendToWebview = null;
|
|
2343
|
+
}
|
|
2304
2344
|
}
|
|
2305
2345
|
|
|
2306
2346
|
// ============================================================================
|
|
@@ -2310,8 +2350,8 @@ X-GNOME-Autostart-enabled=true
|
|
|
2310
2350
|
let desktopManager: DesktopManager | null = null;
|
|
2311
2351
|
|
|
2312
2352
|
export function getDesktopManager(): DesktopManager {
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2353
|
+
if (!desktopManager) {
|
|
2354
|
+
desktopManager = new DesktopManager();
|
|
2355
|
+
}
|
|
2356
|
+
return desktopManager;
|
|
2317
2357
|
}
|