@glassly/engine 0.1.0-dev.99 → 0.2.8-dev.445

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.
Files changed (501) hide show
  1. package/README.md +28 -0
  2. package/build/engine.d.ts +32 -10
  3. package/build/engine.d.ts.map +1 -1
  4. package/build/engine.js +24 -16
  5. package/build/engine.js.map +1 -1
  6. package/build/facades/dev.d.ts +9 -0
  7. package/build/facades/dev.d.ts.map +1 -1
  8. package/build/facades/dev.js +9 -0
  9. package/build/facades/dev.js.map +1 -1
  10. package/build/facades/display.d.ts +10 -3
  11. package/build/facades/display.d.ts.map +1 -1
  12. package/build/facades/display.js +22 -8
  13. package/build/facades/display.js.map +1 -1
  14. package/build/facades/displayMirror.d.ts +11 -0
  15. package/build/facades/displayMirror.d.ts.map +1 -1
  16. package/build/facades/displayMirror.js +22 -0
  17. package/build/facades/displayMirror.js.map +1 -1
  18. package/build/facades/glasses.d.ts +31 -1
  19. package/build/facades/glasses.d.ts.map +1 -1
  20. package/build/facades/glasses.js +51 -0
  21. package/build/facades/glasses.js.map +1 -1
  22. package/build/facades/memory.d.ts +0 -6
  23. package/build/facades/memory.d.ts.map +1 -1
  24. package/build/facades/memory.js +1 -9
  25. package/build/facades/memory.js.map +1 -1
  26. package/build/facades/miniapps.d.ts +3 -1
  27. package/build/facades/miniapps.d.ts.map +1 -1
  28. package/build/facades/miniapps.js +3 -1
  29. package/build/facades/miniapps.js.map +1 -1
  30. package/build/facades/pairing.d.ts.map +1 -1
  31. package/build/facades/pairing.js +5 -4
  32. package/build/facades/pairing.js.map +1 -1
  33. package/build/facades/permissions.d.ts +2 -0
  34. package/build/facades/permissions.d.ts.map +1 -1
  35. package/build/facades/permissions.js +48 -0
  36. package/build/facades/permissions.js.map +1 -1
  37. package/build/facades/phoneNotifications.d.ts +20 -9
  38. package/build/facades/phoneNotifications.d.ts.map +1 -1
  39. package/build/facades/phoneNotifications.js +33 -26
  40. package/build/facades/phoneNotifications.js.map +1 -1
  41. package/build/facades/settings.d.ts.map +1 -1
  42. package/build/facades/settings.js +1 -2
  43. package/build/facades/settings.js.map +1 -1
  44. package/build/generated/releaseMetadata.js +4 -4
  45. package/build/generated/releaseMetadata.js.map +1 -1
  46. package/build/index.d.ts +6 -4
  47. package/build/index.d.ts.map +1 -1
  48. package/build/index.js +5 -4
  49. package/build/index.js.map +1 -1
  50. package/build/react/MentraLiveOtaFlow.js +2 -2
  51. package/build/react/MentraLiveOtaFlow.js.map +1 -1
  52. package/build/react/useMentraLiveOta.d.ts.map +1 -1
  53. package/build/react/useMentraLiveOta.js +8 -7
  54. package/build/react/useMentraLiveOta.js.map +1 -1
  55. package/build/runtime/config.d.ts +1 -1
  56. package/build/runtime/config.d.ts.map +1 -1
  57. package/build/runtime/config.js.map +1 -1
  58. package/build/services/AppRegistry.d.ts +4 -1
  59. package/build/services/AppRegistry.d.ts.map +1 -1
  60. package/build/services/AppRegistry.js +21 -1
  61. package/build/services/AppRegistry.js.map +1 -1
  62. package/build/services/BlobStore.d.ts +2 -2
  63. package/build/services/BlobStore.js +3 -3
  64. package/build/services/BlobStore.js.map +1 -1
  65. package/build/services/CloudClientService.d.ts +7 -3
  66. package/build/services/CloudClientService.d.ts.map +1 -1
  67. package/build/services/CloudClientService.js +34 -9
  68. package/build/services/CloudClientService.js.map +1 -1
  69. package/build/services/DevServerBridge.d.ts +1 -18
  70. package/build/services/DevServerBridge.d.ts.map +1 -1
  71. package/build/services/DevServerBridge.js +9 -8
  72. package/build/services/DevServerBridge.js.map +1 -1
  73. package/build/services/DeviceEventRouter.d.ts.map +1 -1
  74. package/build/services/DeviceEventRouter.js +58 -71
  75. package/build/services/DeviceEventRouter.js.map +1 -1
  76. package/build/services/DisplayDiagnostics.d.ts +5 -0
  77. package/build/services/DisplayDiagnostics.d.ts.map +1 -0
  78. package/build/services/DisplayDiagnostics.js +105 -0
  79. package/build/services/DisplayDiagnostics.js.map +1 -0
  80. package/build/services/DisplayProcessor.d.ts +6 -7
  81. package/build/services/DisplayProcessor.d.ts.map +1 -1
  82. package/build/services/DisplayProcessor.js +17 -45
  83. package/build/services/DisplayProcessor.js.map +1 -1
  84. package/build/services/GestureDotsService.d.ts +10 -4
  85. package/build/services/GestureDotsService.d.ts.map +1 -1
  86. package/build/services/GestureDotsService.js +70 -16
  87. package/build/services/GestureDotsService.js.map +1 -1
  88. package/build/services/GlassesKeyboardInput.d.ts +77 -0
  89. package/build/services/GlassesKeyboardInput.d.ts.map +1 -0
  90. package/build/services/GlassesKeyboardInput.js +261 -0
  91. package/build/services/GlassesKeyboardInput.js.map +1 -0
  92. package/build/services/GlassesSensorService.d.ts +47 -0
  93. package/build/services/GlassesSensorService.d.ts.map +1 -0
  94. package/build/services/GlassesSensorService.js +242 -0
  95. package/build/services/GlassesSensorService.js.map +1 -0
  96. package/build/services/GlassesTouchInput.d.ts +14 -0
  97. package/build/services/GlassesTouchInput.d.ts.map +1 -0
  98. package/build/services/GlassesTouchInput.js +107 -0
  99. package/build/services/GlassesTouchInput.js.map +1 -0
  100. package/build/services/HeadingService.d.ts +0 -6
  101. package/build/services/HeadingService.d.ts.map +1 -1
  102. package/build/services/HeadingService.js +0 -27
  103. package/build/services/HeadingService.js.map +1 -1
  104. package/build/services/HotspotShutdown.d.ts.map +1 -1
  105. package/build/services/HotspotShutdown.js +2 -1
  106. package/build/services/HotspotShutdown.js.map +1 -1
  107. package/build/services/JSCrashloopReportService.js +2 -2
  108. package/build/services/JSCrashloopReportService.js.map +1 -1
  109. package/build/services/JSRouter.d.ts +6 -4
  110. package/build/services/JSRouter.d.ts.map +1 -1
  111. package/build/services/JSRouter.js +15 -13
  112. package/build/services/JSRouter.js.map +1 -1
  113. package/build/services/LocalDisplayManager.d.ts +35 -7
  114. package/build/services/LocalDisplayManager.d.ts.map +1 -1
  115. package/build/services/LocalDisplayManager.js +105 -27
  116. package/build/services/LocalDisplayManager.js.map +1 -1
  117. package/build/services/LocalMiniappDataMigration.d.ts +1 -1
  118. package/build/services/LocalMiniappDataMigration.js +1 -1
  119. package/build/services/LocalMiniappDataMigration.js.map +1 -1
  120. package/build/services/LocalMiniappRuntime.d.ts +64 -11
  121. package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
  122. package/build/services/LocalMiniappRuntime.js +441 -35
  123. package/build/services/LocalMiniappRuntime.js.map +1 -1
  124. package/build/services/LocalSttFallbackCoordinator.d.ts +3 -0
  125. package/build/services/LocalSttFallbackCoordinator.d.ts.map +1 -1
  126. package/build/services/LocalSttFallbackCoordinator.js +27 -8
  127. package/build/services/LocalSttFallbackCoordinator.js.map +1 -1
  128. package/build/services/MemoryStore.d.ts +8 -33
  129. package/build/services/MemoryStore.d.ts.map +1 -1
  130. package/build/services/MemoryStore.js +30 -56
  131. package/build/services/MemoryStore.js.map +1 -1
  132. package/build/services/MiniappEngine.d.ts +3 -3
  133. package/build/services/MiniappEngine.js +7 -7
  134. package/build/services/MiniappEngine.js.map +1 -1
  135. package/build/services/MiniappLauncher.d.ts +8 -0
  136. package/build/services/MiniappLauncher.d.ts.map +1 -1
  137. package/build/services/MiniappLauncher.js +19 -1
  138. package/build/services/MiniappLauncher.js.map +1 -1
  139. package/build/services/MirrorService.d.ts +24 -0
  140. package/build/services/MirrorService.d.ts.map +1 -0
  141. package/build/services/MirrorService.js +132 -0
  142. package/build/services/MirrorService.js.map +1 -0
  143. package/build/services/NativeNavigationService.d.ts +2 -3
  144. package/build/services/NativeNavigationService.d.ts.map +1 -1
  145. package/build/services/NativeNavigationService.js +24 -21
  146. package/build/services/NativeNavigationService.js.map +1 -1
  147. package/build/services/NavigationHandlers.d.ts.map +1 -1
  148. package/build/services/NavigationHandlers.js +10 -5
  149. package/build/services/NavigationHandlers.js.map +1 -1
  150. package/build/services/OtaInstallCoordinator.d.ts.map +1 -1
  151. package/build/services/OtaInstallCoordinator.js +24 -23
  152. package/build/services/OtaInstallCoordinator.js.map +1 -1
  153. package/build/services/PairedGlassesLatch.d.ts +7 -0
  154. package/build/services/PairedGlassesLatch.d.ts.map +1 -0
  155. package/build/services/PairedGlassesLatch.js +38 -0
  156. package/build/services/PairedGlassesLatch.js.map +1 -0
  157. package/build/services/PhoneActivity.d.ts +23 -0
  158. package/build/services/PhoneActivity.d.ts.map +1 -0
  159. package/build/services/PhoneActivity.js +111 -0
  160. package/build/services/PhoneActivity.js.map +1 -0
  161. package/build/services/PhoneCameraFovCoordinator.d.ts.map +1 -1
  162. package/build/services/PhoneCameraFovCoordinator.js +4 -3
  163. package/build/services/PhoneCameraFovCoordinator.js.map +1 -1
  164. package/build/services/PhoneNotificationsSync.d.ts +40 -6
  165. package/build/services/PhoneNotificationsSync.d.ts.map +1 -1
  166. package/build/services/PhoneNotificationsSync.js +160 -84
  167. package/build/services/PhoneNotificationsSync.js.map +1 -1
  168. package/build/services/PhonePhotoCoordinator.d.ts.map +1 -1
  169. package/build/services/PhonePhotoCoordinator.js +6 -5
  170. package/build/services/PhonePhotoCoordinator.js.map +1 -1
  171. package/build/services/PhoneStreamCoordinator.d.ts.map +1 -1
  172. package/build/services/PhoneStreamCoordinator.js +8 -7
  173. package/build/services/PhoneStreamCoordinator.js.map +1 -1
  174. package/build/services/STTModelManager.d.ts +3 -0
  175. package/build/services/STTModelManager.d.ts.map +1 -1
  176. package/build/services/STTModelManager.js +15 -1
  177. package/build/services/STTModelManager.js.map +1 -1
  178. package/build/services/SceneRenderer.d.ts +43 -2
  179. package/build/services/SceneRenderer.d.ts.map +1 -1
  180. package/build/services/SceneRenderer.js +123 -8
  181. package/build/services/SceneRenderer.js.map +1 -1
  182. package/build/services/StreamLifecycleController.d.ts.map +1 -1
  183. package/build/services/StreamLifecycleController.js +6 -14
  184. package/build/services/StreamLifecycleController.js.map +1 -1
  185. package/build/services/TTSModelManager.js +1 -1
  186. package/build/services/TTSModelManager.js.map +1 -1
  187. package/build/services/UIRouter.d.ts +2 -2
  188. package/build/services/UIRouter.js +5 -5
  189. package/build/services/UIRouter.js.map +1 -1
  190. package/build/services/asg/galleryPathMigration.js +1 -1
  191. package/build/services/asg/galleryPathMigration.js.map +1 -1
  192. package/build/services/asg/gallerySyncService.js +2 -2
  193. package/build/services/asg/gallerySyncService.js.map +1 -1
  194. package/build/services/asg/localStorageService.d.ts.map +1 -1
  195. package/build/services/asg/localStorageService.js +3 -3
  196. package/build/services/asg/localStorageService.js.map +1 -1
  197. package/build/services/debug/DashboardOpenTrace.d.ts +32 -0
  198. package/build/services/debug/DashboardOpenTrace.d.ts.map +1 -0
  199. package/build/services/debug/DashboardOpenTrace.js +128 -0
  200. package/build/services/debug/DashboardOpenTrace.js.map +1 -0
  201. package/build/services/debug/dashboardOpenTimeline.d.ts +77 -0
  202. package/build/services/debug/dashboardOpenTimeline.d.ts.map +1 -0
  203. package/build/services/debug/dashboardOpenTimeline.js +195 -0
  204. package/build/services/debug/dashboardOpenTimeline.js.map +1 -0
  205. package/build/services/effectiveCapabilities.d.ts.map +1 -1
  206. package/build/services/effectiveCapabilities.js +25 -13
  207. package/build/services/effectiveCapabilities.js.map +1 -1
  208. package/build/services/gestureClaims.d.ts +34 -15
  209. package/build/services/gestureClaims.d.ts.map +1 -1
  210. package/build/services/gestureClaims.js +42 -21
  211. package/build/services/gestureClaims.js.map +1 -1
  212. package/build/services/manifestFields.d.ts +9 -0
  213. package/build/services/manifestFields.d.ts.map +1 -0
  214. package/build/services/manifestFields.js +26 -0
  215. package/build/services/manifestFields.js.map +1 -0
  216. package/build/services/memoryStoreInstance.d.ts +0 -10
  217. package/build/services/memoryStoreInstance.d.ts.map +1 -1
  218. package/build/services/memoryStoreInstance.js +2 -31
  219. package/build/services/memoryStoreInstance.js.map +1 -1
  220. package/build/services/mirrorSnapshot.d.ts +16 -0
  221. package/build/services/mirrorSnapshot.d.ts.map +1 -0
  222. package/build/services/mirrorSnapshot.js +102 -0
  223. package/build/services/mirrorSnapshot.js.map +1 -0
  224. package/build/services/nativeNavigationGate.d.ts +8 -0
  225. package/build/services/nativeNavigationGate.d.ts.map +1 -0
  226. package/build/services/nativeNavigationGate.js +12 -0
  227. package/build/services/nativeNavigationGate.js.map +1 -0
  228. package/build/services/notificationAppCatalog.d.ts +7 -0
  229. package/build/services/notificationAppCatalog.d.ts.map +1 -0
  230. package/build/services/notificationAppCatalog.js +16 -0
  231. package/build/services/notificationAppCatalog.js.map +1 -0
  232. package/build/services/notifications/notificationPolicy.d.ts +55 -0
  233. package/build/services/notifications/notificationPolicy.d.ts.map +1 -0
  234. package/build/services/notifications/notificationPolicy.js +41 -0
  235. package/build/services/notifications/notificationPolicy.js.map +1 -0
  236. package/build/services/pages/OverlayPages.d.ts +26 -0
  237. package/build/services/pages/OverlayPages.d.ts.map +1 -0
  238. package/build/services/pages/OverlayPages.js +80 -0
  239. package/build/services/pages/OverlayPages.js.map +1 -0
  240. package/build/services/pages/PageHost.d.ts +32 -0
  241. package/build/services/pages/PageHost.d.ts.map +1 -0
  242. package/build/services/pages/PageHost.js +99 -0
  243. package/build/services/pages/PageHost.js.map +1 -0
  244. package/build/services/pages/overlayApps.d.ts +25 -0
  245. package/build/services/pages/overlayApps.d.ts.map +1 -0
  246. package/build/services/pages/overlayApps.js +66 -0
  247. package/build/services/pages/overlayApps.js.map +1 -0
  248. package/build/services/pages/pageEligibility.d.ts +9 -0
  249. package/build/services/pages/pageEligibility.d.ts.map +1 -0
  250. package/build/services/pages/pageEligibility.js +27 -0
  251. package/build/services/pages/pageEligibility.js.map +1 -0
  252. package/build/services/settingsBridge.d.ts +58 -0
  253. package/build/services/settingsBridge.d.ts.map +1 -0
  254. package/build/services/settingsBridge.js +90 -0
  255. package/build/services/settingsBridge.js.map +1 -0
  256. package/build/services/speakerProfileStoreInstance.js +1 -1
  257. package/build/services/speakerProfileStoreInstance.js.map +1 -1
  258. package/build/services/uiShim.d.ts +1 -1
  259. package/build/services/uiShim.js +4 -4
  260. package/build/services/uiShim.js.map +1 -1
  261. package/build/stores/appVisibility.d.ts +28 -0
  262. package/build/stores/appVisibility.d.ts.map +1 -1
  263. package/build/stores/appVisibility.js +34 -0
  264. package/build/stores/appVisibility.js.map +1 -1
  265. package/build/stores/apps.d.ts +13 -0
  266. package/build/stores/apps.d.ts.map +1 -1
  267. package/build/stores/apps.js +66 -12
  268. package/build/stores/apps.js.map +1 -1
  269. package/build/stores/bluetoothSettingKeys.js +1 -1
  270. package/build/stores/bluetoothSettingKeys.js.map +1 -1
  271. package/build/stores/display.d.ts +3 -3
  272. package/build/stores/display.d.ts.map +1 -1
  273. package/build/stores/display.js +16 -4
  274. package/build/stores/display.js.map +1 -1
  275. package/build/stores/glasses.d.ts.map +1 -1
  276. package/build/stores/glasses.js +14 -1
  277. package/build/stores/glasses.js.map +1 -1
  278. package/build/stores/settings.d.ts +1 -0
  279. package/build/stores/settings.d.ts.map +1 -1
  280. package/build/stores/settings.js +170 -44
  281. package/build/stores/settings.js.map +1 -1
  282. package/build/types/applet.d.ts +14 -1
  283. package/build/types/applet.d.ts.map +1 -1
  284. package/build/types/applet.js.map +1 -1
  285. package/build/types/capabilities/even-realities-g2.d.ts.map +1 -1
  286. package/build/types/capabilities/even-realities-g2.js +5 -0
  287. package/build/types/capabilities/even-realities-g2.js.map +1 -1
  288. package/build/types/capabilities/simulated-glasses.d.ts +1 -1
  289. package/build/types/capabilities/simulated-glasses.d.ts.map +1 -1
  290. package/build/types/capabilities/simulated-glasses.js +7 -4
  291. package/build/types/capabilities/simulated-glasses.js.map +1 -1
  292. package/build/types/hardware.d.ts +20 -1
  293. package/build/types/hardware.d.ts.map +1 -1
  294. package/build/types/hardware.js +2 -0
  295. package/build/types/hardware.js.map +1 -1
  296. package/build/types/index.d.ts +1 -0
  297. package/build/types/index.d.ts.map +1 -1
  298. package/build/types/index.js +1 -0
  299. package/build/types/index.js.map +1 -1
  300. package/build/utils/debouncedPatch.d.ts +3 -1
  301. package/build/utils/debouncedPatch.d.ts.map +1 -1
  302. package/build/utils/debouncedPatch.js +6 -3
  303. package/build/utils/debouncedPatch.js.map +1 -1
  304. package/build/utils/devMiniappLaunch.d.ts.map +1 -1
  305. package/build/utils/devMiniappLaunch.js +4 -3
  306. package/build/utils/devMiniappLaunch.js.map +1 -1
  307. package/build/utils/display/measurer/TextMeasurer.d.ts +2 -159
  308. package/build/utils/display/measurer/TextMeasurer.d.ts.map +1 -1
  309. package/build/utils/display/measurer/TextMeasurer.js +2 -272
  310. package/build/utils/display/measurer/TextMeasurer.js.map +1 -1
  311. package/build/utils/display/measurer/script-detection.d.ts +1 -52
  312. package/build/utils/display/measurer/script-detection.d.ts.map +1 -1
  313. package/build/utils/display/measurer/script-detection.js +2 -183
  314. package/build/utils/display/measurer/script-detection.js.map +1 -1
  315. package/build/utils/display/pixelArt.d.ts +3 -0
  316. package/build/utils/display/pixelArt.d.ts.map +1 -0
  317. package/build/utils/display/pixelArt.js +3 -0
  318. package/build/utils/display/pixelArt.js.map +1 -0
  319. package/build/utils/display/profiles/g1.d.ts +1 -32
  320. package/build/utils/display/profiles/g1.d.ts.map +1 -1
  321. package/build/utils/display/profiles/g1.js +2 -212
  322. package/build/utils/display/profiles/g1.js.map +1 -1
  323. package/build/utils/display/profiles/g2.d.ts +1 -12
  324. package/build/utils/display/profiles/g2.d.ts.map +1 -1
  325. package/build/utils/display/profiles/g2.js +2 -33
  326. package/build/utils/display/profiles/g2.js.map +1 -1
  327. package/build/utils/display/profiles/nex.d.ts +1 -9
  328. package/build/utils/display/profiles/nex.d.ts.map +1 -1
  329. package/build/utils/display/profiles/nex.js +2 -149
  330. package/build/utils/display/profiles/nex.js.map +1 -1
  331. package/build/utils/display/profiles/types.d.ts +1 -102
  332. package/build/utils/display/profiles/types.d.ts.map +1 -1
  333. package/build/utils/display/profiles/types.js.map +1 -1
  334. package/build/utils/display/profiles/z100.d.ts +1 -32
  335. package/build/utils/display/profiles/z100.d.ts.map +1 -1
  336. package/build/utils/display/profiles/z100.js +2 -181
  337. package/build/utils/display/profiles/z100.js.map +1 -1
  338. package/build/utils/display/scene/degrade.d.ts.map +1 -1
  339. package/build/utils/display/scene/degrade.js +4 -1
  340. package/build/utils/display/scene/degrade.js.map +1 -1
  341. package/build/utils/display/scene/differ.d.ts +13 -1
  342. package/build/utils/display/scene/differ.d.ts.map +1 -1
  343. package/build/utils/display/scene/differ.js +22 -0
  344. package/build/utils/display/scene/differ.js.map +1 -1
  345. package/build/utils/display/scene/index.d.ts +1 -1
  346. package/build/utils/display/scene/index.d.ts.map +1 -1
  347. package/build/utils/display/scene/index.js.map +1 -1
  348. package/build/utils/display/scene/process.d.ts.map +1 -1
  349. package/build/utils/display/scene/process.js +183 -11
  350. package/build/utils/display/scene/process.js.map +1 -1
  351. package/build/utils/display/scene/store.d.ts +1 -1
  352. package/build/utils/display/scene/store.d.ts.map +1 -1
  353. package/build/utils/display/scene/store.js +0 -0
  354. package/build/utils/display/scene/store.js.map +1 -1
  355. package/build/utils/display/scene/svgPath.d.ts +9 -0
  356. package/build/utils/display/scene/svgPath.d.ts.map +1 -0
  357. package/build/utils/display/scene/svgPath.js +167 -0
  358. package/build/utils/display/scene/svgPath.js.map +1 -0
  359. package/build/utils/display/scene/types.d.ts +2 -142
  360. package/build/utils/display/scene/types.d.ts.map +1 -1
  361. package/build/utils/display/scene/types.js +0 -0
  362. package/build/utils/display/scene/types.js.map +1 -1
  363. package/build/utils/display/wrapper/TextWrapper.d.ts +1 -101
  364. package/build/utils/display/wrapper/TextWrapper.d.ts.map +1 -1
  365. package/build/utils/display/wrapper/TextWrapper.js +2 -470
  366. package/build/utils/display/wrapper/TextWrapper.js.map +1 -1
  367. package/build/utils/display/wrapper/types.d.ts +2 -74
  368. package/build/utils/display/wrapper/types.d.ts.map +1 -1
  369. package/build/utils/display/wrapper/types.js +2 -10
  370. package/build/utils/display/wrapper/types.js.map +1 -1
  371. package/build/utils/hardware/hardware.js +1 -1
  372. package/build/utils/hardware/hardware.js.map +1 -1
  373. package/build/utils/timers/timers.d.ts.map +1 -1
  374. package/build/utils/timers/timers.js +26 -4
  375. package/build/utils/timers/timers.js.map +1 -1
  376. package/package.json +8 -8
  377. package/src/engine.ts +24 -15
  378. package/src/facades/dev.ts +10 -0
  379. package/src/facades/display.ts +21 -8
  380. package/src/facades/displayMirror.ts +29 -0
  381. package/src/facades/glasses.ts +61 -1
  382. package/src/facades/memory.ts +1 -12
  383. package/src/facades/miniapps.ts +4 -1
  384. package/src/facades/pairing.ts +8 -6
  385. package/src/facades/permissions.ts +46 -0
  386. package/src/facades/phoneNotifications.ts +45 -26
  387. package/src/facades/settings.ts +1 -2
  388. package/src/generated/releaseMetadata.ts +4 -4
  389. package/src/index.ts +6 -9
  390. package/src/react/MentraLiveOtaFlow.tsx +2 -2
  391. package/src/react/useMentraLiveOta.ts +14 -8
  392. package/src/runtime/config.ts +1 -1
  393. package/src/services/AppRegistry.ts +43 -7
  394. package/src/services/BlobStore.ts +3 -3
  395. package/src/services/CloudClientService.ts +37 -10
  396. package/src/services/DevServerBridge.ts +12 -10
  397. package/src/services/DeviceEventRouter.ts +73 -74
  398. package/src/services/DisplayDiagnostics.ts +107 -0
  399. package/src/services/DisplayProcessor.ts +20 -55
  400. package/src/services/GestureDotsService.ts +77 -16
  401. package/src/services/GlassesKeyboardInput.ts +306 -0
  402. package/src/services/GlassesSensorService.ts +233 -0
  403. package/src/services/GlassesTouchInput.ts +128 -0
  404. package/src/services/HeadingService.ts +0 -24
  405. package/src/services/HotspotShutdown.ts +3 -1
  406. package/src/services/JSCrashloopReportService.ts +2 -2
  407. package/src/services/JSRouter.ts +29 -14
  408. package/src/services/LocalDisplayManager.ts +112 -26
  409. package/src/services/LocalMiniappDataMigration.ts +1 -1
  410. package/src/services/LocalMiniappRuntime.ts +500 -43
  411. package/src/services/LocalSttFallbackCoordinator.ts +28 -7
  412. package/src/services/MemoryStore.ts +32 -80
  413. package/src/services/MiniappEngine.ts +7 -7
  414. package/src/services/MiniappLauncher.ts +25 -1
  415. package/src/services/MirrorService.ts +139 -0
  416. package/src/services/NativeNavigationService.ts +29 -25
  417. package/src/services/NavigationHandlers.ts +10 -5
  418. package/src/services/OtaInstallCoordinator.ts +36 -34
  419. package/src/services/PairedGlassesLatch.ts +39 -0
  420. package/src/services/PhoneActivity.ts +116 -0
  421. package/src/services/PhoneCameraFovCoordinator.ts +6 -4
  422. package/src/services/PhoneNotificationsSync.ts +185 -103
  423. package/src/services/PhonePhotoCoordinator.ts +9 -10
  424. package/src/services/PhoneStreamCoordinator.ts +13 -11
  425. package/src/services/STTModelManager.ts +15 -1
  426. package/src/services/SceneRenderer.ts +148 -10
  427. package/src/services/StreamLifecycleController.ts +9 -7
  428. package/src/services/TTSModelManager.ts +1 -1
  429. package/src/services/UIRouter.ts +5 -5
  430. package/src/services/asg/galleryPathMigration.ts +1 -1
  431. package/src/services/asg/gallerySyncService.ts +2 -2
  432. package/src/services/asg/localStorageService.ts +3 -3
  433. package/src/services/debug/DashboardOpenTrace.ts +153 -0
  434. package/src/services/debug/dashboardOpenTimeline.ts +237 -0
  435. package/src/services/effectiveCapabilities.ts +32 -13
  436. package/src/services/gestureClaims.ts +72 -23
  437. package/src/services/manifestFields.ts +23 -0
  438. package/src/services/memoryStoreInstance.ts +2 -34
  439. package/src/services/mirrorSnapshot.ts +116 -0
  440. package/src/services/nativeNavigationGate.ts +14 -0
  441. package/src/services/notificationAppCatalog.ts +21 -0
  442. package/src/services/notifications/notificationPolicy.ts +87 -0
  443. package/src/services/pages/OverlayPages.ts +86 -0
  444. package/src/services/pages/PageHost.ts +116 -0
  445. package/src/services/pages/overlayApps.ts +72 -0
  446. package/src/services/pages/pageEligibility.ts +30 -0
  447. package/src/services/settingsBridge.ts +111 -0
  448. package/src/services/speakerProfileStoreInstance.ts +1 -1
  449. package/src/services/uiShim.ts +4 -4
  450. package/src/stores/appVisibility.ts +45 -0
  451. package/src/stores/apps.ts +110 -32
  452. package/src/stores/bluetoothSettingKeys.ts +1 -1
  453. package/src/stores/display.ts +18 -7
  454. package/src/stores/glasses.ts +15 -1
  455. package/src/stores/settings.ts +175 -51
  456. package/src/types/applet.ts +14 -1
  457. package/src/types/capabilities/even-realities-g2.ts +6 -0
  458. package/src/types/capabilities/simulated-glasses.ts +8 -4
  459. package/src/types/hardware.ts +34 -1
  460. package/src/types/index.ts +1 -0
  461. package/src/utils/debouncedPatch.ts +8 -4
  462. package/src/utils/devMiniappLaunch.ts +5 -3
  463. package/src/utils/display/measurer/TextMeasurer.ts +3 -346
  464. package/src/utils/display/measurer/script-detection.ts +10 -218
  465. package/src/utils/display/pixelArt.ts +3 -0
  466. package/src/utils/display/profiles/g1.ts +2 -236
  467. package/src/utils/display/profiles/g2.ts +2 -39
  468. package/src/utils/display/profiles/nex.ts +2 -166
  469. package/src/utils/display/profiles/types.ts +9 -132
  470. package/src/utils/display/profiles/z100.ts +2 -198
  471. package/src/utils/display/scene/degrade.ts +4 -1
  472. package/src/utils/display/scene/differ.ts +25 -1
  473. package/src/utils/display/scene/index.ts +5 -0
  474. package/src/utils/display/scene/process.ts +196 -13
  475. package/src/utils/display/scene/store.ts +0 -0
  476. package/src/utils/display/scene/svgPath.ts +163 -0
  477. package/src/utils/display/scene/types.ts +0 -0
  478. package/src/utils/display/wrapper/TextWrapper.ts +2 -546
  479. package/src/utils/display/wrapper/types.ts +3 -102
  480. package/src/utils/hardware/hardware.ts +1 -1
  481. package/src/utils/timers/timers.ts +32 -4
  482. package/build/services/CustomDashboardModel.d.ts +0 -48
  483. package/build/services/CustomDashboardModel.d.ts.map +0 -1
  484. package/build/services/CustomDashboardModel.js +0 -73
  485. package/build/services/CustomDashboardModel.js.map +0 -1
  486. package/build/services/CustomDashboardService.d.ts +0 -63
  487. package/build/services/CustomDashboardService.d.ts.map +0 -1
  488. package/build/services/CustomDashboardService.js +0 -576
  489. package/build/services/CustomDashboardService.js.map +0 -1
  490. package/build/services/DashboardCoordinator.d.ts +0 -26
  491. package/build/services/DashboardCoordinator.d.ts.map +0 -1
  492. package/build/services/DashboardCoordinator.js +0 -125
  493. package/build/services/DashboardCoordinator.js.map +0 -1
  494. package/build/services/iosNotificationAppCatalog.d.ts +0 -13
  495. package/build/services/iosNotificationAppCatalog.d.ts.map +0 -1
  496. package/build/services/iosNotificationAppCatalog.js +0 -28
  497. package/build/services/iosNotificationAppCatalog.js.map +0 -1
  498. package/src/services/CustomDashboardModel.ts +0 -83
  499. package/src/services/CustomDashboardService.ts +0 -598
  500. package/src/services/DashboardCoordinator.ts +0 -121
  501. package/src/services/iosNotificationAppCatalog.ts +0 -39
