@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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phone-local SimpleStorage for bundled miniapps.
|
|
3
|
+
*
|
|
4
|
+
* Keys are scoped to the stable Mentra user id and package name. Access tokens
|
|
5
|
+
* must never be part of the namespace: Core access tokens rotate and are held
|
|
6
|
+
* in memory only, so using one makes every app restart look like a new user.
|
|
7
|
+
*/
|
|
8
|
+
export interface LocalMiniappStorageBackend {
|
|
9
|
+
get(key: string): unknown | null;
|
|
10
|
+
has(key: string): boolean;
|
|
11
|
+
set(key: string, value: unknown): void;
|
|
12
|
+
remove(key: string): void;
|
|
13
|
+
keys(): string[];
|
|
14
|
+
}
|
|
15
|
+
export interface LocalMiniappStorageHooks {
|
|
16
|
+
getUserId: () => Promise<string>;
|
|
17
|
+
backend: LocalMiniappStorageBackend;
|
|
18
|
+
}
|
|
19
|
+
export declare class LocalMiniappStorage {
|
|
20
|
+
private readonly hooks;
|
|
21
|
+
constructor(hooks: LocalMiniappStorageHooks);
|
|
22
|
+
get(packageName: string, key: string): Promise<unknown | null>;
|
|
23
|
+
set(packageName: string, key: string, value: unknown): Promise<void>;
|
|
24
|
+
delete(packageName: string, key: string): Promise<void>;
|
|
25
|
+
keys(packageName: string): Promise<string[]>;
|
|
26
|
+
clear(packageName: string): Promise<void>;
|
|
27
|
+
has(packageName: string, key: string): Promise<boolean>;
|
|
28
|
+
getAll(packageName: string): Promise<Record<string, string>>;
|
|
29
|
+
setMultiple(packageName: string, values: Record<string, unknown>): Promise<void>;
|
|
30
|
+
private prefix;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=LocalMiniappStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalMiniappStorage.d.ts","sourceRoot":"","sources":["../../src/services/LocalMiniappStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH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M,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAOxE,MAAM;CAKrB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phone-local SimpleStorage for bundled miniapps.
|
|
3
|
+
*
|
|
4
|
+
* Keys are scoped to the stable Mentra user id and package name. Access tokens
|
|
5
|
+
* must never be part of the namespace: Core access tokens rotate and are held
|
|
6
|
+
* in memory only, so using one makes every app restart look like a new user.
|
|
7
|
+
*/
|
|
8
|
+
const KEY_ROOT = "mentraos_localstorage_";
|
|
9
|
+
export class LocalMiniappStorage {
|
|
10
|
+
hooks;
|
|
11
|
+
constructor(hooks) {
|
|
12
|
+
this.hooks = hooks;
|
|
13
|
+
}
|
|
14
|
+
async get(packageName, key) {
|
|
15
|
+
return this.hooks.backend.get((await this.prefix(packageName)) + key);
|
|
16
|
+
}
|
|
17
|
+
async set(packageName, key, value) {
|
|
18
|
+
this.hooks.backend.set((await this.prefix(packageName)) + key, value);
|
|
19
|
+
}
|
|
20
|
+
async delete(packageName, key) {
|
|
21
|
+
this.hooks.backend.remove((await this.prefix(packageName)) + key);
|
|
22
|
+
}
|
|
23
|
+
async keys(packageName) {
|
|
24
|
+
const prefix = await this.prefix(packageName);
|
|
25
|
+
return this.hooks.backend
|
|
26
|
+
.keys()
|
|
27
|
+
.filter((key) => key.startsWith(prefix))
|
|
28
|
+
.map((key) => key.slice(prefix.length));
|
|
29
|
+
}
|
|
30
|
+
async clear(packageName) {
|
|
31
|
+
const prefix = await this.prefix(packageName);
|
|
32
|
+
for (const key of this.hooks.backend.keys()) {
|
|
33
|
+
if (key.startsWith(prefix))
|
|
34
|
+
this.hooks.backend.remove(key);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async has(packageName, key) {
|
|
38
|
+
return this.hooks.backend.has((await this.prefix(packageName)) + key);
|
|
39
|
+
}
|
|
40
|
+
async getAll(packageName) {
|
|
41
|
+
const prefix = await this.prefix(packageName);
|
|
42
|
+
const values = {};
|
|
43
|
+
for (const key of this.hooks.backend.keys()) {
|
|
44
|
+
if (!key.startsWith(prefix))
|
|
45
|
+
continue;
|
|
46
|
+
if (!this.hooks.backend.has(key))
|
|
47
|
+
continue;
|
|
48
|
+
const value = this.hooks.backend.get(key);
|
|
49
|
+
values[key.slice(prefix.length)] = typeof value === "string" ? value : String(value ?? "");
|
|
50
|
+
}
|
|
51
|
+
return values;
|
|
52
|
+
}
|
|
53
|
+
async setMultiple(packageName, values) {
|
|
54
|
+
const prefix = await this.prefix(packageName);
|
|
55
|
+
for (const [key, value] of Object.entries(values)) {
|
|
56
|
+
this.hooks.backend.set(prefix + key, value ?? null);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async prefix(packageName) {
|
|
60
|
+
const userId = (await this.hooks.getUserId()).trim();
|
|
61
|
+
if (!userId)
|
|
62
|
+
throw new Error("Mentra user identity is unavailable");
|
|
63
|
+
return `${KEY_ROOT}${userId}_${packageName}_`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=LocalMiniappStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalMiniappStorage.js","sourceRoot":"","sources":["../../src/services/LocalMiniappStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,MAAM,QAAQ,GAAG,wBAAwB,CAAA;AAEzC,MAAM,OAAO,mBAAmB;IACD;IAA7B,YAA6B,KAA+B;QAA/B,UAAK,GAAL,KAAK,CAA0B;IAAG,CAAC;IAEhE,KAAK,CAAC,GAAG,CAAC,WAAmB,EAAE,GAAW;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;IACvE,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB,EAAE,GAAW,EAAE,KAAc;QACxD,IAAI,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CAAC,IAAI,EAAE,CAAA;QACpD,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;QACnE,OAAO,GAAG,QAAQ,GAAG,MAAM,IAAI,WAAW,GAAG,CAAA;IAC/C,CAAC;CACF","sourcesContent":["/**\n * Phone-local SimpleStorage for bundled miniapps.\n *\n * Keys are scoped to the stable Mentra user id and package name. Access tokens\n * must never be part of the namespace: Core access tokens rotate and are held\n * in memory only, so using one makes every app restart look like a new user.\n */\n\nexport interface LocalMiniappStorageBackend {\n get(key: string): unknown | null\n has(key: string): boolean\n set(key: string, value: unknown): void\n remove(key: string): void\n keys(): string[]\n}\n\nexport interface LocalMiniappStorageHooks {\n getUserId: () => Promise<string>\n backend: LocalMiniappStorageBackend\n}\n\nconst KEY_ROOT = \"mentraos_localstorage_\"\n\nexport class LocalMiniappStorage {\n constructor(private readonly hooks: LocalMiniappStorageHooks) {}\n\n async get(packageName: string, key: string): Promise<unknown | null> {\n return this.hooks.backend.get((await this.prefix(packageName)) + key)\n }\n\n async set(packageName: string, key: string, value: unknown): Promise<void> {\n this.hooks.backend.set((await this.prefix(packageName)) + key, value)\n }\n\n async delete(packageName: string, key: string): Promise<void> {\n this.hooks.backend.remove((await this.prefix(packageName)) + key)\n }\n\n async keys(packageName: string): Promise<string[]> {\n const prefix = await this.prefix(packageName)\n return this.hooks.backend\n .keys()\n .filter((key) => key.startsWith(prefix))\n .map((key) => key.slice(prefix.length))\n }\n\n async clear(packageName: string): Promise<void> {\n const prefix = await this.prefix(packageName)\n for (const key of this.hooks.backend.keys()) {\n if (key.startsWith(prefix)) this.hooks.backend.remove(key)\n }\n }\n\n async has(packageName: string, key: string): Promise<boolean> {\n return this.hooks.backend.has((await this.prefix(packageName)) + key)\n }\n\n async getAll(packageName: string): Promise<Record<string, string>> {\n const prefix = await this.prefix(packageName)\n const values: Record<string, string> = {}\n for (const key of this.hooks.backend.keys()) {\n if (!key.startsWith(prefix)) continue\n if (!this.hooks.backend.has(key)) continue\n const value = this.hooks.backend.get(key)\n values[key.slice(prefix.length)] = typeof value === \"string\" ? value : String(value ?? \"\")\n }\n return values\n }\n\n async setMultiple(packageName: string, values: Record<string, unknown>): Promise<void> {\n const prefix = await this.prefix(packageName)\n for (const [key, value] of Object.entries(values)) {\n this.hooks.backend.set(prefix + key, value ?? null)\n }\n }\n\n private async prefix(packageName: string): Promise<string> {\n const userId = (await this.hooks.getUserId()).trim()\n if (!userId) throw new Error(\"Mentra user identity is unavailable\")\n return `${KEY_ROOT}${userId}_${packageName}_`\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface LocalMiniappUserIdentityBackend {
|
|
2
|
+
get(): string | null;
|
|
3
|
+
set(userId: string): void;
|
|
4
|
+
remove(): void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Keeps the stable Mentra user id available to local miniapps across process
|
|
8
|
+
* restarts. The id is non-secret and is deliberately stored separately from
|
|
9
|
+
* the short-lived Core access token.
|
|
10
|
+
*/
|
|
11
|
+
export declare class LocalMiniappUserIdentity {
|
|
12
|
+
private readonly backend;
|
|
13
|
+
private current;
|
|
14
|
+
constructor(backend: LocalMiniappUserIdentityBackend);
|
|
15
|
+
resolve(resolveOnline: () => Promise<string>): Promise<string>;
|
|
16
|
+
get(): string | null;
|
|
17
|
+
remember(userId: string): void;
|
|
18
|
+
forget(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=LocalMiniappUserIdentity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalMiniappUserIdentity.d.ts","sourceRoot":"","sources":["../../src/services/LocalMiniappUserIdentity.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,+BAA+B;IAC9C,GAAG,IAAI,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,IAAI,IAAI,CAAA;CACf;AAED;;;;GAIG;AACH,qBAAa,wBAAwB;IAGvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,OAAO,CAAsB;gBAER,OAAO,EAAE,+BAA+B;IAE/D,OAAO,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAUpE,GAAG,IAAI,MAAM,GAAG,IAAI;IAQpB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAO9B,MAAM,IAAI,IAAI;CAIf"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps the stable Mentra user id available to local miniapps across process
|
|
3
|
+
* restarts. The id is non-secret and is deliberately stored separately from
|
|
4
|
+
* the short-lived Core access token.
|
|
5
|
+
*/
|
|
6
|
+
export class LocalMiniappUserIdentity {
|
|
7
|
+
backend;
|
|
8
|
+
current = null;
|
|
9
|
+
constructor(backend) {
|
|
10
|
+
this.backend = backend;
|
|
11
|
+
}
|
|
12
|
+
async resolve(resolveOnline) {
|
|
13
|
+
const available = this.get();
|
|
14
|
+
if (available)
|
|
15
|
+
return available;
|
|
16
|
+
const resolved = (await resolveOnline()).trim();
|
|
17
|
+
if (!resolved)
|
|
18
|
+
throw new Error("Mentra user identity is unavailable");
|
|
19
|
+
this.remember(resolved);
|
|
20
|
+
return resolved;
|
|
21
|
+
}
|
|
22
|
+
get() {
|
|
23
|
+
if (this.current)
|
|
24
|
+
return this.current;
|
|
25
|
+
const cached = this.backend.get()?.trim() ?? "";
|
|
26
|
+
if (!cached)
|
|
27
|
+
return null;
|
|
28
|
+
this.current = cached;
|
|
29
|
+
return cached;
|
|
30
|
+
}
|
|
31
|
+
remember(userId) {
|
|
32
|
+
const resolved = userId.trim();
|
|
33
|
+
if (!resolved)
|
|
34
|
+
throw new Error("Mentra user identity is unavailable");
|
|
35
|
+
this.backend.set(resolved);
|
|
36
|
+
this.current = resolved;
|
|
37
|
+
}
|
|
38
|
+
forget() {
|
|
39
|
+
this.current = null;
|
|
40
|
+
this.backend.remove();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=LocalMiniappUserIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalMiniappUserIdentity.js","sourceRoot":"","sources":["../../src/services/LocalMiniappUserIdentity.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAGN;IAFrB,OAAO,GAAkB,IAAI,CAAA;IAErC,YAA6B,OAAwC;QAAxC,YAAO,GAAP,OAAO,CAAiC;IAAG,CAAC;IAEzE,KAAK,CAAC,OAAO,CAAC,aAAoC;QAChD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAC5B,IAAI,SAAS;YAAE,OAAO,SAAS,CAAA;QAE/B,MAAM,QAAQ,GAAG,CAAC,MAAM,aAAa,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;QAC/C,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;QACrE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACvB,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,GAAG;QACD,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC,OAAO,CAAA;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QAC/C,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,OAAO,MAAM,CAAA;IACf,CAAC;IAED,QAAQ,CAAC,MAAc;QACrB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;QAC9B,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;QACrE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QAC1B,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAA;IACzB,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAA;IACvB,CAAC;CACF","sourcesContent":["export interface LocalMiniappUserIdentityBackend {\n get(): string | null\n set(userId: string): void\n remove(): void\n}\n\n/**\n * Keeps the stable Mentra user id available to local miniapps across process\n * restarts. The id is non-secret and is deliberately stored separately from\n * the short-lived Core access token.\n */\nexport class LocalMiniappUserIdentity {\n private current: string | null = null\n\n constructor(private readonly backend: LocalMiniappUserIdentityBackend) {}\n\n async resolve(resolveOnline: () => Promise<string>): Promise<string> {\n const available = this.get()\n if (available) return available\n\n const resolved = (await resolveOnline()).trim()\n if (!resolved) throw new Error(\"Mentra user identity is unavailable\")\n this.remember(resolved)\n return resolved\n }\n\n get(): string | null {\n if (this.current) return this.current\n const cached = this.backend.get()?.trim() ?? \"\"\n if (!cached) return null\n this.current = cached\n return cached\n }\n\n remember(userId: string): void {\n const resolved = userId.trim()\n if (!resolved) throw new Error(\"Mentra user identity is unavailable\")\n this.backend.set(resolved)\n this.current = resolved\n }\n\n forget(): void {\n this.current = null\n this.backend.remove()\n }\n}\n"]}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Decides whether on-device Sherpa STT should produce transcripts for local
|
|
3
|
-
* miniapps, instead of (or in addition to) cloud transcription.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* miniapps, instead of (or in addition to) cloud transcription. Local STT is
|
|
4
|
+
* active when the cloud is unavailable or any subscription requires
|
|
5
|
+
* `forceLocal`.
|
|
6
6
|
*
|
|
7
7
|
* Activation flips `localSttFallbackActive` in the settings store, which
|
|
8
8
|
* the bluetooth-sdk native side reads to decide whether to feed PCM into
|
|
9
9
|
* the SherpaOnnxTranscriber. Local transcripts then flow back through the
|
|
10
10
|
* `local_transcription` Bridge event; the host wires that event to
|
|
11
11
|
* `localMiniappRuntime.forwardEvent`, with this coordinator providing the
|
|
12
|
-
* subscription-active gate so we never publish transcripts to miniapps
|
|
13
|
-
*
|
|
12
|
+
* subscription-active gate so we never publish transcripts to miniapps that
|
|
13
|
+
* aren't asking for them. LocalMiniappRuntime filters mixed local/cloud
|
|
14
|
+
* delivery per miniapp.
|
|
14
15
|
*/
|
|
15
16
|
declare class LocalSttFallbackCoordinator {
|
|
16
17
|
private static instance;
|
|
17
18
|
private hasTranscriptionSubscription;
|
|
19
|
+
private hasForceLocalSubscription;
|
|
18
20
|
private activeLanguage;
|
|
19
21
|
/**
|
|
20
22
|
* Default to "cloud is up" so we never accidentally activate local STT before
|
|
@@ -35,7 +37,7 @@ declare class LocalSttFallbackCoordinator {
|
|
|
35
37
|
static getInstance(): LocalSttFallbackCoordinator;
|
|
36
38
|
isActive(): boolean;
|
|
37
39
|
getActiveLanguage(): string | null;
|
|
38
|
-
onSubscriptionChange(hasTranscription: boolean, language: string | null): void;
|
|
40
|
+
onSubscriptionChange(hasTranscription: boolean, language: string | null, hasForceLocal?: boolean): void;
|
|
39
41
|
/**
|
|
40
42
|
* Informational hook, retained for API stability. No longer called: the
|
|
41
43
|
* authoritative switching signal is the cloud-client adapter (local miniapps
|
|
@@ -47,6 +49,7 @@ declare class LocalSttFallbackCoordinator {
|
|
|
47
49
|
private reconcile;
|
|
48
50
|
private startLocalStt;
|
|
49
51
|
private stopLocalStt;
|
|
52
|
+
private shouldUseLocalStt;
|
|
50
53
|
private log;
|
|
51
54
|
}
|
|
52
55
|
declare const localSttFallbackCoordinator: LocalSttFallbackCoordinator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalSttFallbackCoordinator.d.ts","sourceRoot":"","sources":["../../src/services/LocalSttFallbackCoordinator.ts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"LocalSttFallbackCoordinator.d.ts","sourceRoot":"","sources":["../../src/services/LocalSttFallbackCoordinator.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,cAAM,2BAA2B;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6B;IAEpD,OAAO,CAAC,4BAA4B,CAAQ;IAC5C,OAAO,CAAC,yBAAyB,CAAQ;IACzC,OAAO,CAAC,cAAc,CAAsB;IAC5C;;;;;OAKG;IACH,OAAO,CAAC,cAAc,CAAO;IAC7B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,oBAAoB,CAAQ;IAEpC,OAAO;IAQP;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAajC,MAAM,CAAC,WAAW,IAAI,2BAA2B;IAOjD,QAAQ,IAAI,OAAO;IAInB,iBAAiB,IAAI,MAAM,GAAG,IAAI;IAIlC,oBAAoB,CAAC,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,aAAa,UAAQ,GAAG,IAAI;IAQrG;;;;;;OAMG;IACH,iBAAiB,IAAI,IAAI;YAEX,SAAS;YAUT,aAAa;IAyB3B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,GAAG;CAGZ;AAED,QAAA,MAAM,2BAA2B,6BAA4C,CAAA;AAC7E,eAAe,2BAA2B,CAAA"}
|
|
@@ -5,21 +5,23 @@ import { cloudClientService } from "./CloudClientService";
|
|
|
5
5
|
import sttModelManager from "./STTModelManager";
|
|
6
6
|
/**
|
|
7
7
|
* Decides whether on-device Sherpa STT should produce transcripts for local
|
|
8
|
-
* miniapps, instead of (or in addition to) cloud transcription.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* miniapps, instead of (or in addition to) cloud transcription. Local STT is
|
|
9
|
+
* active when the cloud is unavailable or any subscription requires
|
|
10
|
+
* `forceLocal`.
|
|
11
11
|
*
|
|
12
12
|
* Activation flips `localSttFallbackActive` in the settings store, which
|
|
13
13
|
* the bluetooth-sdk native side reads to decide whether to feed PCM into
|
|
14
14
|
* the SherpaOnnxTranscriber. Local transcripts then flow back through the
|
|
15
15
|
* `local_transcription` Bridge event; the host wires that event to
|
|
16
16
|
* `localMiniappRuntime.forwardEvent`, with this coordinator providing the
|
|
17
|
-
* subscription-active gate so we never publish transcripts to miniapps
|
|
18
|
-
*
|
|
17
|
+
* subscription-active gate so we never publish transcripts to miniapps that
|
|
18
|
+
* aren't asking for them. LocalMiniappRuntime filters mixed local/cloud
|
|
19
|
+
* delivery per miniapp.
|
|
19
20
|
*/
|
|
20
21
|
class LocalSttFallbackCoordinator {
|
|
21
22
|
static instance;
|
|
22
23
|
hasTranscriptionSubscription = false;
|
|
24
|
+
hasForceLocalSubscription = false;
|
|
23
25
|
activeLanguage = null;
|
|
24
26
|
/**
|
|
25
27
|
* Default to "cloud is up" so we never accidentally activate local STT before
|
|
@@ -68,9 +70,10 @@ class LocalSttFallbackCoordinator {
|
|
|
68
70
|
getActiveLanguage() {
|
|
69
71
|
return this.activeLanguage;
|
|
70
72
|
}
|
|
71
|
-
onSubscriptionChange(hasTranscription, language) {
|
|
72
|
-
this.log(`onSubscriptionChange(hasTx=${hasTranscription}, lang=${language})`);
|
|
73
|
+
onSubscriptionChange(hasTranscription, language, hasForceLocal = false) {
|
|
74
|
+
this.log(`onSubscriptionChange(hasTx=${hasTranscription}, lang=${language}, forceLocal=${hasForceLocal})`);
|
|
73
75
|
this.hasTranscriptionSubscription = hasTranscription;
|
|
76
|
+
this.hasForceLocalSubscription = hasTranscription && hasForceLocal;
|
|
74
77
|
this.activeLanguage = hasTranscription ? language : null;
|
|
75
78
|
void this.reconcile();
|
|
76
79
|
}
|
|
@@ -84,7 +87,7 @@ class LocalSttFallbackCoordinator {
|
|
|
84
87
|
onCloudTranscript() { }
|
|
85
88
|
async reconcile() {
|
|
86
89
|
this.attachCloudAdapterIfReady();
|
|
87
|
-
const shouldBeActive = this.
|
|
90
|
+
const shouldBeActive = this.shouldUseLocalStt();
|
|
88
91
|
if (shouldBeActive && !this.localActive) {
|
|
89
92
|
await this.startLocalStt();
|
|
90
93
|
}
|
|
@@ -99,8 +102,8 @@ class LocalSttFallbackCoordinator {
|
|
|
99
102
|
this.log("local stt model is not available yet — skipping activation");
|
|
100
103
|
return;
|
|
101
104
|
}
|
|
102
|
-
if (!this.
|
|
103
|
-
this.log("local stt activation skipped:
|
|
105
|
+
if (!this.shouldUseLocalStt()) {
|
|
106
|
+
this.log("local stt activation skipped: routing changed before start completed");
|
|
104
107
|
return;
|
|
105
108
|
}
|
|
106
109
|
try {
|
|
@@ -110,8 +113,8 @@ class LocalSttFallbackCoordinator {
|
|
|
110
113
|
catch (err) {
|
|
111
114
|
this.log(`restartTranscriber failed: ${err}`);
|
|
112
115
|
}
|
|
113
|
-
if (!this.
|
|
114
|
-
this.log("local stt activation skipped:
|
|
116
|
+
if (!this.shouldUseLocalStt()) {
|
|
117
|
+
this.log("local stt activation skipped: routing changed during transcriber restart");
|
|
115
118
|
return;
|
|
116
119
|
}
|
|
117
120
|
useSettingsStore.getState().setSetting(ISLAND_SETTINGS_KEYS.localSttFallbackActive, true);
|
|
@@ -122,6 +125,9 @@ class LocalSttFallbackCoordinator {
|
|
|
122
125
|
useSettingsStore.getState().setSetting(ISLAND_SETTINGS_KEYS.localSttFallbackActive, false);
|
|
123
126
|
this.localActive = false;
|
|
124
127
|
}
|
|
128
|
+
shouldUseLocalStt() {
|
|
129
|
+
return this.hasTranscriptionSubscription && (this.hasForceLocalSubscription || !this.cloudConnected);
|
|
130
|
+
}
|
|
125
131
|
log(msg) {
|
|
126
132
|
console.log(`[LocalSttFallback] ${msg}`);
|
|
127
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalSttFallbackCoordinator.js","sourceRoot":"","sources":["../../src/services/LocalSttFallbackCoordinator.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MA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AC,MAAc;QACjC,IAAI,CAAC,GAAG,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAA;QACzC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAA;QAC1F,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;IAC1B,CAAC;IAEO,iBAAiB;QACvB,OAAO,IAAI,CAAC,4BAA4B,IAAI,CAAC,IAAI,CAAC,yBAAyB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IACtG,CAAC;IAEO,GAAG,CAAC,GAAW;QACrB,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAA;IAC1C,CAAC;CACF;AAED,MAAM,2BAA2B,GAAG,2BAA2B,CAAC,WAAW,EAAE,CAAA;AAC7E,eAAe,2BAA2B,CAAA","sourcesContent":["import BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport {ISLAND_SETTINGS_KEYS} from \"../runtime/config\"\nimport {useSettingsStore} from \"../stores/settings\"\nimport {cloudClientService} from \"./CloudClientService\"\nimport sttModelManager from \"./STTModelManager\"\n\n/**\n * Decides whether on-device Sherpa STT should produce transcripts for local\n * miniapps, instead of (or in addition to) cloud transcription. Local STT is\n * active when the cloud is unavailable or any subscription requires\n * `forceLocal`.\n *\n * Activation flips `localSttFallbackActive` in the settings store, which\n * the bluetooth-sdk native side reads to decide whether to feed PCM into\n * the SherpaOnnxTranscriber. Local transcripts then flow back through the\n * `local_transcription` Bridge event; the host wires that event to\n * `localMiniappRuntime.forwardEvent`, with this coordinator providing the\n * subscription-active gate so we never publish transcripts to miniapps that\n * aren't asking for them. LocalMiniappRuntime filters mixed local/cloud\n * delivery per miniapp.\n */\nclass LocalSttFallbackCoordinator {\n private static instance: LocalSttFallbackCoordinator\n\n private hasTranscriptionSubscription = false\n private hasForceLocalSubscription = false\n private activeLanguage: string | null = null\n /**\n * Default to \"cloud is up\" so we never accidentally activate local STT before\n * the cloud client has had a chance to start. We attach lazily on the first\n * subscription/reconcile pass; once attached, this field reflects the real\n * cloud-client runtime status.\n */\n private cloudConnected = true\n private localActive = false\n private cloudAdapterAttached = false\n\n private constructor() {\n // Reset the persisted mirror flag on boot — the in-memory state in this\n // coordinator is the source of truth, and a stale \"true\" left from the\n // previous session would cause native to feed Sherpa before any miniapp\n // registered a subscription.\n useSettingsStore.getState().setSetting(ISLAND_SETTINGS_KEYS.localSttFallbackActive, false)\n }\n\n /**\n * Lazy-attach the engine cloud connection listener. The coordinator is\n * constructed at module load, before engine.start() brings up the cloud\n * client, so we defer until the first reconcile.\n */\n private attachCloudAdapterIfReady(): void {\n if (this.cloudAdapterAttached) return\n this.cloudConnected = cloudClientService.isConnected()\n cloudClientService.onStatusChanged((status) => {\n const connected = status.status === \"connected\"\n if (this.cloudConnected === connected) return\n this.log(`cloud connection -> ${connected ? \"up\" : \"down\"}`)\n this.cloudConnected = connected\n void this.reconcile()\n })\n this.cloudAdapterAttached = true\n }\n\n static getInstance(): LocalSttFallbackCoordinator {\n if (!LocalSttFallbackCoordinator.instance) {\n LocalSttFallbackCoordinator.instance = new LocalSttFallbackCoordinator()\n }\n return LocalSttFallbackCoordinator.instance\n }\n\n isActive(): boolean {\n return this.localActive\n }\n\n getActiveLanguage(): string | null {\n return this.activeLanguage\n }\n\n onSubscriptionChange(hasTranscription: boolean, language: string | null, hasForceLocal = false): void {\n this.log(`onSubscriptionChange(hasTx=${hasTranscription}, lang=${language}, forceLocal=${hasForceLocal})`)\n this.hasTranscriptionSubscription = hasTranscription\n this.hasForceLocalSubscription = hasTranscription && hasForceLocal\n this.activeLanguage = hasTranscription ? language : null\n void this.reconcile()\n }\n\n /**\n * Informational hook, retained for API stability. No longer called: the\n * authoritative switching signal is the cloud-client adapter (local miniapps\n * are powered only by V2). v1 cloud transcripts deliberately do NOT drive this\n * coordinator anymore. Kept for future hysteresis if connection-state alone\n * proves too coarse.\n */\n onCloudTranscript(): void {}\n\n private async reconcile(): Promise<void> {\n this.attachCloudAdapterIfReady()\n const shouldBeActive = this.shouldUseLocalStt()\n if (shouldBeActive && !this.localActive) {\n await this.startLocalStt()\n } else if (!shouldBeActive && this.localActive) {\n this.stopLocalStt(this.hasTranscriptionSubscription ? \"cloud reconnected\" : \"subscription gone\")\n }\n }\n\n private async startLocalStt(): Promise<void> {\n this.log(\"starting local stt\")\n const modelAvailable = await sttModelManager.isModelAvailable()\n if (!modelAvailable) {\n this.log(\"local stt model is not available yet — skipping activation\")\n return\n }\n if (!this.shouldUseLocalStt()) {\n this.log(\"local stt activation skipped: routing changed before start completed\")\n return\n }\n try {\n // Direct btsdk call now (was a host restartTranscriber hook).\n await BluetoothSdk.restartTranscriber()\n } catch (err) {\n this.log(`restartTranscriber failed: ${err}`)\n }\n if (!this.shouldUseLocalStt()) {\n this.log(\"local stt activation skipped: routing changed during transcriber restart\")\n return\n }\n useSettingsStore.getState().setSetting(ISLAND_SETTINGS_KEYS.localSttFallbackActive, true)\n this.localActive = true\n }\n\n private stopLocalStt(reason: string): void {\n this.log(`stopping local stt: ${reason}`)\n useSettingsStore.getState().setSetting(ISLAND_SETTINGS_KEYS.localSttFallbackActive, false)\n this.localActive = false\n }\n\n private shouldUseLocalStt(): boolean {\n return this.hasTranscriptionSubscription && (this.hasForceLocalSubscription || !this.cloudConnected)\n }\n\n private log(msg: string): void {\n console.log(`[LocalSttFallback] ${msg}`)\n }\n}\n\nconst localSttFallbackCoordinator = LocalSttFallbackCoordinator.getInstance()\nexport default localSttFallbackCoordinator\n"]}
|
|
@@ -7,10 +7,20 @@
|
|
|
7
7
|
* This coordinator pushes the aggregate local requirement set to BluetoothSdk
|
|
8
8
|
* so the mic runs whenever at least one local consumer needs it.
|
|
9
9
|
*/
|
|
10
|
+
type MicGate = "vad" | "loudnessGate";
|
|
11
|
+
interface ConfiguredMicGates {
|
|
12
|
+
vadEnabled?: boolean | null;
|
|
13
|
+
loudnessGateEnabled?: boolean | null;
|
|
14
|
+
}
|
|
10
15
|
declare class MicStateCoordinator {
|
|
11
16
|
private static instance;
|
|
12
17
|
private localWantsPcm;
|
|
13
18
|
private localWantsLc3;
|
|
19
|
+
private configuredVad;
|
|
20
|
+
private configuredLoudnessGate;
|
|
21
|
+
private readonly miniappVadOverrides;
|
|
22
|
+
private readonly miniappLoudnessGateOverrides;
|
|
23
|
+
private overrideSequence;
|
|
14
24
|
private constructor();
|
|
15
25
|
static getInstance(): MicStateCoordinator;
|
|
16
26
|
/**
|
|
@@ -20,12 +30,43 @@ declare class MicStateCoordinator {
|
|
|
20
30
|
setLocalRequirements(req: {
|
|
21
31
|
pcm: boolean;
|
|
22
32
|
lc3: boolean;
|
|
23
|
-
}): void;
|
|
33
|
+
} & ConfiguredMicGates): void;
|
|
34
|
+
/**
|
|
35
|
+
* Apply a miniapp-owned gate override without changing the OS preference.
|
|
36
|
+
* Overrides are lifecycle-scoped and last-live-owner-wins independently for
|
|
37
|
+
* VAD and Barrier.
|
|
38
|
+
*/
|
|
39
|
+
setMiniappGateOverride(packageName: string, gate: MicGate, enabled: boolean, configured?: ConfiguredMicGates): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Remove every gate override owned by a miniapp. This is synchronous so
|
|
42
|
+
* unregister can drop ownership before recomputing aggregate mic state.
|
|
43
|
+
*/
|
|
44
|
+
clearMiniappGateOverrides(packageName: string): boolean;
|
|
45
|
+
/** Re-apply the current runtime policy after an owner is released. */
|
|
46
|
+
syncEffectiveGatePolicy(configured?: ConfiguredMicGates): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Preserve the runtime microphone contract when the persisted device
|
|
49
|
+
* settings are replayed (for example after a glasses reconnect). Active
|
|
50
|
+
* miniapp gate overrides replace the OS values, and raw PCM keeps VAD off
|
|
51
|
+
* until the last raw-audio consumer unsubscribes.
|
|
52
|
+
*/
|
|
53
|
+
applyRuntimeOverrides(settings: Record<string, unknown>): Record<string, unknown>;
|
|
54
|
+
/**
|
|
55
|
+
* Apply the complete current gate policy without treating the input as an OS
|
|
56
|
+
* preference update. Used by debounced mic-requirement writes, whose queued
|
|
57
|
+
* gate values may be stale after an override is acquired or released.
|
|
58
|
+
*/
|
|
59
|
+
applyEffectiveGatePolicy(settings: Record<string, unknown>): Record<string, unknown>;
|
|
60
|
+
private applyActiveRuntimeOverrides;
|
|
24
61
|
/**
|
|
25
62
|
* Push local requirements to BluetoothSdk. `should_send_pcm` is strictly for
|
|
26
63
|
* on-device PCM consumers; cloud audio uses LC3 through AudioCloudUplink.
|
|
27
64
|
*/
|
|
28
65
|
private applyUnion;
|
|
66
|
+
private rememberConfiguredGates;
|
|
67
|
+
private overridesFor;
|
|
68
|
+
private latestOverride;
|
|
69
|
+
private effectiveGatePatch;
|
|
29
70
|
/**
|
|
30
71
|
* Reset all requirements to off. Called during cleanup.
|
|
31
72
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MicStateCoordinator.d.ts","sourceRoot":"","sources":["../../src/services/MicStateCoordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"MicStateCoordinator.d.ts","sourceRoot":"","sources":["../../src/services/MicStateCoordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,KAAK,OAAO,GAAG,KAAK,GAAG,cAAc,CAAA;AAOrC,UAAU,kBAAkB;IAC1B,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAC3B,mBAAmB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CACrC;AAkBD,cAAM,mBAAmB;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmC;IAG1D,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,sBAAsB,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAkC;IACtE,OAAO,CAAC,QAAQ,CAA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Patch = createDebouncedPatchFlusher((patch) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
// Resolve runtime overrides at flush time. A miniapp can acquire/release a
|
|
18
|
+
// gate override during the debounce window, and a captured stale value
|
|
19
|
+
// must not win after that lifecycle transition.
|
|
20
|
+
const runtimePatch = micStateCoordinator.applyEffectiveGatePolicy(patch);
|
|
21
|
+
void Promise.resolve(BluetoothSdk.updateBluetoothSettings(runtimePatch)).catch((err) => {
|
|
18
22
|
console.error(`${LOG_TAG}: failed to apply mic requirements:`, err);
|
|
19
23
|
});
|
|
20
24
|
}
|
|
@@ -27,6 +31,11 @@ class MicStateCoordinator {
|
|
|
27
31
|
// Local miniapp requirements (set when miniapps subscribe to audio streams)
|
|
28
32
|
localWantsPcm = false;
|
|
29
33
|
localWantsLc3 = false;
|
|
34
|
+
configuredVad;
|
|
35
|
+
configuredLoudnessGate;
|
|
36
|
+
miniappVadOverrides = new Map();
|
|
37
|
+
miniappLoudnessGateOverrides = new Map();
|
|
38
|
+
overrideSequence = 0;
|
|
30
39
|
constructor() { }
|
|
31
40
|
static getInstance() {
|
|
32
41
|
if (!MicStateCoordinator.instance) {
|
|
@@ -41,9 +50,94 @@ class MicStateCoordinator {
|
|
|
41
50
|
setLocalRequirements(req) {
|
|
42
51
|
this.localWantsPcm = req.pcm;
|
|
43
52
|
this.localWantsLc3 = req.lc3;
|
|
53
|
+
this.rememberConfiguredGates(req);
|
|
44
54
|
console.log(`${LOG_TAG}: local requirements updated — pcm=${req.pcm} lc3=${req.lc3}`);
|
|
45
55
|
this.applyUnion();
|
|
46
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Apply a miniapp-owned gate override without changing the OS preference.
|
|
59
|
+
* Overrides are lifecycle-scoped and last-live-owner-wins independently for
|
|
60
|
+
* VAD and Barrier.
|
|
61
|
+
*/
|
|
62
|
+
async setMiniappGateOverride(packageName, gate, enabled, configured = {}) {
|
|
63
|
+
this.rememberConfiguredGates(configured);
|
|
64
|
+
const overrides = this.overridesFor(gate);
|
|
65
|
+
const previous = overrides.get(packageName);
|
|
66
|
+
const next = { enabled, order: ++this.overrideSequence };
|
|
67
|
+
overrides.set(packageName, next);
|
|
68
|
+
try {
|
|
69
|
+
await BluetoothSdk.updateBluetoothSettings(this.effectiveGatePatch());
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
// Do not roll back a newer request from the same package that landed
|
|
73
|
+
// while this native write was in flight.
|
|
74
|
+
if (overrides.get(packageName) === next) {
|
|
75
|
+
if (previous)
|
|
76
|
+
overrides.set(packageName, previous);
|
|
77
|
+
else
|
|
78
|
+
overrides.delete(packageName);
|
|
79
|
+
}
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Remove every gate override owned by a miniapp. This is synchronous so
|
|
85
|
+
* unregister can drop ownership before recomputing aggregate mic state.
|
|
86
|
+
*/
|
|
87
|
+
clearMiniappGateOverrides(packageName) {
|
|
88
|
+
const removedVad = this.miniappVadOverrides.delete(packageName);
|
|
89
|
+
const removedLoudness = this.miniappLoudnessGateOverrides.delete(packageName);
|
|
90
|
+
return removedVad || removedLoudness;
|
|
91
|
+
}
|
|
92
|
+
/** Re-apply the current runtime policy after an owner is released. */
|
|
93
|
+
async syncEffectiveGatePolicy(configured = {}) {
|
|
94
|
+
this.rememberConfiguredGates(configured);
|
|
95
|
+
const patch = this.effectiveGatePatch();
|
|
96
|
+
if (Object.keys(patch).length === 0)
|
|
97
|
+
return;
|
|
98
|
+
await BluetoothSdk.updateBluetoothSettings(patch);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Preserve the runtime microphone contract when the persisted device
|
|
102
|
+
* settings are replayed (for example after a glasses reconnect). Active
|
|
103
|
+
* miniapp gate overrides replace the OS values, and raw PCM keeps VAD off
|
|
104
|
+
* until the last raw-audio consumer unsubscribes.
|
|
105
|
+
*/
|
|
106
|
+
applyRuntimeOverrides(settings) {
|
|
107
|
+
this.rememberConfiguredGates({
|
|
108
|
+
vadEnabled: typeof settings.voice_activity_detection_enabled === "boolean"
|
|
109
|
+
? settings.voice_activity_detection_enabled
|
|
110
|
+
: undefined,
|
|
111
|
+
loudnessGateEnabled: typeof settings.loudness_gate_enabled === "boolean" ? settings.loudness_gate_enabled : undefined,
|
|
112
|
+
});
|
|
113
|
+
return this.applyActiveRuntimeOverrides(settings);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Apply the complete current gate policy without treating the input as an OS
|
|
117
|
+
* preference update. Used by debounced mic-requirement writes, whose queued
|
|
118
|
+
* gate values may be stale after an override is acquired or released.
|
|
119
|
+
*/
|
|
120
|
+
applyEffectiveGatePolicy(settings) {
|
|
121
|
+
return {
|
|
122
|
+
...settings,
|
|
123
|
+
...this.effectiveGatePatch(),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
applyActiveRuntimeOverrides(settings) {
|
|
127
|
+
const runtimeSettings = { ...settings };
|
|
128
|
+
const vadOverride = this.latestOverride(this.miniappVadOverrides);
|
|
129
|
+
const loudnessOverride = this.latestOverride(this.miniappLoudnessGateOverrides);
|
|
130
|
+
if (this.localWantsPcm) {
|
|
131
|
+
runtimeSettings.voice_activity_detection_enabled = false;
|
|
132
|
+
}
|
|
133
|
+
else if (vadOverride) {
|
|
134
|
+
runtimeSettings.voice_activity_detection_enabled = vadOverride.enabled;
|
|
135
|
+
}
|
|
136
|
+
if (loudnessOverride) {
|
|
137
|
+
runtimeSettings.loudness_gate_enabled = loudnessOverride.enabled;
|
|
138
|
+
}
|
|
139
|
+
return runtimeSettings;
|
|
140
|
+
}
|
|
47
141
|
/**
|
|
48
142
|
* Push local requirements to BluetoothSdk. `should_send_pcm` is strictly for
|
|
49
143
|
* on-device PCM consumers; cloud audio uses LC3 through AudioCloudUplink.
|
|
@@ -56,11 +150,53 @@ class MicStateCoordinator {
|
|
|
56
150
|
// )
|
|
57
151
|
// The mic control plane is a direct btsdk call now (was a host setMicRequirements
|
|
58
152
|
// hook) so a bare OEM streams audio without wiring it.
|
|
59
|
-
|
|
153
|
+
const patch = {
|
|
60
154
|
should_send_pcm: shouldSendPcm,
|
|
61
155
|
should_send_lc3: shouldSendLc3,
|
|
62
156
|
should_send_transcript: false,
|
|
63
|
-
|
|
157
|
+
...this.effectiveGatePatch(),
|
|
158
|
+
};
|
|
159
|
+
flushMicRequirementsPatch(patch);
|
|
160
|
+
}
|
|
161
|
+
rememberConfiguredGates(configured) {
|
|
162
|
+
// null means the connected device intentionally omits that setting.
|
|
163
|
+
// undefined means the caller is not updating the remembered preference.
|
|
164
|
+
if (configured.vadEnabled !== undefined) {
|
|
165
|
+
this.configuredVad = configured.vadEnabled ?? undefined;
|
|
166
|
+
}
|
|
167
|
+
if (configured.loudnessGateEnabled !== undefined) {
|
|
168
|
+
this.configuredLoudnessGate = configured.loudnessGateEnabled ?? undefined;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
overridesFor(gate) {
|
|
172
|
+
return gate === "vad" ? this.miniappVadOverrides : this.miniappLoudnessGateOverrides;
|
|
173
|
+
}
|
|
174
|
+
latestOverride(overrides) {
|
|
175
|
+
let latest;
|
|
176
|
+
for (const entry of overrides.values()) {
|
|
177
|
+
if (!latest || entry.order > latest.order)
|
|
178
|
+
latest = entry;
|
|
179
|
+
}
|
|
180
|
+
return latest;
|
|
181
|
+
}
|
|
182
|
+
effectiveGatePatch() {
|
|
183
|
+
const patch = {};
|
|
184
|
+
const vadOverride = this.latestOverride(this.miniappVadOverrides);
|
|
185
|
+
const loudnessOverride = this.latestOverride(this.miniappLoudnessGateOverrides);
|
|
186
|
+
// Hardware VAD suppresses silence. Raw-audio consumers need a continuous
|
|
187
|
+
// timeline, so their requirement wins over both OS and miniapp VAD values.
|
|
188
|
+
if (this.localWantsPcm)
|
|
189
|
+
patch.voice_activity_detection_enabled = false;
|
|
190
|
+
else if (vadOverride)
|
|
191
|
+
patch.voice_activity_detection_enabled = vadOverride.enabled;
|
|
192
|
+
else if (this.configuredVad !== undefined)
|
|
193
|
+
patch.voice_activity_detection_enabled = this.configuredVad;
|
|
194
|
+
if (loudnessOverride)
|
|
195
|
+
patch.loudness_gate_enabled = loudnessOverride.enabled;
|
|
196
|
+
else if (this.configuredLoudnessGate !== undefined) {
|
|
197
|
+
patch.loudness_gate_enabled = this.configuredLoudnessGate;
|
|
198
|
+
}
|
|
199
|
+
return patch;
|
|
64
200
|
}
|
|
65
201
|
/**
|
|
66
202
|
* Reset all requirements to off. Called during cleanup.
|
|
@@ -72,6 +208,8 @@ class MicStateCoordinator {
|
|
|
72
208
|
}
|
|
73
209
|
cleanup() {
|
|
74
210
|
console.log(`${LOG_TAG}: cleanup()`);
|
|
211
|
+
this.miniappVadOverrides.clear();
|
|
212
|
+
this.miniappLoudnessGateOverrides.clear();
|
|
75
213
|
this.reset();
|
|
76
214
|
MicStateCoordinator.instance = null;
|
|
77
215
|
}
|