@mentra/engine 3.1.0-dev.4 → 3.1.0-dev.42

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 (103) hide show
  1. package/README.md +19 -5
  2. package/build/bluetooth-sdk/ota-transport.d.ts +2 -0
  3. package/build/bluetooth-sdk/ota-transport.d.ts.map +1 -0
  4. package/build/bluetooth-sdk/ota-transport.js +2 -0
  5. package/build/bluetooth-sdk/ota-transport.js.map +1 -0
  6. package/build/engine.d.ts +5 -2
  7. package/build/engine.d.ts.map +1 -1
  8. package/build/facades/ota.d.ts +9 -6
  9. package/build/facades/ota.d.ts.map +1 -1
  10. package/build/facades/ota.js +6 -4
  11. package/build/facades/ota.js.map +1 -1
  12. package/build/facades/pairing.d.ts +4 -0
  13. package/build/facades/pairing.d.ts.map +1 -1
  14. package/build/facades/pairing.js +81 -7
  15. package/build/facades/pairing.js.map +1 -1
  16. package/build/generated/releaseMetadata.js +5 -5
  17. package/build/generated/releaseMetadata.js.map +1 -1
  18. package/build/index.d.ts +1 -1
  19. package/build/index.d.ts.map +1 -1
  20. package/build/index.js.map +1 -1
  21. package/build/react/MentraLiveOtaFlow.d.ts +3 -2
  22. package/build/react/MentraLiveOtaFlow.d.ts.map +1 -1
  23. package/build/react/MentraLiveOtaFlow.js +113 -352
  24. package/build/react/MentraLiveOtaFlow.js.map +1 -1
  25. package/build/react/index.d.ts +1 -0
  26. package/build/react/index.d.ts.map +1 -1
  27. package/build/react/index.js +1 -0
  28. package/build/react/index.js.map +1 -1
  29. package/build/react/useMentraLiveOta.d.ts +80 -0
  30. package/build/react/useMentraLiveOta.d.ts.map +1 -0
  31. package/build/react/useMentraLiveOta.js +550 -0
  32. package/build/react/useMentraLiveOta.js.map +1 -0
  33. package/build/services/BlobStore.d.ts +2 -0
  34. package/build/services/BlobStore.d.ts.map +1 -1
  35. package/build/services/BlobStore.js +63 -10
  36. package/build/services/BlobStore.js.map +1 -1
  37. package/build/services/GlassesStatusProjection.d.ts +15 -2
  38. package/build/services/GlassesStatusProjection.d.ts.map +1 -1
  39. package/build/services/GlassesStatusProjection.js +3 -3
  40. package/build/services/GlassesStatusProjection.js.map +1 -1
  41. package/build/services/HotspotOtaTransport.d.ts.map +1 -1
  42. package/build/services/HotspotOtaTransport.js +8 -7
  43. package/build/services/HotspotOtaTransport.js.map +1 -1
  44. package/build/services/OtaAutoChain.d.ts +9 -2
  45. package/build/services/OtaAutoChain.d.ts.map +1 -1
  46. package/build/services/OtaAutoChain.js +10 -2
  47. package/build/services/OtaAutoChain.js.map +1 -1
  48. package/build/services/OtaInstallCoordinator.d.ts +24 -3
  49. package/build/services/OtaInstallCoordinator.d.ts.map +1 -1
  50. package/build/services/OtaInstallCoordinator.js +14 -12
  51. package/build/services/OtaInstallCoordinator.js.map +1 -1
  52. package/build/services/OtaService.d.ts.map +1 -1
  53. package/build/services/OtaService.js +1 -1
  54. package/build/services/OtaService.js.map +1 -1
  55. package/build/services/OtaUpdateCheckService.d.ts +4 -1
  56. package/build/services/OtaUpdateCheckService.d.ts.map +1 -1
  57. package/build/services/OtaUpdateCheckService.js +21 -5
  58. package/build/services/OtaUpdateCheckService.js.map +1 -1
  59. package/build/services/asg/localNetworkTransport.d.ts.map +1 -1
  60. package/build/services/asg/localNetworkTransport.js +13 -12
  61. package/build/services/asg/localNetworkTransport.js.map +1 -1
  62. package/build/services/glassesClockSync.js +1 -1
  63. package/build/services/glassesClockSync.js.map +1 -1
  64. package/build/services/otaReleaseVersion.d.ts +10 -0
  65. package/build/services/otaReleaseVersion.d.ts.map +1 -0
  66. package/build/services/otaReleaseVersion.js +14 -0
  67. package/build/services/otaReleaseVersion.js.map +1 -0
  68. package/build/stores/appVisibility.d.ts +3 -0
  69. package/build/stores/appVisibility.d.ts.map +1 -0
  70. package/build/stores/appVisibility.js +3 -0
  71. package/build/stores/appVisibility.js.map +1 -0
  72. package/build/stores/apps.d.ts.map +1 -1
  73. package/build/stores/apps.js +7 -1
  74. package/build/stores/apps.js.map +1 -1
  75. package/build/stores/core.d.ts +3 -3
  76. package/build/stores/core.d.ts.map +1 -1
  77. package/build/stores/core.js.map +1 -1
  78. package/build/stores/glasses.d.ts +10 -4
  79. package/build/stores/glasses.d.ts.map +1 -1
  80. package/build/stores/glasses.js.map +1 -1
  81. package/package.json +12 -6
  82. package/src/bluetooth-sdk/ota-transport.ts +1 -0
  83. package/src/facades/ota.ts +16 -5
  84. package/src/facades/pairing.ts +88 -12
  85. package/src/generated/releaseMetadata.ts +5 -5
  86. package/src/index.ts +1 -0
  87. package/src/react/MentraLiveOtaFlow.tsx +178 -465
  88. package/src/react/index.ts +14 -0
  89. package/src/react/useMentraLiveOta.ts +707 -0
  90. package/src/services/BlobStore.ts +57 -10
  91. package/src/services/GlassesStatusProjection.ts +7 -6
  92. package/src/services/HotspotOtaTransport.ts +8 -7
  93. package/src/services/OtaAutoChain.ts +26 -2
  94. package/src/services/OtaInstallCoordinator.ts +16 -13
  95. package/src/services/OtaService.ts +1 -2
  96. package/src/services/OtaUpdateCheckService.ts +26 -8
  97. package/src/services/asg/localNetworkTransport.ts +20 -19
  98. package/src/services/glassesClockSync.ts +1 -1
  99. package/src/services/otaReleaseVersion.ts +22 -0
  100. package/src/stores/appVisibility.ts +3 -0
  101. package/src/stores/apps.ts +7 -1
  102. package/src/stores/core.ts +4 -4
  103. package/src/stores/glasses.ts +13 -6
