@mentra/engine 0.1.0-dev.1 → 3.1.0-dev.4

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 (136) hide show
  1. package/README.md +20 -24
  2. package/build/bluetooth-sdk/debug.d.ts +2 -0
  3. package/build/bluetooth-sdk/debug.d.ts.map +1 -0
  4. package/build/bluetooth-sdk/debug.js +2 -0
  5. package/build/bluetooth-sdk/debug.js.map +1 -0
  6. package/build/bluetooth-sdk/index.d.ts +3 -0
  7. package/build/bluetooth-sdk/index.d.ts.map +1 -0
  8. package/build/bluetooth-sdk/index.js +3 -0
  9. package/build/bluetooth-sdk/index.js.map +1 -0
  10. package/build/bluetooth-sdk/photo-receiver.d.ts +3 -0
  11. package/build/bluetooth-sdk/photo-receiver.d.ts.map +1 -0
  12. package/build/bluetooth-sdk/photo-receiver.js +3 -0
  13. package/build/bluetooth-sdk/photo-receiver.js.map +1 -0
  14. package/build/bluetooth-sdk/react.d.ts +2 -0
  15. package/build/bluetooth-sdk/react.d.ts.map +1 -0
  16. package/build/bluetooth-sdk/react.js +2 -0
  17. package/build/bluetooth-sdk/react.js.map +1 -0
  18. package/build/bluetooth-sdk/types.d.ts +2 -0
  19. package/build/bluetooth-sdk/types.d.ts.map +1 -0
  20. package/build/bluetooth-sdk/types.js +2 -0
  21. package/build/bluetooth-sdk/types.js.map +1 -0
  22. package/build/engine.d.ts +13 -13
  23. package/build/engine.d.ts.map +1 -1
  24. package/build/engine.js +2 -2
  25. package/build/engine.js.map +1 -1
  26. package/build/facades/display.d.ts +1 -1
  27. package/build/facades/display.d.ts.map +1 -1
  28. package/build/facades/display.js +1 -1
  29. package/build/facades/display.js.map +1 -1
  30. package/build/facades/glasses.d.ts +3 -13
  31. package/build/facades/glasses.d.ts.map +1 -1
  32. package/build/facades/glasses.js +3 -3
  33. package/build/facades/glasses.js.map +1 -1
  34. package/build/facades/ota.d.ts +5 -16
  35. package/build/facades/ota.d.ts.map +1 -1
  36. package/build/facades/ota.js +3 -3
  37. package/build/facades/ota.js.map +1 -1
  38. package/build/facades/pairing.d.ts +4 -5
  39. package/build/facades/pairing.d.ts.map +1 -1
  40. package/build/facades/pairing.js +2 -2
  41. package/build/facades/pairing.js.map +1 -1
  42. package/build/facades/speech.d.ts +7 -6
  43. package/build/facades/speech.d.ts.map +1 -1
  44. package/build/facades/speech.js +1 -1
  45. package/build/facades/speech.js.map +1 -1
  46. package/build/generated/releaseMetadata.d.ts +12 -0
  47. package/build/generated/releaseMetadata.d.ts.map +1 -0
  48. package/build/generated/releaseMetadata.js +10 -0
  49. package/build/generated/releaseMetadata.js.map +1 -0
  50. package/build/index.d.ts +4 -5
  51. package/build/index.d.ts.map +1 -1
  52. package/build/index.js +2 -3
  53. package/build/index.js.map +1 -1
  54. package/build/services/AppRegistry.d.ts +8 -0
  55. package/build/services/AppRegistry.d.ts.map +1 -1
  56. package/build/services/AppRegistry.js +15 -0
  57. package/build/services/AppRegistry.js.map +1 -1
  58. package/build/services/OtaInstallCoordinator.d.ts +1 -1
  59. package/build/services/OtaInstallCoordinator.d.ts.map +1 -1
  60. package/build/services/OtaInstallCoordinator.js +3 -0
  61. package/build/services/OtaInstallCoordinator.js.map +1 -1
  62. package/build/services/OtaUpdateCheckService.d.ts +1 -1
  63. package/build/services/OtaUpdateCheckService.d.ts.map +1 -1
  64. package/build/services/OtaUpdateCheckService.js +12 -16
  65. package/build/services/OtaUpdateCheckService.js.map +1 -1
  66. package/build/services/glassesClockSync.d.ts.map +1 -1
  67. package/build/services/glassesClockSync.js +4 -0
  68. package/build/services/glassesClockSync.js.map +1 -1
  69. package/build/services/otaDisplayState.d.ts +1 -1
  70. package/build/services/otaDisplayState.d.ts.map +1 -1
  71. package/build/services/otaDisplayState.js.map +1 -1
  72. package/build/services/otaInstallPolicy.d.ts +1 -1
  73. package/build/services/otaInstallPolicy.d.ts.map +1 -1
  74. package/build/services/otaInstallPolicy.js.map +1 -1
  75. package/build/services/otaLegacyMapping.d.ts +1 -1
  76. package/build/services/otaLegacyMapping.d.ts.map +1 -1
  77. package/build/services/otaLegacyMapping.js.map +1 -1
  78. package/build/services/otaManifestPolicy.d.ts +14 -0
  79. package/build/services/otaManifestPolicy.d.ts.map +1 -0
  80. package/build/services/otaManifestPolicy.js +19 -0
  81. package/build/services/otaManifestPolicy.js.map +1 -0
  82. package/build/services/otaManifestUrl.d.ts +2 -1
  83. package/build/services/otaManifestUrl.d.ts.map +1 -1
  84. package/build/services/otaManifestUrl.js +24 -32
  85. package/build/services/otaManifestUrl.js.map +1 -1
  86. package/build/stores/settings.js +3 -3
  87. package/build/stores/settings.js.map +1 -1
  88. package/build/types/enums.d.ts +1 -25
  89. package/build/types/enums.d.ts.map +1 -1
  90. package/build/types/enums.js +1 -27
  91. package/build/types/enums.js.map +1 -1
  92. package/build/types/hardware.d.ts +3 -13
  93. package/build/types/hardware.d.ts.map +1 -1
  94. package/build/types/hardware.js +1 -3
  95. package/build/types/hardware.js.map +1 -1
  96. package/build/types/index.d.ts +2 -6
  97. package/build/types/index.d.ts.map +1 -1
  98. package/build/types/index.js +2 -6
  99. package/build/types/index.js.map +1 -1
  100. package/package.json +40 -22
  101. package/src/bluetooth-sdk/debug.ts +1 -0
  102. package/src/bluetooth-sdk/index.ts +2 -0
  103. package/src/bluetooth-sdk/photo-receiver.ts +2 -0
  104. package/src/bluetooth-sdk/react.ts +1 -0
  105. package/src/bluetooth-sdk/types.ts +1 -0
  106. package/src/engine.ts +2 -2
  107. package/src/facades/display.ts +1 -1
  108. package/src/facades/glasses.ts +4 -4
  109. package/src/facades/ota.ts +4 -4
  110. package/src/facades/pairing.ts +4 -4
  111. package/src/facades/speech.ts +21 -7
  112. package/src/generated/releaseMetadata.ts +20 -0
  113. package/src/index.ts +13 -11
  114. package/src/services/AppRegistry.ts +16 -0
  115. package/src/services/OtaInstallCoordinator.ts +4 -1
  116. package/src/services/OtaUpdateCheckService.ts +20 -20
  117. package/src/services/glassesClockSync.ts +4 -0
  118. package/src/services/otaDisplayState.ts +1 -1
  119. package/src/services/otaInstallPolicy.ts +1 -1
  120. package/src/services/otaLegacyMapping.ts +1 -1
  121. package/src/services/otaManifestPolicy.ts +42 -0
  122. package/src/services/otaManifestUrl.ts +27 -36
  123. package/src/stores/settings.ts +3 -3
  124. package/src/types/enums.ts +1 -27
  125. package/src/types/hardware.ts +3 -13
  126. package/src/types/index.ts +2 -6
  127. package/build/devtools.d.ts +0 -11
  128. package/build/devtools.d.ts.map +0 -1
  129. package/build/devtools.js +0 -13
  130. package/build/devtools.js.map +0 -1
  131. package/build/internal.d.ts +0 -67
  132. package/build/internal.d.ts.map +0 -1
  133. package/build/internal.js +0 -90
  134. package/build/internal.js.map +0 -1
  135. package/src/devtools.ts +0 -13
  136. package/src/internal.ts +0 -160
package/README.md CHANGED
@@ -21,7 +21,8 @@ npm install @mentra/engine
21
21
 
22
22
  ## Entry points
23
23
 
24
- The package exposes four entry points (declared in `package.json` `exports`,
24
+ The package exposes its Engine entry points and a supported Bluetooth SDK
25
+ facade (declared in `package.json` `exports`,
25
26
  with the `react-native` condition pointing at `src/` so Metro, tsc and jest
26
27
  resolve live TypeScript source):
27
28
 
@@ -32,19 +33,15 @@ resolve live TypeScript source):
32
33
  OTA policy constants, hardware capability tables, `BgTimer`). Judgment rule:
33
34
  read models, commands, pure functions and types are main; anything that
34
35
  mutates runtime state or exposes a store/service is not.
35
- - **`@mentra/engine/internal`** (`src/internal.ts`) — the migration-era
36
- runtime surface: raw zustand stores (`useCoreStore`, `useSettingsStore`,
37
- `useAppStatusStore`, …) and service singletons (`appRegistry`, `restComms`,
38
- `cloudClientService`, the gallery cluster, the miniapp engine, …). The
39
- host's `@/stores/*` shims re-export from here. New host code should use
40
- `engine.*` instead; `scripts/check-mobile-runtime-boundary.sh` counts every
41
- `/internal` import in `mobile/src` (report-only) as the burn-down metric.
42
- - **`@mentra/engine/devtools`** (`src/devtools.ts`) — debug-only singletons
43
- (`miniappRunningRegistry`, `devServerBridge`) for the internal dev screens.
44
36
  - **`@mentra/engine/ota`** (`src/react/index.ts`) — shared full-screen OTA
