@mentra/engine 0.1.0-dev.0 → 0.1.0-dev.1
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/README.md +42 -1
- package/build/engine.d.ts +11 -3
- package/build/engine.d.ts.map +1 -1
- package/build/engine.js +7 -2
- package/build/engine.js.map +1 -1
- package/build/facades/dev.d.ts +3 -2
- package/build/facades/dev.d.ts.map +1 -1
- package/build/facades/dev.js +18 -12
- package/build/facades/dev.js.map +1 -1
- package/build/facades/gallery.js +1 -1
- package/build/facades/gallery.js.map +1 -1
- package/build/facades/glasses.d.ts +1 -0
- package/build/facades/glasses.d.ts.map +1 -1
- package/build/facades/glasses.js +19 -4
- package/build/facades/glasses.js.map +1 -1
- package/build/facades/glassesSettings.d.ts.map +1 -1
- package/build/facades/glassesSettings.js +1 -0
- package/build/facades/glassesSettings.js.map +1 -1
- package/build/facades/miniapps.d.ts +4 -0
- package/build/facades/miniapps.d.ts.map +1 -1
- package/build/facades/miniapps.js +5 -0
- package/build/facades/miniapps.js.map +1 -1
- package/build/facades/ota.d.ts +11 -2
- package/build/facades/ota.d.ts.map +1 -1
- package/build/facades/ota.js +19 -4
- package/build/facades/ota.js.map +1 -1
- package/build/facades/pairing.d.ts +4 -0
- package/build/facades/pairing.d.ts.map +1 -1
- package/build/facades/pairing.js +10 -8
- package/build/facades/pairing.js.map +1 -1
- package/build/facades/permissions.d.ts +10 -0
- package/build/facades/permissions.d.ts.map +1 -1
- package/build/facades/permissions.js +10 -0
- package/build/facades/permissions.js.map +1 -1
- package/build/facades/phoneNotifications.d.ts +0 -4
- package/build/facades/phoneNotifications.d.ts.map +1 -1
- package/build/facades/phoneNotifications.js +4 -14
- package/build/facades/phoneNotifications.js.map +1 -1
- package/build/index.d.ts +6 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/internal.d.ts +3 -2
- package/build/internal.d.ts.map +1 -1
- package/build/internal.js +2 -1
- package/build/internal.js.map +1 -1
- package/build/react/MentraLiveOtaFlow.d.ts +38 -0
- package/build/react/MentraLiveOtaFlow.d.ts.map +1 -0
- package/build/react/MentraLiveOtaFlow.js +528 -0
- package/build/react/MentraLiveOtaFlow.js.map +1 -0
- package/build/react/index.d.ts +2 -0
- package/build/react/index.d.ts.map +1 -0
- package/build/react/index.js +2 -0
- package/build/react/index.js.map +1 -0
- package/build/react/useEngineSnapshot.d.ts +2 -0
- package/build/react/useEngineSnapshot.d.ts.map +1 -0
- package/build/react/useEngineSnapshot.js +14 -0
- package/build/react/useEngineSnapshot.js.map +1 -0
- package/build/runtime/bootstrap.d.ts +24 -1
- package/build/runtime/bootstrap.d.ts.map +1 -1
- package/build/runtime/bootstrap.js +17 -0
- package/build/runtime/bootstrap.js.map +1 -1
- package/build/runtime/scanQrSeam.d.ts +7 -0
- package/build/runtime/scanQrSeam.d.ts.map +1 -0
- package/build/runtime/scanQrSeam.js +16 -0
- package/build/runtime/scanQrSeam.js.map +1 -0
- package/build/services/AppRegistry.d.ts +33 -57
- package/build/services/AppRegistry.d.ts.map +1 -1
- package/build/services/AppRegistry.js +193 -144
- package/build/services/AppRegistry.js.map +1 -1
- package/build/services/AudioCloudUplink.d.ts +12 -0
- package/build/services/AudioCloudUplink.d.ts.map +1 -1
- package/build/services/AudioCloudUplink.js +22 -1
- package/build/services/AudioCloudUplink.js.map +1 -1
- package/build/services/AudioPlaybackService.d.ts +41 -2
- package/build/services/AudioPlaybackService.d.ts.map +1 -1
- package/build/services/AudioPlaybackService.js +250 -33
- package/build/services/AudioPlaybackService.js.map +1 -1
- package/build/services/BlobStore.d.ts +2 -1
- package/build/services/BlobStore.d.ts.map +1 -1
- package/build/services/BlobStore.js +17 -9
- package/build/services/BlobStore.js.map +1 -1
- package/build/services/CloudAudioSubscriptionSync.d.ts.map +1 -1
- package/build/services/CloudAudioSubscriptionSync.js +13 -1
- package/build/services/CloudAudioSubscriptionSync.js.map +1 -1
- package/build/services/CloudClientService.d.ts +15 -0
- package/build/services/CloudClientService.d.ts.map +1 -1
- package/build/services/CloudClientService.js +93 -1
- package/build/services/CloudClientService.js.map +1 -1
- package/build/services/DeviceEventRouter.js +5 -5
- package/build/services/DeviceEventRouter.js.map +1 -1
- package/build/services/ForegroundLocationPermission.d.ts +13 -0
- package/build/services/ForegroundLocationPermission.d.ts.map +1 -0
- package/build/services/ForegroundLocationPermission.js +12 -0
- package/build/services/ForegroundLocationPermission.js.map +1 -0
- package/build/services/GlassesSettingsSync.d.ts.map +1 -1
- package/build/services/GlassesSettingsSync.js +9 -3
- package/build/services/GlassesSettingsSync.js.map +1 -1
- package/build/services/GlassesStatusProjection.d.ts +2 -1
- package/build/services/GlassesStatusProjection.d.ts.map +1 -1
- package/build/services/GlassesStatusProjection.js +15 -8
- package/build/services/GlassesStatusProjection.js.map +1 -1
- package/build/services/HotspotOtaTransport.d.ts +29 -0
- package/build/services/HotspotOtaTransport.d.ts.map +1 -0
- package/build/services/HotspotOtaTransport.js +146 -0
- package/build/services/HotspotOtaTransport.js.map +1 -0
- package/build/services/HotspotShutdown.d.ts +17 -0
- package/build/services/HotspotShutdown.d.ts.map +1 -0
- package/build/services/HotspotShutdown.js +29 -0
- package/build/services/HotspotShutdown.js.map +1 -0
- package/build/services/LocalDisplayManager.d.ts +15 -0
- package/build/services/LocalDisplayManager.d.ts.map +1 -1
- package/build/services/LocalDisplayManager.js +106 -20
- package/build/services/LocalDisplayManager.js.map +1 -1
- package/build/services/LocalMiniappRuntime.d.ts +74 -2
- package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
- package/build/services/LocalMiniappRuntime.js +785 -291
- package/build/services/LocalMiniappRuntime.js.map +1 -1
- package/build/services/LocalMiniappStorage.d.ts +32 -0
- package/build/services/LocalMiniappStorage.d.ts.map +1 -0
- package/build/services/LocalMiniappStorage.js +66 -0
- package/build/services/LocalMiniappStorage.js.map +1 -0
- package/build/services/LocalMiniappUserIdentity.d.ts +20 -0
- package/build/services/LocalMiniappUserIdentity.d.ts.map +1 -0
- package/build/services/LocalMiniappUserIdentity.js +43 -0
- package/build/services/LocalMiniappUserIdentity.js.map +1 -0
- package/build/services/LocalSttFallbackCoordinator.d.ts +9 -6
- package/build/services/LocalSttFallbackCoordinator.d.ts.map +1 -1
- package/build/services/LocalSttFallbackCoordinator.js +18 -12
- package/build/services/LocalSttFallbackCoordinator.js.map +1 -1
- package/build/services/MicStateCoordinator.d.ts +42 -1
- package/build/services/MicStateCoordinator.d.ts.map +1 -1
- package/build/services/MicStateCoordinator.js +141 -3
- package/build/services/MicStateCoordinator.js.map +1 -1
- package/build/services/MiniappLauncher.d.ts.map +1 -1
- package/build/services/MiniappLauncher.js +23 -3
- package/build/services/MiniappLauncher.js.map +1 -1
- package/build/services/MiniappLiveness.d.ts +12 -0
- package/build/services/MiniappLiveness.d.ts.map +1 -0
- package/build/services/MiniappLiveness.js +16 -0
- package/build/services/MiniappLiveness.js.map +1 -0
- package/build/services/NativeHttpResponse.d.ts +3 -0
- package/build/services/NativeHttpResponse.d.ts.map +1 -0
- package/build/services/NativeHttpResponse.js +6 -0
- package/build/services/NativeHttpResponse.js.map +1 -0
- package/build/services/OtaArtifactDownloader.d.ts +65 -0
- package/build/services/OtaArtifactDownloader.d.ts.map +1 -0
- package/build/services/OtaArtifactDownloader.js +226 -0
- package/build/services/OtaArtifactDownloader.js.map +1 -0
- package/build/services/OtaAutoChain.d.ts +34 -0
- package/build/services/OtaAutoChain.d.ts.map +1 -0
- package/build/services/OtaAutoChain.js +83 -0
- package/build/services/OtaAutoChain.js.map +1 -0
- package/build/services/OtaErrorMapping.d.ts +18 -0
- package/build/services/OtaErrorMapping.d.ts.map +1 -0
- package/build/services/OtaErrorMapping.js +63 -0
- package/build/services/OtaErrorMapping.js.map +1 -0
- package/build/services/OtaInstallCoordinator.d.ts +94 -14
- package/build/services/OtaInstallCoordinator.d.ts.map +1 -1
- package/build/services/OtaInstallCoordinator.js +574 -130
- package/build/services/OtaInstallCoordinator.js.map +1 -1
- package/build/services/OtaService.d.ts.map +1 -1
- package/build/services/OtaService.js +8 -1
- package/build/services/OtaService.js.map +1 -1
- package/build/services/OtaUpdateCheckService.d.ts +38 -3
- package/build/services/OtaUpdateCheckService.d.ts.map +1 -1
- package/build/services/OtaUpdateCheckService.js +142 -22
- package/build/services/OtaUpdateCheckService.js.map +1 -1
- package/build/services/PhoneCalendarHelpers.d.ts +32 -0
- package/build/services/PhoneCalendarHelpers.d.ts.map +1 -0
- package/build/services/PhoneCalendarHelpers.js +157 -0
- package/build/services/PhoneCalendarHelpers.js.map +1 -0
- package/build/services/PhoneCalendarService.d.ts +5 -0
- package/build/services/PhoneCalendarService.d.ts.map +1 -0
- package/build/services/PhoneCalendarService.js +45 -0
- package/build/services/PhoneCalendarService.js.map +1 -0
- package/build/services/PhoneCameraFovCoordinator.d.ts +30 -0
- package/build/services/PhoneCameraFovCoordinator.d.ts.map +1 -0
- package/build/services/PhoneCameraFovCoordinator.js +194 -0
- package/build/services/PhoneCameraFovCoordinator.js.map +1 -0
- package/build/services/PhoneNotificationsSync.d.ts.map +1 -1
- package/build/services/PhoneNotificationsSync.js +12 -10
- package/build/services/PhoneNotificationsSync.js.map +1 -1
- package/build/services/PhonePhotoCoordinator.d.ts +26 -2
- package/build/services/PhonePhotoCoordinator.d.ts.map +1 -1
- package/build/services/PhonePhotoCoordinator.js +79 -9
- package/build/services/PhonePhotoCoordinator.js.map +1 -1
- package/build/services/PhoneStreamCoordinator.d.ts +8 -1
- package/build/services/PhoneStreamCoordinator.d.ts.map +1 -1
- package/build/services/PhoneStreamCoordinator.js +125 -13
- package/build/services/PhoneStreamCoordinator.js.map +1 -1
- package/build/services/PhoneVideoCoordinator.d.ts +2 -0
- package/build/services/PhoneVideoCoordinator.d.ts.map +1 -1
- package/build/services/PhoneVideoCoordinator.js +10 -0
- package/build/services/PhoneVideoCoordinator.js.map +1 -1
- package/build/services/SceneRenderer.d.ts.map +1 -1
- package/build/services/SceneRenderer.js +15 -0
- package/build/services/SceneRenderer.js.map +1 -1
- package/build/services/SentenceTtsPipeline.d.ts +31 -0
- package/build/services/SentenceTtsPipeline.d.ts.map +1 -0
- package/build/services/SentenceTtsPipeline.js +67 -0
- package/build/services/SentenceTtsPipeline.js.map +1 -0
- package/build/services/SupportProfileSync.d.ts +22 -0
- package/build/services/SupportProfileSync.d.ts.map +1 -0
- package/build/services/SupportProfileSync.js +213 -0
- package/build/services/SupportProfileSync.js.map +1 -0
- package/build/services/TranscriptionRouting.d.ts +12 -0
- package/build/services/TranscriptionRouting.d.ts.map +1 -0
- package/build/services/TranscriptionRouting.js +24 -0
- package/build/services/TranscriptionRouting.js.map +1 -0
- package/build/services/TtsTextSanitizer.d.ts +5 -0
- package/build/services/TtsTextSanitizer.d.ts.map +1 -0
- package/build/services/TtsTextSanitizer.js +61 -0
- package/build/services/TtsTextSanitizer.js.map +1 -0
- package/build/services/WifiAdbRequest.d.ts +17 -0
- package/build/services/WifiAdbRequest.d.ts.map +1 -0
- package/build/services/WifiAdbRequest.js +35 -0
- package/build/services/WifiAdbRequest.js.map +1 -0
- package/build/services/asg/asgCameraApi.d.ts +43 -0
- package/build/services/asg/asgCameraApi.d.ts.map +1 -1
- package/build/services/asg/asgCameraApi.js +509 -26
- package/build/services/asg/asgCameraApi.js.map +1 -1
- package/build/services/asg/cameraRollExportCoordinator.d.ts +60 -0
- package/build/services/asg/cameraRollExportCoordinator.d.ts.map +1 -0
- package/build/services/asg/cameraRollExportCoordinator.js +618 -0
- package/build/services/asg/cameraRollExportCoordinator.js.map +1 -0
- package/build/services/asg/cameraRollExportLedger.d.ts +44 -0
- package/build/services/asg/cameraRollExportLedger.d.ts.map +1 -0
- package/build/services/asg/cameraRollExportLedger.js +78 -0
- package/build/services/asg/cameraRollExportLedger.js.map +1 -0
- package/build/services/asg/galleryNotices.d.ts +1 -1
- package/build/services/asg/galleryNotices.d.ts.map +1 -1
- package/build/services/asg/galleryNotices.js.map +1 -1
- package/build/services/asg/galleryPathMigration.d.ts +3 -0
- package/build/services/asg/galleryPathMigration.d.ts.map +1 -0
- package/build/services/asg/galleryPathMigration.js +26 -0
- package/build/services/asg/galleryPathMigration.js.map +1 -0
- package/build/services/asg/gallerySettingsService.d.ts +1 -0
- package/build/services/asg/gallerySettingsService.d.ts.map +1 -1
- package/build/services/asg/gallerySettingsService.js +2 -0
- package/build/services/asg/gallerySettingsService.js.map +1 -1
- package/build/services/asg/gallerySyncService.d.ts.map +1 -1
- package/build/services/asg/gallerySyncService.js +162 -56
- package/build/services/asg/gallerySyncService.js.map +1 -1
- package/build/services/asg/galleryTransferLedger.d.ts +58 -0
- package/build/services/asg/galleryTransferLedger.d.ts.map +1 -0
- package/build/services/asg/galleryTransferLedger.js +225 -0
- package/build/services/asg/galleryTransferLedger.js.map +1 -0
- package/build/services/asg/localNetworkTransport.d.ts +15 -0
- package/build/services/asg/localNetworkTransport.d.ts.map +1 -0
- package/build/services/asg/localNetworkTransport.js +144 -0
- package/build/services/asg/localNetworkTransport.js.map +1 -0
- package/build/services/asg/localStorageService.d.ts +18 -0
- package/build/services/asg/localStorageService.d.ts.map +1 -1
- package/build/services/asg/localStorageService.js +168 -19
- package/build/services/asg/localStorageService.js.map +1 -1
- package/build/services/asg/mediaProcessingQueue.d.ts +10 -0
- package/build/services/asg/mediaProcessingQueue.d.ts.map +1 -1
- package/build/services/asg/mediaProcessingQueue.js +193 -62
- package/build/services/asg/mediaProcessingQueue.js.map +1 -1
- package/build/services/audioPlaybackAssets.d.ts +8 -0
- package/build/services/audioPlaybackAssets.d.ts.map +1 -0
- package/build/services/audioPlaybackAssets.js +7 -0
- package/build/services/audioPlaybackAssets.js.map +1 -0
- package/build/services/gallerySyncClock.js +1 -1
- package/build/services/gallerySyncClock.js.map +1 -1
- package/build/services/glassesClockSync.js +2 -2
- package/build/services/glassesClockSync.js.map +1 -1
- package/build/services/manifestActions.d.ts +7 -0
- package/build/services/manifestActions.d.ts.map +1 -0
- package/build/services/manifestActions.js +25 -0
- package/build/services/manifestActions.js.map +1 -0
- package/build/services/otaDisplayState.d.ts +22 -11
- package/build/services/otaDisplayState.d.ts.map +1 -1
- package/build/services/otaDisplayState.js +36 -14
- package/build/services/otaDisplayState.js.map +1 -1
- package/build/services/otaInstallPolicy.d.ts +15 -3
- package/build/services/otaInstallPolicy.d.ts.map +1 -1
- package/build/services/otaInstallPolicy.js +24 -3
- package/build/services/otaInstallPolicy.js.map +1 -1
- package/build/services/otaManifestUrl.d.ts +2 -0
- package/build/services/otaManifestUrl.d.ts.map +1 -0
- package/build/services/{asgOtaVersionUrl.js → otaManifestUrl.js} +15 -5
- package/build/services/otaManifestUrl.js.map +1 -0
- package/build/services/slimStreamStatus.d.ts +11 -0
- package/build/services/slimStreamStatus.d.ts.map +1 -1
- package/build/services/slimStreamStatus.js +14 -4
- package/build/services/slimStreamStatus.js.map +1 -1
- package/build/stores/apps.d.ts.map +1 -1
- package/build/stores/apps.js +11 -0
- package/build/stores/apps.js.map +1 -1
- package/build/stores/bluetoothSettingKeys.d.ts.map +1 -1
- package/build/stores/bluetoothSettingKeys.js +2 -0
- package/build/stores/bluetoothSettingKeys.js.map +1 -1
- package/build/stores/gallerySync.d.ts +2 -0
- package/build/stores/gallerySync.d.ts.map +1 -1
- package/build/stores/gallerySync.js +2 -0
- package/build/stores/gallerySync.js.map +1 -1
- package/build/stores/glasses.d.ts.map +1 -1
- package/build/stores/glasses.js +3 -0
- package/build/stores/glasses.js.map +1 -1
- package/build/stores/settings.d.ts +17 -0
- package/build/stores/settings.d.ts.map +1 -1
- package/build/stores/settings.js +157 -17
- package/build/stores/settings.js.map +1 -1
- package/build/types/applet.d.ts +2 -0
- package/build/types/applet.d.ts.map +1 -1
- package/build/types/applet.js.map +1 -1
- package/build/types/asg.d.ts +7 -0
- package/build/types/asg.d.ts.map +1 -1
- package/build/types/asg.js.map +1 -1
- package/build/types/enums.d.ts +1 -0
- package/build/types/enums.d.ts.map +1 -1
- package/build/types/enums.js +1 -0
- package/build/types/enums.js.map +1 -1
- package/build/types/hardware.d.ts +1 -0
- package/build/types/hardware.d.ts.map +1 -1
- package/build/types/hardware.js +14 -0
- package/build/types/hardware.js.map +1 -1
- package/build/utils/configuredDevHost.d.ts +6 -0
- package/build/utils/configuredDevHost.d.ts.map +1 -0
- package/build/utils/configuredDevHost.js +19 -0
- package/build/utils/configuredDevHost.js.map +1 -0
- package/build/utils/devMiniappLaunch.d.ts +19 -8
- package/build/utils/devMiniappLaunch.d.ts.map +1 -1
- package/build/utils/devMiniappLaunch.js +144 -21
- package/build/utils/devMiniappLaunch.js.map +1 -1
- package/build/utils/diagnosticContext.d.ts.map +1 -1
- package/build/utils/diagnosticContext.js +15 -17
- package/build/utils/diagnosticContext.js.map +1 -1
- package/build/utils/hardware/hardware.d.ts.map +1 -1
- package/build/utils/hardware/hardware.js +7 -3
- package/build/utils/hardware/hardware.js.map +1 -1
- package/build/utils/miniappDiagnostics.d.ts +64 -0
- package/build/utils/miniappDiagnostics.d.ts.map +1 -0
- package/build/utils/miniappDiagnostics.js +173 -0
- package/build/utils/miniappDiagnostics.js.map +1 -0
- package/build/utils/permissions/MediaLibraryPermissions.d.ts +11 -0
- package/build/utils/permissions/MediaLibraryPermissions.d.ts.map +1 -1
- package/build/utils/permissions/MediaLibraryPermissions.js +27 -4
- package/build/utils/permissions/MediaLibraryPermissions.js.map +1 -1
- package/build/utils/timers/timers.d.ts.map +1 -1
- package/build/utils/timers/timers.js +55 -18
- package/build/utils/timers/timers.js.map +1 -1
- package/package.json +25 -15
- package/src/assets/silence.wav +0 -0
- package/src/engine.ts +7 -2
- package/src/facades/dev.ts +17 -12
- package/src/facades/gallery.ts +1 -1
- package/src/facades/glasses.ts +17 -4
- package/src/facades/glassesSettings.ts +5 -0
- package/src/facades/miniapps.ts +7 -0
- package/src/facades/ota.ts +19 -4
- package/src/facades/pairing.ts +11 -7
- package/src/facades/permissions.ts +14 -0
- package/src/facades/phoneNotifications.ts +4 -13
- package/src/index.ts +26 -2
- package/src/internal.ts +3 -1
- package/src/react/MentraLiveOtaFlow.tsx +856 -0
- package/src/react/index.ts +7 -0
- package/src/react/useEngineSnapshot.ts +16 -0
- package/src/runtime/bootstrap.ts +33 -1
- package/src/runtime/scanQrSeam.ts +20 -0
- package/src/services/AppRegistry.ts +224 -149
- package/src/services/AudioCloudUplink.ts +23 -1
- package/src/services/AudioPlaybackService.ts +287 -38
- package/src/services/BlobStore.ts +22 -9
- package/src/services/CloudAudioSubscriptionSync.ts +13 -1
- package/src/services/CloudClientService.ts +96 -1
- package/src/services/DeviceEventRouter.ts +5 -5
- package/src/services/ForegroundLocationPermission.ts +24 -0
- package/src/services/GlassesSettingsSync.ts +9 -3
- package/src/services/GlassesStatusProjection.ts +16 -8
- package/src/services/HotspotOtaTransport.ts +184 -0
- package/src/services/HotspotShutdown.ts +41 -0
- package/src/services/LocalDisplayManager.ts +112 -21
- package/src/services/LocalMiniappRuntime.ts +967 -346
- package/src/services/LocalMiniappStorage.ts +82 -0
- package/src/services/LocalMiniappUserIdentity.ts +46 -0
- package/src/services/LocalSttFallbackCoordinator.ts +19 -12
- package/src/services/MicStateCoordinator.ts +169 -4
- package/src/services/MiniappLauncher.ts +30 -3
- package/src/services/MiniappLiveness.ts +24 -0
- package/src/services/NativeHttpResponse.ts +6 -0
- package/src/services/OtaArtifactDownloader.ts +312 -0
- package/src/services/OtaAutoChain.ts +106 -0
- package/src/services/OtaErrorMapping.ts +80 -0
- package/src/services/OtaInstallCoordinator.ts +645 -143
- package/src/services/OtaService.ts +11 -5
- package/src/services/OtaUpdateCheckService.ts +180 -20
- package/src/services/PhoneCalendarHelpers.ts +212 -0
- package/src/services/PhoneCalendarService.ts +65 -0
- package/src/services/PhoneCameraFovCoordinator.ts +210 -0
- package/src/services/PhoneNotificationsSync.ts +12 -10
- package/src/services/PhonePhotoCoordinator.ts +116 -18
- package/src/services/PhoneStreamCoordinator.ts +139 -25
- package/src/services/PhoneVideoCoordinator.ts +11 -0
- package/src/services/SceneRenderer.ts +16 -0
- package/src/services/SentenceTtsPipeline.ts +106 -0
- package/src/services/SupportProfileSync.ts +218 -0
- package/src/services/TranscriptionRouting.ts +37 -0
- package/src/services/TtsTextSanitizer.ts +66 -0
- package/src/services/WifiAdbRequest.ts +53 -0
- package/src/services/asg/asgCameraApi.ts +615 -33
- package/src/services/asg/cameraRollExportCoordinator.ts +627 -0
- package/src/services/asg/cameraRollExportLedger.ts +122 -0
- package/src/services/asg/galleryNotices.ts +1 -0
- package/src/services/asg/galleryPathMigration.ts +22 -0
- package/src/services/asg/gallerySettingsService.ts +3 -0
- package/src/services/asg/gallerySyncService.ts +184 -73
- package/src/services/asg/galleryTransferLedger.ts +312 -0
- package/src/services/asg/localNetworkTransport.ts +169 -0
- package/src/services/asg/localStorageService.ts +179 -24
- package/src/services/asg/mediaProcessingQueue.ts +209 -62
- package/src/services/audioPlaybackAssets.ts +8 -0
- package/src/services/gallerySyncClock.ts +1 -1
- package/src/services/glassesClockSync.ts +2 -2
- package/src/services/manifestActions.ts +30 -0
- package/src/services/otaDisplayState.ts +57 -16
- package/src/services/otaInstallPolicy.ts +29 -3
- package/src/services/{asgOtaVersionUrl.ts → otaManifestUrl.ts} +16 -4
- package/src/services/slimStreamStatus.ts +16 -5
- package/src/stores/apps.ts +12 -0
- package/src/stores/bluetoothSettingKeys.ts +2 -0
- package/src/stores/gallerySync.ts +4 -0
- package/src/stores/glasses.ts +3 -0
- package/src/stores/settings.ts +179 -18
- package/src/types/applet.ts +2 -0
- package/src/types/asg.ts +7 -0
- package/src/types/enums.ts +2 -1
- package/src/types/hardware.ts +17 -0
- package/src/utils/configuredDevHost.ts +17 -0
- package/src/utils/devMiniappLaunch.ts +151 -23
- package/src/utils/diagnosticContext.ts +17 -17
- package/src/utils/hardware/hardware.ts +7 -9
- package/src/utils/miniappDiagnostics.ts +226 -0
- package/src/utils/permissions/MediaLibraryPermissions.ts +35 -4
- package/src/utils/timers/timers.ts +57 -21
- package/build/services/asgOtaVersionUrl.d.ts +0 -2
- package/build/services/asgOtaVersionUrl.d.ts.map +0 -1
- package/build/services/asgOtaVersionUrl.js.map +0 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npm install @mentra/engine
|
|
|
21
21
|
|
|
22
22
|
## Entry points
|
|
23
23
|
|
|
24
|
-
The package exposes
|
|
24
|
+
The package exposes four entry points (declared in `package.json` `exports`,
|
|
25
25
|
with the `react-native` condition pointing at `src/` so Metro, tsc and jest
|
|
26
26
|
resolve live TypeScript source):
|
|
27
27
|
|
|
@@ -41,6 +41,10 @@ resolve live TypeScript source):
|
|
|
41
41
|
`/internal` import in `mobile/src` (report-only) as the burn-down metric.
|
|
42
42
|
- **`@mentra/engine/devtools`** (`src/devtools.ts`) — debug-only singletons
|
|
43
43
|
(`miniappRunningRegistry`, `devServerBridge`) for the internal dev screens.
|
|
44
|
+
- **`@mentra/engine/ota`** (`src/react/index.ts`) — shared full-screen OTA
|
|
45
|
+
Native experiences. `MentraLiveOtaFlow` owns the complete check, hotspot or
|
|
46
|
+
Wi-Fi install, APK/MTK/BES progress, reboot, retry, and final verification
|
|
47
|
+
flow so hosts do not implement their own OTA state machines.
|
|
44
48
|
|
|
45
49
|
See `cloud-v2/docs/issues/020-glasses-status-boundary/integration-review.md`
|
|
46
50
|
§D for the burn-down plan.
|
|
@@ -72,8 +76,45 @@ import {miniappRunningRegistry} from "@mentra/engine/devtools"
|
|
|
72
76
|
- `decideDevLaunchRoute` — pre-flight a dev URL's `miniapp.json` to decide
|
|
73
77
|
whether to mount live or take the user to the offline screen.
|
|
74
78
|
|
|
79
|
+
### Mentra Live OTA flow
|
|
80
|
+
|
|
81
|
+
Bluetooth-only hosts can render the OTA flow without configuring or starting
|
|
82
|
+
the authenticated cloud/miniapp runtime:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import {MentraLiveOtaFlow} from "@mentra/engine/ota"
|
|
86
|
+
|
|
87
|
+
<MentraLiveOtaFlow
|
|
88
|
+
onFinished={() => setShowOta(false)}
|
|
89
|
+
onOpenWifiSetup={() => setShowWifiSetup(true)}
|
|
90
|
+
/>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The component starts only the glasses-status and OTA projections. A host that
|
|
94
|
+
already called `engine.start()` should pass `initializeRuntime={false}`. Show
|
|
95
|
+
the flow after a Mentra Live connects. Hosts must provide `onOpenWifiSetup`;
|
|
96
|
+
the flow invokes it only for older glasses that cannot provide the OTA hotspot
|
|
97
|
+
transport.
|
|
98
|
+
|
|
75
99
|
## Imports
|
|
76
100
|
|
|
77
101
|
Inside `mobile/modules/engine/src/`, use **relative paths** (`./services/...`,
|
|
78
102
|
`../utils/...`). The mobile app's `@/*` alias is not configured here — there
|
|
79
103
|
is no build-time path rewriter for this module.
|
|
104
|
+
|
|
105
|
+
## Testing
|
|
106
|
+
|
|
107
|
+
Run the suite with `bun run test` (from this directory). It executes
|
|
108
|
+
`scripts/test.sh`, which runs **each test file in its own bun process** — do
|
|
109
|
+
not replace it with a single `bun test src`.
|
|
110
|
+
|
|
111
|
+
Why: bun's `mock.module` patches one process-wide module registry with live
|
|
112
|
+
ESM bindings, last write wins. Several suites mock the same specifiers
|
|
113
|
+
(`"@mentra/bluetooth-sdk/internal"` alone is mocked by `audioTestMocks.ts`,
|
|
114
|
+
`PhonePhotoCoordinator.test.ts`, and others), so in a shared process one
|
|
115
|
+
file's mock clobbers another's and suites that pass alone fail in the
|
|
116
|
+
combined run. Per-file processes give every suite an isolated registry.
|
|
117
|
+
|
|
118
|
+
The same rule applies when writing tests: it is fine to `mock.module` any
|
|
119
|
+
specifier your suite needs, but never rely on a mock installed by a
|
|
120
|
+
*different* test file — each file must set up everything it imports.
|
package/build/engine.d.ts
CHANGED
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
* live on the `@mentra/engine/internal` entry (and the debug singletons on
|
|
9
9
|
* `@mentra/engine/devtools`); they shrink as screens move onto `engine.*`.
|
|
10
10
|
*/
|
|
11
|
-
import { configure } from "./runtime/bootstrap";
|
|
11
|
+
import { configure, updateUiSeams } from "./runtime/bootstrap";
|
|
12
12
|
export declare const engine: {
|
|
13
13
|
/** Front door — hand engine auth + config, then start/stop the runtime. */
|
|
14
14
|
configure: typeof configure;
|
|
15
|
+
/** Merge host-UI seams on a running runtime (scan overlay, wifi setup, …). */
|
|
16
|
+
updateUiSeams: typeof updateUiSeams;
|
|
15
17
|
/** Start the runtime: mark started + construct/connect the cloud client + begin
|
|
16
18
|
* syncing device settings to the glasses. */
|
|
17
19
|
start(): Promise<void>;
|
|
@@ -138,6 +140,7 @@ export declare const engine: {
|
|
|
138
140
|
};
|
|
139
141
|
/** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */
|
|
140
142
|
ota: {
|
|
143
|
+
initialize: () => Promise<void>;
|
|
141
144
|
install: (otaVersionUrl?: string | null | undefined) => Promise<import("@mentra/bluetooth-sdk").OtaStartAckEvent>;
|
|
142
145
|
ping: () => Promise<void>;
|
|
143
146
|
checkForUpdates: (options?: import(".").OtaCheckCurrentGlassesOptions) => Promise<import(".").OtaCheckCurrentGlassesResult>;
|
|
@@ -147,6 +150,7 @@ export declare const engine: {
|
|
|
147
150
|
clearBuildNumberForNextCheck: () => void;
|
|
148
151
|
markMtkUpdatedThisSession: (updated: boolean) => void;
|
|
149
152
|
installSession: {
|
|
153
|
+
prepare: (result: import(".").OtaCheckCurrentGlassesResult) => "wifi" | "hotspot";
|
|
150
154
|
attach: () => void;
|
|
151
155
|
detach: () => void;
|
|
152
156
|
retry: () => void;
|
|
@@ -178,6 +182,8 @@ export declare const engine: {
|
|
|
178
182
|
miniapps: {
|
|
179
183
|
list: () => import("./types").ClientApp[];
|
|
180
184
|
onChanged: (cb: (apps: import("./types").ClientApp[]) => void) => (() => void);
|
|
185
|
+
buttonPressSubscribers: () => string[];
|
|
186
|
+
onButtonPressSubscribersChanged: (cb: (packageNames: string[]) => void) => (() => void);
|
|
181
187
|
refresh: () => Promise<void>;
|
|
182
188
|
start: (app: import("./types").ClientApp, opts?: import(".").StartOptions | undefined) => Promise<boolean>;
|
|
183
189
|
stop: (packageName: string) => Promise<void>;
|
|
@@ -210,7 +216,11 @@ export declare const engine: {
|
|
|
210
216
|
model: import("@mentra/bluetooth-sdk").DeviceModel;
|
|
211
217
|
name: string;
|
|
212
218
|
address?: string;
|
|
219
|
+
projectName?: string;
|
|
213
220
|
rssi?: number;
|
|
221
|
+
pairingMode?: boolean;
|
|
222
|
+
pairingCode?: string;
|
|
223
|
+
securePairingCapable?: boolean;
|
|
214
224
|
}[];
|
|
215
225
|
onFound: (cb: (results: ReturnType<() => import("./stores/core").CoreState>["searchResults"]) => void) => (() => void);
|
|
216
226
|
pair: (device: import("@mentra/bluetooth-sdk").Device, options?: import("@mentra/bluetooth-sdk").ConnectOptions) => Promise<void>;
|
|
@@ -224,8 +234,6 @@ export declare const engine: {
|
|
|
224
234
|
};
|
|
225
235
|
/** Phone→glasses notification forwarding (Android). */
|
|
226
236
|
phoneNotifications: {
|
|
227
|
-
enabled: () => boolean;
|
|
228
|
-
setEnabled: (enabled: boolean) => import("typesafe-ts").AsyncResult<void, Error> | undefined;
|
|
229
237
|
installedApps: () => Promise<Array<{
|
|
230
238
|
packageName: string;
|
|
231
239
|
appName: string;
|
package/build/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,EAAkD,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAmC5G,eAAO,MAAM,MAAM;IACjB,2EAA2E;;IAE3E,8EAA8E;;IAE9E;iDAC6C;;IA0E7C;;yCAEqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BrC,mFAAmF;;;;;;;;IAEnF,sEAAsE;;;;;;;;;;;;IAEtE,qFAAqF;;;gBA9FyB,CAAC;mBACpG,CAAC;;;gBAGgB,CAAC;mBAClB,CAAC;;;;;;;;;;;;;;;;IA2FZ,qEAAqE;;;;IAErE,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEtF,6EAA6E;;;;;;;;;;;;IAE7E,iFAAiF;;;;;;;;;;;;;;;;;;;IAEjF,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE9C,uDAAuD;;;;;;;;;;;;IAEvD,8EAA8E;;;;;;;IAE9E,qFAAqF;;;;;;;;;;;;;;CAGtF,CAAA"}
|
package/build/engine.js
CHANGED
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
* live on the `@mentra/engine/internal` entry (and the debug singletons on
|
|
9
9
|
* `@mentra/engine/devtools`); they shrink as screens move onto `engine.*`.
|
|
10
10
|
*/
|
|
11
|
-
import { configure, start as bootstrapStart, stop as bootstrapStop } from "./runtime/bootstrap";
|
|
11
|
+
import { configure, start as bootstrapStart, stop as bootstrapStop, updateUiSeams } from "./runtime/bootstrap";
|
|
12
12
|
import { cloudClientService } from "./services/CloudClientService";
|
|
13
13
|
import { hydrateDeviceStore, demoteOrphanedDefaultWearable } from "./services/DeviceStoreHydration";
|
|
14
14
|
import { startGlassesSettingsSync, stopGlassesSettingsSync } from "./services/GlassesSettingsSync";
|
|
15
15
|
import { startGlassesStatusProjection, stopGlassesStatusProjection } from "./services/GlassesStatusProjection";
|
|
16
16
|
import { startOtaService, stopOtaService } from "./services/OtaService";
|
|
17
17
|
import { startAudioCloudUplink, stopAudioCloudUplink } from "./services/AudioCloudUplink";
|
|
18
|
+
import { startSupportProfileSync, stopSupportProfileSync } from "./services/SupportProfileSync";
|
|
18
19
|
import { startDeviceEventRouter, stopDeviceEventRouter } from "./services/DeviceEventRouter";
|
|
19
20
|
import { startPhoneNotificationsSync, stopPhoneNotificationsSync } from "./services/PhoneNotificationsSync";
|
|
20
21
|
import { startCaptionsTesterReportService, stopCaptionsTesterReportService } from "./services/CaptionsTesterReportService";
|
|
@@ -41,6 +42,8 @@ import { logBuffer } from "./utils/devLogging";
|
|
|
41
42
|
export const engine = {
|
|
42
43
|
/** Front door — hand engine auth + config, then start/stop the runtime. */
|
|
43
44
|
configure,
|
|
45
|
+
/** Merge host-UI seams on a running runtime (scan overlay, wifi setup, …). */
|
|
46
|
+
updateUiSeams,
|
|
44
47
|
/** Start the runtime: mark started + construct/connect the cloud client + begin
|
|
45
48
|
* syncing device settings to the glasses. */
|
|
46
49
|
async start() {
|
|
@@ -55,7 +58,7 @@ export const engine = {
|
|
|
55
58
|
// Project native device status -> the engine stores (the inbound feed the rest
|
|
56
59
|
// of the runtime reads). Established first so the stores are live before the
|
|
57
60
|
// syncs below react to them.
|
|
58
|
-
startGlassesStatusProjection();
|
|
61
|
+
startGlassesStatusProjection((changed) => localMiniappRuntime.forwardEvent("glasses_connection_state", changed));
|
|
59
62
|
// Route the rest of the inbound device events (wifi/hotspot/gallery -> stores+bus,
|
|
60
63
|
// photo/stream -> coordinators, button/touch/accel/head -> miniapps, save_setting ->
|
|
61
64
|
// store, miniapp_selected -> launcher) so a bare OEM gets device data, not just the
|
|
@@ -91,6 +94,7 @@ export const engine = {
|
|
|
91
94
|
catch (error) {
|
|
92
95
|
console.warn("engine.start: initial Cloud V2 core token sync failed:", error instanceof Error ? error.message : error);
|
|
93
96
|
}
|
|
97
|
+
startSupportProfileSync();
|
|
94
98
|
// Push device-setting changes to the glasses for ANY host, so
|
|
95
99
|
// engine.glasses.settings.set() reaches the device (not just the Mentra app).
|
|
96
100
|
startGlassesSettingsSync();
|
|
@@ -131,6 +135,7 @@ export const engine = {
|
|
|
131
135
|
await safely("device event router", stopDeviceEventRouter);
|
|
132
136
|
await safely("ota service", stopOtaService);
|
|
133
137
|
await safely("audio cloud uplink", stopAudioCloudUplink);
|
|
138
|
+
await safely("support profile sync", stopSupportProfileSync);
|
|
134
139
|
await safely("phone notifications sync", stopPhoneNotificationsSync);
|
|
135
140
|
await safely("captions tester report service", stopCaptionsTesterReportService);
|
|
136
141
|
await safely("mentrajs crashloop report service", stopMentraJSCrashloopReportService);
|
package/build/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,EAAE,KAAK,IAAI,cAAc,EAAE,IAAI,IAAI,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAC7F,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAC,kBAAkB,EAAE,6BAA6B,EAAC,MAAM,iCAAiC,CAAA;AACjG,OAAO,EAAC,wBAAwB,EAAE,uBAAuB,EAAC,MAAM,gCAAgC,CAAA;AAChG,OAAO,EAAC,4BAA4B,EAAE,2BAA2B,EAAC,MAAM,oCAAoC,CAAA;AAC5G,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AACvF,OAAO,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,8BAA8B,CAAA;AAC1F,OAAO,EAAC,2BAA2B,EAAE,0BAA0B,EAAC,MAAM,mCAAmC,CAAA;AACzG,OAAO,EAAC,gCAAgC,EAAE,+BAA+B,EAAC,MAAM,wCAAwC,CAAA;AACxH,OAAO,EACL,mCAAmC,EACnC,kCAAkC,GACnC,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAAC,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAA;AAC/E,OAAO,mBAAmB,MAAM,gCAAgC,CAAA;AAChE,OAAO,gBAAgB,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAC,kBA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,EAAE,CAAC,CAAA;QAC7D,MAAM,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO;IACP,MAAM;IACN,mFAAmF;IACnF,OAAO;IACP,sEAAsE;IACtE,QAAQ;IACR,qFAAqF;IACrF,GAAG;IACH,qEAAqE;IACrE,OAAO;IACP,sFAAsF;IACtF,GAAG;IACH,6EAA6E;IAC7E,OAAO;IACP,iFAAiF;IACjF,QAAQ;IACR,8CAA8C;IAC9C,OAAO;IACP,uDAAuD;IACvD,kBAAkB;IAClB,8EAA8E;IAC9E,WAAW;IACX,qFAAqF;IACrF,aAAa;IACb,OAAO;CACR,CAAA","sourcesContent":["/**\n * `engine` — the namespaced OEM-facing engine API (the \"(A) host API\" from the\n * Phase-1 contract). Host UI calls `engine.<domain>.<method>()`; each domain is a\n * typed facade over the runtime. (Exported from the `@mentra/engine` module, whose\n * name stays `engine` in code; the public API surface is `engine`.)\n *\n * It grows one facade at a time. The migration-era flat store/service exports\n * live on the `@mentra/engine/internal` entry (and the debug singletons on\n * `@mentra/engine/devtools`); they shrink as screens move onto `engine.*`.\n */\nimport {configure, start as bootstrapStart, stop as bootstrapStop} from \"./runtime/bootstrap\"\nimport {cloudClientService} from \"./services/CloudClientService\"\nimport {hydrateDeviceStore, demoteOrphanedDefaultWearable} from \"./services/DeviceStoreHydration\"\nimport {startGlassesSettingsSync, stopGlassesSettingsSync} from \"./services/GlassesSettingsSync\"\nimport {startGlassesStatusProjection, stopGlassesStatusProjection} from \"./services/GlassesStatusProjection\"\nimport {startOtaService, stopOtaService} from \"./services/OtaService\"\nimport {startAudioCloudUplink, stopAudioCloudUplink} from \"./services/AudioCloudUplink\"\nimport {startDeviceEventRouter, stopDeviceEventRouter} from \"./services/DeviceEventRouter\"\nimport {startPhoneNotificationsSync, stopPhoneNotificationsSync} from \"./services/PhoneNotificationsSync\"\nimport {startCaptionsTesterReportService, stopCaptionsTesterReportService} from \"./services/CaptionsTesterReportService\"\nimport {\n startMentraJSCrashloopReportService,\n stopMentraJSCrashloopReportService,\n} from \"./services/MentraJSCrashloopReportService\"\nimport {ensureMiniappEngine, stopMiniappEngine} from \"./services/MiniappEngine\"\nimport localMiniappRuntime from \"./services/LocalMiniappRuntime\"\nimport displayProcessor from \"./services/DisplayProcessor\"\nimport {gallerySyncService} from \"./services/asg/gallerySyncService\"\nimport {glasses} from \"./facades/glasses\"\nimport {display} from \"./facades/display\"\nimport {speech} from \"./facades/speech\"\nimport {session} from \"./facades/session\"\nimport {settings} from \"./facades/settings\"\nimport {dev} from \"./facades/dev\"\nimport {reports} from \"./facades/reports\"\nimport {ota} from \"./facades/ota\"\nimport {gallery} from \"./facades/gallery\"\nimport {miniapps} from \"./facades/miniapps\"\nimport {pairing} from \"./facades/pairing\"\nimport {phoneNotifications} from \"./facades/phoneNotifications\"\nimport {permissions} from \"./facades/permissions\"\nimport {notifications} from \"./facades/notifications\"\nimport {logBuffer} from \"./utils/devLogging\"\n\nexport const engine = {\n /** Front door — hand engine auth + config, then start/stop the runtime. */\n configure,\n /** Start the runtime: mark started + construct/connect the cloud client + begin\n * syncing device settings to the glasses. */\n async start() {\n // Reports attach recent phone logs, so engine owns console interception for\n // OEM hosts too. Idempotent; the Mentra host may start it earlier.\n logBuffer.startConsoleInterception()\n await bootstrapStart()\n // Construct + connect the cloud client so the documented configure()+start()\n // lifecycle yields a live engine.session for OEMs. Idempotent for repeated\n // start() calls.\n cloudClientService.init()\n // Project native device status -> the engine stores (the inbound feed the rest\n // of the runtime reads). Established first so the stores are live before the\n // syncs below react to them.\n startGlassesStatusProjection()\n // Route the rest of the inbound device events (wifi/hotspot/gallery -> stores+bus,\n // photo/stream -> coordinators, button/touch/accel/head -> miniapps, save_setting ->\n // store, miniapp_selected -> launcher) so a bare OEM gets device data, not just the\n // Mentra app's MantleManager.\n startDeviceEventRouter()\n // Hydration contract: the native DeviceStore is in-memory and starts empty\n // every launch; seed it from the persisted settings BEFORE start() resolves\n // so every post-start getDefaultDevice() read is a trustworthy two-state\n // answer (no false \"absent\" for genuinely-paired users at cold start).\n // Ordered before startGlassesSettingsSync so the settings load can't\n // double-push through the change subscription. A failed hydration must not\n // brick the runtime: start() continues, and the guards that consume\n // hasDefaultDevice() see the rejection and fail open.\n try {\n await hydrateDeviceStore()\n // Boot repair: a persisted default_wearable without a native default\n // device (identity abandoned mid-pairing, or resurrected from the server\n // before identity stopped syncing) demotes to pending_wearable so hosts\n // render finish-pairing instead of a connect that would throw.\n await demoteOrphanedDefaultWearable()\n } catch (error) {\n console.warn(\"engine.start: device-store hydration failed:\", error instanceof Error ? error.message : error)\n }\n // Project the glasses' OTA events into the store for the engine.ota read surface.\n startOtaService()\n // Forward glasses mic_lc3 frames to the v2 cloud session so cloud transcription\n // works for any host (not just the Mentra app's host-side MantleManager fork).\n startAudioCloudUplink()\n try {\n await cloudClientService.syncCoreTokenToBluetooth()\n } catch (error) {\n console.warn(\n \"engine.start: initial Cloud V2 core token sync failed:\",\n error instanceof Error ? error.message : error,\n )\n }\n // Push device-setting changes to the glasses for ANY host, so\n // engine.glasses.settings.set() reaches the device (not just the Mentra app).\n startGlassesSettingsSync()\n // Same for phone-notification config -> the native listener (Android).\n startPhoneNotificationsSync()\n // Android internal/e2e: laptop captions tester can broadcast a failure intent;\n // engine owns turning that into a Cloud V2 report.\n startCaptionsTesterReportService()\n // MentraJS crashloop-disabled is runtime state; engine owns filing the\n // automatic report while hosts only render alert/telemetry side effects.\n startMentraJSCrashloopReportService()\n // Bring up the local-miniapp engine so a bare OEM can run MentraJS miniapps:\n // the LocalMiniappRuntime (registry + WebView bridge), the MentraJS router\n // (crust-bound spawn/dispatch pump + launcher wiring), the DisplayProcessor\n // (layout arbitration over the engine stores), and the gallery-sync service.\n // All idempotent — when the Mentra app's host bootstrap also calls these, the\n // second call is a no-op. Host-only crashloop telemetry is attached\n // separately by the Mentra app.\n localMiniappRuntime.initialize()\n ensureMiniappEngine()\n displayProcessor.attachToRuntime()\n gallerySyncService.initialize()\n },\n /** Stop the runtime: tear down the settings sync + cloud client + mark stopped.\n * Each step is guarded so one failing teardown can't skip the rest and leak\n * the remaining runtime services. */\n async stop() {\n const safely = async (label: string, step: () => unknown): Promise<void> => {\n try {\n await step()\n } catch (error) {\n console.warn(`engine.stop: ${label} failed:`, error)\n }\n }\n await safely(\"glasses settings sync\", stopGlassesSettingsSync)\n await safely(\"glasses status projection\", stopGlassesStatusProjection)\n await safely(\"device event router\", stopDeviceEventRouter)\n await safely(\"ota service\", stopOtaService)\n await safely(\"audio cloud uplink\", stopAudioCloudUplink)\n await safely(\"phone notifications sync\", stopPhoneNotificationsSync)\n await safely(\"captions tester report service\", stopCaptionsTesterReportService)\n await safely(\"mentrajs crashloop report service\", stopMentraJSCrashloopReportService)\n await safely(\"miniapp engine\", stopMiniappEngine)\n await safely(\"local miniapp runtime\", () => localMiniappRuntime.cleanup())\n await safely(\"display processor\", () => displayProcessor.detachFromRuntime())\n await safely(\"gallery sync service\", () => gallerySyncService.cleanup())\n await safely(\"cloud client\", () => cloudClientService.stop())\n await safely(\"bootstrap\", bootstrapStop)\n },\n glasses,\n speech,\n /** Cloud (cloud-v2) live-session status + account ops — engine owns the client. */\n session,\n /** Typed keyed user settings over the engine-owned settings store. */\n settings,\n /** Developer/debug surface (backend+cloud URL overrides, reconnect, min version). */\n dev,\n /** Bug-report, automatic runtime report, and feedback submission. */\n reports,\n /** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */\n ota,\n /** Gallery sync: status/onStatus · onNotice (host renders) · sync/cancel. */\n gallery,\n /** Miniapp lifecycle (the WebView bridge primitives are exported separately). */\n miniapps,\n /** First-time glasses discovery + pairing. */\n pairing,\n /** Phone→glasses notification forwarding (Android). */\n phoneNotifications,\n /** OS permissions (check/request/openSettings + per-miniapp requirements). */\n permissions,\n /** Inbound alerts engine→host (crashloop, version-incompatible, connection loss). */\n notifications,\n display,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/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kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAA;QAC7D,MAAM,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO;IACP,MAAM;IACN,mFAAmF;IACnF,OAAO;IACP,sEAAsE;IACtE,QAAQ;IACR,qFAAqF;IACrF,GAAG;IACH,qEAAqE;IACrE,OAAO;IACP,sFAAsF;IACtF,GAAG;IACH,6EAA6E;IAC7E,OAAO;IACP,iFAAiF;IACjF,QAAQ;IACR,8CAA8C;IAC9C,OAAO;IACP,uDAAuD;IACvD,kBAAkB;IAClB,8EAA8E;IAC9E,WAAW;IACX,qFAAqF;IACrF,aAAa;IACb,OAAO;CACR,CAAA","sourcesContent":["/**\n * `engine` — the namespaced OEM-facing engine API (the \"(A) host API\" from the\n * Phase-1 contract). Host UI calls `engine.<domain>.<method>()`; each domain is a\n * typed facade over the runtime. (Exported from the `@mentra/engine` module, whose\n * name stays `engine` in code; the public API surface is `engine`.)\n *\n * It grows one facade at a time. The migration-era flat store/service exports\n * live on the `@mentra/engine/internal` entry (and the debug singletons on\n * `@mentra/engine/devtools`); they shrink as screens move onto `engine.*`.\n */\nimport {configure, start as bootstrapStart, stop as bootstrapStop, updateUiSeams} from \"./runtime/bootstrap\"\nimport {cloudClientService} from \"./services/CloudClientService\"\nimport {hydrateDeviceStore, demoteOrphanedDefaultWearable} from \"./services/DeviceStoreHydration\"\nimport {startGlassesSettingsSync, stopGlassesSettingsSync} from \"./services/GlassesSettingsSync\"\nimport {startGlassesStatusProjection, stopGlassesStatusProjection} from \"./services/GlassesStatusProjection\"\nimport {startOtaService, stopOtaService} from \"./services/OtaService\"\nimport {startAudioCloudUplink, stopAudioCloudUplink} from \"./services/AudioCloudUplink\"\nimport {startSupportProfileSync, stopSupportProfileSync} from \"./services/SupportProfileSync\"\nimport {startDeviceEventRouter, stopDeviceEventRouter} from \"./services/DeviceEventRouter\"\nimport {startPhoneNotificationsSync, stopPhoneNotificationsSync} from \"./services/PhoneNotificationsSync\"\nimport {startCaptionsTesterReportService, stopCaptionsTesterReportService} from \"./services/CaptionsTesterReportService\"\nimport {\n startMentraJSCrashloopReportService,\n stopMentraJSCrashloopReportService,\n} from \"./services/MentraJSCrashloopReportService\"\nimport {ensureMiniappEngine, stopMiniappEngine} from \"./services/MiniappEngine\"\nimport localMiniappRuntime from \"./services/LocalMiniappRuntime\"\nimport displayProcessor from \"./services/DisplayProcessor\"\nimport {gallerySyncService} from \"./services/asg/gallerySyncService\"\nimport {glasses} from \"./facades/glasses\"\nimport {display} from \"./facades/display\"\nimport {speech} from \"./facades/speech\"\nimport {session} from \"./facades/session\"\nimport {settings} from \"./facades/settings\"\nimport {dev} from \"./facades/dev\"\nimport {reports} from \"./facades/reports\"\nimport {ota} from \"./facades/ota\"\nimport {gallery} from \"./facades/gallery\"\nimport {miniapps} from \"./facades/miniapps\"\nimport {pairing} from \"./facades/pairing\"\nimport {phoneNotifications} from \"./facades/phoneNotifications\"\nimport {permissions} from \"./facades/permissions\"\nimport {notifications} from \"./facades/notifications\"\nimport {logBuffer} from \"./utils/devLogging\"\n\nexport const engine = {\n /** Front door — hand engine auth + config, then start/stop the runtime. */\n configure,\n /** Merge host-UI seams on a running runtime (scan overlay, wifi setup, …). */\n updateUiSeams,\n /** Start the runtime: mark started + construct/connect the cloud client + begin\n * syncing device settings to the glasses. */\n async start() {\n // Reports attach recent phone logs, so engine owns console interception for\n // OEM hosts too. Idempotent; the Mentra host may start it earlier.\n logBuffer.startConsoleInterception()\n await bootstrapStart()\n // Construct + connect the cloud client so the documented configure()+start()\n // lifecycle yields a live engine.session for OEMs. Idempotent for repeated\n // start() calls.\n cloudClientService.init()\n // Project native device status -> the engine stores (the inbound feed the rest\n // of the runtime reads). Established first so the stores are live before the\n // syncs below react to them.\n startGlassesStatusProjection((changed) => localMiniappRuntime.forwardEvent(\"glasses_connection_state\", changed))\n // Route the rest of the inbound device events (wifi/hotspot/gallery -> stores+bus,\n // photo/stream -> coordinators, button/touch/accel/head -> miniapps, save_setting ->\n // store, miniapp_selected -> launcher) so a bare OEM gets device data, not just the\n // Mentra app's MantleManager.\n startDeviceEventRouter()\n // Hydration contract: the native DeviceStore is in-memory and starts empty\n // every launch; seed it from the persisted settings BEFORE start() resolves\n // so every post-start getDefaultDevice() read is a trustworthy two-state\n // answer (no false \"absent\" for genuinely-paired users at cold start).\n // Ordered before startGlassesSettingsSync so the settings load can't\n // double-push through the change subscription. A failed hydration must not\n // brick the runtime: start() continues, and the guards that consume\n // hasDefaultDevice() see the rejection and fail open.\n try {\n await hydrateDeviceStore()\n // Boot repair: a persisted default_wearable without a native default\n // device (identity abandoned mid-pairing, or resurrected from the server\n // before identity stopped syncing) demotes to pending_wearable so hosts\n // render finish-pairing instead of a connect that would throw.\n await demoteOrphanedDefaultWearable()\n } catch (error) {\n console.warn(\"engine.start: device-store hydration failed:\", error instanceof Error ? error.message : error)\n }\n // Project the glasses' OTA events into the store for the engine.ota read surface.\n startOtaService()\n // Forward glasses mic_lc3 frames to the v2 cloud session so cloud transcription\n // works for any host (not just the Mentra app's host-side MantleManager fork).\n startAudioCloudUplink()\n try {\n await cloudClientService.syncCoreTokenToBluetooth()\n } catch (error) {\n console.warn(\n \"engine.start: initial Cloud V2 core token sync failed:\",\n error instanceof Error ? error.message : error,\n )\n }\n startSupportProfileSync()\n // Push device-setting changes to the glasses for ANY host, so\n // engine.glasses.settings.set() reaches the device (not just the Mentra app).\n startGlassesSettingsSync()\n // Same for phone-notification config -> the native listener (Android).\n startPhoneNotificationsSync()\n // Android internal/e2e: laptop captions tester can broadcast a failure intent;\n // engine owns turning that into a Cloud V2 report.\n startCaptionsTesterReportService()\n // MentraJS crashloop-disabled is runtime state; engine owns filing the\n // automatic report while hosts only render alert/telemetry side effects.\n startMentraJSCrashloopReportService()\n // Bring up the local-miniapp engine so a bare OEM can run MentraJS miniapps:\n // the LocalMiniappRuntime (registry + WebView bridge), the MentraJS router\n // (crust-bound spawn/dispatch pump + launcher wiring), the DisplayProcessor\n // (layout arbitration over the engine stores), and the gallery-sync service.\n // All idempotent — when the Mentra app's host bootstrap also calls these, the\n // second call is a no-op. Host-only crashloop telemetry is attached\n // separately by the Mentra app.\n localMiniappRuntime.initialize()\n ensureMiniappEngine()\n displayProcessor.attachToRuntime()\n gallerySyncService.initialize()\n },\n /** Stop the runtime: tear down the settings sync + cloud client + mark stopped.\n * Each step is guarded so one failing teardown can't skip the rest and leak\n * the remaining runtime services. */\n async stop() {\n const safely = async (label: string, step: () => unknown): Promise<void> => {\n try {\n await step()\n } catch (error) {\n console.warn(`engine.stop: ${label} failed:`, error)\n }\n }\n await safely(\"glasses settings sync\", stopGlassesSettingsSync)\n await safely(\"glasses status projection\", stopGlassesStatusProjection)\n await safely(\"device event router\", stopDeviceEventRouter)\n await safely(\"ota service\", stopOtaService)\n await safely(\"audio cloud uplink\", stopAudioCloudUplink)\n await safely(\"support profile sync\", stopSupportProfileSync)\n await safely(\"phone notifications sync\", stopPhoneNotificationsSync)\n await safely(\"captions tester report service\", stopCaptionsTesterReportService)\n await safely(\"mentrajs crashloop report service\", stopMentraJSCrashloopReportService)\n await safely(\"miniapp engine\", stopMiniappEngine)\n await safely(\"local miniapp runtime\", () => localMiniappRuntime.cleanup())\n await safely(\"display processor\", () => displayProcessor.detachFromRuntime())\n await safely(\"gallery sync service\", () => gallerySyncService.cleanup())\n await safely(\"cloud client\", () => cloudClientService.stop())\n await safely(\"bootstrap\", bootstrapStop)\n },\n glasses,\n speech,\n /** Cloud (cloud-v2) live-session status + account ops — engine owns the client. */\n session,\n /** Typed keyed user settings over the engine-owned settings store. */\n settings,\n /** Developer/debug surface (backend+cloud URL overrides, reconnect, min version). */\n dev,\n /** Bug-report, automatic runtime report, and feedback submission. */\n reports,\n /** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */\n ota,\n /** Gallery sync: status/onStatus · onNotice (host renders) · sync/cancel. */\n gallery,\n /** Miniapp lifecycle (the WebView bridge primitives are exported separately). */\n miniapps,\n /** First-time glasses discovery + pairing. */\n pairing,\n /** Phone→glasses notification forwarding (Android). */\n phoneNotifications,\n /** OS permissions (check/request/openSettings + per-miniapp requirements). */\n permissions,\n /** Inbound alerts engine→host (crashloop, version-incompatible, connection loss). */\n notifications,\n display,\n}\n"]}
|
package/build/facades/dev.d.ts
CHANGED
|
@@ -34,8 +34,9 @@ export declare const dev: {
|
|
|
34
34
|
/**
|
|
35
35
|
* Side-load a miniapp being served from a dev machine (the `mentra dev` / CLI
|
|
36
36
|
* flow) by its URL: probes `<url>/miniapp.json`, and on a reachable manifest
|
|
37
|
-
* registers it
|
|
38
|
-
* and can
|
|
37
|
+
* registers it under its manifest package so it appears in `engine.miniapps`
|
|
38
|
+
* and can coexist with other dev miniapps. This is the OEM-host equivalent
|
|
39
|
+
* of the first-party
|
|
39
40
|
* developer-URL screen — the registration itself is engine-internal, so a
|
|
40
41
|
* host reaches it here rather than the internal registry. Rendering still
|
|
41
42
|
* flows through the normal display path once the miniapp is started.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/facades/dev.ts"],"names":[],"mappings":"AA+DA,iBAAS,oBAAoB;;;;;;;;;;;EAkB5B;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAE9E,eAAO,MAAM,GAAG;IACd,+CAA+C;qBAChC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC;IAIhD,0EAA0E;yBACrD;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC;IAkBtD,8EAA8E;0BAC1D,IAAI;IAExB,iFAAiF;uBAChE,MAAM;IACvB;;;OAGG;2BACkB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAK5C
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/facades/dev.ts"],"names":[],"mappings":"AA+DA,iBAAS,oBAAoB;;;;;;;;;;;EAkB5B;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAE9E,eAAO,MAAM,GAAG;IACd,+CAA+C;qBAChC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC;IAIhD,0EAA0E;yBACrD;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC;IAkBtD,8EAA8E;0BAC1D,IAAI;IAExB,iFAAiF;uBAChE,MAAM;IACvB;;;OAGG;2BACkB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAK5C;;;;;;;;;OASG;0BAEI,MAAM,SACJ,MAAM,KACZ,OAAO,CAAC;QAAC,EAAE,EAAE,IAAI,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG;QAAC,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC;IAyCtF,qEAAqE;yBAClD,wBAAwB;IAE3C,gFAAgF;0BAC1D,CAAC,MAAM,EAAE,wBAAwB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;CAmBhF,CAAA"}
|
package/build/facades/dev.js
CHANGED
|
@@ -116,8 +116,9 @@ export const dev = {
|
|
|
116
116
|
/**
|
|
117
117
|
* Side-load a miniapp being served from a dev machine (the `mentra dev` / CLI
|
|
118
118
|
* flow) by its URL: probes `<url>/miniapp.json`, and on a reachable manifest
|
|
119
|
-
* registers it
|
|
120
|
-
* and can
|
|
119
|
+
* registers it under its manifest package so it appears in `engine.miniapps`
|
|
120
|
+
* and can coexist with other dev miniapps. This is the OEM-host equivalent
|
|
121
|
+
* of the first-party
|
|
121
122
|
* developer-URL screen — the registration itself is engine-internal, so a
|
|
122
123
|
* host reaches it here rather than the internal registry. Rendering still
|
|
123
124
|
* flows through the normal display path once the miniapp is started.
|
|
@@ -131,26 +132,31 @@ export const dev = {
|
|
|
131
132
|
return { ok: false, error: "dev server unreachable, or no miniapp.json served there" };
|
|
132
133
|
}
|
|
133
134
|
const manifest = result.manifest;
|
|
135
|
+
const appName = name ?? manifest.name ?? "Dev Miniapp";
|
|
136
|
+
const packageName = manifest.packageName ?? DEV_APP_PACKAGE_NAME;
|
|
137
|
+
// Persist the host that answered — not the stale input IP — so home-tile
|
|
138
|
+
// relaunches skip a dead LAN address after mDNS/Metro failover.
|
|
139
|
+
const resolvedUrl = result.resolvedUrl || devUrl;
|
|
134
140
|
// The `mentra-miniapp dev` server puts the hot-reload/log sidecar on the
|
|
135
141
|
// user port PLUS ONE — same convention as the first-party developer-URL
|
|
136
142
|
// screen's deriveDevPort.
|
|
137
143
|
let devPort;
|
|
138
144
|
try {
|
|
139
|
-
const parsed = Number(new URL(
|
|
145
|
+
const parsed = Number(new URL(resolvedUrl).port);
|
|
140
146
|
devPort = Number.isFinite(parsed) && parsed > 0 ? parsed + 1 : undefined;
|
|
141
147
|
}
|
|
142
148
|
catch {
|
|
143
149
|
devPort = undefined;
|
|
144
150
|
}
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
packageName: manifest.packageName ?? DEV_APP_PACKAGE_NAME,
|
|
151
|
+
const existing = useAppStatusStore.getState().apps.find((app) => app.packageName === packageName);
|
|
152
|
+
if (existing?.running)
|
|
153
|
+
await useAppStatusStore.getState().stop(packageName);
|
|
154
|
+
await registerDevApp({
|
|
155
|
+
packageName,
|
|
151
156
|
name: appName,
|
|
152
|
-
iconUrl: manifest.icon ? new URL(manifest.icon, `${
|
|
153
|
-
|
|
157
|
+
iconUrl: manifest.icon ? new URL(manifest.icon, `${resolvedUrl}/`).toString() : `${resolvedUrl}/icon.png`,
|
|
158
|
+
// Persist the host that answered — not the stale input IP.
|
|
159
|
+
devUrl: resolvedUrl,
|
|
154
160
|
devPort,
|
|
155
161
|
type: manifest.type,
|
|
156
162
|
permissions: manifest.permissions,
|
|
@@ -158,7 +164,7 @@ export const dev = {
|
|
|
158
164
|
actions: manifest.actions,
|
|
159
165
|
});
|
|
160
166
|
await useAppStatusStore.getState().refresh();
|
|
161
|
-
return { ok: true, packageName
|
|
167
|
+
return { ok: true, packageName, name: appName };
|
|
162
168
|
},
|
|
163
169
|
/** Current engine runtime status for engine-owned debug surfaces. */
|
|
164
170
|
runtimeStatus: () => projectRuntimeStatus(),
|
package/build/facades/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/facades/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAC,cAAc,EAAE,oBAAoB,EAAoB,MAAM,yBAAyB,CAAA;AAC/F,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAIhD;;;;GAIG;AACH,SAAS,sBAAsB,CAAC,OAA0B,wBAAwB,EAAE;IAClF,MAAM,QAAQ,GAAG,8BAA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W,EAAE,CAAC,CAAA;QACvD,CAAC,CAAA;IACH,CAAC;CACF,CAAA","sourcesContent":["/**\n * dev facade — `engine.dev`: developer/debug surface over engine-owned state.\n * Backend/cloud URL overrides read+write the engine settings store; the cloud\n * URL setters reconnect the engine-owned cloud client onto the new endpoints;\n *\n * NOTE: the dev-time endpoint *resolution* (Metro-host auto-detect, env defaults)\n * still lives host-side in `@/services/cloudClient` during the migration; this\n * facade manages the explicit overrides + reconnect.\n */\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport {isGlassesReady} from \"../services/GlassesReadiness\"\nimport {useCloudClientStatusStore} from \"../stores/cloudClientStatus\"\nimport {useConnectionStore} from \"../stores/connection\"\nimport {useCoreStore} from \"../stores/core\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {cloudClientService} from \"../services/CloudClientService\"\nimport {getConfigValues} from \"../runtime/bootstrap\"\nimport {decideDevLaunchRoute} from \"../utils/devMiniappLaunch\"\nimport {registerDevApp, DEV_APP_PACKAGE_NAME, type DevAppRecord} from \"../services/AppRegistry\"\nimport {useAppStatusStore} from \"../stores/apps\"\n\ntype CloudUrlOverrides = {core?: string; runtime?: string}\n\n/**\n * Reconnect the cloud client onto the current cloud-URL overrides. Explicit\n * partial overrides merge over the boot-resolved config (which carries the\n * host's Metro/env URL resolution); both empty clears the live override.\n */\nfunction applyCloudUrlReconnect(urls: CloudUrlOverrides = currentCloudUrlOverrides()): void {\n const resolved = resolveCloudUrlReconnectTarget(urls)\n if (resolved === undefined) {\n cloudClientService.reconnect(null)\n } else if (resolved) {\n cloudClientService.reconnect(resolved)\n } else {\n console.warn(\"engine.dev.setCloudUrls: partial cloud override missing boot-resolved sibling endpoint\")\n }\n}\n\nfunction currentCloudUrlOverrides(): CloudUrlOverrides {\n const s = useSettingsStore.getState()\n return {\n core: trimSetting(s.getSetting(SETTINGS.cloud_core_url.key)),\n runtime: trimSetting(s.getSetting(SETTINGS.cloud_runtime_url.key)),\n }\n}\n\nfunction resolveCloudUrlReconnectTarget(urls: CloudUrlOverrides): {core: string; runtime: string} | null | undefined {\n const core = trimSetting(urls.core)\n const runtime = trimSetting(urls.runtime)\n if (!core && !runtime) return undefined\n\n const config = getConfigValues()\n const resolvedCore = core || config.coreUrl?.trim()\n const resolvedRuntime = runtime || config.runtimeUrl?.trim()\n return resolvedCore && resolvedRuntime ? {core: resolvedCore, runtime: resolvedRuntime} : null\n}\n\nfunction trimSetting(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim().length > 0 ? value.trim() : undefined\n}\n\nfunction projectRuntimeStatus() {\n const core = useCoreStore.getState()\n const glasses = useGlassesStore.getState()\n const connection = useConnectionStore.getState()\n const cloudClient = useCloudClientStatusStore.getState()\n return {\n searching: core.searching,\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n micRanking: [...core.micRanking],\n currentMic: core.currentMic,\n systemMicUnavailable: core.systemMicUnavailable,\n glassesConnected: glasses.connection.state === \"connected\",\n glassesFullyBooted: isGlassesReady(glasses.connection),\n bluetoothClassicConnected: glasses.bluetoothClassicConnected,\n coreStatus: connection.status,\n cloudClientStatus: cloudClient.status,\n cloudClientAudioTransport: cloudClient.audioTransport,\n }\n}\n\nexport type DevRuntimeStatusSnapshot = ReturnType<typeof projectRuntimeStatus>\n\nexport const dev = {\n /** The cloud-v2 core/runtime URL overrides. */\n cloudUrls: (): {core?: string; runtime?: string} => {\n const s = useSettingsStore.getState()\n return {core: s.getSetting(SETTINGS.cloud_core_url.key), runtime: s.getSetting(SETTINGS.cloud_runtime_url.key)}\n },\n /** Override the cloud-v2 URLs and reconnect the live client onto them. */\n setCloudUrls: (urls: {core?: string; runtime?: string}) => {\n const next = {...currentCloudUrlOverrides(), ...urls}\n const resolved = resolveCloudUrlReconnectTarget(next)\n if (resolved === null) {\n console.warn(\"engine.dev.setCloudUrls: ignoring partial cloud override without a resolvable sibling endpoint\")\n return\n }\n\n const s = useSettingsStore.getState()\n if (urls.core !== undefined) s.setSetting(SETTINGS.cloud_core_url.key, urls.core)\n if (urls.runtime !== undefined) s.setSetting(SETTINGS.cloud_runtime_url.key, urls.runtime)\n if (resolved === undefined) {\n cloudClientService.reconnect(null)\n } else {\n cloudClientService.reconnect(resolved)\n }\n },\n\n /** Tear down + rebuild the live cloud client (the dev \"reconnect\" button). */\n reconnectCloud: (): void => applyCloudUrlReconnect(),\n\n /** Current native (BLE-process) memory usage in MB — a dev/diagnostics gauge. */\n getMemoryMB: (): number => BluetoothSdk.getMemoryMB(),\n /**\n * Phone-side bluetooth runtime snapshot (the core store read-model: scan/mic/\n * search state) — the diagnostics/data-export surface. Shallow copy.\n */\n bluetoothStatus: (): Record<string, unknown> => {\n const {setCoreInfo: _setCoreInfo, reset: _reset, ...state} = useCoreStore.getState()\n return {...state}\n },\n\n /**\n * Side-load a miniapp being served from a dev machine (the `mentra dev` / CLI\n * flow) by its URL: probes `<url>/miniapp.json`, and on a reachable manifest\n * registers it into the single dev slot so it appears in `engine.miniapps`\n * and can be started. This is the OEM-host equivalent of the first-party\n * developer-URL screen — the registration itself is engine-internal, so a\n * host reaches it here rather than the internal registry. Rendering still\n * flows through the normal display path once the miniapp is started.\n */\n loadDevMiniapp: async (\n url: string,\n name?: string,\n ): Promise<{ok: true; packageName: string; name: string} | {ok: false; error: string}> => {\n const devUrl = url.trim().replace(/\\/+$/, \"\")\n if (!devUrl) return {ok: false, error: \"empty url\"}\n const result = await decideDevLaunchRoute(\"\", devUrl)\n if (result.decision !== \"live\") {\n return {ok: false, error: \"dev server unreachable, or no miniapp.json served there\"}\n }\n const manifest = result.manifest\n // The `mentra-miniapp dev` server puts the hot-reload/log sidecar on the\n // user port PLUS ONE — same convention as the first-party developer-URL\n // screen's deriveDevPort.\n let devPort: number | undefined\n try {\n const parsed = Number(new URL(devUrl).port)\n devPort = Number.isFinite(parsed) && parsed > 0 ? parsed + 1 : undefined\n } catch {\n devPort = undefined\n }\n const appName = name ?? manifest.name ?? \"Dev Miniapp\"\n registerDevApp({\n // The REAL manifest package: registerDevApp preserves it as\n // sourcePackageName (miniapp auth + dev-slot cleanup key off it) before\n // forcing packageName to the single dev slot.\n packageName: (manifest.packageName as string | undefined) ?? DEV_APP_PACKAGE_NAME,\n name: appName,\n iconUrl: manifest.icon ? new URL(manifest.icon, `${devUrl}/`).toString() : `${devUrl}/icon.png`,\n devUrl,\n devPort,\n type: manifest.type as DevAppRecord[\"type\"],\n permissions: manifest.permissions as DevAppRecord[\"permissions\"],\n hardwareRequirements: manifest.hardwareRequirements as DevAppRecord[\"hardwareRequirements\"],\n actions: manifest.actions as DevAppRecord[\"actions\"],\n })\n await useAppStatusStore.getState().refresh()\n return {ok: true, packageName: DEV_APP_PACKAGE_NAME, name: appName}\n },\n\n /** Current engine runtime status for engine-owned debug surfaces. */\n runtimeStatus: (): DevRuntimeStatusSnapshot => projectRuntimeStatus(),\n\n /** Subscribe to the projected engine runtime status; returns an unsubscribe. */\n onRuntimeStatus: (cb: (status: DevRuntimeStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectRuntimeStatus())\n const notify = () => {\n const snap = projectRuntimeStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n }\n const unsubscribers = [\n useCoreStore.subscribe(notify),\n useGlassesStore.subscribe(notify),\n useConnectionStore.subscribe(notify),\n useCloudClientStatusStore.subscribe(notify),\n ]\n return () => {\n unsubscribers.forEach((unsubscribe) => unsubscribe())\n }\n },\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/facades/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AACvD,OAAO,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O,EAAE,CAAA;QAC5C,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAC,CAAA;IAC/C,CAAC;IAED,qEAAqE;IACrE,aAAa,EAAE,GAA6B,EAAE,CAAC,oBAAoB,EAAE;IAErE,gFAAgF;IAChF,eAAe,EAAE,CAAC,EAA8C,EAAgB,EAAE;QAChF,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE,CAAC,CAAA;QACjD,MAAM,MAAM,GAAG,GAAG,EAAE;YAClB,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAA;YACnC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAChC,IAAI,GAAG,KAAK,IAAI;gBAAE,OAAM;YACxB,IAAI,GAAG,GAAG,CAAA;YACV,EAAE,CAAC,IAAI,CAAC,CAAA;QACV,CAAC,CAAA;QACD,MAAM,aAAa,GAAG;YACpB,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC;YAC9B,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC;YACjC,kBAAkB,CAAC,SAAS,CAAC,MAAM,CAAC;YACpC,yBAAyB,CAAC,SAAS,CAAC,MAAM,CAAC;SAC5C,CAAA;QACD,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;QACvD,CAAC,CAAA;IACH,CAAC;CACF,CAAA","sourcesContent":["/**\n * dev facade — `engine.dev`: developer/debug surface over engine-owned state.\n * Backend/cloud URL overrides read+write the engine settings store; the cloud\n * URL setters reconnect the engine-owned cloud client onto the new endpoints;\n *\n * NOTE: the dev-time endpoint *resolution* (Metro-host auto-detect, env defaults)\n * still lives host-side in `@/services/cloudClient` during the migration; this\n * facade manages the explicit overrides + reconnect.\n */\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport {isGlassesReady} from \"../services/GlassesReadiness\"\nimport {useCloudClientStatusStore} from \"../stores/cloudClientStatus\"\nimport {useConnectionStore} from \"../stores/connection\"\nimport {useCoreStore} from \"../stores/core\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {cloudClientService} from \"../services/CloudClientService\"\nimport {getConfigValues} from \"../runtime/bootstrap\"\nimport {decideDevLaunchRoute} from \"../utils/devMiniappLaunch\"\nimport {registerDevApp, DEV_APP_PACKAGE_NAME, type DevAppRecord} from \"../services/AppRegistry\"\nimport {useAppStatusStore} from \"../stores/apps\"\n\ntype CloudUrlOverrides = {core?: string; runtime?: string}\n\n/**\n * Reconnect the cloud client onto the current cloud-URL overrides. Explicit\n * partial overrides merge over the boot-resolved config (which carries the\n * host's Metro/env URL resolution); both empty clears the live override.\n */\nfunction applyCloudUrlReconnect(urls: CloudUrlOverrides = currentCloudUrlOverrides()): void {\n const resolved = resolveCloudUrlReconnectTarget(urls)\n if (resolved === undefined) {\n cloudClientService.reconnect(null)\n } else if (resolved) {\n cloudClientService.reconnect(resolved)\n } else {\n console.warn(\"engine.dev.setCloudUrls: partial cloud override missing boot-resolved sibling endpoint\")\n }\n}\n\nfunction currentCloudUrlOverrides(): CloudUrlOverrides {\n const s = useSettingsStore.getState()\n return {\n core: trimSetting(s.getSetting(SETTINGS.cloud_core_url.key)),\n runtime: trimSetting(s.getSetting(SETTINGS.cloud_runtime_url.key)),\n }\n}\n\nfunction resolveCloudUrlReconnectTarget(urls: CloudUrlOverrides): {core: string; runtime: string} | null | undefined {\n const core = trimSetting(urls.core)\n const runtime = trimSetting(urls.runtime)\n if (!core && !runtime) return undefined\n\n const config = getConfigValues()\n const resolvedCore = core || config.coreUrl?.trim()\n const resolvedRuntime = runtime || config.runtimeUrl?.trim()\n return resolvedCore && resolvedRuntime ? {core: resolvedCore, runtime: resolvedRuntime} : null\n}\n\nfunction trimSetting(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim().length > 0 ? value.trim() : undefined\n}\n\nfunction projectRuntimeStatus() {\n const core = useCoreStore.getState()\n const glasses = useGlassesStore.getState()\n const connection = useConnectionStore.getState()\n const cloudClient = useCloudClientStatusStore.getState()\n return {\n searching: core.searching,\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n micRanking: [...core.micRanking],\n currentMic: core.currentMic,\n systemMicUnavailable: core.systemMicUnavailable,\n glassesConnected: glasses.connection.state === \"connected\",\n glassesFullyBooted: isGlassesReady(glasses.connection),\n bluetoothClassicConnected: glasses.bluetoothClassicConnected,\n coreStatus: connection.status,\n cloudClientStatus: cloudClient.status,\n cloudClientAudioTransport: cloudClient.audioTransport,\n }\n}\n\nexport type DevRuntimeStatusSnapshot = ReturnType<typeof projectRuntimeStatus>\n\nexport const dev = {\n /** The cloud-v2 core/runtime URL overrides. */\n cloudUrls: (): {core?: string; runtime?: string} => {\n const s = useSettingsStore.getState()\n return {core: s.getSetting(SETTINGS.cloud_core_url.key), runtime: s.getSetting(SETTINGS.cloud_runtime_url.key)}\n },\n /** Override the cloud-v2 URLs and reconnect the live client onto them. */\n setCloudUrls: (urls: {core?: string; runtime?: string}) => {\n const next = {...currentCloudUrlOverrides(), ...urls}\n const resolved = resolveCloudUrlReconnectTarget(next)\n if (resolved === null) {\n console.warn(\"engine.dev.setCloudUrls: ignoring partial cloud override without a resolvable sibling endpoint\")\n return\n }\n\n const s = useSettingsStore.getState()\n if (urls.core !== undefined) s.setSetting(SETTINGS.cloud_core_url.key, urls.core)\n if (urls.runtime !== undefined) s.setSetting(SETTINGS.cloud_runtime_url.key, urls.runtime)\n if (resolved === undefined) {\n cloudClientService.reconnect(null)\n } else {\n cloudClientService.reconnect(resolved)\n }\n },\n\n /** Tear down + rebuild the live cloud client (the dev \"reconnect\" button). */\n reconnectCloud: (): void => applyCloudUrlReconnect(),\n\n /** Current native (BLE-process) memory usage in MB — a dev/diagnostics gauge. */\n getMemoryMB: (): number => BluetoothSdk.getMemoryMB(),\n /**\n * Phone-side bluetooth runtime snapshot (the core store read-model: scan/mic/\n * search state) — the diagnostics/data-export surface. Shallow copy.\n */\n bluetoothStatus: (): Record<string, unknown> => {\n const {setCoreInfo: _setCoreInfo, reset: _reset, ...state} = useCoreStore.getState()\n return {...state}\n },\n\n /**\n * Side-load a miniapp being served from a dev machine (the `mentra dev` / CLI\n * flow) by its URL: probes `<url>/miniapp.json`, and on a reachable manifest\n * registers it under its manifest package so it appears in `engine.miniapps`\n * and can coexist with other dev miniapps. This is the OEM-host equivalent\n * of the first-party\n * developer-URL screen — the registration itself is engine-internal, so a\n * host reaches it here rather than the internal registry. Rendering still\n * flows through the normal display path once the miniapp is started.\n */\n loadDevMiniapp: async (\n url: string,\n name?: string,\n ): Promise<{ok: true; packageName: string; name: string} | {ok: false; error: string}> => {\n const devUrl = url.trim().replace(/\\/+$/, \"\")\n if (!devUrl) return {ok: false, error: \"empty url\"}\n const result = await decideDevLaunchRoute(\"\", devUrl)\n if (result.decision !== \"live\") {\n return {ok: false, error: \"dev server unreachable, or no miniapp.json served there\"}\n }\n const manifest = result.manifest\n const appName = name ?? manifest.name ?? \"Dev Miniapp\"\n const packageName = (manifest.packageName as string | undefined) ?? DEV_APP_PACKAGE_NAME\n // Persist the host that answered — not the stale input IP — so home-tile\n // relaunches skip a dead LAN address after mDNS/Metro failover.\n const resolvedUrl = result.resolvedUrl || devUrl\n // The `mentra-miniapp dev` server puts the hot-reload/log sidecar on the\n // user port PLUS ONE — same convention as the first-party developer-URL\n // screen's deriveDevPort.\n let devPort: number | undefined\n try {\n const parsed = Number(new URL(resolvedUrl).port)\n devPort = Number.isFinite(parsed) && parsed > 0 ? parsed + 1 : undefined\n } catch {\n devPort = undefined\n }\n const existing = useAppStatusStore.getState().apps.find((app) => app.packageName === packageName)\n if (existing?.running) await useAppStatusStore.getState().stop(packageName)\n await registerDevApp({\n packageName,\n name: appName,\n iconUrl: manifest.icon ? new URL(manifest.icon, `${resolvedUrl}/`).toString() : `${resolvedUrl}/icon.png`,\n // Persist the host that answered — not the stale input IP.\n devUrl: resolvedUrl,\n devPort,\n type: manifest.type as DevAppRecord[\"type\"],\n permissions: manifest.permissions as DevAppRecord[\"permissions\"],\n hardwareRequirements: manifest.hardwareRequirements as DevAppRecord[\"hardwareRequirements\"],\n actions: manifest.actions as DevAppRecord[\"actions\"],\n })\n await useAppStatusStore.getState().refresh()\n return {ok: true, packageName, name: appName}\n },\n\n /** Current engine runtime status for engine-owned debug surfaces. */\n runtimeStatus: (): DevRuntimeStatusSnapshot => projectRuntimeStatus(),\n\n /** Subscribe to the projected engine runtime status; returns an unsubscribe. */\n onRuntimeStatus: (cb: (status: DevRuntimeStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectRuntimeStatus())\n const notify = () => {\n const snap = projectRuntimeStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n }\n const unsubscribers = [\n useCoreStore.subscribe(notify),\n useGlassesStore.subscribe(notify),\n useConnectionStore.subscribe(notify),\n useCloudClientStatusStore.subscribe(notify),\n ]\n return () => {\n unsubscribers.forEach((unsubscribe) => unsubscribe())\n }\n },\n}\n"]}
|
package/build/facades/gallery.js
CHANGED
|
@@ -16,7 +16,7 @@ function projectStatus() {
|
|
|
16
16
|
processingFiles: Array.from(progress.processingFiles),
|
|
17
17
|
processedFiles: s.processedFiles,
|
|
18
18
|
isSyncing: selectIssyncing(s),
|
|
19
|
-
isStarting:
|
|
19
|
+
isStarting: s.syncStarting,
|
|
20
20
|
glassesGallery: selectGlassesGalleryStatus(s),
|
|
21
21
|
// Copy: the snapshot must not hand callers a mutable reference into the store
|
|
22
22
|
// (each queue item is copied too — callers must not mutate them in place).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gallery.js","sourceRoot":"","sources":["../../src/facades/gallery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,0BAA0B,GAC3B,MAA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AC,QAAQ,EAAE,CAAC,UAAU,EAAE;IACnE,oFAAoF;IACpF,yBAAyB,EAAE,GAAS,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,yBAAyB,EAAE;CAClG,CAAA","sourcesContent":["/**\n * gallery facade — `engine.gallery`: the OEM-facing gallery-sync surface. Engine's\n * gallerySyncService orchestrates the sync (hotspot → wifi → HTTP fetch → process →\n * store); this facade exposes the projected status + the structured notices the host\n * renders its own UI from, plus the sync/cancel actions. No host-injected UI — the host\n * owns all alerts/navigation/i18n (it renders them off `onNotice`).\n */\nimport {\n useGallerySyncStore,\n selectSyncProgress,\n selectIssyncing,\n selectGlassesGalleryStatus,\n} from \"../stores/gallerySync\"\nimport {gallerySyncService} from \"../services/asg/gallerySyncService\"\nimport {onGalleryNotice, type GalleryNotice} from \"../services/asg/galleryNotices\"\n\nfunction projectStatus() {\n const s = useGallerySyncStore.getState()\n const progress = selectSyncProgress(s)\n return {\n ...progress,\n processingFiles: Array.from(progress.processingFiles),\n processedFiles: s.processedFiles,\n isSyncing: selectIssyncing(s),\n isStarting: s.syncStarting,\n glassesGallery: selectGlassesGalleryStatus(s),\n // Copy: the snapshot must not hand callers a mutable reference into the store\n // (each queue item is copied too — callers must not mutate them in place).\n queue: s.queue.map((item) => ({...item})),\n queueLength: s.queue.length,\n queueIndex: s.queueIndex,\n }\n}\n\nexport type GallerySyncStatus = ReturnType<typeof projectStatus>\n\nexport const gallery = {\n /** Snapshot of the current sync state + progress. */\n status: (): GallerySyncStatus => projectStatus(),\n /** Subscribe to sync-state changes; returns an unsubscribe. Deduped on the projected\n * status (the gallerySync store mutates many unrelated fields during a sync), so the\n * host only re-renders when the projection actually changes — matches the other\n * read-model facades. */\n onStatus: (cb: (status: GallerySyncStatus) => void): (() => void) => {\n let last = JSON.stringify(projectStatus())\n return useGallerySyncStore.subscribe(() => {\n const status = projectStatus()\n const serialized = JSON.stringify(status)\n if (serialized === last) return\n last = serialized\n cb(status)\n })\n },\n /** Subscribe to user-actionable notices (host renders alerts / settings deep-links). */\n onNotice: (cb: (notice: GalleryNotice) => void): (() => void) => onGalleryNotice(cb),\n\n /** Start a gallery sync (the host gates connectivity/permissions first). */\n sync: (): Promise<void> => gallerySyncService.startSync(),\n /** Cancel an in-progress sync. */\n cancel: (): Promise<void> => gallerySyncService.cancelSync(),\n /** Ask glasses to refresh their gallery summary counts. */\n refreshStatus: (): Promise<void> => gallerySyncService.queryGlassesGalleryStatus(),\n /** Remove local files from the current gallery queue after host-owned deletion UI completes. */\n removeFilesFromQueue: (fileNames: string[]): void => useGallerySyncStore.getState().removeFilesFromQueue(fileNames),\n /** Clear the current gallery sync queue after host-owned bulk deletion completes. */\n clearQueue: (): void => useGallerySyncStore.getState().clearQueue(),\n /** Clear the cached glasses gallery summary when product UI observes disconnect. */\n clearGlassesGalleryStatus: (): void => useGallerySyncStore.getState().clearGlassesGalleryStatus(),\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,KAAK,EAAC,gBAAgB,EAAE,UAAU,EAAC,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,KAAK,EAAC,gBAAgB,EAAE,UAAU,EAAC,MAAM,gCAAgC,CAAA;AAYhF,iBAAS,aAAa;;;;;;;;;;;;;;;EAarB;AAED,iBAAS,uBAAuB;;;;;EAQ/B;AAED,iBAAS,WAAW;;;;;;;;;;;;;;;;;;;;;;;EAqBnB;AAED,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;AACpE,MAAM,MA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import { hasDefaultDevice } from "../services/DeviceStoreHydration";
|
|
|
17
17
|
import { projectPairingIdentity } from "../services/PairingIdentity";
|
|
18
18
|
import { isGlassesConnected, isGlassesReady } from "../services/GlassesReadiness";
|
|
19
19
|
import { pushAllBluetoothSettings } from "../services/GlassesSettingsSync";
|
|
20
|
+
import { recordSupportProfileConnectionFailure } from "../services/SupportProfileSync";
|
|
20
21
|
import { getModelCapabilities } from "../types";
|
|
21
22
|
import { glassesWifi } from "./glassesWifi";
|
|
22
23
|
import { glassesSettings } from "./glassesSettings";
|
|
@@ -58,6 +59,7 @@ function projectInfo() {
|
|
|
58
59
|
serialNumber: s.serialNumber,
|
|
59
60
|
buildNumber: s.buildNumber,
|
|
60
61
|
btMac: s.bluetoothMacAddress,
|
|
62
|
+
wifiMac: s.wifiMacAddress,
|
|
61
63
|
leftMac: s.leftMacAddress,
|
|
62
64
|
rightMac: s.rightMacAddress,
|
|
63
65
|
// Copy: the snapshot must not hand callers a mutable reference into the store.
|
|
@@ -72,15 +74,27 @@ export const glasses = {
|
|
|
72
74
|
* the glasses (this used to be a host-side step before `connectDefault`).
|
|
73
75
|
*/
|
|
74
76
|
connectDefault: async () => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
try {
|
|
78
|
+
await pushAllBluetoothSettings();
|
|
79
|
+
await BluetoothSdk.connectDefault();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
recordSupportProfileConnectionFailure(error, "connect_default");
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
77
85
|
},
|
|
78
86
|
disconnect: () => BluetoothSdk.disconnect(),
|
|
79
87
|
forget: () => BluetoothSdk.forget(),
|
|
80
88
|
/** Connect to a specific (discovered) device. */
|
|
81
89
|
connect: async (...args) => {
|
|
82
|
-
|
|
83
|
-
|
|
90
|
+
try {
|
|
91
|
+
await pushAllBluetoothSettings();
|
|
92
|
+
await BluetoothSdk.connect(...args);
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
recordSupportProfileConnectionFailure(error, "connect");
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
84
98
|
},
|
|
85
99
|
/** Connect the built-in simulated glasses (dev/testing). */
|
|
86
100
|
connectSimulated: () => BluetoothSdk.connectSimulated(),
|
|
@@ -104,6 +118,7 @@ export const glasses = {
|
|
|
104
118
|
await BluetoothSdk.connectDefault();
|
|
105
119
|
}
|
|
106
120
|
catch (error) {
|
|
121
|
+
recordSupportProfileConnectionFailure(error, "reconnect");
|
|
107
122
|
console.warn("engine.glasses.reconnect failed:", error);
|
|
108
123
|
return false;
|
|
109
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,kFAAkF;AAClF,sFAAsF;AACtF,uEAAuE;AACvE,OAAO,YAAY,MAAM,gCAAgC,CAAA;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAC,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AAEjD,SAAS,aAAa;IACpB,MAAM,CAAC,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAA;IACpC,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK;QACzB,WAAW,EAAE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AC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAChC,IAAI,GAAG,KAAK,IAAI;oBAAE,OAAM;gBACxB,IAAI,GAAG,GAAG,CAAA;gBACV,EAAE,CAAC,IAAI,CAAC,CAAA;YACV,CAAC,CAAC,CAAA;QACJ,CAAC;KACF;IAED,+DAA+D;IAC/D,KAAK,EAAE;QACL,8CAA8C;QAC9C,cAAc,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,qBAAqB,EAAE;QAC1D,qCAAqC;QACrC,cAAc,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,KAAK,CAAC;QAC5E,6EAA6E;QAC7E,gBAAgB,EAAE,CAAC,OAAgB,EAAiB,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,OAAO,CAAC;KACnG;IAED,sBAAsB;IACtB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,eAAe;CAC1B,CAAA","sourcesContent":["/**\n * glasses facade — the core `engine.glasses.*` surface: connection actions (over\n * the bluetooth-sdk passthrough), a curated status/info read-model (projected from\n * the engine-owned glasses store), capabilities (from the model table), and the\n * discrete input events. The `wifi` sub-facade is nested here.\n *\n * Read-models project the raw glasses store into the stable shape OEM UIs consume,\n * so the device store's field layout doesn't leak into every screen.\n */\n// Internal btsdk surface — connectSimulated/reconnect/controller live on the full\n// surface, not the public entry. Relative path (the alias doesn't resolve in engine's\n// standalone build); jest moduleNameMapper + tsconfig both resolve it.\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport type {ButtonPressEvent, TouchEvent} from \"@mentra/bluetooth-sdk/internal\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {hasDefaultDevice} from \"../services/DeviceStoreHydration\"\nimport {projectPairingIdentity} from \"../services/PairingIdentity\"\nimport {isGlassesConnected, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {pushAllBluetoothSettings} from \"../services/GlassesSettingsSync\"\nimport {getModelCapabilities, type DeviceTypes} from \"../types\"\nimport {glassesWifi} from \"./glassesWifi\"\nimport {glassesSettings} from \"./glassesSettings\"\n\nfunction projectStatus() {\n const s = useGlassesStore.getState()\n return {\n state: s.connection.state,\n fullyBooted: isGlassesReady(s.connection),\n battery: s.batteryLevel,\n charging: s.charging,\n case: {battery: s.caseBatteryLevel, charging: s.caseCharging, open: s.caseOpen, removed: s.caseRemoved},\n signal: s.signalStrength,\n micEnabled: s.micEnabled,\n vadEnabled: s.voiceActivityDetectionEnabled,\n btClassic: s.bluetoothClassicConnected,\n }\n}\n\nfunction projectControllerStatus() {\n const s = useGlassesStore.getState()\n return {\n connected: s.controllerConnected,\n fullyBooted: s.controllerFullyBooted,\n battery: s.controllerBatteryLevel,\n signal: s.controllerSignalStrength,\n }\n}\n\nfunction projectInfo() {\n const s = useGlassesStore.getState()\n return {\n model: s.deviceModel,\n style: s.style,\n color: s.color,\n bluetoothName: s.bluetoothName,\n firmwareVersion: s.firmwareVersion,\n mtkFirmware: s.mtkFirmwareVersion,\n besFirmware: s.besFirmwareVersion,\n appVersion: s.appVersion,\n androidVersion: s.androidVersion,\n serialNumber: s.serialNumber,\n buildNumber: s.buildNumber,\n btMac: s.bluetoothMacAddress,\n leftMac: s.leftMacAddress,\n rightMac: s.rightMacAddress,\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n wifi: {...s.wifi},\n }\n}\n\nexport type GlassesStatusSnapshot = ReturnType<typeof projectStatus>\nexport type ControllerStatusSnapshot = ReturnType<typeof projectControllerStatus>\nexport type GlassesInfoSnapshot = ReturnType<typeof projectInfo>\n\nexport const glasses = {\n // --- connection (bluetooth-sdk passthrough) ---\n /**\n * Reconnect the default wearable. Seeds the phone's current device settings to\n * native first, so they're primed before the connect handshake replays them to\n * the glasses (this used to be a host-side step before `connectDefault`).\n */\n connectDefault: async (): Promise<void> => {\n await pushAllBluetoothSettings()\n return BluetoothSdk.connectDefault()\n },\n disconnect: (): Promise<void> => BluetoothSdk.disconnect(),\n forget: (): Promise<void> => BluetoothSdk.forget(),\n /** Connect to a specific (discovered) device. */\n connect: async (...args: Parameters<typeof BluetoothSdk.connect>): Promise<void> => {\n await pushAllBluetoothSettings()\n return BluetoothSdk.connect(...args)\n },\n /** Connect the built-in simulated glasses (dev/testing). */\n connectSimulated: (): Promise<void> => BluetoothSdk.connectSimulated(),\n /** Set a device as the `connectDefault()` target. */\n setDefault: (...args: Parameters<typeof BluetoothSdk.setDefaultDevice>) => BluetoothSdk.setDefaultDevice(...args),\n /**\n * Reconnect to the saved default glasses. Resolves `false` when there's nothing to\n * reconnect to (no default paired) or the connect attempt fails (e.g. BLE powered\n * off), `true` when already connected or after kicking off the connect. Never\n * rejects — the boolean contract holds. The host gates connectivity/permissions\n * (its UI) before calling.\n */\n reconnect: async (): Promise<boolean> => {\n const defaultWearable = useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key)\n if (!defaultWearable) return false\n if (isGlassesConnected(useGlassesStore.getState().connection)) return true\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n console.warn(\"engine.glasses.reconnect failed:\", error)\n return false\n }\n return true\n },\n /** True when no glasses has ever been paired NOR selected (the pairing-identity\n * lifecycle is in its `none` state) — e.g. to route a first-run host into the\n * pairing/onboarding flow. A pending selection is not \"first\" — the host should\n * offer finish-pairing (see `engine.pairing.identity()`). */\n isFirstPairing: (): boolean => projectPairingIdentity().kind === \"none\",\n /**\n * True when the SDK has an actual default DEVICE to reconnect to. Distinct from\n * `default_wearable` (a model string that a pending or orphaned selection can\n * hold without any paired device): connectDefault() throws without a device, so\n * hosts should route to the pairing flow when this is false.\n *\n * Hydration-aware: awaits the device-store seed internally, so a cold-start\n * read can't see a false \"absent\" for genuinely-paired users. Rejects if\n * hydration failed — callers guarding destructive or routing decisions must\n * fail open (treat as \"has a device\").\n */\n hasDefaultDevice: (): Promise<boolean> => hasDefaultDevice(),\n\n // --- read-model (projected from the engine-owned glasses store) ---\n status: (): GlassesStatusSnapshot => projectStatus(),\n onStatus: (cb: (status: GlassesStatusSnapshot) => void): (() => void) => {\n // Dedupe: the glasses store updates on many fields; only fire when the\n // projected status snapshot actually changes.\n let last = JSON.stringify(projectStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n info: (): GlassesInfoSnapshot => projectInfo(),\n onInfo: (cb: (info: GlassesInfoSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectInfo())\n return useGlassesStore.subscribe(() => {\n const snap = projectInfo()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n capabilities: () => getModelCapabilities(useGlassesStore.getState().deviceModel as DeviceTypes),\n /** Ask the glasses to report fresh firmware/version info (updates the store). */\n requestVersionInfo: () => BluetoothSdk.requestVersionInfo(),\n\n // --- discrete input events (passthrough listeners) ---\n onButtonPress: (cb: (event: ButtonPressEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"button_press\", cb)\n return () => sub.remove()\n },\n onTouchGesture: (cb: (event: TouchEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"touch_event\", cb)\n return () => sub.remove()\n },\n\n // --- ring controller (optional input device) ---\n controller: {\n connectDefault: (): Promise<void> => BluetoothSdk.connectDefaultController(),\n disconnect: (): Promise<void> => BluetoothSdk.disconnectController(),\n forget: (): Promise<void> => BluetoothSdk.forgetController(),\n status: (): ControllerStatusSnapshot => projectControllerStatus(),\n onStatus: (cb: (status: ControllerStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectControllerStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectControllerStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n },\n\n // --- audio (glasses media-volume + own-app playback hint) ---\n audio: {\n /** Read the glasses' current media volume. */\n getMediaVolume: () => BluetoothSdk.getGlassesMediaVolume(),\n /** Set the glasses' media volume. */\n setMediaVolume: (level: number) => BluetoothSdk.setGlassesMediaVolume(level),\n /** Tell native whether THIS app is currently playing audio (for ducking). */\n setOwnAppPlaying: (playing: boolean): Promise<void> => BluetoothSdk.setOwnAppAudioPlaying(playing),\n },\n\n // --- sub-facades ---\n wifi: glassesWifi,\n settings: glassesSettings,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,kFAAkF;AAClF,sFAAsF;AACtF,uEAAuE;AACvE,OAAO,YAAY,MAAM,gCAAgC,CAAA;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAC,qCAAqC,EAAC,MAAM,gCAAgC,CAAA;AACpF,OAAO,EAAC,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AAEjD,SAAS,aAAa;IACpB,MAAM,CAAC,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAA;IACpC,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK;QACzB,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC;QACzC,OAAO,EAAE,CAAC,CAAC,YAAY;QACvB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,IAAI,EAAE,EA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QAAQ,EAAE,CAAC,EAA8C,EAAgB,EAAE;YACzE,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,EAAE,CAAC,CAAA;YACpD,OAAO,eAAe,CAAC,SAAS,CAAC,GAAG,EAAE;gBACpC,MAAM,IAAI,GAAG,uBAAuB,EAAE,CAAA;gBACtC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;gBAChC,IAAI,GAAG,KAAK,IAAI;oBAAE,OAAM;gBACxB,IAAI,GAAG,GAAG,CAAA;gBACV,EAAE,CAAC,IAAI,CAAC,CAAA;YACV,CAAC,CAAC,CAAA;QACJ,CAAC;KACF;IAED,+DAA+D;IAC/D,KAAK,EAAE;QACL,8CAA8C;QAC9C,cAAc,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,qBAAqB,EAAE;QAC1D,qCAAqC;QACrC,cAAc,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,KAAK,CAAC;QAC5E,6EAA6E;QAC7E,gBAAgB,EAAE,CAAC,OAAgB,EAAiB,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,OAAO,CAAC;KACnG;IAED,sBAAsB;IACtB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,eAAe;CAC1B,CAAA","sourcesContent":["/**\n * glasses facade — the core `engine.glasses.*` surface: connection actions (over\n * the bluetooth-sdk passthrough), a curated status/info read-model (projected from\n * the engine-owned glasses store), capabilities (from the model table), and the\n * discrete input events. The `wifi` sub-facade is nested here.\n *\n * Read-models project the raw glasses store into the stable shape OEM UIs consume,\n * so the device store's field layout doesn't leak into every screen.\n */\n// Internal btsdk surface — connectSimulated/reconnect/controller live on the full\n// surface, not the public entry. Relative path (the alias doesn't resolve in engine's\n// standalone build); jest moduleNameMapper + tsconfig both resolve it.\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport type {ButtonPressEvent, TouchEvent} from \"@mentra/bluetooth-sdk/internal\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {hasDefaultDevice} from \"../services/DeviceStoreHydration\"\nimport {projectPairingIdentity} from \"../services/PairingIdentity\"\nimport {isGlassesConnected, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {pushAllBluetoothSettings} from \"../services/GlassesSettingsSync\"\nimport {recordSupportProfileConnectionFailure} from \"../services/SupportProfileSync\"\nimport {getModelCapabilities, type DeviceTypes} from \"../types\"\nimport {glassesWifi} from \"./glassesWifi\"\nimport {glassesSettings} from \"./glassesSettings\"\n\nfunction projectStatus() {\n const s = useGlassesStore.getState()\n return {\n state: s.connection.state,\n fullyBooted: isGlassesReady(s.connection),\n battery: s.batteryLevel,\n charging: s.charging,\n case: {battery: s.caseBatteryLevel, charging: s.caseCharging, open: s.caseOpen, removed: s.caseRemoved},\n signal: s.signalStrength,\n micEnabled: s.micEnabled,\n vadEnabled: s.voiceActivityDetectionEnabled,\n btClassic: s.bluetoothClassicConnected,\n }\n}\n\nfunction projectControllerStatus() {\n const s = useGlassesStore.getState()\n return {\n connected: s.controllerConnected,\n fullyBooted: s.controllerFullyBooted,\n battery: s.controllerBatteryLevel,\n signal: s.controllerSignalStrength,\n }\n}\n\nfunction projectInfo() {\n const s = useGlassesStore.getState()\n return {\n model: s.deviceModel,\n style: s.style,\n color: s.color,\n bluetoothName: s.bluetoothName,\n firmwareVersion: s.firmwareVersion,\n mtkFirmware: s.mtkFirmwareVersion,\n besFirmware: s.besFirmwareVersion,\n appVersion: s.appVersion,\n androidVersion: s.androidVersion,\n serialNumber: s.serialNumber,\n buildNumber: s.buildNumber,\n btMac: s.bluetoothMacAddress,\n wifiMac: s.wifiMacAddress,\n leftMac: s.leftMacAddress,\n rightMac: s.rightMacAddress,\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n wifi: {...s.wifi},\n }\n}\n\nexport type GlassesStatusSnapshot = ReturnType<typeof projectStatus>\nexport type ControllerStatusSnapshot = ReturnType<typeof projectControllerStatus>\nexport type GlassesInfoSnapshot = ReturnType<typeof projectInfo>\n\nexport const glasses = {\n // --- connection (bluetooth-sdk passthrough) ---\n /**\n * Reconnect the default wearable. Seeds the phone's current device settings to\n * native first, so they're primed before the connect handshake replays them to\n * the glasses (this used to be a host-side step before `connectDefault`).\n */\n connectDefault: async (): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect_default\")\n throw error\n }\n },\n disconnect: (): Promise<void> => BluetoothSdk.disconnect(),\n forget: (): Promise<void> => BluetoothSdk.forget(),\n /** Connect to a specific (discovered) device. */\n connect: async (...args: Parameters<typeof BluetoothSdk.connect>): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connect(...args)\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect\")\n throw error\n }\n },\n /** Connect the built-in simulated glasses (dev/testing). */\n connectSimulated: (): Promise<void> => BluetoothSdk.connectSimulated(),\n /** Set a device as the `connectDefault()` target. */\n setDefault: (...args: Parameters<typeof BluetoothSdk.setDefaultDevice>) => BluetoothSdk.setDefaultDevice(...args),\n /**\n * Reconnect to the saved default glasses. Resolves `false` when there's nothing to\n * reconnect to (no default paired) or the connect attempt fails (e.g. BLE powered\n * off), `true` when already connected or after kicking off the connect. Never\n * rejects — the boolean contract holds. The host gates connectivity/permissions\n * (its UI) before calling.\n */\n reconnect: async (): Promise<boolean> => {\n const defaultWearable = useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key)\n if (!defaultWearable) return false\n if (isGlassesConnected(useGlassesStore.getState().connection)) return true\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"reconnect\")\n console.warn(\"engine.glasses.reconnect failed:\", error)\n return false\n }\n return true\n },\n /** True when no glasses has ever been paired NOR selected (the pairing-identity\n * lifecycle is in its `none` state) — e.g. to route a first-run host into the\n * pairing/onboarding flow. A pending selection is not \"first\" — the host should\n * offer finish-pairing (see `engine.pairing.identity()`). */\n isFirstPairing: (): boolean => projectPairingIdentity().kind === \"none\",\n /**\n * True when the SDK has an actual default DEVICE to reconnect to. Distinct from\n * `default_wearable` (a model string that a pending or orphaned selection can\n * hold without any paired device): connectDefault() throws without a device, so\n * hosts should route to the pairing flow when this is false.\n *\n * Hydration-aware: awaits the device-store seed internally, so a cold-start\n * read can't see a false \"absent\" for genuinely-paired users. Rejects if\n * hydration failed — callers guarding destructive or routing decisions must\n * fail open (treat as \"has a device\").\n */\n hasDefaultDevice: (): Promise<boolean> => hasDefaultDevice(),\n\n // --- read-model (projected from the engine-owned glasses store) ---\n status: (): GlassesStatusSnapshot => projectStatus(),\n onStatus: (cb: (status: GlassesStatusSnapshot) => void): (() => void) => {\n // Dedupe: the glasses store updates on many fields; only fire when the\n // projected status snapshot actually changes.\n let last = JSON.stringify(projectStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n info: (): GlassesInfoSnapshot => projectInfo(),\n onInfo: (cb: (info: GlassesInfoSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectInfo())\n return useGlassesStore.subscribe(() => {\n const snap = projectInfo()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n capabilities: () => getModelCapabilities(useGlassesStore.getState().deviceModel as DeviceTypes),\n /** Ask the glasses to report fresh firmware/version info (updates the store). */\n requestVersionInfo: () => BluetoothSdk.requestVersionInfo(),\n\n // --- discrete input events (passthrough listeners) ---\n onButtonPress: (cb: (event: ButtonPressEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"button_press\", cb)\n return () => sub.remove()\n },\n onTouchGesture: (cb: (event: TouchEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"touch_event\", cb)\n return () => sub.remove()\n },\n\n // --- ring controller (optional input device) ---\n controller: {\n connectDefault: (): Promise<void> => BluetoothSdk.connectDefaultController(),\n disconnect: (): Promise<void> => BluetoothSdk.disconnectController(),\n forget: (): Promise<void> => BluetoothSdk.forgetController(),\n status: (): ControllerStatusSnapshot => projectControllerStatus(),\n onStatus: (cb: (status: ControllerStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectControllerStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectControllerStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n },\n\n // --- audio (glasses media-volume + own-app playback hint) ---\n audio: {\n /** Read the glasses' current media volume. */\n getMediaVolume: () => BluetoothSdk.getGlassesMediaVolume(),\n /** Set the glasses' media volume. */\n setMediaVolume: (level: number) => BluetoothSdk.setGlassesMediaVolume(level),\n /** Tell native whether THIS app is currently playing audio (for ducking). */\n setOwnAppPlaying: (playing: boolean): Promise<void> => BluetoothSdk.setOwnAppAudioPlaying(playing),\n },\n\n // --- sub-facades ---\n wifi: glassesWifi,\n settings: glassesSettings,\n}\n"]}
|