@@ -2,10 +2,21 @@ export type DisplayMirrorEvent = Record<string, unknown> & {
2
2
  view?: string;
3
3
  layout?: any;
4
4
  };
5
+ export interface DisplayMirrorCanvas {
6
+ width: number;
7
+ height: number;
8
+ }
5
9
  export declare const displayMirror: {
6
10
  /** The display event currently on the glasses (snapshot). */
7
11
  current(): DisplayMirrorEvent;
8
12
  /** Subscribe to changes of the mirrored display event; returns an unsubscribe. */
9
13
  onMirror(cb: (event: DisplayMirrorEvent) => void): () => void;
14
+ /**
15
+ * Drawable canvas of the selected glasses, in device px — the space scene
16
+ * frames and positioned layouts are laid out in (same source SceneRenderer
17
+ * sends CONNECT_ACK from). Falls back to the text profile's line width.
18
+ * `previewModel` previews a model that is not selected yet (pairing prep).
19
+ */
20
+ canvas(previewModel?: string): DisplayMirrorCanvas;
10
21
  };
11
22
  //# sourceMappingURL=displayMirror.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"displayMirror.d.ts","sourceRoot":"","sources":["../../src/facades/displayMirror.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAC,CAAA;AAExF,eAAO,MAAM,aAAa;IACxB,6DAA6D;eAClD,kBAAkB;IAK7B,kFAAkF;iBACrE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAAG,MAAM,IAAI;CAG9D,CAAA"}
