@glassly/engine 0.4.0 → 0.4.1-beta.1138

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 (230) hide show
  1. package/build/engine.d.ts +3 -1
  2. package/build/engine.d.ts.map +1 -1
  3. package/build/engine.js +6 -4
  4. package/build/engine.js.map +1 -1
  5. package/build/facades/display.d.ts +1 -1
  6. package/build/facades/display.d.ts.map +1 -1
  7. package/build/facades/display.js +1 -1
  8. package/build/facades/display.js.map +1 -1
  9. package/build/facades/glasses.js +1 -1
  10. package/build/facades/glasses.js.map +1 -1
  11. package/build/facades/permissions.d.ts.map +1 -1
  12. package/build/facades/permissions.js +0 -2
  13. package/build/facades/permissions.js.map +1 -1
  14. package/build/facades/phoneNotifications.d.ts +7 -0
  15. package/build/facades/phoneNotifications.d.ts.map +1 -1
  16. package/build/facades/phoneNotifications.js +6 -0
  17. package/build/facades/phoneNotifications.js.map +1 -1
  18. package/build/facades/providerKeys.d.ts +1 -1
  19. package/build/facades/providerKeys.js +1 -1
  20. package/build/facades/providerKeys.js.map +1 -1
  21. package/build/facades/reports.d.ts +15 -0
  22. package/build/facades/reports.d.ts.map +1 -1
  23. package/build/facades/reports.js +37 -0
  24. package/build/facades/reports.js.map +1 -1
  25. package/build/facades/settings.js +1 -1
  26. package/build/facades/settings.js.map +1 -1
  27. package/build/generated/releaseMetadata.js +4 -4
  28. package/build/generated/releaseMetadata.js.map +1 -1
  29. package/build/index.d.ts +2 -1
  30. package/build/index.d.ts.map +1 -1
  31. package/build/index.js +1 -1
  32. package/build/index.js.map +1 -1
  33. package/build/react/useMentraLiveOta.d.ts.map +1 -1
  34. package/build/react/useMentraLiveOta.js.map +1 -1
  35. package/build/runtime/config.d.ts.map +1 -1
  36. package/build/runtime/config.js.map +1 -1
  37. package/build/services/AiTierResolution.d.ts +1 -1
  38. package/build/services/AiTierResolution.d.ts.map +1 -1
  39. package/build/services/AiTierResolution.js.map +1 -1
  40. package/build/services/AppRegistry.d.ts +12 -1
  41. package/build/services/AppRegistry.d.ts.map +1 -1
  42. package/build/services/AppRegistry.js +33 -0
  43. package/build/services/AppRegistry.js.map +1 -1
  44. package/build/services/AutomaticReportResult.d.ts.map +1 -1
  45. package/build/services/AutomaticReportResult.js.map +1 -1
  46. package/build/services/CloudClientService.d.ts +7 -5
  47. package/build/services/CloudClientService.d.ts.map +1 -1
  48. package/build/services/CloudClientService.js +17 -14
  49. package/build/services/CloudClientService.js.map +1 -1
  50. package/build/services/DisplayProcessor.d.ts.map +1 -1
  51. package/build/services/DisplayProcessor.js +2 -1
  52. package/build/services/DisplayProcessor.js.map +1 -1
  53. package/build/services/GestureDotsService.js +1 -1
  54. package/build/services/GestureDotsService.js.map +1 -1
  55. package/build/services/HotspotOtaTransport.d.ts.map +1 -1
  56. package/build/services/HotspotOtaTransport.js +0 -1
  57. package/build/services/HotspotOtaTransport.js.map +1 -1
  58. package/build/services/JSRouter.js +2 -2
  59. package/build/services/JSRouter.js.map +1 -1
  60. package/build/services/LocalLlmModelManager.d.ts.map +1 -1
  61. package/build/services/LocalLlmModelManager.js +4 -3
  62. package/build/services/LocalLlmModelManager.js.map +1 -1
  63. package/build/services/LocalLlmProvider.d.ts.map +1 -1
  64. package/build/services/LocalLlmProvider.js +5 -6
  65. package/build/services/LocalLlmProvider.js.map +1 -1
  66. package/build/services/LocalMiniappRuntime.d.ts +10 -3
  67. package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
  68. package/build/services/LocalMiniappRuntime.js +142 -30
  69. package/build/services/LocalMiniappRuntime.js.map +1 -1
  70. package/build/services/LocalSttFallbackCoordinator.d.ts.map +1 -1
  71. package/build/services/LocalSttFallbackCoordinator.js.map +1 -1
  72. package/build/services/NativeNavigationService.d.ts.map +1 -1
  73. package/build/services/NativeNavigationService.js.map +1 -1
  74. package/build/services/NavigationHandlers.d.ts +1 -1
  75. package/build/services/NavigationHandlers.js +2 -2
  76. package/build/services/NavigationHandlers.js.map +1 -1
  77. package/build/services/NavigationService.d.ts +2 -2
  78. package/build/services/NavigationService.d.ts.map +1 -1
  79. package/build/services/NavigationService.js +11 -11
  80. package/build/services/NavigationService.js.map +1 -1
  81. package/build/services/PairingIdentity.d.ts.map +1 -1
  82. package/build/services/PairingIdentity.js.map +1 -1
  83. package/build/services/PhoneCalendarService.d.ts.map +1 -1
  84. package/build/services/PhoneCalendarService.js.map +1 -1
  85. package/build/services/PhoneNotificationsSync.d.ts.map +1 -1
  86. package/build/services/PhoneNotificationsSync.js +2 -1
  87. package/build/services/PhoneNotificationsSync.js.map +1 -1
  88. package/build/services/PhoneStreamCoordinator.d.ts.map +1 -1
  89. package/build/services/PhoneStreamCoordinator.js.map +1 -1
  90. package/build/services/ProviderKeyValidation.d.ts +1 -1
  91. package/build/services/ProviderKeyValidation.js +1 -1
  92. package/build/services/ProviderKeyValidation.js.map +1 -1
  93. package/build/services/STTModelManager.d.ts.map +1 -1
  94. package/build/services/STTModelManager.js +1 -6
  95. package/build/services/STTModelManager.js.map +1 -1
  96. package/build/services/SupportProfileSync.d.ts.map +1 -1
  97. package/build/services/SupportProfileSync.js +3 -0
  98. package/build/services/SupportProfileSync.js.map +1 -1
  99. package/build/services/TranscriptionRouting.d.ts +3 -0
  100. package/build/services/TranscriptionRouting.d.ts.map +1 -1
  101. package/build/services/TranscriptionRouting.js +14 -0
  102. package/build/services/TranscriptionRouting.js.map +1 -1
  103. package/build/services/UIRouter.d.ts.map +1 -1
  104. package/build/services/UIRouter.js.map +1 -1
  105. package/build/services/controllers.d.ts.map +1 -1
  106. package/build/services/controllers.js +1 -0
  107. package/build/services/controllers.js.map +1 -1
  108. package/build/services/effectiveCapabilities.js +3 -2
  109. package/build/services/effectiveCapabilities.js.map +1 -1
  110. package/build/services/gestureDotGlyphs.d.ts.map +1 -1
  111. package/build/services/gestureDotGlyphs.js.map +1 -1
  112. package/build/services/manifestActions.d.ts.map +1 -1
  113. package/build/services/manifestActions.js.map +1 -1
  114. package/build/services/neuralBand/MetaAuth.d.ts +1 -0
  115. package/build/services/neuralBand/MetaAuth.d.ts.map +1 -1
  116. package/build/services/neuralBand/MetaAuth.js +36 -8
  117. package/build/services/neuralBand/MetaAuth.js.map +1 -1
  118. package/build/services/notificationAppPayload.d.ts +14 -0
  119. package/build/services/notificationAppPayload.d.ts.map +1 -0
  120. package/build/services/notificationAppPayload.js +15 -0
  121. package/build/services/notificationAppPayload.js.map +1 -0
  122. package/build/services/notifications/miniappNotifications.d.ts +31 -0
  123. package/build/services/notifications/miniappNotifications.d.ts.map +1 -0
  124. package/build/services/notifications/miniappNotifications.js +24 -0
  125. package/build/services/notifications/miniappNotifications.js.map +1 -0
  126. package/build/services/pages/pageEligibility.d.ts +1 -2
  127. package/build/services/pages/pageEligibility.d.ts.map +1 -1
  128. package/build/services/pages/pageEligibility.js +4 -2
  129. package/build/services/pages/pageEligibility.js.map +1 -1
  130. package/build/services/settingsBridge.d.ts.map +1 -1
  131. package/build/services/settingsBridge.js +0 -2
  132. package/build/services/settingsBridge.js.map +1 -1
  133. package/build/services/uiShim.d.ts.map +1 -1
  134. package/build/services/uiShim.js +14 -0
  135. package/build/services/uiShim.js.map +1 -1
  136. package/build/stores/appVisibility.d.ts.map +1 -1
  137. package/build/stores/appVisibility.js.map +1 -1
  138. package/build/stores/gallerySync.d.ts.map +1 -1
  139. package/build/stores/gallerySync.js.map +1 -1
  140. package/build/stores/glasses.d.ts.map +1 -1
  141. package/build/stores/glasses.js +1 -0
  142. package/build/stores/glasses.js.map +1 -1
  143. package/build/stores/settings.d.ts.map +1 -1
  144. package/build/stores/settings.js +27 -28
  145. package/build/stores/settings.js.map +1 -1
  146. package/build/types/capabilities/even-realities-g1.d.ts.map +1 -1
  147. package/build/types/capabilities/even-realities-g1.js +4 -0
  148. package/build/types/capabilities/even-realities-g1.js.map +1 -1
  149. package/build/types/capabilities/nimo.d.ts.map +1 -1
  150. package/build/types/capabilities/nimo.js +21 -7
  151. package/build/types/capabilities/nimo.js.map +1 -1
  152. package/build/types/enums.d.ts +2 -1
  153. package/build/types/enums.d.ts.map +1 -1
  154. package/build/types/enums.js +1 -0
  155. package/build/types/enums.js.map +1 -1
  156. package/build/utils/display/index.d.ts +1 -0
  157. package/build/utils/display/index.d.ts.map +1 -1
  158. package/build/utils/display/index.js +2 -2
  159. package/build/utils/display/index.js.map +1 -1
  160. package/build/utils/display/profiles/index.d.ts +1 -0
  161. package/build/utils/display/profiles/index.d.ts.map +1 -1
  162. package/build/utils/display/profiles/index.js +1 -0
  163. package/build/utils/display/profiles/index.js.map +1 -1
  164. package/build/utils/display/profiles/nimo.d.ts +2 -0
  165. package/build/utils/display/profiles/nimo.d.ts.map +1 -0
  166. package/build/utils/display/profiles/nimo.js +3 -0
  167. package/build/utils/display/profiles/nimo.js.map +1 -0
  168. package/build/utils/display/scene/svgPath.js.map +1 -1
  169. package/build/utils/memory/search.d.ts.map +1 -1
  170. package/build/utils/memory/search.js +17 -7
  171. package/build/utils/memory/search.js.map +1 -1
  172. package/package.json +15 -15
  173. package/src/engine.ts +9 -7
  174. package/src/facades/display.ts +1 -1
  175. package/src/facades/glasses.ts +1 -1
  176. package/src/facades/permissions.ts +0 -2
  177. package/src/facades/phoneNotifications.ts +10 -0
  178. package/src/facades/providerKeys.ts +1 -1
  179. package/src/facades/reports.ts +41 -0
  180. package/src/facades/settings.ts +1 -1
  181. package/src/generated/releaseMetadata.ts +4 -4
  182. package/src/index.ts +2 -0
  183. package/src/react/useMentraLiveOta.ts +1 -4
  184. package/src/runtime/config.ts +1 -6
  185. package/src/services/AiTierResolution.ts +1 -1
  186. package/src/services/AppRegistry.ts +38 -1
  187. package/src/services/AutomaticReportResult.ts +1 -3
  188. package/src/services/CloudClientService.ts +17 -11
  189. package/src/services/DisplayProcessor.ts +2 -0
  190. package/src/services/GestureDotsService.ts +1 -1
  191. package/src/services/HotspotOtaTransport.ts +1 -5
  192. package/src/services/JSRouter.ts +2 -2
  193. package/src/services/LocalLlmModelManager.ts +4 -3
  194. package/src/services/LocalLlmProvider.ts +6 -7
  195. package/src/services/LocalMiniappRuntime.ts +170 -40
  196. package/src/services/LocalSttFallbackCoordinator.ts +1 -5
  197. package/src/services/NativeNavigationService.ts +1 -2
  198. package/src/services/NavigationHandlers.ts +2 -2
  199. package/src/services/NavigationService.ts +12 -11
  200. package/src/services/PairingIdentity.ts +1 -3
  201. package/src/services/PhoneCalendarService.ts +1 -3
  202. package/src/services/PhoneNotificationsSync.ts +2 -1
  203. package/src/services/PhoneStreamCoordinator.ts +1 -2
  204. package/src/services/ProviderKeyValidation.ts +1 -1
  205. package/src/services/STTModelManager.ts +1 -6
  206. package/src/services/SupportProfileSync.ts +2 -0
  207. package/src/services/TranscriptionRouting.ts +18 -0
  208. package/src/services/UIRouter.ts +3 -9
  209. package/src/services/controllers.ts +1 -0
  210. package/src/services/effectiveCapabilities.ts +3 -2
  211. package/src/services/gestureDotGlyphs.ts +10 -5
  212. package/src/services/manifestActions.ts +2 -1
  213. package/src/services/neuralBand/MetaAuth.ts +37 -8
  214. package/src/services/notificationAppPayload.ts +15 -0
  215. package/src/services/notifications/miniappNotifications.ts +53 -0
  216. package/src/services/pages/pageEligibility.ts +3 -2
  217. package/src/services/settingsBridge.ts +1 -4
  218. package/src/services/uiShim.ts +14 -0
  219. package/src/stores/appVisibility.ts +2 -5
  220. package/src/stores/gallerySync.ts +1 -7
  221. package/src/stores/glasses.ts +1 -0
  222. package/src/stores/settings.ts +27 -28
  223. package/src/types/capabilities/even-realities-g1.ts +5 -0
  224. package/src/types/capabilities/nimo.ts +23 -7
  225. package/src/types/enums.ts +1 -0
  226. package/src/utils/display/index.ts +2 -2
  227. package/src/utils/display/profiles/index.ts +2 -0
  228. package/src/utils/display/profiles/nimo.ts +2 -0
  229. package/src/utils/display/scene/svgPath.ts +1 -1
  230. package/src/utils/memory/search.ts +17 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notificationAppPayload.d.ts","sourceRoot":"","sources":["../../src/services/notificationAppPayload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAC,CAAC,GACvE,KAAK,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAC,CAAC,CAQpE"}
