@mentra/engine 3.1.0-dev.9 → 3.1.0-dev.91
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.
- package/README.md +23 -5
- package/build/bluetooth-sdk/ota-transport.d.ts +2 -0
- package/build/bluetooth-sdk/ota-transport.d.ts.map +1 -0
- package/build/bluetooth-sdk/ota-transport.js +2 -0
- package/build/bluetooth-sdk/ota-transport.js.map +1 -0
- package/build/engine.d.ts +5 -2
- package/build/engine.d.ts.map +1 -1
- package/build/facades/ota.d.ts +11 -6
- package/build/facades/ota.d.ts.map +1 -1
- package/build/facades/ota.js +9 -5
- package/build/facades/ota.js.map +1 -1
- package/build/facades/pairing.d.ts +4 -0
- package/build/facades/pairing.d.ts.map +1 -1
- package/build/facades/pairing.js +81 -7
- package/build/facades/pairing.js.map +1 -1
- package/build/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/react/MentraLiveOtaFlow.d.ts +8 -2
- package/build/react/MentraLiveOtaFlow.d.ts.map +1 -1
- package/build/react/MentraLiveOtaFlow.js +256 -354
- package/build/react/MentraLiveOtaFlow.js.map +1 -1
- package/build/react/index.d.ts +1 -0
- package/build/react/index.d.ts.map +1 -1
- package/build/react/index.js +1 -0
- package/build/react/index.js.map +1 -1
- package/build/react/useMentraLiveOta.d.ts +84 -0
- package/build/react/useMentraLiveOta.d.ts.map +1 -0
- package/build/react/useMentraLiveOta.js +627 -0
- package/build/react/useMentraLiveOta.js.map +1 -0
- package/build/services/BlobStore.d.ts +2 -0
- package/build/services/BlobStore.d.ts.map +1 -1
- package/build/services/BlobStore.js +63 -10
- package/build/services/BlobStore.js.map +1 -1
- package/build/services/GlassesStatusProjection.d.ts +15 -2
- package/build/services/GlassesStatusProjection.d.ts.map +1 -1
- package/build/services/GlassesStatusProjection.js +3 -3
- package/build/services/GlassesStatusProjection.js.map +1 -1
- package/build/services/HotspotOtaTransport.d.ts.map +1 -1
- package/build/services/HotspotOtaTransport.js +8 -7
- package/build/services/HotspotOtaTransport.js.map +1 -1
- package/build/services/OtaAutoChain.d.ts +9 -2
- package/build/services/OtaAutoChain.d.ts.map +1 -1
- package/build/services/OtaAutoChain.js +10 -2
- package/build/services/OtaAutoChain.js.map +1 -1
- package/build/services/OtaInstallCoordinator.d.ts +26 -3
- package/build/services/OtaInstallCoordinator.d.ts.map +1 -1
- package/build/services/OtaInstallCoordinator.js +35 -13
- package/build/services/OtaInstallCoordinator.js.map +1 -1
- package/build/services/OtaService.d.ts.map +1 -1
- package/build/services/OtaService.js +1 -1
- package/build/services/OtaService.js.map +1 -1
- package/build/services/OtaUpdateCheckService.d.ts +4 -1
- package/build/services/OtaUpdateCheckService.d.ts.map +1 -1
- package/build/services/OtaUpdateCheckService.js +21 -5
- package/build/services/OtaUpdateCheckService.js.map +1 -1
- package/build/services/asg/localNetworkTransport.d.ts.map +1 -1
- package/build/services/asg/localNetworkTransport.js +13 -12
- package/build/services/asg/localNetworkTransport.js.map +1 -1
- package/build/services/glassesClockSync.js +1 -1
- package/build/services/glassesClockSync.js.map +1 -1
- package/build/services/otaInstallPolicy.d.ts +4 -0
- package/build/services/otaInstallPolicy.d.ts.map +1 -1
- package/build/services/otaInstallPolicy.js +4 -0
- package/build/services/otaInstallPolicy.js.map +1 -1
- package/build/services/otaReleaseVersion.d.ts +10 -0
- package/build/services/otaReleaseVersion.d.ts.map +1 -0
- package/build/services/otaReleaseVersion.js +14 -0
- package/build/services/otaReleaseVersion.js.map +1 -0
- package/build/stores/appVisibility.d.ts +3 -0
- package/build/stores/appVisibility.d.ts.map +1 -0
- package/build/stores/appVisibility.js +3 -0
- package/build/stores/appVisibility.js.map +1 -0
- package/build/stores/apps.d.ts.map +1 -1
- package/build/stores/apps.js +7 -1
- package/build/stores/apps.js.map +1 -1
- package/build/stores/core.d.ts +3 -3
- package/build/stores/core.d.ts.map +1 -1
- package/build/stores/core.js.map +1 -1
- package/build/stores/glasses.d.ts +10 -4
- package/build/stores/glasses.d.ts.map +1 -1
- package/build/stores/glasses.js.map +1 -1
- package/package.json +13 -6
- package/src/bluetooth-sdk/ota-transport.ts +1 -0
- package/src/facades/ota.ts +19 -6
- package/src/facades/pairing.ts +88 -12
- package/src/generated/releaseMetadata.ts +5 -5
- package/src/index.ts +2 -0
- package/src/react/MentraLiveOtaFlow.tsx +378 -480
- package/src/react/index.ts +14 -0
- package/src/react/useMentraLiveOta.ts +793 -0
- package/src/services/BlobStore.ts +57 -10
- package/src/services/GlassesStatusProjection.ts +7 -6
- package/src/services/HotspotOtaTransport.ts +8 -7
- package/src/services/OtaAutoChain.ts +26 -2
- package/src/services/OtaInstallCoordinator.ts +37 -13
- package/src/services/OtaService.ts +1 -2
- package/src/services/OtaUpdateCheckService.ts +26 -8
- package/src/services/asg/localNetworkTransport.ts +20 -19
- package/src/services/glassesClockSync.ts +1 -1
- package/src/services/otaInstallPolicy.ts +4 -0
- package/src/services/otaReleaseVersion.ts +22 -0
- package/src/stores/appVisibility.ts +3 -0
- package/src/stores/apps.ts +7 -1
- package/src/stores/core.ts +4 -4
- package/src/stores/glasses.ts +13 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otaInstallPolicy.js","sourceRoot":"","sources":["../../src/services/otaInstallPolicy.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAE1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAC5B,sFAAsF;AACtF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AACrC,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAA;AAC1C,kDAAkD;AAClD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAA;AAC/C,2DAA2D;AAC3D,MAAM,C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AC/E,IAAI,WAAW;QAAE,OAAO,QAAQ,CAAA;IAChC,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc,EAAE,4EAA4E;IAC5F,aAAa,EAAE,yCAAyC;IACxD,kBAAkB,EAAE,qCAAqC;IACzD,6BAA6B,EAAE,kFAAkF;IACjH,2BAA2B,EAAE,mEAAmE;IAChG,2BAA2B,EAAE,8EAA8E;IAC3G,kBAAkB,EAAE,wDAAwD;IAC5E,iBAAiB,EAAE,uEAAuE;IAC1F,mBAAmB,EAAE,uEAAuE;CACpF,CAAA","sourcesContent":["/** Shared OTA progress watchdog timings (see progress-legacy.tsx / progress.tsx). */\nimport type {OtaProgress, OtaStatus} from \"@mentra/bluetooth-sdk\"\n\n/**\n * First glasses `build_number` (ASG `versionCode`) that uses `progress.tsx` with unified\n * `ota_status` session UI. Strictly lower builds use `/ota/progress-legacy` (routed from\n * `check-for-updates.tsx` before navigation), and get the LEGACY_* padded policy below\n * in the unified OtaInstallCoordinator (WP 8C). Change only here.\n */\nexport const MINIMUM_OTA_STATUS_BUILD = 37\n\nexport const MAX_RETRIES = 3\n/** Wait between ended native ota_start requests; never overlaps a pending request. */\nexport const RETRY_INTERVAL_MS = 5000\n/** APK/BES and general install when progress events are expected */\nexport const PROGRESS_TIMEOUT_MS = 120_000\n/** Fail if still at 0% in starting/downloading */\nexport const DOWNLOAD_STUCK_TIMEOUT_MS = 70_000\n/** MTK system install often goes quiet for long periods */\nexport const MTK_INSTALL_TIMEOUT_MS = 300_000\n/** Whole multi-step session cap */\nexport const GLOBAL_OTA_TIMEOUT_MS = 20 * 60 * 1000\n/** BLE keepalive during OTA */\nexport const PING_INTERVAL_MS = 10_000\n/**\n * If we sent ota_query_status (e.g. on reconnect) and the glasses haven't\n * replied with an ota_status by then, fall back to ota_start. This recovers\n * from the case where the glasses process restarted between mount and\n * reconnect — the session is gone, ota_query_status returns nothing, and\n * the user would otherwise sit on the spinner forever.\n */\nexport const QUERY_REPLY_TIMEOUT_MS = 6000\n/** 15s lockout on the Continue button after a BES restart, to prevent an accidental tap. */\nexport const BES_CONTINUE_LOCKOUT_MS = 15_000\n\n// --- Legacy old-build (< MINIMUM_OTA_STATUS_BUILD) OTA policy (WP 8C) ---\n//\n// Ported verbatim from mobile/src/app/ota/progress-legacy.tsx, which padded EVERY\n// watchdog/timer by +20s for old ASG builds (\"Legacy OTA: +20s on every watchdog /\n// timer duration\"). Old builds respond slower on every path, so where the legacy\n// screen used a longer duration the coordinator applies the longer value whenever\n// the session is legacy-shaped (see isLegacyShapedOtaStatus / the coordinator's\n// session-shape check). Builds >= 37 keep the unpadded values above.\n\n/** The uniform pad progress-legacy.tsx added to every duration for old builds. */\nexport const LEGACY_EXTRA_TIMEOUT_MS = 20_000\nexport const LEGACY_RETRY_INTERVAL_MS = RETRY_INTERVAL_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_PROGRESS_TIMEOUT_MS = PROGRESS_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_DOWNLOAD_STUCK_TIMEOUT_MS = DOWNLOAD_STUCK_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_MTK_INSTALL_TIMEOUT_MS = MTK_INSTALL_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_GLOBAL_OTA_TIMEOUT_MS = GLOBAL_OTA_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_PING_INTERVAL_MS = PING_INTERVAL_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_BES_CONTINUE_LOCKOUT_MS = BES_CONTINUE_LOCKOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\n/**\n * After a legacy apk `install FINISHED` observed in-flight, the legacy screen held the\n * completed state for 12s (+20s pad) so the ASG process restart settles (and fresh\n * version_info lands) before the user can continue.\n */\nexport const LEGACY_APK_COMPLETION_SETTLE_MS = 12_000 + LEGACY_EXTRA_TIMEOUT_MS\n/**\n * Legacy MTK install stall simulation (display-only): the MTK system install typically\n * stalls around 49-50%. After LEGACY_MTK_STALL_DETECT_MS without a new event in the\n * [45, 55) zone, the legacy screen simulated +1% every LEGACY_MTK_SIM_TICK_MS starting\n * at max(stall+1, 51) and capped at 60%, purely to keep the user informed.\n */\nexport const LEGACY_MTK_STALL_DETECT_MS = 20_000 + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_MTK_SIM_TICK_MS = 15_000 + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_MTK_STALL_ZONE_MIN_PERCENT = 45\nexport const LEGACY_MTK_STALL_ZONE_MAX_PERCENT = 55\nexport const LEGACY_MTK_SIM_FLOOR_PERCENT = 51\nexport const LEGACY_MTK_SIM_CAP_PERCENT = 60\n\nexport type OtaProtocolProfile = \"legacy\" | \"unified\"\n\n/**\n * Legacy-shaped ota_status: old (< 37) ASG builds send `ota_progress`, which the SDK\n * (Android MentraLive.kt / iOS MentraLive.swift) maps to a unified ota_status with\n * sessionId \"\" and totalSteps 1, and FINISHED→\"complete\" regardless of phase. A real\n * (>= 37) session always carries a sessionId; an \"idle\" reply also has sessionId \"\" but\n * proves the glasses speak the unified protocol, so it is NOT legacy-shaped.\n */\nexport function isLegacyShapedOtaStatus(otaStatus: OtaStatus | null): boolean {\n return !!otaStatus && otaStatus.sessionId === \"\" && otaStatus.status !== \"idle\"\n}\n\n/**\n * Is the current install session legacy-shaped? Event shape wins when events exist\n * (per the WP 8C rule: key off legacy-shaped inputs, not a build flag, where possible);\n * before any event arrives only the glasses build number can tell.\n */\nexport function isLegacyShapedOtaSession(\n otaStatus: OtaStatus | null,\n otaProgress: OtaProgress | null,\n buildNumber: string | null | undefined,\n): boolean {\n if (otaStatus) return isLegacyShapedOtaStatus(otaStatus)\n if (otaProgress) return true\n const build = Number.parseInt(buildNumber ?? \"\", 10)\n return Number.isFinite(build) && build > 0 && build < MINIMUM_OTA_STATUS_BUILD\n}\n\n/**\n * Select the compatibility profile once at install-screen attach. The old split\n * routes made this decision from the pre-update build and kept it for the whole\n * mounted flow, even when an APK step restarted into a newer ASG build. Returning\n * null leaves the coordinator undecided until the first meaningful OTA event.\n */\nexport function selectOtaProtocolProfile(\n otaStatus: OtaStatus | null,\n otaProgress: OtaProgress | null,\n buildNumber: string | null | undefined,\n): OtaProtocolProfile | null {\n const build = Number.parseInt(buildNumber ?? \"\", 10)\n if (Number.isFinite(build) && build > 0) {\n return build < MINIMUM_OTA_STATUS_BUILD ? \"legacy\" : \"unified\"\n }\n if (otaStatus) return isLegacyShapedOtaStatus(otaStatus) ? \"legacy\" : \"unified\"\n if (otaProgress) return \"legacy\"\n return null\n}\n\nexport const OtaProgressMessages = {\n stalledOrStuck: \"Update may have failed. Ensure glasses have internet access and try again.\",\n globalTimeout: \"Update took too long. Please try again.\",\n sendOtaStartFailed: \"Failed to communicate with glasses.\",\n hotspotArtifactDownloadFailed: \"Could not download the update to your phone. Check phone internet and try again.\",\n hotspotArtifactVerifyFailed: \"The update package could not be verified. Please try again later.\",\n hotspotWifiPermissionDenied: \"Allow nearby devices access so the phone can connect to the glasses hotspot.\",\n hotspotStartFailed: \"Could not start the glasses hotspot. Please try again.\",\n hotspotJoinFailed: \"Could not connect the phone to the glasses hotspot. Please try again.\",\n hotspotServerFailed: \"Could not make the update available to the glasses. Please try again.\",\n} as const\n"]}
|
|
1
|
+
{"version":3,"file":"otaInstallPolicy.js","sourceRoot":"","sources":["../../src/services/otaInstallPolicy.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAE1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAC5B,sFAAsF;AACtF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AACrC,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAA;AAC1C,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,EAAE,CAAC;QACxC,OAAO,KAAK,GAAG,wBAAwB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;IAChE,CAAC;IACD,IAAI,SAAS;QAAE,OAAO,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/E,IAAI,WAAW;QAAE,OAAO,QAAQ,CAAA;IAChC,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc,EAAE,4EAA4E;IAC5F,aAAa,EAAE,yCAAyC;IACxD,cAAc,EAAE,iFAAiF;IACjG,kBAAkB,EAAE,qCAAqC;IACzD,6BAA6B,EAAE,kFAAkF;IACjH,2BAA2B,EAAE,mEAAmE;IAChG,2BAA2B,EAAE,8EAA8E;IAC3G,kBAAkB,EAAE,wDAAwD;IAC5E,iBAAiB,EAAE,uEAAuE;IAC1F,mBAAmB,EAAE,uEAAuE;CACpF,CAAA","sourcesContent":["/** Shared OTA progress watchdog timings (see progress-legacy.tsx / progress.tsx). */\nimport type {OtaProgress, OtaStatus} from \"@mentra/bluetooth-sdk\"\n\n/**\n * First glasses `build_number` (ASG `versionCode`) that uses `progress.tsx` with unified\n * `ota_status` session UI. Strictly lower builds use `/ota/progress-legacy` (routed from\n * `check-for-updates.tsx` before navigation), and get the LEGACY_* padded policy below\n * in the unified OtaInstallCoordinator (WP 8C). Change only here.\n */\nexport const MINIMUM_OTA_STATUS_BUILD = 37\n\nexport const MAX_RETRIES = 3\n/** Wait between ended native ota_start requests; never overlaps a pending request. */\nexport const RETRY_INTERVAL_MS = 5000\n/** APK/BES and general install when progress events are expected */\nexport const PROGRESS_TIMEOUT_MS = 120_000\n/** Fail if still at 0% in starting/downloading */\nexport const DOWNLOAD_STUCK_TIMEOUT_MS = 70_000\n/** MTK system install often goes quiet for long periods */\nexport const MTK_INSTALL_TIMEOUT_MS = 300_000\n/** Whole multi-step session cap */\nexport const GLOBAL_OTA_TIMEOUT_MS = 20 * 60 * 1000\n/** BLE keepalive during OTA */\nexport const PING_INTERVAL_MS = 10_000\n/**\n * If we sent ota_query_status (e.g. on reconnect) and the glasses haven't\n * replied with an ota_status by then, fall back to ota_start. This recovers\n * from the case where the glasses process restarted between mount and\n * reconnect — the session is gone, ota_query_status returns nothing, and\n * the user would otherwise sit on the spinner forever.\n */\nexport const QUERY_REPLY_TIMEOUT_MS = 6000\n/** 15s lockout on the Continue button after a BES restart, to prevent an accidental tap. */\nexport const BES_CONTINUE_LOCKOUT_MS = 15_000\n/** Fail closed if a BES reboot never reconnects; normal restarts complete in a fraction of this window. */\nexport const BES_RESTART_TIMEOUT_MS = 120_000\n\n// --- Legacy old-build (< MINIMUM_OTA_STATUS_BUILD) OTA policy (WP 8C) ---\n//\n// Ported verbatim from mobile/src/app/ota/progress-legacy.tsx, which padded EVERY\n// watchdog/timer by +20s for old ASG builds (\"Legacy OTA: +20s on every watchdog /\n// timer duration\"). Old builds respond slower on every path, so where the legacy\n// screen used a longer duration the coordinator applies the longer value whenever\n// the session is legacy-shaped (see isLegacyShapedOtaStatus / the coordinator's\n// session-shape check). Builds >= 37 keep the unpadded values above.\n\n/** The uniform pad progress-legacy.tsx added to every duration for old builds. */\nexport const LEGACY_EXTRA_TIMEOUT_MS = 20_000\nexport const LEGACY_RETRY_INTERVAL_MS = RETRY_INTERVAL_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_PROGRESS_TIMEOUT_MS = PROGRESS_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_DOWNLOAD_STUCK_TIMEOUT_MS = DOWNLOAD_STUCK_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_MTK_INSTALL_TIMEOUT_MS = MTK_INSTALL_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_GLOBAL_OTA_TIMEOUT_MS = GLOBAL_OTA_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_PING_INTERVAL_MS = PING_INTERVAL_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_BES_CONTINUE_LOCKOUT_MS = BES_CONTINUE_LOCKOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_BES_RESTART_TIMEOUT_MS = BES_RESTART_TIMEOUT_MS + LEGACY_EXTRA_TIMEOUT_MS\n/**\n * After a legacy apk `install FINISHED` observed in-flight, the legacy screen held the\n * completed state for 12s (+20s pad) so the ASG process restart settles (and fresh\n * version_info lands) before the user can continue.\n */\nexport const LEGACY_APK_COMPLETION_SETTLE_MS = 12_000 + LEGACY_EXTRA_TIMEOUT_MS\n/**\n * Legacy MTK install stall simulation (display-only): the MTK system install typically\n * stalls around 49-50%. After LEGACY_MTK_STALL_DETECT_MS without a new event in the\n * [45, 55) zone, the legacy screen simulated +1% every LEGACY_MTK_SIM_TICK_MS starting\n * at max(stall+1, 51) and capped at 60%, purely to keep the user informed.\n */\nexport const LEGACY_MTK_STALL_DETECT_MS = 20_000 + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_MTK_SIM_TICK_MS = 15_000 + LEGACY_EXTRA_TIMEOUT_MS\nexport const LEGACY_MTK_STALL_ZONE_MIN_PERCENT = 45\nexport const LEGACY_MTK_STALL_ZONE_MAX_PERCENT = 55\nexport const LEGACY_MTK_SIM_FLOOR_PERCENT = 51\nexport const LEGACY_MTK_SIM_CAP_PERCENT = 60\n\nexport type OtaProtocolProfile = \"legacy\" | \"unified\"\n\n/**\n * Legacy-shaped ota_status: old (< 37) ASG builds send `ota_progress`, which the SDK\n * (Android MentraLive.kt / iOS MentraLive.swift) maps to a unified ota_status with\n * sessionId \"\" and totalSteps 1, and FINISHED→\"complete\" regardless of phase. A real\n * (>= 37) session always carries a sessionId; an \"idle\" reply also has sessionId \"\" but\n * proves the glasses speak the unified protocol, so it is NOT legacy-shaped.\n */\nexport function isLegacyShapedOtaStatus(otaStatus: OtaStatus | null): boolean {\n return !!otaStatus && otaStatus.sessionId === \"\" && otaStatus.status !== \"idle\"\n}\n\n/**\n * Is the current install session legacy-shaped? Event shape wins when events exist\n * (per the WP 8C rule: key off legacy-shaped inputs, not a build flag, where possible);\n * before any event arrives only the glasses build number can tell.\n */\nexport function isLegacyShapedOtaSession(\n otaStatus: OtaStatus | null,\n otaProgress: OtaProgress | null,\n buildNumber: string | null | undefined,\n): boolean {\n if (otaStatus) return isLegacyShapedOtaStatus(otaStatus)\n if (otaProgress) return true\n const build = Number.parseInt(buildNumber ?? \"\", 10)\n return Number.isFinite(build) && build > 0 && build < MINIMUM_OTA_STATUS_BUILD\n}\n\n/**\n * Select the compatibility profile once at install-screen attach. The old split\n * routes made this decision from the pre-update build and kept it for the whole\n * mounted flow, even when an APK step restarted into a newer ASG build. Returning\n * null leaves the coordinator undecided until the first meaningful OTA event.\n */\nexport function selectOtaProtocolProfile(\n otaStatus: OtaStatus | null,\n otaProgress: OtaProgress | null,\n buildNumber: string | null | undefined,\n): OtaProtocolProfile | null {\n const build = Number.parseInt(buildNumber ?? \"\", 10)\n if (Number.isFinite(build) && build > 0) {\n return build < MINIMUM_OTA_STATUS_BUILD ? \"legacy\" : \"unified\"\n }\n if (otaStatus) return isLegacyShapedOtaStatus(otaStatus) ? \"legacy\" : \"unified\"\n if (otaProgress) return \"legacy\"\n return null\n}\n\nexport const OtaProgressMessages = {\n stalledOrStuck: \"Update may have failed. Ensure glasses have internet access and try again.\",\n globalTimeout: \"Update took too long. Please try again.\",\n restartTimeout: \"Glasses did not finish restarting. Restart them before trying the update again.\",\n sendOtaStartFailed: \"Failed to communicate with glasses.\",\n hotspotArtifactDownloadFailed: \"Could not download the update to your phone. Check phone internet and try again.\",\n hotspotArtifactVerifyFailed: \"The update package could not be verified. Please try again later.\",\n hotspotWifiPermissionDenied: \"Allow nearby devices access so the phone can connect to the glasses hotspot.\",\n hotspotStartFailed: \"Could not start the glasses hotspot. Please try again.\",\n hotspotJoinFailed: \"Could not connect the phone to the glasses hotspot. Please try again.\",\n hotspotServerFailed: \"Could not make the update available to the glasses. Please try again.\",\n} as const\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type OtaReleaseVersionInput = {
|
|
2
|
+
manifestReleaseVersion?: string | null;
|
|
3
|
+
manifestUrl: string;
|
|
4
|
+
packagedManifestUrl?: string | null;
|
|
5
|
+
packagedReleaseIdentity?: string | null;
|
|
6
|
+
};
|
|
7
|
+
/** Resolve the label for the selected OTA pin, including stable promotion of exact beta OTA bytes. */
|
|
8
|
+
export declare function resolveOtaReleaseVersion(input: OtaReleaseVersionInput): string | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=otaReleaseVersion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otaReleaseVersion.d.ts","sourceRoot":"","sources":["../../src/services/otaReleaseVersion.ts"],"names":[],"mappings":"AAEA,KAAK,sBAAsB,GAAG;IAC5B,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxC,CAAA;AAOD,sGAAsG;AACtG,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI,CAMrF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const COORDINATED_RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-(?:dev|beta)\.[1-9]\d*)?$/;
|
|
2
|
+
function validReleaseVersion(version) {
|
|
3
|
+
const trimmed = version?.trim();
|
|
4
|
+
return trimmed && COORDINATED_RELEASE_VERSION.test(trimmed) ? trimmed : null;
|
|
5
|
+
}
|
|
6
|
+
/** Resolve the label for the selected OTA pin, including stable promotion of exact beta OTA bytes. */
|
|
7
|
+
export function resolveOtaReleaseVersion(input) {
|
|
8
|
+
const packagedRelease = validReleaseVersion(input.packagedReleaseIdentity);
|
|
9
|
+
if (packagedRelease && input.packagedManifestUrl?.trim() === input.manifestUrl.trim()) {
|
|
10
|
+
return packagedRelease;
|
|
11
|
+
}
|
|
12
|
+
return validReleaseVersion(input.manifestReleaseVersion);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=otaReleaseVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otaReleaseVersion.js","sourceRoot":"","sources":["../../src/services/otaReleaseVersion.ts"],"names":[],"mappings":"AAAA,MAAM,2BAA2B,GAAG,6CAA6C,CAAA;AASjF,SAAS,mBAAmB,CAAC,OAAkC;IAC7D,MAAM,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,CAAA;IAC/B,OAAO,OAAO,IAAI,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA;AAC9E,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,wBAAwB,CAAC,KAA6B;IACpE,MAAM,eAAe,GAAG,mBAAmB,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;IAC1E,IAAI,eAAe,IAAI,KAAK,CAAC,mBAAmB,EAAE,IAAI,EAAE,KAAK,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;QACtF,OAAO,eAAe,CAAA;IACxB,CAAC;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;AAC1D,CAAC","sourcesContent":["const COORDINATED_RELEASE_VERSION = /^\\d+\\.\\d+\\.\\d+(?:-(?:dev|beta)\\.[1-9]\\d*)?$/\n\ntype OtaReleaseVersionInput = {\n manifestReleaseVersion?: string | null\n manifestUrl: string\n packagedManifestUrl?: string | null\n packagedReleaseIdentity?: string | null\n}\n\nfunction validReleaseVersion(version: string | null | undefined): string | null {\n const trimmed = version?.trim()\n return trimmed && COORDINATED_RELEASE_VERSION.test(trimmed) ? trimmed : null\n}\n\n/** Resolve the label for the selected OTA pin, including stable promotion of exact beta OTA bytes. */\nexport function resolveOtaReleaseVersion(input: OtaReleaseVersionInput): string | null {\n const packagedRelease = validReleaseVersion(input.packagedReleaseIdentity)\n if (packagedRelease && input.packagedManifestUrl?.trim() === input.manifestUrl.trim()) {\n return packagedRelease\n }\n return validReleaseVersion(input.manifestReleaseVersion)\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appVisibility.d.ts","sourceRoot":"","sources":["../../src/stores/appVisibility.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,OAAO,EAAE,YAAY,OAAO,KAAG,OACrD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appVisibility.js","sourceRoot":"","sources":["../../src/stores/appVisibility.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,cAAuB,EAAE,UAAmB,EAAW,EAAE,CAC3F,cAAc,IAAI,UAAU,CAAA","sourcesContent":["/** Combine registry-enforced visibility with the user's home-screen choice. */\nexport const resolveHiddenStatus = (registryHidden: boolean, userHidden: boolean): boolean =>\n registryHidden || userHidden\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/stores/apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAC,WAAW,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAA;AAG9D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/stores/apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAC,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S,SAAS,YAAY,KAAK,OAAO,CAAC,OAAO,CA+eM,CAAA;AACvE,eAAO,MAAM,OAAO,sBA/eE,MAAM,KAAK,OAAO,CAAC,IAAI,CA+ewB,CAAA;AACrE,eAAO,MAAM,gBAAgB,sBA/eE,MAAM,KAAK,OAAO,CAAC,IAAI,CA+eiC,CAAA;AACvF,eAAO,MAAM,kBAAkB,cA/eN,IA+ekE,CAAA;AAC3F,eAAO,MAAM,UAAU,cArfN,OAAO,CAAC,IAAI,CAqf8C,CAAA;AAC3E,eAAO,MAAM,UAAU,cAhfN,WAAW,CAAC,IAAI,EAAE,KAAK,CAgfmC,CAAA;AAC3E,eAAO,MAAM,UAAU,cAhfN,MAAM,SAAS;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAC,KAAK,WAAW,CAAC,IAAI,EAAE,KAAK,CAgfX,CAAA;AAC3E,eAAO,MAAM,YAAY,sBAhfE,MAAM,YAAY,MAAM,KAAK,WAAW,CAAC,IAAI,EAAE,KAAK,CAgfA,CAAA;AAE/E,eAAO,MAAM,aAAa,mBAGzB,CAAA;AAED,eAAO,MAAM,uBAAuB,mBAGnC,CAAA;AAED,eAAO,MAAM,iBAAiB;;;CAS7B,CAAA;AAED,eAAO,MAAM,sBAAsB,wBAGlC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,wBAG5B,CAAA;AAED,eAAO,MAAM,4BAA4B,cAGxC,CAAA;AAED,eAAO,MAAM,gBAAgB,mBAG5B,CAAA"}
|
package/build/stores/apps.js
CHANGED
|
@@ -22,6 +22,7 @@ import { islandNotifications } from "../services/NotificationsEmitter";
|
|
|
22
22
|
import sttModelManager from "../services/STTModelManager";
|
|
23
23
|
import { miniappLauncher } from "../services/MiniappLauncher";
|
|
24
24
|
import { miniappRunningRegistry } from "../services/MiniappRunningRegistry";
|
|
25
|
+
import { resolveHiddenStatus } from "./appVisibility";
|
|
25
26
|
import { SETTINGS, useSettingsStore } from "./settings";
|
|
26
27
|
import BluetoothSdk from "@mentra/bluetooth-sdk";
|
|
27
28
|
let hostHooks = {};
|
|
@@ -143,7 +144,12 @@ function projectApps(previousState, localApps) {
|
|
|
143
144
|
...app,
|
|
144
145
|
screenshot: previousByPackage.get(app.packageName)?.screenshot ?? app.screenshot,
|
|
145
146
|
compatibility: HardwareCompatibility.checkCompatibility(app.hardwareRequirements, capabilities),
|
|
146
|
-
|
|
147
|
+
// A registry source can force an app off the primary home screen (for
|
|
148
|
+
// example, Miniapp Developer while its home-screen setting is disabled).
|
|
149
|
+
// Compose that gate with the user's persisted home-screen layout instead
|
|
150
|
+
// of replacing it, otherwise a default-false persisted value makes a
|
|
151
|
+
// source-hidden app visible again during projection.
|
|
152
|
+
hidden: resolveHiddenStatus(app.hidden, previousState.getHiddenStatus(app.packageName)),
|
|
147
153
|
// Derive the foreground flag from the store's single source of truth
|
|
148
154
|
// (`foregroundedPackage`), NOT from the previous snapshot. Carrying it over
|
|
149
155
|
// per-app meant a refresh that momentarily omitted an app (e.g. the
|
package/build/stores/apps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/stores/apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAsB,MAAM,IAAI,GAAG,EAAC,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAG9B,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAC,qBAAqB,EAA2B,MAAM,4BAA4B,CAAA;AAC1F,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAA;AAChD,OAAO,WAAW,MAAM,yBAAyB,CAAA;AACjD,OAAO,mBAAmB,MAAM,iCAAiC,CAAA;AACjE,OAAO,E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,CAAC,IAAI,CAAC,CAAC,CAAA;AACrG,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/D,CAAC,CAAA","sourcesContent":["/**\n * Engine apps store — runtime state of installed and local applets.\n *\n * The OEM-facing API: subscribe to the running set, install/uninstall\n * miniapps, start/stop them. The store delegates install plumbing to\n * AppRegistry, and exposes hooks (`useApps`, `useStart`, `useStop`,\n * `useRefresh`, `useStopAll`) that the host UI can read.\n *\n * Source of `apps`:\n * - Local: appRegistry.getInstalledMiniapps() (always)\n */\n\nimport {useMemo} from \"react\"\nimport {AsyncResult, Result, result as Res} from \"typesafe-ts\"\nimport {create} from \"zustand\"\n\nimport type {ClientApp} from \"../types/applet\"\nimport {DeviceTypes} from \"../types/enums\"\nimport {getModelCapabilities} from \"../types/hardware\"\nimport {HardwareCompatibility, type CompatibilityResult} from \"../utils/hardware/hardware\"\nimport {storage} from \"../utils/storage/storage\"\nimport appRegistry from \"../services/AppRegistry\"\nimport localDisplayManager from \"../services/LocalDisplayManager\"\nimport {islandNotifications} from \"../services/NotificationsEmitter\"\nimport sttModelManager from \"../services/STTModelManager\"\nimport {miniappLauncher} from \"../services/MiniappLauncher\"\nimport {miniappRunningRegistry} from \"../services/MiniappRunningRegistry\"\nimport {SETTINGS, useSettingsStore} from \"./settings\"\nimport BluetoothSdk from \"@mentra/bluetooth-sdk\"\n\n// ---------------------------------------------------------------------------\n// Configuration / hooks\n// ---------------------------------------------------------------------------\n\nexport interface StartOptions {\n skipNavigation?: boolean\n}\n\nexport interface AppStoreHooks {\n /**\n * A start was blocked because the app is hardware-incompatible. Engine made\n * the decision (and raised the `version_incompatible` notification); the host\n * renders its branded alert here.\n */\n onIncompatibleBlocked?: (app: ClientApp) => void\n /**\n * A start was blocked because the app requires the on-device STT model\n * (declared at registration — see AppRegistry.installOfflineApp) and none is\n * installed. Engine decided via its model manager; the host renders the\n * alert / settings navigation here.\n */\n onMissingSpeechModel?: (app: ClientApp) => void\n /**\n * An open request passed the gates — fired on EVERY open, including\n * re-opening an already-running app, so the host's navigation / open\n * animation always plays.\n */\n onOpenRequested?: (app: ClientApp, opts?: StartOptions) => void\n}\n\nlet hostHooks: AppStoreHooks = {}\n\nexport function installAppStoreHooks(hooks: AppStoreHooks): void {\n hostHooks = {...hostHooks, ...hooks}\n}\n\n// ---------------------------------------------------------------------------\n// Store\n// ---------------------------------------------------------------------------\n\ninterface AppStatusState {\n apps: ClientApp[]\n /**\n * Source of truth for which app is foregrounded in the Compositor overlay.\n * The per-app `foregrounded` boolean is derived from this in `projectApps`\n * so a refresh can never drop the flag when an app is transiently missing\n * from one of the two refresh passes (local-only then merged). See\n * `projectApps` / `setForeground` / `clearForeground`.\n */\n foregroundedPackage: string | null\n refresh: () => Promise<void>\n /** Resolves true if the app actually started; false if a host gate aborted it or its JS context failed to spawn. */\n start: (app: ClientApp, opts?: StartOptions) => Promise<boolean>\n stop: (packageName: string) => Promise<void>\n setForeground: (packageName: string) => Promise<void>\n clearForeground: () => void\n stopAll: () => AsyncResult<void, Error>\n install: (url: string, opts?: {versionOverride?: string}) => AsyncResult<void, Error>\n uninstall: (packageName: string, version?: string) => AsyncResult<void, Error>\n saveScreenshot: (packageName: string, screenshot: string) => Promise<void>\n setHiddenStatus: (packageName: string, status: boolean) => void\n getHiddenStatus: (packageName: string) => boolean\n /** Replace the whole apps array. Hosts use this when their extra source changes. */\n setApps: (apps: ClientApp[]) => void\n}\n\nexport const DUMMY_APPLET: ClientApp = {\n packageName: \"\",\n name: \"\",\n webviewUrl: \"\",\n logoUrl: \"\",\n type: \"standard\",\n permissions: [],\n running: false,\n loading: false,\n healthy: true,\n hardwareRequirements: [],\n offline: true,\n offlineRoute: \"\",\n local: false,\n hidden: false,\n}\n\nexport type OrderMap = Record<string, number>\nconst APP_ORDER_KEY = \"foreground_apps_order\"\n\nexport const saveAppsOrder = (orderMap: OrderMap): Result<void, Error> => {\n return storage.save(APP_ORDER_KEY, orderMap)\n}\n\nexport const getAppsOrder = (): Result<OrderMap, Error> => {\n return storage.load<OrderMap>(APP_ORDER_KEY)\n}\n\n// In-memory cache for hidden flags. `projectApps` reads getHiddenStatus once\n// per app per refresh — without a cache that was a synchronous JNI hop per\n// app per refresh on a hot UI path. Kept consistent with disk by writing\n// through in setHiddenStatus. Map of packageName → hidden boolean.\nconst hiddenStatusCache = new Map<string, boolean>()\n\nconst getRawPackageNamePriority = (pkg: string): number => {\n if (pkg.includes(\"@empty\")) {\n return 1000\n }\n return 0\n}\n\nexport const sortAppsByPackageNamePriority = (a: ClientApp, b: ClientApp): number => {\n const pa = getRawPackageNamePriority(a.packageName)\n const pb = getRawPackageNamePriority(b.packageName)\n if (pa !== pb) {\n return pa - pb\n }\n return a.name.localeCompare(b.name)\n}\n\nexport const saveLastOpenTime = (packageName: string): void => {\n storage.save(`${packageName}_last_open_time`, Date.now())\n}\n\nexport const getLastOpenTime = (packageName: string): number => {\n const res = storage.load<number>(`${packageName}_last_open_time`)\n if (res.is_ok()) return res.value\n return 0\n}\n\nexport const sortAppsByLastOpenTime = async <T extends {packageName: string}>(apps: T[]): Promise<T[]> => {\n const timestamps = apps.map((app) => ({app, time: getLastOpenTime(app.packageName)}))\n return timestamps.sort((a, b) => a.time - b.time).map((entry) => entry.app)\n}\n\nconst startStopApp = async (app: ClientApp, status: boolean): Promise<void> => {\n if (!status && app.onStop) {\n try {\n app.onStop()\n } catch (e) {\n console.warn(`ISLAND: onStop threw for ${app.packageName}`, e)\n }\n }\n if (status && app.onStart) {\n try {\n app.onStart()\n } catch (e) {\n console.warn(`ISLAND: onStart threw for ${app.packageName}`, e)\n }\n }\n}\n\n/**\n * Build the final `apps` array for the store from the installed/offline app\n * source. Pure — same inputs -> same outputs.\n */\nfunction projectApps(previousState: AppStatusState, localApps: ClientApp[]): ClientApp[] {\n // Dedupe by packageName, keep first occurrence.\n const byPackage = new Map<string, ClientApp>()\n for (const app of localApps) {\n if (!byPackage.has(app.packageName)) byPackage.set(app.packageName, app)\n }\n\n // Index previous snapshot for cheap lookups (was O(N²) via .find()).\n const previousByPackage = new Map<string, ClientApp>()\n for (const oldApp of previousState.apps) {\n previousByPackage.set(oldApp.packageName, oldApp)\n }\n\n const defaultWearable =\n (useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key) as DeviceTypes | undefined) ||\n DeviceTypes.NONE\n const capabilities = getModelCapabilities(defaultWearable)\n\n // Single pass: dedupe → screenshot carry-over → compat → hidden, all into\n // fresh objects. The previous in-place mutation re-used object references\n // across refreshes, which broke React.memo / referential-equality\n // memoization downstream (every refresh propagated re-renders even when\n // nothing meaningful changed) AND tripped Reanimated's \"tried to modify\n // key of an object already passed to a worklet\" warning whenever the home\n // screen's animated app cards held a reference to a previous snapshot's\n // app object that we then mutated.\n //\n // Identity stability: refresh() is event-driven and fires repeatedly (and\n // twice per cycle via the local-only → merged two-pass emit). If we always\n // returned fresh objects, every poll changed the identity of EVERY app —\n // which re-rendered the Compositor (via useForegroundApp) mid-slide and made\n // the open/close animation hitch, and churned the home grid / switcher pill.\n // So we build the candidate object, then REUSE the previous reference when\n // nothing meaningful changed. Same pattern as the miniappRunningRegistry\n // projection below. A stable foreground-app reference lets the Compositor's\n // slide run uninterrupted on the UI thread.\n return Array.from(byPackage.values()).map((app) => {\n const next: ClientApp = {\n ...app,\n screenshot: previousByPackage.get(app.packageName)?.screenshot ?? app.screenshot,\n compatibility: HardwareCompatibility.checkCompatibility(app.hardwareRequirements, capabilities),\n hidden: previousState.getHiddenStatus(app.packageName),\n // Derive the foreground flag from the store's single source of truth\n // (`foregroundedPackage`), NOT from the previous snapshot. Carrying it over\n // per-app meant a refresh that momentarily omitted an app (e.g. the\n // two-pass local-only → merged emit) would reset its flag to false — which\n // raced OfflineAppHost's interceptor guard and made the hosted miniapp fall\n // through to the root router (restart). Deriving here keeps the flag stable\n // across both passes.\n foregrounded: app.packageName === previousState.foregroundedPackage,\n }\n const prev = previousByPackage.get(app.packageName)\n return prev && shallowEqualApp(prev, next) ? prev : next\n })\n}\n\n// Cheap equality check used by projectApps to preserve object identity across\n// refreshes when nothing meaningful changed. Most keys are compared by\n// reference (the source app's nested fields — permissions, hardwareRequirements,\n// parameters — are reference-stable within a refresh). The ONE exception is\n// `compatibility`, which projectApps recomputes into a fresh object every call;\n// comparing it by reference would always differ and defeat the whole point. We\n// compare it structurally instead so identity is only broken when the device's\n// actual compatibility verdict changes (e.g. glasses connect/disconnect).\nfunction shallowEqualApp(a: ClientApp, b: ClientApp): boolean {\n const aKeys = Object.keys(a) as (keyof ClientApp)[]\n const bKeys = Object.keys(b) as (keyof ClientApp)[]\n if (aKeys.length !== bKeys.length) return false\n for (const k of aKeys) {\n if (k === \"compatibility\") {\n if (!compatibilityEqual(a.compatibility, b.compatibility)) return false\n continue\n }\n if (a[k] !== b[k]) return false\n }\n return true\n}\n\nfunction compatibilityEqual(a?: CompatibilityResult, b?: CompatibilityResult): boolean {\n if (a === b) return true\n if (!a || !b) return false\n return (\n a.isCompatible === b.isCompatible &&\n a.missingRequired.length === b.missingRequired.length &&\n a.missingOptional.length === b.missingOptional.length &&\n a.warnings.length === b.warnings.length\n )\n}\n\nexport const useAppStatusStore = create<AppStatusState>((set, get) => ({\n apps: [],\n foregroundedPackage: null,\n\n refresh: async () => {\n const previousState = get()\n const localApps = await appRegistry.getInstalledMiniapps()\n set({apps: projectApps(previousState, localApps)})\n },\n\n start: async (clientApp: ClientApp, opts?: StartOptions) => {\n const state = get()\n const packageName = clientApp.packageName\n const app = state.apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: app not found for package name: ${packageName}`)\n return false\n }\n\n // Skip spawning a NEW app while another is mid-launch — concurrent spawns\n // race the foreground-only-one teardown. This is checked BEFORE the gates\n // and the onOpenRequested seam (which navigates/foregrounds) so a gated\n // launch doesn't paint a splash it can't back. Re-opening an already-running\n // app is exempt: it has nothing to spawn, so it skips this gate and is\n // allowed to re-navigate/animate below.\n // That exemption is the fix for the \"second tap during another app's launch\n // window silently does nothing\" bug.\n if (!app.running && state.apps.some((a) => a.loading)) {\n console.log(`ISLAND: skipping start ${packageName} — another app is loading`)\n return false\n }\n\n if (!app.offline && !app.local) {\n console.warn(`ISLAND: cloud-v1 app entries are no longer supported: ${packageName}`)\n return false\n }\n\n // Hardware-compatibility gate — engine decides and blocks; the host renders\n // its branded alert via onIncompatibleBlocked (and/or the structured\n // notification below). `!isCompatible` (not `=== false`) keeps the semantics\n // of the host gate this replaces: an unknown verdict blocks, not launches.\n if (!app.compatibility?.isCompatible) {\n islandNotifications.emit({\n kind: \"version_incompatible\",\n packageName,\n reason: `${app.name ?? packageName} is not compatible with the connected glasses`,\n metadata: {missingRequired: app.compatibility?.missingRequired ?? []},\n timestamp: Date.now(),\n })\n hostHooks.onIncompatibleBlocked?.(app)\n return false\n }\n\n // Missing-speech-model gate for apps registered with requiresLocalSttModel.\n // Engine decides via its own model manager; the host renders the alert and\n // any settings navigation via onMissingSpeechModel.\n if (appRegistry.requiresLocalSttModel(packageName) && !(await sttModelManager.isModelAvailable())) {\n islandNotifications.emit({\n kind: \"missing_speech_model\",\n packageName,\n reason: `${app.name ?? packageName} needs an on-device speech model before it can start`,\n timestamp: Date.now(),\n })\n hostHooks.onMissingSpeechModel?.(app)\n return false\n }\n\n // Host navigation / open-animation seam. Runs on EVERY accepted open —\n // including re-opening an already-running app — so the animation always\n // plays (BuiltInMiniappCatalog.navigateForApp: overlay apps setForeground\n // for the slide).\n hostHooks.onOpenRequested?.(app, opts)\n\n // First-activation mark (moved from the host's old beforeStart — engine\n // owns the settings store).\n useSettingsStore.getState().setSetting(SETTINGS.has_ever_activated_app.key, true)\n\n // If the tapped app is already running, this is a re-open: the nav/foreground\n // above already drove the animation, and there's nothing to spawn. Short-\n // circuit before the spawn pipeline.\n if (app.running) {\n saveLastOpenTime(packageName)\n return true\n }\n\n // Foreground-only-one rule: stop other running standard apps.\n if (app.type === \"standard\") {\n const runningForeground = state.apps.filter(\n (a) => a.running && a.type === \"standard\" && a.packageName !== packageName,\n )\n for (const r of runningForeground) {\n await get().stop(r.packageName)\n }\n }\n\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, running: true, loading: false} : a)),\n }))\n\n saveLastOpenTime(packageName)\n await startStopApp(app, true)\n\n // Spawn the background JS context for local miniapps. This used to be a\n // side effect of LocalMiniappView mounting on foreground; pulling it here\n // lets start() actually run the app even when nothing foregrounds it (e.g.\n // a system app launching another miniapp via session.miniapps). Idempotent\n // with the view's own ensureRunning; a no-op for native offline built-ins\n // and cloud apps (no JS bundle).\n if (app.local) {\n try {\n await miniappLauncher.ensureRunning(packageName)\n } catch (e) {\n // Spawn / bundle-resolve failed — revert the optimistic running flag so\n // the home list and miniapps.list() don't show a \"running\" app with no\n // JS context, and report failure to the caller (session.miniapps.start).\n console.warn(`ISLAND: launcher.ensureRunning failed for ${packageName}`, e)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, running: false, loading: false} : a)),\n }))\n // onStart already persisted running:true to disk (saveLocalAppRunningState)\n // before the spawn; run onStop to undo it so a refresh/reboot doesn't\n // resurrect a \"running\" app with no JS context.\n await startStopApp(app, false)\n return false\n }\n }\n\n return true\n },\n\n stop: async (packageName: string) => {\n const state = get()\n const app = state.apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: app not found for package name: ${packageName}`)\n return\n }\n\n set((s) => ({\n apps: s.apps.map((a) =>\n a.packageName === packageName ? {...a, running: false, screenshot: undefined, loading: false} : a,\n ),\n }))\n\n // if there are no apps running, call clearDisplay():\n // read fresh state via get() — `state` was captured before the set() above, so it still shows\n // this app as running and would never reach 0 when stopping the last app.\n if (get().apps.filter((a) => a.running).length === 0) {\n BluetoothSdk.clearDisplay()\n }\n await startStopApp(app, false)\n\n // Tear down the background JS context for local miniapps. No-op for native\n // offline built-ins.\n if (app.local) {\n try {\n await miniappLauncher.stop(packageName)\n } catch (e) {\n console.warn(`ISLAND: launcher.stop failed for ${packageName}`, e)\n }\n }\n },\n\n setForeground: async (packageName: string) => {\n const app = get().apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: setForeground — app not found: ${packageName}`)\n return\n }\n\n // Flip the foreground flag synchronously so the Compositor's open\n // animation starts on the same frame as the tap. We do NOT await start()\n // first — that gated the flag (and thus the animation) behind the whole\n // JSContext-spawn chain, which was the perceived launch delay. The\n // Compositor/LocalMiniappView already handle the spawn being in-flight\n // (the phase machine), so foregrounding needn't wait for it.\n saveLastOpenTime(packageName)\n set((s) => ({\n foregroundedPackage: packageName,\n apps: s.apps.map((a) => ({...a, foregrounded: a.packageName === packageName})),\n }))\n\n // Ensure the JSContext exists. start() is idempotent for an\n // already-running app and enforces the foreground-only-one rule for\n // standard apps. Fire-and-forget after the flag flip so it doesn't block\n // paint.\n // if (!app.running) {\n // get().start(app)\n // }\n },\n\n clearForeground: () => {\n set((s) => ({\n foregroundedPackage: null,\n apps: s.apps.some((a) => a.foregrounded)\n ? s.apps.map((a) => (a.foregrounded ? {...a, foregrounded: false} : a))\n : s.apps,\n }))\n },\n\n stopAll: () => {\n return Res.try_async(async () => {\n const running = get().apps.filter((a) => a.running)\n for (const a of running) {\n await get().stop(a.packageName)\n }\n })\n },\n\n install: (url, opts) => appRegistry.installFromUrl(url, opts),\n\n uninstall: (packageName, version) => {\n return Res.try_async(async () => {\n const res = await appRegistry.uninstall(packageName, version)\n if (res.is_error()) throw res.error\n set((s) => ({apps: s.apps.filter((a) => a.packageName !== packageName)}))\n })\n },\n\n saveScreenshot: async (packageName: string, screenshot: string) => {\n storage.save(`${packageName}_screenshot`, screenshot)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, screenshot} : a)),\n }))\n },\n\n setHiddenStatus: (packageName: string, status: boolean) => {\n hiddenStatusCache.set(packageName, status)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, hidden: status} : a)),\n }))\n storage.save(`${packageName}_hidden`, status)\n if (!status) {\n const orderMap = getAppsOrder()\n if (orderMap.is_ok()) {\n delete orderMap.value[packageName]\n saveAppsOrder(orderMap.value)\n }\n }\n },\n\n getHiddenStatus: (packageName: string): boolean => {\n const cached = hiddenStatusCache.get(packageName)\n if (cached !== undefined) return cached\n const res = storage.load<boolean>(`${packageName}_hidden`)\n const value = res.is_ok() ? res.value : false\n hiddenStatusCache.set(packageName, value)\n return value\n },\n\n setApps: (apps) => set({apps}),\n}))\n\n// Project miniappRunningRegistry membership into the store's `running` field\n// for local apps so the home tray and switcher reflect actual mount state\n// without waiting for the next refresh() cycle.\nminiappRunningRegistry.subscribe(() => {\n const running = new Set(miniappRunningRegistry.getAll())\n const state = useAppStatusStore.getState()\n let changed = false\n const updated = state.apps.map((app) => {\n if (!app.local) return app\n const next = running.has(app.packageName)\n if (app.running === next) return app\n changed = true\n return {...app, running: next}\n })\n if (changed) {\n useAppStatusStore.setState({apps: updated})\n }\n})\n\n// The display-manager's core (foreground) slot is DERIVED state: always the\n// currently-running standard app, no matter HOW it came to run — user tap\n// (start()), boot restore (autostartLocalMiniapps → registry projection\n// above), crash-respawn, or interop. One reconciler instead of per-path call\n// sites, so no launch/stop path can forget to claim or release the slot.\n// onCoreAppChange is idempotent, so firing on every store write is free.\nuseAppStatusStore.subscribe((state) => {\n const core = state.apps.find((a) => a.running && (a.type === \"standard\" || !a.type))\n localDisplayManager.onCoreAppChange(core?.packageName ?? null)\n})\n\n// AppRegistry change events trigger a store refresh.\nappRegistry.subscribe(() => {\n void useAppStatusStore.getState().refresh()\n})\n\n// Re-evaluate hardware compatibility when the paired/default wearable changes.\nuseSettingsStore.subscribe(\n (state) => state.getSetting(SETTINGS.default_wearable.key),\n () => {\n void useAppStatusStore.getState().refresh()\n },\n)\n\n// ---------------------------------------------------------------------------\n// Public hooks\n// ---------------------------------------------------------------------------\n\nexport const useApps = () => useAppStatusStore((state) => state.apps)\nexport const useStart = () => useAppStatusStore((state) => state.start)\nexport const useStop = () => useAppStatusStore((state) => state.stop)\nexport const useSetForeground = () => useAppStatusStore((state) => state.setForeground)\nexport const useClearForeground = () => useAppStatusStore((state) => state.clearForeground)\nexport const useRefresh = () => useAppStatusStore((state) => state.refresh)\nexport const useStopAll = () => useAppStatusStore((state) => state.stopAll)\nexport const useInstall = () => useAppStatusStore((state) => state.install)\nexport const useUninstall = () => useAppStatusStore((state) => state.uninstall)\n\nexport const useActiveApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.running), [apps])\n}\n\nexport const useActiveBackgroundApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.type === \"background\" && app.running), [apps])\n}\n\nexport const useBackgroundApps = () => {\n const apps = useApps()\n return useMemo(\n () => ({\n active: apps.filter((app) => app.type === \"background\" && app.running),\n inactive: apps.filter((app) => app.type === \"background\" && !app.running),\n }),\n [apps],\n )\n}\n\nexport const useActiveForegroundApp = () => {\n const apps = useApps()\n return useMemo(() => apps.find((app) => (app.type === \"standard\" || !app.type) && app.running) ?? null, [apps])\n}\n\n/**\n * The single app currently foregrounded in the Compositor overlay, or null.\n * Driven by setForeground/clearForeground — distinct from the \"active\n * standard app\" (running) selector above.\n */\nexport const useForegroundApp = () => {\n const apps = useApps()\n return useMemo(() => apps.find((app) => app.foregrounded) ?? null, [apps])\n}\n\nexport const useActiveBackgroundAppsCount = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.type === \"background\" && app.running).length, [apps])\n}\n\nexport const useLocalMiniApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.local), [apps])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/stores/apps.ts"],"names":[],"mappings":"AAAA;;;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AAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AACjH,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAC5E,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AACrG,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/D,CAAC,CAAA","sourcesContent":["/**\n * Engine apps store — runtime state of installed and local applets.\n *\n * The OEM-facing API: subscribe to the running set, install/uninstall\n * miniapps, start/stop them. The store delegates install plumbing to\n * AppRegistry, and exposes hooks (`useApps`, `useStart`, `useStop`,\n * `useRefresh`, `useStopAll`) that the host UI can read.\n *\n * Source of `apps`:\n * - Local: appRegistry.getInstalledMiniapps() (always)\n */\n\nimport {useMemo} from \"react\"\nimport {AsyncResult, Result, result as Res} from \"typesafe-ts\"\nimport {create} from \"zustand\"\n\nimport type {ClientApp} from \"../types/applet\"\nimport {DeviceTypes} from \"../types/enums\"\nimport {getModelCapabilities} from \"../types/hardware\"\nimport {HardwareCompatibility, type CompatibilityResult} from \"../utils/hardware/hardware\"\nimport {storage} from \"../utils/storage/storage\"\nimport appRegistry from \"../services/AppRegistry\"\nimport localDisplayManager from \"../services/LocalDisplayManager\"\nimport {islandNotifications} from \"../services/NotificationsEmitter\"\nimport sttModelManager from \"../services/STTModelManager\"\nimport {miniappLauncher} from \"../services/MiniappLauncher\"\nimport {miniappRunningRegistry} from \"../services/MiniappRunningRegistry\"\nimport {resolveHiddenStatus} from \"./appVisibility\"\nimport {SETTINGS, useSettingsStore} from \"./settings\"\nimport BluetoothSdk from \"@mentra/bluetooth-sdk\"\n\n// ---------------------------------------------------------------------------\n// Configuration / hooks\n// ---------------------------------------------------------------------------\n\nexport interface StartOptions {\n skipNavigation?: boolean\n}\n\nexport interface AppStoreHooks {\n /**\n * A start was blocked because the app is hardware-incompatible. Engine made\n * the decision (and raised the `version_incompatible` notification); the host\n * renders its branded alert here.\n */\n onIncompatibleBlocked?: (app: ClientApp) => void\n /**\n * A start was blocked because the app requires the on-device STT model\n * (declared at registration — see AppRegistry.installOfflineApp) and none is\n * installed. Engine decided via its model manager; the host renders the\n * alert / settings navigation here.\n */\n onMissingSpeechModel?: (app: ClientApp) => void\n /**\n * An open request passed the gates — fired on EVERY open, including\n * re-opening an already-running app, so the host's navigation / open\n * animation always plays.\n */\n onOpenRequested?: (app: ClientApp, opts?: StartOptions) => void\n}\n\nlet hostHooks: AppStoreHooks = {}\n\nexport function installAppStoreHooks(hooks: AppStoreHooks): void {\n hostHooks = {...hostHooks, ...hooks}\n}\n\n// ---------------------------------------------------------------------------\n// Store\n// ---------------------------------------------------------------------------\n\ninterface AppStatusState {\n apps: ClientApp[]\n /**\n * Source of truth for which app is foregrounded in the Compositor overlay.\n * The per-app `foregrounded` boolean is derived from this in `projectApps`\n * so a refresh can never drop the flag when an app is transiently missing\n * from one of the two refresh passes (local-only then merged). See\n * `projectApps` / `setForeground` / `clearForeground`.\n */\n foregroundedPackage: string | null\n refresh: () => Promise<void>\n /** Resolves true if the app actually started; false if a host gate aborted it or its JS context failed to spawn. */\n start: (app: ClientApp, opts?: StartOptions) => Promise<boolean>\n stop: (packageName: string) => Promise<void>\n setForeground: (packageName: string) => Promise<void>\n clearForeground: () => void\n stopAll: () => AsyncResult<void, Error>\n install: (url: string, opts?: {versionOverride?: string}) => AsyncResult<void, Error>\n uninstall: (packageName: string, version?: string) => AsyncResult<void, Error>\n saveScreenshot: (packageName: string, screenshot: string) => Promise<void>\n setHiddenStatus: (packageName: string, status: boolean) => void\n getHiddenStatus: (packageName: string) => boolean\n /** Replace the whole apps array. Hosts use this when their extra source changes. */\n setApps: (apps: ClientApp[]) => void\n}\n\nexport const DUMMY_APPLET: ClientApp = {\n packageName: \"\",\n name: \"\",\n webviewUrl: \"\",\n logoUrl: \"\",\n type: \"standard\",\n permissions: [],\n running: false,\n loading: false,\n healthy: true,\n hardwareRequirements: [],\n offline: true,\n offlineRoute: \"\",\n local: false,\n hidden: false,\n}\n\nexport type OrderMap = Record<string, number>\nconst APP_ORDER_KEY = \"foreground_apps_order\"\n\nexport const saveAppsOrder = (orderMap: OrderMap): Result<void, Error> => {\n return storage.save(APP_ORDER_KEY, orderMap)\n}\n\nexport const getAppsOrder = (): Result<OrderMap, Error> => {\n return storage.load<OrderMap>(APP_ORDER_KEY)\n}\n\n// In-memory cache for hidden flags. `projectApps` reads getHiddenStatus once\n// per app per refresh — without a cache that was a synchronous JNI hop per\n// app per refresh on a hot UI path. Kept consistent with disk by writing\n// through in setHiddenStatus. Map of packageName → hidden boolean.\nconst hiddenStatusCache = new Map<string, boolean>()\n\nconst getRawPackageNamePriority = (pkg: string): number => {\n if (pkg.includes(\"@empty\")) {\n return 1000\n }\n return 0\n}\n\nexport const sortAppsByPackageNamePriority = (a: ClientApp, b: ClientApp): number => {\n const pa = getRawPackageNamePriority(a.packageName)\n const pb = getRawPackageNamePriority(b.packageName)\n if (pa !== pb) {\n return pa - pb\n }\n return a.name.localeCompare(b.name)\n}\n\nexport const saveLastOpenTime = (packageName: string): void => {\n storage.save(`${packageName}_last_open_time`, Date.now())\n}\n\nexport const getLastOpenTime = (packageName: string): number => {\n const res = storage.load<number>(`${packageName}_last_open_time`)\n if (res.is_ok()) return res.value\n return 0\n}\n\nexport const sortAppsByLastOpenTime = async <T extends {packageName: string}>(apps: T[]): Promise<T[]> => {\n const timestamps = apps.map((app) => ({app, time: getLastOpenTime(app.packageName)}))\n return timestamps.sort((a, b) => a.time - b.time).map((entry) => entry.app)\n}\n\nconst startStopApp = async (app: ClientApp, status: boolean): Promise<void> => {\n if (!status && app.onStop) {\n try {\n app.onStop()\n } catch (e) {\n console.warn(`ISLAND: onStop threw for ${app.packageName}`, e)\n }\n }\n if (status && app.onStart) {\n try {\n app.onStart()\n } catch (e) {\n console.warn(`ISLAND: onStart threw for ${app.packageName}`, e)\n }\n }\n}\n\n/**\n * Build the final `apps` array for the store from the installed/offline app\n * source. Pure — same inputs -> same outputs.\n */\nfunction projectApps(previousState: AppStatusState, localApps: ClientApp[]): ClientApp[] {\n // Dedupe by packageName, keep first occurrence.\n const byPackage = new Map<string, ClientApp>()\n for (const app of localApps) {\n if (!byPackage.has(app.packageName)) byPackage.set(app.packageName, app)\n }\n\n // Index previous snapshot for cheap lookups (was O(N²) via .find()).\n const previousByPackage = new Map<string, ClientApp>()\n for (const oldApp of previousState.apps) {\n previousByPackage.set(oldApp.packageName, oldApp)\n }\n\n const defaultWearable =\n (useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key) as DeviceTypes | undefined) ||\n DeviceTypes.NONE\n const capabilities = getModelCapabilities(defaultWearable)\n\n // Single pass: dedupe → screenshot carry-over → compat → hidden, all into\n // fresh objects. The previous in-place mutation re-used object references\n // across refreshes, which broke React.memo / referential-equality\n // memoization downstream (every refresh propagated re-renders even when\n // nothing meaningful changed) AND tripped Reanimated's \"tried to modify\n // key of an object already passed to a worklet\" warning whenever the home\n // screen's animated app cards held a reference to a previous snapshot's\n // app object that we then mutated.\n //\n // Identity stability: refresh() is event-driven and fires repeatedly (and\n // twice per cycle via the local-only → merged two-pass emit). If we always\n // returned fresh objects, every poll changed the identity of EVERY app —\n // which re-rendered the Compositor (via useForegroundApp) mid-slide and made\n // the open/close animation hitch, and churned the home grid / switcher pill.\n // So we build the candidate object, then REUSE the previous reference when\n // nothing meaningful changed. Same pattern as the miniappRunningRegistry\n // projection below. A stable foreground-app reference lets the Compositor's\n // slide run uninterrupted on the UI thread.\n return Array.from(byPackage.values()).map((app) => {\n const next: ClientApp = {\n ...app,\n screenshot: previousByPackage.get(app.packageName)?.screenshot ?? app.screenshot,\n compatibility: HardwareCompatibility.checkCompatibility(app.hardwareRequirements, capabilities),\n // A registry source can force an app off the primary home screen (for\n // example, Miniapp Developer while its home-screen setting is disabled).\n // Compose that gate with the user's persisted home-screen layout instead\n // of replacing it, otherwise a default-false persisted value makes a\n // source-hidden app visible again during projection.\n hidden: resolveHiddenStatus(app.hidden, previousState.getHiddenStatus(app.packageName)),\n // Derive the foreground flag from the store's single source of truth\n // (`foregroundedPackage`), NOT from the previous snapshot. Carrying it over\n // per-app meant a refresh that momentarily omitted an app (e.g. the\n // two-pass local-only → merged emit) would reset its flag to false — which\n // raced OfflineAppHost's interceptor guard and made the hosted miniapp fall\n // through to the root router (restart). Deriving here keeps the flag stable\n // across both passes.\n foregrounded: app.packageName === previousState.foregroundedPackage,\n }\n const prev = previousByPackage.get(app.packageName)\n return prev && shallowEqualApp(prev, next) ? prev : next\n })\n}\n\n// Cheap equality check used by projectApps to preserve object identity across\n// refreshes when nothing meaningful changed. Most keys are compared by\n// reference (the source app's nested fields — permissions, hardwareRequirements,\n// parameters — are reference-stable within a refresh). The ONE exception is\n// `compatibility`, which projectApps recomputes into a fresh object every call;\n// comparing it by reference would always differ and defeat the whole point. We\n// compare it structurally instead so identity is only broken when the device's\n// actual compatibility verdict changes (e.g. glasses connect/disconnect).\nfunction shallowEqualApp(a: ClientApp, b: ClientApp): boolean {\n const aKeys = Object.keys(a) as (keyof ClientApp)[]\n const bKeys = Object.keys(b) as (keyof ClientApp)[]\n if (aKeys.length !== bKeys.length) return false\n for (const k of aKeys) {\n if (k === \"compatibility\") {\n if (!compatibilityEqual(a.compatibility, b.compatibility)) return false\n continue\n }\n if (a[k] !== b[k]) return false\n }\n return true\n}\n\nfunction compatibilityEqual(a?: CompatibilityResult, b?: CompatibilityResult): boolean {\n if (a === b) return true\n if (!a || !b) return false\n return (\n a.isCompatible === b.isCompatible &&\n a.missingRequired.length === b.missingRequired.length &&\n a.missingOptional.length === b.missingOptional.length &&\n a.warnings.length === b.warnings.length\n )\n}\n\nexport const useAppStatusStore = create<AppStatusState>((set, get) => ({\n apps: [],\n foregroundedPackage: null,\n\n refresh: async () => {\n const previousState = get()\n const localApps = await appRegistry.getInstalledMiniapps()\n set({apps: projectApps(previousState, localApps)})\n },\n\n start: async (clientApp: ClientApp, opts?: StartOptions) => {\n const state = get()\n const packageName = clientApp.packageName\n const app = state.apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: app not found for package name: ${packageName}`)\n return false\n }\n\n // Skip spawning a NEW app while another is mid-launch — concurrent spawns\n // race the foreground-only-one teardown. This is checked BEFORE the gates\n // and the onOpenRequested seam (which navigates/foregrounds) so a gated\n // launch doesn't paint a splash it can't back. Re-opening an already-running\n // app is exempt: it has nothing to spawn, so it skips this gate and is\n // allowed to re-navigate/animate below.\n // That exemption is the fix for the \"second tap during another app's launch\n // window silently does nothing\" bug.\n if (!app.running && state.apps.some((a) => a.loading)) {\n console.log(`ISLAND: skipping start ${packageName} — another app is loading`)\n return false\n }\n\n if (!app.offline && !app.local) {\n console.warn(`ISLAND: cloud-v1 app entries are no longer supported: ${packageName}`)\n return false\n }\n\n // Hardware-compatibility gate — engine decides and blocks; the host renders\n // its branded alert via onIncompatibleBlocked (and/or the structured\n // notification below). `!isCompatible` (not `=== false`) keeps the semantics\n // of the host gate this replaces: an unknown verdict blocks, not launches.\n if (!app.compatibility?.isCompatible) {\n islandNotifications.emit({\n kind: \"version_incompatible\",\n packageName,\n reason: `${app.name ?? packageName} is not compatible with the connected glasses`,\n metadata: {missingRequired: app.compatibility?.missingRequired ?? []},\n timestamp: Date.now(),\n })\n hostHooks.onIncompatibleBlocked?.(app)\n return false\n }\n\n // Missing-speech-model gate for apps registered with requiresLocalSttModel.\n // Engine decides via its own model manager; the host renders the alert and\n // any settings navigation via onMissingSpeechModel.\n if (appRegistry.requiresLocalSttModel(packageName) && !(await sttModelManager.isModelAvailable())) {\n islandNotifications.emit({\n kind: \"missing_speech_model\",\n packageName,\n reason: `${app.name ?? packageName} needs an on-device speech model before it can start`,\n timestamp: Date.now(),\n })\n hostHooks.onMissingSpeechModel?.(app)\n return false\n }\n\n // Host navigation / open-animation seam. Runs on EVERY accepted open —\n // including re-opening an already-running app — so the animation always\n // plays (BuiltInMiniappCatalog.navigateForApp: overlay apps setForeground\n // for the slide).\n hostHooks.onOpenRequested?.(app, opts)\n\n // First-activation mark (moved from the host's old beforeStart — engine\n // owns the settings store).\n useSettingsStore.getState().setSetting(SETTINGS.has_ever_activated_app.key, true)\n\n // If the tapped app is already running, this is a re-open: the nav/foreground\n // above already drove the animation, and there's nothing to spawn. Short-\n // circuit before the spawn pipeline.\n if (app.running) {\n saveLastOpenTime(packageName)\n return true\n }\n\n // Foreground-only-one rule: stop other running standard apps.\n if (app.type === \"standard\") {\n const runningForeground = state.apps.filter(\n (a) => a.running && a.type === \"standard\" && a.packageName !== packageName,\n )\n for (const r of runningForeground) {\n await get().stop(r.packageName)\n }\n }\n\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, running: true, loading: false} : a)),\n }))\n\n saveLastOpenTime(packageName)\n await startStopApp(app, true)\n\n // Spawn the background JS context for local miniapps. This used to be a\n // side effect of LocalMiniappView mounting on foreground; pulling it here\n // lets start() actually run the app even when nothing foregrounds it (e.g.\n // a system app launching another miniapp via session.miniapps). Idempotent\n // with the view's own ensureRunning; a no-op for native offline built-ins\n // and cloud apps (no JS bundle).\n if (app.local) {\n try {\n await miniappLauncher.ensureRunning(packageName)\n } catch (e) {\n // Spawn / bundle-resolve failed — revert the optimistic running flag so\n // the home list and miniapps.list() don't show a \"running\" app with no\n // JS context, and report failure to the caller (session.miniapps.start).\n console.warn(`ISLAND: launcher.ensureRunning failed for ${packageName}`, e)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, running: false, loading: false} : a)),\n }))\n // onStart already persisted running:true to disk (saveLocalAppRunningState)\n // before the spawn; run onStop to undo it so a refresh/reboot doesn't\n // resurrect a \"running\" app with no JS context.\n await startStopApp(app, false)\n return false\n }\n }\n\n return true\n },\n\n stop: async (packageName: string) => {\n const state = get()\n const app = state.apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: app not found for package name: ${packageName}`)\n return\n }\n\n set((s) => ({\n apps: s.apps.map((a) =>\n a.packageName === packageName ? {...a, running: false, screenshot: undefined, loading: false} : a,\n ),\n }))\n\n // if there are no apps running, call clearDisplay():\n // read fresh state via get() — `state` was captured before the set() above, so it still shows\n // this app as running and would never reach 0 when stopping the last app.\n if (get().apps.filter((a) => a.running).length === 0) {\n BluetoothSdk.clearDisplay()\n }\n await startStopApp(app, false)\n\n // Tear down the background JS context for local miniapps. No-op for native\n // offline built-ins.\n if (app.local) {\n try {\n await miniappLauncher.stop(packageName)\n } catch (e) {\n console.warn(`ISLAND: launcher.stop failed for ${packageName}`, e)\n }\n }\n },\n\n setForeground: async (packageName: string) => {\n const app = get().apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: setForeground — app not found: ${packageName}`)\n return\n }\n\n // Flip the foreground flag synchronously so the Compositor's open\n // animation starts on the same frame as the tap. We do NOT await start()\n // first — that gated the flag (and thus the animation) behind the whole\n // JSContext-spawn chain, which was the perceived launch delay. The\n // Compositor/LocalMiniappView already handle the spawn being in-flight\n // (the phase machine), so foregrounding needn't wait for it.\n saveLastOpenTime(packageName)\n set((s) => ({\n foregroundedPackage: packageName,\n apps: s.apps.map((a) => ({...a, foregrounded: a.packageName === packageName})),\n }))\n\n // Ensure the JSContext exists. start() is idempotent for an\n // already-running app and enforces the foreground-only-one rule for\n // standard apps. Fire-and-forget after the flag flip so it doesn't block\n // paint.\n // if (!app.running) {\n // get().start(app)\n // }\n },\n\n clearForeground: () => {\n set((s) => ({\n foregroundedPackage: null,\n apps: s.apps.some((a) => a.foregrounded)\n ? s.apps.map((a) => (a.foregrounded ? {...a, foregrounded: false} : a))\n : s.apps,\n }))\n },\n\n stopAll: () => {\n return Res.try_async(async () => {\n const running = get().apps.filter((a) => a.running)\n for (const a of running) {\n await get().stop(a.packageName)\n }\n })\n },\n\n install: (url, opts) => appRegistry.installFromUrl(url, opts),\n\n uninstall: (packageName, version) => {\n return Res.try_async(async () => {\n const res = await appRegistry.uninstall(packageName, version)\n if (res.is_error()) throw res.error\n set((s) => ({apps: s.apps.filter((a) => a.packageName !== packageName)}))\n })\n },\n\n saveScreenshot: async (packageName: string, screenshot: string) => {\n storage.save(`${packageName}_screenshot`, screenshot)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, screenshot} : a)),\n }))\n },\n\n setHiddenStatus: (packageName: string, status: boolean) => {\n hiddenStatusCache.set(packageName, status)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, hidden: status} : a)),\n }))\n storage.save(`${packageName}_hidden`, status)\n if (!status) {\n const orderMap = getAppsOrder()\n if (orderMap.is_ok()) {\n delete orderMap.value[packageName]\n saveAppsOrder(orderMap.value)\n }\n }\n },\n\n getHiddenStatus: (packageName: string): boolean => {\n const cached = hiddenStatusCache.get(packageName)\n if (cached !== undefined) return cached\n const res = storage.load<boolean>(`${packageName}_hidden`)\n const value = res.is_ok() ? res.value : false\n hiddenStatusCache.set(packageName, value)\n return value\n },\n\n setApps: (apps) => set({apps}),\n}))\n\n// Project miniappRunningRegistry membership into the store's `running` field\n// for local apps so the home tray and switcher reflect actual mount state\n// without waiting for the next refresh() cycle.\nminiappRunningRegistry.subscribe(() => {\n const running = new Set(miniappRunningRegistry.getAll())\n const state = useAppStatusStore.getState()\n let changed = false\n const updated = state.apps.map((app) => {\n if (!app.local) return app\n const next = running.has(app.packageName)\n if (app.running === next) return app\n changed = true\n return {...app, running: next}\n })\n if (changed) {\n useAppStatusStore.setState({apps: updated})\n }\n})\n\n// The display-manager's core (foreground) slot is DERIVED state: always the\n// currently-running standard app, no matter HOW it came to run — user tap\n// (start()), boot restore (autostartLocalMiniapps → registry projection\n// above), crash-respawn, or interop. One reconciler instead of per-path call\n// sites, so no launch/stop path can forget to claim or release the slot.\n// onCoreAppChange is idempotent, so firing on every store write is free.\nuseAppStatusStore.subscribe((state) => {\n const core = state.apps.find((a) => a.running && (a.type === \"standard\" || !a.type))\n localDisplayManager.onCoreAppChange(core?.packageName ?? null)\n})\n\n// AppRegistry change events trigger a store refresh.\nappRegistry.subscribe(() => {\n void useAppStatusStore.getState().refresh()\n})\n\n// Re-evaluate hardware compatibility when the paired/default wearable changes.\nuseSettingsStore.subscribe(\n (state) => state.getSetting(SETTINGS.default_wearable.key),\n () => {\n void useAppStatusStore.getState().refresh()\n },\n)\n\n// ---------------------------------------------------------------------------\n// Public hooks\n// ---------------------------------------------------------------------------\n\nexport const useApps = () => useAppStatusStore((state) => state.apps)\nexport const useStart = () => useAppStatusStore((state) => state.start)\nexport const useStop = () => useAppStatusStore((state) => state.stop)\nexport const useSetForeground = () => useAppStatusStore((state) => state.setForeground)\nexport const useClearForeground = () => useAppStatusStore((state) => state.clearForeground)\nexport const useRefresh = () => useAppStatusStore((state) => state.refresh)\nexport const useStopAll = () => useAppStatusStore((state) => state.stopAll)\nexport const useInstall = () => useAppStatusStore((state) => state.install)\nexport const useUninstall = () => useAppStatusStore((state) => state.uninstall)\n\nexport const useActiveApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.running), [apps])\n}\n\nexport const useActiveBackgroundApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.type === \"background\" && app.running), [apps])\n}\n\nexport const useBackgroundApps = () => {\n const apps = useApps()\n return useMemo(\n () => ({\n active: apps.filter((app) => app.type === \"background\" && app.running),\n inactive: apps.filter((app) => app.type === \"background\" && !app.running),\n }),\n [apps],\n )\n}\n\nexport const useActiveForegroundApp = () => {\n const apps = useApps()\n return useMemo(() => apps.find((app) => (app.type === \"standard\" || !app.type) && app.running) ?? null, [apps])\n}\n\n/**\n * The single app currently foregrounded in the Compositor overlay, or null.\n * Driven by setForeground/clearForeground — distinct from the \"active\n * standard app\" (running) selector above.\n */\nexport const useForegroundApp = () => {\n const apps = useApps()\n return useMemo(() => apps.find((app) => app.foregrounded) ?? null, [apps])\n}\n\nexport const useActiveBackgroundAppsCount = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.type === \"background\" && app.running).length, [apps])\n}\n\nexport const useLocalMiniApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.local), [apps])\n}\n"]}
|
package/build/stores/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface CoreState extends
|
|
3
|
-
setCoreInfo: (info: Partial<
|
|
1
|
+
import type { PublicBluetoothStatus } from "@mentra/bluetooth-sdk";
|
|
2
|
+
export interface CoreState extends PublicBluetoothStatus {
|
|
3
|
+
setCoreInfo: (info: Partial<PublicBluetoothStatus>) => void;
|
|
4
4
|
reset: () => void;
|
|
5
5
|
}
|
|
6
6
|
export declare const useCoreStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<CoreState>, "subscribe"> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/stores/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/stores/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,MAAM,WAAW,SAAU,SAAQ,qBAAqB;IACtD,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAA;IAC3D,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAgBD,eAAO,MAAM,YAAY;;;;;;;;EAQxB,CAAA"}
|
package/build/stores/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/stores/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAA;AAQxD,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/stores/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAA;AAQxD,MAAM,YAAY,GAA0B;IAC1C,SAAS;IACT,SAAS,EAAE,KAAK;IAChB,mBAAmB,EAAE,KAAK;IAC1B,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,CAAC;IACjE,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,EAAE;IACjB,eAAe,EAAE,EAAE;IACnB,OAAO,EAAE,EAAE;IACX,gBAAgB,EAAE,KAAK;IACvB,kBAAkB,EAAE,IAAI;CACzB,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,EAAa,CAC7C,qBAAqB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC9B,GAAG,YAAY;IAEf,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,KAAK,EAAE,GAAG,IAAI,EAAC,CAAC,CAAC;IAE5D,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC;CAC/B,CAAC,CAAC,CACJ,CAAA","sourcesContent":["import {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\nimport type {PublicBluetoothStatus} from \"@mentra/bluetooth-sdk\"\n\nexport interface CoreState extends PublicBluetoothStatus {\n setCoreInfo: (info: Partial<PublicBluetoothStatus>) => void\n reset: () => void\n}\n\nconst initialState: PublicBluetoothStatus = {\n // state:\n searching: false,\n searchingController: false,\n micRanking: [\"glasses\", \"phone\", \"bluetooth\", \"bluetoothClassic\"],\n systemMicUnavailable: false,\n currentMic: null,\n searchResults: [],\n wifiScanResults: [],\n lastLog: [],\n otherBtConnected: false,\n galleryModeEnabled: true,\n}\n\nexport const useCoreStore = create<CoreState>()(\n subscribeWithSelector((set) => ({\n ...initialState,\n\n setCoreInfo: (info) => set((state) => ({...state, ...info})),\n\n reset: () => set(initialState),\n })),\n)\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GlassesConnectionStatus,
|
|
1
|
+
import type { GlassesConnectionStatus, OtaProgress, OtaStatus, OtaUpdateInfo, PublicGlassesStatus } from "@mentra/bluetooth-sdk";
|
|
2
2
|
import { isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady } from "../services/GlassesReadiness";
|
|
3
3
|
export { isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady };
|
|
4
4
|
export declare const selectGlassesConnected: (state: {
|
|
@@ -7,7 +7,13 @@ export declare const selectGlassesConnected: (state: {
|
|
|
7
7
|
export declare const selectGlassesReady: (state: {
|
|
8
8
|
connection: GlassesConnectionStatus;
|
|
9
9
|
}) => boolean;
|
|
10
|
-
|
|
10
|
+
type EngineGlassesStatus = PublicGlassesStatus & {
|
|
11
|
+
otaUpdateAvailable: OtaUpdateInfo | null;
|
|
12
|
+
otaProgress: OtaProgress | null;
|
|
13
|
+
otaInProgress: boolean;
|
|
14
|
+
otaVersionUrl: string;
|
|
15
|
+
};
|
|
16
|
+
export interface GlassesState extends EngineGlassesStatus {
|
|
11
17
|
systemTimeMs: number;
|
|
12
18
|
wifiStatusKnown: boolean;
|
|
13
19
|
setGlassesInfo: (info: GlassesInfoUpdate) => void;
|
|
@@ -36,8 +42,8 @@ type LegacyHotspotFields = {
|
|
|
36
42
|
hotspotGatewayIp?: string;
|
|
37
43
|
hotspotLocalIp?: string;
|
|
38
44
|
};
|
|
39
|
-
type GlassesInfoUpdate = Partial<
|
|
40
|
-
export declare const getGlasesInfoPartial: (state:
|
|
45
|
+
type GlassesInfoUpdate = Partial<EngineGlassesStatus> & LegacyWifiFields & LegacyHotspotFields;
|
|
46
|
+
export declare const getGlasesInfoPartial: (state: EngineGlassesStatus) => {
|
|
41
47
|
batteryLevel: number;
|
|
42
48
|
charging: boolean;
|
|
43
49
|
caseBatteryLevel: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/stores/glasses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,
|
|
1
|
+
{"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/stores/glasses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EAEvB,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EAEpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAMvG,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,CAAA;AAEnE,eAAO,MAAM,sBAAsB,GAA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CAAA;AACJ,CAAC,CAAA","sourcesContent":["import type {\n GlassesConnectionStatus,\n GlassesStatus,\n HotspotStatus,\n OtaProgress,\n OtaStatus,\n OtaUpdateInfo,\n WifiStatus,\n} from \"@mentra/bluetooth-sdk/internal\"\nimport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\n// Re-export the connection predicates (single source of truth lives in\n// GlassesReadiness) so importers of this store keep getting them.\nexport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady}\n\nexport const selectGlassesConnected = (state: {connection: GlassesConnectionStatus}) =>\n isGlassesConnected(state.connection)\n\nexport const selectGlassesReady = (state: {connection: GlassesConnectionStatus}) => isGlassesReady(state.connection)\n\nexport interface GlassesState extends GlassesStatus {\n systemTimeMs: number\n wifiStatusKnown: boolean\n setGlassesInfo: (info: GlassesInfoUpdate) => void\n setBatteryInfo: (batteryLevel: number, charging: boolean, caseBatteryLevel: number, caseCharging: boolean) => void\n setWifiInfo: (connected: boolean, ssid: string) => void\n setHotspotInfo: (enabled: boolean, ssid: string, password: string, ip: string) => void\n // OTA methods\n otaStatus: OtaStatus | null\n setOtaStatus: (status: OtaStatus | null) => void\n setOtaUpdateAvailable: (info: OtaUpdateInfo | null) => void\n setOtaProgress: (progress: OtaProgress | null) => void\n setOtaInProgress: (inProgress: boolean) => void\n setMtkUpdatedThisSession: (updated: boolean) => void\n clearOtaState: () => void\n reset: () => void\n mtkUpdatedThisSession: boolean\n}\n\ntype LegacyWifiFields = {\n wifiConnected?: boolean\n wifiSsid?: string\n wifiLocalIp?: string\n}\n\ntype LegacyHotspotFields = {\n hotspotEnabled?: boolean\n hotspotSsid?: string\n hotspotPassword?: string\n hotspotGatewayIp?: string\n hotspotLocalIp?: string\n}\n\ntype GlassesInfoUpdate = Partial<GlassesStatus> & LegacyWifiFields & LegacyHotspotFields\n\nfunction wifiFromLegacyFields(info: LegacyWifiFields): WifiStatus | null {\n if (info.wifiConnected === true) {\n const ssid = info.wifiSsid?.trim()\n const localIp = info.wifiLocalIp?.trim()\n return ssid ? {state: \"connected\", ssid, ...(localIp ? {localIp} : {})} : null\n }\n if (info.wifiConnected === false) {\n return {state: \"disconnected\"}\n }\n return null\n}\n\nfunction hotspotFromLegacyFields(info: LegacyHotspotFields): HotspotStatus | null {\n if (info.hotspotEnabled === true) {\n const ssid = info.hotspotSsid?.trim()\n const password = info.hotspotPassword?.trim()\n const localIp = (info.hotspotGatewayIp ?? info.hotspotLocalIp)?.trim()\n return ssid && password && localIp ? {state: \"enabled\", ssid, password, localIp} : null\n }\n if (info.hotspotEnabled === false) {\n return {state: \"disabled\"}\n }\n return null\n}\n\nexport const getGlasesInfoPartial = (state: GlassesStatus) => {\n const wifi = state.wifi\n const connected = isGlassesConnected(state.connection)\n return {\n batteryLevel: state.batteryLevel,\n charging: state.charging,\n caseBatteryLevel: state.caseBatteryLevel,\n caseCharging: state.caseCharging,\n connected,\n wifiConnected: wifi.state === \"connected\",\n wifiSsid: wifi.state === \"connected\" ? wifi.ssid : \"\",\n deviceModel: state.deviceModel,\n // Cloud GlassesInfo uses modelName, map from deviceModel so the cloud\n // knows which device is connected when it receives connection state updates\n modelName: state.deviceModel || null,\n }\n}\n\ninterface GlassesStore extends GlassesStatus {\n systemTimeMs: number\n mtkUpdatedThisSession: boolean\n wifiStatusKnown: boolean\n otaStatus: OtaStatus | null\n}\n\nconst initialState: GlassesStore = {\n // state:\n connection: {state: \"disconnected\"},\n micEnabled: false,\n bluetoothClassicConnected: false,\n signalStrength: -1,\n signalStrengthUpdatedAt: 0,\n voiceActivityDetectionEnabled: true,\n // device info\n deviceModel: \"\",\n androidVersion: \"\",\n firmwareVersion: \"\",\n bluetoothMacAddress: \"\",\n wifiMacAddress: \"\",\n leftMacAddress: \"\",\n rightMacAddress: \"\",\n buildNumber: \"\",\n systemTimeMs: 0,\n otaVersionUrl: \"\",\n appVersion: \"\",\n bluetoothName: \"\",\n serialNumber: \"\",\n style: \"\",\n color: \"\",\n mtkFirmwareVersion: \"\",\n besFirmwareVersion: \"\",\n hotspotOtaVersion: 0,\n // wifi info\n wifi: {state: \"disconnected\"},\n wifiStatusKnown: false,\n // battery info\n batteryLevel: -1,\n charging: false,\n caseBatteryLevel: -1,\n caseCharging: false,\n caseOpen: false,\n caseRemoved: true,\n // hotspot info\n hotspot: {state: \"disabled\"},\n // OTA update info\n otaStatus: null,\n otaUpdateAvailable: null,\n otaProgress: null,\n otaInProgress: false,\n mtkUpdatedThisSession: false,\n // ring:\n controllerConnected: false,\n controllerFullyBooted: false,\n controllerMacAddress: \"\",\n controllerBatteryLevel: -1,\n controllerSignalStrength: -1,\n}\n\nexport const useGlassesStore = create<GlassesState>()(\n subscribeWithSelector((set) => ({\n ...initialState,\n\n setGlassesInfo: (info) =>\n set((state) => {\n const {\n wifiConnected,\n wifiSsid,\n wifiLocalIp,\n hotspotEnabled,\n hotspotSsid,\n hotspotPassword,\n hotspotGatewayIp,\n hotspotLocalIp,\n wifi,\n hotspot,\n ...sdkInfo\n } = info\n const wifiUpdate = wifi ?? wifiFromLegacyFields({wifiConnected, wifiSsid, wifiLocalIp})\n const hotspotUpdate =\n hotspot ??\n hotspotFromLegacyFields({hotspotEnabled, hotspotSsid, hotspotPassword, hotspotGatewayIp, hotspotLocalIp})\n const hasWifiInfoUpdate =\n Object.prototype.hasOwnProperty.call(info, \"wifi\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiConnected\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiSsid\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiLocalIp\")\n const next = {\n ...state,\n ...sdkInfo,\n ...(wifiUpdate ? {wifi: wifiUpdate} : {}),\n ...(hotspotUpdate ? {hotspot: hotspotUpdate} : {}),\n ...(hasWifiInfoUpdate ? {wifiStatusKnown: true} : {}),\n }\n if (!isGlassesConnected(next.connection)) {\n next.wifiStatusKnown = false\n next.hotspotOtaVersion = 0\n }\n return next\n }),\n\n setBatteryInfo: (batteryLevel, charging, caseBatteryLevel, caseCharging) =>\n set({\n batteryLevel,\n charging,\n caseBatteryLevel,\n caseCharging,\n }),\n\n setWifiInfo: (connected, ssid) =>\n set(() => {\n const trimmedSsid = ssid.trim()\n if (connected && !trimmedSsid) {\n return {}\n }\n const wifi: WifiStatus = connected ? {state: \"connected\", ssid: trimmedSsid} : {state: \"disconnected\"}\n return {\n wifi,\n wifiStatusKnown: true,\n }\n }),\n\n setHotspotInfo: (enabled: boolean, ssid: string, password: string, ip: string) =>\n set(() => {\n const hotspot = hotspotFromLegacyFields({\n hotspotEnabled: enabled,\n hotspotSsid: ssid,\n hotspotPassword: password,\n hotspotGatewayIp: ip,\n })\n return hotspot ? {hotspot} : {}\n }),\n\n // OTA methods\n setOtaStatus: (status: OtaStatus | null) => set({otaStatus: status}),\n\n setOtaUpdateAvailable: (info: OtaUpdateInfo | null) => set({otaUpdateAvailable: info}),\n\n setOtaProgress: (progress: OtaProgress | null) =>\n set((state) => {\n const otaInProgress = progress !== null && progress.status !== \"FINISHED\" && progress.status !== \"FAILED\"\n console.log(\"🔍 GLASSES STORE: setOtaProgress called with:\", JSON.stringify(progress))\n console.log(\"🔍 GLASSES STORE: otaInProgress =\", otaInProgress)\n\n // Never allow progress to regress within the same stage+currentUpdate — except a new\n // work wave (STARTED) or the step after FINISHED (multi-hop APK: 27→31→36 re-downloads from 0).\n const prev = state.otaProgress\n const sameWave =\n progress &&\n prev &&\n progress.stage === prev.stage &&\n progress.currentUpdate === prev.currentUpdate &&\n progress.progress < prev.progress\n if (sameWave) {\n const nextIsNewWave = progress.status === \"STARTED\" || prev.status === \"FINISHED\"\n if (!nextIsNewWave) {\n return {otaProgress: {...progress, progress: prev.progress}, otaInProgress}\n }\n }\n\n return {otaProgress: progress, otaInProgress}\n }),\n\n setOtaInProgress: (inProgress: boolean) => set({otaInProgress: inProgress}),\n\n setMtkUpdatedThisSession: (updated: boolean) => set({mtkUpdatedThisSession: updated}),\n\n clearOtaState: () =>\n set({\n otaUpdateAvailable: null,\n otaProgress: null,\n otaInProgress: false,\n // Note: mtkUpdatedThisSession is NOT cleared here - it stays true until glasses disconnect/reboot\n }),\n\n reset: () => set(initialState),\n })),\n)\n\nexport function getGlassesSystemTimeMs(): number {\n return useGlassesStore.getState().systemTimeMs ?? 0\n}\n\nexport const waitForGlassesState = <K extends keyof GlassesState>(\n key: K,\n predicate: (value: GlassesState[K]) => boolean,\n timeoutMs = 1000,\n): Promise<boolean> => {\n return new Promise((resolve) => {\n const state = useGlassesStore.getState()\n if (predicate(state[key])) {\n resolve(true)\n return\n }\n\n const unsubscribe = useGlassesStore.subscribe(\n (s) => s[key],\n (value) => {\n if (predicate(value)) {\n unsubscribe()\n resolve(true)\n }\n },\n )\n\n setTimeout(() => {\n unsubscribe()\n resolve(predicate(useGlassesStore.getState()[key]))\n }, timeoutMs)\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/stores/glasses.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AACvG,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAA;AAExD,uEAAuE;AACvE,kEAAkE;AAClE,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,CAAA;AAEnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAA4C,EAAE,EAAE,CACrF,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA4C,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AA4CpH,SAAS,oBAAoB,CAAC,IAAsB;IAClD,IAAI,IAAI,CAAC,aAAa,KAAK,I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Y,IAAI,CAAC,CAAA;AACrD,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,GAAM,EACN,SAA8C,EAC9C,SAAS,GAAG,IAAI,EACE,EAAE;IACpB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAA;QACxC,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,CAAA;YACb,OAAM;QACR,CAAC;QAED,MAAM,WAAW,GAAG,eAAe,CAAC,SAAS,CAC3C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EACb,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrB,WAAW,EAAE,CAAA;gBACb,OAAO,CAAC,IAAI,CAAC,CAAA;YACf,CAAC;QACH,CAAC,CACF,CAAA;QAED,UAAU,CAAC,GAAG,EAAE;YACd,WAAW,EAAE,CAAA;YACb,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACrD,CAAC,EAAE,SAAS,CAAC,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import type {\n GlassesConnectionStatus,\n HotspotStatus,\n OtaProgress,\n OtaStatus,\n OtaUpdateInfo,\n PublicGlassesStatus,\n WifiStatus,\n} from \"@mentra/bluetooth-sdk\"\nimport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\n// Re-export the connection predicates (single source of truth lives in\n// GlassesReadiness) so importers of this store keep getting them.\nexport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady}\n\nexport const selectGlassesConnected = (state: {connection: GlassesConnectionStatus}) =>\n isGlassesConnected(state.connection)\n\nexport const selectGlassesReady = (state: {connection: GlassesConnectionStatus}) => isGlassesReady(state.connection)\n\ntype EngineGlassesStatus = PublicGlassesStatus & {\n otaUpdateAvailable: OtaUpdateInfo | null\n otaProgress: OtaProgress | null\n otaInProgress: boolean\n otaVersionUrl: string\n}\n\nexport interface GlassesState extends EngineGlassesStatus {\n systemTimeMs: number\n wifiStatusKnown: boolean\n setGlassesInfo: (info: GlassesInfoUpdate) => void\n setBatteryInfo: (batteryLevel: number, charging: boolean, caseBatteryLevel: number, caseCharging: boolean) => void\n setWifiInfo: (connected: boolean, ssid: string) => void\n setHotspotInfo: (enabled: boolean, ssid: string, password: string, ip: string) => void\n // OTA methods\n otaStatus: OtaStatus | null\n setOtaStatus: (status: OtaStatus | null) => void\n setOtaUpdateAvailable: (info: OtaUpdateInfo | null) => void\n setOtaProgress: (progress: OtaProgress | null) => void\n setOtaInProgress: (inProgress: boolean) => void\n setMtkUpdatedThisSession: (updated: boolean) => void\n clearOtaState: () => void\n reset: () => void\n mtkUpdatedThisSession: boolean\n}\n\ntype LegacyWifiFields = {\n wifiConnected?: boolean\n wifiSsid?: string\n wifiLocalIp?: string\n}\n\ntype LegacyHotspotFields = {\n hotspotEnabled?: boolean\n hotspotSsid?: string\n hotspotPassword?: string\n hotspotGatewayIp?: string\n hotspotLocalIp?: string\n}\n\ntype GlassesInfoUpdate = Partial<EngineGlassesStatus> & LegacyWifiFields & LegacyHotspotFields\n\nfunction wifiFromLegacyFields(info: LegacyWifiFields): WifiStatus | null {\n if (info.wifiConnected === true) {\n const ssid = info.wifiSsid?.trim()\n const localIp = info.wifiLocalIp?.trim()\n return ssid ? {state: \"connected\", ssid, ...(localIp ? {localIp} : {})} : null\n }\n if (info.wifiConnected === false) {\n return {state: \"disconnected\"}\n }\n return null\n}\n\nfunction hotspotFromLegacyFields(info: LegacyHotspotFields): HotspotStatus | null {\n if (info.hotspotEnabled === true) {\n const ssid = info.hotspotSsid?.trim()\n const password = info.hotspotPassword?.trim()\n const localIp = (info.hotspotGatewayIp ?? info.hotspotLocalIp)?.trim()\n return ssid && password && localIp ? {state: \"enabled\", ssid, password, localIp} : null\n }\n if (info.hotspotEnabled === false) {\n return {state: \"disabled\"}\n }\n return null\n}\n\nexport const getGlasesInfoPartial = (state: EngineGlassesStatus) => {\n const wifi = state.wifi\n const connected = isGlassesConnected(state.connection)\n return {\n batteryLevel: state.batteryLevel,\n charging: state.charging,\n caseBatteryLevel: state.caseBatteryLevel,\n caseCharging: state.caseCharging,\n connected,\n wifiConnected: wifi.state === \"connected\",\n wifiSsid: wifi.state === \"connected\" ? wifi.ssid : \"\",\n deviceModel: state.deviceModel,\n // Cloud GlassesInfo uses modelName, map from deviceModel so the cloud\n // knows which device is connected when it receives connection state updates\n modelName: state.deviceModel || null,\n }\n}\n\ninterface GlassesStore extends EngineGlassesStatus {\n systemTimeMs: number\n mtkUpdatedThisSession: boolean\n wifiStatusKnown: boolean\n otaStatus: OtaStatus | null\n}\n\nconst initialState: GlassesStore = {\n // state:\n connection: {state: \"disconnected\"},\n micEnabled: false,\n bluetoothClassicConnected: false,\n signalStrength: -1,\n signalStrengthUpdatedAt: 0,\n voiceActivityDetectionEnabled: true,\n // device info\n deviceModel: \"\",\n androidVersion: \"\",\n firmwareVersion: \"\",\n bluetoothMacAddress: \"\",\n wifiMacAddress: \"\",\n leftMacAddress: \"\",\n rightMacAddress: \"\",\n buildNumber: \"\",\n systemTimeMs: 0,\n otaVersionUrl: \"\",\n appVersion: \"\",\n bluetoothName: \"\",\n serialNumber: \"\",\n style: \"\",\n color: \"\",\n mtkFirmwareVersion: \"\",\n besFirmwareVersion: \"\",\n hotspotOtaVersion: 0,\n // wifi info\n wifi: {state: \"disconnected\"},\n wifiStatusKnown: false,\n // battery info\n batteryLevel: -1,\n charging: false,\n caseBatteryLevel: -1,\n caseCharging: false,\n caseOpen: false,\n caseRemoved: true,\n // hotspot info\n hotspot: {state: \"disabled\"},\n // OTA update info\n otaStatus: null,\n otaUpdateAvailable: null,\n otaProgress: null,\n otaInProgress: false,\n mtkUpdatedThisSession: false,\n // ring:\n controllerConnected: false,\n controllerFullyBooted: false,\n controllerMacAddress: \"\",\n controllerBatteryLevel: -1,\n controllerSignalStrength: -1,\n}\n\nexport const useGlassesStore = create<GlassesState>()(\n subscribeWithSelector((set) => ({\n ...initialState,\n\n setGlassesInfo: (info) =>\n set((state) => {\n const {\n wifiConnected,\n wifiSsid,\n wifiLocalIp,\n hotspotEnabled,\n hotspotSsid,\n hotspotPassword,\n hotspotGatewayIp,\n hotspotLocalIp,\n wifi,\n hotspot,\n ...sdkInfo\n } = info\n const wifiUpdate = wifi ?? wifiFromLegacyFields({wifiConnected, wifiSsid, wifiLocalIp})\n const hotspotUpdate =\n hotspot ??\n hotspotFromLegacyFields({hotspotEnabled, hotspotSsid, hotspotPassword, hotspotGatewayIp, hotspotLocalIp})\n const hasWifiInfoUpdate =\n Object.prototype.hasOwnProperty.call(info, \"wifi\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiConnected\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiSsid\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiLocalIp\")\n const next = {\n ...state,\n ...sdkInfo,\n ...(wifiUpdate ? {wifi: wifiUpdate} : {}),\n ...(hotspotUpdate ? {hotspot: hotspotUpdate} : {}),\n ...(hasWifiInfoUpdate ? {wifiStatusKnown: true} : {}),\n }\n if (!isGlassesConnected(next.connection)) {\n next.wifiStatusKnown = false\n next.hotspotOtaVersion = 0\n }\n return next\n }),\n\n setBatteryInfo: (batteryLevel, charging, caseBatteryLevel, caseCharging) =>\n set({\n batteryLevel,\n charging,\n caseBatteryLevel,\n caseCharging,\n }),\n\n setWifiInfo: (connected, ssid) =>\n set(() => {\n const trimmedSsid = ssid.trim()\n if (connected && !trimmedSsid) {\n return {}\n }\n const wifi: WifiStatus = connected ? {state: \"connected\", ssid: trimmedSsid} : {state: \"disconnected\"}\n return {\n wifi,\n wifiStatusKnown: true,\n }\n }),\n\n setHotspotInfo: (enabled: boolean, ssid: string, password: string, ip: string) =>\n set(() => {\n const hotspot = hotspotFromLegacyFields({\n hotspotEnabled: enabled,\n hotspotSsid: ssid,\n hotspotPassword: password,\n hotspotGatewayIp: ip,\n })\n return hotspot ? {hotspot} : {}\n }),\n\n // OTA methods\n setOtaStatus: (status: OtaStatus | null) => set({otaStatus: status}),\n\n setOtaUpdateAvailable: (info: OtaUpdateInfo | null) => set({otaUpdateAvailable: info}),\n\n setOtaProgress: (progress: OtaProgress | null) =>\n set((state) => {\n const otaInProgress = progress !== null && progress.status !== \"FINISHED\" && progress.status !== \"FAILED\"\n console.log(\"🔍 GLASSES STORE: setOtaProgress called with:\", JSON.stringify(progress))\n console.log(\"🔍 GLASSES STORE: otaInProgress =\", otaInProgress)\n\n // Never allow progress to regress within the same stage+currentUpdate — except a new\n // work wave (STARTED) or the step after FINISHED (multi-hop APK: 27→31→36 re-downloads from 0).\n const prev = state.otaProgress\n const sameWave =\n progress &&\n prev &&\n progress.stage === prev.stage &&\n progress.currentUpdate === prev.currentUpdate &&\n progress.progress < prev.progress\n if (sameWave) {\n const nextIsNewWave = progress.status === \"STARTED\" || prev.status === \"FINISHED\"\n if (!nextIsNewWave) {\n return {otaProgress: {...progress, progress: prev.progress}, otaInProgress}\n }\n }\n\n return {otaProgress: progress, otaInProgress}\n }),\n\n setOtaInProgress: (inProgress: boolean) => set({otaInProgress: inProgress}),\n\n setMtkUpdatedThisSession: (updated: boolean) => set({mtkUpdatedThisSession: updated}),\n\n clearOtaState: () =>\n set({\n otaUpdateAvailable: null,\n otaProgress: null,\n otaInProgress: false,\n // Note: mtkUpdatedThisSession is NOT cleared here - it stays true until glasses disconnect/reboot\n }),\n\n reset: () => set(initialState),\n })),\n)\n\nexport function getGlassesSystemTimeMs(): number {\n return useGlassesStore.getState().systemTimeMs ?? 0\n}\n\nexport const waitForGlassesState = <K extends keyof GlassesState>(\n key: K,\n predicate: (value: GlassesState[K]) => boolean,\n timeoutMs = 1000,\n): Promise<boolean> => {\n return new Promise((resolve) => {\n const state = useGlassesStore.getState()\n if (predicate(state[key])) {\n resolve(true)\n return\n }\n\n const unsubscribe = useGlassesStore.subscribe(\n (s) => s[key],\n (value) => {\n if (predicate(value)) {\n unsubscribe()\n resolve(true)\n }\n },\n )\n\n setTimeout(() => {\n unsubscribe()\n resolve(predicate(useGlassesStore.getState()[key]))\n }, timeoutMs)\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/engine",
|
|
3
|
-
"version": "3.1.0-dev.
|
|
3
|
+
"version": "3.1.0-dev.91",
|
|
4
4
|
"description": "Mentra Engine — miniapp registry, WebView bridge, and miniapp store",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"react-native": "./src/bluetooth-sdk/photo-receiver.ts",
|
|
37
37
|
"default": "./build/bluetooth-sdk/photo-receiver.js"
|
|
38
38
|
},
|
|
39
|
+
"./bluetooth-sdk/ota-transport": {
|
|
40
|
+
"types": "./build/bluetooth-sdk/ota-transport.d.ts",
|
|
41
|
+
"react-native": "./src/bluetooth-sdk/ota-transport.ts",
|
|
42
|
+
"default": "./build/bluetooth-sdk/ota-transport.js"
|
|
43
|
+
},
|
|
39
44
|
"./bluetooth-sdk/debug": {
|
|
40
45
|
"types": "./build/bluetooth-sdk/debug.d.ts",
|
|
41
46
|
"react-native": "./src/bluetooth-sdk/debug.ts",
|
|
@@ -64,6 +69,7 @@
|
|
|
64
69
|
"write:release-metadata": "node scripts/write-release-metadata.mjs",
|
|
65
70
|
"verify:release-package": "node scripts/verify-release-package.mjs",
|
|
66
71
|
"test:public-api": "bun test src/bluetooth-sdk/__tests__/publicApi.test.ts",
|
|
72
|
+
"test:public-ota-consumer": "tsc --noEmit --strict --skipLibCheck --jsx react-jsx --moduleResolution bundler --module esnext --target es2022 scripts/fixtures/public-ota-consumer.tsx",
|
|
67
73
|
"build:module": "expo-module prepare",
|
|
68
74
|
"prepublishOnly": "expo-module prepublishOnly",
|
|
69
75
|
"expo-module": "expo-module"
|
|
@@ -91,13 +97,14 @@
|
|
|
91
97
|
"registry": "https://registry.npmjs.org/"
|
|
92
98
|
},
|
|
93
99
|
"dependencies": {
|
|
94
|
-
"@mentra/bluetooth-sdk": "3.1.0-dev.
|
|
95
|
-
"@mentra/cloud-client": "3.1.0-dev.
|
|
96
|
-
"@mentra/cloud-protocol": "3.1.0-dev.
|
|
97
|
-
"@mentra/crust": "3.1.0-dev.
|
|
98
|
-
"@mentra/miniapp": "3.1.0-dev.
|
|
100
|
+
"@mentra/bluetooth-sdk": "3.1.0-dev.91",
|
|
101
|
+
"@mentra/cloud-client": "3.1.0-dev.91",
|
|
102
|
+
"@mentra/cloud-protocol": "3.1.0-dev.91",
|
|
103
|
+
"@mentra/crust": "3.1.0-dev.91",
|
|
104
|
+
"@mentra/miniapp": "3.1.0-dev.91",
|
|
99
105
|
"buffer": "^6.0.3",
|
|
100
106
|
"events": "^3.3.0",
|
|
107
|
+
"react-native-marked": "8.1.1",
|
|
101
108
|
"semver": "^7.7.4",
|
|
102
109
|
"typesafe-ts": "^1.7.1"
|
|
103
110
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@mentra/bluetooth-sdk/ota-transport"
|