1
+ {"version":3,"file":"displayMirror.d.ts","sourceRoot":"","sources":["../../src/facades/displayMirror.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAC,CAAA;AAExF,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,aAAa;IACxB,6DAA6D;eAClD,kBAAkB;IAK7B,kFAAkF;iBACrE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAAG,MAAM,IAAI;IAI7D;;;;;OAKG;0BACmB,MAAM,GAAG,mBAAmB;CAYnD,CAAA"}
@@ -7,7 +7,12 @@
7
7
  * The raw store is also exposed as `engine.displayStore` (the Glassly-app
8
8
  * escape hatch).
9
9
  */
10
+ import displayProcessor from "../services/DisplayProcessor";
11
+ import { getEffectiveCapabilities } from "../services/effectiveCapabilities";
10
12
  import { useDisplayStore } from "../stores/display";
13
+ import { useGlassesStore } from "../stores/glasses";
14
+ import { SETTINGS, useSettingsStore } from "../stores/settings";
15
+ import { DeviceTypes } from "../types";
11
16
  export const displayMirror = {
12
17
  /** The display event currently on the glasses (snapshot). */
13
18
  current() {
@@ -18,5 +23,22 @@ export const displayMirror = {
18
23
  onMirror(cb) {
19
24
  return useDisplayStore.subscribe((s) => s.currentEvent, cb);
20
25
  },
26
+ /**
27
+ * Drawable canvas of the selected glasses, in device px — the space scene
28
+ * frames and positioned layouts are laid out in (same source SceneRenderer
29
+ * sends CONNECT_ACK from). Falls back to the text profile's line width.
30
+ * `previewModel` previews a model that is not selected yet (pairing prep).
31
+ */
32
+ canvas(previewModel) {
33
+ const model = previewModel ??
34
+ useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key) ??
35
+ useGlassesStore.getState().deviceModel;
36
+ const display = getEffectiveCapabilities((model ?? DeviceTypes.NONE))?.display;
37
+ const profile = displayProcessor.getProfile();
38
+ return {
39
+ width: display?.width ?? display?.resolution?.width ?? profile.displayWidthPx,
40
+ height: display?.height ?? display?.resolution?.height ?? profile.displayHeightPx ?? profile.displayWidthPx / 2,
41
+ };
42
+ },
21
43
  };
22
44
  //# sourceMappingURL=displayMirror.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"displayMirror.js","sourceRoot":"","sources":["../../src/facades/displayMirror.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AAIjD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,6DAA6D;IAC7D,OAAO;QACL,+EAA+E;QAC/E,OAAO,EAAC,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC,YAAY,EAAC,CAAA;IACrD,CAAC;IAED,kFAAkF;IAClF,QAAQ,CAAC,EAAuC;QAC9C,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;IAC7D,CAAC;CACF,CAAA","sourcesContent":["/**\n * glasses display mirror — the typed read facade over the (now engine-owned)\n * display store, for a phone-side preview of the glasses screen\n * (`engine.display.mirror`). The store holds the single frame currently on the\n * glasses (dashboard switching happens upstream in DashboardCoordinator); this\n * facade is the read side: `current()` (snapshot) + `onMirror(cb)` (subscribe).\n * The raw store is also exposed as `engine.displayStore` (the Glassly-app\n * escape hatch).\n */\nimport {useDisplayStore} from \"../stores/display\"\n\nexport type DisplayMirrorEvent = Record<string, unknown> & {view?: string; layout?: any}\n\nexport const displayMirror = {\n /** The display event currently on the glasses (snapshot). */\n current(): DisplayMirrorEvent {\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n return {...useDisplayStore.getState().currentEvent}\n },\n\n /** Subscribe to changes of the mirrored display event; returns an unsubscribe. */\n onMirror(cb: (event: DisplayMirrorEvent) => void): () => void {\n return useDisplayStore.subscribe((s) =>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AO,CAAC,cAAc;YAC7E,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,OAAO,CAAC,eAAe,IAAI,OAAO,CAAC,cAAc,GAAG,CAAC;SAChH,CAAA;IACH,CAAC;CACF,CAAA","sourcesContent":["/**\n * glasses display mirror — the typed read facade over the (now engine-owned)\n * display store, for a phone-side preview of the glasses screen\n * (`engine.display.mirror`). The store holds the single frame currently on the\n * glasses (dashboard switching happens upstream in DashboardCoordinator); this\n * facade is the read side: `current()` (snapshot) + `onMirror(cb)` (subscribe).\n * The raw store is also exposed as `engine.displayStore` (the Glassly-app\n * escape hatch).\n */\nimport displayProcessor from \"../services/DisplayProcessor\"\nimport {getEffectiveCapabilities} from \"../services/effectiveCapabilities\"\nimport {useDisplayStore} from \"../stores/display\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {SETTINGS, useSettingsStore} from \"../stores/settings\"\nimport {DeviceTypes} from \"../types\"\n\nexport type DisplayMirrorEvent = Record<string, unknown> & {view?: string; layout?: any}\n\nexport interface DisplayMirrorCanvas {\n width: number\n height: number\n}\n\nexport const displayMirror = {\n /** The display event currently on the glasses (snapshot). */\n current(): DisplayMirrorEvent {\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n return {...useDisplayStore.getState().currentEvent}\n },\n\n /** Subscribe to changes of the mirrored display event; returns an unsubscribe. */\n onMirror(cb: (event: DisplayMirrorEvent) => void): () => void {\n return useDisplayStore.subscribe((s) => s.currentEvent, cb)\n },\n\n /**\n * Drawable canvas of the selected glasses, in device px — the space scene\n * frames and positioned layouts are laid out in (same source SceneRenderer\n * sends CONNECT_ACK from). Falls back to the text profile's line width.\n * `previewModel` previews a model that is not selected yet (pairing prep).\n */\n canvas(previewModel?: string): DisplayMirrorCanvas {\n const model =\n previewModel ??\n (useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key) as string | undefined) ??\n (useGlassesStore.getState().deviceModel as string | undefined)\n const display = getEffectiveCapabilities((model ?? DeviceTypes.NONE) as DeviceTypes)?.display\n const profile = displayProcessor.getProfile()\n return {\n width: display?.width ?? display?.resolution?.width ?? profile.displayWidthPx,\n height: display?.height ?? display?.resolution?.height ?? profile.displayHeightPx ?? profile.displayWidthPx / 2,\n }\n },\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { ButtonPressEvent, ConnectOptions, Device, TouchEvent } from "@glassly/bluetooth-sdk";
1
+ import type { ButtonPressEvent, ConnectOptions, Device, KeyboardAdvertEvent, KeyboardPairingEvent, TouchEvent } from "@glassly/bluetooth-sdk";
2
2
  declare function projectStatus(): {
3
3
  state: "connecting" | "connected" | "disconnected" | "scanning" | "bonding";
4
4
  fullyBooted: boolean;
@@ -22,6 +22,16 @@ declare function projectControllerStatus(): {
22
22
  battery: number;
23
23
  signal: number;
24
24
  };
25
+ declare function projectKeyboardStatus(): {
26
+ /** Connected glasses run a firmware that can host a keyboard (G2 Glassly CFW 39+). */
27
+ available: boolean;
28
+ connected: boolean;
29
+ name: string;
30
+ /** A keyboard is remembered and reconnects automatically. */
31
+ saved: boolean;
32
+ state: import("@glassly/bluetooth-sdk").KeyboardBridgeState;
33
+ error: string;
34
+ };
25
35
  declare function projectInfo(): {
26
36
  model: string;
27
37
  style: string;
@@ -50,6 +60,7 @@ declare function projectInfo(): {
50
60
  };
51
61
  export type GlassesStatusSnapshot = ReturnType<typeof projectStatus>;
52
62
  export type ControllerStatusSnapshot = ReturnType<typeof projectControllerStatus>;
63
+ export type KeyboardStatusSnapshot = ReturnType<typeof projectKeyboardStatus>;
53
64
  export type GlassesInfoSnapshot = ReturnType<typeof projectInfo>;
54
65
  export declare const glasses: {
55
66
  /**
@@ -100,6 +111,25 @@ export declare const glasses: {
100
111
  requestVersionInfo: () => Promise<import("@glassly/bluetooth-sdk").VersionInfoResult>;
101
112
  onButtonPress: (cb: (event: ButtonPressEvent) => void) => (() => void);
102
113
  onTouchGesture: (cb: (event: TouchEvent) => void) => (() => void);
114
+ keyboard: {
115
+ /** Five-second scan; distinct advertisers, HID ones flagged. Also streams via onAdvert. */
116
+ scan: () => Promise<KeyboardAdvertEvent[]>;
117
+ /** Connect, pair and subscribe; the keyboard is remembered and auto-reconnected. */
118
+ connect: (device: {
119
+ address: string;
120
+ addressType: number;
121
+ name: string;
122
+ }) => Promise<void>;
123
+ reconnect: () => Promise<void>;
124
+ disconnect: () => Promise<void>;
125
+ forget: () => Promise<void>;
126
+ passkey: (pin: number) => Promise<void>;
127
+ compare: (accept: boolean) => Promise<void>;
128
+ status: () => KeyboardStatusSnapshot;
129
+ onStatus: (cb: (status: KeyboardStatusSnapshot) => void) => (() => void);
130
+ onAdvert: (cb: (advert: KeyboardAdvertEvent) => void) => (() => void);
131
+ onPairing: (cb: (prompt: KeyboardPairingEvent) => void) => (() => void);
132
+ };
103
133
  controller: {
104
134
  connectDefault: () => Promise<void>;
105
135
  disconnect: () => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAC,MAAM,wBAAwB,CAAA;AAYhG,iBAAS,aAAa;;;;;;;;;;;;;;;;EAerB;AAED,iBAAS,uBAAuB;;;;;EAQ/B;AAED,iBAAS,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;EAuBnB;AAED,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;AACpE,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACjF,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA;AAEhE,eAAO,MAAM,OAAO;IAElB;;;;OAIG;0BACuB,OAAO,CAAC,IAAI,CAAC;sBASvB,OAAO,CAAC,IAAI,CAAC;kBACjB,OAAO,CAAC,IAAI,CAAC;IACzB,iD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,IAAI,CAAC;;QAO7D,2FAA2F;oBACjF,OAAO,CAAC,mBAAmB,EAAE,CAAC;QACxC,oFAAoF;0BAC5D;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,KAAG,OAAO,CAAC,IAAI,CAAC;yBAI7E,OAAO,CAAC,IAAI,CAAC;0BACZ,OAAO,CAAC,IAAI,CAAC;sBACX,OAAO,CAAC,IAAI,CAAC;uBAIhB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;0BACnB,OAAO,KAAG,OAAO,CAAC,IAAI,CAAC;sBAC7B,sBAAsB;uBACnB,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;uBAUvD,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;wBAInD,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;;;8BAQjD,OAAO,CAAC,IAAI,CAAC;0BACjB,OAAO,CAAC,IAAI,CAAC;sBACjB,OAAO,CAAC,IAAI,CAAC;sBACb,wBAAwB;uBACrB,CAAC,MAAM,EAAE,wBAAwB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;;;QAcxE,8CAA8C;;QAE9C,qCAAqC;gCACb,MAAM;QAC9B,6EAA6E;oCACjD,OAAO,KAAG,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;CAMtD,CAAA"}
@@ -46,6 +46,19 @@ function projectControllerStatus() {
46
46
  signal: s.controllerSignalStrength,
47
47
  };
48
48
  }
49
+ function projectKeyboardStatus() {
50
+ const s = useGlassesStore.getState();
51
+ return {
52
+ /** Connected glasses run a firmware that can host a keyboard (G2 Glassly CFW 39+). */
53
+ available: s.keyboardBridge === true,
54
+ connected: s.keyboardConnected === true,
55
+ name: s.keyboardName ?? "",
56
+ /** A keyboard is remembered and reconnects automatically. */
57
+ saved: s.keyboardSaved === true,
58
+ state: s.keyboardState ?? "idle",
59
+ error: s.keyboardError ?? "",
60
+ };
61
+ }
49
62
  function projectInfo() {
50
63
  const s = useGlassesStore.getState();
51
64
  return {
@@ -184,6 +197,44 @@ export const glasses = {
184
197
  const sub = BluetoothSdk.addListener("touch_event", cb);
185
198
  return () => sub.remove();
186
199
  },
200
+ // --- BLE keyboard bridged through G2 Glassly CFW (revision 39+) ---
201
+ keyboard: {
202
+ /** Five-second scan; distinct advertisers, HID ones flagged. Also streams via onAdvert. */
203
+ scan: () => BluetoothSdk.g2KeyboardScan(),
204
+ /** Connect, pair and subscribe; the keyboard is remembered and auto-reconnected. */
205
+ connect: async (device) => {
206
+ await BluetoothSdk.g2KeyboardConnect(device.address, device.addressType, device.name);
207
+ useSettingsStore.getState().setSetting(SETTINGS.keyboard_name.key, device.name);
208
+ },
209
+ reconnect: () => BluetoothSdk.g2KeyboardReconnect(),
210
+ disconnect: () => BluetoothSdk.g2KeyboardDisconnect(),
211
+ forget: async () => {
212
+ await BluetoothSdk.g2KeyboardForget();
213
+ useSettingsStore.getState().setSetting(SETTINGS.keyboard_name.key, "");
214
+ },
215
+ passkey: (pin) => BluetoothSdk.g2KeyboardPasskey(pin),
216
+ compare: (accept) => BluetoothSdk.g2KeyboardCompare(accept),
217
+ status: () => projectKeyboardStatus(),
218
+ onStatus: (cb) => {
219
+ let last = JSON.stringify(projectKeyboardStatus());
220
+ return useGlassesStore.subscribe(() => {
221
+ const snap = projectKeyboardStatus();
222
+ const key = JSON.stringify(snap);
223
+ if (key === last)
224
+ return;
225
+ last = key;
226
+ cb(snap);
227
+ });
228
+ },
229
+ onAdvert: (cb) => {
230
+ const sub = BluetoothSdk.addListener("keyboard_advert", cb);
231
+ return () => sub.remove();
232
+ },
233
+ onPairing: (cb) => {
234
+ const sub = BluetoothSdk.addListener("keyboard_pairing", cb);
235
+ return () => sub.remove();
236
+ },
237
+ },
187
238
  // --- ring controller (optional input device) ---
188
239
  controller: {
189
240
  connectDefault: () => BluetoothSdk.connectDefaultController(),
@@ -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,iCAAiC,CAAA;AAE1D,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,EAAC,OAAO,EAAE,CAAC,CAAC,gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,WAAW,EA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QACjE,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 \"@glassly/bluetooth-sdk/internal\"\nimport type {ButtonPressEvent, ConnectOptions, Device, TouchEvent} from \"@glassly/bluetooth-sdk\"\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 // iOS: glasses may read the phone's ANCS stream (\"Share System Notifications\").\n ancsAuthorized: Boolean(s.ancsAuthorized),\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 sceneCanvasWidth: s.sceneCanvasWidth,\n sceneCanvasHeight: s.sceneCanvasHeight,\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 (device: Device, options?: ConnectOptions): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connect(device, options)\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: (device: Device | null): Promise<void> => BluetoothSdk.setDefaultDevice(device),\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"]}
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,iCAAiC,CAAA;AAS1D,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,c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AqB,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 \"@glassly/bluetooth-sdk/internal\"\nimport type {\n ButtonPressEvent,\n ConnectOptions,\n Device,\n KeyboardAdvertEvent,\n KeyboardPairingEvent,\n TouchEvent,\n} from \"@glassly/bluetooth-sdk\"\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 // iOS: glasses may read the phone's ANCS stream (\"Share System Notifications\").\n ancsAuthorized: Boolean(s.ancsAuthorized),\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 projectKeyboardStatus() {\n const s = useGlassesStore.getState()\n return {\n /** Connected glasses run a firmware that can host a keyboard (G2 Glassly CFW 39+). */\n available: s.keyboardBridge === true,\n connected: s.keyboardConnected === true,\n name: s.keyboardName ?? \"\",\n /** A keyboard is remembered and reconnects automatically. */\n saved: s.keyboardSaved === true,\n state: s.keyboardState ?? \"idle\",\n error: s.keyboardError ?? \"\",\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 sceneCanvasWidth: s.sceneCanvasWidth,\n sceneCanvasHeight: s.sceneCanvasHeight,\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 KeyboardStatusSnapshot = ReturnType<typeof projectKeyboardStatus>\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 (device: Device, options?: ConnectOptions): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connect(device, options)\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: (device: Device | null): Promise<void> => BluetoothSdk.setDefaultDevice(device),\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 // --- BLE keyboard bridged through G2 Glassly CFW (revision 39+) ---\n keyboard: {\n /** Five-second scan; distinct advertisers, HID ones flagged. Also streams via onAdvert. */\n scan: (): Promise<KeyboardAdvertEvent[]> => BluetoothSdk.g2KeyboardScan(),\n /** Connect, pair and subscribe; the keyboard is remembered and auto-reconnected. */\n connect: async (device: {address: string; addressType: number; name: string}): Promise<void> => {\n await BluetoothSdk.g2KeyboardConnect(device.address, device.addressType, device.name)\n useSettingsStore.getState().setSetting(SETTINGS.keyboard_name.key, device.name)\n },\n reconnect: (): Promise<void> => BluetoothSdk.g2KeyboardReconnect(),\n disconnect: (): Promise<void> => BluetoothSdk.g2KeyboardDisconnect(),\n forget: async (): Promise<void> => {\n await BluetoothSdk.g2KeyboardForget()\n useSettingsStore.getState().setSetting(SETTINGS.keyboard_name.key, \"\")\n },\n passkey: (pin: number): Promise<void> => BluetoothSdk.g2KeyboardPasskey(pin),\n compare: (accept: boolean): Promise<void> => BluetoothSdk.g2KeyboardCompare(accept),\n status: (): KeyboardStatusSnapshot => projectKeyboardStatus(),\n onStatus: (cb: (status: KeyboardStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectKeyboardStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectKeyboardStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n onAdvert: (cb: (advert: KeyboardAdvertEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"keyboard_advert\", cb)\n return () => sub.remove()\n },\n onPairing: (cb: (prompt: KeyboardPairingEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"keyboard_pairing\", cb)\n return () => sub.remove()\n },\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"]}
@@ -28,11 +28,5 @@ export declare const memory: {
28
28
  clearAll: () => Promise<void>;
29
29
  /** Subscribe to store mutations (from miniapps or Settings). */
30
30
  onChanged: (listener: () => void) => (() => void);
31
- /** Whether the extended (Plus/Pro) retention window is active. */
32
- retentionExtended: () => boolean;
33
- /** Retention window in days for the given (or current) tier, for UI copy. */
34
- retentionDays: (extended?: boolean) => number;
35
- /** Flip retention on subscription change. Host app (RevenueCat sync) only. */
36
- setRetentionExtended: (extended: boolean) => void;
37
31
  };
38
32
  //# sourceMappingURL=memory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/facades/memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAA;AAEhE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAA;AAIxD,eAAO,MAAM,MAAM;IACjB,sCAAsC;iBAC3B,OAAO,CAAC,WAAW,EAAE,CAAC;IACjC;;;OAGG;oBACa,MAAM,OAAO,MAAM,KAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAEjE,sEAAsE;qBACrD,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;IACxD,6CAA6C;sBAC3B,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;IAC3C,mFAAmF;oBACrE,OAAO,CAAC,aAAa,EAAE,CAAC;IACtC,4EAA4E;yBACvD,SAAS,GAAG,KAAK,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;IAClE,yEAAyE;iBAC9D,OAAO,CAAC,WAAW,CAAC;IAC/B,+DAA+D;oBACjD,OAAO,CAAC,IAAI,CAAC;IAC3B,gEAAgE;0BAC1C,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAC/C,kEAAkE;6BAC3C,OAAO;IAC9B,6EAA6E;+BAClD,OAAO,KAAG,MAAM;IAK3C,8EAA8E;qCAC7C,OAAO,KAAG,IAAI;CAChD,CAAA"}
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/facades/memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAC,WAAW,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAA;AAEhE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAA;AAGxD,eAAO,MAAM,MAAM;IACjB,sCAAsC;iBAC3B,OAAO,CAAC,WAAW,EAAE,CAAC;IACjC;;;OAGG;oBACa,MAAM,OAAO,MAAM,KAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAEjE,sEAAsE;qBACrD,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;IACxD,6CAA6C;sBAC3B,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;IAC3C,mFAAmF;oBACrE,OAAO,CAAC,aAAa,EAAE,CAAC;IACtC,4EAA4E;yBACvD,SAAS,GAAG,KAAK,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;IAClE,yEAAyE;iBAC9D,OAAO,CAAC,WAAW,CAAC;IAC/B,+DAA+D;oBACjD,OAAO,CAAC,IAAI,CAAC;IAC3B,gEAAgE;0BAC1C,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;CAChD,CAAA"}
@@ -1,5 +1,4 @@
1
- import { EXTENDED_RETENTION, STANDARD_RETENTION } from "../services/MemoryStore";
2
- import { isMemoryRetentionExtended, memoryStore, setMemoryRetentionExtended } from "../services/memoryStoreInstance";
1
+ import { memoryStore } from "../services/memoryStoreInstance";
3
2
  export const memory = {
4
3
  /** All note entries, newest first. */
5
4
  notes: () => memoryStore.notes(),
@@ -22,12 +21,5 @@ export const memory = {
22
21
  clearAll: () => memoryStore.clear(),
23
22
  /** Subscribe to store mutations (from miniapps or Settings). */
24
23
  onChanged: (listener) => memoryStore.onChanged(listener),
25
- /** Whether the extended (Plus/Pro) retention window is active. */
26
- retentionExtended: () => isMemoryRetentionExtended(),
27
- /** Retention window in days for the given (or current) tier, for UI copy. */
28
- retentionDays: (extended) => Math.round(((extended ?? isMemoryRetentionExtended()) ? EXTENDED_RETENTION : STANDARD_RETENTION).maxAgeMs /
29
- (24 * 60 * 60 * 1000)),
30
- /** Flip retention on subscription change. Host app (RevenueCat sync) only. */
31
- setRetentionExtended: (extended) => setMemoryRetentionExtended(extended),
32
24
  };
33
25
  //# sourceMappingURL=memory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/facades/memory.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,yBAAyB,CAAA;AAC9E,OAAO,EAAC,yBAAyB,EAAE,WAAW,EAAE,0BAA0B,EAAC,MAAM,iCAAiC,CAAA;AAElH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,sCAAsC;IACtC,KAAK,EAAE,GAA2B,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;IACxD;;;OAGG;IACH,OAAO,EAAE,CAAC,IAAY,EAAE,EAAW,EAA+B,EAAE,CAClE,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACnD,sEAAsE;IACtE,UAAU,EAAE,CAAC,EAAU,EAAE,IAAY,EAAoB,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC;IAC5F,6CAA6C;IAC7C,WAAW,EAAE,CAAC,EAAU,EAAoB,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;IAC1E,mFAAmF;IACnF,QAAQ,EAAE,GAA6B,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE;IACnE,4EAA4E;IAC5E,WAAW,EAAE,CAAC,KAAwB,EAAE,EAAU,EAAiB,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC;IACxG,yEAAyE;IACzE,KAAK,EAAE,GAAyB,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;IACtD,+DAA+D;IAC/D,QAAQ,EAAE,GAAkB,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;IAClD,gEAAgE;IAChE,SAAS,EAAE,CAAC,QAAoB,EAAgB,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC;IAClF,kEAAkE;IAClE,iBAAiB,EAAE,GAAY,EAAE,CAAC,yBAAyB,EAAE;IAC7D,6EAA6E;IAC7E,aAAa,EAAE,CAAC,QAAkB,EAAU,EAAE,CAC5C,IAAI,CAAC,KAAK,CACR,CAAC,CAAC,QAAQ,IAAI,yBAAyB,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,QAAQ;QAC5F,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CACxB;IACH,8EAA8E;IAC9E,oBAAoB,EAAE,CAAC,QAAiB,EAAQ,EAAE,CAAC,0BAA0B,CAAC,QAAQ,CAAC;CACxF,CAAA","sourcesContent":["/**\n * memory facade — `engine.memory`: the user's shared phone-local memory\n * timeline (Settings > Memory). Host UI manages the note entries and can\n * purge everything; the full timeline surface (lines, sessions, summaries)\n * is what miniapps reach through session.memory with the MEMORY permission.\n */\nimport type {MemoryEntry, MemorySession} from \"@glassly/miniapp\"\n\nimport type {MemoryStats} from \"../services/MemoryStore\"\nimport {EXTENDED_RETENTION, STANDARD_RETENTION} from \"../services/MemoryStore\"\nimport {isMemoryRetentionExtended, memoryStore, setMemoryRetentionExtended} from \"../services/memoryStoreInstance\"\n\nexport const memory = {\n /** All note entries, newest first. */\n notes: (): Promise<MemoryEntry[]> => memoryStore.notes(),\n /**\n * Add a manual note (\"ui\" source). Pass `at` inside a past hour to append\n * to that session. Resolves null on duplicate/empty.\n */\n addNote: (text: string, at?: number): Promise<MemoryEntry | null> =>\n memoryStore.addNote(text, \"ui\", at ?? Date.now()),\n /** Rewrite a note's text. Resolves false when the id isn't a note. */\n updateNote: (id: string, text: string): Promise<boolean> => memoryStore.updateNote(id, text),\n /** Delete one entry (note or line) by id. */\n removeEntry: (id: string): Promise<boolean> => memoryStore.removeEntry(id),\n /** All sessions (hours with entries + summary), newest first (history browser). */\n sessions: (): Promise<MemorySession[]> => memoryStore.sessionList(),\n /** Delete every entry (and summary) in an hour, or a whole day of hours. */\n removeScope: (scope: \"session\" | \"day\", at: number): Promise<void> => memoryStore.removeScope(scope, at),\n /** Counts for the Settings screen (entries, lines, notes, summaries). */\n stats: (): Promise<MemoryStats> => memoryStore.stats(),\n /** Drop the entire timeline: every entry and every summary. */\n clearAll: (): Promise<void> => memoryStore.clear(),\n /** Subscribe to store mutations (from miniapps or Settings). */\n onChanged: (listener: () => void): (() => void) => memoryStore.onChanged(listener),\n /** Whether the extended (Plus/Pro) retention window is active. */\n retentionExtended: (): boolean => isMemoryRetentionExtended(),\n /** Retention window in days for the given (or current) tier, for UI copy. */\n retentionDays: (extended?: boolean): number =>\n Math.round(\n ((extended ?? isMemoryRetentionExtended()) ? EXTENDED_RETENTION : STANDARD_RETENTION).maxAgeMs /\n (24 * 60 * 60 * 1000),\n ),\n /** Flip retention on subscription change. Host app (RevenueCat sync) only. */\n setRetentionExtended: (extended: boolean): void => setMemoryRetentionExtended(extended),\n}\n"]}
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/facades/memory.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,WAAW,EAAC,MAAM,iCAAiC,CAAA;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,sCAAsC;IACtC,KAAK,EAAE,GAA2B,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;IACxD;;;OAGG;IACH,OAAO,EAAE,CAAC,IAAY,EAAE,EAAW,EAA+B,EAAE,CAClE,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACnD,sEAAsE;IACtE,UAAU,EAAE,CAAC,EAAU,EAAE,IAAY,EAAoB,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC;IAC5F,6CAA6C;IAC7C,WAAW,EAAE,CAAC,EAAU,EAAoB,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;IAC1E,mFAAmF;IACnF,QAAQ,EAAE,GAA6B,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE;IACnE,4EAA4E;IAC5E,WAAW,EAAE,CAAC,KAAwB,EAAE,EAAU,EAAiB,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC;IACxG,yEAAyE;IACzE,KAAK,EAAE,GAAyB,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;IACtD,+DAA+D;IAC/D,QAAQ,EAAE,GAAkB,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;IAClD,gEAAgE;IAChE,SAAS,EAAE,CAAC,QAAoB,EAAgB,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC;CACnF,CAAA","sourcesContent":["/**\n * memory facade — `engine.memory`: the user's shared phone-local memory\n * timeline (Settings > Memory). Host UI manages the note entries and can\n * purge everything; the full timeline surface (lines, sessions, summaries)\n * is what miniapps reach through session.memory with the MEMORY permission.\n */\nimport type {MemoryEntry, MemorySession} from \"@glassly/miniapp\"\n\nimport type {MemoryStats} from \"../services/MemoryStore\"\nimport {memoryStore} from \"../services/memoryStoreInstance\"\n\nexport const memory = {\n /** All note entries, newest first. */\n notes: (): Promise<MemoryEntry[]> => memoryStore.notes(),\n /**\n * Add a manual note (\"ui\" source). Pass `at` inside a past hour to append\n * to that session. Resolves null on duplicate/empty.\n */\n addNote: (text: string, at?: number): Promise<MemoryEntry | null> =>\n memoryStore.addNote(text, \"ui\", at ?? Date.now()),\n /** Rewrite a note's text. Resolves false when the id isn't a note. */\n updateNote: (id: string, text: string): Promise<boolean> => memoryStore.updateNote(id, text),\n /** Delete one entry (note or line) by id. */\n removeEntry: (id: string): Promise<boolean> => memoryStore.removeEntry(id),\n /** All sessions (hours with entries + summary), newest first (history browser). */\n sessions: (): Promise<MemorySession[]> => memoryStore.sessionList(),\n /** Delete every entry (and summary) in an hour, or a whole day of hours. */\n removeScope: (scope: \"session\" | \"day\", at: number): Promise<void> => memoryStore.removeScope(scope, at),\n /** Counts for the Settings screen (entries, lines, notes, summaries). */\n stats: (): Promise<MemoryStats> => memoryStore.stats(),\n /** Drop the entire timeline: every entry and every summary. */\n clearAll: (): Promise<void> => memoryStore.clear(),\n /** Subscribe to store mutations (from miniapps or Settings). */\n onChanged: (listener: () => void): (() => void) => memoryStore.onChanged(listener),\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * The miniapp WebView is a HOST component (engine ships the bridge, not the view) —
7
7
  * the bridge primitives (`buildMiniappGlobalsScript`, `buildUiShim`, the
8
- * GlasslyJS router) are exported from `@glassly/engine` directly; the host mounts a
8
+ * JSRuntime router) are exported from `@glassly/engine` directly; the host mounts a
9
9
  * `<WebView>` wired to them. This facade is the lifecycle half.
10
10
  */
11
11
  import { useAppStatusStore } from "../stores/apps";
@@ -42,6 +42,8 @@ export declare const miniapps: {
42
42
  saveScreenshot: (packageName: string, screenshot: string) => Promise<void>;
43
43
  /** Hide/show a miniapp on the home surfaces. */
44
44
  setHiddenStatus: (packageName: string, status: boolean) => void;
45
+ /** Mark a miniapp persistent (starts at launch, stops only from the switcher pill), persisted for the next boot. */
46
+ setPersistent: (packageName: string, status: boolean) => Promise<void>;
45
47
  };
46
48
  export {};
47
49
  //# sourceMappingURL=miniapps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"miniapps.d.ts","sourceRoot":"","sources":["../../src/facades/miniapps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,UAAU,CAAA;AAEvC,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAE9D,eAAO,MAAM,QAAQ;IACnB,yCAAyC;gBAE/B,SAAS,EAAE;IACrB,8FAA8F;oBAC9E,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAW1D,0EAA0E;kCAC9C,MAAM,EAAE;IACpC,qEAAqE;0CAC/B,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAGrF,wDAAwD;;IAExD,oCAAoC;;IAEpC,sBAAsB;;IAEtB,iDAAiD;;IAGjD,4CAA4C;;IAE5C,iCAAiC;;IAEjC,2CAA2C;;;;IAE3C,2BAA2B;;IAE3B,2EAA2E;;IAG3E,gDAAgD;;CAGjD,CAAA"}
1
+ {"version":3,"file":"miniapps.d.ts","sourceRoot":"","sources":["../../src/facades/miniapps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAEhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,UAAU,CAAA;AAEvC,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAE9D,eAAO,MAAM,QAAQ;IACnB,yCAAyC;gBAE/B,SAAS,EAAE;IACrB,8FAA8F;oBAC9E,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAW1D,0EAA0E;kCAC9C,MAAM,EAAE;IACpC,qEAAqE;0CAC/B,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAGrF,wDAAwD;;IAExD,oCAAoC;;IAEpC,sBAAsB;;IAEtB,iDAAiD;;IAGjD,4CAA4C;;IAE5C,iCAAiC;;IAEjC,2CAA2C;;;;IAE3C,2BAA2B;;IAE3B,2EAA2E;;IAG3E,gDAAgD;;IAGhD,oHAAoH;;CAGrH,CAAA"}
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * The miniapp WebView is a HOST component (engine ships the bridge, not the view) —
7
7
  * the bridge primitives (`buildMiniappGlobalsScript`, `buildUiShim`, the
8
- * GlasslyJS router) are exported from `@glassly/engine` directly; the host mounts a
8
+ * JSRuntime router) are exported from `@glassly/engine` directly; the host mounts a
9
9
  * `<WebView>` wired to them. This facade is the lifecycle half.
10
10
  */
11
11
  import { useAppStatusStore } from "../stores/apps";
@@ -50,5 +50,7 @@ export const miniapps = {
50
50
  saveScreenshot: (...args) => useAppStatusStore.getState().saveScreenshot(...args),
51
51
  /** Hide/show a miniapp on the home surfaces. */
52
52
  setHiddenStatus: (...args) => useAppStatusStore.getState().setHiddenStatus(...args),
53
+ /** Mark a miniapp persistent (starts at launch, stops only from the switcher pill), persisted for the next boot. */
54
+ setPersistent: (...args) => useAppStatusStore.getState().setPersistent(...args),
53
55
  };
54
56
  //# sourceMappingURL=miniapps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"miniapps.js","sourceRoot":"","sources":["../../src/facades/miniapps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAChD,OAAO,mBAAmB,MAAM,iCAAiC,CAAA;AAKjE,MAAM,CAAC,MAAM,QAAQ,GA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EAAE,EAAE,CACjE,iBAAiB,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IACrD,4CAA4C;IAC5C,eAAe,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,eAAe,EAAE;IACrE,iCAAiC;IACjC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE;IACrD,2CAA2C;IAC3C,OAAO,EAAE,CAAC,GAAG,IAAsC,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IACrG,2BAA2B;IAC3B,SAAS,EAAE,CAAC,GAAG,IAAwC,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC3G,2EAA2E;IAC3E,cAAc,EAAE,CAAC,GAAG,IAA6C,EAAE,EAAE,CACnE,iBAAiB,CAAC,QAAQ,EAAE,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IACtD,gDAAgD;IAChD,eAAe,EAAE,CAAC,GAAG,IAA8C,EAAE,EAAE,CACrE,iBAAiB,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;CACxD,CAAA","sourcesContent":["/**\n * miniapps facade — `engine.miniapps`: miniapp lifecycle over the engine-owned\n * apps store. Thin forwarding (args via Parameters<>), so the facade never drifts\n * from the store's actions.\n *\n * The miniapp WebView is a HOST component (engine ships the bridge, not the view) —\n * the bridge primitives (`buildMiniappGlobalsScript`, `buildUiShim`, the\n * GlasslyJS router) are exported from `@glassly/engine` directly; the host mounts a\n * `<WebView>` wired to them. This facade is the lifecycle half.\n */\nimport {useAppStatusStore} from \"../stores/apps\"\nimport localMiniappRuntime from \"../services/LocalMiniappRuntime\"\nimport type {ClientApp} from \"../types\"\n\ntype AppsState = ReturnType<typeof useAppStatusStore.getState>\n\nexport const miniapps = {\n /** All installed miniapps (snapshot). */\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n list: (): ClientApp[] => [...useAppStatusStore.getState().apps],\n /** Subscribe to the installed-app set; fires only when it changes. Returns an unsubscribe. */\n onChanged: (cb: (apps: ClientApp[]) => void): (() => void) => {\n let last = JSON.stringify(useAppStatusStore.getState().apps)\n return useAppStatusStore.subscribe(() => {\n const apps = useAppStatusStore.getState().apps\n const key = JSON.stringify(apps)\n if (key === last) return\n last = key\n cb(apps)\n })\n },\n\n /** Miniapps actively subscribed to Mentra Live hardware-button events. */\n buttonPressSubscribers: (): string[] => localMiniappRuntime.getButtonPressSubscribers(),\n /** Observe the active Mentra Live hardware-button subscriber set. */\n onButtonPressSubscribersChanged: (cb: (packageNames: string[]) => void): (() => void) =>\n localMiniappRuntime.onButtonPressSubscribersChanged(cb),\n\n /** Re-fetch the installed-app list from the backend. */\n refresh: () => useAppStatusStore.getState().refresh(),\n /** Start (foreground) a miniapp. */\n start: (...args: Parameters<AppsState[\"start\"]>) => useAppStatusStore.getState().start(...args),\n /** Stop a miniapp. */\n stop: (...args: Parameters<AppsState[\"stop\"]>) => useAppStatusStore.getState().stop(...args),\n /** Bring a running miniapp to the foreground. */\n setForeground: (...args: Parameters<AppsState[\"setForeground\"]>) =>\n useAppStatusStore.getState().setForeground(...args),\n /** Clear the current foreground miniapp. */\n clearForeground: () => useAppStatusStore.getState().clearForeground(),\n /** Stop all running miniapps. */\n stopAll: () => useAppStatusStore.getState().stopAll(),\n /** Install a miniapp from a bundle URL. */\n install: (...args: Parameters<AppsState[\"install\"]>) => useAppStatusStore.getState().install(...args),\n /** Uninstall a miniapp. */\n uninstall: (...args: Parameters<AppsState[\"uninstall\"]>) => useAppStatusStore.getState().uninstall(...args),\n /** Persist a miniapp's captured screenshot (the switcher/card preview). */\n saveScreenshot: (...args: Parameters<AppsState[\"saveScreenshot\"]>) =>\n useAppStatusStore.getState().saveScreenshot(...args),\n /** Hide/show a miniapp on the home surfaces. */\n setHiddenStatus: (...args: Parameters<AppsState[\"setHiddenStatus\"]>) =>\n useAppStatusStore.getState().setHiddenStatus(...args),\n}\n"]}
1
+ {"version":3,"file":"miniapps.js","sourceRoot":"","sources":["../../src/facades/miniapps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAChD,OAAO,mBAAmB,MAAM,iCAAiC,CAAA;AAKjE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,yCAAyC;IACzC,+EAA+E;IAC/E,IAAI,EAAE,GAAgB,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;IAC/D,8FAA8F;IAC9F,SAAS,EAAE,CAAC,EAA+B,EAAgB,EAAE;QAC3D,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAA;QAC5D,OAAO,iBAAiB,CAAC,SAAS,CAAC,GAAG,EAAE;YACtC,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAA;YAC9C,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,CAAC,CAAA;IACJ,CAAC;IAED,0EAA0E;IAC1E,sBAAsB,EAAE,GAAa,EAAE,CAAC,mBAAmB,CAAC,yBAAyB,EAAE;IACvF,qEAAqE;IACrE,+BAA+B,EAAE,CAAC,EAAoC,EAAgB,EAAE,CACtF,mBAAmB,CAAC,+BAA+B,CAAC,EAAE,CAAC;IAEzD,wDAAwD;IACxD,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE;IACr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AC,aAAa,CAAC,GAAG,IAAI,CAAC;CACtD,CAAA","sourcesContent":["/**\n * miniapps facade — `engine.miniapps`: miniapp lifecycle over the engine-owned\n * apps store. Thin forwarding (args via Parameters<>), so the facade never drifts\n * from the store's actions.\n *\n * The miniapp WebView is a HOST component (engine ships the bridge, not the view) —\n * the bridge primitives (`buildMiniappGlobalsScript`, `buildUiShim`, the\n * JSRuntime router) are exported from `@glassly/engine` directly; the host mounts a\n * `<WebView>` wired to them. This facade is the lifecycle half.\n */\nimport {useAppStatusStore} from \"../stores/apps\"\nimport localMiniappRuntime from \"../services/LocalMiniappRuntime\"\nimport type {ClientApp} from \"../types\"\n\ntype AppsState = ReturnType<typeof useAppStatusStore.getState>\n\nexport const miniapps = {\n /** All installed miniapps (snapshot). */\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n list: (): ClientApp[] => [...useAppStatusStore.getState().apps],\n /** Subscribe to the installed-app set; fires only when it changes. Returns an unsubscribe. */\n onChanged: (cb: (apps: ClientApp[]) => void): (() => void) => {\n let last = JSON.stringify(useAppStatusStore.getState().apps)\n return useAppStatusStore.subscribe(() => {\n const apps = useAppStatusStore.getState().apps\n const key = JSON.stringify(apps)\n if (key === last) return\n last = key\n cb(apps)\n })\n },\n\n /** Miniapps actively subscribed to Mentra Live hardware-button events. */\n buttonPressSubscribers: (): string[] => localMiniappRuntime.getButtonPressSubscribers(),\n /** Observe the active Mentra Live hardware-button subscriber set. */\n onButtonPressSubscribersChanged: (cb: (packageNames: string[]) => void): (() => void) =>\n localMiniappRuntime.onButtonPressSubscribersChanged(cb),\n\n /** Re-fetch the installed-app list from the backend. */\n refresh: () => useAppStatusStore.getState().refresh(),\n /** Start (foreground) a miniapp. */\n start: (...args: Parameters<AppsState[\"start\"]>) => useAppStatusStore.getState().start(...args),\n /** Stop a miniapp. */\n stop: (...args: Parameters<AppsState[\"stop\"]>) => useAppStatusStore.getState().stop(...args),\n /** Bring a running miniapp to the foreground. */\n setForeground: (...args: Parameters<AppsState[\"setForeground\"]>) =>\n useAppStatusStore.getState().setForeground(...args),\n /** Clear the current foreground miniapp. */\n clearForeground: () => useAppStatusStore.getState().clearForeground(),\n /** Stop all running miniapps. */\n stopAll: () => useAppStatusStore.getState().stopAll(),\n /** Install a miniapp from a bundle URL. */\n install: (...args: Parameters<AppsState[\"install\"]>) => useAppStatusStore.getState().install(...args),\n /** Uninstall a miniapp. */\n uninstall: (...args: Parameters<AppsState[\"uninstall\"]>) => useAppStatusStore.getState().uninstall(...args),\n /** Persist a miniapp's captured screenshot (the switcher/card preview). */\n saveScreenshot: (...args: Parameters<AppsState[\"saveScreenshot\"]>) =>\n useAppStatusStore.getState().saveScreenshot(...args),\n /** Hide/show a miniapp on the home surfaces. */\n setHiddenStatus: (...args: Parameters<AppsState[\"setHiddenStatus\"]>) =>\n useAppStatusStore.getState().setHiddenStatus(...args),\n /** Mark a miniapp persistent (starts at launch, stops only from the switcher pill), persisted for the next boot. */\n setPersistent: (...args: Parameters<AppsState[\"setPersistent\"]>) =>\n useAppStatusStore.getState().setPersistent(...args),\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"pairing.d.ts","sourceRoot":"","sources":["../../src/facades/pairing.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAKvH,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAGL,KAAK,+BAA+B,EACrC,MAAM,mCAAmC,CAAA;AAK1C,YAAY,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAEjE,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EA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oothSettings } from "../services/GlassesSettingsSync";
21
21
  import { ControllerTypes } from "../types";
22
22
  import { submitAutomaticReport } from "./reports";
23
+ import { BgTimer } from "../utils/timers";
23
24
  const DEFAULT_PAIRING_BOOT_TIMEOUT_MS = 35_000;
24
25
  const DEFAULT_BT_CLASSIC_TIMEOUT_MS = 1_000;
25
26
  const DEFAULT_PAIRING_ROUTE = "/pairing/loading";
@@ -89,7 +90,7 @@ async function waitForTargetReady(options, timeoutMs) {
89
90
  return;
90
91
  settled = true;
91
92
  if (timeout)
92
- clearTimeout(timeout);
93
+ BgTimer.clearTimeout(timeout);
93
94
  if (unsubscribe)
94
95
  unsubscribe();
95
96
  if (onAbort && options.signal)
@@ -104,7 +105,7 @@ async function waitForTargetReady(options, timeoutMs) {
104
105
  onAbort = () => finish(false);
105
106
  options.signal.addEventListener("abort", onAbort);
106
107
  }
107
- timeout = setTimeout(() => finish(projectTargetReady(options)), timeoutMs);
108
+ timeout = BgTimer.setTimeout(() => finish(projectTargetReady(options)), timeoutMs);
108
109
  });
109
110
  }
110
111
  export async function submitPairingBootTimeoutReport(params) {
@@ -179,7 +180,7 @@ async function waitForBluetoothClassic(options = {}) {
179
180
  return;
180
181
  settled = true;
181
182
  if (timeout)
182
- clearTimeout(timeout);
183
+ BgTimer.clearTimeout(timeout);
183
184
  if (unsubscribe)
184
185
  unsubscribe();
185
186
  if (onAbort && options.signal)
@@ -194,7 +195,7 @@ async function waitForBluetoothClassic(options = {}) {
194
195
  if (connected)
195
196
  finish(true);
196
197
  });
197
- timeout = setTimeout(() => {
198
+ timeout = BgTimer.setTimeout(() => {
198
199
  finish(useGlassesStore.getState().bluetoothClassicConnected);
199
200
  }, timeoutMs);
200
201
  });