@@ -0,0 +1,15 @@
1
+ /** Keep installed-app icons from exhausting the miniapp's 32 MiB JS heap.
2
+ * Icons are optional; clients already render a fallback when one is absent.
3
+ * Bound both individual icons and their total before JSON crosses the bridge.
4
+ */
5
+ export function notificationAppPayload(apps) {
6
+ let remaining = 128 * 1024;
7
+ return apps.map(({ packageName, appName, icon }) => {
8
+ const size = icon?.length ?? 0;
9
+ const keep = size <= 8 * 1024 && size <= remaining;
10
+ if (keep)
11
+ remaining -= size;
12
+ return { packageName, appName, icon: keep ? icon : null };
13
+ });
14
+ }
15
+ //# sourceMappingURL=notificationAppPayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notificationAppPayload.js","sourceRoot":"","sources":["../../src/services/notificationAppPayload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAwE;IAExE,IAAI,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;IAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAC,EAAE,EAAE;QAC/C,MAAM,IAAI,GAAG,IAAI,EAAE,MAAM,IAAI,CAAC,CAAA;QAC9B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,SAAS,CAAA;QAClD,IAAI,IAAI;YAAE,SAAS,IAAI,IAAI,CAAA;QAC3B,OAAO,EAAC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/** Keep installed-app icons from exhausting the miniapp's 32 MiB JS heap.\n * Icons are optional; clients already render a fallback when one is absent.\n * Bound both individual icons and their total before JSON crosses the bridge.\n */\nexport function notificationAppPayload(\n apps: Array<{packageName: string; appName: string; icon: string | null}>,\n): Array<{packageName: string; appName: string; icon: string | null}> {\n let remaining = 128 * 1024\n return apps.map(({packageName, appName, icon}) => {\n const size = icon?.length ?? 0\n const keep = size <= 8 * 1024 && size <= remaining\n if (keep) remaining -= size\n return {packageName, appName, icon: keep ? icon : null}\n })\n}\n"]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Notifications miniapps post (`session.phone.notifications.post`) on their
3
+ * way into the host's phone-notification path. The runtime validates and
4
+ * emits here; the host subscribes through `engine.phoneNotifications` and
5
+ * feeds them to the same fan-out as the phone's own, with `system: false`
6
+ * and `source` set, so the dashboard, other readers and presentation treat
7
+ * them alike.
8
+ */
9
+ export interface MiniappNotificationPosted {
10
+ type: "posted";
11
+ notificationId: string;
12
+ source: string;
13
+ app: string;
14
+ title: string;
15
+ content: string;
16
+ timestamp: number;
17
+ }
18
+ export interface MiniappNotificationDismissed {
19
+ type: "dismissed";
20
+ notificationId: string;
21
+ source: string;
22
+ timestamp: number;
23
+ }
24
+ export type MiniappNotificationEvent = MiniappNotificationPosted | MiniappNotificationDismissed;
25
+ export declare const MINIAPP_NOTIFICATION_TITLE_MAX = 200;
26
+ export declare const MINIAPP_NOTIFICATION_CONTENT_MAX = 2000;
27
+ export declare const MINIAPP_NOTIFICATION_ID_MAX = 128;
28
+ export declare function miniappNotificationId(source: string, id: string): string;
29
+ export declare function emitMiniappNotification(event: MiniappNotificationEvent): void;
30
+ export declare function onMiniappNotification(listener: (event: MiniappNotificationEvent) => void): () => void;
31
+ //# sourceMappingURL=miniappNotifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miniappNotifications.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/miniappNotifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,QAAQ,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,WAAW,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,wBAAwB,GAAG,yBAAyB,GAAG,4BAA4B,CAAA;AAE/F,eAAO,MAAM,8BAA8B,MAAM,CAAA;AACjD,eAAO,MAAM,gCAAgC,OAAQ,CAAA;AACrD,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAI9C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,wBAAwB,GAAG,IAAI,CAQ7E;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,GAAG,MAAM,IAAI,CAKrG"}
@@ -0,0 +1,24 @@
1
+ export const MINIAPP_NOTIFICATION_TITLE_MAX = 200;
2
+ export const MINIAPP_NOTIFICATION_CONTENT_MAX = 2_000;
3
+ export const MINIAPP_NOTIFICATION_ID_MAX = 128;
4
+ const listeners = new Set();
5
+ export function miniappNotificationId(source, id) {
6
+ return `${source}:${id}`;
7
+ }
8
+ export function emitMiniappNotification(event) {
9
+ for (const listener of listeners) {
10
+ try {
11
+ listener(event);
12
+ }
13
+ catch (err) {
14
+ console.warn(`miniappNotifications: listener threw: ${err?.message ?? err}`);
15
+ }
16
+ }
17
+ }
18
+ export function onMiniappNotification(listener) {
19
+ listeners.add(listener);
20
+ return () => {
21
+ listeners.delete(listener);
22
+ };
23
+ }
24
+ //# sourceMappingURL=miniappNotifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miniappNotifications.js","sourceRoot":"","sources":["../../../src/services/notifications/miniappNotifications.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAA;AACjD,MAAM,CAAC,MAAM,gCAAgC,GAAG,KAAK,CAAA;AACrD,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAE9C,MAAM,SAAS,GAAG,IAAI,GAAG,EAA6C,CAAA;AAEtE,MAAM,UAAU,qBAAqB,CAAC,MAAc,EAAE,EAAU;IAC9D,OAAO,GAAG,MAAM,IAAI,EAAE,EAAE,CAAA;AAC1B,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAA+B;IACrE,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,QAAQ,CAAC,KAAK,CAAC,CAAA;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,yCAA0C,GAAa,EAAE,OAAO,IAAI,GAAG,EAAE,CAAC,CAAA;QACzF,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAmD;IACvF,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACvB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC5B,CAAC,CAAA;AACH,CAAC","sourcesContent":["/**\n * Notifications miniapps post (`session.phone.notifications.post`) on their\n * way into the host's phone-notification path. The runtime validates and\n * emits here; the host subscribes through `engine.phoneNotifications` and\n * feeds them to the same fan-out as the phone's own, with `system: false`\n * and `source` set, so the dashboard, other readers and presentation treat\n * them alike.\n */\nexport interface MiniappNotificationPosted {\n type: \"posted\"\n notificationId: string\n source: string\n app: string\n title: string\n content: string\n timestamp: number\n}\n\nexport interface MiniappNotificationDismissed {\n type: \"dismissed\"\n notificationId: string\n source: string\n timestamp: number\n}\n\nexport type MiniappNotificationEvent = MiniappNotificationPosted | MiniappNotificationDismissed\n\nexport const MINIAPP_NOTIFICATION_TITLE_MAX = 200\nexport const MINIAPP_NOTIFICATION_CONTENT_MAX = 2_000\nexport const MINIAPP_NOTIFICATION_ID_MAX = 128\n\nconst listeners = new Set<(event: MiniappNotificationEvent) => void>()\n\nexport function miniappNotificationId(source: string, id: string): string {\n return `${source}:${id}`\n}\n\nexport function emitMiniappNotification(event: MiniappNotificationEvent): void {\n for (const listener of listeners) {\n try {\n listener(event)\n } catch (err) {\n console.warn(`miniappNotifications: listener threw: ${(err as Error)?.message ?? err}`)\n }\n }\n}\n\nexport function onMiniappNotification(listener: (event: MiniappNotificationEvent) => void): () => void {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n}\n"]}
@@ -2,8 +2,7 @@
2
2
  export declare function isCfwFirmwareVersion(firmwareVersion: string | null | undefined): boolean;
3
3
  /**
4
4
  * Only models that ship a Glassly custom firmware, and only while they run it.
5
- * Stock firmware on those models and every other model (NIMO, G1, ...) are
6
- * intentionally excluded.
5
+ * Stock firmware and every other model are intentionally excluded.
7
6
  */
