@glassly/engine 0.4.0 → 0.4.1-beta.1138
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/build/engine.d.ts +3 -1
- package/build/engine.d.ts.map +1 -1
- package/build/engine.js +6 -4
- package/build/engine.js.map +1 -1
- package/build/facades/display.d.ts +1 -1
- package/build/facades/display.d.ts.map +1 -1
- package/build/facades/display.js +1 -1
- package/build/facades/display.js.map +1 -1
- package/build/facades/glasses.js +1 -1
- package/build/facades/glasses.js.map +1 -1
- package/build/facades/permissions.d.ts.map +1 -1
- package/build/facades/permissions.js +0 -2
- package/build/facades/permissions.js.map +1 -1
- package/build/facades/phoneNotifications.d.ts +7 -0
- package/build/facades/phoneNotifications.d.ts.map +1 -1
- package/build/facades/phoneNotifications.js +6 -0
- package/build/facades/phoneNotifications.js.map +1 -1
- package/build/facades/providerKeys.d.ts +1 -1
- package/build/facades/providerKeys.js +1 -1
- package/build/facades/providerKeys.js.map +1 -1
- package/build/facades/reports.d.ts +15 -0
- package/build/facades/reports.d.ts.map +1 -1
- package/build/facades/reports.js +37 -0
- package/build/facades/reports.js.map +1 -1
- package/build/facades/settings.js +1 -1
- package/build/facades/settings.js.map +1 -1
- package/build/generated/releaseMetadata.js +4 -4
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/index.d.ts +2 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/react/useMentraLiveOta.d.ts.map +1 -1
- package/build/react/useMentraLiveOta.js.map +1 -1
- package/build/runtime/config.d.ts.map +1 -1
- package/build/runtime/config.js.map +1 -1
- package/build/services/AiTierResolution.d.ts +1 -1
- package/build/services/AiTierResolution.d.ts.map +1 -1
- package/build/services/AiTierResolution.js.map +1 -1
- package/build/services/AppRegistry.d.ts +12 -1
- package/build/services/AppRegistry.d.ts.map +1 -1
- package/build/services/AppRegistry.js +33 -0
- package/build/services/AppRegistry.js.map +1 -1
- package/build/services/AutomaticReportResult.d.ts.map +1 -1
- package/build/services/AutomaticReportResult.js.map +1 -1
- package/build/services/CloudClientService.d.ts +7 -5
- package/build/services/CloudClientService.d.ts.map +1 -1
- package/build/services/CloudClientService.js +17 -14
- package/build/services/CloudClientService.js.map +1 -1
- package/build/services/DisplayProcessor.d.ts.map +1 -1
- package/build/services/DisplayProcessor.js +2 -1
- package/build/services/DisplayProcessor.js.map +1 -1
- package/build/services/GestureDotsService.js +1 -1
- package/build/services/GestureDotsService.js.map +1 -1
- package/build/services/HotspotOtaTransport.d.ts.map +1 -1
- package/build/services/HotspotOtaTransport.js +0 -1
- package/build/services/HotspotOtaTransport.js.map +1 -1
- package/build/services/JSRouter.js +2 -2
- package/build/services/JSRouter.js.map +1 -1
- package/build/services/LocalLlmModelManager.d.ts.map +1 -1
- package/build/services/LocalLlmModelManager.js +4 -3
- package/build/services/LocalLlmModelManager.js.map +1 -1
- package/build/services/LocalLlmProvider.d.ts.map +1 -1
- package/build/services/LocalLlmProvider.js +5 -6
- package/build/services/LocalLlmProvider.js.map +1 -1
- package/build/services/LocalMiniappRuntime.d.ts +10 -3
- package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
- package/build/services/LocalMiniappRuntime.js +142 -30
- package/build/services/LocalMiniappRuntime.js.map +1 -1
- package/build/services/LocalSttFallbackCoordinator.d.ts.map +1 -1
- package/build/services/LocalSttFallbackCoordinator.js.map +1 -1
- package/build/services/NativeNavigationService.d.ts.map +1 -1
- package/build/services/NativeNavigationService.js.map +1 -1
- package/build/services/NavigationHandlers.d.ts +1 -1
- package/build/services/NavigationHandlers.js +2 -2
- package/build/services/NavigationHandlers.js.map +1 -1
- package/build/services/NavigationService.d.ts +2 -2
- package/build/services/NavigationService.d.ts.map +1 -1
- package/build/services/NavigationService.js +11 -11
- package/build/services/NavigationService.js.map +1 -1
- package/build/services/PairingIdentity.d.ts.map +1 -1
- package/build/services/PairingIdentity.js.map +1 -1
- package/build/services/PhoneCalendarService.d.ts.map +1 -1
- package/build/services/PhoneCalendarService.js.map +1 -1
- package/build/services/PhoneNotificationsSync.d.ts.map +1 -1
- package/build/services/PhoneNotificationsSync.js +2 -1
- package/build/services/PhoneNotificationsSync.js.map +1 -1
- package/build/services/PhoneStreamCoordinator.d.ts.map +1 -1
- package/build/services/PhoneStreamCoordinator.js.map +1 -1
- package/build/services/ProviderKeyValidation.d.ts +1 -1
- package/build/services/ProviderKeyValidation.js +1 -1
- package/build/services/ProviderKeyValidation.js.map +1 -1
- package/build/services/STTModelManager.d.ts.map +1 -1
- package/build/services/STTModelManager.js +1 -6
- package/build/services/STTModelManager.js.map +1 -1
- package/build/services/SupportProfileSync.d.ts.map +1 -1
- package/build/services/SupportProfileSync.js +3 -0
- package/build/services/SupportProfileSync.js.map +1 -1
- package/build/services/TranscriptionRouting.d.ts +3 -0
- package/build/services/TranscriptionRouting.d.ts.map +1 -1
- package/build/services/TranscriptionRouting.js +14 -0
- package/build/services/TranscriptionRouting.js.map +1 -1
- package/build/services/UIRouter.d.ts.map +1 -1
- package/build/services/UIRouter.js.map +1 -1
- package/build/services/controllers.d.ts.map +1 -1
- package/build/services/controllers.js +1 -0
- package/build/services/controllers.js.map +1 -1
- package/build/services/effectiveCapabilities.js +3 -2
- package/build/services/effectiveCapabilities.js.map +1 -1
- package/build/services/gestureDotGlyphs.d.ts.map +1 -1
- package/build/services/gestureDotGlyphs.js.map +1 -1
- package/build/services/manifestActions.d.ts.map +1 -1
- package/build/services/manifestActions.js.map +1 -1
- package/build/services/neuralBand/MetaAuth.d.ts +1 -0
- package/build/services/neuralBand/MetaAuth.d.ts.map +1 -1
- package/build/services/neuralBand/MetaAuth.js +36 -8
- package/build/services/neuralBand/MetaAuth.js.map +1 -1
- package/build/services/notificationAppPayload.d.ts +14 -0
- package/build/services/notificationAppPayload.d.ts.map +1 -0
- package/build/services/notificationAppPayload.js +15 -0
- package/build/services/notificationAppPayload.js.map +1 -0
- package/build/services/notifications/miniappNotifications.d.ts +31 -0
- package/build/services/notifications/miniappNotifications.d.ts.map +1 -0
- package/build/services/notifications/miniappNotifications.js +24 -0
- package/build/services/notifications/miniappNotifications.js.map +1 -0
- package/build/services/pages/pageEligibility.d.ts +1 -2
- package/build/services/pages/pageEligibility.d.ts.map +1 -1
- package/build/services/pages/pageEligibility.js +4 -2
- package/build/services/pages/pageEligibility.js.map +1 -1
- package/build/services/settingsBridge.d.ts.map +1 -1
- package/build/services/settingsBridge.js +0 -2
- package/build/services/settingsBridge.js.map +1 -1
- package/build/services/uiShim.d.ts.map +1 -1
- package/build/services/uiShim.js +14 -0
- package/build/services/uiShim.js.map +1 -1
- package/build/stores/appVisibility.d.ts.map +1 -1
- package/build/stores/appVisibility.js.map +1 -1
- package/build/stores/gallerySync.d.ts.map +1 -1
- package/build/stores/gallerySync.js.map +1 -1
- package/build/stores/glasses.d.ts.map +1 -1
- package/build/stores/glasses.js +1 -0
- package/build/stores/glasses.js.map +1 -1
- package/build/stores/settings.d.ts.map +1 -1
- package/build/stores/settings.js +27 -28
- package/build/stores/settings.js.map +1 -1
- package/build/types/capabilities/even-realities-g1.d.ts.map +1 -1
- package/build/types/capabilities/even-realities-g1.js +4 -0
- package/build/types/capabilities/even-realities-g1.js.map +1 -1
- package/build/types/capabilities/nimo.d.ts.map +1 -1
- package/build/types/capabilities/nimo.js +21 -7
- package/build/types/capabilities/nimo.js.map +1 -1
- package/build/types/enums.d.ts +2 -1
- package/build/types/enums.d.ts.map +1 -1
- package/build/types/enums.js +1 -0
- package/build/types/enums.js.map +1 -1
- package/build/utils/display/index.d.ts +1 -0
- package/build/utils/display/index.d.ts.map +1 -1
- package/build/utils/display/index.js +2 -2
- package/build/utils/display/index.js.map +1 -1
- package/build/utils/display/profiles/index.d.ts +1 -0
- package/build/utils/display/profiles/index.d.ts.map +1 -1
- package/build/utils/display/profiles/index.js +1 -0
- package/build/utils/display/profiles/index.js.map +1 -1
- package/build/utils/display/profiles/nimo.d.ts +2 -0
- package/build/utils/display/profiles/nimo.d.ts.map +1 -0
- package/build/utils/display/profiles/nimo.js +3 -0
- package/build/utils/display/profiles/nimo.js.map +1 -0
- package/build/utils/display/scene/svgPath.js.map +1 -1
- package/build/utils/memory/search.d.ts.map +1 -1
- package/build/utils/memory/search.js +17 -7
- package/build/utils/memory/search.js.map +1 -1
- package/package.json +15 -15
- package/src/engine.ts +9 -7
- package/src/facades/display.ts +1 -1
- package/src/facades/glasses.ts +1 -1
- package/src/facades/permissions.ts +0 -2
- package/src/facades/phoneNotifications.ts +10 -0
- package/src/facades/providerKeys.ts +1 -1
- package/src/facades/reports.ts +41 -0
- package/src/facades/settings.ts +1 -1
- package/src/generated/releaseMetadata.ts +4 -4
- package/src/index.ts +2 -0
- package/src/react/useMentraLiveOta.ts +1 -4
- package/src/runtime/config.ts +1 -6
- package/src/services/AiTierResolution.ts +1 -1
- package/src/services/AppRegistry.ts +38 -1
- package/src/services/AutomaticReportResult.ts +1 -3
- package/src/services/CloudClientService.ts +17 -11
- package/src/services/DisplayProcessor.ts +2 -0
- package/src/services/GestureDotsService.ts +1 -1
- package/src/services/HotspotOtaTransport.ts +1 -5
- package/src/services/JSRouter.ts +2 -2
- package/src/services/LocalLlmModelManager.ts +4 -3
- package/src/services/LocalLlmProvider.ts +6 -7
- package/src/services/LocalMiniappRuntime.ts +170 -40
- package/src/services/LocalSttFallbackCoordinator.ts +1 -5
- package/src/services/NativeNavigationService.ts +1 -2
- package/src/services/NavigationHandlers.ts +2 -2
- package/src/services/NavigationService.ts +12 -11
- package/src/services/PairingIdentity.ts +1 -3
- package/src/services/PhoneCalendarService.ts +1 -3
- package/src/services/PhoneNotificationsSync.ts +2 -1
- package/src/services/PhoneStreamCoordinator.ts +1 -2
- package/src/services/ProviderKeyValidation.ts +1 -1
- package/src/services/STTModelManager.ts +1 -6
- package/src/services/SupportProfileSync.ts +2 -0
- package/src/services/TranscriptionRouting.ts +18 -0
- package/src/services/UIRouter.ts +3 -9
- package/src/services/controllers.ts +1 -0
- package/src/services/effectiveCapabilities.ts +3 -2
- package/src/services/gestureDotGlyphs.ts +10 -5
- package/src/services/manifestActions.ts +2 -1
- package/src/services/neuralBand/MetaAuth.ts +37 -8
- package/src/services/notificationAppPayload.ts +15 -0
- package/src/services/notifications/miniappNotifications.ts +53 -0
- package/src/services/pages/pageEligibility.ts +3 -2
- package/src/services/settingsBridge.ts +1 -4
- package/src/services/uiShim.ts +14 -0
- package/src/stores/appVisibility.ts +2 -5
- package/src/stores/gallerySync.ts +1 -7
- package/src/stores/glasses.ts +1 -0
- package/src/stores/settings.ts +27 -28
- package/src/types/capabilities/even-realities-g1.ts +5 -0
- package/src/types/capabilities/nimo.ts +23 -7
- package/src/types/enums.ts +1 -0
- package/src/utils/display/index.ts +2 -2
- package/src/utils/display/profiles/index.ts +2 -0
- package/src/utils/display/profiles/nimo.ts +2 -0
- package/src/utils/display/scene/svgPath.ts +1 -1
- package/src/utils/memory/search.ts +17 -7
package/build/engine.d.ts
CHANGED
|
@@ -229,6 +229,7 @@ export declare const engine: {
|
|
|
229
229
|
/** Bug-report, automatic runtime report, and feedback submission. */
|
|
230
230
|
reports: {
|
|
231
231
|
submit(input: import(".").EngineSubmitReportInput): Promise<import(".").ReportSubmitResult>;
|
|
232
|
+
uploadLogs: () => Promise<import("./facades/reports").LogUploadResult>;
|
|
232
233
|
};
|
|
233
234
|
/** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */
|
|
234
235
|
ota: {
|
|
@@ -342,6 +343,7 @@ export declare const engine: {
|
|
|
342
343
|
nativeNotifications: typeof import("./services/PhoneNotificationsSync").nativeNotificationsSupported;
|
|
343
344
|
popupSecondsOptions: typeof import("./services/PhoneNotificationsSync").nativeNotificationPopupSeconds;
|
|
344
345
|
presentationOwner: typeof import("./services/PhoneNotificationsSync").currentPresentationOwner;
|
|
346
|
+
onMiniappNotification: (listener: (event: import(".").MiniappNotificationEvent) => void) => (() => void);
|
|
345
347
|
uploadToGlasses: (event: import("@glassly/crust").PhoneNotificationEvent) => Promise<void>;
|
|
346
348
|
glassesStatus: () => Promise<import("@glassly/bluetooth-sdk").GlassesNotificationStatus>;
|
|
347
349
|
onGlassesStatus: (listener: (status: import("@glassly/bluetooth-sdk").GlassesNotificationStatus) => void) => (() => void);
|
|
@@ -411,7 +413,7 @@ export declare const engine: {
|
|
|
411
413
|
cancelDownload: () => Promise<void>;
|
|
412
414
|
};
|
|
413
415
|
};
|
|
414
|
-
/** AI/voice provider key validation — user-supplied keys (Settings > API Keys). */
|
|
416
|
+
/** AI/voice provider key validation — user-supplied keys (Settings > Privacy > API Keys). */
|
|
415
417
|
providerKeys: {
|
|
416
418
|
anthropic: {
|
|
417
419
|
validateKey: (apiKey: string) => Promise<import("./services/ProviderKeyValidation").KeyValidationResult>;
|
package/build/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,EAAkD,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAgD5G,eAAO,MAAM,MAAM;IACjB,2EAA2E;;IAE3E,8EAA8E;;IAE9E;iDAC6C;;
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,EAAkD,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAgD5G,eAAO,MAAM,MAAM;IACjB,2EAA2E;;IAE3E,8EAA8E;;IAE9E;iDAC6C;;IA2G7C;;yCAEqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoCrC,kEAAkE;;;;;;;;;;;;;;;;;;;;;;;IAElE,wEAAwE;;;;;;;;IAExE,sEAAsE;;;;;;;;;;;;IAEtE,qFAAqF;;;;gBA7IpE,CAAC;mBAAiB,CAAC;;;gBAMlC,CAFF;mBAAiB,CAAC;;;;;;;;;;;;;;;;;IA2IlB,qEAAqE;;;;;IAErE,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEtF,6EAA6E;;;;;;;;;;;;IAE7E,iFAAiF;;;;;;;;;;;;;;;;;;;;;;;;IAEjF,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE9C,uDAAuD;;;;;;;;;;;;;;;;;IAEvD,8EAA8E;;;;;;;;IAE9E,qFAAqF;;;;IAErF,4EAA4E;;;;;;;;;;;IAE5E,+EAA+E;;;;;;;;;;;;;;;IAE/E,qGAAqG;;;;;;IAErG,kFAAkF;;;;;+BAvKjE,CAAC;;;+BAUiC,CAAC;;;;;;;;;;;;IA+JpD,6FAA6F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9F,CAAA"}
|
package/build/engine.js
CHANGED
|
@@ -129,9 +129,11 @@ export const engine = {
|
|
|
129
129
|
// Not awaited: the exchange behind it is a Core round trip with no client
|
|
130
130
|
// deadline, and start() must resolve offline. The glasses get the token
|
|
131
131
|
// when it lands; identity resolution joins the same single-flight exchange.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
if (!cloudClientService.isCloudDisabled()) {
|
|
133
|
+
void cloudClientService.syncCoreTokenToBluetooth().catch((error) => {
|
|
134
|
+
console.warn("engine.start: initial Cloud core token sync failed:", error instanceof Error ? error.message : error);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
135
137
|
startSupportProfileSync();
|
|
136
138
|
// Push device-setting changes to the glasses for ANY host, so
|
|
137
139
|
// engine.glasses.settings.set() reaches the device (not just the Glassly app).
|
|
@@ -235,7 +237,7 @@ export const engine = {
|
|
|
235
237
|
backup,
|
|
236
238
|
/** Device-local voice profiles for on-device speaker ID (Settings > Speakers). */
|
|
237
239
|
speakers,
|
|
238
|
-
/** AI/voice provider key validation — user-supplied keys (Settings > API Keys). */
|
|
240
|
+
/** AI/voice provider key validation — user-supplied keys (Settings > Privacy > API Keys). */
|
|
239
241
|
providerKeys,
|
|
240
242
|
display,
|
|
241
243
|
};
|
package/build/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAC,SAAS,EAAE,KAAK,IAAI,cAAc,EAAE,IAAI,IAAI,aAAa,EAAE,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAC5G,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAC,kBAAkB,EAAE,6BAA6B,EAAC,MAAM,iCAAiC,CAAA;AACjG,OAAO,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,+BAA+B,CAAA;AAC7F,OAAO,EAAC,4BAA4B,EAAE,2BAA2B,EAAC,MAAM,oCAAoC,CAAA;AAC5G,OAAO,EAAC,wBAAwB,EAAE,oCAAoC,EAAC,MAAM,mCAAmC,CAAA;AAChH,OAAO,EAAC,wBAAwB,EAAE,uBAAuB,EAAC,MAAM,gCAAgC,CAAA;AAChG,OAAO,EAAC,4BAA4B,EAAE,2BAA2B,EAAC,MAAM,oCAAoC,CAAA;AAC5G,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,6BAA6B,CAAA;AACvF,OAAO,mBAAmB,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAC,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,+BAA+B,CAAA;AAC7F,OAAO,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,8BAA8B,CAAA;AAC1F,OAAO,EAAC,0BAA0B,EAAE,yBAAyB,EAAC,MAAM,0BAA0B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,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAA;QACjE,MAAM,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO;IACP,MAAM;IACN,kEAAkE;IAClE,EAAE;IACF,wEAAwE;IACxE,OAAO;IACP,sEAAsE;IACtE,QAAQ;IACR,qFAAqF;IACrF,GAAG;IACH,qEAAqE;IACrE,OAAO;IACP,sFAAsF;IACtF,GAAG;IACH,6EAA6E;IAC7E,OAAO;IACP,iFAAiF;IACjF,QAAQ;IACR,8CAA8C;IAC9C,OAAO;IACP,uDAAuD;IACvD,kBAAkB;IAClB,8EAA8E;IAC9E,WAAW;IACX,qFAAqF;IACrF,aAAa;IACb,4EAA4E;IAC5E,IAAI;IACJ,+EAA+E;IAC/E,MAAM;IACN,qGAAqG;IACrG,MAAM;IACN,kFAAkF;IAClF,QAAQ;IACR,mFAAmF;IACnF,YAAY;IACZ,OAAO;CACR,CAAA","sourcesContent":["/**\n * `engine` — the namespaced OEM-facing engine API (the \"(A) host API\" from the\n * Phase-1 contract). Host UI calls `engine.<domain>.<method>()`; each domain is a\n * typed facade over the runtime. (Exported from the `@glassly/engine` module, whose\n * name stays `engine` in code; the public API surface is `engine`.)\n *\n * It grows one facade at a time. The migration-era flat store/service exports\n * remain in a private Glassly host package; they shrink as screens move onto\n * `engine.*`.\n */\nimport {configure, start as bootstrapStart, stop as bootstrapStop, updateUiSeams} from \"./runtime/bootstrap\"\nimport {cloudClientService} from \"./services/CloudClientService\"\nimport {hydrateDeviceStore, demoteOrphanedDefaultWearable} from \"./services/DeviceStoreHydration\"\nimport {startPairedGlassesLatch, stopPairedGlassesLatch} from \"./services/PairedGlassesLatch\"\nimport {startMiniappPauseCoordinator, stopMiniappPauseCoordinator} from \"./services/MiniappPauseCoordinator\"\nimport {nativeRestoreLaunchQuery, reconnectAfterBluetoothRestoreLaunch} from \"./services/BluetoothRestoreLaunch\"\nimport {startGlassesSettingsSync, stopGlassesSettingsSync} from \"./services/GlassesSettingsSync\"\nimport {startGlassesStatusProjection, stopGlassesStatusProjection} from \"./services/GlassesStatusProjection\"\nimport {startOtaService, stopOtaService} from \"./services/OtaService\"\nimport {startAudioCloudUplink, stopAudioCloudUplink} from \"./services/AudioCloudUplink\"\nimport sonioxDirectService from \"./services/soniox/SonioxDirectService\"\nimport {startSupportProfileSync, stopSupportProfileSync} from \"./services/SupportProfileSync\"\nimport {startDeviceEventRouter, stopDeviceEventRouter} from \"./services/DeviceEventRouter\"\nimport {startPhoneActivityTracking, stopPhoneActivityTracking} from \"./services/PhoneActivity\"\nimport {startPhoneNotificationsSync, stopPhoneNotificationsSync} from \"./services/PhoneNotificationsSync\"\nimport {startSpeakerIdSync, stopSpeakerIdSync} from \"./services/SpeakerIdSync\"\nimport {startNeuralBandSettingsSync, stopNeuralBandSettingsSync} from \"./services/neuralBand/NeuralBandSettingsSync\"\nimport {startWatchLink, stopWatchLink} from \"./services/watch/WatchLink\"\nimport {startCaptionsTesterReportService, stopCaptionsTesterReportService} from \"./services/CaptionsTesterReportService\"\nimport {startJSCrashloopReportService, stopJSCrashloopReportService} from \"./services/JSCrashloopReportService\"\nimport {ensureMiniappEngine, stopMiniappEngine} from \"./services/MiniappEngine\"\nimport localMiniappRuntime from \"./services/LocalMiniappRuntime\"\nimport displayProcessor from \"./services/DisplayProcessor\"\nimport {gallerySyncService} from \"./services/asg/gallerySyncService\"\nimport {glasses} from \"./facades/glasses\"\nimport {display} from \"./facades/display\"\nimport {speech} from \"./facades/speech\"\nimport {ai} from \"./facades/ai\"\nimport {session} from \"./facades/session\"\nimport {settings} from \"./facades/settings\"\nimport {dev} from \"./facades/dev\"\nimport {reports} from \"./facades/reports\"\nimport {ota} from \"./facades/ota\"\nimport {gallery} from \"./facades/gallery\"\nimport {miniapps} from \"./facades/miniapps\"\nimport {pairing} from \"./facades/pairing\"\nimport {phoneNotifications} from \"./facades/phoneNotifications\"\nimport {permissions} from \"./facades/permissions\"\nimport {notifications} from \"./facades/notifications\"\nimport {maps} from \"./facades/maps\"\nimport {memory} from \"./facades/memory\"\nimport {backup} from \"./facades/backup\"\nimport {speakers} from \"./facades/speakers\"\nimport {providerKeys} from \"./facades/providerKeys\"\nimport {logBuffer} from \"./utils/devLogging\"\nimport pageHost from \"./services/pages/PageHost\"\nimport gestureDotsService from \"./services/GestureDotsService\"\n\nexport const engine = {\n /** Front door — hand engine auth + config, then start/stop the runtime. */\n configure,\n /** Merge host-UI seams on a running runtime (scan overlay, wifi setup, …). */\n updateUiSeams,\n /** Start the runtime: mark started + construct/connect the cloud client + begin\n * syncing device settings to the glasses. */\n async start() {\n // Reports attach recent phone logs, so engine owns console interception for\n // OEM hosts too. Idempotent; the Glassly host may start it earlier.\n logBuffer.startConsoleInterception()\n await bootstrapStart()\n // Construct + connect the cloud client so the documented configure()+start()\n // lifecycle yields a live engine.session for OEMs. Idempotent for repeated\n // start() calls.\n cloudClientService.init()\n // Project native device status -> the engine stores (the inbound feed the rest\n // of the runtime reads). Established first so the stores are live before the\n // syncs below react to them.\n startGlassesStatusProjection((changed) => localMiniappRuntime.forwardEvent(\"glasses_connection_state\", changed))\n // Lock + foreground state, read by the dashboard's notification gate and\n // the G2 notification ctrl below; up before either consumer.\n startPhoneActivityTracking()\n // The overlay slot's owner: the designated dashboard miniapp's page shows\n // through it (ADR-0006), so it is up before the miniapp runtime.\n pageHost.start()\n gestureDotsService.start()\n // Route the rest of the inbound device events (wifi/hotspot/gallery -> stores+bus,\n // photo/stream -> coordinators, button/touch/accel/head -> miniapps, save_setting ->\n // store, miniapp_selected -> launcher) so a bare OEM gets device data, not just the\n // Glassly app's MantleManager.\n startDeviceEventRouter()\n // Hydration contract: the native DeviceStore is in-memory and starts empty\n // every launch; seed it from the persisted settings BEFORE start() resolves\n // so every post-start getDefaultDevice() read is a trustworthy two-state\n // answer (no false \"absent\" for genuinely-paired users at cold start).\n // Ordered before startGlassesSettingsSync so the settings load can't\n // double-push through the change subscription. A failed hydration must not\n // brick the runtime: start() continues, and the guards that consume\n // hasDefaultDevice() see the rejection and fail open.\n try {\n await hydrateDeviceStore()\n // Boot repair: a persisted default_wearable without a native default\n // device (identity abandoned mid-pairing, or resurrected from the server\n // before identity stopped syncing) demotes to pending_wearable so hosts\n // render finish-pairing instead of a connect that would throw.\n await demoteOrphanedDefaultWearable()\n } catch (error) {\n console.warn(\"engine.start: device-store hydration failed:\", error instanceof Error ? error.message : error)\n }\n // After the settings load so an already-paired phone latches on this start.\n startPairedGlassesLatch()\n // Pause local miniapps while the paired glasses stay disconnected. Reads\n // the pairing identity, so after the settings load like the latch.\n startMiniappPauseCoordinator()\n // iOS relaunched the app in the background to hand back a preserved glasses link:\n // no screen will ask to connect, so the engine does. Not awaited; start() must not\n // wait on a BLE handshake.\n void reconnectAfterBluetoothRestoreLaunch({\n launchedForRestore: nativeRestoreLaunchQuery(),\n connectDefault: () => glasses.connectDefault(),\n })\n // Project the glasses' OTA events into the store for the engine.ota read surface.\n startOtaService()\n // Forward glasses mic_lc3 frames to the v2 cloud session so cloud transcription\n // works for any host (not just the Glassly app's host-side MantleManager fork).\n startAudioCloudUplink()\n // Phone -> Soniox direct transcription (user-supplied API key). Started\n // after device-store hydration so the persisted key is already loaded.\n sonioxDirectService.start()\n // Not awaited: the exchange behind it is a Core round trip with no client\n // deadline, and start() must resolve offline. The glasses get the token\n // when it lands; identity resolution joins the same single-flight exchange.\n void cloudClientService.syncCoreTokenToBluetooth().catch((error) => {\n console.warn(\n \"engine.start: initial Cloud core token sync failed:\",\n error instanceof Error ? error.message : error,\n )\n })\n startSupportProfileSync()\n // Push device-setting changes to the glasses for ANY host, so\n // engine.glasses.settings.set() reaches the device (not just the Glassly app).\n startGlassesSettingsSync()\n // Same for phone-notification config -> the native listener (Android).\n startPhoneNotificationsSync()\n // On-device speaker identification: sync the enabled setting + enrolled\n // profile centroids to the native SpeakerIdEngine, and start the resolver\n // that annotates cloud transcripts with resolved speaker identities.\n startSpeakerIdSync()\n // Meta Neural Band: push the air mouse and wearing-hand settings to the band on connect.\n startNeuralBandSettingsSync()\n // Watch remote (Apple Watch on iOS, Wear OS on Android): status and mirror frames out, wrist commands in.\n startWatchLink()\n // Android internal/e2e: laptop captions tester can broadcast a failure intent;\n // engine owns turning that into a Cloud report.\n startCaptionsTesterReportService()\n // JSRuntime crashloop-disabled is runtime state; engine owns filing the\n // automatic report while hosts only render alert/telemetry side effects.\n startJSCrashloopReportService()\n // Bring up the local-miniapp engine so a bare OEM can run JSRuntime miniapps:\n // the LocalMiniappRuntime (registry + WebView bridge), the JSRuntime router\n // (crust-bound spawn/dispatch pump + launcher wiring), the DisplayProcessor\n // (layout arbitration over the engine stores), and the gallery-sync service.\n // All idempotent — when the Glassly app's host bootstrap also calls these, the\n // second call is a no-op. Host-only crashloop telemetry is attached\n // separately by the Glassly app.\n localMiniappRuntime.initialize()\n ensureMiniappEngine()\n displayProcessor.attachToRuntime()\n gallerySyncService.initialize()\n },\n /** Stop the runtime: tear down the settings sync + cloud client + mark stopped.\n * Each step is guarded so one failing teardown can't skip the rest and leak\n * the remaining runtime services. */\n async stop() {\n const safely = async (label: string, step: () => unknown): Promise<void> => {\n try {\n await step()\n } catch (error) {\n console.warn(`engine.stop: ${label} failed:`, error)\n }\n }\n await safely(\"glasses settings sync\", stopGlassesSettingsSync)\n await safely(\"paired glasses latch\", stopPairedGlassesLatch)\n await safely(\"miniapp pause coordinator\", stopMiniappPauseCoordinator)\n await safely(\"glasses status projection\", stopGlassesStatusProjection)\n await safely(\"device event router\", stopDeviceEventRouter)\n await safely(\"page host\", () => pageHost.stop())\n await safely(\"gesture dots service\", () => gestureDotsService.stop())\n await safely(\"ota service\", stopOtaService)\n await safely(\"audio cloud uplink\", stopAudioCloudUplink)\n await safely(\"soniox direct service\", () => sonioxDirectService.stop())\n await safely(\"support profile sync\", stopSupportProfileSync)\n await safely(\"phone notifications sync\", stopPhoneNotificationsSync)\n await safely(\"phone activity tracking\", stopPhoneActivityTracking)\n await safely(\"speaker id sync\", stopSpeakerIdSync)\n await safely(\"neural band settings sync\", stopNeuralBandSettingsSync)\n await safely(\"watch link\", stopWatchLink)\n await safely(\"captions tester report service\", stopCaptionsTesterReportService)\n await safely(\"js crashloop report service\", stopJSCrashloopReportService)\n await safely(\"miniapp engine\", stopMiniappEngine)\n await safely(\"local miniapp runtime\", () => localMiniappRuntime.cleanup())\n await safely(\"display processor\", () => displayProcessor.detachFromRuntime())\n await safely(\"gallery sync service\", () => gallerySyncService.cleanup())\n await safely(\"cloud client\", () => cloudClientService.shutdown())\n await safely(\"bootstrap\", bootstrapStop)\n },\n glasses,\n speech,\n /** On-device LLM model management (Settings > Offline Models). */\n ai,\n /** Cloud live-session status + account ops — engine owns the client. */\n session,\n /** Typed keyed user settings over the engine-owned settings store. */\n settings,\n /** Developer/debug surface (backend+cloud URL overrides, reconnect, min version). */\n dev,\n /** Bug-report, automatic runtime report, and feedback submission. */\n reports,\n /** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */\n ota,\n /** Gallery sync: status/onStatus · onNotice (host renders) · sync/cancel. */\n gallery,\n /** Miniapp lifecycle (the WebView bridge primitives are exported separately). */\n miniapps,\n /** First-time glasses discovery + pairing. */\n pairing,\n /** Phone→glasses notification forwarding (Android). */\n phoneNotifications,\n /** OS permissions (check/request/openSettings + per-miniapp requirements). */\n permissions,\n /** Inbound alerts engine→host (crashloop, version-incompatible, connection loss). */\n notifications,\n /** Maps providers — user-supplied Mapbox access token (Settings > Keys). */\n maps,\n /** Shared user-scoped memory timeline (Settings > Memory + session.memory). */\n memory,\n /** Whole-app backup file: settings, miniapp storage, installed list, memory (Settings > Profile). */\n backup,\n /** Device-local voice profiles for on-device speaker ID (Settings > Speakers). */\n speakers,\n /** AI/voice provider key validation — user-supplied keys (Settings > API Keys). */\n providerKeys,\n display,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;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AsE;IACtE,QAAQ;IACR,qFAAqF;IACrF,GAAG;IACH,qEAAqE;IACrE,OAAO;IACP,sFAAsF;IACtF,GAAG;IACH,6EAA6E;IAC7E,OAAO;IACP,iFAAiF;IACjF,QAAQ;IACR,8CAA8C;IAC9C,OAAO;IACP,uDAAuD;IACvD,kBAAkB;IAClB,8EAA8E;IAC9E,WAAW;IACX,qFAAqF;IACrF,aAAa;IACb,4EAA4E;IAC5E,IAAI;IACJ,+EAA+E;IAC/E,MAAM;IACN,qGAAqG;IACrG,MAAM;IACN,kFAAkF;IAClF,QAAQ;IACR,6FAA6F;IAC7F,YAAY;IACZ,OAAO;CACR,CAAA","sourcesContent":["/**\n * `engine` — the namespaced OEM-facing engine API (the \"(A) host API\" from the\n * Phase-1 contract). Host UI calls `engine.<domain>.<method>()`; each domain is a\n * typed facade over the runtime. (Exported from the `@glassly/engine` module, whose\n * name stays `engine` in code; the public API surface is `engine`.)\n *\n * It grows one facade at a time. The migration-era flat store/service exports\n * remain in a private Glassly host package; they shrink as screens move onto\n * `engine.*`.\n */\nimport {configure, start as bootstrapStart, stop as bootstrapStop, updateUiSeams} from \"./runtime/bootstrap\"\nimport {cloudClientService} from \"./services/CloudClientService\"\nimport {hydrateDeviceStore, demoteOrphanedDefaultWearable} from \"./services/DeviceStoreHydration\"\nimport {startPairedGlassesLatch, stopPairedGlassesLatch} from \"./services/PairedGlassesLatch\"\nimport {startMiniappPauseCoordinator, stopMiniappPauseCoordinator} from \"./services/MiniappPauseCoordinator\"\nimport {nativeRestoreLaunchQuery, reconnectAfterBluetoothRestoreLaunch} from \"./services/BluetoothRestoreLaunch\"\nimport {startGlassesSettingsSync, stopGlassesSettingsSync} from \"./services/GlassesSettingsSync\"\nimport {startGlassesStatusProjection, stopGlassesStatusProjection} from \"./services/GlassesStatusProjection\"\nimport {startOtaService, stopOtaService} from \"./services/OtaService\"\nimport {startAudioCloudUplink, stopAudioCloudUplink} from \"./services/AudioCloudUplink\"\nimport sonioxDirectService from \"./services/soniox/SonioxDirectService\"\nimport {startSupportProfileSync, stopSupportProfileSync} from \"./services/SupportProfileSync\"\nimport {startDeviceEventRouter, stopDeviceEventRouter} from \"./services/DeviceEventRouter\"\nimport {startPhoneActivityTracking, stopPhoneActivityTracking} from \"./services/PhoneActivity\"\nimport {startPhoneNotificationsSync, stopPhoneNotificationsSync} from \"./services/PhoneNotificationsSync\"\nimport {startSpeakerIdSync, stopSpeakerIdSync} from \"./services/SpeakerIdSync\"\nimport {startNeuralBandSettingsSync, stopNeuralBandSettingsSync} from \"./services/neuralBand/NeuralBandSettingsSync\"\nimport {startWatchLink, stopWatchLink} from \"./services/watch/WatchLink\"\nimport {startCaptionsTesterReportService, stopCaptionsTesterReportService} from \"./services/CaptionsTesterReportService\"\nimport {startJSCrashloopReportService, stopJSCrashloopReportService} from \"./services/JSCrashloopReportService\"\nimport {ensureMiniappEngine, stopMiniappEngine} from \"./services/MiniappEngine\"\nimport localMiniappRuntime from \"./services/LocalMiniappRuntime\"\nimport displayProcessor from \"./services/DisplayProcessor\"\nimport {gallerySyncService} from \"./services/asg/gallerySyncService\"\nimport {glasses} from \"./facades/glasses\"\nimport {display} from \"./facades/display\"\nimport {speech} from \"./facades/speech\"\nimport {ai} from \"./facades/ai\"\nimport {session} from \"./facades/session\"\nimport {settings} from \"./facades/settings\"\nimport {dev} from \"./facades/dev\"\nimport {reports} from \"./facades/reports\"\nimport {ota} from \"./facades/ota\"\nimport {gallery} from \"./facades/gallery\"\nimport {miniapps} from \"./facades/miniapps\"\nimport {pairing} from \"./facades/pairing\"\nimport {phoneNotifications} from \"./facades/phoneNotifications\"\nimport {permissions} from \"./facades/permissions\"\nimport {notifications} from \"./facades/notifications\"\nimport {maps} from \"./facades/maps\"\nimport {memory} from \"./facades/memory\"\nimport {backup} from \"./facades/backup\"\nimport {speakers} from \"./facades/speakers\"\nimport {providerKeys} from \"./facades/providerKeys\"\nimport {logBuffer} from \"./utils/devLogging\"\nimport pageHost from \"./services/pages/PageHost\"\nimport gestureDotsService from \"./services/GestureDotsService\"\n\nexport const engine = {\n /** Front door — hand engine auth + config, then start/stop the runtime. */\n configure,\n /** Merge host-UI seams on a running runtime (scan overlay, wifi setup, …). */\n updateUiSeams,\n /** Start the runtime: mark started + construct/connect the cloud client + begin\n * syncing device settings to the glasses. */\n async start() {\n // Reports attach recent phone logs, so engine owns console interception for\n // OEM hosts too. Idempotent; the Glassly host may start it earlier.\n logBuffer.startConsoleInterception()\n await bootstrapStart()\n // Construct + connect the cloud client so the documented configure()+start()\n // lifecycle yields a live engine.session for OEMs. Idempotent for repeated\n // start() calls.\n cloudClientService.init()\n // Project native device status -> the engine stores (the inbound feed the rest\n // of the runtime reads). Established first so the stores are live before the\n // syncs below react to them.\n startGlassesStatusProjection((changed) => localMiniappRuntime.forwardEvent(\"glasses_connection_state\", changed))\n // Lock + foreground state, read by the dashboard's notification gate and\n // the G2 notification ctrl below; up before either consumer.\n startPhoneActivityTracking()\n // The overlay slot's owner: the designated dashboard miniapp's page shows\n // through it (ADR-0006), so it is up before the miniapp runtime.\n pageHost.start()\n gestureDotsService.start()\n // Route the rest of the inbound device events (wifi/hotspot/gallery -> stores+bus,\n // photo/stream -> coordinators, button/touch/accel/head -> miniapps, save_setting ->\n // store, miniapp_selected -> launcher) so a bare OEM gets device data, not just the\n // Glassly app's MantleManager.\n startDeviceEventRouter()\n // Hydration contract: the native DeviceStore is in-memory and starts empty\n // every launch; seed it from the persisted settings BEFORE start() resolves\n // so every post-start getDefaultDevice() read is a trustworthy two-state\n // answer (no false \"absent\" for genuinely-paired users at cold start).\n // Ordered before startGlassesSettingsSync so the settings load can't\n // double-push through the change subscription. A failed hydration must not\n // brick the runtime: start() continues, and the guards that consume\n // hasDefaultDevice() see the rejection and fail open.\n try {\n await hydrateDeviceStore()\n // Boot repair: a persisted default_wearable without a native default\n // device (identity abandoned mid-pairing, or resurrected from the server\n // before identity stopped syncing) demotes to pending_wearable so hosts\n // render finish-pairing instead of a connect that would throw.\n await demoteOrphanedDefaultWearable()\n } catch (error) {\n console.warn(\"engine.start: device-store hydration failed:\", error instanceof Error ? error.message : error)\n }\n // After the settings load so an already-paired phone latches on this start.\n startPairedGlassesLatch()\n // Pause local miniapps while the paired glasses stay disconnected. Reads\n // the pairing identity, so after the settings load like the latch.\n startMiniappPauseCoordinator()\n // iOS relaunched the app in the background to hand back a preserved glasses link:\n // no screen will ask to connect, so the engine does. Not awaited; start() must not\n // wait on a BLE handshake.\n void reconnectAfterBluetoothRestoreLaunch({\n launchedForRestore: nativeRestoreLaunchQuery(),\n connectDefault: () => glasses.connectDefault(),\n })\n // Project the glasses' OTA events into the store for the engine.ota read surface.\n startOtaService()\n // Forward glasses mic_lc3 frames to the v2 cloud session so cloud transcription\n // works for any host (not just the Glassly app's host-side MantleManager fork).\n startAudioCloudUplink()\n // Phone -> Soniox direct transcription (user-supplied API key). Started\n // after device-store hydration so the persisted key is already loaded.\n sonioxDirectService.start()\n // Not awaited: the exchange behind it is a Core round trip with no client\n // deadline, and start() must resolve offline. The glasses get the token\n // when it lands; identity resolution joins the same single-flight exchange.\n if (!cloudClientService.isCloudDisabled()) {\n void cloudClientService.syncCoreTokenToBluetooth().catch((error) => {\n console.warn(\n \"engine.start: initial Cloud core token sync failed:\",\n error instanceof Error ? error.message : error,\n )\n })\n }\n startSupportProfileSync()\n // Push device-setting changes to the glasses for ANY host, so\n // engine.glasses.settings.set() reaches the device (not just the Glassly app).\n startGlassesSettingsSync()\n // Same for phone-notification config -> the native listener (Android).\n startPhoneNotificationsSync()\n // On-device speaker identification: sync the enabled setting + enrolled\n // profile centroids to the native SpeakerIdEngine, and start the resolver\n // that annotates cloud transcripts with resolved speaker identities.\n startSpeakerIdSync()\n // Meta Neural Band: push the air mouse and wearing-hand settings to the band on connect.\n startNeuralBandSettingsSync()\n // Watch remote (Apple Watch on iOS, Wear OS on Android): status and mirror frames out, wrist commands in.\n startWatchLink()\n // Android internal/e2e: laptop captions tester can broadcast a failure intent;\n // engine owns turning that into a Cloud report.\n startCaptionsTesterReportService()\n // JSRuntime crashloop-disabled is runtime state; engine owns filing the\n // automatic report while hosts only render alert/telemetry side effects.\n startJSCrashloopReportService()\n // Bring up the local-miniapp engine so a bare OEM can run JSRuntime miniapps:\n // the LocalMiniappRuntime (registry + WebView bridge), the JSRuntime router\n // (crust-bound spawn/dispatch pump + launcher wiring), the DisplayProcessor\n // (layout arbitration over the engine stores), and the gallery-sync service.\n // All idempotent — when the Glassly app's host bootstrap also calls these, the\n // second call is a no-op. Host-only crashloop telemetry is attached\n // separately by the Glassly app.\n localMiniappRuntime.initialize()\n ensureMiniappEngine()\n displayProcessor.attachToRuntime()\n gallerySyncService.initialize()\n },\n /** Stop the runtime: tear down the settings sync + cloud client + mark stopped.\n * Each step is guarded so one failing teardown can't skip the rest and leak\n * the remaining runtime services. */\n async stop() {\n const safely = async (label: string, step: () => unknown): Promise<void> => {\n try {\n await step()\n } catch (error) {\n console.warn(`engine.stop: ${label} failed:`, error)\n }\n }\n await safely(\"glasses settings sync\", stopGlassesSettingsSync)\n await safely(\"paired glasses latch\", stopPairedGlassesLatch)\n await safely(\"miniapp pause coordinator\", stopMiniappPauseCoordinator)\n await safely(\"glasses status projection\", stopGlassesStatusProjection)\n await safely(\"device event router\", stopDeviceEventRouter)\n await safely(\"page host\", () => pageHost.stop())\n await safely(\"gesture dots service\", () => gestureDotsService.stop())\n await safely(\"ota service\", stopOtaService)\n await safely(\"audio cloud uplink\", stopAudioCloudUplink)\n await safely(\"soniox direct service\", () => sonioxDirectService.stop())\n await safely(\"support profile sync\", stopSupportProfileSync)\n await safely(\"phone notifications sync\", stopPhoneNotificationsSync)\n await safely(\"phone activity tracking\", stopPhoneActivityTracking)\n await safely(\"speaker id sync\", stopSpeakerIdSync)\n await safely(\"neural band settings sync\", stopNeuralBandSettingsSync)\n await safely(\"watch link\", stopWatchLink)\n await safely(\"captions tester report service\", stopCaptionsTesterReportService)\n await safely(\"js crashloop report service\", stopJSCrashloopReportService)\n await safely(\"miniapp engine\", stopMiniappEngine)\n await safely(\"local miniapp runtime\", () => localMiniappRuntime.cleanup())\n await safely(\"display processor\", () => displayProcessor.detachFromRuntime())\n await safely(\"gallery sync service\", () => gallerySyncService.cleanup())\n await safely(\"cloud client\", () => cloudClientService.shutdown())\n await safely(\"bootstrap\", bootstrapStop)\n },\n glasses,\n speech,\n /** On-device LLM model management (Settings > Offline Models). */\n ai,\n /** Cloud live-session status + account ops — engine owns the client. */\n session,\n /** Typed keyed user settings over the engine-owned settings store. */\n settings,\n /** Developer/debug surface (backend+cloud URL overrides, reconnect, min version). */\n dev,\n /** Bug-report, automatic runtime report, and feedback submission. */\n reports,\n /** Firmware OTA read/observe surface (updateAvailable/status + on* subscriptions). */\n ota,\n /** Gallery sync: status/onStatus · onNotice (host renders) · sync/cancel. */\n gallery,\n /** Miniapp lifecycle (the WebView bridge primitives are exported separately). */\n miniapps,\n /** First-time glasses discovery + pairing. */\n pairing,\n /** Phone→glasses notification forwarding (Android). */\n phoneNotifications,\n /** OS permissions (check/request/openSettings + per-miniapp requirements). */\n permissions,\n /** Inbound alerts engine→host (crashloop, version-incompatible, connection loss). */\n notifications,\n /** Maps providers — user-supplied Mapbox access token (Settings > Keys). */\n maps,\n /** Shared user-scoped memory timeline (Settings > Memory + session.memory). */\n memory,\n /** Whole-app backup file: settings, miniapp storage, installed list, memory (Settings > Profile). */\n backup,\n /** Device-local voice profiles for on-device speaker ID (Settings > Speakers). */\n speakers,\n /** AI/voice provider key validation — user-supplied keys (Settings > Privacy > API Keys). */\n providerKeys,\n display,\n}\n"]}
|
|
@@ -20,7 +20,7 @@ export declare const display: {
|
|
|
20
20
|
dashboard: {
|
|
21
21
|
/** An overlay app holds the slot. */
|
|
22
22
|
isOpen: () => boolean;
|
|
23
|
-
/** As if the head was raised/lowered (the dashboard app
|
|
23
|
+
/** As if the head was raised/lowered (the dashboard app decides whether head-up opens it). */
|
|
24
24
|
setHeadUp: (up: boolean) => void;
|
|
25
25
|
/** A double tap on the empty screen: the dashboard app opens (simulator button). */
|
|
26
26
|
open: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/facades/display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,MAAM,wBAAwB,CAAA;AAKjD,eAAO,MAAM,OAAO;IAClB,mDAAmD;;;;;;IAEnD;;;;OAIG;;QAED,qCAAqC;sBACzB,OAAO;QACnB,
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/facades/display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,MAAM,wBAAwB,CAAA;AAKjD,eAAO,MAAM,OAAO;IAClB,mDAAmD;;;;;;IAEnD;;;;OAIG;;QAED,qCAAqC;sBACzB,OAAO;QACnB,8FAA8F;wBAC9E,OAAO,KAAG,IAAI;QAC9B,oFAAoF;oBAC1E,IAAI;QAGd,mDAAmD;qBACxC,IAAI;;IAIjB,wEAAwE;;IAExE,iCAAiC;iBACtB,OAAO,CAAC,IAAI,CAAC;CACzB,CAAA"}
|
package/build/facades/display.js
CHANGED
|
@@ -19,7 +19,7 @@ export const display = {
|
|
|
19
19
|
dashboard: {
|
|
20
20
|
/** An overlay app holds the slot. */
|
|
21
21
|
isOpen: () => useDisplayStore.getState().overlayOwner !== null,
|
|
22
|
-
/** As if the head was raised/lowered (the dashboard app
|
|
22
|
+
/** As if the head was raised/lowered (the dashboard app decides whether head-up opens it). */
|
|
23
23
|
setHeadUp: (up) => sendGesture(up ? "head_up" : "head_down"),
|
|
24
24
|
/** A double tap on the empty screen: the dashboard app opens (simulator button). */
|
|
25
25
|
open: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/facades/display.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,YAAY,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAC,WAAW,EAAC,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AAA;QAC3D,CAAC;KACF;IACD,wEAAwE;IACxE,IAAI,EAAE,CAAC,GAAG,IAAiD,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IACjG,iCAAiC;IACjC,KAAK,EAAE,GAAkB,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE;CACxD,CAAA","sourcesContent":["/**\n * display facade — `engine.display`: the host/OEM display surface. `mirror`\n * exposes the mirrored-view read-model; `text`/`clear` are raw passthroughs to the\n * glasses display for dev tools and escape-hatch use (normal rendering goes through\n * the engine DisplayProcessor / layout system, not these).\n */\nimport BluetoothSdk from \"@glassly/bluetooth-sdk\"\nimport {sendGesture} from \"../services/GlassesTouchInput\"\nimport {useDisplayStore} from \"../stores/display\"\nimport {displayMirror} from \"./displayMirror\"\n\nexport const display = {\n /** Mirrored-view read-model (current/onMirror). */\n mirror: displayMirror,\n /**\n * Dashboard controls for the simulator and dev tools. The dashboard is a\n * miniapp's (ADR-0006): these replay the wearer's own inputs, so they do\n * whatever the running apps make of them.\n */\n dashboard: {\n /** An overlay app holds the slot. */\n isOpen: (): boolean => useDisplayStore.getState().overlayOwner !== null,\n /** As if the head was raised/lowered (the dashboard app decides whether head-up opens it). */\n setHeadUp: (up: boolean): void => sendGesture(up ? \"head_up\" : \"head_down\"),\n /** A double tap on the empty screen: the dashboard app opens (simulator button). */\n open: (): void => {\n if (!display.dashboard.isOpen()) sendGesture(\"double_tap\")\n },\n /** A double tap on the showing page: it closes. */\n close: (): void => {\n if (display.dashboard.isOpen()) sendGesture(\"double_tap\")\n },\n },\n /** Write raw text to the glasses display at (x, y) with a font size. */\n text: (...args: Parameters<typeof BluetoothSdk.displayText>) => BluetoothSdk.displayText(...args),\n /** Clear the glasses display. */\n clear: (): Promise<void> => BluetoothSdk.clearDisplay(),\n}\n"]}
|
package/build/facades/glasses.js
CHANGED
|
@@ -80,7 +80,7 @@ function projectKeyboardStatus() {
|
|
|
80
80
|
const s = useGlassesStore.getState();
|
|
81
81
|
return {
|
|
82
82
|
/** Connected glasses run a firmware that can host a keyboard (G2 Glassly CFW 39+). */
|
|
83
|
-
available: s.keyboardBridge === true,
|
|
83
|
+
available: isGlassesReady(s.connection) && s.keyboardBridge === true,
|
|
84
84
|
connected: s.keyboardConnected === true,
|
|
85
85
|
name: s.keyboardName ?? "",
|
|
86
86
|
/** A keyboard is remembered and reconnects automatically. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,kFAAkF;AAClF,sFAAsF;AACtF,uEAAuE;AACvE,OAAO,YAAY,MAAM,iCAAiC,CAAA;AAa1D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAA;AACjE,OAAO,mBAAmB,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAA;AAClE,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,gBAAgB,GACjB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAC,iBAAiB,EAAE,qBAAqB,EAAE,gBAAgB,EAAC,MAAM,yBAAyB,CAAA;AAClG,OAAO,eAKN,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAC,qCAAqC,EAAC,MAAM,gCAAgC,CAAA;AACpF,OAAO,EAAC,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAA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,GAAG,GAAG,YAAY,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,KAAsC,EAAE,EAAE;gBACzF,IAAI,KAAK,EAAE,GAAG;oBAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;YAC7C,CAAC,CAAC,CAAA;YACF,OAAO,GAAG,EAAE;gBACV,GAAG,CAAC,MAAM,EAAE,CAAA;gBACZ,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;YAC3C,CAAC,CAAA;QACH,CAAC;KACF;IAED,sBAAsB;IACtB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,eAAe;CAC1B,CAAA","sourcesContent":["/**\n * glasses facade — the core `engine.glasses.*` surface: connection actions (over\n * the bluetooth-sdk passthrough), a curated status/info read-model (projected from\n * the engine-owned glasses store), capabilities (from the model table), and the\n * discrete input events. The `wifi` sub-facade is nested here.\n *\n * Read-models project the raw glasses store into the stable shape OEM UIs consume,\n * so the device store's field layout doesn't leak into every screen.\n */\n// Internal btsdk surface — connectSimulated/reconnect/controller live on the full\n// surface, not the public entry. Relative path (the alias doesn't resolve in engine's\n// standalone build); jest moduleNameMapper + tsconfig both resolve it.\nimport BluetoothSdk from \"@glassly/bluetooth-sdk/internal\"\nimport type {\n WatchAvailability,\n ButtonPressEvent,\n ConnectOptions,\n ControllerStatus,\n Device,\n KeyboardAdvertEvent,\n KeyboardPairingEvent,\n NeuralBandFirmwareEvent,\n PairedController,\n TouchEvent,\n} from \"@glassly/bluetooth-sdk\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {hasDefaultDevice} from \"../services/DeviceStoreHydration\"\nimport micStateCoordinator from \"../services/MicStateCoordinator\"\nimport {projectPairingIdentity} from \"../services/PairingIdentity\"\nimport {\n fixtureControllerList,\n fixtureControllerStatuses,\n fixtureInfo,\n fixtureStatus,\n isScreenshotMode,\n} from \"../services/ScreenshotFixture\"\nimport {isGlassesConnected, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {pushAllBluetoothSettings} from \"../services/GlassesSettingsSync\"\nimport {isControllerReady, pairedControllersFrom, readyControllers} from \"../services/controllers\"\nimport neuralBandInput, {\n type NeuralBandClaimStatus,\n type NeuralBandFirmwareStatus,\n type NeuralBandHandwritingStatus,\n type NeuralBandHandwritingUpdate,\n} from \"../services/neuralBand/NeuralBandInput\"\nimport {recordSupportProfileConnectionFailure} from \"../services/SupportProfileSync\"\nimport {getModelCapabilities, type DeviceTypes} from \"../types\"\nimport {pcmLevelDbfs} from \"../utils/audio/pcmLevel\"\nimport {glassesWifi} from \"./glassesWifi\"\nimport {glassesSettings} from \"./glassesSettings\"\n\nlet micLevelSubscriptions = 0\n\n// The screenshot fixture (ScreenshotFixture.ts) dresses these read-models\n// while the identity is the simulated device; it is a no-op outside that build.\nfunction projectStatus() {\n const s = useGlassesStore.getState()\n return fixtureStatus(\n {\n state: s.connection.state,\n fullyBooted: isGlassesReady(s.connection),\n battery: s.batteryLevel,\n charging: s.charging,\n case: {battery: s.caseBatteryLevel, charging: s.caseCharging, open: s.caseOpen, removed: s.caseRemoved},\n signal: s.signalStrength,\n micEnabled: s.micEnabled,\n vadEnabled: s.voiceActivityDetectionEnabled,\n btClassic: s.bluetoothClassicConnected,\n // iOS: glasses may read the phone's ANCS stream (\"Share System Notifications\").\n ancsAuthorized: Boolean(s.ancsAuthorized),\n },\n projectPairingIdentity(),\n )\n}\n\nfunction projectControllerList(): PairedController[] {\n return fixtureControllerList(\n pairedControllersFrom(useSettingsStore.getState().getSetting(SETTINGS.controllers.key)),\n projectPairingIdentity(),\n )\n}\n\n// Copies: snapshots must not hand callers mutable references into the store.\nfunction projectControllerStatuses(): Record<string, ControllerStatus> {\n const statuses: Record<string, ControllerStatus> = {}\n for (const [id, status] of Object.entries(useGlassesStore.getState().controllers ?? {})) {\n statuses[id] = {...status}\n }\n return fixtureControllerStatuses(statuses, projectPairingIdentity())\n}\n\n// Dedupe on the projected snapshot: the store updates on many fields; fire\n// only when the projection changes. The fixture's read-models also follow the\n// identity (a settings key), so that build watches the settings store too.\nfunction subscribeProjection<T>(project: () => T, cb: (snapshot: T) => void): () => void {\n let last = JSON.stringify(project())\n const notify = () => {\n const snap = project()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n }\n const unsubscribeGlasses = useGlassesStore.subscribe(notify)\n const unsubscribeSettings = isScreenshotMode() ? useSettingsStore.subscribe(notify) : () => {}\n return () => {\n unsubscribeGlasses()\n unsubscribeSettings()\n }\n}\n\nfunction projectKeyboardStatus() {\n const s = useGlassesStore.getState()\n return {\n /** Connected glasses run a firmware that can host a keyboard (G2 Glassly CFW 39+). */\n available: s.keyboardBridge === true,\n connected: s.keyboardConnected === true,\n name: s.keyboardName ?? \"\",\n /** A keyboard is remembered and reconnects automatically. */\n saved: s.keyboardSaved === true,\n state: s.keyboardState ?? \"idle\",\n error: s.keyboardError ?? \"\",\n }\n}\n\nfunction projectInfo() {\n const s = useGlassesStore.getState()\n return fixtureInfo(projectRawInfo(s), projectPairingIdentity())\n}\n\nfunction projectRawInfo(s: ReturnType<typeof useGlassesStore.getState>) {\n return {\n model: s.deviceModel,\n style: s.style,\n color: s.color,\n bluetoothName: s.bluetoothName,\n firmwareVersion: s.firmwareVersion,\n mtkFirmware: s.mtkFirmwareVersion,\n besFirmware: s.besFirmwareVersion,\n appVersion: s.appVersion,\n androidVersion: s.androidVersion,\n serialNumber: s.serialNumber,\n buildNumber: s.buildNumber,\n btMac: s.bluetoothMacAddress,\n wifiMac: s.wifiMacAddress,\n leftMac: s.leftMacAddress,\n rightMac: s.rightMacAddress,\n sceneCanvasWidth: s.sceneCanvasWidth,\n sceneCanvasHeight: s.sceneCanvasHeight,\n volumeGate: s.volumeGate === true,\n firmwareUpdateAvailable: s.firmwareUpdateAvailable === true,\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n wifi: {...s.wifi},\n }\n}\n\nexport type GlassesStatusSnapshot = ReturnType<typeof projectStatus>\nexport type KeyboardStatusSnapshot = ReturnType<typeof projectKeyboardStatus>\nexport type GlassesInfoSnapshot = ReturnType<typeof projectInfo>\n\nexport const glasses = {\n // --- connection (bluetooth-sdk passthrough) ---\n /**\n * Reconnect the default wearable. Seeds the phone's current device settings to\n * native first, so they're primed before the connect handshake replays them to\n * the glasses (this used to be a host-side step before `connectDefault`).\n */\n connectDefault: async (): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect_default\")\n throw error\n }\n },\n disconnect: (): Promise<void> => BluetoothSdk.disconnect(),\n forget: (): Promise<void> => BluetoothSdk.forget(),\n /** Connect to a specific (discovered) device. */\n connect: async (device: Device, options?: ConnectOptions): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connect(device, options)\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect\")\n throw error\n }\n },\n /** Connect the built-in simulated glasses (dev/testing). */\n connectSimulated: (): Promise<void> => BluetoothSdk.connectSimulated(),\n /** Set a device as the `connectDefault()` target. */\n setDefault: (device: Device | null): Promise<void> => BluetoothSdk.setDefaultDevice(device),\n /**\n * Reconnect to the saved default glasses. Resolves `false` when there's nothing to\n * reconnect to (no default paired) or the connect attempt fails (e.g. BLE powered\n * off), `true` when already connected or after kicking off the connect. Never\n * rejects — the boolean contract holds. The host gates connectivity/permissions\n * (its UI) before calling.\n */\n reconnect: async (): Promise<boolean> => {\n const defaultWearable = useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key)\n if (!defaultWearable) return false\n if (isGlassesConnected(useGlassesStore.getState().connection)) return true\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"reconnect\")\n console.warn(\"engine.glasses.reconnect failed:\", error)\n return false\n }\n return true\n },\n /** True when no glasses has ever been paired NOR selected (the pairing-identity\n * lifecycle is in its `none` state) — e.g. to route a first-run host into the\n * pairing/onboarding flow. A pending selection is not \"first\" — the host should\n * offer finish-pairing (see `engine.pairing.identity()`). */\n isFirstPairing: (): boolean => projectPairingIdentity().kind === \"none\",\n /**\n * True when the SDK has an actual default DEVICE to reconnect to. Distinct from\n * `default_wearable` (a model string that a pending or orphaned selection can\n * hold without any paired device): connectDefault() throws without a device, so\n * hosts should route to the pairing flow when this is false.\n *\n * Hydration-aware: awaits the device-store seed internally, so a cold-start\n * read can't see a false \"absent\" for genuinely-paired users. Rejects if\n * hydration failed — callers guarding destructive or routing decisions must\n * fail open (treat as \"has a device\").\n */\n hasDefaultDevice: (): Promise<boolean> => hasDefaultDevice(),\n\n // --- read-model (projected from the engine-owned glasses store) ---\n status: (): GlassesStatusSnapshot => projectStatus(),\n onStatus: (cb: (status: GlassesStatusSnapshot) => void): (() => void) => subscribeProjection(projectStatus, cb),\n info: (): GlassesInfoSnapshot => projectInfo(),\n onInfo: (cb: (info: GlassesInfoSnapshot) => void): (() => void) => subscribeProjection(projectInfo, cb),\n capabilities: () => getModelCapabilities(useGlassesStore.getState().deviceModel as DeviceTypes),\n /** Ask the glasses to report fresh firmware/version info (updates the store). */\n requestVersionInfo: () => BluetoothSdk.requestVersionInfo(),\n\n // --- discrete input events (passthrough listeners) ---\n onButtonPress: (cb: (event: ButtonPressEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"button_press\", cb)\n return () => sub.remove()\n },\n onTouchGesture: (cb: (event: TouchEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"touch_event\", cb)\n return () => sub.remove()\n },\n\n // --- BLE keyboard bridged through G2 Glassly CFW (revision 39+) ---\n keyboard: {\n /** Five-second scan; distinct advertisers, HID ones flagged. Also streams via onAdvert. */\n scan: (): Promise<KeyboardAdvertEvent[]> => BluetoothSdk.g2KeyboardScan(),\n /** Connect, pair and subscribe; the keyboard is remembered and auto-reconnected. */\n connect: async (device: {address: string; addressType: number; name: string}): Promise<void> => {\n await BluetoothSdk.g2KeyboardConnect(device.address, device.addressType, device.name)\n useSettingsStore.getState().setSetting(SETTINGS.keyboard_name.key, device.name)\n },\n reconnect: (): Promise<void> => BluetoothSdk.g2KeyboardReconnect(),\n disconnect: (): Promise<void> => BluetoothSdk.g2KeyboardDisconnect(),\n forget: async (): Promise<void> => {\n await BluetoothSdk.g2KeyboardForget()\n useSettingsStore.getState().setSetting(SETTINGS.keyboard_name.key, \"\")\n },\n passkey: (pin: number): Promise<void> => BluetoothSdk.g2KeyboardPasskey(pin),\n compare: (accept: boolean): Promise<void> => BluetoothSdk.g2KeyboardCompare(accept),\n status: (): KeyboardStatusSnapshot => projectKeyboardStatus(),\n onStatus: (cb: (status: KeyboardStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectKeyboardStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectKeyboardStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n onAdvert: (cb: (advert: KeyboardAdvertEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"keyboard_advert\", cb)\n return () => sub.remove()\n },\n onPairing: (cb: (prompt: KeyboardPairingEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"keyboard_pairing\", cb)\n return () => sub.remove()\n },\n },\n\n // --- controllers (input accessories linked to the phone), by registry id ---\n controllers: {\n /** Paired controllers in pairing order. */\n list: (): PairedController[] => projectControllerList(),\n onList: (cb: (controllers: PairedController[]) => void): (() => void) => {\n let last = JSON.stringify(projectControllerList())\n return useSettingsStore.subscribe(() => {\n const list = projectControllerList()\n const key = JSON.stringify(list)\n if (key === last) return\n last = key\n cb(list)\n })\n },\n /** Live driver statuses by id; a paired controller without an entry is idle. */\n statuses: (): Record<string, ControllerStatus> => projectControllerStatuses(),\n status: (id: string): ControllerStatus | undefined => projectControllerStatuses()[id],\n onStatus: (cb: (statuses: Record<string, ControllerStatus>) => void): (() => void) =>\n subscribeProjection(projectControllerStatuses, cb),\n /** Controllers delivering input (linked, route or claim done). */\n connected: (): ControllerStatus[] => readyControllers(projectControllerStatuses()),\n isConnected: (model?: string): boolean =>\n Object.values(projectControllerStatuses()).some(\n (status) => isControllerReady(status) && (model === undefined || status.model === model),\n ),\n connect: (id: string): Promise<void> => BluetoothSdk.connectController(id),\n /** Reconnect every paired controller that is not connected. */\n connectAll: (): Promise<void> => BluetoothSdk.connectControllers(),\n /** Drop an in-flight controller scan or pairing; paired records are untouched. */\n cancelAttempt: (): Promise<void> => BluetoothSdk.cancelControllerAttempt(),\n /** Disconnect; the controller stays paired. */\n disconnect: (id: string): Promise<void> => BluetoothSdk.disconnectController(id),\n forget: async (id: string): Promise<void> => {\n await BluetoothSdk.forgetController(id)\n neuralBandInput.forget(id)\n },\n },\n\n // --- Meta Neural Band (a controller with a claim step and its own features), by controller id ---\n neuralBand: {\n /** Store the Meta account session the one-time band claim uses (account-wide). */\n setMetaSession: (accessToken: string, userId: string): Promise<void> =>\n BluetoothSdk.neuralBandSetMetaSession(accessToken, userId),\n clearMetaSession: (): Promise<void> => BluetoothSdk.neuralBandClearMetaSession(),\n hasMetaSession: (): Promise<boolean> => BluetoothSdk.neuralBandHasMetaSession(),\n /** This band's identity is stored on this phone, so it reconnects without a claim. */\n isClaimed: (id: string): Promise<boolean> => BluetoothSdk.neuralBandIsClaimed(id),\n /** The latest claim progress of any band (with its `controllerId`), kept across screens. */\n claimStatus: (): NeuralBandClaimStatus => ({...neuralBandInput.claimStatus()}),\n resetClaim: (): void => neuralBandInput.resetClaim(),\n onClaimStatus: (cb: (status: NeuralBandClaimStatus) => void): (() => void) => neuralBandInput.onClaimStatus(cb),\n /** The band's handwriting model; writing arrives on the miniapp keyboard stream. */\n setHandwriting: (id: string, enabled: boolean): Promise<void> => BluetoothSdk.neuralBandSetHandwriting(id, enabled),\n handwritingStatus: (id: string): NeuralBandHandwritingStatus => ({...neuralBandInput.handwritingStatus(id)}),\n onHandwritingStatus: (cb: (update: NeuralBandHandwritingUpdate) => void): (() => void) =>\n neuralBandInput.onHandwritingStatus(cb),\n /** The band's air mouse; movement reaches miniapps on the pointer stream. */\n setPointer: (id: string, enabled: boolean): Promise<void> => BluetoothSdk.neuralBandSetPointer(id, enabled),\n setHand: (id: string, hand: \"left\" | \"right\"): Promise<void> => BluetoothSdk.neuralBandSetHand(id, hand),\n firmwareStatus: (id: string): NeuralBandFirmwareStatus => ({...neuralBandInput.firmwareStatus(id)}),\n onFirmwareStatus: (cb: (update: {id: string; status: NeuralBandFirmwareStatus}) => void): (() => void) =>\n neuralBandInput.onFirmwareStatus(cb),\n refreshFirmware: async (id: string): Promise<NeuralBandFirmwareStatus> => {\n const info = await BluetoothSdk.neuralBandFirmwareInfo(id)\n neuralBandInput.handleFirmware({\n ...(info as object),\n type: \"neural_band_firmware\",\n controllerId: id,\n } as NeuralBandFirmwareEvent)\n return neuralBandInput.firmwareStatus(id)\n },\n checkFirmware: (id: string): Promise<void> => BluetoothSdk.neuralBandCheckFirmware(id),\n updateFirmware: (id: string, mode: \"update\" | \"cancel\" | \"key\" | \"send\" | \"trial\" | \"install\"): Promise<void> =>\n BluetoothSdk.neuralBandUpdateFirmware(id, mode),\n },\n\n // --- watch: an Apple Watch over WatchConnectivity (iOS), a Wear OS watch over the Data Layer (Android) ---\n watch: {\n /** Whether this phone has a paired watch and the Glassly watch app is on it. */\n availability: (): Promise<WatchAvailability> => BluetoothSdk.watchAvailability(),\n },\n\n // --- audio (glasses media-volume, own-app playback hint, live mic level) ---\n audio: {\n /** Read the glasses' current media volume. */\n getMediaVolume: () => BluetoothSdk.getGlassesMediaVolume(),\n /** Set the glasses' media volume. */\n setMediaVolume: (level: number) => BluetoothSdk.setGlassesMediaVolume(level),\n /** Tell native whether THIS app is currently playing audio (for ducking). */\n setOwnAppPlaying: (playing: boolean): Promise<void> => BluetoothSdk.setOwnAppAudioPlaying(playing),\n /**\n * Stream the active mic's level in dBFS, one reading per PCM chunk. Holds\n * raw PCM open while subscribed, so the mic runs with no miniapp listening,\n * and holds the G2 volume gate open so the meter shows the ambient level.\n */\n onMicLevel: (cb: (dbfs: number) => void): (() => void) => {\n const owner = `mic_level_${++micLevelSubscriptions}`\n micStateCoordinator.acquireHostPcm(owner)\n const sub = BluetoothSdk.addListener(\"mic_pcm\", (event: {pcm: ArrayBuffer | Uint8Array}) => {\n if (event?.pcm) cb(pcmLevelDbfs(event.pcm))\n })\n return () => {\n sub.remove()\n micStateCoordinator.releaseHostPcm(owner)\n }\n },\n },\n\n // --- sub-facades ---\n wifi: glassesWifi,\n settings: glassesSettings,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/facades/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,kFAAkF;AAClF,sFAAsF;AACtF,uEAAuE;AACvE,OAAO,YAAY,MAAM,iCAAiC,CAAA;AAa1D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAA;AACjE,OAAO,mBAAmB,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,6BAA6B,CAAA;AAClE,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,gBAAgB,GACjB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC/E,OAAO,EAAC,wBAAwB,EAAC,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAC,iBAAiB,EAAE,qBAAqB,EAAE,gBAAgB,EAAC,MAAM,yBAAyB,CAAA;AAClG,OAAO,eAKN,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAC,qCAAqC,EAAC,MAAM,gCAAgC,CAAA;AACpF,OAAO,EAAC,oBAAoB,EAAm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AAgB,EAAE;YACvD,MAAM,KAAK,GAAG,aAAa,EAAE,qBAAqB,EAAE,CAAA;YACpD,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;YACzC,MAAM,GAAG,GAAG,YAAY,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,KAAsC,EAAE,EAAE;gBACzF,IAAI,KAAK,EAAE,GAAG;oBAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;YAC7C,CAAC,CAAC,CAAA;YACF,OAAO,GAAG,EAAE;gBACV,GAAG,CAAC,MAAM,EAAE,CAAA;gBACZ,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;YAC3C,CAAC,CAAA;QACH,CAAC;KACF;IAED,sBAAsB;IACtB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,eAAe;CAC1B,CAAA","sourcesContent":["/**\n * glasses facade — the core `engine.glasses.*` surface: connection actions (over\n * the bluetooth-sdk passthrough), a curated status/info read-model (projected from\n * the engine-owned glasses store), capabilities (from the model table), and the\n * discrete input events. The `wifi` sub-facade is nested here.\n *\n * Read-models project the raw glasses store into the stable shape OEM UIs consume,\n * so the device store's field layout doesn't leak into every screen.\n */\n// Internal btsdk surface — connectSimulated/reconnect/controller live on the full\n// surface, not the public entry. Relative path (the alias doesn't resolve in engine's\n// standalone build); jest moduleNameMapper + tsconfig both resolve it.\nimport BluetoothSdk from \"@glassly/bluetooth-sdk/internal\"\nimport type {\n WatchAvailability,\n ButtonPressEvent,\n ConnectOptions,\n ControllerStatus,\n Device,\n KeyboardAdvertEvent,\n KeyboardPairingEvent,\n NeuralBandFirmwareEvent,\n PairedController,\n TouchEvent,\n} from \"@glassly/bluetooth-sdk\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {hasDefaultDevice} from \"../services/DeviceStoreHydration\"\nimport micStateCoordinator from \"../services/MicStateCoordinator\"\nimport {projectPairingIdentity} from \"../services/PairingIdentity\"\nimport {\n fixtureControllerList,\n fixtureControllerStatuses,\n fixtureInfo,\n fixtureStatus,\n isScreenshotMode,\n} from \"../services/ScreenshotFixture\"\nimport {isGlassesConnected, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {pushAllBluetoothSettings} from \"../services/GlassesSettingsSync\"\nimport {isControllerReady, pairedControllersFrom, readyControllers} from \"../services/controllers\"\nimport neuralBandInput, {\n type NeuralBandClaimStatus,\n type NeuralBandFirmwareStatus,\n type NeuralBandHandwritingStatus,\n type NeuralBandHandwritingUpdate,\n} from \"../services/neuralBand/NeuralBandInput\"\nimport {recordSupportProfileConnectionFailure} from \"../services/SupportProfileSync\"\nimport {getModelCapabilities, type DeviceTypes} from \"../types\"\nimport {pcmLevelDbfs} from \"../utils/audio/pcmLevel\"\nimport {glassesWifi} from \"./glassesWifi\"\nimport {glassesSettings} from \"./glassesSettings\"\n\nlet micLevelSubscriptions = 0\n\n// The screenshot fixture (ScreenshotFixture.ts) dresses these read-models\n// while the identity is the simulated device; it is a no-op outside that build.\nfunction projectStatus() {\n const s = useGlassesStore.getState()\n return fixtureStatus(\n {\n state: s.connection.state,\n fullyBooted: isGlassesReady(s.connection),\n battery: s.batteryLevel,\n charging: s.charging,\n case: {battery: s.caseBatteryLevel, charging: s.caseCharging, open: s.caseOpen, removed: s.caseRemoved},\n signal: s.signalStrength,\n micEnabled: s.micEnabled,\n vadEnabled: s.voiceActivityDetectionEnabled,\n btClassic: s.bluetoothClassicConnected,\n // iOS: glasses may read the phone's ANCS stream (\"Share System Notifications\").\n ancsAuthorized: Boolean(s.ancsAuthorized),\n },\n projectPairingIdentity(),\n )\n}\n\nfunction projectControllerList(): PairedController[] {\n return fixtureControllerList(\n pairedControllersFrom(useSettingsStore.getState().getSetting(SETTINGS.controllers.key)),\n projectPairingIdentity(),\n )\n}\n\n// Copies: snapshots must not hand callers mutable references into the store.\nfunction projectControllerStatuses(): Record<string, ControllerStatus> {\n const statuses: Record<string, ControllerStatus> = {}\n for (const [id, status] of Object.entries(useGlassesStore.getState().controllers ?? {})) {\n statuses[id] = {...status}\n }\n return fixtureControllerStatuses(statuses, projectPairingIdentity())\n}\n\n// Dedupe on the projected snapshot: the store updates on many fields; fire\n// only when the projection changes. The fixture's read-models also follow the\n// identity (a settings key), so that build watches the settings store too.\nfunction subscribeProjection<T>(project: () => T, cb: (snapshot: T) => void): () => void {\n let last = JSON.stringify(project())\n const notify = () => {\n const snap = project()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n }\n const unsubscribeGlasses = useGlassesStore.subscribe(notify)\n const unsubscribeSettings = isScreenshotMode() ? useSettingsStore.subscribe(notify) : () => {}\n return () => {\n unsubscribeGlasses()\n unsubscribeSettings()\n }\n}\n\nfunction projectKeyboardStatus() {\n const s = useGlassesStore.getState()\n return {\n /** Connected glasses run a firmware that can host a keyboard (G2 Glassly CFW 39+). */\n available: isGlassesReady(s.connection) && s.keyboardBridge === true,\n connected: s.keyboardConnected === true,\n name: s.keyboardName ?? \"\",\n /** A keyboard is remembered and reconnects automatically. */\n saved: s.keyboardSaved === true,\n state: s.keyboardState ?? \"idle\",\n error: s.keyboardError ?? \"\",\n }\n}\n\nfunction projectInfo() {\n const s = useGlassesStore.getState()\n return fixtureInfo(projectRawInfo(s), projectPairingIdentity())\n}\n\nfunction projectRawInfo(s: ReturnType<typeof useGlassesStore.getState>) {\n return {\n model: s.deviceModel,\n style: s.style,\n color: s.color,\n bluetoothName: s.bluetoothName,\n firmwareVersion: s.firmwareVersion,\n mtkFirmware: s.mtkFirmwareVersion,\n besFirmware: s.besFirmwareVersion,\n appVersion: s.appVersion,\n androidVersion: s.androidVersion,\n serialNumber: s.serialNumber,\n buildNumber: s.buildNumber,\n btMac: s.bluetoothMacAddress,\n wifiMac: s.wifiMacAddress,\n leftMac: s.leftMacAddress,\n rightMac: s.rightMacAddress,\n sceneCanvasWidth: s.sceneCanvasWidth,\n sceneCanvasHeight: s.sceneCanvasHeight,\n volumeGate: s.volumeGate === true,\n firmwareUpdateAvailable: s.firmwareUpdateAvailable === true,\n // Copy: the snapshot must not hand callers a mutable reference into the store.\n wifi: {...s.wifi},\n }\n}\n\nexport type GlassesStatusSnapshot = ReturnType<typeof projectStatus>\nexport type KeyboardStatusSnapshot = ReturnType<typeof projectKeyboardStatus>\nexport type GlassesInfoSnapshot = ReturnType<typeof projectInfo>\n\nexport const glasses = {\n // --- connection (bluetooth-sdk passthrough) ---\n /**\n * Reconnect the default wearable. Seeds the phone's current device settings to\n * native first, so they're primed before the connect handshake replays them to\n * the glasses (this used to be a host-side step before `connectDefault`).\n */\n connectDefault: async (): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect_default\")\n throw error\n }\n },\n disconnect: (): Promise<void> => BluetoothSdk.disconnect(),\n forget: (): Promise<void> => BluetoothSdk.forget(),\n /** Connect to a specific (discovered) device. */\n connect: async (device: Device, options?: ConnectOptions): Promise<void> => {\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connect(device, options)\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"connect\")\n throw error\n }\n },\n /** Connect the built-in simulated glasses (dev/testing). */\n connectSimulated: (): Promise<void> => BluetoothSdk.connectSimulated(),\n /** Set a device as the `connectDefault()` target. */\n setDefault: (device: Device | null): Promise<void> => BluetoothSdk.setDefaultDevice(device),\n /**\n * Reconnect to the saved default glasses. Resolves `false` when there's nothing to\n * reconnect to (no default paired) or the connect attempt fails (e.g. BLE powered\n * off), `true` when already connected or after kicking off the connect. Never\n * rejects — the boolean contract holds. The host gates connectivity/permissions\n * (its UI) before calling.\n */\n reconnect: async (): Promise<boolean> => {\n const defaultWearable = useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key)\n if (!defaultWearable) return false\n if (isGlassesConnected(useGlassesStore.getState().connection)) return true\n try {\n await pushAllBluetoothSettings()\n await BluetoothSdk.connectDefault()\n } catch (error) {\n recordSupportProfileConnectionFailure(error, \"reconnect\")\n console.warn(\"engine.glasses.reconnect failed:\", error)\n return false\n }\n return true\n },\n /** True when no glasses has ever been paired NOR selected (the pairing-identity\n * lifecycle is in its `none` state) — e.g. to route a first-run host into the\n * pairing/onboarding flow. A pending selection is not \"first\" — the host should\n * offer finish-pairing (see `engine.pairing.identity()`). */\n isFirstPairing: (): boolean => projectPairingIdentity().kind === \"none\",\n /**\n * True when the SDK has an actual default DEVICE to reconnect to. Distinct from\n * `default_wearable` (a model string that a pending or orphaned selection can\n * hold without any paired device): connectDefault() throws without a device, so\n * hosts should route to the pairing flow when this is false.\n *\n * Hydration-aware: awaits the device-store seed internally, so a cold-start\n * read can't see a false \"absent\" for genuinely-paired users. Rejects if\n * hydration failed — callers guarding destructive or routing decisions must\n * fail open (treat as \"has a device\").\n */\n hasDefaultDevice: (): Promise<boolean> => hasDefaultDevice(),\n\n // --- read-model (projected from the engine-owned glasses store) ---\n status: (): GlassesStatusSnapshot => projectStatus(),\n onStatus: (cb: (status: GlassesStatusSnapshot) => void): (() => void) => subscribeProjection(projectStatus, cb),\n info: (): GlassesInfoSnapshot => projectInfo(),\n onInfo: (cb: (info: GlassesInfoSnapshot) => void): (() => void) => subscribeProjection(projectInfo, cb),\n capabilities: () => getModelCapabilities(useGlassesStore.getState().deviceModel as DeviceTypes),\n /** Ask the glasses to report fresh firmware/version info (updates the store). */\n requestVersionInfo: () => BluetoothSdk.requestVersionInfo(),\n\n // --- discrete input events (passthrough listeners) ---\n onButtonPress: (cb: (event: ButtonPressEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"button_press\", cb)\n return () => sub.remove()\n },\n onTouchGesture: (cb: (event: TouchEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"touch_event\", cb)\n return () => sub.remove()\n },\n\n // --- BLE keyboard bridged through G2 Glassly CFW (revision 39+) ---\n keyboard: {\n /** Five-second scan; distinct advertisers, HID ones flagged. Also streams via onAdvert. */\n scan: (): Promise<KeyboardAdvertEvent[]> => BluetoothSdk.g2KeyboardScan(),\n /** Connect, pair and subscribe; the keyboard is remembered and auto-reconnected. */\n connect: async (device: {address: string; addressType: number; name: string}): Promise<void> => {\n await BluetoothSdk.g2KeyboardConnect(device.address, device.addressType, device.name)\n useSettingsStore.getState().setSetting(SETTINGS.keyboard_name.key, device.name)\n },\n reconnect: (): Promise<void> => BluetoothSdk.g2KeyboardReconnect(),\n disconnect: (): Promise<void> => BluetoothSdk.g2KeyboardDisconnect(),\n forget: async (): Promise<void> => {\n await BluetoothSdk.g2KeyboardForget()\n useSettingsStore.getState().setSetting(SETTINGS.keyboard_name.key, \"\")\n },\n passkey: (pin: number): Promise<void> => BluetoothSdk.g2KeyboardPasskey(pin),\n compare: (accept: boolean): Promise<void> => BluetoothSdk.g2KeyboardCompare(accept),\n status: (): KeyboardStatusSnapshot => projectKeyboardStatus(),\n onStatus: (cb: (status: KeyboardStatusSnapshot) => void): (() => void) => {\n let last = JSON.stringify(projectKeyboardStatus())\n return useGlassesStore.subscribe(() => {\n const snap = projectKeyboardStatus()\n const key = JSON.stringify(snap)\n if (key === last) return\n last = key\n cb(snap)\n })\n },\n onAdvert: (cb: (advert: KeyboardAdvertEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"keyboard_advert\", cb)\n return () => sub.remove()\n },\n onPairing: (cb: (prompt: KeyboardPairingEvent) => void): (() => void) => {\n const sub = BluetoothSdk.addListener(\"keyboard_pairing\", cb)\n return () => sub.remove()\n },\n },\n\n // --- controllers (input accessories linked to the phone), by registry id ---\n controllers: {\n /** Paired controllers in pairing order. */\n list: (): PairedController[] => projectControllerList(),\n onList: (cb: (controllers: PairedController[]) => void): (() => void) => {\n let last = JSON.stringify(projectControllerList())\n return useSettingsStore.subscribe(() => {\n const list = projectControllerList()\n const key = JSON.stringify(list)\n if (key === last) return\n last = key\n cb(list)\n })\n },\n /** Live driver statuses by id; a paired controller without an entry is idle. */\n statuses: (): Record<string, ControllerStatus> => projectControllerStatuses(),\n status: (id: string): ControllerStatus | undefined => projectControllerStatuses()[id],\n onStatus: (cb: (statuses: Record<string, ControllerStatus>) => void): (() => void) =>\n subscribeProjection(projectControllerStatuses, cb),\n /** Controllers delivering input (linked, route or claim done). */\n connected: (): ControllerStatus[] => readyControllers(projectControllerStatuses()),\n isConnected: (model?: string): boolean =>\n Object.values(projectControllerStatuses()).some(\n (status) => isControllerReady(status) && (model === undefined || status.model === model),\n ),\n connect: (id: string): Promise<void> => BluetoothSdk.connectController(id),\n /** Reconnect every paired controller that is not connected. */\n connectAll: (): Promise<void> => BluetoothSdk.connectControllers(),\n /** Drop an in-flight controller scan or pairing; paired records are untouched. */\n cancelAttempt: (): Promise<void> => BluetoothSdk.cancelControllerAttempt(),\n /** Disconnect; the controller stays paired. */\n disconnect: (id: string): Promise<void> => BluetoothSdk.disconnectController(id),\n forget: async (id: string): Promise<void> => {\n await BluetoothSdk.forgetController(id)\n neuralBandInput.forget(id)\n },\n },\n\n // --- Meta Neural Band (a controller with a claim step and its own features), by controller id ---\n neuralBand: {\n /** Store the Meta account session the one-time band claim uses (account-wide). */\n setMetaSession: (accessToken: string, userId: string): Promise<void> =>\n BluetoothSdk.neuralBandSetMetaSession(accessToken, userId),\n clearMetaSession: (): Promise<void> => BluetoothSdk.neuralBandClearMetaSession(),\n hasMetaSession: (): Promise<boolean> => BluetoothSdk.neuralBandHasMetaSession(),\n /** This band's identity is stored on this phone, so it reconnects without a claim. */\n isClaimed: (id: string): Promise<boolean> => BluetoothSdk.neuralBandIsClaimed(id),\n /** The latest claim progress of any band (with its `controllerId`), kept across screens. */\n claimStatus: (): NeuralBandClaimStatus => ({...neuralBandInput.claimStatus()}),\n resetClaim: (): void => neuralBandInput.resetClaim(),\n onClaimStatus: (cb: (status: NeuralBandClaimStatus) => void): (() => void) => neuralBandInput.onClaimStatus(cb),\n /** The band's handwriting model; writing arrives on the miniapp keyboard stream. */\n setHandwriting: (id: string, enabled: boolean): Promise<void> => BluetoothSdk.neuralBandSetHandwriting(id, enabled),\n handwritingStatus: (id: string): NeuralBandHandwritingStatus => ({...neuralBandInput.handwritingStatus(id)}),\n onHandwritingStatus: (cb: (update: NeuralBandHandwritingUpdate) => void): (() => void) =>\n neuralBandInput.onHandwritingStatus(cb),\n /** The band's air mouse; movement reaches miniapps on the pointer stream. */\n setPointer: (id: string, enabled: boolean): Promise<void> => BluetoothSdk.neuralBandSetPointer(id, enabled),\n setHand: (id: string, hand: \"left\" | \"right\"): Promise<void> => BluetoothSdk.neuralBandSetHand(id, hand),\n firmwareStatus: (id: string): NeuralBandFirmwareStatus => ({...neuralBandInput.firmwareStatus(id)}),\n onFirmwareStatus: (cb: (update: {id: string; status: NeuralBandFirmwareStatus}) => void): (() => void) =>\n neuralBandInput.onFirmwareStatus(cb),\n refreshFirmware: async (id: string): Promise<NeuralBandFirmwareStatus> => {\n const info = await BluetoothSdk.neuralBandFirmwareInfo(id)\n neuralBandInput.handleFirmware({\n ...(info as object),\n type: \"neural_band_firmware\",\n controllerId: id,\n } as NeuralBandFirmwareEvent)\n return neuralBandInput.firmwareStatus(id)\n },\n checkFirmware: (id: string): Promise<void> => BluetoothSdk.neuralBandCheckFirmware(id),\n updateFirmware: (id: string, mode: \"update\" | \"cancel\" | \"key\" | \"send\" | \"trial\" | \"install\"): Promise<void> =>\n BluetoothSdk.neuralBandUpdateFirmware(id, mode),\n },\n\n // --- watch: an Apple Watch over WatchConnectivity (iOS), a Wear OS watch over the Data Layer (Android) ---\n watch: {\n /** Whether this phone has a paired watch and the Glassly watch app is on it. */\n availability: (): Promise<WatchAvailability> => BluetoothSdk.watchAvailability(),\n },\n\n // --- audio (glasses media-volume, own-app playback hint, live mic level) ---\n audio: {\n /** Read the glasses' current media volume. */\n getMediaVolume: () => BluetoothSdk.getGlassesMediaVolume(),\n /** Set the glasses' media volume. */\n setMediaVolume: (level: number) => BluetoothSdk.setGlassesMediaVolume(level),\n /** Tell native whether THIS app is currently playing audio (for ducking). */\n setOwnAppPlaying: (playing: boolean): Promise<void> => BluetoothSdk.setOwnAppAudioPlaying(playing),\n /**\n * Stream the active mic's level in dBFS, one reading per PCM chunk. Holds\n * raw PCM open while subscribed, so the mic runs with no miniapp listening,\n * and holds the G2 volume gate open so the meter shows the ambient level.\n */\n onMicLevel: (cb: (dbfs: number) => void): (() => void) => {\n const owner = `mic_level_${++micLevelSubscriptions}`\n micStateCoordinator.acquireHostPcm(owner)\n const sub = BluetoothSdk.addListener(\"mic_pcm\", (event: {pcm: ArrayBuffer | Uint8Array}) => {\n if (event?.pcm) cb(pcmLevelDbfs(event.pcm))\n })\n return () => {\n sub.remove()\n micStateCoordinator.releaseHostPcm(owner)\n }\n },\n },\n\n // --- sub-facades ---\n wifi: glassesWifi,\n settings: glassesSettings,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/facades/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAoB,kBAAkB,EAAE,KAAK,UAAU,IAAI,iBAAiB,EAAC,MAAM,cAAc,CAAA;AAIxG,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAA;AAE9C,uEAAuE;AACvE,eAAO,MAAM,kBAAkB;;;;;;;;;;CAUrB,CAAA;AAMV,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,MAAM,EACvB,kBAAkB,GAAE,OAAO,kBAAkB,CAAC,WAAqB,GAClE,iBAAiB,CAEnB;AAgFD,eAAO,MAAM,WAAW;IACtB,gGAAgG;kCAC5D,SAAS,gBAAgB,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/facades/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAoB,kBAAkB,EAAE,KAAK,UAAU,IAAI,iBAAiB,EAAC,MAAM,cAAc,CAAA;AAIxG,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAA;AAE9C,uEAAuE;AACvE,eAAO,MAAM,kBAAkB;;;;;;;;;;CAUrB,CAAA;AAMV,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,MAAM,EACvB,kBAAkB,GAAE,OAAO,kBAAkB,CAAC,WAAqB,GAClE,iBAAiB,CAEnB;AAgFD,eAAO,MAAM,WAAW;IACtB,gGAAgG;kCAC5D,SAAS,gBAAgB,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA2CnF,8DAA8D;mBACzC,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAmB9C,mFAAmF;qBAC5D,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAmBhD,6EAA6E;wBAC3D,OAAO,CAAC,IAAI,CAAC;IAE/B,mEAAmE;wCACzB,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAI/E,CAAA"}
|
|
@@ -112,14 +112,12 @@ export const permissions = {
|
|
|
112
112
|
features.add(PermissionFeatures.CALENDAR);
|
|
113
113
|
features.add(PermissionFeatures.LOCATION);
|
|
114
114
|
features.add(PermissionFeatures.BACKGROUND_LOCATION);
|
|
115
|
-
features.add(PermissionFeatures.POST_NOTIFICATIONS);
|
|
116
115
|
features.add("read_notifications");
|
|
117
116
|
break;
|
|
118
117
|
case "MICROPHONE":
|
|
119
118
|
case "CALENDAR":
|
|
120
119
|
case "LOCATION":
|
|
121
120
|
case "BACKGROUND_LOCATION":
|
|
122
|
-
case "POST_NOTIFICATIONS":
|
|
123
121
|
features.add(PermissionFeatures[permission.type]);
|
|
124
122
|
break;
|
|
125
123
|
case "READ_NOTIFICATIONS":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../src/facades/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE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,OAAO,CAAC,OAAO;gBAAE,OAAO,GAAG,KAAK,CAAA;QAC/E,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,6EAA6E;IAC7E,YAAY,EAAE,GAAkB,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE;IAEzD,mEAAmE;IACnE,KAAK,CAAC,sBAAsB,CAAC,WAAmB;QAC9C,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,oBAAoB,EAAE,CAAA;QACrD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,EAAE,WAAW,IAAI,EAAE,CAAA;IAC3E,CAAC;CACF,CAAA","sourcesContent":["/**\n * permissions facade — `engine.permissions`: the raw OS-permission ops the runtime\n * needs, mapped from feature keys to react-native-permissions. This is the LEAN\n * surface (check/request/openSettings/requirementsForMiniapp) — the host keeps its\n * own UI helpers (rationale dialogs, denied-warnings) on top; engine stays free of\n * i18n/theme/AlertUtils.\n */\nimport {Platform, Linking, PermissionsAndroid, type Permission as AndroidPermission} from \"react-native\"\nimport {check, request, PERMISSIONS, RESULTS, type Permission} from \"react-native-permissions\"\n\nimport appRegistry from \"../services/AppRegistry\"\nimport type {AppletPermission} from \"../types\"\n\n/** OEM-facing feature keys (mapped to OS permissions per platform). */\nexport const PermissionFeatures = {\n MICROPHONE: \"microphone\",\n CAMERA: \"camera\",\n CALENDAR: \"calendar\",\n LOCATION: \"location\",\n LOCAL_WIFI: \"local_wifi\",\n BACKGROUND_LOCATION: \"background_location\",\n BLUETOOTH: \"bluetooth\",\n PHONE_STATE: \"phone_state\",\n POST_NOTIFICATIONS: \"post_notifications\",\n} as const\n\nconst ANDROID = PermissionsAndroid.PERMISSIONS\nconst apiLevel = typeof Platform.Version === \"number\" ? Platform.Version : parseInt(String(Platform.Version), 10)\nconst requiresSeparateAndroidBackgroundLocation = apiLevel >= 29\n\nexport function localWifiPermissionForAndroid(\n androidApiLevel: number,\n androidPermissions: typeof PermissionsAndroid.PERMISSIONS = ANDROID,\n): AndroidPermission {\n return androidApiLevel >= 33 ? androidPermissions.NEARBY_WIFI_DEVICES : androidPermissions.ACCESS_FINE_LOCATION\n}\n\nasync function areAndroidPermissionsGranted(perms: AndroidPermission[]): Promise<boolean> {\n for (const p of perms) {\n if (!(await PermissionsAndroid.check(p))) return false\n }\n return true\n}\n\nasync function requestAndroidPermissions(perms: AndroidPermission[]): Promise<boolean> {\n const results = await PermissionsAndroid.requestMultiple(perms)\n return perms.every((p) => results[p] === PermissionsAndroid.RESULTS.GRANTED)\n}\n\nasync function checkAndroidBackgroundLocation(): Promise<boolean> {\n const hasForegroundLocation = await areAndroidPermissionsGranted([ANDROID.ACCESS_FINE_LOCATION])\n if (!hasForegroundLocation || !requiresSeparateAndroidBackgroundLocation) return hasForegroundLocation\n\n return PermissionsAndroid.check(ANDROID.ACCESS_BACKGROUND_LOCATION)\n}\n\nasync function requestAndroidBackgroundLocation(): Promise<boolean> {\n const hasForegroundLocation = await requestAndroidPermissions([ANDROID.ACCESS_FINE_LOCATION])\n if (!hasForegroundLocation || !requiresSeparateAndroidBackgroundLocation) return hasForegroundLocation\n\n if (await PermissionsAndroid.check(ANDROID.ACCESS_BACKGROUND_LOCATION)) return true\n\n const result = await PermissionsAndroid.request(ANDROID.ACCESS_BACKGROUND_LOCATION)\n return result === PermissionsAndroid.RESULTS.GRANTED\n}\n\nfunction iosPerms(feature: string): Permission[] {\n switch (feature) {\n case PermissionFeatures.MICROPHONE:\n return [PERMISSIONS.IOS.MICROPHONE]\n case PermissionFeatures.CAMERA:\n return [PERMISSIONS.IOS.CAMERA]\n case PermissionFeatures.CALENDAR:\n return [PERMISSIONS.IOS.CALENDARS]\n case PermissionFeatures.LOCATION:\n return [PERMISSIONS.IOS.LOCATION_WHEN_IN_USE]\n case PermissionFeatures.LOCAL_WIFI:\n return []\n case PermissionFeatures.BACKGROUND_LOCATION:\n // iOS won't grant ALWAYS without WHEN_IN_USE first — request both (matches\n // the host PermissionsUtils mapping), else a cold request can't escalate.\n return [PERMISSIONS.IOS.LOCATION_WHEN_IN_USE, PERMISSIONS.IOS.LOCATION_ALWAYS]\n case PermissionFeatures.BLUETOOTH:\n return [PERMISSIONS.IOS.BLUETOOTH]\n default:\n return []\n }\n}\n\nfunction androidPerms(feature: string): AndroidPermission[] {\n switch (feature) {\n case PermissionFeatures.MICROPHONE:\n return [ANDROID.RECORD_AUDIO]\n case PermissionFeatures.CAMERA:\n return [ANDROID.CAMERA]\n case PermissionFeatures.CALENDAR:\n // Expo Calendar requires both grants on Android, including for read APIs.\n // The miniapp-facing calendar API remains read-only.\n return [ANDROID.READ_CALENDAR, ANDROID.WRITE_CALENDAR]\n case PermissionFeatures.LOCATION:\n case PermissionFeatures.BACKGROUND_LOCATION:\n return [ANDROID.ACCESS_FINE_LOCATION]\n case PermissionFeatures.LOCAL_WIFI:\n return [localWifiPermissionForAndroid(apiLevel)]\n case PermissionFeatures.PHONE_STATE:\n return [ANDROID.READ_PHONE_STATE]\n case PermissionFeatures.BLUETOOTH:\n return apiLevel >= 31 ? [ANDROID.BLUETOOTH_SCAN, ANDROID.BLUETOOTH_CONNECT, ANDROID.BLUETOOTH_ADVERTISE] : []\n case PermissionFeatures.POST_NOTIFICATIONS:\n return apiLevel >= 33 ? [ANDROID.POST_NOTIFICATIONS] : []\n default:\n return []\n }\n}\n\nexport const permissions = {\n /** Missing required miniapp grants, checked without prompting. CAMERA is the glasses camera. */\n async missingRequired(requirements: readonly AppletPermission[]): Promise<string[]> {\n const features = new Set<string>()\n for (const permission of requirements) {\n if (permission.required === false) continue\n switch (permission.type) {\n case \"ALL\":\n features.add(PermissionFeatures.MICROPHONE)\n features.add(PermissionFeatures.CALENDAR)\n features.add(PermissionFeatures.LOCATION)\n features.add(PermissionFeatures.BACKGROUND_LOCATION)\n features.add(PermissionFeatures.POST_NOTIFICATIONS)\n features.add(\"read_notifications\")\n break\n case \"MICROPHONE\":\n case \"CALENDAR\":\n case \"LOCATION\":\n case \"BACKGROUND_LOCATION\":\n case \"POST_NOTIFICATIONS\":\n features.add(PermissionFeatures[permission.type])\n break\n case \"READ_NOTIFICATIONS\":\n features.add(\"read_notifications\")\n break\n }\n }\n\n const missing: string[] = []\n for (const feature of features) {\n let granted: boolean\n if (feature === \"read_notifications\") {\n // iOS glasses read notifications directly; Android uses the phone's listener.\n granted =\n Platform.OS !== \"android\" ||\n (await (await import(\"@glassly/crust\")).default.hasNotificationListenerPermission())\n } else if (feature === PermissionFeatures.CALENDAR && Platform.OS === \"ios\") {\n // EventKit must allow reads; a scoped/write-only OS grant is insufficient.\n granted = (await (await import(\"expo-calendar\")).getCalendarPermissions()).status === \"granted\"\n } else {\n granted = await permissions.check(feature)\n }\n if (!granted) missing.push(feature)\n }\n return missing\n },\n\n /** Is the given feature's OS permission currently granted? */\n async check(feature: string): Promise<boolean> {\n if (Platform.OS === \"android\") {\n if (feature === PermissionFeatures.BACKGROUND_LOCATION) return checkAndroidBackgroundLocation()\n\n const perms = androidPerms(feature)\n if (perms.length === 0) return true // nothing to ask on this OS/version\n // Every permission in the group must be granted (e.g. bluetooth =\n // scan+connect+advertise, calendar = read+write) — matches the iOS branch.\n return areAndroidPermissionsGranted(perms)\n }\n const perms = iosPerms(feature)\n if (perms.length === 0) return true\n for (const p of perms) {\n const status = await check(p)\n if (status !== RESULTS.GRANTED && status !== RESULTS.LIMITED) return false\n }\n return true\n },\n\n /** Request the given feature's OS permission. Resolves to whether it's granted. */\n async request(feature: string): Promise<boolean> {\n if (Platform.OS === \"android\") {\n if (feature === PermissionFeatures.BACKGROUND_LOCATION) return requestAndroidBackgroundLocation()\n\n const perms = androidPerms(feature)\n if (perms.length === 0) return true\n // Granted only when EVERY permission in the group was granted.\n return requestAndroidPermissions(perms)\n }\n const perms = iosPerms(feature)\n if (perms.length === 0) return true\n let granted = true\n for (const p of perms) {\n const result = await request(p)\n if (result !== RESULTS.GRANTED && result !== RESULTS.LIMITED) granted = false\n }\n return granted\n },\n\n /** Open the OS settings app (so the user can grant a blocked permission). */\n openSettings: (): Promise<void> => Linking.openSettings(),\n\n /** The permissions a given installed miniapp declares it needs. */\n async requirementsForMiniapp(packageName: string): Promise<AppletPermission[]> {\n const apps = await appRegistry.getInstalledMiniapps()\n return apps.find((a) => a.packageName === packageName)?.permissions ?? []\n },\n}\n"]}
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../src/facades/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAuC,MAAM,cAAc,CAAA;AACxG,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAkB,MAAM,0BAA0B,CAAA;AAE9F,OAAO,WAAW,MAAM,yBAAyB,CAAA;AAGjD,uEAAuE;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;IACxB,mBAAmB,EAAE,qBAAqB;IAC1C,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,kBAAkB,EAAE,oBAAoB;CAChC,CAAA;AAEV,MAAM,OAAO,GAAG,kBAAkB,CAAC,WAAW,CAAA;AAC9C,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;AACjH,MAAM,yCAAyC,GAAG,QAAQ,IAAI,EAAE,CAAA;AAEhE,MAAM,UAAU,6BAA6B,CAC3C,eAAuB,EACvB,qBAA4D,OAAO;IAEnE,OAAO,eAAe,IAAI,EAAE,CAAC,CAAC,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QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACnC,IAAI,OAAO,GAAG,IAAI,CAAA;QAClB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,CAAC,CAAC,CAAA;YAC/B,IAAI,MAAM,KAAK,OAAO,CAAC,OAAO,IAAI,MAAM,KAAK,OAAO,CAAC,OAAO;gBAAE,OAAO,GAAG,KAAK,CAAA;QAC/E,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,6EAA6E;IAC7E,YAAY,EAAE,GAAkB,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE;IAEzD,mEAAmE;IACnE,KAAK,CAAC,sBAAsB,CAAC,WAAmB;QAC9C,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,oBAAoB,EAAE,CAAA;QACrD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,EAAE,WAAW,IAAI,EAAE,CAAA;IAC3E,CAAC;CACF,CAAA","sourcesContent":["/**\n * permissions facade — `engine.permissions`: the raw OS-permission ops the runtime\n * needs, mapped from feature keys to react-native-permissions. This is the LEAN\n * surface (check/request/openSettings/requirementsForMiniapp) — the host keeps its\n * own UI helpers (rationale dialogs, denied-warnings) on top; engine stays free of\n * i18n/theme/AlertUtils.\n */\nimport {Platform, Linking, PermissionsAndroid, type Permission as AndroidPermission} from \"react-native\"\nimport {check, request, PERMISSIONS, RESULTS, type Permission} from \"react-native-permissions\"\n\nimport appRegistry from \"../services/AppRegistry\"\nimport type {AppletPermission} from \"../types\"\n\n/** OEM-facing feature keys (mapped to OS permissions per platform). */\nexport const PermissionFeatures = {\n MICROPHONE: \"microphone\",\n CAMERA: \"camera\",\n CALENDAR: \"calendar\",\n LOCATION: \"location\",\n LOCAL_WIFI: \"local_wifi\",\n BACKGROUND_LOCATION: \"background_location\",\n BLUETOOTH: \"bluetooth\",\n PHONE_STATE: \"phone_state\",\n POST_NOTIFICATIONS: \"post_notifications\",\n} as const\n\nconst ANDROID = PermissionsAndroid.PERMISSIONS\nconst apiLevel = typeof Platform.Version === \"number\" ? Platform.Version : parseInt(String(Platform.Version), 10)\nconst requiresSeparateAndroidBackgroundLocation = apiLevel >= 29\n\nexport function localWifiPermissionForAndroid(\n androidApiLevel: number,\n androidPermissions: typeof PermissionsAndroid.PERMISSIONS = ANDROID,\n): AndroidPermission {\n return androidApiLevel >= 33 ? androidPermissions.NEARBY_WIFI_DEVICES : androidPermissions.ACCESS_FINE_LOCATION\n}\n\nasync function areAndroidPermissionsGranted(perms: AndroidPermission[]): Promise<boolean> {\n for (const p of perms) {\n if (!(await PermissionsAndroid.check(p))) return false\n }\n return true\n}\n\nasync function requestAndroidPermissions(perms: AndroidPermission[]): Promise<boolean> {\n const results = await PermissionsAndroid.requestMultiple(perms)\n return perms.every((p) => results[p] === PermissionsAndroid.RESULTS.GRANTED)\n}\n\nasync function checkAndroidBackgroundLocation(): Promise<boolean> {\n const hasForegroundLocation = await areAndroidPermissionsGranted([ANDROID.ACCESS_FINE_LOCATION])\n if (!hasForegroundLocation || !requiresSeparateAndroidBackgroundLocation) return hasForegroundLocation\n\n return PermissionsAndroid.check(ANDROID.ACCESS_BACKGROUND_LOCATION)\n}\n\nasync function requestAndroidBackgroundLocation(): Promise<boolean> {\n const hasForegroundLocation = await requestAndroidPermissions([ANDROID.ACCESS_FINE_LOCATION])\n if (!hasForegroundLocation || !requiresSeparateAndroidBackgroundLocation) return hasForegroundLocation\n\n if (await PermissionsAndroid.check(ANDROID.ACCESS_BACKGROUND_LOCATION)) return true\n\n const result = await PermissionsAndroid.request(ANDROID.ACCESS_BACKGROUND_LOCATION)\n return result === PermissionsAndroid.RESULTS.GRANTED\n}\n\nfunction iosPerms(feature: string): Permission[] {\n switch (feature) {\n case PermissionFeatures.MICROPHONE:\n return [PERMISSIONS.IOS.MICROPHONE]\n case PermissionFeatures.CAMERA:\n return [PERMISSIONS.IOS.CAMERA]\n case PermissionFeatures.CALENDAR:\n return [PERMISSIONS.IOS.CALENDARS]\n case PermissionFeatures.LOCATION:\n return [PERMISSIONS.IOS.LOCATION_WHEN_IN_USE]\n case PermissionFeatures.LOCAL_WIFI:\n return []\n case PermissionFeatures.BACKGROUND_LOCATION:\n // iOS won't grant ALWAYS without WHEN_IN_USE first — request both (matches\n // the host PermissionsUtils mapping), else a cold request can't escalate.\n return [PERMISSIONS.IOS.LOCATION_WHEN_IN_USE, PERMISSIONS.IOS.LOCATION_ALWAYS]\n case PermissionFeatures.BLUETOOTH:\n return [PERMISSIONS.IOS.BLUETOOTH]\n default:\n return []\n }\n}\n\nfunction androidPerms(feature: string): AndroidPermission[] {\n switch (feature) {\n case PermissionFeatures.MICROPHONE:\n return [ANDROID.RECORD_AUDIO]\n case PermissionFeatures.CAMERA:\n return [ANDROID.CAMERA]\n case PermissionFeatures.CALENDAR:\n // Expo Calendar requires both grants on Android, including for read APIs.\n // The miniapp-facing calendar API remains read-only.\n return [ANDROID.READ_CALENDAR, ANDROID.WRITE_CALENDAR]\n case PermissionFeatures.LOCATION:\n case PermissionFeatures.BACKGROUND_LOCATION:\n return [ANDROID.ACCESS_FINE_LOCATION]\n case PermissionFeatures.LOCAL_WIFI:\n return [localWifiPermissionForAndroid(apiLevel)]\n case PermissionFeatures.PHONE_STATE:\n return [ANDROID.READ_PHONE_STATE]\n case PermissionFeatures.BLUETOOTH:\n return apiLevel >= 31 ? [ANDROID.BLUETOOTH_SCAN, ANDROID.BLUETOOTH_CONNECT, ANDROID.BLUETOOTH_ADVERTISE] : []\n case PermissionFeatures.POST_NOTIFICATIONS:\n return apiLevel >= 33 ? [ANDROID.POST_NOTIFICATIONS] : []\n default:\n return []\n }\n}\n\nexport const permissions = {\n /** Missing required miniapp grants, checked without prompting. CAMERA is the glasses camera. */\n async missingRequired(requirements: readonly AppletPermission[]): Promise<string[]> {\n const features = new Set<string>()\n for (const permission of requirements) {\n if (permission.required === false) continue\n switch (permission.type) {\n case \"ALL\":\n features.add(PermissionFeatures.MICROPHONE)\n features.add(PermissionFeatures.CALENDAR)\n features.add(PermissionFeatures.LOCATION)\n features.add(PermissionFeatures.BACKGROUND_LOCATION)\n features.add(\"read_notifications\")\n break\n case \"MICROPHONE\":\n case \"CALENDAR\":\n case \"LOCATION\":\n case \"BACKGROUND_LOCATION\":\n features.add(PermissionFeatures[permission.type])\n break\n case \"READ_NOTIFICATIONS\":\n features.add(\"read_notifications\")\n break\n }\n }\n\n const missing: string[] = []\n for (const feature of features) {\n let granted: boolean\n if (feature === \"read_notifications\") {\n // iOS glasses read notifications directly; Android uses the phone's listener.\n granted =\n Platform.OS !== \"android\" ||\n (await (await import(\"@glassly/crust\")).default.hasNotificationListenerPermission())\n } else if (feature === PermissionFeatures.CALENDAR && Platform.OS === \"ios\") {\n // EventKit must allow reads; a scoped/write-only OS grant is insufficient.\n granted = (await (await import(\"expo-calendar\")).getCalendarPermissions()).status === \"granted\"\n } else {\n granted = await permissions.check(feature)\n }\n if (!granted) missing.push(feature)\n }\n return missing\n },\n\n /** Is the given feature's OS permission currently granted? */\n async check(feature: string): Promise<boolean> {\n if (Platform.OS === \"android\") {\n if (feature === PermissionFeatures.BACKGROUND_LOCATION) return checkAndroidBackgroundLocation()\n\n const perms = androidPerms(feature)\n if (perms.length === 0) return true // nothing to ask on this OS/version\n // Every permission in the group must be granted (e.g. bluetooth =\n // scan+connect+advertise, calendar = read+write) — matches the iOS branch.\n return areAndroidPermissionsGranted(perms)\n }\n const perms = iosPerms(feature)\n if (perms.length === 0) return true\n for (const p of perms) {\n const status = await check(p)\n if (status !== RESULTS.GRANTED && status !== RESULTS.LIMITED) return false\n }\n return true\n },\n\n /** Request the given feature's OS permission. Resolves to whether it's granted. */\n async request(feature: string): Promise<boolean> {\n if (Platform.OS === \"android\") {\n if (feature === PermissionFeatures.BACKGROUND_LOCATION) return requestAndroidBackgroundLocation()\n\n const perms = androidPerms(feature)\n if (perms.length === 0) return true\n // Granted only when EVERY permission in the group was granted.\n return requestAndroidPermissions(perms)\n }\n const perms = iosPerms(feature)\n if (perms.length === 0) return true\n let granted = true\n for (const p of perms) {\n const result = await request(p)\n if (result !== RESULTS.GRANTED && result !== RESULTS.LIMITED) granted = false\n }\n return granted\n },\n\n /** Open the OS settings app (so the user can grant a blocked permission). */\n openSettings: (): Promise<void> => Linking.openSettings(),\n\n /** The permissions a given installed miniapp declares it needs. */\n async requirementsForMiniapp(packageName: string): Promise<AppletPermission[]> {\n const apps = await appRegistry.getInstalledMiniapps()\n return apps.find((a) => a.packageName === packageName)?.permissions ?? []\n },\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { PhoneNotificationEvent } from "@glassly/crust";
|
|
2
2
|
import type { GlassesNotificationStatus, NotificationUploadResult } from "@glassly/bluetooth-sdk";
|
|
3
3
|
import { captureAuthorization, currentPresentationOwner, installedNotificationApps, nativeNotificationPopupSeconds, nativeNotificationsSupported } from "../services/PhoneNotificationsSync";
|
|
4
|
+
import { type MiniappNotificationEvent } from "../services/notifications/miniappNotifications";
|
|
5
|
+
export type { MiniappNotificationEvent } from "../services/notifications/miniappNotifications";
|
|
4
6
|
export declare const phoneNotifications: {
|
|
5
7
|
/**
|
|
6
8
|
* Apps to show in the notification filter UI (package/bundle id, name, icon).
|
|
@@ -27,6 +29,11 @@ export declare const phoneNotifications: {
|
|
|
27
29
|
* surface runs and draw only when the answer is `host`.
|
|
28
30
|
*/
|
|
29
31
|
presentationOwner: typeof currentPresentationOwner;
|
|
32
|
+
/**
|
|
33
|
+
* Notifications miniapps post and dismiss. Hosts feed them to the same
|
|
34
|
+
* fan-out as the phone's, marked `system: false` with `source` set.
|
|
35
|
+
*/
|
|
36
|
+
onMiniappNotification: (listener: (event: MiniappNotificationEvent) => void) => (() => void);
|
|
30
37
|
/** Hand a captured notification to firmware that presents uploaded content (owner `firmware`, Android). */
|
|
31
38
|
uploadToGlasses: (event: PhoneNotificationEvent) => Promise<void>;
|
|
32
39
|
/** The driver's view of its notification surface. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phoneNotifications.d.ts","sourceRoot":"","sources":["../../src/facades/phoneNotifications.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAA;AAE1D,OAAO,KAAK,EAAC,yBAAyB,EAAE,wBAAwB,EAAC,MAAM,wBAAwB,CAAA;AAE/F,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,4BAA4B,EAE7B,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"phoneNotifications.d.ts","sourceRoot":"","sources":["../../src/facades/phoneNotifications.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAA;AAE1D,OAAO,KAAK,EAAC,yBAAyB,EAAE,wBAAwB,EAAC,MAAM,wBAAwB,CAAA;AAE/F,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,4BAA4B,EAE7B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAwB,KAAK,wBAAwB,EAAC,MAAM,gDAAgD,CAAA;AAEnH,YAAY,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAA;AAE5F,eAAO,MAAM,kBAAkB;IAC7B;;;;OAIG;;IAGH,wFAAwF;qBACzE,MAAM,EAAE;IAIvB,qCAAqC;iCACR,MAAM,EAAE;IAGrC,qFAAqF;iCAC1D,OAAO,CAAC,OAAO,CAAC;IAI3C,yFAAyF;;IAMzF,qGAAqG;;IAGrG,8DAA8D;;IAE9D,kGAAkG;;IAGlG;;;OAGG;;IAEH;;;OAGG;sCAC+B,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAG1F,2GAA2G;6BAClF,sBAAsB,KAAG,OAAO,CAAC,IAAI,CAAC;IAE/D,qDAAqD;yBAClC,OAAO,CAAC,yBAAyB,CAAC;gCACzB,CAAC,MAAM,EAAE,yBAAyB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;IAItF,yDAAyD;+BAC9B,CAAC,MAAM,EAAE,wBAAwB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;CAIrF,CAAA"}
|
|
@@ -14,6 +14,7 @@ import CrustModule from "@glassly/crust";
|
|
|
14
14
|
import BluetoothSdk from "@glassly/bluetooth-sdk/internal";
|
|
15
15
|
import { useSettingsStore, SETTINGS } from "../stores/settings";
|
|
16
16
|
import { captureAuthorization, currentPresentationOwner, installedNotificationApps, nativeNotificationPopupSeconds, nativeNotificationsSupported, uploadPhoneNotification, } from "../services/PhoneNotificationsSync";
|
|
17
|
+
import { onMiniappNotification } from "../services/notifications/miniappNotifications";
|
|
17
18
|
export const phoneNotifications = {
|
|
18
19
|
/**
|
|
19
20
|
* Apps to show in the notification filter UI (package/bundle id, name, icon).
|
|
@@ -51,6 +52,11 @@ export const phoneNotifications = {
|
|
|
51
52
|
* surface runs and draw only when the answer is `host`.
|
|
52
53
|
*/
|
|
53
54
|
presentationOwner: currentPresentationOwner,
|
|
55
|
+
/**
|
|
56
|
+
* Notifications miniapps post and dismiss. Hosts feed them to the same
|
|
57
|
+
* fan-out as the phone's, marked `system: false` with `source` set.
|
|
58
|
+
*/
|
|
59
|
+
onMiniappNotification: (listener) => onMiniappNotification(listener),
|
|
54
60
|
/** Hand a captured notification to firmware that presents uploaded content (owner `firmware`, Android). */
|
|
55
61
|
uploadToGlasses: (event) => uploadPhoneNotification(event),
|
|
56
62
|
/** The driver's view of its notification surface. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phoneNotifications.js","sourceRoot":"","sources":["../../src/facades/phoneNotifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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F,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAA;IACpC,CAAC;CACF,CAAA","sourcesContent":["/**\n * phoneNotifications facade — `engine.phoneNotifications`: phone notifications\n * on the glasses, with a per-app blocklist and one presentation owner.\n *\n * Capture is the phone's (Android listener) or the glasses' (iOS, reading the\n * phone's stream) business and is never gated here. Presentation is decided\n * by `presentationOwner`: the engine's viewer on Glassly CFW glasses, the\n * firmware on glasses with their own notification centre, else the host's\n * card while its surface (Notify) runs. The four display settings drive\n * firmware and viewer alike; PhoneNotificationsSync pushes them.\n */\nimport {Platform} from \"react-native\"\nimport CrustModule from \"@glassly/crust\"\nimport type {PhoneNotificationEvent} from \"@glassly/crust\"\nimport BluetoothSdk from \"@glassly/bluetooth-sdk/internal\"\nimport type {GlassesNotificationStatus, NotificationUploadResult} from \"@glassly/bluetooth-sdk\"\nimport {useSettingsStore, SETTINGS} from \"../stores/settings\"\nimport {\n captureAuthorization,\n currentPresentationOwner,\n installedNotificationApps,\n nativeNotificationPopupSeconds,\n nativeNotificationsSupported,\n uploadPhoneNotification,\n} from \"../services/PhoneNotificationsSync\"\nimport {onMiniappNotification, type MiniappNotificationEvent} from \"../services/notifications/miniappNotifications\"\n\nexport type {MiniappNotificationEvent} from \"../services/notifications/miniappNotifications\"\n\nexport const phoneNotifications = {\n /**\n * Apps to show in the notification filter UI (package/bundle id, name, icon).\n * Android: installed apps. iOS: seeded catalog ∪ glasses-reported apps\n * (icons unavailable — iOS offers no cross-app icon lookup).\n */\n installedApps: installedNotificationApps,\n\n /** The per-app blocklist (package/bundle ids whose notifications are NOT forwarded). */\n blocklist: (): string[] => {\n const b = useSettingsStore.getState().getSetting(SETTINGS.notifications_blocklist.key)\n return Array.isArray(b) ? b : []\n },\n /** Replace the per-app blocklist. */\n setBlocklist: (packageNames: string[]) =>\n useSettingsStore.getState().setSetting(SETTINGS.notifications_blocklist.key, packageNames),\n\n /** Does the app have the Android notification-listener permission? (false on iOS) */\n hasListenerPermission: (): Promise<boolean> => {\n if (Platform.OS !== \"android\") return Promise.resolve(false)\n return CrustModule.hasNotificationListenerPermission()\n },\n /** Open the OS settings to grant the notification-listener permission. (no-op on iOS) */\n requestListenerPermission: () => {\n if (Platform.OS !== \"android\") return\n return CrustModule.openNotificationListenerSettings()\n },\n\n /** Whether the glasses may read the phone's notifications; `not_needed` where the phone captures. */\n captureAuthorization,\n\n /** The connected model presents notifications in firmware. */\n nativeNotifications: nativeNotificationsSupported,\n /** Popup durations the firmware accepts (seconds, 0 = its default); empty when any value goes. */\n popupSecondsOptions: nativeNotificationPopupSeconds,\n\n /**\n * Who presents the next phone notification. Hosts pass whether their own\n * surface runs and draw only when the answer is `host`.\n */\n presentationOwner: currentPresentationOwner,\n /**\n * Notifications miniapps post and dismiss. Hosts feed them to the same\n * fan-out as the phone's, marked `system: false` with `source` set.\n */\n onMiniappNotification: (listener: (event: MiniappNotificationEvent) => void): (() => void) =>\n onMiniappNotification(listener),\n\n /** Hand a captured notification to firmware that presents uploaded content (owner `firmware`, Android). */\n uploadToGlasses: (event: PhoneNotificationEvent): Promise<void> => uploadPhoneNotification(event),\n\n /** The driver's view of its notification surface. */\n glassesStatus: (): Promise<GlassesNotificationStatus> => BluetoothSdk.getGlassesNotificationStatus(),\n onGlassesStatus: (listener: (status: GlassesNotificationStatus) => void): (() => void) => {\n const subscription = BluetoothSdk.addListener(\"glasses_notification_status\", listener)\n return () => subscription.remove()\n },\n /** Upload outcomes by id; content never travels back. */\n onUploadResult: (listener: (result: NotificationUploadResult) => void): (() => void) => {\n const subscription = BluetoothSdk.addListener(\"notification_upload_result\", listener)\n return () => subscription.remove()\n },\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* providerKeys facade — `engine.providerKeys.{anthropic,gemini,openai,deepseek,elevenlabs}`:
|
|
3
3
|
* validate-before-save probes for the user-supplied AI/voice provider keys
|
|
4
|
-
* (Settings > API Keys). Same per-provider shape as `engine.maps.mapbox` /
|
|
4
|
+
* (Settings > Privacy > API Keys). Same per-provider shape as `engine.maps.mapbox` /
|
|
5
5
|
* `engine.speech.sonioxDirect` so the Keys screen treats providers uniformly.
|
|
6
6
|
*/
|
|
7
7
|
import { validateAnthropicApiKey, validateDeepSeekApiKey, validateElevenLabsApiKey, validateGeminiApiKey, validateOpenAiApiKey } from "../services/ProviderKeyValidation";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* providerKeys facade — `engine.providerKeys.{anthropic,gemini,openai,deepseek,elevenlabs}`:
|
|
3
3
|
* validate-before-save probes for the user-supplied AI/voice provider keys
|
|
4
|
-
* (Settings > API Keys). Same per-provider shape as `engine.maps.mapbox` /
|
|
4
|
+
* (Settings > Privacy > API Keys). Same per-provider shape as `engine.maps.mapbox` /
|
|
5
5
|
* `engine.speech.sonioxDirect` so the Keys screen treats providers uniformly.
|
|
6
6
|
*/
|
|
7
7
|
import { validateAnthropicApiKey, validateDeepSeekApiKey, validateElevenLabsApiKey, validateGeminiApiKey, validateOpenAiApiKey, } from "../services/ProviderKeyValidation";
|