@@ -13,6 +13,7 @@ import BluetoothSdk from "@mentra/bluetooth-sdk/internal"
13
13
  import type {ConnectOptions, Device, DeviceModel, PairFailureEvent, GlassesNotReadyEvent} from "@mentra/bluetooth-sdk"
14
14
  import {useCoreStore} from "../stores/core"
15
15
  import {useGlassesStore} from "../stores/glasses"
16
+ import {SETTINGS, useSettingsStore} from "../stores/settings"
16
17
  import {hasDefaultDevice} from "../services/DeviceStoreHydration"
17
18
  import {
18
19
  markPendingSelection,
@@ -20,18 +21,14 @@ import {
20
21
  subscribePairingIdentity,
21
22
  type IdentitySnapshot,
22
23
  } from "../services/PairingIdentity"
23
- import {
24
- isGlassesConnected,
25
- isGlassesLinkLayerBusy,
26
- isGlassesReady,
27
- waitForGlassesReady,
28
- } from "../services/GlassesReadiness"
24
+ import {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady} from "../services/GlassesReadiness"
29
25
  import {
30
26
  logAutomaticReportSubmissionStatus,
31
27
  toAutomaticReportSubmissionStatus,
32
28
  type AutomaticReportSubmissionStatus,
33
29
  } from "../services/AutomaticReportResult"
34
30
  import {pushAllBluetoothSettings} from "../services/GlassesSettingsSync"
31
+ import {ControllerTypes} from "../types"
35
32
  import {submitAutomaticReport} from "./reports"
36
33
 
37
34
  export type {IdentitySnapshot} from "../services/PairingIdentity"
@@ -60,6 +57,82 @@ function projectReadiness() {
60
57
  }
61
58
  }
62
59
 
60
+ function projectTargetReady(options: Pick<PairingReadyWaitOptions, "deviceModel" | "deviceName">): boolean {
61
+ const {deviceModel, deviceName} = options
62
+ const glasses = useGlassesStore.getState()
63
+
64
+ if (deviceModel === ControllerTypes.R1) {
65
+ if (!glasses.controllerConnected || !glasses.controllerFullyBooted) return false
66
+ const settings = useSettingsStore.getState()
67
+ const pairedModel = settings.getSetting(SETTINGS.default_controller.key)
68
+ const pairedName = settings.getSetting(SETTINGS.controller_device_name.key)
69
+ return (!deviceModel || pairedModel === deviceModel) && (!deviceName || pairedName === deviceName)
70
+ }
71
+
72
+ if (!isGlassesReady(glasses.connection)) return false
73
+ const identity = projectPairingIdentity()
74
+ if (!deviceModel && !deviceName) return true
75
+ return (
76
+ identity.kind === "paired" &&
77
+ (!deviceModel || identity.model === deviceModel) &&
78
+ (!deviceName || identity.name === deviceName)
79
+ )
80
+ }
81
+
82
+ function subscribeTargetReady(
83
+ options: Pick<PairingReadyWaitOptions, "deviceModel" | "deviceName">,
84
+ cb: (ready: boolean) => void,
85
+ ): () => void {
86
+ let last = projectTargetReady(options)
87
+ const notify = () => {
88
+ const ready = projectTargetReady(options)
89
+ if (ready === last) return
90
+ last = ready
91
+ cb(ready)
92
+ }
93
+ const unsubscribeGlasses = useGlassesStore.subscribe(notify)
94
+ const unsubscribeSettings = useSettingsStore.subscribe(notify)
95
+ return () => {
96
+ unsubscribeGlasses()
97
+ unsubscribeSettings()
98
+ }
99
+ }
100
+
101
+ async function waitForTargetReady(options: PairingReadyWaitOptions, timeoutMs: number): Promise<boolean> {
102
+ return new Promise((resolve) => {
103
+ if (options.signal?.aborted) {
104
+ resolve(false)
105
+ return
106
+ }
107
+ if (projectTargetReady(options)) {
108
+ resolve(true)
109
+ return
110
+ }
111
+
112
+ let settled = false
113
+ let timeout: ReturnType<typeof setTimeout> | null = null
114
+ let unsubscribe: (() => void) | null = null
115
+ let onAbort: (() => void) | null = null
116
+ const finish = (ready: boolean) => {
117
+ if (settled) return
118
+ settled = true
119
+ if (timeout) clearTimeout(timeout)
120
+ if (unsubscribe) unsubscribe()
121
+ if (onAbort && options.signal) options.signal.removeEventListener("abort", onAbort)
122
+ resolve(ready)
123
+ }
124
+
125
+ unsubscribe = subscribeTargetReady(options, (ready) => {
126
+ if (ready) finish(true)
127
+ })
128
+ if (options.signal) {
129
+ onAbort = () => finish(false)
130
+ options.signal.addEventListener("abort", onAbort)
131
+ }
132
+ timeout = setTimeout(() => finish(projectTargetReady(options)), timeoutMs)
133
+ })
134
+ }
135
+
63
136
  export type PairingReadinessSnapshot = ReturnType<typeof projectReadiness>