8
7
  export declare function isCustomDashboardEligible(info: {
9
8
  model?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"pageEligibility.d.ts","sourceRoot":"","sources":["../../../src/services/pages/pageEligibility.ts"],"names":[],"mappings":"AAaA,0GAA0G;AAC1G,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAKxF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAC,GAAG,OAAO,CAWjH;AAED,wBAAgB,aAAa,IAAI,OAAO,CAOvC"}
1
+ {"version":3,"file":"pageEligibility.d.ts","sourceRoot":"","sources":["../../../src/services/pages/pageEligibility.ts"],"names":[],"mappings":"AAaA,0GAA0G;AAC1G,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAKxF;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAC,GAAG,OAAO,CAajH;AAED,wBAAgB,aAAa,IAAI,OAAO,CAOvC"}
@@ -17,12 +17,14 @@ export function isCfwFirmwareVersion(firmwareVersion) {
17
17
  }
18
18
  /**
19
19
  * Only models that ship a Glassly custom firmware, and only while they run it.
20
- * Stock firmware on those models and every other model (NIMO, G1, ...) are
21
- * intentionally excluded.
20
+ * Stock firmware and every other model are intentionally excluded.
22
21
  */
23
22
  export function isCustomDashboardEligible(info) {
24
23
  if (!info.model)
25
24
  return false;
25
+ // The NIMO drivers draw no scenes through its CFW yet; the dashboard would land on the text page.
26
+ if (info.model === DeviceTypes.NIMO)
27
+ return false;
26
28
  if (info.model === DeviceTypes.MEMOMIND_ONE) {
27
29
  const match = /^GLASSLYCFW\/([0-9]+)$/.exec(info.firmwareVersion ?? "");
28
30
  const revision = match ? Number(match[1]) : 0;
@@ -1 +1 @@
1
- {"version":3,"file":"pageEligibility.js","sourceRoot":"","sources":["../../../src/services/pages/pageEligibility.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAC,QAAQ,E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AAK,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAA;IACxC,OAAO,CACL,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC;QACpC,yBAAyB,CAAC,EAAC,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,EAAC,CAAC,CAC9F,CAAA;AACH,CAAC","sourcesContent":["/**\n * Whether the dashboard view may show right now: connected Glassly CFW\n * glasses with the dashboard enabled. The page host reads it before showing\n * a page and hides the showing page when it turns false; the miniapp runtime\n * folds it into the designated app's `display.views` capability. Read at\n * decision time, never cached.\n */\nimport {useGlassesStore} from \"../../stores/glasses\"\nimport {SETTINGS, useSettingsStore} from \"../../stores/settings\"\nimport {DeviceTypes} from \"../../types/enums\"\nimport {getModelCapabilities} from \"../../types/hardware\"\nimport {isGlassesConnected} from \"../GlassesReadiness\"\n\n/** The SGC appends this marker after the firmware advertises Glassly CFW capabilities (G2, RayNeo iO). */\nexport function isCfwFirmwareVersion(firmwareVersion: string | null | undefined): boolean {\n return (\n firmwareVersion?.toLowerCase().includes(\"glassly cfw\") === true ||\n /^GLASSLYCFW\\/[0-9]+$/.test(firmwareVersion ?? \"\")\n )\n}\n\n/**\n * Only models that ship a Glassly custom firmware, and only while they run it.\n * Stock firmware on those models and every other model (NIMO, G1, ...) are\n * intentionally excluded.\n */\nexport function isCustomDashboardEligible(info: {model?: string | null; firmwareVersion?: string | null}): boolean {\n if (!info.model) return false\n if (info.model === DeviceTypes.MEMOMIND_ONE) {\n const match = /^GLASSLYCFW\\/([0-9]+)$/.exec(info.firmwareVersion ?? \"\")\n const revision = match ? Number(match[1]) : 0\n return Number.isSafeInteger(revision) && revision >= 10\n }\n return (\n getModelCapabilities(info.model as DeviceTypes).hasCustomFirmware === true &&\n isCfwFirmwareVersion(info.firmwareVersion)\n )\n}\n\nexport function pagesEligible(): boolean {\n if (useSettingsStore.getState().getSetting(SETTINGS.custom_dashboard_enabled.key) === false) return false\n const state = useGlassesStore.getState()\n return (\n isGlassesConnected(state.connection) &&\n isCustomDashboardEligible({model: state.deviceModel, firmwareVersion: state.firmwareVersion})\n )\n}\n"]}
1
+ {"version":3,"file":"pageEligibility.js","sourceRoot":"","sources":["../../../src/services/pages/pageEligibility.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAA;AAEtD,0GAA0G;AAC1G,MAAM,UAAU,oBAAoB,CAAC,eAA0C;IAC7E,OAAO,CACL,eAAe,EAAE,WAAW,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,IAAI;QAC/D,sBAAsB,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC,CACnD,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAA8D;IACtG,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IAC7B,kGAAkG;IAClG,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,IAAI;QAAE,OAAO,KAAK,CAAA;IACjD,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,YAAY,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC,CAAA;QACvE,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7C,OAAO,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,EAAE,CAAA;IACzD,CAAC;IACD,OAAO,CACL,oBAAoB,CAAC,IAAI,CAAC,KAAoB,CAAC,CAAC,iBAAiB,KAAK,IAAI;QAC1E,oBAAoB,CAAC,IAAI,CAAC,eAAe,CAAC,CAC3C,CAAA;AACH,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,IAAI,gBAAgB,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,wBAAwB,CAAC,GAAG,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAA;IACzG,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAA;IACxC,OAAO,CACL,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC;QACpC,yBAAyB,CAAC,EAAC,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,EAAC,CAAC,CAC9F,CAAA;AACH,CAAC","sourcesContent":["/**\n * Whether the dashboard view may show right now: connected Glassly CFW\n * glasses with the dashboard enabled. The page host reads it before showing\n * a page and hides the showing page when it turns false; the miniapp runtime\n * folds it into the designated app's `display.views` capability. Read at\n * decision time, never cached.\n */\nimport {useGlassesStore} from \"../../stores/glasses\"\nimport {SETTINGS, useSettingsStore} from \"../../stores/settings\"\nimport {DeviceTypes} from \"../../types/enums\"\nimport {getModelCapabilities} from \"../../types/hardware\"\nimport {isGlassesConnected} from \"../GlassesReadiness\"\n\n/** The SGC appends this marker after the firmware advertises Glassly CFW capabilities (G2, RayNeo iO). */\nexport function isCfwFirmwareVersion(firmwareVersion: string | null | undefined): boolean {\n return (\n firmwareVersion?.toLowerCase().includes(\"glassly cfw\") === true ||\n /^GLASSLYCFW\\/[0-9]+$/.test(firmwareVersion ?? \"\")\n )\n}\n\n/**\n * Only models that ship a Glassly custom firmware, and only while they run it.\n * Stock firmware and every other model are intentionally excluded.\n */\nexport function isCustomDashboardEligible(info: {model?: string | null; firmwareVersion?: string | null}): boolean {\n if (!info.model) return false\n // The NIMO drivers draw no scenes through its CFW yet; the dashboard would land on the text page.\n if (info.model === DeviceTypes.NIMO) return false\n if (info.model === DeviceTypes.MEMOMIND_ONE) {\n const match = /^GLASSLYCFW\\/([0-9]+)$/.exec(info.firmwareVersion ?? \"\")\n const revision = match ? Number(match[1]) : 0\n return Number.isSafeInteger(revision) && revision >= 10\n }\n return (\n getModelCapabilities(info.model as DeviceTypes).hasCustomFirmware === true &&\n isCfwFirmwareVersion(info.firmwareVersion)\n )\n}\n\nexport function pagesEligible(): boolean {\n if (useSettingsStore.getState().getSetting(SETTINGS.custom_dashboard_enabled.key) === false) return false\n const state = useGlassesStore.getState()\n return (\n isGlassesConnected(state.connection) &&\n isCustomDashboardEligible({model: state.deviceModel, firmwareVersion: state.firmwareVersion})\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"settingsBridge.d.ts","sourceRoot":"","sources":["../../src/services/settingsBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAA;AAK9E,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,CAAA;AAEnD,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAwB/E,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sEAAuE,CAAA;AACzG,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,kBAAkB,CAE3E;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAG7E;AAED,wDAAwD;AACxD,wBAAgB,qBAAqB,IAAI,MA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AS,EAAE,OAAO,CAAA;IAClB,6BAA6B;IAC7B,OAAO,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAC,CAAA;IAC3C,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,gGAAgG;AAChG,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,OAAO,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;IACxB,YAAY,EAAE,OAAO,CAAA;CACtB;AAcD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,gBAAgB,EAAE,EAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,SAAS,EACtD,OAAO,EAAE,WAAW,GACnB,sBAAsB,EAAE,CAqB1B"}
@@ -17,7 +17,6 @@ import { hasInput2d, isControllerReady } from "./controllers";
17
17
  export const SETTINGS_BRIDGE_KEYS = {
18
18
  // The dashboard's master switch is a phone-side debug knob.
19
19
  custom_dashboard_enabled: "read",
20
- contextual_dashboard: "write",
21
20
  head_up_angle: "write",
22
21
  // Where the glasses draw; each model's steps are its display.positionRange.
23
22
  dashboard_depth: "write",
@@ -27,7 +26,6 @@ export const SETTINGS_BRIDGE_KEYS = {
27
26
  auto_brightness: "write",
28
27
  // Per paired model: the store resolves the indexed key.
29
28
  preferred_mic: "write",
30
- twelve_hour_time: "write",
31
29
  menu_apps: "write",
32
30
  notifications_enabled: "write",
33
31
  notifications_popups: "write",
@@ -1 +1 @@
1
- {"version":3,"file":"settingsBridge.js","sourceRoot":"","sources":["../../src/services/settingsBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAA;AAI3D,2FAA2F;AAC3F,MAAM,CAAC,MAAM,oBAAoB,GAAmD;IAClF,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K,EAAE,MAAM,CAAC,KAAK;YACnB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS;YACT,OAAO;YACP,OAAO,EAAE,SAAS,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC;SAC/C,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * The settings bridge's vocabulary (session.settings): which engine settings\n * a miniapp with the PLATFORM_SETTINGS permission may read or write, the\n * derived read-only keys the engine computes rather than stores, and the\n * request validation. Pure, so the runtime's handlers stay thin and this can\n * be tested without the native import surface the runtime pulls in.\n *\n * A dashboard miniapp is the usual consumer: it edits the notification,\n * glasses-menu, display-position, brightness and microphone keys the phone's\n * settings screens do, through the store, so persistence, server sync and the\n * Bluetooth sync behave as if a phone screen wrote them. A dashboard's own\n * look is not here; it keeps that in its storage.\n */\n\nimport type {ControllerStatus, PairedController} from \"@glassly/bluetooth-sdk\"\n\nimport {ControllerTypes} from \"../types/enums\"\nimport {hasInput2d, isControllerReady} from \"./controllers\"\n\nexport type SettingsBridgeAccess = \"read\" | \"write\"\n\n/** Stored settings the bridge serves, by key, with what a permitted app may do to each. */\nexport const SETTINGS_BRIDGE_KEYS: Readonly<Record<string, SettingsBridgeAccess>> = {\n // The dashboard's master switch is a phone-side debug knob.\n custom_dashboard_enabled: \"read\",\n contextual_dashboard: \"write\",\n head_up_angle: \"write\",\n // Where the glasses draw; each model's steps are its display.positionRange.\n dashboard_depth: \"write\",\n dashboard_height: \"write\",\n // Device settings the dashboard's glasses Settings page edits.\n brightness: \"write\",\n auto_brightness: \"write\",\n // Per paired model: the store resolves the indexed key.\n preferred_mic: \"write\",\n twelve_hour_time: \"write\",\n menu_apps: \"write\",\n notifications_enabled: \"write\",\n notifications_popups: \"write\",\n notifications_popup_seconds: \"write\",\n notifications_batch_seconds: \"write\",\n notifications_hold_during_apps: \"write\",\n notifications_ignore_while_active: \"write\",\n notifications_blocklist: \"write\",\n // Apps the glasses reported posting notifications; the engine records it.\n notification_seen_apps: \"read\",\n}\n\n/**\n * Read-only keys the engine computes: whether the wearer can see the phone,\n * whether the foreground miniapp is drawing on the glasses, and the paired\n * controllers with their battery and input. They change on their own clocks;\n * the runtime pushes them like stored keys.\n */\nexport const DERIVED_SETTINGS_KEYS = [\"phone_active\", \"foreground_app_on_screen\", \"controllers\"] as const\nexport type DerivedSettingsKey = (typeof DERIVED_SETTINGS_KEYS)[number]\n\nexport function isDerivedSettingsKey(key: string): key is DerivedSettingsKey {\n return (DERIVED_SETTINGS_KEYS as readonly string[]).includes(key)\n}\n\n/** What a permitted app may do with `key`, or null when the bridge does not serve it. */\nexport function settingsBridgeAccess(key: string): SettingsBridgeAccess | null {\n if (isDerivedSettingsKey(key)) return \"read\"\n return SETTINGS_BRIDGE_KEYS[key] ?? null\n}\n\n/** Every key the bridge serves, stored then derived. */\nexport function allSettingsBridgeKeys(): string[] {\n return [...Object.keys(SETTINGS_BRIDGE_KEYS), ...DERIVED_SETTINGS_KEYS]\n}\n\n/**\n * The keys a SETTINGS_GET asks for: everything when `requested` is absent,\n * else the known ones among the requested strings (unknown keys are left\n * out, never rejected).\n */\nexport function selectSettingsBridgeKeys(requested: unknown): string[] {\n if (requested === undefined || requested === null) return allSettingsBridgeKeys()\n if (!Array.isArray(requested)) return []\n return requested.filter((key): key is string => typeof key === \"string\" && settingsBridgeAccess(key) !== null)\n}\n\nexport type SettingsSetValidation =\n | {ok: true; key: string; value: unknown}\n | {ok: false; code: \"INVALID_ARGUMENT\" | \"NOT_PERMITTED\"; message: string}\n\n/** A SETTINGS_SET payload: a writable key and a JSON value (undefined is not a value). */\nexport function validateSettingsSet(payload: Record<string, unknown>): SettingsSetValidation {\n const key = payload.key\n if (typeof key !== \"string\" || !key) {\n return {ok: false, code: \"INVALID_ARGUMENT\", message: \"settings.set requires a key\"}\n }\n const access = settingsBridgeAccess(key)\n if (access === null) return {ok: false, code: \"INVALID_ARGUMENT\", message: `Unknown setting \"${key}\"`}\n if (access !== \"write\") return {ok: false, code: \"NOT_PERMITTED\", message: `Setting \"${key}\" is read-only`}\n if (!(\"value\" in payload) || payload.value === undefined) {\n return {ok: false, code: \"INVALID_ARGUMENT\", message: \"settings.set requires a value\"}\n }\n return {ok: true, key, value: payload.value}\n}\n\n/** One paired controller as the `controllers` derived key serves it. */\nexport interface ControllerSettingEntry {\n id: string\n model: string\n name: string\n /** Delivering input. */\n connected: boolean\n /** level -1 when unknown. */\n battery: {level: number; charging: boolean}\n /** Swipes sideways as well as up and down (the Meta Neural Band). */\n input2d: boolean\n}\n\n/** What the glasses report about the ring linked to them (G2 with the R1 routed through it). */\nexport interface RelayedRing {\n ringConnected: boolean\n ringBatteryLevel: number\n ringCharging: boolean\n}\n\n/**\n * The R1 the glasses' ring report is about: a ring routed through the G2 keeps\n * its phone link for telemetry, so prefer a linked ring, else the first one.\n */\nfunction relayedRingId(\n records: PairedController[],\n statuses: Record<string, ControllerStatus> | undefined,\n): string | undefined {\n const rings = records.filter((record) => record.model === ControllerTypes.R1)\n return (rings.find((ring) => statuses?.[ring.id]?.connected === true) ?? rings[0])?.id\n}\n\n/**\n * One entry per paired record, registry order. While the glasses report a\n * linked ring, that report is that ring's link and battery: a ring routed\n * through the G2 reports there, not to the phone.\n */\nexport function controllersSettingFrom(\n records: PairedController[],\n statuses: Record<string, ControllerStatus> | undefined,\n relayed: RelayedRing,\n): ControllerSettingEntry[] {\n const relayedId = relayed.ringConnected ? relayedRingId(records, statuses) : undefined\n return records.map((record) => {\n const status = statuses?.[record.id]\n let connected = isControllerReady(status)\n let battery = {level: status?.batteryLevel ?? -1, charging: status?.charging === true}\n if (record.id === relayedId) {\n connected = true\n if (relayed.ringBatteryLevel >= 0) {\n battery = {level: relayed.ringBatteryLevel, charging: relayed.ringCharging}\n }\n }\n return {\n id: record.id,\n model: record.model,\n name: record.name,\n connected,\n battery,\n input2d: connected && hasInput2d(record.model),\n }\n })\n}\n"]}
1
+ {"version":3,"file":"settingsBridge.js","sourceRoot":"","sources":["../../src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OAAO,GAAG,EAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,EAAE,QAAQ,EAAE,OAAO,CAAC,YAAY,EAAC,CAAA;YAC7E,CAAC;QACH,CAAC;QACD,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS;YACT,OAAO;YACP,OAAO,EAAE,SAAS,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC;SAC/C,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["/**\n * The settings bridge's vocabulary (session.settings): which engine settings\n * a miniapp with the PLATFORM_SETTINGS permission may read or write, the\n * derived read-only keys the engine computes rather than stores, and the\n * request validation. Pure, so the runtime's handlers stay thin and this can\n * be tested without the native import surface the runtime pulls in.\n *\n * A dashboard miniapp is the usual consumer: it edits the notification,\n * glasses-menu, display-position, brightness and microphone keys the phone's\n * settings screens do, through the store, so persistence, server sync and the\n * Bluetooth sync behave as if a phone screen wrote them. A dashboard's own\n * look is not here; it keeps that in its storage.\n */\n\nimport type {ControllerStatus, PairedController} from \"@glassly/bluetooth-sdk\"\n\nimport {ControllerTypes} from \"../types/enums\"\nimport {hasInput2d, isControllerReady} from \"./controllers\"\n\nexport type SettingsBridgeAccess = \"read\" | \"write\"\n\n/** Stored settings the bridge serves, by key, with what a permitted app may do to each. */\nexport const SETTINGS_BRIDGE_KEYS: Readonly<Record<string, SettingsBridgeAccess>> = {\n // The dashboard's master switch is a phone-side debug knob.\n custom_dashboard_enabled: \"read\",\n head_up_angle: \"write\",\n // Where the glasses draw; each model's steps are its display.positionRange.\n dashboard_depth: \"write\",\n dashboard_height: \"write\",\n // Device settings the dashboard's glasses Settings page edits.\n brightness: \"write\",\n auto_brightness: \"write\",\n // Per paired model: the store resolves the indexed key.\n preferred_mic: \"write\",\n menu_apps: \"write\",\n notifications_enabled: \"write\",\n notifications_popups: \"write\",\n notifications_popup_seconds: \"write\",\n notifications_batch_seconds: \"write\",\n notifications_hold_during_apps: \"write\",\n notifications_ignore_while_active: \"write\",\n notifications_blocklist: \"write\",\n // Apps the glasses reported posting notifications; the engine records it.\n notification_seen_apps: \"read\",\n}\n\n/**\n * Read-only keys the engine computes: whether the wearer can see the phone,\n * whether the foreground miniapp is drawing on the glasses, and the paired\n * controllers with their battery and input. They change on their own clocks;\n * the runtime pushes them like stored keys.\n */\nexport const DERIVED_SETTINGS_KEYS = [\"phone_active\", \"foreground_app_on_screen\", \"controllers\"] as const\nexport type DerivedSettingsKey = (typeof DERIVED_SETTINGS_KEYS)[number]\n\nexport function isDerivedSettingsKey(key: string): key is DerivedSettingsKey {\n return (DERIVED_SETTINGS_KEYS as readonly string[]).includes(key)\n}\n\n/** What a permitted app may do with `key`, or null when the bridge does not serve it. */\nexport function settingsBridgeAccess(key: string): SettingsBridgeAccess | null {\n if (isDerivedSettingsKey(key)) return \"read\"\n return SETTINGS_BRIDGE_KEYS[key] ?? null\n}\n\n/** Every key the bridge serves, stored then derived. */\nexport function allSettingsBridgeKeys(): string[] {\n return [...Object.keys(SETTINGS_BRIDGE_KEYS), ...DERIVED_SETTINGS_KEYS]\n}\n\n/**\n * The keys a SETTINGS_GET asks for: everything when `requested` is absent,\n * else the known ones among the requested strings (unknown keys are left\n * out, never rejected).\n */\nexport function selectSettingsBridgeKeys(requested: unknown): string[] {\n if (requested === undefined || requested === null) return allSettingsBridgeKeys()\n if (!Array.isArray(requested)) return []\n return requested.filter((key): key is string => typeof key === \"string\" && settingsBridgeAccess(key) !== null)\n}\n\nexport type SettingsSetValidation =\n {ok: true; key: string; value: unknown} | {ok: false; code: \"INVALID_ARGUMENT\" | \"NOT_PERMITTED\"; message: string}\n\n/** A SETTINGS_SET payload: a writable key and a JSON value (undefined is not a value). */\nexport function validateSettingsSet(payload: Record<string, unknown>): SettingsSetValidation {\n const key = payload.key\n if (typeof key !== \"string\" || !key) {\n return {ok: false, code: \"INVALID_ARGUMENT\", message: \"settings.set requires a key\"}\n }\n const access = settingsBridgeAccess(key)\n if (access === null) return {ok: false, code: \"INVALID_ARGUMENT\", message: `Unknown setting \"${key}\"`}\n if (access !== \"write\") return {ok: false, code: \"NOT_PERMITTED\", message: `Setting \"${key}\" is read-only`}\n if (!(\"value\" in payload) || payload.value === undefined) {\n return {ok: false, code: \"INVALID_ARGUMENT\", message: \"settings.set requires a value\"}\n }\n return {ok: true, key, value: payload.value}\n}\n\n/** One paired controller as the `controllers` derived key serves it. */\nexport interface ControllerSettingEntry {\n id: string\n model: string\n name: string\n /** Delivering input. */\n connected: boolean\n /** level -1 when unknown. */\n battery: {level: number; charging: boolean}\n /** Swipes sideways as well as up and down (the Meta Neural Band). */\n input2d: boolean\n}\n\n/** What the glasses report about the ring linked to them (G2 with the R1 routed through it). */\nexport interface RelayedRing {\n ringConnected: boolean\n ringBatteryLevel: number\n ringCharging: boolean\n}\n\n/**\n * The R1 the glasses' ring report is about: a ring routed through the G2 keeps\n * its phone link for telemetry, so prefer a linked ring, else the first one.\n */\nfunction relayedRingId(\n records: PairedController[],\n statuses: Record<string, ControllerStatus> | undefined,\n): string | undefined {\n const rings = records.filter((record) => record.model === ControllerTypes.R1)\n return (rings.find((ring) => statuses?.[ring.id]?.connected === true) ?? rings[0])?.id\n}\n\n/**\n * One entry per paired record, registry order. While the glasses report a\n * linked ring, that report is that ring's link and battery: a ring routed\n * through the G2 reports there, not to the phone.\n */\nexport function controllersSettingFrom(\n records: PairedController[],\n statuses: Record<string, ControllerStatus> | undefined,\n relayed: RelayedRing,\n): ControllerSettingEntry[] {\n const relayedId = relayed.ringConnected ? relayedRingId(records, statuses) : undefined\n return records.map((record) => {\n const status = statuses?.[record.id]\n let connected = isControllerReady(status)\n let battery = {level: status?.batteryLevel ?? -1, charging: status?.charging === true}\n if (record.id === relayedId) {\n connected = true\n if (relayed.ringBatteryLevel >= 0) {\n battery = {level: relayed.ringBatteryLevel, charging: relayed.ringCharging}\n }\n }\n return {\n id: record.id,\n model: record.model,\n name: record.name,\n connected,\n battery,\n input2d: connected && hasInput2d(record.model),\n }\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"uiShim.d.ts","sourceRoot":"","sources":["../../src/services/uiShim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAgV1D"}
1
+ {"version":3,"file":"uiShim.d.ts","sourceRoot":"","sources":["../../src/services/uiShim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CA8V1D"}
@@ -297,6 +297,13 @@ export function buildUiShim(options) {
297
297
  postEnvelope({ type: 'set_background', color: color });
298
298
  }
299
299
 
300
+ var backHandler = null;
301
+
302
+ function setBackActionFn(handler) {
303
+ backHandler = typeof handler === 'function' ? handler : null;
304
+ postEnvelope({ type: 'set_back_action', shown: backHandler !== null });
305
+ }
306
+
300
307
  function fireChannel(channel, payload) {
301
308
  var list = channelHandlers[channel];
302
309
  if (!list || list.length === 0) {
@@ -341,6 +348,12 @@ export function buildUiShim(options) {
341
348
  }
342
349
  return;
343
350
  }
351
+ if (type === 'back') {
352
+ if (backHandler) {
353
+ try { backHandler(); } catch (e) {}
354
+ }
355
+ return;
356
+ }
344
357
  if (type === 'cancel' && typeof envelope.requestId === 'string') {
345
358
  // Background-side cancel (reserved; currently unused). If we had a
346
359
  // future bidirectional RPC this would abort an in-flight UI handler.
@@ -359,6 +372,7 @@ export function buildUiShim(options) {
359
372
  onClose: onClose,
360
373
  ready: readyFn,
361
374
  setBackgroundColor: setBackgroundColorFn,
375
+ setBackAction: setBackActionFn,
362
376
  /** @internal — packageName for diagnostic logs only. */
363
377
  _packageName: packageName,
364
378
  };
@@ -1 +1 @@
1
- {"version":3,"file":"uiShim.js","sourceRoot":"","sources":["../../src/services/uiShim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAQH,MAAM,UAAU,WAAW,CAAC,OAAsB;IAChD,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3D,+DAA+D;IAC/D,mEAAmE;IACnE,yDAAyD;IACzD,OAAO;;;;sBAIa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsUpC,CAAC,IAAI,EAAE,CAAA;AACR,CAAC","sourcesContent":["/**\n * window.glassly — WebView-side bridge to the per-miniapp background JSContext.\n *\n * Injected into every UI WebView via `injectedJavaScriptBeforeContentLoaded`\n * (iOS) or `injectedJavaScriptObject` + a bundler-emitted inline `<script>`\n * (Android, where the `BeforeContentLoaded` prop is documented unreliable\n * per react-native-webview issues #1099 / #1609).\n *\n * The shim:\n * - Buffers `glassly.send(channel, payload)` calls until `glassly.ready()`\n * fires + the host acks the channel is open. WebView-side BUFFERS (the\n * WebView is the short-lived side and shouldn't drop user input).\n * - Installs `window.__host.recv(envelope)` for the host to push\n * background → WebView messages via `webview.injectJavaScript(...)`.\n * - Sends `__heartbeat__` every 5s; host considers the WebView gone\n * after 15s of silence.\n * - Maintains monotonic seq numbers; the host's per-WebView dedup window\n * drops replays during reconnect.\n *\n * This file exports a `buildUiShim()` function returning the JS\n * source as a string. The host's UIRouter wraps it inside the\n * existing WebView setup so a single bundler-time string emission covers\n * both platforms.\n *\n * IMPORTANT: the shim runs in the WebView's bare ECMAScript scope before\n * the miniapp's bundle. It must not import anything; the source is one\n * IIFE. The only injected dependencies are\n * `window.ReactNativeWebView.postMessage` (provided by react-native-webview)\n * and (on Android) `window.ReactNativeWebView.injectedObjectJson()`\n * (provided when the host sets `injectedJavaScriptObject`).\n */\n\nexport interface UiShimOptions {\n packageName: string\n /** @deprecated No longer used — heartbeat removed since WebViews are foreground-only. */\n heartbeatIntervalMs?: number\n}\n\nexport function buildUiShim(options: UiShimOptions): string {\n const packageNameJson = JSON.stringify(options.packageName)\n // The IIFE assembles a typed `glassly` global plus an internal\n // `__host` for host inbound calls. Quoted strings are JSON-safe so\n // direct injection inside another JS literal also works.\n return `\n(function () {\n if (typeof window === 'undefined') return;\n if (window.glassly && window.__host) return;\n var packageName = ${packageNameJson};\n // Resolve window.ReactNativeWebView.postMessage LAZILY, not once at shim-eval.\n // On Android the shim is injected as a WebViewCompat document-start script\n // (so it beats the page bundle and the ready handshake can't be raced — see\n // the react-native-webview patch). But the order in which that document-start\n // script runs vs. the WebMessageListener that installs\n // window.ReactNativeWebView is not contractually fixed on Android the way it\n // is on iOS (postMessageScript is registered before atStartScript there). If\n // we captured rnPost once and the bridge object wasn't installed yet, every\n // postMessage — including {type:'ready'} — would be silently dropped and the\n // splash would hang forever. Resolving per-call means we always pick up the\n // bridge once it exists, which it reliably does by the time the bundle mounts\n // and calls glassly.ready().\n function getRnPost() {\n try {\n return window.ReactNativeWebView && typeof window.ReactNativeWebView.postMessage === 'function'\n ? window.ReactNativeWebView.postMessage.bind(window.ReactNativeWebView)\n : null;\n } catch (e) { return null; }\n }\n\n // Outbound seq number — purely a log-correlation aid (the host's\n // router doesn't dedup anymore since reconnect can't happen: one\n // WebView, foreground-only, destroyed on close → fresh shim on\n // next open).\n var outboundSeq = 1;\n var ready = false;\n var channelHandlers = Object.create(null);\n var openHandlers = [];\n var closeHandlers = [];\n // Queued glassly.send calls before glassly.ready() acks. FIFO drained\n // on ack. Buffered so user input (button taps, etc.) isn't dropped\n // when the WebView mounts faster than the host expects.\n var outboundQueue = [];\n // Inbound payloads that arrived before any glassly.on subscriber was\n // registered for the channel. The background side fires\n // session.ui.onOpen handlers as soon as the WebView posts {type:'ready'},\n // and on a fast bridge the resulting ui.send round-trips back before\n // React useEffects have had a chance to attach listeners. Without\n // buffering, the very first snapshot (the one a controller pushes from\n // its ui.onOpen handler to hydrate the fresh UI) is silently dropped.\n //\n // Drain policy: the queue for a channel is flushed into the FIRST\n // glassly.on(channel, ...) subscriber, then discarded. Subsequent\n // sends with no listener fall back to the old drop-on-floor behaviour\n // — we don't want a re-subscribe to replay stale state.\n //\n // Cap: 32 entries per channel, oldest dropped on overflow. Bounds the\n // memory cost when a controller pushes to a channel that no UI page\n // ever subscribes to.\n var pendingByChannel = Object.create(null);\n var PENDING_CAP_PER_CHANNEL = 32;\n\n function postEnvelope(envelope) {\n var rnPost = getRnPost();\n if (!rnPost) return;\n try { rnPost(JSON.stringify(envelope)); } catch (_) {}\n }\n\n function send(channel, payload) {\n var seq = outboundSeq++;\n var envelope = { type: 'msg', seq: seq, channel: String(channel), payload: payload };\n if (!ready) {\n outboundQueue.push(envelope);\n return;\n }\n postEnvelope(envelope);\n }\n\n function flushQueue() {\n while (outboundQueue.length > 0) {\n postEnvelope(outboundQueue.shift());\n }\n }\n\n // NOTE: console.* tap lives in miniappGlobals.ts (injected alongside\n // this shim for every UI WebView, two-layer or single-bundle). That\n // shim posts {payload:{type:\"dev_log\", ...}} envelopes which\n // LocalMiniappRuntime forwards to the dev sidecar tagged source:\"ui\".\n // We don't re-wrap here to avoid double-delivery.\n\n function on(channel, cb) {\n if (typeof cb !== 'function') return function () {};\n var list = channelHandlers[channel];\n var firstSubscriber = !list || list.length === 0;\n if (!list) { list = []; channelHandlers[channel] = list; }\n list.push(cb);\n // Drain any payloads buffered before this channel had a listener.\n // Only fired on the first subscriber for the channel — a later\n // re-subscribe (after an unsubscribe) does NOT replay history.\n if (firstSubscriber) {\n var pending = pendingByChannel[channel];\n if (pending) {\n delete pendingByChannel[channel];\n for (var i = 0; i < pending.length; i++) {\n try { cb(pending[i]); } catch (e) {}\n }\n }\n }\n return function () {\n var idx = list.indexOf(cb);\n if (idx >= 0) list.splice(idx, 1);\n };\n }\n\n // ── RPC ─────────────────────────────────────────────────────────────\n // Outbound RPC: every glassly.request() generates a request id, sends a\n // 'msg' envelope tagged with requestId, and stashes a one-shot resolver\n // keyed on the id. The background-side reply is a recv('msg') with the\n // same channel + requestId; we route it directly to the resolver.\n //\n // Cancellation: caller's AbortSignal triggers a 'cancel' envelope to\n // background and rejects the local promise with a DOM-standard\n // AbortError. The background side's UI_CANCEL handler aborts the\n // handler's ctx.signal and drops the reply.\n var rpcCounter = 0;\n var rpcInflight = Object.create(null);\n\n function makeRequestId() {\n rpcCounter += 1;\n return 'r' + rpcCounter + '-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 8);\n }\n\n function RpcError(message, code, stage, transport) {\n var e = new Error(message);\n e.name = 'RpcError';\n if (code) {\n try { e.cause = {code: code}; } catch (_) { /* old runtimes */ }\n e.code = code;\n }\n // Diagnostic fields ride as own props so a miniapp can show exactly which\n // pipeline stage and transport failed, not just a message string.\n if (stage) e.stage = stage;\n if (transport) e.transport = transport;\n return e;\n }\n\n function RpcTimeoutError(message) {\n var e = new Error(message || 'RPC timed out');\n e.name = 'RpcTimeoutError';\n return e;\n }\n\n function makeAbortError() {\n var e;\n try { e = new DOMException('aborted', 'AbortError'); } catch (_) {\n e = new Error('aborted');\n e.name = 'AbortError';\n }\n return e;\n }\n\n function request(channel, payload, options) {\n var opts = options || {};\n var signal = opts.signal;\n var timeoutMs = typeof opts.timeout === 'number' ? opts.timeout : null;\n var id = makeRequestId();\n\n return new Promise(function (resolve, reject) {\n var done = false;\n var timeoutHandle = null;\n var abortListener = null;\n\n function cleanup() {\n if (done) return;\n done = true;\n delete rpcInflight[id];\n if (timeoutHandle != null) { clearTimeout(timeoutHandle); timeoutHandle = null; }\n if (signal && abortListener) {\n try { signal.removeEventListener('abort', abortListener); } catch (_) {}\n }\n }\n\n function settle(envelope) {\n if (done) return;\n cleanup();\n if (envelope && envelope.ok === true) {\n resolve(envelope.result);\n } else if (envelope && envelope.ok === false) {\n reject(RpcError(envelope.error && envelope.error.message || 'RPC failed', envelope.error && envelope.error.code, envelope.error && envelope.error.stage, envelope.error && envelope.error.transport));\n } else {\n reject(RpcError('malformed RPC reply'));\n }\n }\n\n rpcInflight[id] = settle;\n\n if (signal) {\n if (signal.aborted) {\n cleanup();\n reject(makeAbortError());\n return;\n }\n abortListener = function () {\n if (done) return;\n cleanup();\n postEnvelope({type: 'cancel', requestId: id});\n reject(makeAbortError());\n };\n try { signal.addEventListener('abort', abortListener); } catch (_) {}\n }\n\n if (timeoutMs != null) {\n timeoutHandle = setTimeout(function () {\n if (done) return;\n cleanup();\n postEnvelope({type: 'cancel', requestId: id});\n reject(RpcTimeoutError());\n }, timeoutMs);\n }\n\n var envelope = {type: 'msg', seq: outboundSeq++, channel: String(channel), payload: payload, requestId: id};\n if (!ready) {\n outboundQueue.push(envelope);\n return;\n }\n postEnvelope(envelope);\n });\n }\n\n function onOpen(cb) {\n if (typeof cb !== 'function') return function () {};\n openHandlers.push(cb);\n if (ready) {\n try { cb(); } catch (e) {}\n }\n return function () {\n var idx = openHandlers.indexOf(cb);\n if (idx >= 0) openHandlers.splice(idx, 1);\n };\n }\n\n function onClose(cb) {\n if (typeof cb !== 'function') return function () {};\n closeHandlers.push(cb);\n return function () {\n var idx = closeHandlers.indexOf(cb);\n if (idx >= 0) closeHandlers.splice(idx, 1);\n };\n }\n\n function readyFn() {\n if (ready) return;\n ready = true;\n postEnvelope({ type: 'ready' });\n flushQueue();\n for (var i = 0; i < openHandlers.length; i++) {\n try { openHandlers[i](); } catch (e) {}\n }\n }\n\n function setBackgroundColorFn(color) {\n // Tells the host what to paint the native WebView layer (the surface\n // exposed during keyboard push-up / resize animations, which page CSS\n // cannot reach). Host validates and falls back to its theme background.\n if (typeof color !== 'string' || !color) return;\n postEnvelope({ type: 'set_background', color: color });\n }\n\n function fireChannel(channel, payload) {\n var list = channelHandlers[channel];\n if (!list || list.length === 0) {\n // No subscriber yet — stash for the first glassly.on(channel, ...).\n // Bounded FIFO: drop the oldest when capped so a stuck channel\n // can't grow unbounded.\n var q = pendingByChannel[channel];\n if (!q) { q = []; pendingByChannel[channel] = q; }\n q.push(payload);\n if (q.length > PENDING_CAP_PER_CHANNEL) q.shift();\n return;\n }\n for (var i = 0; i < list.length; i++) {\n try { list[i](payload); } catch (e) {}\n }\n }\n\n function recv(envelope) {\n if (!envelope || typeof envelope !== 'object') return;\n var type = envelope.type;\n if (type === 'msg' && typeof envelope.channel === 'string') {\n // RPC frames carry a requestId; broadcast frames don't. Treat them\n // as disjoint — never fall through from RPC to broadcast. An orphan\n // RPC reply (caller already aborted/timed out) is silently dropped.\n if (typeof envelope.requestId === 'string') {\n var settle = rpcInflight[envelope.requestId];\n if (settle) settle(envelope.payload);\n return;\n }\n fireChannel(envelope.channel, envelope.payload);\n return;\n }\n if (type === 'open') {\n for (var j = 0; j < openHandlers.length; j++) {\n try { openHandlers[j](); } catch (e) {}\n }\n return;\n }\n if (type === 'close') {\n for (var k = 0; k < closeHandlers.length; k++) {\n try { closeHandlers[k](); } catch (e) {}\n }\n return;\n }\n if (type === 'cancel' && typeof envelope.requestId === 'string') {\n // Background-side cancel (reserved; currently unused). If we had a\n // future bidirectional RPC this would abort an in-flight UI handler.\n return;\n }\n if (type === 'ack') {\n return;\n }\n }\n\n window.glassly = {\n send: send,\n on: on,\n request: request,\n onOpen: onOpen,\n onClose: onClose,\n ready: readyFn,\n setBackgroundColor: setBackgroundColorFn,\n /** @internal — packageName for diagnostic logs only. */\n _packageName: packageName,\n };\n window.__host = { recv: recv };\n})();\n`.trim()\n}\n"]}
1
+ {"version":3,"file":"uiShim.js","sourceRoot":"","sources":["../../src/services/uiShim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAQH,MAAM,UAAU,WAAW,CAAC,OAAsB;IAChD,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3D,+DAA+D;IAC/D,mEAAmE;IACnE,yDAAyD;IACzD,OAAO;;;;sBAIa,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoVpC,CAAC,IAAI,EAAE,CAAA;AACR,CAAC","sourcesContent":["/**\n * window.glassly — WebView-side bridge to the per-miniapp background JSContext.\n *\n * Injected into every UI WebView via `injectedJavaScriptBeforeContentLoaded`\n * (iOS) or `injectedJavaScriptObject` + a bundler-emitted inline `<script>`\n * (Android, where the `BeforeContentLoaded` prop is documented unreliable\n * per react-native-webview issues #1099 / #1609).\n *\n * The shim:\n * - Buffers `glassly.send(channel, payload)` calls until `glassly.ready()`\n * fires + the host acks the channel is open. WebView-side BUFFERS (the\n * WebView is the short-lived side and shouldn't drop user input).\n * - Installs `window.__host.recv(envelope)` for the host to push\n * background → WebView messages via `webview.injectJavaScript(...)`.\n * - Sends `__heartbeat__` every 5s; host considers the WebView gone\n * after 15s of silence.\n * - Maintains monotonic seq numbers; the host's per-WebView dedup window\n * drops replays during reconnect.\n *\n * This file exports a `buildUiShim()` function returning the JS\n * source as a string. The host's UIRouter wraps it inside the\n * existing WebView setup so a single bundler-time string emission covers\n * both platforms.\n *\n * IMPORTANT: the shim runs in the WebView's bare ECMAScript scope before\n * the miniapp's bundle. It must not import anything; the source is one\n * IIFE. The only injected dependencies are\n * `window.ReactNativeWebView.postMessage` (provided by react-native-webview)\n * and (on Android) `window.ReactNativeWebView.injectedObjectJson()`\n * (provided when the host sets `injectedJavaScriptObject`).\n */\n\nexport interface UiShimOptions {\n packageName: string\n /** @deprecated No longer used — heartbeat removed since WebViews are foreground-only. */\n heartbeatIntervalMs?: number\n}\n\nexport function buildUiShim(options: UiShimOptions): string {\n const packageNameJson = JSON.stringify(options.packageName)\n // The IIFE assembles a typed `glassly` global plus an internal\n // `__host` for host inbound calls. Quoted strings are JSON-safe so\n // direct injection inside another JS literal also works.\n return `\n(function () {\n if (typeof window === 'undefined') return;\n if (window.glassly && window.__host) return;\n var packageName = ${packageNameJson};\n // Resolve window.ReactNativeWebView.postMessage LAZILY, not once at shim-eval.\n // On Android the shim is injected as a WebViewCompat document-start script\n // (so it beats the page bundle and the ready handshake can't be raced — see\n // the react-native-webview patch). But the order in which that document-start\n // script runs vs. the WebMessageListener that installs\n // window.ReactNativeWebView is not contractually fixed on Android the way it\n // is on iOS (postMessageScript is registered before atStartScript there). If\n // we captured rnPost once and the bridge object wasn't installed yet, every\n // postMessage — including {type:'ready'} — would be silently dropped and the\n // splash would hang forever. Resolving per-call means we always pick up the\n // bridge once it exists, which it reliably does by the time the bundle mounts\n // and calls glassly.ready().\n function getRnPost() {\n try {\n return window.ReactNativeWebView && typeof window.ReactNativeWebView.postMessage === 'function'\n ? window.ReactNativeWebView.postMessage.bind(window.ReactNativeWebView)\n : null;\n } catch (e) { return null; }\n }\n\n // Outbound seq number — purely a log-correlation aid (the host's\n // router doesn't dedup anymore since reconnect can't happen: one\n // WebView, foreground-only, destroyed on close → fresh shim on\n // next open).\n var outboundSeq = 1;\n var ready = false;\n var channelHandlers = Object.create(null);\n var openHandlers = [];\n var closeHandlers = [];\n // Queued glassly.send calls before glassly.ready() acks. FIFO drained\n // on ack. Buffered so user input (button taps, etc.) isn't dropped\n // when the WebView mounts faster than the host expects.\n var outboundQueue = [];\n // Inbound payloads that arrived before any glassly.on subscriber was\n // registered for the channel. The background side fires\n // session.ui.onOpen handlers as soon as the WebView posts {type:'ready'},\n // and on a fast bridge the resulting ui.send round-trips back before\n // React useEffects have had a chance to attach listeners. Without\n // buffering, the very first snapshot (the one a controller pushes from\n // its ui.onOpen handler to hydrate the fresh UI) is silently dropped.\n //\n // Drain policy: the queue for a channel is flushed into the FIRST\n // glassly.on(channel, ...) subscriber, then discarded. Subsequent\n // sends with no listener fall back to the old drop-on-floor behaviour\n // — we don't want a re-subscribe to replay stale state.\n //\n // Cap: 32 entries per channel, oldest dropped on overflow. Bounds the\n // memory cost when a controller pushes to a channel that no UI page\n // ever subscribes to.\n var pendingByChannel = Object.create(null);\n var PENDING_CAP_PER_CHANNEL = 32;\n\n function postEnvelope(envelope) {\n var rnPost = getRnPost();\n if (!rnPost) return;\n try { rnPost(JSON.stringify(envelope)); } catch (_) {}\n }\n\n function send(channel, payload) {\n var seq = outboundSeq++;\n var envelope = { type: 'msg', seq: seq, channel: String(channel), payload: payload };\n if (!ready) {\n outboundQueue.push(envelope);\n return;\n }\n postEnvelope(envelope);\n }\n\n function flushQueue() {\n while (outboundQueue.length > 0) {\n postEnvelope(outboundQueue.shift());\n }\n }\n\n // NOTE: console.* tap lives in miniappGlobals.ts (injected alongside\n // this shim for every UI WebView, two-layer or single-bundle). That\n // shim posts {payload:{type:\"dev_log\", ...}} envelopes which\n // LocalMiniappRuntime forwards to the dev sidecar tagged source:\"ui\".\n // We don't re-wrap here to avoid double-delivery.\n\n function on(channel, cb) {\n if (typeof cb !== 'function') return function () {};\n var list = channelHandlers[channel];\n var firstSubscriber = !list || list.length === 0;\n if (!list) { list = []; channelHandlers[channel] = list; }\n list.push(cb);\n // Drain any payloads buffered before this channel had a listener.\n // Only fired on the first subscriber for the channel — a later\n // re-subscribe (after an unsubscribe) does NOT replay history.\n if (firstSubscriber) {\n var pending = pendingByChannel[channel];\n if (pending) {\n delete pendingByChannel[channel];\n for (var i = 0; i < pending.length; i++) {\n try { cb(pending[i]); } catch (e) {}\n }\n }\n }\n return function () {\n var idx = list.indexOf(cb);\n if (idx >= 0) list.splice(idx, 1);\n };\n }\n\n // ── RPC ─────────────────────────────────────────────────────────────\n // Outbound RPC: every glassly.request() generates a request id, sends a\n // 'msg' envelope tagged with requestId, and stashes a one-shot resolver\n // keyed on the id. The background-side reply is a recv('msg') with the\n // same channel + requestId; we route it directly to the resolver.\n //\n // Cancellation: caller's AbortSignal triggers a 'cancel' envelope to\n // background and rejects the local promise with a DOM-standard\n // AbortError. The background side's UI_CANCEL handler aborts the\n // handler's ctx.signal and drops the reply.\n var rpcCounter = 0;\n var rpcInflight = Object.create(null);\n\n function makeRequestId() {\n rpcCounter += 1;\n return 'r' + rpcCounter + '-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 8);\n }\n\n function RpcError(message, code, stage, transport) {\n var e = new Error(message);\n e.name = 'RpcError';\n if (code) {\n try { e.cause = {code: code}; } catch (_) { /* old runtimes */ }\n e.code = code;\n }\n // Diagnostic fields ride as own props so a miniapp can show exactly which\n // pipeline stage and transport failed, not just a message string.\n if (stage) e.stage = stage;\n if (transport) e.transport = transport;\n return e;\n }\n\n function RpcTimeoutError(message) {\n var e = new Error(message || 'RPC timed out');\n e.name = 'RpcTimeoutError';\n return e;\n }\n\n function makeAbortError() {\n var e;\n try { e = new DOMException('aborted', 'AbortError'); } catch (_) {\n e = new Error('aborted');\n e.name = 'AbortError';\n }\n return e;\n }\n\n function request(channel, payload, options) {\n var opts = options || {};\n var signal = opts.signal;\n var timeoutMs = typeof opts.timeout === 'number' ? opts.timeout : null;\n var id = makeRequestId();\n\n return new Promise(function (resolve, reject) {\n var done = false;\n var timeoutHandle = null;\n var abortListener = null;\n\n function cleanup() {\n if (done) return;\n done = true;\n delete rpcInflight[id];\n if (timeoutHandle != null) { clearTimeout(timeoutHandle); timeoutHandle = null; }\n if (signal && abortListener) {\n try { signal.removeEventListener('abort', abortListener); } catch (_) {}\n }\n }\n\n function settle(envelope) {\n if (done) return;\n cleanup();\n if (envelope && envelope.ok === true) {\n resolve(envelope.result);\n } else if (envelope && envelope.ok === false) {\n reject(RpcError(envelope.error && envelope.error.message || 'RPC failed', envelope.error && envelope.error.code, envelope.error && envelope.error.stage, envelope.error && envelope.error.transport));\n } else {\n reject(RpcError('malformed RPC reply'));\n }\n }\n\n rpcInflight[id] = settle;\n\n if (signal) {\n if (signal.aborted) {\n cleanup();\n reject(makeAbortError());\n return;\n }\n abortListener = function () {\n if (done) return;\n cleanup();\n postEnvelope({type: 'cancel', requestId: id});\n reject(makeAbortError());\n };\n try { signal.addEventListener('abort', abortListener); } catch (_) {}\n }\n\n if (timeoutMs != null) {\n timeoutHandle = setTimeout(function () {\n if (done) return;\n cleanup();\n postEnvelope({type: 'cancel', requestId: id});\n reject(RpcTimeoutError());\n }, timeoutMs);\n }\n\n var envelope = {type: 'msg', seq: outboundSeq++, channel: String(channel), payload: payload, requestId: id};\n if (!ready) {\n outboundQueue.push(envelope);\n return;\n }\n postEnvelope(envelope);\n });\n }\n\n function onOpen(cb) {\n if (typeof cb !== 'function') return function () {};\n openHandlers.push(cb);\n if (ready) {\n try { cb(); } catch (e) {}\n }\n return function () {\n var idx = openHandlers.indexOf(cb);\n if (idx >= 0) openHandlers.splice(idx, 1);\n };\n }\n\n function onClose(cb) {\n if (typeof cb !== 'function') return function () {};\n closeHandlers.push(cb);\n return function () {\n var idx = closeHandlers.indexOf(cb);\n if (idx >= 0) closeHandlers.splice(idx, 1);\n };\n }\n\n function readyFn() {\n if (ready) return;\n ready = true;\n postEnvelope({ type: 'ready' });\n flushQueue();\n for (var i = 0; i < openHandlers.length; i++) {\n try { openHandlers[i](); } catch (e) {}\n }\n }\n\n function setBackgroundColorFn(color) {\n // Tells the host what to paint the native WebView layer (the surface\n // exposed during keyboard push-up / resize animations, which page CSS\n // cannot reach). Host validates and falls back to its theme background.\n if (typeof color !== 'string' || !color) return;\n postEnvelope({ type: 'set_background', color: color });\n }\n\n var backHandler = null;\n\n function setBackActionFn(handler) {\n backHandler = typeof handler === 'function' ? handler : null;\n postEnvelope({ type: 'set_back_action', shown: backHandler !== null });\n }\n\n function fireChannel(channel, payload) {\n var list = channelHandlers[channel];\n if (!list || list.length === 0) {\n // No subscriber yet — stash for the first glassly.on(channel, ...).\n // Bounded FIFO: drop the oldest when capped so a stuck channel\n // can't grow unbounded.\n var q = pendingByChannel[channel];\n if (!q) { q = []; pendingByChannel[channel] = q; }\n q.push(payload);\n if (q.length > PENDING_CAP_PER_CHANNEL) q.shift();\n return;\n }\n for (var i = 0; i < list.length; i++) {\n try { list[i](payload); } catch (e) {}\n }\n }\n\n function recv(envelope) {\n if (!envelope || typeof envelope !== 'object') return;\n var type = envelope.type;\n if (type === 'msg' && typeof envelope.channel === 'string') {\n // RPC frames carry a requestId; broadcast frames don't. Treat them\n // as disjoint — never fall through from RPC to broadcast. An orphan\n // RPC reply (caller already aborted/timed out) is silently dropped.\n if (typeof envelope.requestId === 'string') {\n var settle = rpcInflight[envelope.requestId];\n if (settle) settle(envelope.payload);\n return;\n }\n fireChannel(envelope.channel, envelope.payload);\n return;\n }\n if (type === 'open') {\n for (var j = 0; j < openHandlers.length; j++) {\n try { openHandlers[j](); } catch (e) {}\n }\n return;\n }\n if (type === 'close') {\n for (var k = 0; k < closeHandlers.length; k++) {\n try { closeHandlers[k](); } catch (e) {}\n }\n return;\n }\n if (type === 'back') {\n if (backHandler) {\n try { backHandler(); } catch (e) {}\n }\n return;\n }\n if (type === 'cancel' && typeof envelope.requestId === 'string') {\n // Background-side cancel (reserved; currently unused). If we had a\n // future bidirectional RPC this would abort an in-flight UI handler.\n return;\n }\n if (type === 'ack') {\n return;\n }\n }\n\n window.glassly = {\n send: send,\n on: on,\n request: request,\n onOpen: onOpen,\n onClose: onClose,\n ready: readyFn,\n setBackgroundColor: setBackgroundColorFn,\n setBackAction: setBackActionFn,\n /** @internal — packageName for diagnostic logs only. */\n _packageName: packageName,\n };\n window.__host = { recv: recv };\n})();\n`.trim()\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"appVisibility.d.ts","sourceRoot":"","sources":["../../src/stores/appVisibility.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,eAAO,MAAM,eAAe,GAAI,KAAK;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,KAAG,OAC/B,CAAA;AAEzC,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,OAAO,EAAE,YAAY,OAAO,KAAG,OACrD,CAAA;AAE9B;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAA2D,CAAA;AAEnH,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,KAAG,OAAmD,CAAA;AAE7G;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAKjD,CAAA;AAEF,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,EAAE,iBAAiB,OAAO,KAAG,OACzB,CAAA;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAkC,CAAA;AAE1F,uFAAuF;AACvF,eAAO,MAAM,kBAAkB,GAC7B,aAAa,MAAM,EACnB,iBAAiB,OAAO,EACxB,kBAAkB,OAAO,KACxB,OAA4F,CAAA"}
1
+ {"version":3,"file":"appVisibility.d.ts","sourceRoot":"","sources":["../../src/stores/appVisibility.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,eAAO,MAAM,eAAe,GAAI,KAAK;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,KAAG,OAC/B,CAAA;AAEzC,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,OAAO,EAAE,YAAY,OAAO,KAAG,OACrD,CAAA;AAE9B;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAA2D,CAAA;AAEnH,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,KAAG,OAAmD,CAAA;AAE7G;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAKjD,CAAA;AAEF,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,EAAE,iBAAiB,OAAO,KAAG,OACzB,CAAA;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAkC,CAAA;AAE1F,uFAAuF;AACvF,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,EAAE,iBAAiB,OAAO,EAAE,kBAAkB,OAAO,KAAG,OAC3B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"appVisibility.js","sourceRoot":"","sources":["../../src/stores/appVisibility.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAqC,EAAW,EAAE,CAChF,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAA;AAEzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,cAAuB,EAAE,UAAmB,EAAW,EAAE,CAC3F,cAAc,IAAI,UAAU,CAAA;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC,CAAA;AAEnH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,WAAmB,EAAW,EAAE,CAAC,uBAAuB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAE7G;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,wBAAwB;IACxB,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;CACtB,CAAC,CAAA;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAE,eAAwB,EAAW,EAAE,CAC1F,CAAC,eAAe,IAAI,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAA;AAE1F,uFAAuF;AACvF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,WAAmB,EACnB,eAAwB,EACxB,gBAAyB,EAChB,EAAE,CAAC,CAAC,eAAe,IAAI,CAAC,gBAAgB,IAAI,uBAAuB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA","sourcesContent":["/** Host built-in phone pages and dashboard-type miniapps: never launched from a glasses menu. */\nexport const isSystemMiniapp = (app: {offline: boolean; type: string}): boolean =>\n app.offline || app.type === \"dashboard\"\n\n/** Combine registry-enforced visibility with the user's home-screen choice. */\nexport const resolveHiddenStatus = (registryHidden: boolean, userHidden: boolean): boolean =>\n registryHidden || userHidden\n\n/**\n * Miniapps that start off the primary home screen. They stay listed under\n * \"view all apps\", where \"Add to Home\" saves an explicit choice that wins\n * over this default from then on.\n */\nexport const DEFAULT_HIDDEN_PACKAGES: ReadonlySet<string> = new Set([\"com.glassly.camera\", \"com.glassly.recorder\"])\n\n/** The home-screen visibility of an app the user has never hidden or added. */\nexport const defaultHiddenStatus = (packageName: string): boolean => DEFAULT_HIDDEN_PACKAGES.has(packageName)\n\n/**\n * Miniapps that exist only for developers: the Miniapp Developer launcher and\n * the bundled sample/test miniapps. They are projected into the app store\n * only while the `dev_tools` setting is on; off, they are absent from every\n * launcher surface (home, all apps, glasses menu, AI listing), not merely\n * hidden from the primary home screen.\n */\nexport const DEV_TOOLS_PACKAGES: ReadonlySet<string> = new Set([\n \"com.glassly.miniappdev\",\n \"com.glassly.example\",\n \"com.glassly.tetris\",\n \"com.glassly.compass\",\n])\n\n/** True when the app is dev-only and developer tools are off. */\nexport const isGatedByDevTools = (packageName: string, devToolsEnabled: boolean): boolean =>\n !devToolsEnabled && DEV_TOOLS_PACKAGES.has(packageName)\n\n/**\n * Miniapps that unlock once a real pair of glasses has been paired on this\n * phone (`has_paired_glasses`, latched by PairedGlassesLatch and never\n * cleared, so forgetting the glasses keeps them). Developer tools open them\n * early. Until either, they are absent from every launcher surface like the\n * dev-only set above.\n */\nexport const PAIRED_GLASSES_PACKAGES: ReadonlySet<string> = new Set([\"com.glassly.store\"])\n\n/** True when the app waits on a pairing that hasn't happened and dev tools are off. */\nexport const isGatedUntilPaired = (\n packageName: string,\n devToolsEnabled: boolean,\n hasPairedGlasses: boolean,\n): boolean => !devToolsEnabled && !hasPairedGlasses && PAIRED_GLASSES_PACKAGES.has(packageName)\n"]}
1
+ {"version":3,"file":"appVisibility.js","sourceRoot":"","sources":["../../src/stores/appVisibility.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAqC,EAAW,EAAE,CAChF,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAA;AAEzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,cAAuB,EAAE,UAAmB,EAAW,EAAE,CAC3F,cAAc,IAAI,UAAU,CAAA;AAE9B;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC,CAAA;AAEnH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,WAAmB,EAAW,EAAE,CAAC,uBAAuB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAE7G;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,wBAAwB;IACxB,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;CACtB,CAAC,CAAA;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAE,eAAwB,EAAW,EAAE,CAC1F,CAAC,eAAe,IAAI,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAA;AAE1F,uFAAuF;AACvF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,WAAmB,EAAE,eAAwB,EAAE,gBAAyB,EAAW,EAAE,CACtH,CAAC,eAAe,IAAI,CAAC,gBAAgB,IAAI,uBAAuB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA","sourcesContent":["/** Host built-in phone pages and dashboard-type miniapps: never launched from a glasses menu. */\nexport const isSystemMiniapp = (app: {offline: boolean; type: string}): boolean =>\n app.offline || app.type === \"dashboard\"\n\n/** Combine registry-enforced visibility with the user's home-screen choice. */\nexport const resolveHiddenStatus = (registryHidden: boolean, userHidden: boolean): boolean =>\n registryHidden || userHidden\n\n/**\n * Miniapps that start off the primary home screen. They stay listed under\n * \"view all apps\", where \"Add to Home\" saves an explicit choice that wins\n * over this default from then on.\n */\nexport const DEFAULT_HIDDEN_PACKAGES: ReadonlySet<string> = new Set([\"com.glassly.camera\", \"com.glassly.recorder\"])\n\n/** The home-screen visibility of an app the user has never hidden or added. */\nexport const defaultHiddenStatus = (packageName: string): boolean => DEFAULT_HIDDEN_PACKAGES.has(packageName)\n\n/**\n * Miniapps that exist only for developers: the Miniapp Developer launcher and\n * the bundled sample/test miniapps. They are projected into the app store\n * only while the `dev_tools` setting is on; off, they are absent from every\n * launcher surface (home, all apps, glasses menu, AI listing), not merely\n * hidden from the primary home screen.\n */\nexport const DEV_TOOLS_PACKAGES: ReadonlySet<string> = new Set([\n \"com.glassly.miniappdev\",\n \"com.glassly.example\",\n \"com.glassly.tetris\",\n \"com.glassly.compass\",\n])\n\n/** True when the app is dev-only and developer tools are off. */\nexport const isGatedByDevTools = (packageName: string, devToolsEnabled: boolean): boolean =>\n !devToolsEnabled && DEV_TOOLS_PACKAGES.has(packageName)\n\n/**\n * Miniapps that unlock once a real pair of glasses has been paired on this\n * phone (`has_paired_glasses`, latched by PairedGlassesLatch and never\n * cleared, so forgetting the glasses keeps them). Developer tools open them\n * early. Until either, they are absent from every launcher surface like the\n * dev-only set above.\n */\nexport const PAIRED_GLASSES_PACKAGES: ReadonlySet<string> = new Set([\"com.glassly.store\"])\n\n/** True when the app waits on a pairing that hasn't happened and dev tools are off. */\nexport const isGatedUntilPaired = (packageName: string, devToolsEnabled: boolean, hasPairedGlasses: boolean): boolean =>\n !devToolsEnabled && !hasPairedGlasses && PAIRED_GLASSES_PACKAGES.has(packageName)\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gallerySync.d.ts","sourceRoot":"","sources":["../../src/stores/gallerySync.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,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B;IAC9B,UAAU,EAAE,KAAK,CAAC,iBAAiB;CACpC,CAAC,CAAA","sourcesContent":["/**\n * Gallery Sync Store\n * Manages gallery sync state independently of UI lifecycle\n */\n\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\n// Relocated from the host @/types/asg so this store is self-contained inside\n// engine. The host barrel re-exports this (a shim), so its importers are unchanged.\nexport interface PhotoInfo {\n name: string\n url: string\n download: string\n size: number\n modified: string | number // Unix timestamp (milliseconds) - can be string or number from API\n mime_type?: string\n is_video?: boolean\n thumbnail_data?: string\n downloaded_at?: number\n // Video duration in milliseconds (from glasses sync response)\n duration?: number\n // New fields for filesystem storage\n filePath?: string\n thumbnailPath?: string\n // Glasses model that captured this media\n glassesModel?: string\n}\n\n// Sync state machine states\nexport type SyncState =\n | \"idle\"\n | \"requesting_hotspot\"\n | \"connecting_wifi\"\n | \"syncing\"\n | \"complete\"\n | \"error\"\n | \"cancelled\"\n\nexport interface HotspotInfo {\n ssid: string\n password: string\n ip: string\n}\n\nexport interface SyncQueue {\n files: PhotoInfo[]\n currentIndex: number\n startedAt: number\n hotspotInfo: HotspotInfo\n}\n\nexport interface GallerySyncInfo {\n // State machine\n syncState: SyncState\n syncStarting: boolean\n\n // Progress tracking\n currentFile: string | null\n currentFileProgress: number // 0-100\n completedFiles: number\n totalFiles: number\n failedFiles: string[]\n\n // Queue (persisted separately via localStorageService)\n queue: PhotoInfo[]\n queueIndex: number\n\n // Hotspot info\n hotspotInfo: HotspotInfo | null\n syncServiceOpenedHotspot: boolean\n\n // Gallery status from glasses\n glassesPhotoCount: number\n glassesVideoCount: number\n glassesTotalCount: number\n glassesHasContent: boolean\n\n // Error tracking\n lastError: string | null\n}\n\nexport interface GallerySyncState extends GallerySyncInfo {\n // State transitions\n setSyncState: (state: SyncState) => void\n setSyncStarting: (starting: boolean) => void\n setRequestingHotspot: () => void\n setConnectingWifi: () => void\n setSyncing: (files: PhotoInfo[]) => void\n setSyncComplete: () => void\n setSyncError: (error: string) => void\n setSyncCancelled: () => void\n\n // Progress updates\n setCurrentFile: (fileName: string | null, progress: number) => void\n onFileProgress: (fileName: string, progress: number) => void\n onFileComplete: (fileName: string) => void\n onFileFailed: (fileName: string, error?: string) => void\n onFileProcessing: (fileName: string) => void\n onFileProcessed: (fileName: string) => void\n updateFileInQueue: (fileName: string, updatedFile: PhotoInfo) => void\n removeFilesFromQueue: (fileNames: string[]) => void\n\n // Processing queue tracking\n processingFiles: Set<string>\n processedFiles: number\n\n // Hotspot management\n setHotspotInfo: (info: HotspotInfo | null) => void\n setSyncServiceOpenedHotspot: (opened: boolean) => void\n\n // Gallery status from glasses\n setGlassesGalleryStatus: (photos: number, videos: number, total: number, hasContent: boolean) => void\n clearGlassesGalleryStatus: () => void\n\n // Queue management (for resume)\n setQueue: (files: PhotoInfo[], startIndex?: number) => void\n advanceQueue: () => void\n clearQueue: () => void\n\n // Full reset\n reset: () => void\n}\n\nconst initialState: GallerySyncInfo & {processingFiles: Set<string>; processedFiles: number} = {\n syncState: \"idle\",\n syncStarting: false,\n currentFile: null,\n currentFileProgress: 0,\n completedFiles: 0,\n totalFiles: 0,\n failedFiles: [],\n queue: [],\n queueIndex: 0,\n hotspotInfo: null,\n syncServiceOpenedHotspot: false,\n glassesPhotoCount: 0,\n glassesVideoCount: 0,\n glassesTotalCount: 0,\n glassesHasContent: false,\n lastError: null,\n processingFiles: new Set<string>(),\n processedFiles: 0,\n}\n\nexport const useGallerySyncStore = create<GallerySyncState>()(\n subscribeWithSelector((set, get) => ({\n ...initialState,\n\n // State transitions\n setSyncState: (syncState: SyncState) => set({syncState}),\n setSyncStarting: (syncStarting: boolean) => set({syncStarting}),\n\n setRequestingHotspot: () =>\n set({\n syncState: \"requesting_hotspot\",\n lastError: null,\n failedFiles: [],\n }),\n\n setConnectingWifi: () =>\n set({\n syncState: \"connecting_wifi\",\n }),\n\n setSyncing: (files: PhotoInfo[]) =>\n set({\n syncState: \"syncing\",\n // C4: Strip thumbnail_data (base64) from store to prevent OOM\n queue: files.map(({thumbnail_data: _thumbnailData, ...rest}) => rest),\n queueIndex: 0,\n totalFiles: files.length,\n completedFiles: 0,\n currentFile: files.length > 0 ? files[0].name : null,\n currentFileProgress: 0,\n failedFiles: [],\n lastError: null,\n processedFiles: 0,\n processingFiles: new Set<string>(),\n }),\n\n setSyncComplete: () =>\n set({\n syncState: \"complete\",\n currentFile: null,\n currentFileProgress: 0,\n // Keep queue intact so photos remain visible after sync\n // Don't clear: queue: [], queueIndex: 0\n }),\n\n setSyncError: (error: string) =>\n set({\n syncState: \"error\",\n lastError: error,\n currentFile: null,\n currentFileProgress: 0,\n }),\n\n setSyncCancelled: () =>\n set({\n syncState: \"cancelled\",\n currentFile: null,\n currentFileProgress: 0,\n queue: [],\n queueIndex: 0,\n }),\n\n // Progress updates\n setCurrentFile: (fileName: string | null, progress: number) =>\n set({\n currentFile: fileName,\n currentFileProgress: Math.max(0, Math.min(100, progress)),\n }),\n\n onFileProgress: (fileName: string, progress: number) => {\n const state = get()\n const clampedProgress = Math.max(0, Math.min(100, progress))\n // Throttle: skip update if same file and same percentage (prevents Zustand flood)\n if (clampedProgress === state.currentFileProgress && fileName === state.currentFile) {\n return\n }\n set({\n currentFile: fileName,\n currentFileProgress: clampedProgress,\n })\n },\n\n onFileComplete: (_fileName: string) => {\n const state = get()\n const newCompletedFiles = state.completedFiles + 1\n const newQueueIndex = state.queueIndex + 1\n const nextFile = state.queue[newQueueIndex]\n\n set({\n completedFiles: newCompletedFiles,\n queueIndex: newQueueIndex,\n currentFile: nextFile?.name || null,\n currentFileProgress: 0,\n })\n },\n\n onFileFailed: (fileName: string, _error?: string) => {\n const state = get()\n const newQueueIndex = state.queueIndex + 1\n const nextFile = state.queue[newQueueIndex]\n\n set({\n failedFiles: [...state.failedFiles, fileName],\n queueIndex: newQueueIndex,\n currentFile: nextFile?.name || null,\n currentFileProgress: 0,\n })\n },\n\n onFileProcessing: (fileName: string) => {\n const state = get()\n const newSet = new Set(state.processingFiles)\n newSet.add(fileName)\n set({processingFiles: newSet})\n },\n\n onFileProcessed: (fileName: string) => {\n const state = get()\n const newSet = new Set(state.processingFiles)\n newSet.delete(fileName)\n set({processingFiles: newSet, processedFiles: state.processedFiles + 1})\n },\n\n updateFileInQueue: (fileName: string, updatedFile: PhotoInfo) => {\n const state = get()\n const updatedQueue = state.queue.map((file) => (file.name === fileName ? updatedFile : file))\n set({queue: updatedQueue})\n },\n\n removeFilesFromQueue: (fileNames: string[]) => {\n if (fileNames.length === 0) return\n\n const filesToRemove = new Set(fileNames)\n const state = get()\n const failedFilesSet = new Set(state.failedFiles)\n const filesBeforeQueueIndex = state.queue\n .slice(0, state.queueIndex)\n .filter((file) => filesToRemove.has(file.name))\n const removedBeforeQueueIndex = filesBeforeQueueIndex.length\n const removedCompletedBeforeQueueIndex = filesBeforeQueueIndex.filter(\n (file) => !failedFilesSet.has(file.name),\n ).length\n const filteredQueue = state.queue.filter((file) => !filesToRemove.has(file.name))\n const removedCount = state.queue.length - filteredQueue.length\n\n if (removedCount === 0) return\n\n const nextQueueIndex = state.queueIndex - removedBeforeQueueIndex\n const currentFileRemoved = state.currentFile !== null && filesToRemove.has(state.currentFile)\n\n set({\n queue: filteredQueue,\n totalFiles: state.totalFiles - removedCount,\n completedFiles: Math.max(0, state.completedFiles - removedCompletedBeforeQueueIndex),\n queueIndex: nextQueueIndex,\n failedFiles: state.failedFiles.filter((fileName) => !filesToRemove.has(fileName)),\n processingFiles: new Set(Array.from(state.processingFiles).filter((fileName) => !filesToRemove.has(fileName))),\n currentFile: currentFileRemoved ? filteredQueue[nextQueueIndex]?.name || null : state.currentFile,\n })\n },\n\n // Hotspot management\n setHotspotInfo: (info: HotspotInfo | null) => set({hotspotInfo: info}),\n\n setSyncServiceOpenedHotspot: (opened: boolean) => set({syncServiceOpenedHotspot: opened}),\n\n // Gallery status from glasses\n setGlassesGalleryStatus: (photos: number, videos: number, total: number, hasContent: boolean) => {\n const state = get()\n // Reset to idle if sync is in a terminal state and new content is available\n // This allows syncing again after taking new photos\n const shouldResetToIdle =\n hasContent && (state.syncState === \"complete\" || state.syncState === \"error\" || state.syncState === \"cancelled\")\n\n set({\n glassesPhotoCount: photos,\n glassesVideoCount: videos,\n glassesTotalCount: total,\n glassesHasContent: hasContent,\n ...(shouldResetToIdle ? {syncState: \"idle\" as SyncState} : {}),\n })\n },\n\n clearGlassesGalleryStatus: () =>\n set({\n glassesPhotoCount: 0,\n glassesVideoCount: 0,\n glassesTotalCount: 0,\n glassesHasContent: false,\n }),\n\n // Queue management\n setQueue: (files: PhotoInfo[], startIndex: number = 0) =>\n set({\n // C4: Strip thumbnail_data (base64) from store to prevent OOM\n queue: files.map(({thumbnail_data: _thumbnailData, ...rest}) => rest),\n queueIndex: startIndex,\n totalFiles: files.length,\n completedFiles: startIndex,\n }),\n\n advanceQueue: () => {\n const state = get()\n set({queueIndex: state.queueIndex + 1})\n },\n\n clearQueue: () =>\n set({\n queue: [],\n queueIndex: 0,\n totalFiles: 0,\n completedFiles: 0,\n }),\n\n // Full reset\n reset: () => set({...initialState, processingFiles: new Set<string>()}),\n })),\n)\n\n// Selector helpers for common subscriptions\nexport const selectSyncProgress = (state: GallerySyncState) => ({\n syncState: state.syncState,\n currentFile: state.currentFile,\n currentFileProgress: state.currentFileProgress,\n completedFiles: state.completedFiles,\n totalFiles: state.totalFiles,\n failedFiles: state.failedFiles,\n processingFiles: state.processingFiles,\n})\n\nexport const selectIssyncing = (state: GallerySyncState) =>\n state.syncState === \"syncing\" || state.syncState === \"requesting_hotspot\" || state.syncState === \"connecting_wifi\"\n\nexport const selectGlassesGalleryStatus = (state: GallerySyncState) => ({\n photos: state.glassesPhotoCount,\n videos: state.glassesVideoCount,\n total: state.glassesTotalCount,\n hasContent: state.glassesHasContent,\n})\n"]}
1
+ {"version":3,"file":"gallerySync.js","sourceRoot":"","sources":["../../src/stores/gallerySync.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,MAAM,E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AAmB;IAC9C,cAAc,EAAE,KAAK,CAAC,cAAc;IACpC,UAAU,EAAE,KAAK,CAAC,UAAU;IAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;IAC9B,eAAe,EAAE,KAAK,CAAC,eAAe;CACvC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAuB,EAAE,EAAE,CACzD,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,oBAAoB,IAAI,KAAK,CAAC,SAAS,KAAK,iBAAiB,CAAA;AAEpH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC;IACtE,MAAM,EAAE,KAAK,CAAC,iBAAiB;IAC/B,MAAM,EAAE,KAAK,CAAC,iBAAiB;IAC/B,KAAK,EAAE,KAAK,CAAC,iBAAiB;IAC9B,UAAU,EAAE,KAAK,CAAC,iBAAiB;CACpC,CAAC,CAAA","sourcesContent":["/**\n * Gallery Sync Store\n * Manages gallery sync state independently of UI lifecycle\n */\n\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\n// Relocated from the host @/types/asg so this store is self-contained inside\n// engine. The host barrel re-exports this (a shim), so its importers are unchanged.\nexport interface PhotoInfo {\n name: string\n url: string\n download: string\n size: number\n modified: string | number // Unix timestamp (milliseconds) - can be string or number from API\n mime_type?: string\n is_video?: boolean\n thumbnail_data?: string\n downloaded_at?: number\n // Video duration in milliseconds (from glasses sync response)\n duration?: number\n // New fields for filesystem storage\n filePath?: string\n thumbnailPath?: string\n // Glasses model that captured this media\n glassesModel?: string\n}\n\n// Sync state machine states\nexport type SyncState =\n \"idle\" | \"requesting_hotspot\" | \"connecting_wifi\" | \"syncing\" | \"complete\" | \"error\" | \"cancelled\"\n\nexport interface HotspotInfo {\n ssid: string\n password: string\n ip: string\n}\n\nexport interface SyncQueue {\n files: PhotoInfo[]\n currentIndex: number\n startedAt: number\n hotspotInfo: HotspotInfo\n}\n\nexport interface GallerySyncInfo {\n // State machine\n syncState: SyncState\n syncStarting: boolean\n\n // Progress tracking\n currentFile: string | null\n currentFileProgress: number // 0-100\n completedFiles: number\n totalFiles: number\n failedFiles: string[]\n\n // Queue (persisted separately via localStorageService)\n queue: PhotoInfo[]\n queueIndex: number\n\n // Hotspot info\n hotspotInfo: HotspotInfo | null\n syncServiceOpenedHotspot: boolean\n\n // Gallery status from glasses\n glassesPhotoCount: number\n glassesVideoCount: number\n glassesTotalCount: number\n glassesHasContent: boolean\n\n // Error tracking\n lastError: string | null\n}\n\nexport interface GallerySyncState extends GallerySyncInfo {\n // State transitions\n setSyncState: (state: SyncState) => void\n setSyncStarting: (starting: boolean) => void\n setRequestingHotspot: () => void\n setConnectingWifi: () => void\n setSyncing: (files: PhotoInfo[]) => void\n setSyncComplete: () => void\n setSyncError: (error: string) => void\n setSyncCancelled: () => void\n\n // Progress updates\n setCurrentFile: (fileName: string | null, progress: number) => void\n onFileProgress: (fileName: string, progress: number) => void\n onFileComplete: (fileName: string) => void\n onFileFailed: (fileName: string, error?: string) => void\n onFileProcessing: (fileName: string) => void\n onFileProcessed: (fileName: string) => void\n updateFileInQueue: (fileName: string, updatedFile: PhotoInfo) => void\n removeFilesFromQueue: (fileNames: string[]) => void\n\n // Processing queue tracking\n processingFiles: Set<string>\n processedFiles: number\n\n // Hotspot management\n setHotspotInfo: (info: HotspotInfo | null) => void\n setSyncServiceOpenedHotspot: (opened: boolean) => void\n\n // Gallery status from glasses\n setGlassesGalleryStatus: (photos: number, videos: number, total: number, hasContent: boolean) => void\n clearGlassesGalleryStatus: () => void\n\n // Queue management (for resume)\n setQueue: (files: PhotoInfo[], startIndex?: number) => void\n advanceQueue: () => void\n clearQueue: () => void\n\n // Full reset\n reset: () => void\n}\n\nconst initialState: GallerySyncInfo & {processingFiles: Set<string>; processedFiles: number} = {\n syncState: \"idle\",\n syncStarting: false,\n currentFile: null,\n currentFileProgress: 0,\n completedFiles: 0,\n totalFiles: 0,\n failedFiles: [],\n queue: [],\n queueIndex: 0,\n hotspotInfo: null,\n syncServiceOpenedHotspot: false,\n glassesPhotoCount: 0,\n glassesVideoCount: 0,\n glassesTotalCount: 0,\n glassesHasContent: false,\n lastError: null,\n processingFiles: new Set<string>(),\n processedFiles: 0,\n}\n\nexport const useGallerySyncStore = create<GallerySyncState>()(\n subscribeWithSelector((set, get) => ({\n ...initialState,\n\n // State transitions\n setSyncState: (syncState: SyncState) => set({syncState}),\n setSyncStarting: (syncStarting: boolean) => set({syncStarting}),\n\n setRequestingHotspot: () =>\n set({\n syncState: \"requesting_hotspot\",\n lastError: null,\n failedFiles: [],\n }),\n\n setConnectingWifi: () =>\n set({\n syncState: \"connecting_wifi\",\n }),\n\n setSyncing: (files: PhotoInfo[]) =>\n set({\n syncState: \"syncing\",\n // C4: Strip thumbnail_data (base64) from store to prevent OOM\n queue: files.map(({thumbnail_data: _thumbnailData, ...rest}) => rest),\n queueIndex: 0,\n totalFiles: files.length,\n completedFiles: 0,\n currentFile: files.length > 0 ? files[0].name : null,\n currentFileProgress: 0,\n failedFiles: [],\n lastError: null,\n processedFiles: 0,\n processingFiles: new Set<string>(),\n }),\n\n setSyncComplete: () =>\n set({\n syncState: \"complete\",\n currentFile: null,\n currentFileProgress: 0,\n // Keep queue intact so photos remain visible after sync\n // Don't clear: queue: [], queueIndex: 0\n }),\n\n setSyncError: (error: string) =>\n set({\n syncState: \"error\",\n lastError: error,\n currentFile: null,\n currentFileProgress: 0,\n }),\n\n setSyncCancelled: () =>\n set({\n syncState: \"cancelled\",\n currentFile: null,\n currentFileProgress: 0,\n queue: [],\n queueIndex: 0,\n }),\n\n // Progress updates\n setCurrentFile: (fileName: string | null, progress: number) =>\n set({\n currentFile: fileName,\n currentFileProgress: Math.max(0, Math.min(100, progress)),\n }),\n\n onFileProgress: (fileName: string, progress: number) => {\n const state = get()\n const clampedProgress = Math.max(0, Math.min(100, progress))\n // Throttle: skip update if same file and same percentage (prevents Zustand flood)\n if (clampedProgress === state.currentFileProgress && fileName === state.currentFile) {\n return\n }\n set({\n currentFile: fileName,\n currentFileProgress: clampedProgress,\n })\n },\n\n onFileComplete: (_fileName: string) => {\n const state = get()\n const newCompletedFiles = state.completedFiles + 1\n const newQueueIndex = state.queueIndex + 1\n const nextFile = state.queue[newQueueIndex]\n\n set({\n completedFiles: newCompletedFiles,\n queueIndex: newQueueIndex,\n currentFile: nextFile?.name || null,\n currentFileProgress: 0,\n })\n },\n\n onFileFailed: (fileName: string, _error?: string) => {\n const state = get()\n const newQueueIndex = state.queueIndex + 1\n const nextFile = state.queue[newQueueIndex]\n\n set({\n failedFiles: [...state.failedFiles, fileName],\n queueIndex: newQueueIndex,\n currentFile: nextFile?.name || null,\n currentFileProgress: 0,\n })\n },\n\n onFileProcessing: (fileName: string) => {\n const state = get()\n const newSet = new Set(state.processingFiles)\n newSet.add(fileName)\n set({processingFiles: newSet})\n },\n\n onFileProcessed: (fileName: string) => {\n const state = get()\n const newSet = new Set(state.processingFiles)\n newSet.delete(fileName)\n set({processingFiles: newSet, processedFiles: state.processedFiles + 1})\n },\n\n updateFileInQueue: (fileName: string, updatedFile: PhotoInfo) => {\n const state = get()\n const updatedQueue = state.queue.map((file) => (file.name === fileName ? updatedFile : file))\n set({queue: updatedQueue})\n },\n\n removeFilesFromQueue: (fileNames: string[]) => {\n if (fileNames.length === 0) return\n\n const filesToRemove = new Set(fileNames)\n const state = get()\n const failedFilesSet = new Set(state.failedFiles)\n const filesBeforeQueueIndex = state.queue\n .slice(0, state.queueIndex)\n .filter((file) => filesToRemove.has(file.name))\n const removedBeforeQueueIndex = filesBeforeQueueIndex.length\n const removedCompletedBeforeQueueIndex = filesBeforeQueueIndex.filter(\n (file) => !failedFilesSet.has(file.name),\n ).length\n const filteredQueue = state.queue.filter((file) => !filesToRemove.has(file.name))\n const removedCount = state.queue.length - filteredQueue.length\n\n if (removedCount === 0) return\n\n const nextQueueIndex = state.queueIndex - removedBeforeQueueIndex\n const currentFileRemoved = state.currentFile !== null && filesToRemove.has(state.currentFile)\n\n set({\n queue: filteredQueue,\n totalFiles: state.totalFiles - removedCount,\n completedFiles: Math.max(0, state.completedFiles - removedCompletedBeforeQueueIndex),\n queueIndex: nextQueueIndex,\n failedFiles: state.failedFiles.filter((fileName) => !filesToRemove.has(fileName)),\n processingFiles: new Set(Array.from(state.processingFiles).filter((fileName) => !filesToRemove.has(fileName))),\n currentFile: currentFileRemoved ? filteredQueue[nextQueueIndex]?.name || null : state.currentFile,\n })\n },\n\n // Hotspot management\n setHotspotInfo: (info: HotspotInfo | null) => set({hotspotInfo: info}),\n\n setSyncServiceOpenedHotspot: (opened: boolean) => set({syncServiceOpenedHotspot: opened}),\n\n // Gallery status from glasses\n setGlassesGalleryStatus: (photos: number, videos: number, total: number, hasContent: boolean) => {\n const state = get()\n // Reset to idle if sync is in a terminal state and new content is available\n // This allows syncing again after taking new photos\n const shouldResetToIdle =\n hasContent && (state.syncState === \"complete\" || state.syncState === \"error\" || state.syncState === \"cancelled\")\n\n set({\n glassesPhotoCount: photos,\n glassesVideoCount: videos,\n glassesTotalCount: total,\n glassesHasContent: hasContent,\n ...(shouldResetToIdle ? {syncState: \"idle\" as SyncState} : {}),\n })\n },\n\n clearGlassesGalleryStatus: () =>\n set({\n glassesPhotoCount: 0,\n glassesVideoCount: 0,\n glassesTotalCount: 0,\n glassesHasContent: false,\n }),\n\n // Queue management\n setQueue: (files: PhotoInfo[], startIndex: number = 0) =>\n set({\n // C4: Strip thumbnail_data (base64) from store to prevent OOM\n queue: files.map(({thumbnail_data: _thumbnailData, ...rest}) => rest),\n queueIndex: startIndex,\n totalFiles: files.length,\n completedFiles: startIndex,\n }),\n\n advanceQueue: () => {\n const state = get()\n set({queueIndex: state.queueIndex + 1})\n },\n\n clearQueue: () =>\n set({\n queue: [],\n queueIndex: 0,\n totalFiles: 0,\n completedFiles: 0,\n }),\n\n // Full reset\n reset: () => set({...initialState, processingFiles: new Set<string>()}),\n })),\n)\n\n// Selector helpers for common subscriptions\nexport const selectSyncProgress = (state: GallerySyncState) => ({\n syncState: state.syncState,\n currentFile: state.currentFile,\n currentFileProgress: state.currentFileProgress,\n completedFiles: state.completedFiles,\n totalFiles: state.totalFiles,\n failedFiles: state.failedFiles,\n processingFiles: state.processingFiles,\n})\n\nexport const selectIssyncing = (state: GallerySyncState) =>\n state.syncState === \"syncing\" || state.syncState === \"requesting_hotspot\" || state.syncState === \"connecting_wifi\"\n\nexport const selectGlassesGalleryStatus = (state: GallerySyncState) => ({\n photos: state.glassesPhotoCount,\n videos: state.glassesVideoCount,\n total: state.glassesTotalCount,\n hasContent: state.glassesHasContent,\n})\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/stores/glasses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EAEvB,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EAEpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAQvG,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,CAAA;AAEnE,eAAO,MAAM,sBAAsB,GAAI,OAAO;IAAC,UAAU,EAAE,uBAAuB,CAAA;CAAC,YAC7C,CAAA;AAEtC,eAAO,MAAM,kBAAkB,GAAI,OAAO;IAAC,UAAU,EAAE,uBAAuB,CAAA;CAAC,YAAqC,CAAA;AAEpH,KAAK,mBAAmB,GAAG,mBAAmB,GAAG;IAC/C,kBAAkB,EAAE,aAAa,GAAG,IAAI,CAAA;IACxC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACvD,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,OAA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AAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,KAAK,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,GAAG,mBAAmB,CAAA;AA2B9F,eAAO,MAAM,oBAAoB,GAAI,OAAO,mBAAmB;;;;;;;;;;CAgB9D,CAAA;AA6ED,eAAO,MAAM,eAAe;;;;;;;;EAsH3B,CAAA;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,YAAY,EAC9D,KAAK,CAAC,EACN,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,OAAO,EAC9C,kBAAgB,KACf,OAAO,CAAC,OAAO,CAuBjB,CAAA"}
@@ -77,6 +77,7 @@ const initialState = {
77
77
  sceneCanvasWidth: 0,
78
78
  sceneCanvasHeight: 0,
79
79
  sceneVector: false,
80
+ sceneStereo: false,
80
81
  sceneSettle: false,
81
82
  volumeGate: false,
82
83
  firmwareUpdateAvailable: false,