@mentra/engine 3.2.0-dev.259 → 3.2.0-dev.261

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 (58) hide show
  1. package/build/facades/displayMirror.js +1 -1
  2. package/build/facades/displayMirror.js.map +1 -1
  3. package/build/generated/releaseMetadata.js +5 -5
  4. package/build/generated/releaseMetadata.js.map +1 -1
  5. package/build/services/DisplayProcessor.d.ts +1 -1
  6. package/build/services/DisplayProcessor.js.map +1 -1
  7. package/build/services/LocalDisplayManager.d.ts +0 -4
  8. package/build/services/LocalDisplayManager.d.ts.map +1 -1
  9. package/build/services/LocalDisplayManager.js +2 -7
  10. package/build/services/LocalDisplayManager.js.map +1 -1
  11. package/build/services/LocalMiniappRuntime.d.ts +7 -21
  12. package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
  13. package/build/services/LocalMiniappRuntime.js +9 -93
  14. package/build/services/LocalMiniappRuntime.js.map +1 -1
  15. package/build/services/MentraJSRouter.d.ts +5 -9
  16. package/build/services/MentraJSRouter.d.ts.map +1 -1
  17. package/build/services/MentraJSRouter.js +5 -9
  18. package/build/services/MentraJSRouter.js.map +1 -1
  19. package/build/services/MentraUIRouter.d.ts +9 -12
  20. package/build/services/MentraUIRouter.d.ts.map +1 -1
  21. package/build/services/MentraUIRouter.js +9 -12
  22. package/build/services/MentraUIRouter.js.map +1 -1
  23. package/build/services/MiniappLauncher.d.ts +6 -9
  24. package/build/services/MiniappLauncher.d.ts.map +1 -1
  25. package/build/services/MiniappLauncher.js +6 -9
  26. package/build/services/MiniappLauncher.js.map +1 -1
  27. package/build/services/PhoneLocationService.d.ts +2 -2
  28. package/build/services/PhoneLocationService.d.ts.map +1 -1
  29. package/build/services/PhoneLocationService.js +5 -9
  30. package/build/services/PhoneLocationService.js.map +1 -1
  31. package/build/services/PhoneStreamCoordinator.d.ts +1 -2
  32. package/build/services/PhoneStreamCoordinator.d.ts.map +1 -1
  33. package/build/services/PhoneStreamCoordinator.js +1 -2
  34. package/build/services/PhoneStreamCoordinator.js.map +1 -1
  35. package/build/services/slimStreamStatus.d.ts +4 -1
  36. package/build/services/slimStreamStatus.d.ts.map +1 -1
  37. package/build/services/slimStreamStatus.js +4 -1
  38. package/build/services/slimStreamStatus.js.map +1 -1
  39. package/build/stores/apps.js +2 -2
  40. package/build/stores/apps.js.map +1 -1
  41. package/build/utils/miniappGlobals.d.ts +3 -5
  42. package/build/utils/miniappGlobals.d.ts.map +1 -1
  43. package/build/utils/miniappGlobals.js +3 -5
  44. package/build/utils/miniappGlobals.js.map +1 -1
  45. package/package.json +8 -8
  46. package/src/facades/displayMirror.ts +1 -1
  47. package/src/generated/releaseMetadata.ts +5 -5
  48. package/src/services/DisplayProcessor.ts +1 -1
  49. package/src/services/LocalDisplayManager.ts +2 -7
  50. package/src/services/LocalMiniappRuntime.ts +9 -103
  51. package/src/services/MentraJSRouter.ts +5 -9
  52. package/src/services/MentraUIRouter.ts +9 -12
  53. package/src/services/MiniappLauncher.ts +6 -9
  54. package/src/services/PhoneLocationService.ts +5 -9
  55. package/src/services/PhoneStreamCoordinator.ts +1 -2
  56. package/src/services/slimStreamStatus.ts +4 -1
  57. package/src/stores/apps.ts +2 -2
  58. package/src/utils/miniappGlobals.ts +3 -5
@@ -50,14 +50,13 @@ interface BoundWebView {
50
50
  }
51
51
 