64
137
 
65
138
  export async function submitPairingBootTimeoutReport(params: {
@@ -108,12 +181,7 @@ async function waitForReadyDuringPairing(options: PairingReadyWaitOptions = {}):
108
181
  })
109
182
 
110
183
  try {
111
- const ready = await waitForGlassesReady({
112
- getConnection: () => useGlassesStore.getState().connection,
113
- subscribe: (listener) => useGlassesStore.subscribe((state) => state.connection, listener),
114
- timeoutMs,
115
- signal: options.signal,
116
- })
184
+ const ready = await waitForTargetReady(options, timeoutMs)
117
185
 
118
186
  if (!ready && !options.signal?.aborted) {
119
187
  void submitPairingBootTimeoutReport({
@@ -193,6 +261,14 @@ export const pairing = {
193
261
  cb(snap)
194
262
  })
195
263
  },
264
+ /** Whether the exact wearable or controller selected on the scan screen is ready. */
265
+ targetReady: (options: Pick<PairingReadyWaitOptions, "deviceModel" | "deviceName">): boolean =>
266
+ projectTargetReady(options),
267
+ /** Subscribe to readiness for the exact selected target, excluding stale devices. */
268
+ onTargetReady: (
269
+ options: Pick<PairingReadyWaitOptions, "deviceModel" | "deviceName">,
270
+ cb: (ready: boolean) => void,
271
+ ): (() => void) => subscribeTargetReady(options, cb),
196
272
 
197
273
  // --- pairing-identity lifecycle (the PairingIdentity read-model + the JS-owned
198
274
  // identity writes; promotion to `paired` only ever happens natively) ---
@@ -12,9 +12,9 @@ export interface EngineReleaseMetadata {
12
12
  export const ENGINE_RELEASE_METADATA: Readonly<EngineReleaseMetadata> = Object.freeze({
13
13
  "schemaVersion": 1,
14
14
  "familyBaseVersion": "3.1.0",
15
- "releaseIdentity": "3.1.0-dev.4",
16
- "releaseSetId": "mentra-3.1.0-dev.4",
17
- "sourceCommit": "43b81aea1c84675fade024077063e45fddde4861",
18
- "otaManifestUrl": "https://github.com/Mentra-Community/MentraOS/releases/download/mentra-v3.1.0-dev.4/mentra-live-ota-3.1.0-dev.4.json",
19
- "otaManifestSha256": "8fbea7589345658dc5dffcb394229ffc5c52fbe75352acb8f6827d83290ce750"
15
+ "releaseIdentity": "3.1.0-dev.42",
16
+ "releaseSetId": "mentra-3.1.0-dev.42",
17
+ "sourceCommit": "7534f9991fff2345ea9428c5df85e81ddfbbbf90",
18
+ "otaManifestUrl": "https://github.com/Mentra-Community/MentraOS/releases/download/mentra-builds-v3.1.0/mentra-live-ota-3.1.0-dev.42.json",
19
+ "otaManifestSha256": "21d811e95aa17bda834dec4cc6b17c66ae917c74e1b1b1f0e2a886b7c00235ee"
20
20
  })
package/src/index.ts CHANGED
@@ -98,6 +98,7 @@ export type {
98
98
  OtaProgressStatus,
99
99
  OtaStatus,
100
100
  OtaUpdateInfo,
101
+ ReleaseChangelog,
101
102
  OtaSnapshot,
102
103
  OtaInstallSnapshot,
103
104
  } from "./facades/ota"