@glassly/engine 0.3.3-beta.639 → 0.3.3-beta.654

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/build/facades/glasses.d.ts +1 -0
  2. package/build/facades/glasses.d.ts.map +1 -1
  3. package/build/facades/glasses.js +1 -0
  4. package/build/facades/glasses.js.map +1 -1
  5. package/build/generated/releaseMetadata.js +3 -3
  6. package/build/generated/releaseMetadata.js.map +1 -1
  7. package/build/index.d.ts +1 -1
  8. package/build/index.d.ts.map +1 -1
  9. package/build/index.js +1 -1
  10. package/build/index.js.map +1 -1
  11. package/build/services/AiTierResolution.d.ts.map +1 -1
  12. package/build/services/AiTierResolution.js +11 -3
  13. package/build/services/AiTierResolution.js.map +1 -1
  14. package/build/services/GestureDotsService.d.ts.map +1 -1
  15. package/build/services/GestureDotsService.js +15 -6
  16. package/build/services/GestureDotsService.js.map +1 -1
  17. package/build/services/gestureDotGlyphs.d.ts +1 -1
  18. package/build/services/gestureDotGlyphs.d.ts.map +1 -1
  19. package/build/services/gestureDotGlyphs.js +1 -0
  20. package/build/services/gestureDotGlyphs.js.map +1 -1
  21. package/build/stores/glasses.d.ts.map +1 -1
  22. package/build/stores/glasses.js +1 -0
  23. package/build/stores/glasses.js.map +1 -1
  24. package/build/types/capabilities/even-realities-g2.js +1 -1
  25. package/build/types/capabilities/even-realities-g2.js.map +1 -1
  26. package/build/types/capabilities/mentra-display.js +1 -1
  27. package/build/types/capabilities/mentra-display.js.map +1 -1
  28. package/build/types/capabilities/rayneo-io.js +1 -1
  29. package/build/types/capabilities/rayneo-io.js.map +1 -1
  30. package/build/utils/timers/index.d.ts +1 -2
  31. package/build/utils/timers/index.d.ts.map +1 -1
  32. package/build/utils/timers/index.js +1 -2
  33. package/build/utils/timers/index.js.map +1 -1
  34. package/build/utils/timers/timers.d.ts +3 -5
  35. package/build/utils/timers/timers.d.ts.map +1 -1
  36. package/build/utils/timers/timers.js +78 -128
  37. package/build/utils/timers/timers.js.map +1 -1
  38. package/package.json +8 -8
  39. package/src/facades/glasses.ts +1 -0
  40. package/src/generated/releaseMetadata.ts +3 -3
  41. package/src/index.ts +1 -1
  42. package/src/services/AiTierResolution.ts +12 -3
  43. package/src/services/GestureDotsService.ts +16 -6
  44. package/src/services/gestureDotGlyphs.ts +2 -1
  45. package/src/stores/glasses.ts +1 -0
  46. package/src/types/capabilities/even-realities-g2.ts +1 -1
  47. package/src/types/capabilities/mentra-display.ts +1 -1
  48. package/src/types/capabilities/rayneo-io.ts +1 -1
  49. package/src/utils/timers/index.ts +1 -2
  50. package/src/utils/timers/timers.ts +82 -157
@@ -1 +1 @@
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,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAA;AAEvC,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,IAAI,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAA;QAClC,MAAM,OAAO,GAAG,I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n OtaUpdateInfo,\n PublicGlassesStatus,\n WifiStatus,\n} from \"@glassly/bluetooth-sdk\"\nimport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\nimport {BgTimer} from \"../utils/timers\"\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 sceneCanvasWidth: 0,\n sceneCanvasHeight: 0,\n sceneVector: false,\n sceneSettle: false,\n volumeGate: false,\n // wifi info\n wifi: {state: \"disconnected\"},\n wifiStatusKnown: false,\n // battery info\n batteryLevel: -1,\n charging: false,\n ringConnected: false,\n ringBatteryLevel: -1,\n ringCharging: 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 // iOS ANCS consent (G2 consumes notifications on-firmware):\n ancsAuthorized: false,\n // G2 Glassly CFW keyboard bridge (revision 39+):\n keyboardBridge: false,\n keyboardConnected: false,\n keyboardName: \"\",\n keyboardSaved: false,\n keyboardState: \"idle\",\n keyboardError: \"\",\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 BgTimer.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,OAAO,EAAC,OAAO,EAAC,MAAM,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G,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,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE;YACtB,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 \"@glassly/bluetooth-sdk\"\nimport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\nimport {BgTimer} from \"../utils/timers\"\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 sceneCanvasWidth: 0,\n sceneCanvasHeight: 0,\n sceneVector: false,\n sceneSettle: false,\n volumeGate: false,\n firmwareUpdateAvailable: false,\n // wifi info\n wifi: {state: \"disconnected\"},\n wifiStatusKnown: false,\n // battery info\n batteryLevel: -1,\n charging: false,\n ringConnected: false,\n ringBatteryLevel: -1,\n ringCharging: 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 // iOS ANCS consent (G2 consumes notifications on-firmware):\n ancsAuthorized: false,\n // G2 Glassly CFW keyboard bridge (revision 39+):\n keyboardBridge: false,\n keyboardConnected: false,\n keyboardName: \"\",\n keyboardSaved: false,\n keyboardState: \"idle\",\n keyboardError: \"\",\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 BgTimer.setTimeout(() => {\n unsubscribe()\n resolve(predicate(useGlassesStore.getState()[key]))\n }, timeoutMs)\n })\n}\n"]}
@@ -36,7 +36,7 @@ export const evenRealitiesG2 = {
36
36
  // envelope). Pathological sizes needing more than the 4-container pool are
37
37
  // dropped SGC-side with a log.
38
38
  shapes: ["rect"], // bordered empty container ≈ rect
39
- intensityLevels: 2,
39
+ intensityLevels: 16,
40
40
  partialUpdate: true,
41
41
  },
42
42
  // Microphone capabilities - G2 has one microphone (right side), LC3 codec