52
52
  /**
53
- * NOTE: the WebView host heartbeat was removed when the lifecycle
54
- * inversion landed. The current model is **at most one WebView at a
55
- * time, foreground UI with an always-on background JSContext** (same
56
- * shape as the cloud-WebView miniapps). User navigation closes it
57
- * explicitly and `onContentProcessDidTerminate` catches OS-level
58
- * crashes, but the host may still re-announce UI_OPEN for an already
59
- * mounted WebView after app resume/dev respawn so the background can
60
- * push a fresh authoritative snapshot.
53
+ * The host mounts at most one miniapp UI WebView at a time. Its background
54
+ * JSContext runs separately on the phone and can remain alive after UI closure.
55
+ * UI closure unbinds the WebView and sends UI_CLOSE; on iOS the host also exits
56
+ * the UI when `onContentProcessDidTerminate` reports a content-process exit.
57
+ * The host may re-announce UI_OPEN after app resume or background dev respawn
58
+ * so the background can push a fresh snapshot. This router has no WebView
59
+ * heartbeat timeout.
61
60
  */
62
61
 
63
62
  export class MentraUIRouter {
@@ -85,9 +84,8 @@ export class MentraUIRouter {
85
84
  }
86
85
 
87
86
  /**
88
- * Called when the WebView unmounts (user navigated away or the host
89
- * tore it down on heartbeat timeout). Pushes UI_CLOSE to background
90
- * so handlers can flush state, then drops the binding.
87
+ * Called when the host tears down the WebView. Drops the binding and
88
+ * sends UI_CLOSE to the background so handlers can flush state.
91
89
  */
92
90
  unbindWebView(packageName: string): void {
93
91
  if (!this.bindings.has(packageName)) return
@@ -123,7 +121,6 @@ export class MentraUIRouter {
123
121
  * Recognised envelope types from the WebView shim:
124
122
  * - {type: "ready"} → fire UI_OPEN
125
123
  * - {type: "msg", seq, channel, payload} → fire UI_MESSAGE
126
- * - {type: "heartbeat", seq} → silently ack
127
124
  */
128
125
  routeFromWebView(packageName: string, rawJson: string): void {
129
126
  let env: {
@@ -317,12 +317,9 @@ class MiniappLauncher {
317
317
  /**
318
318
  * Re-spawn local miniapps that were running when the app was last killed.
319
319
  *
320
- * Cloud apps run on a remote server: the cloud persists which ones are
321
- * running and resurrects them when the phone reconnects, so a host-app
322
- * restart brings them back on its own. Local (phone-hosted) miniapps run in
323
- * the phone's own JS engine — a host-process kill tears down their JSContext
324
- * and there is no server to resurrect them, so without this they silently
325
- * stay stopped on the next launch even though the user left them running.
320
+ * Every miniapp runs as local JavaScript in the Mentra App on the phone.
321
+ * A host-process kill tears down its JSContext, so without this restoration
322
+ * it stays stopped on the next launch even though the user left it running.
326
323
  *
327
324
  * Each local miniapp persists its running flag to disk on start/stop
328
325
  * (`saveLocalAppRunningState`, via the applet's `onStart`/`onStop`). We read
@@ -331,9 +328,9 @@ class MiniappLauncher {
331
328
  * tray/switcher project it as running, exactly as a normal start would. The
332
329
  * WebView, if any, re-attaches lazily when the user opens the app.
333
330
  *
334
- * Idempotent and best-effort: skips already-spawned contexts, and clears the
335
- * persisted flag for any app whose bundle can no longer be resolved
336
- * (uninstalled, or dev server gone) so a dead entry doesn't retry every boot.
331
+ * Idempotent and best-effort: skips already-spawned contexts and clears the
332
+ * persisted running flag if ensureRunning fails (for example, bundle resolution,
333
+ * deployment policy, or context spawning) so it does not retry every boot.
337
334
  * Not compatibility-gated: a previously-running background app shouldn't be
338
335
  * dropped just because glasses are momentarily disconnected at boot — it
339
336
  * resumes when they reconnect, same as mid-session.
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Phone location service — engine-owned. Owns the background phone-GPS task: the
3
3
  * accuracy-tier control (`setLocationTier`), the accuracy mapping, and the
4
- * `expo-task-manager` background task that fans each fix to the v2 cloud
5
- * local miniapps (`location_update`). Cloud upload was V1 (removed).
4
+ * `expo-task-manager` background task that forwards the first fix in each batch
5
+ * to subscribed local miniapps (`location_update`). Cloud upload was V1 (removed).
6
6
  *
7
7
  * This used to be the host-injected `locationTier` runtime hook + a MantleManager
8
8
  * `TaskManager.defineTask`. It's device/OS plumbing (no UI), so it moved into engine:
@@ -21,8 +21,7 @@ import localMiniappRuntime from "./LocalMiniappRuntime"
21
21
 
22
22
  export const LOCATION_TASK_NAME = "handleLocationUpdates"
23
23
 
24
- // Background location task — sends each fix to the v2 cloud (RestComms) + local
25
- // miniapps. (The v1 SocketComms leg was already removed/commented before the move.)
24
+ // Background location task — forwards the first fix from each non-empty batch.
26
25
  TaskManager.defineTask<{locations?: Location.LocationObject[]}>(LOCATION_TASK_NAME, async ({data, error}) => {
27
26
  if (error) {
28
27
  // OS-level failure (permission revoked, GPS unavailable, …) — log it so
@@ -36,11 +35,8 @@ TaskManager.defineTask<{locations?: Location.LocationObject[]}>(LOCATION_TASK_NA
36
35
  return
37
36
  }
38
37
  const first = locs[0]!
39
- // Cloud path (relayMessageToApps) never reaches __phone__, so local miniapps rely
40
- // on this direct push.
41
- // Local miniapps get the update directly (the cloud relay never reaches
42
- // __phone__). The Cloud V1 upload that used to run here was removed with the
43
- // V1 ripout (issue #3392); a V2 location channel is separate product work.
38
+ // Deliver directly to local miniapps. The Cloud V1 upload that used to run
39
+ // here was removed with the V1 ripout (issue #3392).
44
40
  localMiniappRuntime.forwardEvent("location_update", {
45
41
  lat: first.coords.latitude,
46
42
  lng: first.coords.longitude,
@@ -23,8 +23,7 @@
23
23
  *
24
24
  * Important: this is the ONLY place that mints `streamId`s for phone-owned
25
25
  * streams. We use a `phone-` prefix so they're trivially distinguishable from
26
- * cloud-minted IDs in logs and from cloud-SDK app streams that flow through
27
- * the legacy path.
26
+ * cloud-minted managed-stream resource IDs in logs.
28
27
  *
29
28
  * BLE link loss is a SUSPENDED state, not a failure:
30
29
  * ASG owns the ten-second phone/controller liveness deadline. The coordinator
@@ -11,7 +11,10 @@ import type {StreamStatusEvent} from "@mentra/bluetooth-sdk/internal"
11
11
  */
12
12
  export const ENABLE_PIPELINE_FPS_TELEMETRY = false
13
13
 
14
- /** Fields forwarded to cloud / miniapps after the first resolvedConfig ack. */
14
+ /**
15
+ * Select stream-status fields for local miniapps. Include resolvedConfig only
16
+ * when requested by the caller; include stats only when FPS telemetry is enabled.
17
+ */
15
18
  export function slimStreamStatusEvent(
16
19
  event: StreamStatusEvent,
17
20
  options: {includeResolvedConfig?: boolean; enableFpsTelemetry?: boolean} = {},
@@ -381,8 +381,8 @@ export const useAppStatusStore = create<AppStatusState>((set, get) => ({
381
381
  // side effect of LocalMiniappView mounting on foreground; pulling it here
382
382
  // lets start() actually run the app even when nothing foregrounds it (e.g.
383
383
  // a system app launching another miniapp via session.miniapps). Idempotent
384
- // with the view's own ensureRunning; a no-op for native offline built-ins
385
- // and cloud apps (no JS bundle).
384
+ // with the view's own ensureRunning; skipped for native offline built-ins
385
+ // (no JS bundle).
386
386
  if (app.local) {
387
387
  try {
388
388
  await miniappLauncher.ensureRunning(packageName)
@@ -1,11 +1,9 @@
1
1
  /**
2
2
  * miniappGlobals — shared builder for the window.MentraOS globals injected
3
- * into every miniapp WebView (both cloud and local).
3
+ * into miniapp WebViews in the Mentra App on the phone.
4
4
  *
5
- * Authors should be able to use one API in their miniapp code regardless of
6
- * whether it's hosted in the cloud or on-device. So both injection paths
7
- * (webview.tsx for cloud miniapps, MiniappHost.tsx for local miniapps) funnel
8
- * through this util.
5
+ * Miniapps run locally. This util gives their WebView UI a consistent API
6
+ * for host capabilities, safe-area insets, and capsule-menu geometry.
9
7
  */
10
8
 
11
9
  import {Dimensions, Platform} from "react-native"