45
37
  Native experiences. `MentraLiveOtaFlow` owns the complete check, hotspot or
46
38
  Wi-Fi install, APK/MTK/BES progress, reboot, retry, and final verification
47
39
  flow so hosts do not implement their own OTA state machines.
40
+ - **`@mentra/engine/bluetooth-sdk`** (`src/bluetooth-sdk/index.ts`) — the
41
+ complete public Bluetooth SDK surface, re-exported without a wrapper so it
42
+ has the same singleton identity as `@mentra/bluetooth-sdk`. The supported
43
+ SDK `react`, `types`, `photo-receiver`, and `debug` subpaths are mirrored
44
+ below this path. The SDK's `internal` entrypoint is deliberately not exposed.
48
45
 
49
46
  See `cloud-v2/docs/issues/020-glasses-status-boundary/integration-review.md`
50
47
  §D for the burn-down plan.
@@ -63,16 +60,9 @@ sockets.
63
60
 
64
61
  ```ts
65
62
  import {engine, decideDevLaunchRoute} from "@mentra/engine"
66
- import {webviewBridge, buildMiniappGlobalsScript} from "@mentra/engine/internal"
67
- import {miniappRunningRegistry} from "@mentra/engine/devtools"
63
+ import BluetoothSdk from "@mentra/engine/bluetooth-sdk"
68
64
  ```
69
65
 
70
- - `webviewBridge` — registers per-package WebView message handlers so any
71
- service can `postMessage` JSON into a specific miniapp.
72
- - `miniappRunningRegistry` — session-scoped set of currently-mounted local
73
- miniapp packageNames (foreground + background).
74
- - `buildMiniappGlobalsScript` — builds the `window.MentraOS` injection script
75
- (and CSS variables / console-tap shim) used by every miniapp WebView.
76
66
  - `decideDevLaunchRoute` — pre-flight a dev URL's `miniapp.json` to decide
77
67
  whether to mount live or take the user to the offline screen.
78
68
 
@@ -83,11 +73,7 @@ the authenticated cloud/miniapp runtime:
83
73
 
84
74
  ```tsx
85
75
  import {MentraLiveOtaFlow} from "@mentra/engine/ota"
86
-
87
- <MentraLiveOtaFlow
88
- onFinished={() => setShowOta(false)}
89
- onOpenWifiSetup={() => setShowWifiSetup(true)}
90
- />
76
+ ;<MentraLiveOtaFlow onFinished={() => setShowOta(false)} onOpenWifiSetup={() => setShowWifiSetup(true)} />
91
77
  ```
92
78
 
93
79
  The component starts only the glasses-status and OTA projections. A host that
@@ -96,6 +82,16 @@ the flow after a Mentra Live connects. Hosts must provide `onOpenWifiSetup`;
96
82
  the flow invokes it only for older glasses that cannot provide the OTA hotspot
97
83
  transport.
98
84
 
85
+ Released Engine packages contain a literal immutable OTA manifest URL and
86
+ SHA-256 generated by coordinated release CI. Modern-glasses manifest selection
87
+ is developer override, host-app release pin, then Engine release pin. It does
88
+ not derive a URL from the Bluetooth SDK version or fall through to a
89
+ glasses-reported or mutable production URL. An unpinned source build has OTA
90
+ disabled unless an Expo/React Native host explicitly sets
91
+ `EXPO_PUBLIC_ASG_OTA_VERSION_URL`; native source hosts use the Bluetooth SDK's
92
+ debug `setOtaVersionUrl` surface. Pre-39 glasses retain their separate legacy
93
+ path because those clients ignore the URL sent by the phone.
94
+
99
95
  ## Imports
100
96
 
101
97
  Inside `mobile/modules/engine/src/`, use **relative paths** (`./services/...`,
@@ -117,4 +113,4 @@ combined run. Per-file processes give every suite an isolated registry.
117
113
 
118
114
  The same rule applies when writing tests: it is fine to `mock.module` any
119
115
  specifier your suite needs, but never rely on a mock installed by a
120
- *different* test file — each file must set up everything it imports.
116
+ _different_ test file — each file must set up everything it imports.
@@ -0,0 +1,2 @@
1
+ export * from "@mentra/bluetooth-sdk/debug";
2
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/bluetooth-sdk/debug.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "@mentra/bluetooth-sdk/debug";
2
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/bluetooth-sdk/debug.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA","sourcesContent":["export * from \"@mentra/bluetooth-sdk/debug\"\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from "@mentra/bluetooth-sdk";
2
+ export * from "@mentra/bluetooth-sdk";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bluetooth-sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAA;AAC7C,cAAc,uBAAuB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { default } from "@mentra/bluetooth-sdk";
2
+ export * from "@mentra/bluetooth-sdk";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bluetooth-sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAA;AAC7C,cAAc,uBAAuB,CAAA","sourcesContent":["export {default} from \"@mentra/bluetooth-sdk\"\nexport * from \"@mentra/bluetooth-sdk\"\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from "@mentra/bluetooth-sdk/photo-receiver";
2
+ export * from "@mentra/bluetooth-sdk/photo-receiver";
3
+ //# sourceMappingURL=photo-receiver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"photo-receiver.d.ts","sourceRoot":"","sources":["../../src/bluetooth-sdk/photo-receiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sCAAsC,CAAA;AAC5D,cAAc,sCAAsC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { default } from "@mentra/bluetooth-sdk/photo-receiver";
2
+ export * from "@mentra/bluetooth-sdk/photo-receiver";
3
+ //# sourceMappingURL=photo-receiver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"photo-receiver.js","sourceRoot":"","sources":["../../src/bluetooth-sdk/photo-receiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sCAAsC,CAAA;AAC5D,cAAc,sCAAsC,CAAA","sourcesContent":["export {default} from \"@mentra/bluetooth-sdk/photo-receiver\"\nexport * from \"@mentra/bluetooth-sdk/photo-receiver\"\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "@mentra/bluetooth-sdk/react";
2
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/bluetooth-sdk/react.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "@mentra/bluetooth-sdk/react";
2
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/bluetooth-sdk/react.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA","sourcesContent":["export * from \"@mentra/bluetooth-sdk/react\"\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "@mentra/bluetooth-sdk/types";
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bluetooth-sdk/types.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "@mentra/bluetooth-sdk/types";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/bluetooth-sdk/types.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA","sourcesContent":["export * from \"@mentra/bluetooth-sdk/types\"\n"]}
package/build/engine.d.ts CHANGED
@@ -5,8 +5,8 @@
5
5
  * name stays `engine` in code; the public API surface is `engine`.)
6
6
  *
7
7
  * It grows one facade at a time. The migration-era flat store/service exports
8
- * live on the `@mentra/engine/internal` entry (and the debug singletons on
9
- * `@mentra/engine/devtools`); they shrink as screens move onto `engine.*`.
8
+ * remain in a private MentraOS host package; they shrink as screens move onto
9
+ * `engine.*`.
10
10
  */
11
11
  import { configure, updateUiSeams } from "./runtime/bootstrap";