@@ -1 +1 @@
1
- {"version":3,"file":"even-realities-g2.js","sourceRoot":"","sources":["../../../src/types/capabilities/even-realities-g2.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAiB;IAC3C,SAAS,EAAE,mBAAmB;IAE9B,kDAAkD;IAClD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,IAAI;IAEZ,2EAA2E;IAC3E,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QACd,gBAAgB,EAAE,IAAI;QACtB,6EAA6E;QAC7E,UAAU,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC;QACrC,WAAW,EAAE,EAAC,UAAU,EAAE,EAAE,EAAC;QAC7B,YAAY,EAAE,CAAC;QACf,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAC,EAAE,KAAK,EAAE,EAAC,GAAG,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AEzB,uEAAuE;IACvE,sBAAsB,EAAE,IAAI;IAC5B,8BAA8B,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;CAC9C,CAAA","sourcesContent":["/**\n * @fileoverview Even Realities G2 Hardware Capabilities\n *\n * Capability profile for the Even Realities G2 smart glasses model.\n * G2 uses the EvenHub protocol with protobuf-based commands.\n */\n\nimport type {Capabilities} from \"../hardware\"\n\n/**\n * Even Realities G2 capability profile\n */\nexport const evenRealitiesG2: Capabilities = {\n modelName: \"Even Realities G2\",\n\n // Camera capabilities - G2 does not have a camera\n hasCamera: false,\n camera: null,\n\n // Display capabilities - G2 has a green monochrome display (similar to G1)\n hasDisplay: true,\n display: {\n count: 2,\n isColor: false,\n color: \"green\",\n canDisplayBitmap: true,\n // Physical panel; stock firmware blits its 576×288 scene canvas into it 1:1.\n resolution: {width: 640, height: 480},\n fieldOfView: {horizontal: 25},\n maxTextLines: 8,\n adjustBrightness: true,\n positionRange: {height: {min: 0, max: 12}, depth: {min: 1, max: 3}},\n\n // Scene display API — EvenHub retained containers.\n width: 576,\n height: 288,\n canPosition: true,\n maxTextElements: 6, // firmware text-container pool (rects share it)\n maxImageElements: 4, // firmware image-container pool\n // No maxImagePx: the SGC tiles larger images across multiple firmware\n // containers (each ≤200x100 — the hardware-verified per-container transfer\n // envelope). Pathological sizes needing more than the 4-container pool are\n // dropped SGC-side with a log.\n shapes: [\"rect\"], // bordered empty container ≈ rect\n intensityLevels: 2,\n partialUpdate: true,\n },\n\n // Microphone capabilities - G2 has one microphone (right side), LC3 codec\n hasMicrophone: true,\n microphone: {\n count: 1,\n hasVAD: false,\n },\n\n // Speaker capabilities - G2 does not have a speaker\n hasSpeaker: false,\n speaker: null,\n\n // IMU capabilities - G2 has IMU\n hasIMU: true,\n imu: null,\n\n // Button capabilities - G2 has a capacitive touchbar\n hasButton: true,\n button: {\n count: 1,\n buttons: [\n {\n type: \"swipe1d\",\n events: [\"TAP\", \"DOUBLE_TAP\", \"TRIPLE_TAP\", \"PRESS_HOLD\", \"SWIPE_UP\", \"SWIPE_DOWN\"],\n isCapacitive: true,\n },\n ],\n },\n\n // Light capabilities - G2 does not have lights\n hasLight: false,\n light: null,\n\n // Power capabilities\n power: {\n hasExternalBattery: false,\n },\n\n // WiFi capabilities - G2 does not support WiFi\n hasWifi: false,\n\n // OTA capabilities - G2 firmware updates are not driven by the ASG OTA flow\n hasOta: false,\n\n // Glassly CFW is bundled for the G2 and flashed over BLE from the app\n hasCustomFirmware: true,\n\n // Dashboard - G2 renders Even Realities' native dashboard in firmware, so\n // Glassly does not manage the dashboard or expose dashboard settings for it\n hasNativeDashboard: true,\n\n // Navigation - firmware nav UI on service 0x08 (card, 176×176 mini map,\n // 576×188 overview map); magnetometer streams only while it is active\n hasNativeNavigation: true,\n\n // Firmware notification centre: popups + history, on-glass app filter.\n hasNativeNotifications: true,\n nativeNotificationPopupSeconds: [0, 5, 7, 10],\n}\n"]}
1
+ {"version":3,"file":"even-realities-g2.js","sourceRoot":"","sources":["../../../src/types/capabilities/even-realities-g2.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAiB;IAC3C,SAAS,EAAE,mBAAmB;IAE9B,kDAAkD;IAClD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,IAAI;IAEZ,2EAA2E;IAC3E,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QACd,gBAAgB,EAAE,IAAI;QACtB,6EAA6E;QAC7E,UAAU,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC;QACrC,WAAW,EAAE,EAAC,UAAU,EAAE,EAAE,EAAC;QAC7B,YAAY,EAAE,CAAC;QACf,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,EAAC,MAAM,EAAE,EAAC,GAAG,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kB,EAAE,IAAI;IAExB,wEAAwE;IACxE,sEAAsE;IACtE,mBAAmB,EAAE,IAAI;IAEzB,uEAAuE;IACvE,sBAAsB,EAAE,IAAI;IAC5B,8BAA8B,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;CAC9C,CAAA","sourcesContent":["/**\n * @fileoverview Even Realities G2 Hardware Capabilities\n *\n * Capability profile for the Even Realities G2 smart glasses model.\n * G2 uses the EvenHub protocol with protobuf-based commands.\n */\n\nimport type {Capabilities} from \"../hardware\"\n\n/**\n * Even Realities G2 capability profile\n */\nexport const evenRealitiesG2: Capabilities = {\n modelName: \"Even Realities G2\",\n\n // Camera capabilities - G2 does not have a camera\n hasCamera: false,\n camera: null,\n\n // Display capabilities - G2 has a green monochrome display (similar to G1)\n hasDisplay: true,\n display: {\n count: 2,\n isColor: false,\n color: \"green\",\n canDisplayBitmap: true,\n // Physical panel; stock firmware blits its 576×288 scene canvas into it 1:1.\n resolution: {width: 640, height: 480},\n fieldOfView: {horizontal: 25},\n maxTextLines: 8,\n adjustBrightness: true,\n positionRange: {height: {min: 0, max: 12}, depth: {min: 1, max: 3}},\n\n // Scene display API — EvenHub retained containers.\n width: 576,\n height: 288,\n canPosition: true,\n maxTextElements: 6, // firmware text-container pool (rects share it)\n maxImageElements: 4, // firmware image-container pool\n // No maxImagePx: the SGC tiles larger images across multiple firmware\n // containers (each ≤200x100 — the hardware-verified per-container transfer\n // envelope). Pathological sizes needing more than the 4-container pool are\n // dropped SGC-side with a log.\n shapes: [\"rect\"], // bordered empty container ≈ rect\n intensityLevels: 16,\n partialUpdate: true,\n },\n\n // Microphone capabilities - G2 has one microphone (right side), LC3 codec\n hasMicrophone: true,\n microphone: {\n count: 1,\n hasVAD: false,\n },\n\n // Speaker capabilities - G2 does not have a speaker\n hasSpeaker: false,\n speaker: null,\n\n // IMU capabilities - G2 has IMU\n hasIMU: true,\n imu: null,\n\n // Button capabilities - G2 has a capacitive touchbar\n hasButton: true,\n button: {\n count: 1,\n buttons: [\n {\n type: \"swipe1d\",\n events: [\"TAP\", \"DOUBLE_TAP\", \"TRIPLE_TAP\", \"PRESS_HOLD\", \"SWIPE_UP\", \"SWIPE_DOWN\"],\n isCapacitive: true,\n },\n ],\n },\n\n // Light capabilities - G2 does not have lights\n hasLight: false,\n light: null,\n\n // Power capabilities\n power: {\n hasExternalBattery: false,\n },\n\n // WiFi capabilities - G2 does not support WiFi\n hasWifi: false,\n\n // OTA capabilities - G2 firmware updates are not driven by the ASG OTA flow\n hasOta: false,\n\n // Glassly CFW is bundled for the G2 and flashed over BLE from the app\n hasCustomFirmware: true,\n\n // Dashboard - G2 renders Even Realities' native dashboard in firmware, so\n // Glassly does not manage the dashboard or expose dashboard settings for it\n hasNativeDashboard: true,\n\n // Navigation - firmware nav UI on service 0x08 (card, 176×176 mini map,\n // 576×188 overview map); magnetometer streams only while it is active\n hasNativeNavigation: true,\n\n // Firmware notification centre: popups + history, on-glass app filter.\n hasNativeNotifications: true,\n nativeNotificationPopupSeconds: [0, 5, 7, 10],\n}\n"]}
@@ -33,7 +33,7 @@ export const mentraDisplay = {
33
33
  maxImageElements: 4, // firmware BITMAP pool ids 10-13
34
34
  maxImagePx: { width: 200, height: 200 }, // CANVAS_IMAGE_MAX_I1_BYTES / NAV_IMAGE_MAX_W/H
35
35
  shapes: ["rect"], // bordered empty TEXTBOX ≈ rect (no shape primitive)
36
- intensityLevels: 2, // 1-bpp panel today
36
+ intensityLevels: 16,
37
37
  partialUpdate: true,
38
38
  },
39
39
  // Microphone capabilities - Mentra Display has one microphone without VAD
@@ -1 +1 @@
1
- {"version":3,"file":"mentra-display.js","sourceRoot":"","sources":["../../../src/types/capabilities/mentra-display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,SAAS,EAAE,gBAAgB;IAE3B,8DAA8D;IAC9D,SAAS,EAAE,KAAK;IAChB,MAAM,E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EAAE,IAAI;IAEX,qEAAqE;IACrE,KAAK,EAAE;QACL,kBAAkB,EAAE,KAAK;KAC1B;IAED,2DAA2D;IAC3D,OAAO,EAAE,KAAK;IAEd,wFAAwF;IACxF,MAAM,EAAE,KAAK;CACd,CAAA","sourcesContent":["/**\n * @fileoverview Mentra Display Hardware Capabilities\n *\n * Capability profile for the Mentra Display smart glasses model.\n * Defines the hardware and software features available on this device.\n */\n\nimport type {Capabilities} from \"../hardware\"\n\n/**\n * Mentra Display capability profile\n */\nexport const mentraDisplay: Capabilities = {\n modelName: \"Mentra Display\",\n\n // Camera capabilities - Mentra Display does not have a camera\n hasCamera: false,\n camera: null,\n\n // Display capabilities - Mentra Display has a green monochrome display\n hasDisplay: true,\n display: {\n count: 2,\n isColor: false,\n color: \"green\",\n canDisplayBitmap: true,\n resolution: {width: 640, height: 480},\n fieldOfView: {horizontal: 25},\n maxTextLines: 5,\n adjustBrightness: true,\n positionRange: {height: {min: 0, max: 8}, depth: {min: 1, max: 4}},\n\n // Scene display API — firmware canvas components on the 500x220 virtual\n // screen centered in the 640x480 A6N panel (mos_display_config.c).\n width: 500,\n height: 220,\n canPosition: true,\n maxTextElements: 6, // firmware TEXTBOX pool ids 1-6 (rects share it)\n maxImageElements: 4, // firmware BITMAP pool ids 10-13\n maxImagePx: {width: 200, height: 200}, // CANVAS_IMAGE_MAX_I1_BYTES / NAV_IMAGE_MAX_W/H\n shapes: [\"rect\"], // bordered empty TEXTBOX ≈ rect (no shape primitive)\n intensityLevels: 2, // 1-bpp panel today\n partialUpdate: true,\n },\n\n // Microphone capabilities - Mentra Display has one microphone without VAD\n hasMicrophone: true,\n microphone: {\n count: 1,\n hasVAD: false,\n },\n\n // Speaker capabilities - Mentra Display does not have a speaker\n hasSpeaker: false,\n speaker: null,\n\n // IMU capabilities - Mentra Display has IMU for head-up/down detection but raw data not exposed to apps\n hasIMU: true,\n imu: null,\n\n // Button capabilities - Mentra Display does not have buttons\n hasButton: false,\n button: null,\n\n // Light capabilities - Mentra Display does not have lights\n hasLight: false,\n light: null,\n\n // Power capabilities - Mentra Display does not have external battery\n power: {\n hasExternalBattery: false,\n },\n\n // WiFi capabilities - Mentra Display does not support WiFi\n hasWifi: false,\n\n // OTA capabilities - Mentra Display firmware updates are not driven by the ASG OTA flow\n hasOta: false,\n}\n"]}
1
+ {"version":3,"file":"mentra-display.js","sourceRoot":"","sources":["../../../src/types/capabilities/mentra-display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,SAAS,EAAE,gBAAgB;IAE3B,8DAA8D;IAC9D,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,IAAI;IAEZ,uEAAuE;IACvE,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QACd,gBAAgB,EAAE,IAAI;QACtB,UAAU,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC;QACrC,WAAW,EAAE,EAAC,UAAU,EAAE,EAAE,EAAC;QAC7B,YAAY,EAAE,CAAC;QACf,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,EAAE,KAAK,EAAE,EAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,EAAC;QAElE,wEAAwE;QACxE,mEAAmE;QACnE,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,IAAI;QACjB,eAAe,EAAE,CAAC,EAAE,iDAAiD;QACrE,gBAAgB,EAAE,CAAC,EAAE,iCAAiC;QACtD,UAAU,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,EAAE,gDAAgD;QACvF,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,qDAAqD;QACvE,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,IAAI;KACpB;IAED,0EAA0E;IAC1E,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE;QACV,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,KAAK;KACd;IAED,gEAAgE;IAChE,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,IAAI;IAEb,wGAAwG;IACxG,MAAM,EAAE,IAAI;IACZ,GAAG,EAAE,IAAI;IAET,6DAA6D;IAC7D,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,IAAI;IAEZ,2DAA2D;IAC3D,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,IAAI;IAEX,qEAAqE;IACrE,KAAK,EAAE;QACL,kBAAkB,EAAE,KAAK;KAC1B;IAED,2DAA2D;IAC3D,OAAO,EAAE,KAAK;IAEd,wFAAwF;IACxF,MAAM,EAAE,KAAK;CACd,CAAA","sourcesContent":["/**\n * @fileoverview Mentra Display Hardware Capabilities\n *\n * Capability profile for the Mentra Display smart glasses model.\n * Defines the hardware and software features available on this device.\n */\n\nimport type {Capabilities} from \"../hardware\"\n\n/**\n * Mentra Display capability profile\n */\nexport const mentraDisplay: Capabilities = {\n modelName: \"Mentra Display\",\n\n // Camera capabilities - Mentra Display does not have a camera\n hasCamera: false,\n camera: null,\n\n // Display capabilities - Mentra Display has a green monochrome display\n hasDisplay: true,\n display: {\n count: 2,\n isColor: false,\n color: \"green\",\n canDisplayBitmap: true,\n resolution: {width: 640, height: 480},\n fieldOfView: {horizontal: 25},\n maxTextLines: 5,\n adjustBrightness: true,\n positionRange: {height: {min: 0, max: 8}, depth: {min: 1, max: 4}},\n\n // Scene display API — firmware canvas components on the 500x220 virtual\n // screen centered in the 640x480 A6N panel (mos_display_config.c).\n width: 500,\n height: 220,\n canPosition: true,\n maxTextElements: 6, // firmware TEXTBOX pool ids 1-6 (rects share it)\n maxImageElements: 4, // firmware BITMAP pool ids 10-13\n maxImagePx: {width: 200, height: 200}, // CANVAS_IMAGE_MAX_I1_BYTES / NAV_IMAGE_MAX_W/H\n shapes: [\"rect\"], // bordered empty TEXTBOX ≈ rect (no shape primitive)\n intensityLevels: 16,\n partialUpdate: true,\n },\n\n // Microphone capabilities - Mentra Display has one microphone without VAD\n hasMicrophone: true,\n microphone: {\n count: 1,\n hasVAD: false,\n },\n\n // Speaker capabilities - Mentra Display does not have a speaker\n hasSpeaker: false,\n speaker: null,\n\n // IMU capabilities - Mentra Display has IMU for head-up/down detection but raw data not exposed to apps\n hasIMU: true,\n imu: null,\n\n // Button capabilities - Mentra Display does not have buttons\n hasButton: false,\n button: null,\n\n // Light capabilities - Mentra Display does not have lights\n hasLight: false,\n light: null,\n\n // Power capabilities - Mentra Display does not have external battery\n power: {\n hasExternalBattery: false,\n },\n\n // WiFi capabilities - Mentra Display does not support WiFi\n hasWifi: false,\n\n // OTA capabilities - Mentra Display firmware updates are not driven by the ASG OTA flow\n hasOta: false,\n}\n"]}
@@ -33,7 +33,7 @@ export const rayneoIO = {
33
33
  canPosition: true,
34
34
  maxTextElements: 6,
35
35
  maxImageElements: 4,
36
- intensityLevels: 2,
36
+ intensityLevels: 16,
37
37
  partialUpdate: true,
38
38
  },
39
39
  // Microphone capabilities - one Opus mic stream through the voice page
@@ -1 +1 @@
1
- {"version":3,"file":"rayneo-io.js","sourceRoot":"","sources":["../../../src/types/capabilities/rayneo-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,SAAS,EAAE,WAAW;IAEtB,kCAAkC;IAClC,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,IAAI;IAEZ,yDAAyD;IACzD,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QACd,uEAAuE;QACvE,6CAA6C;QAC7C,gBAAgB,EAAE,IAAI;QACt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AA","sourcesContent":["/**\n * @fileoverview RayNeo iO Hardware Capabilities\n *\n * Capability profile for the RayNeo iO smart glasses. The stock firmware\n * exposes a single-line subtitle page over a framed BLE protocol; with the\n * Glassly CFW installed the glasses open a 540×180 page the phone draws into\n * through the Glassly CFW record protocol (positioned text, images, rects).\n */\n\nimport type {Capabilities} from \"../hardware\"\n\n/**\n * RayNeo iO capability profile\n */\nexport const rayneoIO: Capabilities = {\n modelName: \"RayNeo iO\",\n\n // Camera capabilities - no camera\n hasCamera: false,\n camera: null,\n\n // Display capabilities - single monochrome (1-bit) panel\n hasDisplay: true,\n display: {\n count: 1,\n isColor: false,\n color: \"green\",\n // Bitmaps and positioned elements need the Glassly CFW; stock firmware\n // only shows text through its subtitle page.\n canDisplayBitmap: true,\n resolution: {width: 540, height: 180},\n fieldOfView: {horizontal: 30},\n maxTextLines: 5,\n adjustBrightness: true,\n\n // Scene display API — the Glassly CFW page canvas.\n width: 540,\n height: 180,\n canPosition: true,\n maxTextElements: 6,\n maxImageElements: 4,\n intensityLevels: 2,\n partialUpdate: true,\n },\n\n // Microphone capabilities - one Opus mic stream through the voice page\n hasMicrophone: true,\n microphone: {\n count: 1,\n hasVAD: false,\n },\n\n // Speaker capabilities - no speaker channel in the protocol\n hasSpeaker: false,\n speaker: null,\n\n // IMU capabilities - stock firmware exposes no IMU or head-gesture stream\n hasIMU: false,\n imu: null,\n\n // Button capabilities - temple touchpad/crown plus a physical button\n hasButton: true,\n button: {\n count: 1,\n buttons: [\n {\n type: \"swipe1d\",\n events: [\"TAP\", \"DOUBLE_TAP\", \"PRESS_HOLD\", \"SWIPE_UP\", \"SWIPE_DOWN\"],\n isCapacitive: true,\n },\n ],\n },\n\n // Light capabilities - no lights\n hasLight: false,\n light: null,\n\n // Power capabilities\n power: {\n hasExternalBattery: false,\n },\n\n // WiFi capabilities - no WiFi\n hasWifi: false,\n\n // OTA capabilities - RayNeo iO updates are not driven by the ASG OTA flow\n hasOta: false,\n\n // Glassly CFW is bundled for the RayNeo iO and flashed over BLE from the app\n hasCustomFirmware: true,\n\n // Dashboard - the launcher renders its own status UI; Glassly does not\n // manage the dashboard settings for it\n hasNativeDashboard: true,\n\n // Navigation - no firmware nav UI\n hasNativeNavigation: false,\n\n // Firmware notification popups: the phone uploads notification content\n hasNativeNotifications: true,\n}\n"]}
1
+ {"version":3,"file":"rayneo-io.js","sourceRoot":"","sources":["../../../src/types/capabilities/rayneo-io.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,SAAS,EAAE,WAAW;IAEtB,kCAAkC;IAClC,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,IAAI;IAEZ,yDAAyD;IACzD,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE;QACP,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO;QACd,uEAAuE;QACvE,6CAA6C;QAC7C,gBAAgB,EAAE,IAAI;QACtB,UAAU,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC;QACrC,WAAW,EAAE,EAAC,UAAU,EAAE,EAAE,EAAC;QAC7B,YAAY,EAAE,CAAC;QACf,gBAAgB,EAAE,IAAI;QAEtB,mDAAmD;QACnD,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,IAAI;QACjB,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;QACnB,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,IAAI;KACpB;IAED,uEAAuE;IACvE,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE;QACV,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,KAAK;KACd;IAED,4DAA4D;IAC5D,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,IAAI;IAEb,0EAA0E;IAC1E,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,IAAI;IAET,qEAAqE;IACrE,SAAS,EAAE,IAAI;IACf,MAAM,EAAE;QACN,KAAK,EAAE,CAAC;QACR,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC;gBACrE,YAAY,EAAE,IAAI;aACnB;SACF;KACF;IAED,iCAAiC;IACjC,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,IAAI;IAEX,qBAAqB;IACrB,KAAK,EAAE;QACL,kBAAkB,EAAE,KAAK;KAC1B;IAED,8BAA8B;IAC9B,OAAO,EAAE,KAAK;IAEd,0EAA0E;IAC1E,MAAM,EAAE,KAAK;IAEb,6EAA6E;IAC7E,iBAAiB,EAAE,IAAI;IAEvB,uEAAuE;IACvE,uCAAuC;IACvC,kBAAkB,EAAE,IAAI;IAExB,kCAAkC;IAClC,mBAAmB,EAAE,KAAK;IAE1B,uEAAuE;IACvE,sBAAsB,EAAE,IAAI;CAC7B,CAAA","sourcesContent":["/**\n * @fileoverview RayNeo iO Hardware Capabilities\n *\n * Capability profile for the RayNeo iO smart glasses. The stock firmware\n * exposes a single-line subtitle page over a framed BLE protocol; with the\n * Glassly CFW installed the glasses open a 540×180 page the phone draws into\n * through the Glassly CFW record protocol (positioned text, images, rects).\n */\n\nimport type {Capabilities} from \"../hardware\"\n\n/**\n * RayNeo iO capability profile\n */\nexport const rayneoIO: Capabilities = {\n modelName: \"RayNeo iO\",\n\n // Camera capabilities - no camera\n hasCamera: false,\n camera: null,\n\n // Display capabilities - single monochrome (1-bit) panel\n hasDisplay: true,\n display: {\n count: 1,\n isColor: false,\n color: \"green\",\n // Bitmaps and positioned elements need the Glassly CFW; stock firmware\n // only shows text through its subtitle page.\n canDisplayBitmap: true,\n resolution: {width: 540, height: 180},\n fieldOfView: {horizontal: 30},\n maxTextLines: 5,\n adjustBrightness: true,\n\n // Scene display API — the Glassly CFW page canvas.\n width: 540,\n height: 180,\n canPosition: true,\n maxTextElements: 6,\n maxImageElements: 4,\n intensityLevels: 16,\n partialUpdate: true,\n },\n\n // Microphone capabilities - one Opus mic stream through the voice page\n hasMicrophone: true,\n microphone: {\n count: 1,\n hasVAD: false,\n },\n\n // Speaker capabilities - no speaker channel in the protocol\n hasSpeaker: false,\n speaker: null,\n\n // IMU capabilities - stock firmware exposes no IMU or head-gesture stream\n hasIMU: false,\n imu: null,\n\n // Button capabilities - temple touchpad/crown plus a physical button\n hasButton: true,\n button: {\n count: 1,\n buttons: [\n {\n type: \"swipe1d\",\n events: [\"TAP\", \"DOUBLE_TAP\", \"PRESS_HOLD\", \"SWIPE_UP\", \"SWIPE_DOWN\"],\n isCapacitive: true,\n },\n ],\n },\n\n // Light capabilities - no lights\n hasLight: false,\n light: null,\n\n // Power capabilities\n power: {\n hasExternalBattery: false,\n },\n\n // WiFi capabilities - no WiFi\n hasWifi: false,\n\n // OTA capabilities - RayNeo iO updates are not driven by the ASG OTA flow\n hasOta: false,\n\n // Glassly CFW is bundled for the RayNeo iO and flashed over BLE from the app\n hasCustomFirmware: true,\n\n // Dashboard - the launcher renders its own status UI; Glassly does not\n // manage the dashboard settings for it\n hasNativeDashboard: true,\n\n // Navigation - no firmware nav UI\n hasNativeNavigation: false,\n\n // Firmware notification popups: the phone uploads notification content\n hasNativeNotifications: true,\n}\n"]}
@@ -1,3 +1,2 @@
1
- import { BgTimer, throttle, debounce } from "./timers";
2
- export { BgTimer, throttle, debounce };
1
+ export { BgTimer } from "./timers";
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/timers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAA;AACpD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/timers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAA"}
@@ -1,3 +1,2 @@
1
- import { BgTimer, throttle, debounce } from "./timers";
2
- export { BgTimer, throttle, debounce };
1
+ export { BgTimer } from "./timers";
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/timers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAA;AACpD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAA","sourcesContent":["import {BgTimer, throttle, debounce} from \"./timers\"\nexport {BgTimer, throttle, debounce}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/timers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAA","sourcesContent":["export {BgTimer} from \"./timers\"\n"]}
@@ -1,9 +1,7 @@
1
1
  export declare class BgTimer {
2
- static setInterval(callback: () => void, delay: number): number;
3
- static clearInterval(intervalId: number): void;
4
2
  static setTimeout(callback: () => void, delay: number): number;
5
- static clearTimeout(timeoutId: number): void;
3
+ static clearTimeout(id: number): void;
4
+ static setInterval(callback: () => void, delay: number): number;
5
+ static clearInterval(id: number): void;
6
6
  }
7
- export declare function throttle<T extends (...args: any[]) => any>(fn: T, ms: number): (...args: Parameters<T>) => void;
8
- export declare function debounce<T extends (...args: any[]) => any>(fn: T, ms: number): (...args: Parameters<T>) => void;
9
7
  //# sourceMappingURL=timers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timers.d.ts","sourceRoot":"","sources":["../../../src/utils/timers/timers.ts"],"names":[],"mappings":"AAoJA,qBAAa,OAAO;IAClB,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAO/D,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAO9C,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9D,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAM7C;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAU/G;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAY/G"}
1
+ {"version":3,"file":"timers.d.ts","sourceRoot":"","sources":["../../../src/utils/timers/timers.ts"],"names":[],"mappings":"AA+GA,qBAAa,OAAO;IAClB,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI9D,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIrC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI/D,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;CAGvC"}
@@ -1,164 +1,114 @@
1
- // BgTimer — background-safe timers for the engine.
1
+ // BgTimer: every engine timer (miniapp liveness watchdog, display expiries,
2
+ // boot windows, token refresh) goes through here. Android pauses plain JS
3
+ // timers while the app is backgrounded, so on a device these run on the
4
+ // native react-native-nitro-bg-timer instead. iOS needs that package at
5
+ // >= 0.2.0: earlier versions cleared each timer right after scheduling it
6
+ // (https://github.com/tconns/react-native-nitro-bg-timer/issues/2).
2
7
  //
3
- // Everything timing-critical in the engine runs through this class: the
4
- // miniapp liveness watchdog, display durationMs expiries, boot windows,
5
- // auth-token refresh. On Android, React Native PAUSES plain JS timers while
6
- // the app is backgrounded, so those features only keep working in the
7
- // background when the native implementation (react-native-nitro-bg-timer)
8
- // is active.
8
+ // Dev and release behave the same; there is no env switch. A missing native
9
+ // module falls back to JS timers so the foreground keeps working, and says so
10
+ // once, loudly: a quiet fallback already cost a day of phantom "zombie
11
+ // miniapp" bugs (OS-1790). Never downgrade that report to a warning.
9
12
  //
10
- // Who actually gets native timers:
11
- // - Android, dev AND release: always attempted — dev must match production
12
- // background behavior. There is no opt-in/opt-out env var. If the native
13
- // module is unavailable (a dev client whose binary predates it, or a
14
- // broken release binary), the failure is LOUD: a console.error with the
15
- // remediation, plus a blocking dev alert. The JS-timer fallback still
16
- // engages so foreground behavior keeps working, but backgrounded
17
- // behavior is broken until the native rebuild — the error says exactly
18
- // that. (A silent dev fallback previously cost a full debugging day of
19
- // phantom "zombie miniapp" bugs; see OS-1790.)
20
- // - iOS: never, dev or prod — the package is disabled pending
21
- // https://github.com/tconns/react-native-nitro-bg-timer/issues/2. iOS
22
- // suspends the whole process in background anyway, so background timing
23
- // there is handled by native per-device queues, not JS timers.
24
- //
25
- // react-native is loaded lazily, not imported. Every engine service runs its
26
- // timers through this module, and the engine's bun test suites load those
27
- // services in a plain JS runtime that cannot parse react-native's Flow
28
- // source. A static import would force every such suite to mock this module;
29
- // with the lazy load, a runtime without react-native simply gets the JS
30
- // timers, which is the correct answer there anyway.
13
+ // react-native and the nitro packages are require()d lazily. The engine's bun
14
+ // suites run services in a plain JS runtime that cannot parse react-native;
15
+ // there the native lookup finds no platform and JS timers are the right answer.
16
+ const TIMER_METHODS = ["setTimeout", "clearTimeout", "setInterval", "clearInterval"];
17
+ const jsTimers = {
18
+ setTimeout: (callback, delay) => setTimeout(callback, delay),
19
+ clearTimeout: (id) => clearTimeout(id),
20
+ setInterval: (callback, delay) => setInterval(callback, delay),
21
+ clearInterval: (id) => clearInterval(id),
22
+ };
31
23
  let reactNative;
32
- function getReactNative() {
33
- if (reactNative !== undefined) {
34
- return reactNative;
35
- }
36
- try {
37
- reactNative = require("react-native");
38
- }
39
- catch {
40
- reactNative = null;
24
+ // undefined = not looked up yet, null = unavailable (JS timers from here on).
25
+ let nativeTimers;
26
+ let reported = false;
27
+ function loadReactNative() {
28
+ if (reactNative === undefined) {
29
+ try {
30
+ reactNative = require("react-native");
31
+ }
32
+ catch {
33
+ reactNative = null;
34
+ }
41
35
  }
42
36
  return reactNative;
43
37
  }
44
- function isDev() {
45
- return typeof __DEV__ !== "undefined" && __DEV__;
46
- }
47
- let nitroTimer;
48
- let nitroDisabled = false;
49
- let failedLoud = false;
50
- /**
51
- * The native background timer is unavailable — say so ONCE, loudly, with the
52
- * remediation. The JS-timer fallback keeps foreground behavior working, but
53
- * everything timing-driven freezes while the app is backgrounded, which
54
- * presents as phantom miniapp bugs (frozen captions, missed wake words,
55
- * watchdog kills on resume). A quiet warning here has already cost a full
56
- * debugging day; never downgrade this to console.warn.
57
- */
58
- function failUnavailable(reason) {
59
- if (failedLoud) {
38
+ function reportUnavailable(reason) {
39
+ if (reported)
60
40
  return;
61
- }
62
- failedLoud = true;
41
+ reported = true;
42
+ const rn = loadReactNative();
43
+ const platform = rn?.Platform.OS === "ios" ? "ios" : "android";
63
44
  const message = `BgTimer: native background timer unavailable (${reason}). ` +
64
- "Backgrounded behavior IS BROKEN until you rebuild the Android app: run `bun android`. " +
45
+ `Backgrounded behavior IS BROKEN until you rebuild the app: run \`bun ${platform}\`. ` +
65
46
  "Engine timers and local miniapps (captions, wake words) freeze whenever the app is not foregrounded.";
66
47
  console.error(message);
67
- if (isDev()) {
68
- // A stale dev client may ALSO show the library's own require-time red box
69
- // (bridgeless LogBox surfaces it even though we catch below) — this alert
70
- // is the actionable one: it names the fix.
48
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
49
+ // A stale dev client may also red-box inside the library itself; this
50
+ // alert is the one that names the fix.
71
51
  try {
72
- getReactNative()?.Alert?.alert("Background timers unavailable", message);
52
+ rn?.Alert?.alert("Background timers unavailable", message);
73
53
  }
74
54
  catch {
75
- /* Alert not available (tests / headless) — the console.error stands. */
55
+ // Headless runtime: the console.error stands.
76
56
  }
77
57
  }
78
58
  }
79
- function getNitroTimer() {
80
- if (nitroDisabled || getReactNative()?.Platform.OS !== "android") {
59
+ function loadNativeTimers() {
60
+ if (nativeTimers !== undefined)
61
+ return nativeTimers;
62
+ const platform = loadReactNative()?.Platform.OS;
63
+ if (platform !== "android" && platform !== "ios") {
64
+ nativeTimers = null;
81
65
  return null;
82
66
  }
83
- if (nitroTimer !== undefined) {
84
- return nitroTimer;
85
- }
86
67
  try {
87
68
  const { isRuntimeAlive } = require("react-native-nitro-modules");
88
- if (typeof isRuntimeAlive === "function" && !isRuntimeAlive()) {
89
- nitroTimer = null;
90
- failUnavailable("nitro runtime is not alive");
91
- return nitroTimer;
92
- }
69
+ if (typeof isRuntimeAlive === "function" && !isRuntimeAlive())
70
+ throw new Error("nitro runtime is not alive");
93
71
  const { BackgroundTimer } = require("react-native-nitro-bg-timer");
94
- nitroTimer =
95
- BackgroundTimer &&
96
- typeof BackgroundTimer.setTimeout === "function" &&
97
- typeof BackgroundTimer.setInterval === "function" &&
98
- typeof BackgroundTimer.clearTimeout === "function" &&
99
- typeof BackgroundTimer.clearInterval === "function"
100
- ? BackgroundTimer
101
- : null;
102
- }
103
- catch {
104
- nitroTimer = null;
105
- nitroDisabled = true;
72
+ for (const method of TIMER_METHODS) {
73
+ if (typeof BackgroundTimer?.[method] !== "function")
74
+ throw new Error(`BackgroundTimer.${method} missing`);
75
+ }
76
+ nativeTimers = BackgroundTimer;
106
77
  }
107
- if (!nitroTimer) {
108
- failUnavailable("react-native-nitro-bg-timer failed to load");
78
+ catch (error) {
79
+ nativeTimers = null;
80
+ reportUnavailable(error instanceof Error ? error.message : String(error));
109
81
  }
110
- return nitroTimer;
82
+ return nativeTimers;
111
83
  }
112
- function withNitro(run, fallback) {
113
- const api = getNitroTimer();
114
- if (!api) {
115
- return fallback();
116
- }
84
+ // A native call that throws mid-session is new information: drop to JS timers
85
+ // and announce again.
86
+ function call(run) {
87
+ const native = loadNativeTimers();
88
+ if (!native)
89
+ return run(jsTimers);
117
90
  try {
118
- return run(api);
91
+ return run(native);
119
92
  }
120
93
  catch (error) {
121
- nitroDisabled = true;
122
- nitroTimer = null;
123
- failedLoud = false; // a mid-session failure is new information — re-announce
124
- failUnavailable(`nitro timer call threw: ${String(error)}`);
125
- return fallback();
94
+ nativeTimers = null;
95
+ reported = false;
96
+ reportUnavailable(`native timer call threw: ${String(error)}`);
97
+ return run(jsTimers);
126
98
  }
127
99
  }
128
100
  export class BgTimer {
129
- static setInterval(callback, delay) {
130
- return withNitro((api) => api.setInterval(callback, delay), () => setInterval(callback, delay));
101
+ static setTimeout(callback, delay) {
102
+ return call((timers) => timers.setTimeout(callback, delay));
131
103
  }
132
- static clearInterval(intervalId) {
133
- withNitro((api) => api.clearInterval(intervalId), () => clearInterval(intervalId));
104
+ static clearTimeout(id) {
105
+ call((timers) => timers.clearTimeout(id));
134
106
  }
135
- static setTimeout(callback, delay) {
136
- return withNitro((api) => api.setTimeout(callback, delay), () => setTimeout(callback, delay));
107
+ static setInterval(callback, delay) {
108
+ return call((timers) => timers.setInterval(callback, delay));
137
109
  }
138
- static clearTimeout(timeoutId) {
139
- withNitro((api) => api.clearTimeout(timeoutId), () => clearTimeout(timeoutId));
110
+ static clearInterval(id) {
111
+ call((timers) => timers.clearInterval(id));
140
112
  }
141
113
  }
142
- export function throttle(fn, ms) {
143
- let lastCalled = 0;
144
- return (...args) => {
145
- const now = Date.now();
146
- if (now - lastCalled >= ms) {
147
- lastCalled = now;
148
- fn(...args);
149
- }
150
- };
151
- }
152
- export function debounce(fn, ms) {
153
- let timeoutId = null;
154
- return (...args) => {
155
- if (timeoutId) {
156
- BgTimer.clearTimeout(timeoutId);
157
- }
158
- timeoutId = BgTimer.setTimeout(() => {
159
- fn(...args);
160
- timeoutId = null;
161
- }, ms);
162
- };
163
- }
164
114
  //# sourceMappingURL=timers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"timers.js","sourceRoot":"","sources":["../../../src/utils/timers/timers.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,4EAA4E;AAC5E,sEAAsE;AACtE,0EAA0E;AAC1E,aAAa;AACb,EAAE;AACF,mCAAmC;AACnC,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,qEAAqE;AACrE,2EAA2E;AAC3E,2EAA2E;AAC3E,mDAAmD;AACnD,gEAAgE;AAChE,0EAA0E;AAC1E,4EAA4E;AAC5E,mEAAmE;AACnE,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,uEAAuE;AACvE,4EAA4E;AAC5E,wEAAwE;AACxE,oDAAoD;AAOpD,IAAI,WAAiD,CAAA;AAErD,SAAS,cAAc;IACrB,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAA;IACpB,CAAC;IACD,IAAI,CAAC;QACH,WAAW,GAAG,OAAO,CAAC,cAAc,CAAsB,CAAA;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,WAAW,GAAG,IAAI,CAAA;IACpB,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,SAAS,KAAK;IACZ,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAA;AAClD,CAAC;AASD,IAAI,UAA4C,CAAA;AAChD,IAAI,aAAa,GAAG,KAAK,CAAA;AACzB,IAAI,UAAU,GAAG,KAAK,CAAA;AAEtB;;;;;;;GAOG;AACH,S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in the engine runs through this class: the\n// miniapp liveness watchdog, display durationMs expiries, boot windows,\n// auth-token refresh. On Android, React Native PAUSES plain JS timers while\n// the app is backgrounded, so those features only keep working in the\n// background when the native implementation (react-native-nitro-bg-timer)\n// is active.\n//\n// Who actually gets native timers:\n// - Android, dev AND release: always attempted — dev must match production\n// background behavior. There is no opt-in/opt-out env var. If the native\n// module is unavailable (a dev client whose binary predates it, or a\n// broken release binary), the failure is LOUD: a console.error with the\n// remediation, plus a blocking dev alert. The JS-timer fallback still\n// engages so foreground behavior keeps working, but backgrounded\n// behavior is broken until the native rebuild — the error says exactly\n// that. (A silent dev fallback previously cost a full debugging day of\n// phantom \"zombie miniapp\" bugs; see OS-1790.)\n// - iOS: never, dev or prod — the package is disabled pending\n// https://github.com/tconns/react-native-nitro-bg-timer/issues/2. iOS\n// suspends the whole process in background anyway, so background timing\n// there is handled by native per-device queues, not JS timers.\n//\n// react-native is loaded lazily, not imported. Every engine service runs its\n// timers through this module, and the engine's bun test suites load those\n// services in a plain JS runtime that cannot parse react-native's Flow\n// source. A static import would force every such suite to mock this module;\n// with the lazy load, a runtime without react-native simply gets the JS\n// timers, which is the correct answer there anyway.\n\ntype ReactNativeSubset = {\n Platform: {OS: string}\n Alert?: {alert: (title: string, message?: string) => void}\n}\n\nlet reactNative: ReactNativeSubset | null | undefined\n\nfunction getReactNative(): ReactNativeSubset | null {\n if (reactNative !== undefined) {\n return reactNative\n }\n try {\n reactNative = require(\"react-native\") as ReactNativeSubset\n } catch {\n reactNative = null\n }\n return reactNative\n}\n\nfunction isDev(): boolean {\n return typeof __DEV__ !== \"undefined\" && __DEV__\n}\n\ntype NitroTimerApi = {\n setInterval: (callback: () => void, delay: number) => number\n clearInterval: (intervalId: number) => void\n setTimeout: (callback: () => void, delay: number) => number\n clearTimeout: (timeoutId: number) => void\n}\n\nlet nitroTimer: NitroTimerApi | null | undefined\nlet nitroDisabled = false\nlet failedLoud = false\n\n/**\n * The native background timer is unavailable — say so ONCE, loudly, with the\n * remediation. The JS-timer fallback keeps foreground behavior working, but\n * everything timing-driven freezes while the app is backgrounded, which\n * presents as phantom miniapp bugs (frozen captions, missed wake words,\n * watchdog kills on resume). A quiet warning here has already cost a full\n * debugging day; never downgrade this to console.warn.\n */\nfunction failUnavailable(reason: string) {\n if (failedLoud) {\n return\n }\n failedLoud = true\n const message =\n `BgTimer: native background timer unavailable (${reason}). ` +\n \"Backgrounded behavior IS BROKEN until you rebuild the Android app: run `bun android`. \" +\n \"Engine timers and local miniapps (captions, wake words) freeze whenever the app is not foregrounded.\"\n console.error(message)\n if (isDev()) {\n // A stale dev client may ALSO show the library's own require-time red box\n // (bridgeless LogBox surfaces it even though we catch below) — this alert\n // is the actionable one: it names the fix.\n try {\n getReactNative()?.Alert?.alert(\"Background timers unavailable\", message)\n } catch {\n /* Alert not available (tests / headless) — the console.error stands. */\n }\n }\n}\n\nfunction getNitroTimer(): NitroTimerApi | null {\n if (nitroDisabled || getReactNative()?.Platform.OS !== \"android\") {\n return null\n }\n\n if (nitroTimer !== undefined) {\n return nitroTimer\n }\n\n try {\n const {isRuntimeAlive} = require(\"react-native-nitro-modules\") as {isRuntimeAlive?: () => boolean}\n if (typeof isRuntimeAlive === \"function\" && !isRuntimeAlive()) {\n nitroTimer = null\n failUnavailable(\"nitro runtime is not alive\")\n return nitroTimer\n }\n\n const {BackgroundTimer} = require(\"react-native-nitro-bg-timer\") as {BackgroundTimer?: NitroTimerApi}\n nitroTimer =\n BackgroundTimer &&\n typeof BackgroundTimer.setTimeout === \"function\" &&\n typeof BackgroundTimer.setInterval === \"function\" &&\n typeof BackgroundTimer.clearTimeout === \"function\" &&\n typeof BackgroundTimer.clearInterval === \"function\"\n ? BackgroundTimer\n : null\n } catch {\n nitroTimer = null\n nitroDisabled = true\n }\n\n if (!nitroTimer) {\n failUnavailable(\"react-native-nitro-bg-timer failed to load\")\n }\n return nitroTimer\n}\n\nfunction withNitro<T>(run: (api: NitroTimerApi) => T, fallback: () => T): T {\n const api = getNitroTimer()\n if (!api) {\n return fallback()\n }\n try {\n return run(api)\n } catch (error) {\n nitroDisabled = true\n nitroTimer = null\n failedLoud = false // a mid-session failure is new information — re-announce\n failUnavailable(`nitro timer call threw: ${String(error)}`)\n return fallback()\n }\n}\n\nexport class BgTimer {\n static setInterval(callback: () => void, delay: number): number {\n return withNitro(\n (api) => api.setInterval(callback, delay),\n () => setInterval(callback, delay) as unknown as number,\n )\n }\n\n static clearInterval(intervalId: number): void {\n withNitro(\n (api) => api.clearInterval(intervalId),\n () => clearInterval(intervalId),\n )\n }\n\n static setTimeout(callback: () => void, delay: number): number {\n return withNitro(\n (api) => api.setTimeout(callback, delay),\n () => setTimeout(callback, delay) as unknown as number,\n )\n }\n\n static clearTimeout(timeoutId: number): void {\n withNitro(\n (api) => api.clearTimeout(timeoutId),\n () => clearTimeout(timeoutId),\n )\n }\n}\n\nexport function throttle<T extends (...args: any[]) => any>(fn: T, ms: number): (...args: Parameters<T>) => void {\n let lastCalled = 0\n\n return (...args: Parameters<T>) => {\n const now = Date.now()\n if (now - lastCalled >= ms) {\n lastCalled = now\n fn(...args)\n }\n }\n}\n\nexport function debounce<T extends (...args: any[]) => any>(fn: T, ms: number): (...args: Parameters<T>) => void {\n let timeoutId: number | null = null\n\n return (...args: Parameters<T>) => {\n if (timeoutId) {\n BgTimer.clearTimeout(timeoutId)\n }\n timeoutId = BgTimer.setTimeout(() => {\n fn(...args)\n timeoutId = null\n }, ms)\n }\n}\n"]}
1
+ {"version":3,"file":"timers.js","sourceRoot":"","sources":["../../../src/utils/timers/timers.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0EAA0E;AAC1E,wEAAwE;AACxE,wEAAwE;AACxE,0EAA0E;AAC1E,oEAAoE;AACpE,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,uEAAuE;AACvE,qEAAqE;AACrE,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,gFAAgF;AAchF,MAAM,aAAa,GAAG,CAAC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AA8E;AAC9E,sBAAsB;AACtB,SAAS,IAAI,CAAI,GAA4B;IAC3C,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAA;IACjC,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAA;IACjC,IAAI,CAAC;QACH,OAAO,GAAG,CAAC,MAAM,CAAC,CAAA;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAY,GAAG,IAAI,CAAA;QACnB,QAAQ,GAAG,KAAK,CAAA;QAChB,iBAAiB,CAAC,4BAA4B,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC9D,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAA;IACtB,CAAC;AACH,CAAC;AAED,MAAM,OAAO,OAAO;IAClB,MAAM,CAAC,UAAU,CAAC,QAAoB,EAAE,KAAa;QACnD,OAAO,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,EAAU;QAC5B,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,QAAoB,EAAE,KAAa;QACpD,OAAO,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,EAAU;QAC7B,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5C,CAAC;CACF","sourcesContent":["// BgTimer: every engine timer (miniapp liveness watchdog, display expiries,\n// boot windows, token refresh) goes through here. Android pauses plain JS\n// timers while the app is backgrounded, so on a device these run on the\n// native react-native-nitro-bg-timer instead. iOS needs that package at\n// >= 0.2.0: earlier versions cleared each timer right after scheduling it\n// (https://github.com/tconns/react-native-nitro-bg-timer/issues/2).\n//\n// Dev and release behave the same; there is no env switch. A missing native\n// module falls back to JS timers so the foreground keeps working, and says so\n// once, loudly: a quiet fallback already cost a day of phantom \"zombie\n// miniapp\" bugs (OS-1790). Never downgrade that report to a warning.\n//\n// react-native and the nitro packages are require()d lazily. The engine's bun\n// suites run services in a plain JS runtime that cannot parse react-native;\n// there the native lookup finds no platform and JS timers are the right answer.\n\ntype TimerApi = {\n setTimeout(callback: () => void, delay: number): number\n clearTimeout(id: number): void\n setInterval(callback: () => void, delay: number): number\n clearInterval(id: number): void\n}\n\ntype ReactNativeSubset = {\n Platform: {OS: string}\n Alert?: {alert(title: string, message?: string): void}\n}\n\nconst TIMER_METHODS = [\"setTimeout\", \"clearTimeout\", \"setInterval\", \"clearInterval\"] as const\n\nconst jsTimers: TimerApi = {\n setTimeout: (callback, delay) => setTimeout(callback, delay) as unknown as number,\n clearTimeout: (id) => clearTimeout(id),\n setInterval: (callback, delay) => setInterval(callback, delay) as unknown as number,\n clearInterval: (id) => clearInterval(id),\n}\n\nlet reactNative: ReactNativeSubset | null | undefined\n// undefined = not looked up yet, null = unavailable (JS timers from here on).\nlet nativeTimers: TimerApi | null | undefined\nlet reported = false\n\nfunction loadReactNative(): ReactNativeSubset | null {\n if (reactNative === undefined) {\n try {\n reactNative = require(\"react-native\") as ReactNativeSubset\n } catch {\n reactNative = null\n }\n }\n return reactNative\n}\n\nfunction reportUnavailable(reason: string): void {\n if (reported) return\n reported = true\n const rn = loadReactNative()\n const platform = rn?.Platform.OS === \"ios\" ? \"ios\" : \"android\"\n const message =\n `BgTimer: native background timer unavailable (${reason}). ` +\n `Backgrounded behavior IS BROKEN until you rebuild the app: run \\`bun ${platform}\\`. ` +\n \"Engine timers and local miniapps (captions, wake words) freeze whenever the app is not foregrounded.\"\n console.error(message)\n if (typeof __DEV__ !== \"undefined\" && __DEV__) {\n // A stale dev client may also red-box inside the library itself; this\n // alert is the one that names the fix.\n try {\n rn?.Alert?.alert(\"Background timers unavailable\", message)\n } catch {\n // Headless runtime: the console.error stands.\n }\n }\n}\n\nfunction loadNativeTimers(): TimerApi | null {\n if (nativeTimers !== undefined) return nativeTimers\n const platform = loadReactNative()?.Platform.OS\n if (platform !== \"android\" && platform !== \"ios\") {\n nativeTimers = null\n return null\n }\n try {\n const {isRuntimeAlive} = require(\"react-native-nitro-modules\") as {isRuntimeAlive?: () => boolean}\n if (typeof isRuntimeAlive === \"function\" && !isRuntimeAlive()) throw new Error(\"nitro runtime is not alive\")\n const {BackgroundTimer} = require(\"react-native-nitro-bg-timer\") as {BackgroundTimer?: Partial<TimerApi>}\n for (const method of TIMER_METHODS) {\n if (typeof BackgroundTimer?.[method] !== \"function\") throw new Error(`BackgroundTimer.${method} missing`)\n }\n nativeTimers = BackgroundTimer as TimerApi\n } catch (error) {\n nativeTimers = null\n reportUnavailable(error instanceof Error ? error.message : String(error))\n }\n return nativeTimers\n}\n\n// A native call that throws mid-session is new information: drop to JS timers\n// and announce again.\nfunction call<T>(run: (timers: TimerApi) => T): T {\n const native = loadNativeTimers()\n if (!native) return run(jsTimers)\n try {\n return run(native)\n } catch (error) {\n nativeTimers = null\n reported = false\n reportUnavailable(`native timer call threw: ${String(error)}`)\n return run(jsTimers)\n }\n}\n\nexport class BgTimer {\n static setTimeout(callback: () => void, delay: number): number {\n return call((timers) => timers.setTimeout(callback, delay))\n }\n\n static clearTimeout(id: number): void {\n call((timers) => timers.clearTimeout(id))\n }\n\n static setInterval(callback: () => void, delay: number): number {\n return call((timers) => timers.setInterval(callback, delay))\n }\n\n static clearInterval(id: number): void {\n call((timers) => timers.clearInterval(id))\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/engine",
3
- "version": "0.3.3-beta.639",
3
+ "version": "0.3.3-beta.654",
4
4
  "description": "Glassly Engine — miniapp registry, WebView bridge, and miniapp store",
5
5
  "main": "build/index.js",
6
6
  "react-native": "src/index.ts",
@@ -97,24 +97,24 @@
97
97
  "registry": "https://registry.npmjs.org/"
98
98
  },
99
99
  "dependencies": {
100
- "@glassly/bluetooth-sdk": "0.3.3-beta.639",
101
- "@glassly/cloud-client": "0.3.3-beta.639",
102
- "@glassly/cloud-protocol": "0.3.3-beta.639",
103
- "@glassly/crust": "0.3.3-beta.639",
104
- "@glassly/miniapp": "0.3.3-beta.639",
100
+ "@glassly/bluetooth-sdk": "0.3.3-beta.654",
101
+ "@glassly/cloud-client": "0.3.3-beta.654",
102
+ "@glassly/cloud-protocol": "0.3.3-beta.654",
103
+ "@glassly/crust": "0.3.3-beta.654",
104
+ "@glassly/miniapp": "0.3.3-beta.654",
105
105
  "buffer": "^6.0.3",
106
106
  "events": "^3.3.0",
107
107
  "react-native-marked": "8.1.1",
108
108
  "semver": "^7.7.4",
109
109
  "typesafe-ts": "^1.7.1",
110
- "@glassly/llm-providers": "0.3.3-beta.639"
110
+ "@glassly/llm-providers": "0.3.3-beta.654"
111
111
  },
112
112
  "devDependencies": {
113
113
  "@glassly/llm-providers": "workspace:*",
114
114
  "@types/semver": "^7.7.1",
115
115
  "expo-module-scripts": "^56.0.3",
116
116
  "expo-modules-core": "^57.0.7",
117
- "react-native-nitro-modules": "^0.31.10",
117
+ "react-native-nitro-modules": "^0.35.10",
118
118
  "typescript": "~5.9.2"
119
119
  },
120
120
  "peerDependencies": {
@@ -112,6 +112,7 @@ function projectInfo() {
112
112
  sceneCanvasWidth: s.sceneCanvasWidth,
113
113
  sceneCanvasHeight: s.sceneCanvasHeight,
114
114
  volumeGate: s.volumeGate === true,
115
+ firmwareUpdateAvailable: s.firmwareUpdateAvailable === true,
115
116
  // Copy: the snapshot must not hand callers a mutable reference into the store.
116
117
  wifi: {...s.wifi},
117
118
  }
@@ -12,9 +12,9 @@ export interface EngineReleaseMetadata {
12
12
  export const ENGINE_RELEASE_METADATA: Readonly<EngineReleaseMetadata> = Object.freeze({
13
13
  "schemaVersion": 1,
14
14
  "familyBaseVersion": "0.3.3",
15
- "releaseIdentity": "0.3.3-beta.639",
16
- "releaseSetId": "glassly-0.3.3-beta.639",
17
- "sourceCommit": "2f573069edc77578d99369a6893567135b6e4673",
15
+ "releaseIdentity": "0.3.3-beta.654",
16
+ "releaseSetId": "glassly-0.3.3-beta.654",
17
+ "sourceCommit": "9c554ec6e0d33cd235914ccee98e7d39e4fa29e2",
18
18
  "otaManifestUrl": null,
19
19
  "otaManifestSha256": null
20
20
  })