12
12
  export declare const engine: {
@@ -25,7 +25,7 @@ export declare const engine: {
25
25
  connectDefault: () => Promise<void>;
26
26
  disconnect: () => Promise<void>;
27
27
  forget: () => Promise<void>;
28
- connect: (device: import("@mentra/bluetooth-sdk").Device, options?: import("@mentra/bluetooth-sdk").ConnectOptions | undefined) => Promise<void>;
28
+ connect: (device: import("@mentra/bluetooth-sdk").Device, options?: import("@mentra/bluetooth-sdk").ConnectOptions) => Promise<void>;
29
29
  connectSimulated: () => Promise<void>;
30
30
  setDefault: (device: import("@mentra/bluetooth-sdk").Device | null) => Promise<void>;
31
31
  reconnect: () => Promise<boolean>;
@@ -71,14 +71,14 @@ export declare const engine: {
71
71
  restartTranscriber: () => Promise<void>;
72
72
  stt: {
73
73
  currentLanguage: () => string;
74
- languages: () => import("./internal").SttLanguageConfig[];
75
- languageInfo: () => Promise<import("./internal").SttLanguageInfo[]>;
76
- download: (code?: string | undefined, onProgress?: ((progress: import("./internal").SttDownloadProgress) => void) | undefined, onExtractionProgress?: ((progress: import("./internal").SttExtractionProgress) => void) | undefined) => Promise<void>;
74
+ languages: () => import("./services/STTModelManager").LanguageConfig[];
75
+ languageInfo: () => Promise<import("./services/STTModelManager").LanguageInfo[]>;
76
+ download: (code?: string | undefined, onProgress?: ((progress: import("./services/STTModelManager").DownloadProgress) => void) | undefined, onExtractionProgress?: ((progress: import("./services/STTModelManager").ExtractionProgress) => void) | undefined) => Promise<void>;
77
77
  activate: (code: string) => void;
78
78
  cancelDownload: () => Promise<void>;
79
79
  deleteModel: (code?: string | undefined) => Promise<void>;
80
- status: () => import("./internal").OfflineModelDownloadStatus | null;
81
- onStatusChanged: (listener: (status: import("./internal").OfflineModelDownloadStatus | null) => void) => () => void;
80
+ status: () => import("./services/OfflineSpeechModelService").DownloadStatus | null;
81
+ onStatusChanged: (listener: (status: import("./services/OfflineSpeechModelService").DownloadStatus | null) => void) => (() => void);
82
82
  };
83
83
  tts: {
84
84
  currentLanguage: () => string;
@@ -141,12 +141,12 @@ export declare const engine: {
141
141
  /** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */
142
142
  ota: {
143
143
  initialize: () => Promise<void>;
144
- install: (otaVersionUrl?: string | null | undefined) => Promise<import("@mentra/bluetooth-sdk").OtaStartAckEvent>;
144
+ install: (otaVersionUrl?: string | null) => Promise<import("@mentra/bluetooth-sdk").OtaStartAckEvent>;
145
145
  ping: () => Promise<void>;
146
146
  checkForUpdates: (options?: import(".").OtaCheckCurrentGlassesOptions) => Promise<import(".").OtaCheckCurrentGlassesResult>;
147
147
  clearUpdateAvailable: () => void;
148
148
  clearProgress: () => void;
149
- replacePendingUpdateSequence: (updates: import("@mentra/bluetooth-sdk/internal").OtaUpdateInfo["updates"]) => import("@mentra/bluetooth-sdk/internal").OtaUpdateInfo | null;
149
+ replacePendingUpdateSequence: (updates: import("@mentra/bluetooth-sdk").OtaUpdateInfo["updates"]) => import("@mentra/bluetooth-sdk").OtaUpdateInfo | null;
150
150
  clearBuildNumberForNextCheck: () => void;
151
151
  markMtkUpdatedThisSession: (updated: boolean) => void;
152
152
  installSession: {
@@ -159,10 +159,10 @@ export declare const engine: {
159
159
  snapshot: () => import(".").OtaInstallSnapshot;
160
160
  onSnapshot: (cb: (snapshot: import(".").OtaInstallSnapshot) => void) => (() => void);
161
161
  };
162
- updateAvailable: () => import("@mentra/bluetooth-sdk/internal").OtaUpdateInfo | null;
162
+ updateAvailable: () => import("@mentra/bluetooth-sdk").OtaUpdateInfo | null;
163
163
  status: () => import("@mentra/bluetooth-sdk").OtaStatus | null;
164
164
  snapshot: () => import(".").OtaSnapshot;
165
- onUpdateAvailable: (cb: (info: import("@mentra/bluetooth-sdk/internal").OtaUpdateInfo | null) => void) => (() => void);
165
+ onUpdateAvailable: (cb: (info: import("@mentra/bluetooth-sdk").OtaUpdateInfo | null) => void) => (() => void);
166
166
  onStatus: (cb: (status: import("@mentra/bluetooth-sdk").OtaStatus | null) => void) => (() => void);
167
167
  onSnapshot: (cb: (snapshot: import(".").OtaSnapshot) => void) => (() => void);
168
168
  };
@@ -222,7 +222,7 @@ export declare const engine: {
222
222
  pairingCode?: string;
223
223
  securePairingCapable?: boolean;
224
224
  }[];
225
- onFound: (cb: (results: ReturnType<() => import("./stores/core").CoreState>["searchResults"]) => void) => (() => void);
225
+ onFound: (cb: (results: import("@mentra/bluetooth-sdk").Device[]) => void) => (() => void);
226
226
  pair: (device: import("@mentra/bluetooth-sdk").Device, options?: import("@mentra/bluetooth-sdk").ConnectOptions) => Promise<void>;
227
227
  setDefault: (device: import("@mentra/bluetooth-sdk").Device | null) => Promise<void>;
228
228
  setBluetoothClassicTarget: (device: import("@mentra/bluetooth-sdk").Device) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,EAAkD,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAmC5G,eAAO,MAAM,MAAM;IACjB,2EAA2E;;IAE3E,8EAA8E;;IAE9E;iDAC6C;;IA0E7C;;yCAEqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BrC,mFAAmF;;;;;;;;IAEnF,sEAAsE;;;;;;;;;;;;IAEtE,qFAAqF;;;gBA9FyB,CAAC;mBACpG,CAAC;;;gBAGgB,CAAC;mBAClB,CAAC;;;;;;;;;;;;;;;;IA2FZ,qEAAqE;;;;IAErE,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEtF,6EAA6E;;;;;;;;;;;;IAE7E,iFAAiF;;;;;;;;;;;;;;;;;;;IAEjF,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE9C,uDAAuD;;;;;;;;;;;;IAEvD,8EAA8E;;;;;;;IAE9E,qFAAqF;;;;;;;;;;;;;;CAGtF,CAAA"}
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,EAAkD,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAmC5G,eAAO,MAAM,MAAM;IACjB,2EAA2E;;IAE3E,8EAA8E;;IAE9E;iDAC6C;;IA0E7C;;yCAEqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BrC,mFAAmF;;;;;;;;IAEnF,sEAAsE;;;;;;;;;;;;IAEtE,qFAAqF;;;gBA7FlC,CAAC;mBAAiB,CAAC;;;gBAKhD,CAAC;mBAAiB,CAAC;;;;;;;;;;;;;;;;IA0FzC,qEAAqE;;;;IAErE,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEtF,6EAA6E;;;;;;;;;;;;IAE7E,iFAAiF;;;;;;;;;;;;;;;;;;;IAEjF,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE9C,uDAAuD;;;;;;;;;;;;IAEvD,8EAA8E;;;;;;;IAE9E,qFAAqF;;;;;;;;;;;;;;CAGtF,CAAA"}
package/build/engine.js CHANGED
@@ -5,8 +5,8 @@
5
5
  * name stays `engine` in code; the public API surface is `engine`.)
6
6
  *
7
7
  * It grows one facade at a time. The migration-era flat store/service exports
8
- * live on the `@mentra/engine/internal` entry (and the debug singletons on
9
- * `@mentra/engine/devtools`); they shrink as screens move onto `engine.*`.
8
+ * remain in a private MentraOS host package; they shrink as screens move onto
9
+ * `engine.*`.
10
10
  */
11
11
  import { configure, start as bootstrapStart, stop as bootstrapStop, updateUiSeams } from "./runtime/bootstrap";
12
12
  import { cloudClientService } from "./services/CloudClientService";
@@ -1 +1 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","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E,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAA;QAC7D,MAAM,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO;IACP,MAAM;IACN,mFAAmF;IACnF,OAAO;IACP,sEAAsE;IACtE,QAAQ;IACR,qFAAqF;IACrF,GAAG;IACH,qEAAqE;IACrE,OAAO;IACP,sFAAsF;IACtF,GAAG;IACH,6EAA6E;IAC7E,OAAO;IACP,iFAAiF;IACjF,QAAQ;IACR,8CAA8C;IAC9C,OAAO;IACP,uDAAuD;IACvD,kBAAkB;IAClB,8EAA8E;IAC9E,WAAW;IACX,qFAAqF;IACrF,aAAa;IACb,OAAO;CACR,CAAA","sourcesContent":["/**\n * `engine` — the namespaced OEM-facing engine API (the \"(A) host API\" from the\n * Phase-1 contract). Host UI calls `engine.<domain>.<method>()`; each domain is a\n * typed facade over the runtime. (Exported from the `@mentra/engine` module, whose\n * name stays `engine` in code; the public API surface is `engine`.)\n *\n * It grows one facade at a time. The migration-era flat store/service exports\n * live on the `@mentra/engine/internal` entry (and the debug singletons on\n * `@mentra/engine/devtools`); they shrink as screens move onto `engine.*`.\n */\nimport {configure, start as bootstrapStart, stop as bootstrapStop, updateUiSeams} from \"./runtime/bootstrap\"\nimport {cloudClientService} from \"./services/CloudClientService\"\nimport {hydrateDeviceStore, demoteOrphanedDefaultWearable} from \"./services/DeviceStoreHydration\"\nimport {startGlassesSettingsSync, stopGlassesSettingsSync} from \"./services/GlassesSettingsSync\"\nimport {startGlassesStatusProjection, stopGlassesStatusProjection} from \"./services/GlassesStatusProjection\"\nimport {startOtaService, stopOtaService} from \"./services/OtaService\"\nimport {startAudioCloudUplink, stopAudioCloudUplink} from \"./services/AudioCloudUplink\"\nimport {startSupportProfileSync, stopSupportProfileSync} from \"./services/SupportProfileSync\"\nimport {startDeviceEventRouter, stopDeviceEventRouter} from \"./services/DeviceEventRouter\"\nimport {startPhoneNotificationsSync, stopPhoneNotificationsSync} from \"./services/PhoneNotificationsSync\"\nimport {startCaptionsTesterReportService, stopCaptionsTesterReportService} from \"./services/CaptionsTesterReportService\"\nimport {\n startMentraJSCrashloopReportService,\n stopMentraJSCrashloopReportService,\n} from \"./services/MentraJSCrashloopReportService\"\nimport {ensureMiniappEngine, stopMiniappEngine} from \"./services/MiniappEngine\"\nimport localMiniappRuntime from \"./services/LocalMiniappRuntime\"\nimport displayProcessor from \"./services/DisplayProcessor\"\nimport {gallerySyncService} from \"./services/asg/gallerySyncService\"\nimport {glasses} from \"./facades/glasses\"\nimport {display} from \"./facades/display\"\nimport {speech} from \"./facades/speech\"\nimport {session} from \"./facades/session\"\nimport {settings} from \"./facades/settings\"\nimport {dev} from \"./facades/dev\"\nimport {reports} from \"./facades/reports\"\nimport {ota} from \"./facades/ota\"\nimport {gallery} from \"./facades/gallery\"\nimport {miniapps} from \"./facades/miniapps\"\nimport {pairing} from \"./facades/pairing\"\nimport {phoneNotifications} from \"./facades/phoneNotifications\"\nimport {permissions} from \"./facades/permissions\"\nimport {notifications} from \"./facades/notifications\"\nimport {logBuffer} from \"./utils/devLogging\"\n\nexport const engine = {\n /** Front door — hand engine auth + config, then start/stop the runtime. */\n configure,\n /** Merge host-UI seams on a running runtime (scan overlay, wifi setup, …). */\n updateUiSeams,\n /** Start the runtime: mark started + construct/connect the cloud client + begin\n * syncing device settings to the glasses. */\n async start() {\n // Reports attach recent phone logs, so engine owns console interception for\n // OEM hosts too. Idempotent; the Mentra host may start it earlier.\n logBuffer.startConsoleInterception()\n await bootstrapStart()\n // Construct + connect the cloud client so the documented configure()+start()\n // lifecycle yields a live engine.session for OEMs. Idempotent for repeated\n // start() calls.\n cloudClientService.init()\n // Project native device status -> the engine stores (the inbound feed the rest\n // of the runtime reads). Established first so the stores are live before the\n // syncs below react to them.\n startGlassesStatusProjection((changed) => localMiniappRuntime.forwardEvent(\"glasses_connection_state\", changed))\n // Route the rest of the inbound device events (wifi/hotspot/gallery -> stores+bus,\n // photo/stream -> coordinators, button/touch/accel/head -> miniapps, save_setting ->\n // store, miniapp_selected -> launcher) so a bare OEM gets device data, not just the\n // Mentra app's MantleManager.\n startDeviceEventRouter()\n // Hydration contract: the native DeviceStore is in-memory and starts empty\n // every launch; seed it from the persisted settings BEFORE start() resolves\n // so every post-start getDefaultDevice() read is a trustworthy two-state\n // answer (no false \"absent\" for genuinely-paired users at cold start).\n // Ordered before startGlassesSettingsSync so the settings load can't\n // double-push through the change subscription. A failed hydration must not\n // brick the runtime: start() continues, and the guards that consume\n // hasDefaultDevice() see the rejection and fail open.\n try {\n await hydrateDeviceStore()\n // Boot repair: a persisted default_wearable without a native default\n // device (identity abandoned mid-pairing, or resurrected from the server\n // before identity stopped syncing) demotes to pending_wearable so hosts\n // render finish-pairing instead of a connect that would throw.\n await demoteOrphanedDefaultWearable()\n } catch (error) {\n console.warn(\"engine.start: device-store hydration failed:\", error instanceof Error ? error.message : error)\n }\n // Project the glasses' OTA events into the store for the engine.ota read surface.\n startOtaService()\n // Forward glasses mic_lc3 frames to the v2 cloud session so cloud transcription\n // works for any host (not just the Mentra app's host-side MantleManager fork).\n startAudioCloudUplink()\n try {\n await cloudClientService.syncCoreTokenToBluetooth()\n } catch (error) {\n console.warn(\n \"engine.start: initial Cloud V2 core token sync failed:\",\n error instanceof Error ? error.message : error,\n )\n }\n startSupportProfileSync()\n // Push device-setting changes to the glasses for ANY host, so\n // engine.glasses.settings.set() reaches the device (not just the Mentra app).\n startGlassesSettingsSync()\n // Same for phone-notification config -> the native listener (Android).\n startPhoneNotificationsSync()\n // Android internal/e2e: laptop captions tester can broadcast a failure intent;\n // engine owns turning that into a Cloud V2 report.\n startCaptionsTesterReportService()\n // MentraJS crashloop-disabled is runtime state; engine owns filing the\n // automatic report while hosts only render alert/telemetry side effects.\n startMentraJSCrashloopReportService()\n // Bring up the local-miniapp engine so a bare OEM can run MentraJS miniapps:\n // the LocalMiniappRuntime (registry + WebView bridge), the MentraJS router\n // (crust-bound spawn/dispatch pump + launcher wiring), the DisplayProcessor\n // (layout arbitration over the engine stores), and the gallery-sync service.\n // All idempotent — when the Mentra app's host bootstrap also calls these, the\n // second call is a no-op. Host-only crashloop telemetry is attached\n // separately by the Mentra app.\n localMiniappRuntime.initialize()\n ensureMiniappEngine()\n displayProcessor.attachToRuntime()\n gallerySyncService.initialize()\n },\n /** Stop the runtime: tear down the settings sync + cloud client + mark stopped.\n * Each step is guarded so one failing teardown can't skip the rest and leak\n * the remaining runtime services. */\n async stop() {\n const safely = async (label: string, step: () => unknown): Promise<void> => {\n try {\n await step()\n } catch (error) {\n console.warn(`engine.stop: ${label} failed:`, error)\n }\n }\n await safely(\"glasses settings sync\", stopGlassesSettingsSync)\n await safely(\"glasses status projection\", stopGlassesStatusProjection)\n await safely(\"device event router\", stopDeviceEventRouter)\n await safely(\"ota service\", stopOtaService)\n await safely(\"audio cloud uplink\", stopAudioCloudUplink)\n await safely(\"support profile sync\", stopSupportProfileSync)\n await safely(\"phone notifications sync\", stopPhoneNotificationsSync)\n await safely(\"captions tester report service\", stopCaptionsTesterReportService)\n await safely(\"mentrajs crashloop report service\", stopMentraJSCrashloopReportService)\n await safely(\"miniapp engine\", stopMiniappEngine)\n await safely(\"local miniapp runtime\", () => localMiniappRuntime.cleanup())\n await safely(\"display processor\", () => displayProcessor.detachFromRuntime())\n await safely(\"gallery sync service\", () => gallerySyncService.cleanup())\n await safely(\"cloud client\", () => cloudClientService.stop())\n await safely(\"bootstrap\", bootstrapStop)\n },\n glasses,\n speech,\n /** Cloud (cloud-v2) live-session status + account ops — engine owns the client. */\n session,\n /** Typed keyed user settings over the engine-owned settings store. */\n settings,\n /** Developer/debug surface (backend+cloud URL overrides, reconnect, min version). */\n dev,\n /** Bug-report, automatic runtime report, and feedback submission. */\n reports,\n /** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */\n ota,\n /** Gallery sync: status/onStatus · onNotice (host renders) · sync/cancel. */\n gallery,\n /** Miniapp lifecycle (the WebView bridge primitives are exported separately). */\n miniapps,\n /** First-time glasses discovery + pairing. */\n pairing,\n /** Phone→glasses notification forwarding (Android). */\n phoneNotifications,\n /** OS permissions (check/request/openSettings + per-miniapp requirements). */\n permissions,\n /** Inbound alerts engine→host (crashloop, version-incompatible, connection loss). */\n notifications,\n display,\n}\n"]}
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,EAAE,KAAK,IAAI,cAAc,EAAE,IAAI,IAAI,aAAa,EAAE,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAC5G,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAC,kBAAkB,EAAE,6BAA6B,EAAC,MAAM,iCAAiC,CAAA;AACjG,OAAO,EAAC,wBAAwB,EAAE,uBAAuB,EAAC,MAAM,gCAAgC,CAAA;AAChG,OAAO,EAAC,4BAA4B,EAAE,2BAA2B,EAAC,MAAM,oCAAoC,CAAA;AAC5G,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AACvF,OAAO,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,+BAA+B,CAAA;AAC7F,OAAO,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,8BAA8B,CAAA;AAC1F,OAAO,EAAC,2BAA2B,EAAE,0BAA0B,EAAC,MAAM,mCAAmC,CAAA;AACzG,OAAO,EAAC,gCAAgC,EAAE,+BAA+B,EAAC,MAAM,wCAAwC,CAAA;AACxH,OAAO,EACL,mCAAmC,EACnC,kCAAkC,GACnC,MAAM,2CAA2C,CAAA;AAClD,OAAO,EAAC,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAA;AAC/E,OAAO,mBAAmB,MAAM,gCAAgC,CAAA;AAChE,OAAO,gBAAgB,M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mBAAmB,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,CAAA;QAC7E,MAAM,MAAM,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAA;QACxE,MAAM,MAAM,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAA;QAC7D,MAAM,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO;IACP,MAAM;IACN,mFAAmF;IACnF,OAAO;IACP,sEAAsE;IACtE,QAAQ;IACR,qFAAqF;IACrF,GAAG;IACH,qEAAqE;IACrE,OAAO;IACP,sFAAsF;IACtF,GAAG;IACH,6EAA6E;IAC7E,OAAO;IACP,iFAAiF;IACjF,QAAQ;IACR,8CAA8C;IAC9C,OAAO;IACP,uDAAuD;IACvD,kBAAkB;IAClB,8EAA8E;IAC9E,WAAW;IACX,qFAAqF;IACrF,aAAa;IACb,OAAO;CACR,CAAA","sourcesContent":["/**\n * `engine` — the namespaced OEM-facing engine API (the \"(A) host API\" from the\n * Phase-1 contract). Host UI calls `engine.<domain>.<method>()`; each domain is a\n * typed facade over the runtime. (Exported from the `@mentra/engine` module, whose\n * name stays `engine` in code; the public API surface is `engine`.)\n *\n * It grows one facade at a time. The migration-era flat store/service exports\n * remain in a private MentraOS host package; they shrink as screens move onto\n * `engine.*`.\n */\nimport {configure, start as bootstrapStart, stop as bootstrapStop, updateUiSeams} from \"./runtime/bootstrap\"\nimport {cloudClientService} from \"./services/CloudClientService\"\nimport {hydrateDeviceStore, demoteOrphanedDefaultWearable} from \"./services/DeviceStoreHydration\"\nimport {startGlassesSettingsSync, stopGlassesSettingsSync} from \"./services/GlassesSettingsSync\"\nimport {startGlassesStatusProjection, stopGlassesStatusProjection} from \"./services/GlassesStatusProjection\"\nimport {startOtaService, stopOtaService} from \"./services/OtaService\"\nimport {startAudioCloudUplink, stopAudioCloudUplink} from \"./services/AudioCloudUplink\"\nimport {startSupportProfileSync, stopSupportProfileSync} from \"./services/SupportProfileSync\"\nimport {startDeviceEventRouter, stopDeviceEventRouter} from \"./services/DeviceEventRouter\"\nimport {startPhoneNotificationsSync, stopPhoneNotificationsSync} from \"./services/PhoneNotificationsSync\"\nimport {startCaptionsTesterReportService, stopCaptionsTesterReportService} from \"./services/CaptionsTesterReportService\"\nimport {\n startMentraJSCrashloopReportService,\n stopMentraJSCrashloopReportService,\n} from \"./services/MentraJSCrashloopReportService\"\nimport {ensureMiniappEngine, stopMiniappEngine} from \"./services/MiniappEngine\"\nimport localMiniappRuntime from \"./services/LocalMiniappRuntime\"\nimport displayProcessor from \"./services/DisplayProcessor\"\nimport {gallerySyncService} from \"./services/asg/gallerySyncService\"\nimport {glasses} from \"./facades/glasses\"\nimport {display} from \"./facades/display\"\nimport {speech} from \"./facades/speech\"\nimport {session} from \"./facades/session\"\nimport {settings} from \"./facades/settings\"\nimport {dev} from \"./facades/dev\"\nimport {reports} from \"./facades/reports\"\nimport {ota} from \"./facades/ota\"\nimport {gallery} from \"./facades/gallery\"\nimport {miniapps} from \"./facades/miniapps\"\nimport {pairing} from \"./facades/pairing\"\nimport {phoneNotifications} from \"./facades/phoneNotifications\"\nimport {permissions} from \"./facades/permissions\"\nimport {notifications} from \"./facades/notifications\"\nimport {logBuffer} from \"./utils/devLogging\"\n\nexport const engine = {\n /** Front door — hand engine auth + config, then start/stop the runtime. */\n configure,\n /** Merge host-UI seams on a running runtime (scan overlay, wifi setup, …). */\n updateUiSeams,\n /** Start the runtime: mark started + construct/connect the cloud client + begin\n * syncing device settings to the glasses. */\n async start() {\n // Reports attach recent phone logs, so engine owns console interception for\n // OEM hosts too. Idempotent; the Mentra host may start it earlier.\n logBuffer.startConsoleInterception()\n await bootstrapStart()\n // Construct + connect the cloud client so the documented configure()+start()\n // lifecycle yields a live engine.session for OEMs. Idempotent for repeated\n // start() calls.\n cloudClientService.init()\n // Project native device status -> the engine stores (the inbound feed the rest\n // of the runtime reads). Established first so the stores are live before the\n // syncs below react to them.\n startGlassesStatusProjection((changed) => localMiniappRuntime.forwardEvent(\"glasses_connection_state\", changed))\n // Route the rest of the inbound device events (wifi/hotspot/gallery -> stores+bus,\n // photo/stream -> coordinators, button/touch/accel/head -> miniapps, save_setting ->\n // store, miniapp_selected -> launcher) so a bare OEM gets device data, not just the\n // Mentra app's MantleManager.\n startDeviceEventRouter()\n // Hydration contract: the native DeviceStore is in-memory and starts empty\n // every launch; seed it from the persisted settings BEFORE start() resolves\n // so every post-start getDefaultDevice() read is a trustworthy two-state\n // answer (no false \"absent\" for genuinely-paired users at cold start).\n // Ordered before startGlassesSettingsSync so the settings load can't\n // double-push through the change subscription. A failed hydration must not\n // brick the runtime: start() continues, and the guards that consume\n // hasDefaultDevice() see the rejection and fail open.\n try {\n await hydrateDeviceStore()\n // Boot repair: a persisted default_wearable without a native default\n // device (identity abandoned mid-pairing, or resurrected from the server\n // before identity stopped syncing) demotes to pending_wearable so hosts\n // render finish-pairing instead of a connect that would throw.\n await demoteOrphanedDefaultWearable()\n } catch (error) {\n console.warn(\"engine.start: device-store hydration failed:\", error instanceof Error ? error.message : error)\n }\n // Project the glasses' OTA events into the store for the engine.ota read surface.\n startOtaService()\n // Forward glasses mic_lc3 frames to the v2 cloud session so cloud transcription\n // works for any host (not just the Mentra app's host-side MantleManager fork).\n startAudioCloudUplink()\n try {\n await cloudClientService.syncCoreTokenToBluetooth()\n } catch (error) {\n console.warn(\n \"engine.start: initial Cloud V2 core token sync failed:\",\n error instanceof Error ? error.message : error,\n )\n }\n startSupportProfileSync()\n // Push device-setting changes to the glasses for ANY host, so\n // engine.glasses.settings.set() reaches the device (not just the Mentra app).\n startGlassesSettingsSync()\n // Same for phone-notification config -> the native listener (Android).\n startPhoneNotificationsSync()\n // Android internal/e2e: laptop captions tester can broadcast a failure intent;\n // engine owns turning that into a Cloud V2 report.\n startCaptionsTesterReportService()\n // MentraJS crashloop-disabled is runtime state; engine owns filing the\n // automatic report while hosts only render alert/telemetry side effects.\n startMentraJSCrashloopReportService()\n // Bring up the local-miniapp engine so a bare OEM can run MentraJS miniapps:\n // the LocalMiniappRuntime (registry + WebView bridge), the MentraJS router\n // (crust-bound spawn/dispatch pump + launcher wiring), the DisplayProcessor\n // (layout arbitration over the engine stores), and the gallery-sync service.\n // All idempotent — when the Mentra app's host bootstrap also calls these, the\n // second call is a no-op. Host-only crashloop telemetry is attached\n // separately by the Mentra app.\n localMiniappRuntime.initialize()\n ensureMiniappEngine()\n displayProcessor.attachToRuntime()\n gallerySyncService.initialize()\n },\n /** Stop the runtime: tear down the settings sync + cloud client + mark stopped.\n * Each step is guarded so one failing teardown can't skip the rest and leak\n * the remaining runtime services. */\n async stop() {\n const safely = async (label: string, step: () => unknown): Promise<void> => {\n try {\n await step()\n } catch (error) {\n console.warn(`engine.stop: ${label} failed:`, error)\n }\n }\n await safely(\"glasses settings sync\", stopGlassesSettingsSync)\n await safely(\"glasses status projection\", stopGlassesStatusProjection)\n await safely(\"device event router\", stopDeviceEventRouter)\n await safely(\"ota service\", stopOtaService)\n await safely(\"audio cloud uplink\", stopAudioCloudUplink)\n await safely(\"support profile sync\", stopSupportProfileSync)\n await safely(\"phone notifications sync\", stopPhoneNotificationsSync)\n await safely(\"captions tester report service\", stopCaptionsTesterReportService)\n await safely(\"mentrajs crashloop report service\", stopMentraJSCrashloopReportService)\n await safely(\"miniapp engine\", stopMiniappEngine)\n await safely(\"local miniapp runtime\", () => localMiniappRuntime.cleanup())\n await safely(\"display processor\", () => displayProcessor.detachFromRuntime())\n await safely(\"gallery sync service\", () => gallerySyncService.cleanup())\n await safely(\"cloud client\", () => cloudClientService.stop())\n await safely(\"bootstrap\", bootstrapStop)\n },\n glasses,\n speech,\n /** Cloud (cloud-v2) live-session status + account ops — engine owns the client. */\n session,\n /** Typed keyed user settings over the engine-owned settings store. */\n settings,\n /** Developer/debug surface (backend+cloud URL overrides, reconnect, min version). */\n dev,\n /** Bug-report, automatic runtime report, and feedback submission. */\n reports,\n /** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */\n ota,\n /** Gallery sync: status/onStatus · onNotice (host renders) · sync/cancel. */\n gallery,\n /** Miniapp lifecycle (the WebView bridge primitives are exported separately). */\n miniapps,\n /** First-time glasses discovery + pairing. */\n pairing,\n /** Phone→glasses notification forwarding (Android). */\n phoneNotifications,\n /** OS permissions (check/request/openSettings + per-miniapp requirements). */\n permissions,\n /** Inbound alerts engine→host (crashloop, version-incompatible, connection loss). */\n notifications,\n display,\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  * glasses display for dev tools and escape-hatch use (normal rendering goes through
5
5
  * the engine DisplayProcessor / layout system, not these).
6
6
  */
7
- import BluetoothSdk from "@mentra/bluetooth-sdk/internal";
7
+ import BluetoothSdk from "@mentra/bluetooth-sdk";
8
8
  export declare const display: {
9
9
  /** Mirrored-view read-model (current/onMirror/view/setView). */
10
10
  mirror: {
@@ -1 +1 @@
1
- {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/facades/display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,MAAM,gCAAgC,CAAA;AAGzD,eAAO,MAAM,OAAO;IAClB,gEAAgE;;;;;;;IAEhE,wEAAwE;;IAExE,iCAAiC;iBACtB,OAAO,CAAC,IAAI,CAAC;CACzB,CAAA"}
1
+ {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/facades/display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAGhD,eAAO,MAAM,OAAO;IAClB,gEAAgE;;;;;;;IAEhE,wEAAwE;;IAExE,iCAAiC;iBACtB,OAAO,CAAC,IAAI,CAAC;CACzB,CAAA"}
@@ -4,7 +4,7 @@
4
4
  * glasses display for dev tools and escape-hatch use (normal rendering goes through
5
5
  * the engine DisplayProcessor / layout system, not these).
6
6
  */
7
- import BluetoothSdk from "@mentra/bluetooth-sdk/internal";
7
+ import BluetoothSdk from "@mentra/bluetooth-sdk";
8
8
  import { displayMirror } from "./displayMirror";
9
9
  export const display = {
10
10
  /** Mirrored-view read-model (current/onMirror/view/setView). */
@@ -1 +1 @@
1
- {"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/facades/display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAE7C,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,gEAAgE;IAChE,MAAM,EAAE,aAAa;IACrB,wEAAwE;IACxE,IAAI,EAAE,CAAC,GAAG,IAAiD,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IACjG,iCAAiC;IACjC,KAAK,EAAE,GAAkB,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE;CACxD,CAAA","sourcesContent":["/**\n * display facade — `engine.display`: the host/OEM display surface. `mirror`\n * exposes the mirrored-view read-model; `text`/`clear` are raw passthroughs to the\n * glasses display for dev tools and escape-hatch use (normal rendering goes through\n * the engine DisplayProcessor / layout system, not these).\n */\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport {displayMirror} from \"./displayMirror\"\n\nexport const display = {\n /** Mirrored-view read-model (current/onMirror/view/setView). */\n mirror: displayMirror,\n /** Write raw text to the glasses display at (x, y) with a font size. */\n text: (...args: Parameters<typeof BluetoothSdk.displayText>) => BluetoothSdk.displayText(...args),\n /** Clear the glasses display. */\n clear: (): Promise<void> => BluetoothSdk.clearDisplay(),\n}\n"]}
1
+ {"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/facades/display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAE7C,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,gEAAgE;IAChE,MAAM,EAAE,aAAa;IACrB,wEAAwE;IACxE,IAAI,EAAE,CAAC,GAAG,IAAiD,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IACjG,iCAAiC;IACjC,KAAK,EAAE,GAAkB,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE;CACxD,CAAA","sourcesContent":["/**\n * display facade — `engine.display`: the host/OEM display surface. `mirror`\n * exposes the mirrored-view read-model; `text`/`clear` are raw passthroughs to the\n * glasses display for dev tools and escape-hatch use (normal rendering goes through\n * the engine DisplayProcessor / layout system, not these).\n */\nimport BluetoothSdk from \"@mentra/bluetooth-sdk\"\nimport {displayMirror} from \"./displayMirror\"\n\nexport const display = {\n /** Mirrored-view read-model (current/onMirror/view/setView). */\n mirror: displayMirror,\n /** Write raw text to the glasses display at (x, y) with a font size. */\n text: (...args: Parameters<typeof BluetoothSdk.displayText>) => BluetoothSdk.displayText(...args),\n /** Clear the glasses display. */\n clear: (): Promise<void> => BluetoothSdk.clearDisplay(),\n}\n"]}
@@ -1,14 +1,4 @@
1
- /**
2
- * glasses facade — the core `engine.glasses.*` surface: connection actions (over
3
- * the bluetooth-sdk passthrough), a curated status/info read-model (projected from
4
- * the engine-owned glasses store), capabilities (from the model table), and the
5
- * discrete input events. The `wifi` sub-facade is nested here.
6
- *
7
- * Read-models project the raw glasses store into the stable shape OEM UIs consume,
8
- * so the device store's field layout doesn't leak into every screen.
9
- */
10
- import BluetoothSdk from "@mentra/bluetooth-sdk/internal";
11
- import type { ButtonPressEvent, TouchEvent } from "@mentra/bluetooth-sdk/internal";
1
+ import type { ButtonPressEvent, ConnectOptions, Device, TouchEvent } from "@mentra/bluetooth-sdk";
12
2
  declare function projectStatus(): {
13
3
  state: "connecting" | "connected" | "disconnected" | "scanning" | "bonding";
14
4
  fullyBooted: boolean;
@@ -68,11 +58,11 @@ export declare const glasses: {
68
58
  disconnect: () => Promise<void>;
69
59
  forget: () => Promise<void>;
70
60
  /** Connect to a specific (discovered) device. */
71
- connect: (device: import("@mentra/bluetooth-sdk").Device, options?: import("@mentra/bluetooth-sdk").ConnectOptions | undefined) => Promise<void>;
61
+ connect: (device: Device, options?: ConnectOptions) => Promise<void>;
72
62
  /** Connect the built-in simulated glasses (dev/testing). */
73
63
  connectSimulated: () => Promise<void>;
74
64
  /** Set a device as the `connectDefault()` target. */
75
- setDefault: (device: import("@mentra/bluetooth-sdk").Device | null) => Promise<void>;
65
+ setDefault: (device: Device | null) => Promise<void>;
76
66
  /**
77
67
  * Reconnect to the saved default glasses. Resolves `false` when there's nothing to
78
68
  * reconnect to (no default paired) or the connect attempt fails (e.g. BLE powered
@@ -1 +1 @@
1
- {"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,KAAK,EAAC,gBAAgB,EAAE,UAAU,EAAC,MAAM,gCAAgC,CAAA;AAYhF,iBAAS,aAAa;;;;;;;;;;;;;;;EAarB;AAED,iBAAS,uBAAuB;;;;;EAQ/B;AAED,iBAAS,WAAW;;;;;;;;;;;;;;;;;;;;;;;EAqBnB;AAED,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;AACpE,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACjF,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA;AAEhE,eAAO,MAAM,OAAO;IAElB;;;;OAIG;0BACuB,OAAO,CAAC,IAAI,CAAC;sBASvB,OAAO,CAAC,IAAI,CAAC;kBACjB,OAAO,CAAC,IAAI,CAAC;IACzB,iDAAiD;uIACkB,OAAO,CAAC,IAAI,CAAC;IAShF,4DAA4D;4BACtC,OAAO,CAAC,IAAI,CAAC;IACnC,qDAAq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}
@@ -86,10 +86,10 @@ export const glasses = {
86
86
  disconnect: () => BluetoothSdk.disconnect(),
87
87
  forget: () => BluetoothSdk.forget(),
88
88
  /** Connect to a specific (discovered) device. */
89
- connect: async (...args) => {
89
+ connect: async (device, options) => {
90
90
  try {
91
91
  await pushAllBluetoothSettings();
92
- await BluetoothSdk.connect(...args);
92
+ await BluetoothSdk.connect(device, options);
93
93
  }
94
94
  catch (error) {
95
95
  recordSupportProfileConnectionFailure(error, "connect");
@@ -99,7 +99,7 @@ export const glasses = {
99
99
  /** Connect the built-in simulated glasses (dev/testing). */
100
100
  connectSimulated: () => BluetoothSdk.connectSimulated(),
101
101
  /** Set a device as the `connectDefault()` target. */
102
- setDefault: (...args) => BluetoothSdk.setDefaultDevice(...args),
102
+ setDefault: (device) => BluetoothSdk.setDefaultDevice(device),
103
103
  /**
104
104
  * Reconnect to the saved default glasses. Resolves `false` when there's nothing to
105
105
  * reconnect to (no default paired) or the connect attempt fails (e.g. BLE powered
@@ -1 +1 @@
1
- {"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,kFAAkF;AAClF,sFAAsF;AACtF,uEAAuE;AACvE,OAAO,YAAY,MAAM,gCAAgC,CAAA;AAEzD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAC,qCAAqC,EAAC,MAAM,gCAAgC,CAAA;AACpF,OAAO,EAAC,oBAAoB,EAAmB,MAAM,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["/**\n * glasses facade — the core `engine.glasses.*` surface: connection actions (over\n * the bluetooth-sdk passthrough), a curated status/info read-model (projected from\n * the engine-owned glasses store), capabilities (from the model table), and the\n * discrete input events. The `wifi` sub-facade is nested here.\n *\n * Read-models project the raw glasses store into the stable shape OEM UIs consume,\n * so the device store's field layout doesn't leak into every screen.\n */\n// Internal btsdk surface — connectSimulated/reconnect/controller live on the full\n// surface, not the public entry. Relative path (the alias doesn't resolve in engine's\n// standalone build); jest moduleNameMapper + tsconfig both resolve it.\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport type {ButtonPressEvent, TouchEvent} from \"@mentra/bluetooth-sdk/internal\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {hasDefaultDevice} from \"../services/DeviceStoreHydration\"\nimport {projectPairingIdentity} from \"../services/PairingIdentity\"\nimport {isGlassesConnected, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {pushAllBluetoothSettings} from \"../services/GlassesSettingsSync\"\nimport {recordSupportProfileConnectionFailure} from \"../services/SupportProfileSync\"\nimport {getModelCapabilities, type DeviceTypes} from \"../types\"\nimport {glassesWifi} from \"./glassesWifi\"\nimport {glassesSettings} from \"./glassesSettings\"\n\nfunction projectStatus() {\n const s = useGlassesStore.getState()\n return {\n state: s.connection.state,\n fullyBooted: isGlassesReady(s.connection),\n battery: s.batteryLevel,\n charging: s.charging,\n case: {battery: s.caseBatteryLevel, charging: s.caseCharging, open: s.caseOpen, removed: s.caseRemoved},\n signal: s.signalStrength,\n micEnabled: s.micEnabled,\n vadEnabled: s.voiceActivityDetectionEnabled,\n btClassic: s.bluetoothClassicConnected,\n }\n}\n\nfunction projectControllerStatus() {\n const s = useGlassesStore.getState()\n return {\n connected: s.controllerConnected,\n fullyBooted: s.controllerFullyBooted,\n battery: s.controllerBatteryLevel,\n signal: s.controllerSignalStrength,\n }\n}\n\nfunction projectInfo() {\n const s = useGlassesStore.getState()\n return {\n model: s.deviceModel,\n style: s.style,\n color: s.color,\n bluetoothName: s.bluetoothName,\n firmwareVersion: s.firmwareVersion,\n mtkFirmware: s.mtkFirmwareVersion,\n besFirmware: s.besFirmwareVersion,\n appVersion: s.appVersion,\n androidVersion: s.androidVersion,\n serialNumber: s.serialNumber,\n buildNumber: s.buildNumber,\n btMac: s.bluetoothMacAddress,\n wifiMac: s.wifiMacAddress,\n leftMac: s.leftMacAddress,\n rightMac: s.rightMacAddress,\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n wifi: {...s.wifi},\n }\n}\n\nexport type GlassesStatusSnapshot = ReturnType<typeof projectStatus>\nexport type ControllerStatusSnapshot = ReturnType<typeof projectControllerStatus>\nexport type GlassesInfoSnapshot = ReturnType<typeof projectInfo>\n\nexport const glasses = {\n // --- connection (bluetooth-sdk passthrough) ---\n /**\n * Reconnect the default wearable. Seeds the phone's current device settings to\n * native first, so they're primed before the connect handshake replays them to\n * the glasses (this used to be a host-side step before `connectDefault`).\n */\n connectDefault: async (): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect_default\")\n throw error\n }\n },\n disconnect: (): Promise<void> => BluetoothSdk.disconnect(),\n forget: (): Promise<void> => BluetoothSdk.forget(),\n /** Connect to a specific (discovered) device. */\n connect: async (...args: Parameters<typeof BluetoothSdk.connect>): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connect(...args)\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect\")\n throw error\n }\n },\n /** Connect the built-in simulated glasses (dev/testing). */\n connectSimulated: (): Promise<void> => BluetoothSdk.connectSimulated(),\n /** Set a device as the `connectDefault()` target. */\n setDefault: (...args: Parameters<typeof BluetoothSdk.setDefaultDevice>) => BluetoothSdk.setDefaultDevice(...args),\n /**\n * Reconnect to the saved default glasses. Resolves `false` when there's nothing to\n * reconnect to (no default paired) or the connect attempt fails (e.g. BLE powered\n * off), `true` when already connected or after kicking off the connect. Never\n * rejects — the boolean contract holds. The host gates connectivity/permissions\n * (its UI) before calling.\n */\n reconnect: async (): Promise<boolean> => {\n const defaultWearable = useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key)\n if (!defaultWearable) return false\n if (isGlassesConnected(useGlassesStore.getState().connection)) return true\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"reconnect\")\n console.warn(\"engine.glasses.reconnect failed:\", error)\n return false\n }\n return true\n },\n /** True when no glasses has ever been paired NOR selected (the pairing-identity\n * lifecycle is in its `none` state) — e.g. to route a first-run host into the\n * pairing/onboarding flow. A pending selection is not \"first\" — the host should\n * offer finish-pairing (see `engine.pairing.identity()`). */\n isFirstPairing: (): boolean => projectPairingIdentity().kind === \"none\",\n /**\n * True when the SDK has an actual default DEVICE to reconnect to. Distinct from\n * `default_wearable` (a model string that a pending or orphaned selection can\n * hold without any paired device): connectDefault() throws without a device, so\n * hosts should route to the pairing flow when this is false.\n *\n * Hydration-aware: awaits the device-store seed internally, so a cold-start\n * read can't see a false \"absent\" for genuinely-paired users. Rejects if\n * hydration failed — callers guarding destructive or routing decisions must\n * fail open (treat as \"has a device\").\n */\n hasDefaultDevice: (): Promise<boolean> => hasDefaultDevice(),\n\n // --- read-model (projected from the engine-owned glasses store) ---\n status: (): GlassesStatusSnapshot => projectStatus(),\n onStatus: (cb: (status: GlassesStatusSnapshot) => void): (() => void) => {\n // Dedupe: the glasses store updates on many fields; only fire when the\n // projected status snapshot actually changes.\n let last = JSON.stringify(projectStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n info: (): GlassesInfoSnapshot => projectInfo(),\n onInfo: (cb: (info: GlassesInfoSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectInfo())\n return useGlassesStore.subscribe(() => {\n const snap = projectInfo()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n capabilities: () => getModelCapabilities(useGlassesStore.getState().deviceModel as DeviceTypes),\n /** Ask the glasses to report fresh firmware/version info (updates the store). */\n requestVersionInfo: () => BluetoothSdk.requestVersionInfo(),\n\n // --- discrete input events (passthrough listeners) ---\n onButtonPress: (cb: (event: ButtonPressEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"button_press\", cb)\n return () => sub.remove()\n },\n onTouchGesture: (cb: (event: TouchEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"touch_event\", cb)\n return () => sub.remove()\n },\n\n // --- ring controller (optional input device) ---\n controller: {\n connectDefault: (): Promise<void> => BluetoothSdk.connectDefaultController(),\n disconnect: (): Promise<void> => BluetoothSdk.disconnectController(),\n forget: (): Promise<void> => BluetoothSdk.forgetController(),\n status: (): ControllerStatusSnapshot => projectControllerStatus(),\n onStatus: (cb: (status: ControllerStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectControllerStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectControllerStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n },\n\n // --- audio (glasses media-volume + own-app playback hint) ---\n audio: {\n /** Read the glasses' current media volume. */\n getMediaVolume: () => BluetoothSdk.getGlassesMediaVolume(),\n /** Set the glasses' media volume. */\n setMediaVolume: (level: number) => BluetoothSdk.setGlassesMediaVolume(level),\n /** Tell native whether THIS app is currently playing audio (for ducking). */\n setOwnAppPlaying: (playing: boolean): Promise<void> => BluetoothSdk.setOwnAppAudioPlaying(playing),\n },\n\n // --- sub-facades ---\n wifi: glassesWifi,\n settings: glassesSettings,\n}\n"]}
1
+ {"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,kFAAkF;AAClF,sFAAsF;AACtF,uEAAuE;AACvE,OAAO,YAAY,MAAM,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AAA;YACV,CAAC,CAAC,CAAA;QACJ,CAAC;KACF;IAED,+DAA+D;IAC/D,KAAK,EAAE;QACL,8CAA8C;QAC9C,cAAc,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,qBAAqB,EAAE;QAC1D,qCAAqC;QACrC,cAAc,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,KAAK,CAAC;QAC5E,6EAA6E;QAC7E,gBAAgB,EAAE,CAAC,OAAgB,EAAiB,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,OAAO,CAAC;KACnG;IAED,sBAAsB;IACtB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,eAAe;CAC1B,CAAA","sourcesContent":["/**\n * glasses facade — the core `engine.glasses.*` surface: connection actions (over\n * the bluetooth-sdk passthrough), a curated status/info read-model (projected from\n * the engine-owned glasses store), capabilities (from the model table), and the\n * discrete input events. The `wifi` sub-facade is nested here.\n *\n * Read-models project the raw glasses store into the stable shape OEM UIs consume,\n * so the device store's field layout doesn't leak into every screen.\n */\n// Internal btsdk surface — connectSimulated/reconnect/controller live on the full\n// surface, not the public entry. Relative path (the alias doesn't resolve in engine's\n// standalone build); jest moduleNameMapper + tsconfig both resolve it.\nimport BluetoothSdk from \"@mentra/bluetooth-sdk/internal\"\nimport type {ButtonPressEvent, ConnectOptions, Device, TouchEvent} from \"@mentra/bluetooth-sdk\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {hasDefaultDevice} from \"../services/DeviceStoreHydration\"\nimport {projectPairingIdentity} from \"../services/PairingIdentity\"\nimport {isGlassesConnected, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {pushAllBluetoothSettings} from \"../services/GlassesSettingsSync\"\nimport {recordSupportProfileConnectionFailure} from \"../services/SupportProfileSync\"\nimport {getModelCapabilities, type DeviceTypes} from \"../types\"\nimport {glassesWifi} from \"./glassesWifi\"\nimport {glassesSettings} from \"./glassesSettings\"\n\nfunction projectStatus() {\n const s = useGlassesStore.getState()\n return {\n state: s.connection.state,\n fullyBooted: isGlassesReady(s.connection),\n battery: s.batteryLevel,\n charging: s.charging,\n case: {battery: s.caseBatteryLevel, charging: s.caseCharging, open: s.caseOpen, removed: s.caseRemoved},\n signal: s.signalStrength,\n micEnabled: s.micEnabled,\n vadEnabled: s.voiceActivityDetectionEnabled,\n btClassic: s.bluetoothClassicConnected,\n }\n}\n\nfunction projectControllerStatus() {\n const s = useGlassesStore.getState()\n return {\n connected: s.controllerConnected,\n fullyBooted: s.controllerFullyBooted,\n battery: s.controllerBatteryLevel,\n signal: s.controllerSignalStrength,\n }\n}\n\nfunction projectInfo() {\n const s = useGlassesStore.getState()\n return {\n model: s.deviceModel,\n style: s.style,\n color: s.color,\n bluetoothName: s.bluetoothName,\n firmwareVersion: s.firmwareVersion,\n mtkFirmware: s.mtkFirmwareVersion,\n besFirmware: s.besFirmwareVersion,\n appVersion: s.appVersion,\n androidVersion: s.androidVersion,\n serialNumber: s.serialNumber,\n buildNumber: s.buildNumber,\n btMac: s.bluetoothMacAddress,\n wifiMac: s.wifiMacAddress,\n leftMac: s.leftMacAddress,\n rightMac: s.rightMacAddress,\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n wifi: {...s.wifi},\n }\n}\n\nexport type GlassesStatusSnapshot = ReturnType<typeof projectStatus>\nexport type ControllerStatusSnapshot = ReturnType<typeof projectControllerStatus>\nexport type GlassesInfoSnapshot = ReturnType<typeof projectInfo>\n\nexport const glasses = {\n // --- connection (bluetooth-sdk passthrough) ---\n /**\n * Reconnect the default wearable. Seeds the phone's current device settings to\n * native first, so they're primed before the connect handshake replays them to\n * the glasses (this used to be a host-side step before `connectDefault`).\n */\n connectDefault: async (): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect_default\")\n throw error\n }\n },\n disconnect: (): Promise<void> => BluetoothSdk.disconnect(),\n forget: (): Promise<void> => BluetoothSdk.forget(),\n /** Connect to a specific (discovered) device. */\n connect: async (device: Device, options?: ConnectOptions): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connect(device, options)\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect\")\n throw error\n }\n },\n /** Connect the built-in simulated glasses (dev/testing). */\n connectSimulated: (): Promise<void> => BluetoothSdk.connectSimulated(),\n /** Set a device as the `connectDefault()` target. */\n setDefault: (device: Device | null): Promise<void> => BluetoothSdk.setDefaultDevice(device),\n /**\n * Reconnect to the saved default glasses. Resolves `false` when there's nothing to\n * reconnect to (no default paired) or the connect attempt fails (e.g. BLE powered\n * off), `true` when already connected or after kicking off the connect. Never\n * rejects — the boolean contract holds. The host gates connectivity/permissions\n * (its UI) before calling.\n */\n reconnect: async (): Promise<boolean> => {\n const defaultWearable = useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key)\n if (!defaultWearable) return false\n if (isGlassesConnected(useGlassesStore.getState().connection)) return true\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"reconnect\")\n console.warn(\"engine.glasses.reconnect failed:\", error)\n return false\n }\n return true\n },\n /** True when no glasses has ever been paired NOR selected (the pairing-identity\n * lifecycle is in its `none` state) — e.g. to route a first-run host into the\n * pairing/onboarding flow. A pending selection is not \"first\" — the host should\n * offer finish-pairing (see `engine.pairing.identity()`). */\n isFirstPairing: (): boolean => projectPairingIdentity().kind === \"none\",\n /**\n * True when the SDK has an actual default DEVICE to reconnect to. Distinct from\n * `default_wearable` (a model string that a pending or orphaned selection can\n * hold without any paired device): connectDefault() throws without a device, so\n * hosts should route to the pairing flow when this is false.\n *\n * Hydration-aware: awaits the device-store seed internally, so a cold-start\n * read can't see a false \"absent\" for genuinely-paired users. Rejects if\n * hydration failed — callers guarding destructive or routing decisions must\n * fail open (treat as \"has a device\").\n */\n hasDefaultDevice: (): Promise<boolean> => hasDefaultDevice(),\n\n // --- read-model (projected from the engine-owned glasses store) ---\n status: (): GlassesStatusSnapshot => projectStatus(),\n onStatus: (cb: (status: GlassesStatusSnapshot) => void): (() => void) => {\n // Dedupe: the glasses store updates on many fields; only fire when the\n // projected status snapshot actually changes.\n let last = JSON.stringify(projectStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n info: (): GlassesInfoSnapshot => projectInfo(),\n onInfo: (cb: (info: GlassesInfoSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectInfo())\n return useGlassesStore.subscribe(() => {\n const snap = projectInfo()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n capabilities: () => getModelCapabilities(useGlassesStore.getState().deviceModel as DeviceTypes),\n /** Ask the glasses to report fresh firmware/version info (updates the store). */\n requestVersionInfo: () => BluetoothSdk.requestVersionInfo(),\n\n // --- discrete input events (passthrough listeners) ---\n onButtonPress: (cb: (event: ButtonPressEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"button_press\", cb)\n return () => sub.remove()\n },\n onTouchGesture: (cb: (event: TouchEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"touch_event\", cb)\n return () => sub.remove()\n },\n\n // --- ring controller (optional input device) ---\n controller: {\n connectDefault: (): Promise<void> => BluetoothSdk.connectDefaultController(),\n disconnect: (): Promise<void> => BluetoothSdk.disconnectController(),\n forget: (): Promise<void> => BluetoothSdk.forgetController(),\n status: (): ControllerStatusSnapshot => projectControllerStatus(),\n onStatus: (cb: (status: ControllerStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectControllerStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectControllerStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n },\n\n // --- audio (glasses media-volume + own-app playback hint) ---\n audio: {\n /** Read the glasses' current media volume. */\n getMediaVolume: () => BluetoothSdk.getGlassesMediaVolume(),\n /** Set the glasses' media volume. */\n setMediaVolume: (level: number) => BluetoothSdk.setGlassesMediaVolume(level),\n /** Tell native whether THIS app is currently playing audio (for ducking). */\n setOwnAppPlaying: (playing: boolean): Promise<void> => BluetoothSdk.setOwnAppAudioPlaying(playing),\n },\n\n // --- sub-facades ---\n wifi: glassesWifi,\n settings: glassesSettings,\n}\n"]}
@@ -1,15 +1,4 @@
1
- /**
2
- * ota facade — `engine.ota`: the OEM-facing OTA read/observe surface. Engine's
3
- * OtaService projects the glasses' OTA BLE events into the engine store; this facade
4
- * exposes the snapshot + change subscriptions behind the shared OTA flow exported by
5
- * `@mentra/engine/ota`. Hosts retain only their surrounding navigation and theme/i18n adapters.
6
- *
7
- * Availability checks live in engine. Install orchestration lives in engine too:
8
- * `installSession` fronts the OtaInstallCoordinator state machine (WP 8B) — the host
9
- * progress screen is a pure renderer over its snapshot + attach/detach/retry/finish.
10
- */
11
- import BluetoothSdk from "@mentra/bluetooth-sdk/internal";
12
- import type { OtaProgress, OtaProgressStatus, OtaStatus, OtaUpdateInfo } from "@mentra/bluetooth-sdk/internal";
1
+ import type { OtaProgress, OtaProgressStatus, OtaStartAckEvent, OtaStatus, OtaUpdateInfo } from "@mentra/bluetooth-sdk";
13
2
  import { type OtaInstallSnapshot } from "../services/OtaInstallCoordinator";
14
3
  import { type OtaCheckCurrentGlassesOptions, type OtaCheckCurrentGlassesResult } from "../services/OtaUpdateCheckService";
15
4
  declare function projectSnapshot(): {
@@ -20,7 +9,7 @@ declare function projectSnapshot(): {
20
9
  hotspotOtaVersion: number;
21
10
  wifiConnected: boolean;
22
11
  wifiStatusKnown: boolean;
23
- manifestUrl: string;
12
+ manifestUrl: string | null;
24
13
  updateAvailable: OtaUpdateInfo | null;
25
14
  status: OtaStatus | null;
26
15
  legacyProgress: OtaProgress | null;
@@ -38,11 +27,11 @@ export declare const ota: {
38
27
  initialize: () => Promise<void>;
39
28
  /**
40
29
  * Start the firmware install with the resolved OTA manifest URL. Progress lands on
41
- * `status()`/`onStatus()`. (The host resolves the manifest URL — dev-override/env/prod
42
- * resolution stays with the OTA config; the host-side stuck/retry watchdog is its own
30
+ * `status()`/`onStatus()`. (The host resolves the manifest URL — developer override,
31
+ * host pin, or Engine release pin resolution stays with the OTA config; the stuck/retry watchdog is its own
43
32
  * resilience layer on top of this command.)
44
33
  */
45
- install: (otaVersionUrl?: string | null | undefined) => Promise<import("@mentra/bluetooth-sdk").OtaStartAckEvent>;
34
+ install: (otaVersionUrl?: string | null) => Promise<OtaStartAckEvent>;
46
35
  /**
47
36
  * Keep glasses awake while an OTA session is actively progressing.
48
37
  * @deprecated Legacy progress route (build < 37) only — removed with WP 8D.
@@ -1 +1 @@
1
- {"version":3,"file":"ota.d.ts","sourceRoot":"","sources":["../../src/facades/ota.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,YAAY,MAAM,gCAAgC,CAAA;AACzD,OAAO,KAAK,EAAC,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,gCAAgC,CAAA;AAG5G,OAAO,EAAwB,KAAK,kBAAkB,EAAC,MAAM,mCAAmC,CAAA;AAGhG,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAClC,MAAM,mCAAmC,CAAA;AAE1C,iBAAS,eAAe;;;;;;;;;;;;;;EAiBvB;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAC5D,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,GAC7B,CAAA;AAED,eAAO,MAAM,GAAG;IAEd;;;;OAIG;;IAMH;;;;;OAKG;;IASH;;;OAGG;;IAEH,sGAAsG;gCAC1E,6BAA6B;IACzD,+CAA+C;;IAE/C,yEAAyE;;IAMzE;;;;;OAKG;4CACqC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BAAiB,EACjB,SAAS,EACT,aAAa,EACb,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,GAC7B,CAAA;AAED,eAAO,MAAM,GAAG;IAEd;;;;OAIG;;IAMH;;;;;OAKG;8BACuB,MAAM,GAAG,IAAI,KAAG,OAAO,CAAC,gBAAgB,CAAC;IAQnE;;;OAGG;;IAEH,sGAAsG;gCAC1E,6BAA6B;IACzD,+CAA+C;;IAE/C,yEAAyE;;IAMzE;;;;;OAKG;4CACqC,aAAa,CAAC,SAAS,CAAC,KAAG,aAAa,GAAG,IAAI;IAQvF;;;;;OAKG;;IAKH;;;OAGG;yCACkC,OAAO;IAE5C;;;;OAIG;;QAED,oFAAoF;0BAClE,4BAA4B;QAC9C,2FAA2F;;QAE3F,+EAA+E;;QAE/E,+EAA+E;;QAE/E,2EAA2E;;QAE3E,uGAAuG;;QAEvG,qFAAqF;wBACvE,kBAAkB;QAChC,iGAAiG;yBAChF,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;;IAGxE,8EAA8E;2BACzD,aAAa,GAAG,IAAI;IACzC,iFAAiF;kBACrE,SAAS,GAAG,IAAI;IAC5B,iEAAiE;oBACnD,WAAW;IAEzB,iGAAiG;4BACzE,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAU3E,uEAAuE;mBACxD,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAUhE,iEAAiE;qBAChD,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;CAUhE,CAAA"}
@@ -47,11 +47,11 @@ export const ota = {
47
47
  },
48
48
  /**
49
49
  * Start the firmware install with the resolved OTA manifest URL. Progress lands on
50
- * `status()`/`onStatus()`. (The host resolves the manifest URL — dev-override/env/prod
51
- * resolution stays with the OTA config; the host-side stuck/retry watchdog is its own
50
+ * `status()`/`onStatus()`. (The host resolves the manifest URL — developer override,
51
+ * host pin, or Engine release pin resolution stays with the OTA config; the stuck/retry watchdog is its own
52
52
  * resilience layer on top of this command.)
53
53
  */
54
- install: (...args) => BluetoothSdk.startOtaUpdate(...args),
54
+ install: (otaVersionUrl) => BluetoothSdk.startOtaUpdate(otaVersionUrl),
55
55
  // Deferred: this facade entry was intended to become the engine-owned retry/check
56
56
  // action, but BluetoothSdk.checkForOtaUpdate() only returns a boolean. Exposing it
57
57
  // here would make callers think the rich otaUpdateAvailable read model is refreshed,