@glassly/engine 0.3.7 → 0.3.8-dev.976
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/engine.d.ts +8 -2
- package/build/engine.d.ts.map +1 -1
- package/build/engine.js +7 -4
- package/build/engine.js.map +1 -1
- package/build/facades/backup.d.ts +14 -0
- package/build/facades/backup.d.ts.map +1 -0
- package/build/facades/backup.js +22 -0
- package/build/facades/backup.js.map +1 -0
- package/build/facades/glasses.d.ts +4 -4
- package/build/facades/glasses.d.ts.map +1 -1
- package/build/facades/glasses.js +4 -4
- package/build/facades/glasses.js.map +1 -1
- package/build/generated/releaseMetadata.js +4 -4
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/build/services/AppRegistry.d.ts +2 -1
- package/build/services/AppRegistry.d.ts.map +1 -1
- package/build/services/AppRegistry.js +38 -8
- package/build/services/AppRegistry.js.map +1 -1
- package/build/services/AppStateBackup.d.ts +98 -0
- package/build/services/AppStateBackup.d.ts.map +1 -0
- package/build/services/AppStateBackup.js +224 -0
- package/build/services/AppStateBackup.js.map +1 -0
- package/build/services/BlobStore.d.ts.map +1 -1
- package/build/services/BlobStore.js +5 -12
- package/build/services/BlobStore.js.map +1 -1
- package/build/services/CloudClientService.d.ts +1 -0
- package/build/services/CloudClientService.d.ts.map +1 -1
- package/build/services/CloudClientService.js +34 -2
- package/build/services/CloudClientService.js.map +1 -1
- package/build/services/DisplayProcessor.d.ts +2 -0
- package/build/services/DisplayProcessor.d.ts.map +1 -1
- package/build/services/DisplayProcessor.js +15 -1
- package/build/services/DisplayProcessor.js.map +1 -1
- package/build/services/GlassesTouchInput.d.ts.map +1 -1
- package/build/services/GlassesTouchInput.js +4 -2
- package/build/services/GlassesTouchInput.js.map +1 -1
- package/build/services/JSCrashloopReportService.d.ts.map +1 -1
- package/build/services/JSCrashloopReportService.js +5 -0
- package/build/services/JSCrashloopReportService.js.map +1 -1
- package/build/services/JSRouter.d.ts +11 -3
- package/build/services/JSRouter.d.ts.map +1 -1
- package/build/services/JSRouter.js +36 -6
- package/build/services/JSRouter.js.map +1 -1
- package/build/services/LocalMiniappRuntime.d.ts +13 -0
- package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
- package/build/services/LocalMiniappRuntime.js +54 -20
- package/build/services/LocalMiniappRuntime.js.map +1 -1
- package/build/services/MiniappEngine.d.ts +9 -0
- package/build/services/MiniappEngine.d.ts.map +1 -1
- package/build/services/MiniappEngine.js +60 -27
- package/build/services/MiniappEngine.js.map +1 -1
- package/build/services/MiniappLauncher.d.ts +2 -0
- package/build/services/MiniappLauncher.d.ts.map +1 -1
- package/build/services/MiniappLauncher.js +6 -0
- package/build/services/MiniappLauncher.js.map +1 -1
- package/build/services/NavigationService.d.ts +1 -0
- package/build/services/NavigationService.d.ts.map +1 -1
- package/build/services/NavigationService.js +20 -6
- package/build/services/NavigationService.js.map +1 -1
- package/build/services/PhoneCalendarService.d.ts.map +1 -1
- package/build/services/PhoneCalendarService.js +8 -0
- package/build/services/PhoneCalendarService.js.map +1 -1
- package/build/services/PhoneNotificationsSync.d.ts.map +1 -1
- package/build/services/PhoneNotificationsSync.js +7 -3
- package/build/services/PhoneNotificationsSync.js.map +1 -1
- package/build/services/SceneRenderer.js +1 -1
- package/build/services/SceneRenderer.js.map +1 -1
- package/build/services/appStateBackupFile.d.ts +32 -0
- package/build/services/appStateBackupFile.d.ts.map +1 -0
- package/build/services/appStateBackupFile.js +135 -0
- package/build/services/appStateBackupFile.js.map +1 -0
- package/build/services/controllers.d.ts.map +1 -1
- package/build/services/controllers.js +11 -3
- package/build/services/controllers.js.map +1 -1
- package/build/services/effectiveCapabilities.js +3 -0
- package/build/services/effectiveCapabilities.js.map +1 -1
- package/build/services/pages/pageEligibility.d.ts.map +1 -1
- package/build/services/pages/pageEligibility.js +8 -1
- package/build/services/pages/pageEligibility.js.map +1 -1
- package/build/services/settingsBridge.d.ts.map +1 -1
- package/build/services/settingsBridge.js +1 -0
- package/build/services/settingsBridge.js.map +1 -1
- package/build/services/{appleWatch/AppleWatchLink.d.ts → watch/WatchLink.d.ts} +8 -7
- package/build/services/watch/WatchLink.d.ts.map +1 -0
- package/build/services/{appleWatch/AppleWatchLink.js → watch/WatchLink.js} +14 -15
- package/build/services/watch/WatchLink.js.map +1 -0
- package/build/stores/apps.d.ts.map +1 -1
- package/build/stores/apps.js +14 -2
- package/build/stores/apps.js.map +1 -1
- package/build/stores/settings.d.ts.map +1 -1
- package/build/stores/settings.js +45 -3
- 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 +3 -0
- package/build/types/capabilities/even-realities-g1.js.map +1 -1
- package/build/types/capabilities/memomind-one.d.ts +3 -0
- package/build/types/capabilities/memomind-one.d.ts.map +1 -0
- package/build/types/capabilities/memomind-one.js +41 -0
- package/build/types/capabilities/memomind-one.js.map +1 -0
- package/build/types/enums.d.ts +6 -2
- package/build/types/enums.d.ts.map +1 -1
- package/build/types/enums.js +4 -0
- package/build/types/enums.js.map +1 -1
- package/build/types/hardware.d.ts +3 -1
- package/build/types/hardware.d.ts.map +1 -1
- package/build/types/hardware.js +3 -1
- package/build/types/hardware.js.map +1 -1
- package/build/utils/display/index.d.ts +2 -1
- package/build/utils/display/index.d.ts.map +1 -1
- package/build/utils/display/index.js +3 -2
- package/build/utils/display/index.js.map +1 -1
- package/build/utils/display/profiles/index.d.ts +2 -1
- package/build/utils/display/profiles/index.d.ts.map +1 -1
- package/build/utils/display/profiles/index.js +3 -2
- package/build/utils/display/profiles/index.js.map +1 -1
- package/build/utils/display/profiles/rayneo-io.d.ts +1 -1
- package/build/utils/display/profiles/rayneo-io.d.ts.map +1 -1
- package/build/utils/display/profiles/rayneo-io.js +1 -1
- package/build/utils/display/profiles/rayneo-io.js.map +1 -1
- package/build/utils/display/scene/index.d.ts +1 -1
- package/build/utils/display/scene/index.d.ts.map +1 -1
- package/build/utils/display/scene/index.js +1 -1
- package/build/utils/display/scene/index.js.map +1 -1
- package/build/utils/display/scene/process.d.ts +6 -0
- package/build/utils/display/scene/process.d.ts.map +1 -1
- package/build/utils/display/scene/process.js +22 -7
- package/build/utils/display/scene/process.js.map +1 -1
- package/build/utils/miniappGlobals.d.ts +13 -17
- package/build/utils/miniappGlobals.d.ts.map +1 -1
- package/build/utils/miniappGlobals.js +24 -56
- package/build/utils/miniappGlobals.js.map +1 -1
- package/package.json +7 -7
- package/src/engine.ts +7 -4
- package/src/facades/backup.ts +28 -0
- package/src/facades/glasses.ts +5 -5
- package/src/generated/releaseMetadata.ts +4 -4
- package/src/index.ts +1 -0
- package/src/services/AppRegistry.ts +36 -9
- package/src/services/AppStateBackup.ts +283 -0
- package/src/services/BlobStore.ts +5 -11
- package/src/services/CloudClientService.ts +35 -4
- package/src/services/DisplayProcessor.ts +20 -8
- package/src/services/GlassesTouchInput.ts +6 -2
- package/src/services/JSCrashloopReportService.ts +5 -0
- package/src/services/JSRouter.ts +37 -6
- package/src/services/LocalMiniappRuntime.ts +55 -20
- package/src/services/MiniappEngine.ts +62 -27
- package/src/services/MiniappLauncher.ts +7 -0
- package/src/services/NavigationService.ts +28 -8
- package/src/services/PhoneCalendarService.ts +7 -0
- package/src/services/PhoneNotificationsSync.ts +8 -3
- package/src/services/SceneRenderer.ts +1 -1
- package/src/services/appStateBackupFile.ts +171 -0
- package/src/services/controllers.ts +12 -3
- package/src/services/effectiveCapabilities.ts +3 -0
- package/src/services/pages/pageEligibility.ts +9 -1
- package/src/services/settingsBridge.ts +1 -0
- package/src/services/{appleWatch/AppleWatchLink.ts → watch/WatchLink.ts} +20 -20
- package/src/stores/apps.ts +13 -2
- package/src/stores/settings.ts +52 -7
- package/src/types/capabilities/even-realities-g1.ts +4 -0
- package/src/types/capabilities/memomind-one.ts +42 -0
- package/src/types/enums.ts +4 -0
- package/src/types/hardware.ts +14 -1
- package/src/utils/display/index.ts +4 -2
- package/src/utils/display/profiles/index.ts +9 -2
- package/src/utils/display/profiles/rayneo-io.ts +6 -1
- package/src/utils/display/scene/index.ts +1 -1
- package/src/utils/display/scene/process.ts +22 -7
- package/src/utils/miniappGlobals.ts +32 -64
- package/build/services/appleWatch/AppleWatchLink.d.ts.map +0 -1
- package/build/services/appleWatch/AppleWatchLink.js.map +0 -1
|
@@ -132,6 +132,17 @@ function withTimeout(promise, timeoutMs) {
|
|
|
132
132
|
promise.then((value) => done(value), () => done(null));
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
+
/** Bounds the cold-GPS wait for a one-shot poll; on a stall, any older fix beats an error. */
|
|
136
|
+
const FRESH_LOCATION_TIMEOUT_MS = 8_000;
|
|
137
|
+
async function freshLocationOrStale() {
|
|
138
|
+
const fresh = await withTimeout(Location.getCurrentPositionAsync({ accuracy: Location.Accuracy.Low }), FRESH_LOCATION_TIMEOUT_MS);
|
|
139
|
+
if (fresh)
|
|
140
|
+
return fresh;
|
|
141
|
+
const stale = await Location.getLastKnownPositionAsync();
|
|
142
|
+
if (stale)
|
|
143
|
+
return stale;
|
|
144
|
+
throw new Error("No location fix available");
|
|
145
|
+
}
|
|
135
146
|
const LOG_TAG = "LOCAL_MINIAPP";
|
|
136
147
|
const DIAGNOSTIC_MAX_LIST_ITEMS = 100;
|
|
137
148
|
const DIAGNOSTIC_MAX_STRING_LENGTH = 512;
|
|
@@ -152,6 +163,8 @@ const SYSTEM_MINIAPP_PACKAGES = new Set([
|
|
|
152
163
|
"com.glassly.miniappdev",
|
|
153
164
|
]);
|
|
154
165
|
const PING_INTERVAL_MS = 5_000;
|
|
166
|
+
/** How long a stopping miniapp's `beforeDisconnect` handlers get before teardown. */
|
|
167
|
+
const WILL_DISCONNECT_GRACE_MS = 100;
|
|
155
168
|
// Min gap between "transcription limit reached" notices on the glasses. A
|
|
156
169
|
// debounce, not a cooldown: the cloud re-announces the block per refused
|
|
157
170
|
// subscribe, and miniapps retry in bursts — this only coalesces those bursts
|
|
@@ -981,20 +994,26 @@ class LocalMiniappRuntime {
|
|
|
981
994
|
* undeliverable anyway.
|
|
982
995
|
*/
|
|
983
996
|
async gracefullyUnregisterApp(packageName, reason = "unregistering") {
|
|
984
|
-
|
|
985
|
-
if (!app)
|
|
997
|
+
if (!this.connectedApps.has(packageName))
|
|
986
998
|
return;
|
|
987
|
-
|
|
988
|
-
this.sendToMiniapp(packageName, {
|
|
989
|
-
type: MiniappResponseType.WILL_DISCONNECT,
|
|
990
|
-
reason,
|
|
991
|
-
});
|
|
992
|
-
// 50 ms: imperceptible to the user, plenty of time for the SDK's
|
|
993
|
-
// synchronous `beforeDisconnect` handlers to flush a final
|
|
994
|
-
// sendOneShot through the still-open transport.
|
|
995
|
-
await new Promise((resolve) => BgTimer.setTimeout(resolve, 50));
|
|
999
|
+
await this.notifyWillDisconnect(packageName, reason);
|
|
996
1000
|
this.unregisterApp(packageName);
|
|
997
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Send `WILL_DISCONNECT` and wait out the grace window, so the session's
|
|
1004
|
+
* `beforeDisconnect` handlers run (Navigation clears its HUD and ends its
|
|
1005
|
+
* trip) and their last messages land before teardown. No-op unless the
|
|
1006
|
+
* app finished its handshake.
|
|
1007
|
+
*/
|
|
1008
|
+
async notifyWillDisconnect(packageName, reason) {
|
|
1009
|
+
if (!this.connectedApps.has(packageName) || !this.handshookApps.has(packageName))
|
|
1010
|
+
return;
|
|
1011
|
+
console.log(`${LOG_TAG}: ${packageName} — sending WILL_DISCONNECT (${reason})`);
|
|
1012
|
+
this.sendToMiniapp(packageName, { type: MiniappResponseType.WILL_DISCONNECT, reason });
|
|
1013
|
+
// The message and the replies it triggers each cross a JSContext hop;
|
|
1014
|
+
// short enough not to slow an app switch noticeably.
|
|
1015
|
+
await new Promise((resolve) => BgTimer.setTimeout(resolve, WILL_DISCONNECT_GRACE_MS));
|
|
1016
|
+
}
|
|
998
1017
|
unregisterApp(packageName, opts) {
|
|
999
1018
|
console.log(`${LOG_TAG}: unregisterApp(${packageName})`);
|
|
1000
1019
|
const releasedMicGateOverride = micStateCoordinator.clearMiniappGateOverrides(packageName);
|
|
@@ -2966,7 +2985,7 @@ class LocalMiniappRuntime {
|
|
|
2966
2985
|
const locationStartedAt = Date.now();
|
|
2967
2986
|
const cached = await Location.getLastKnownPositionAsync({ maxAge: 60_000 });
|
|
2968
2987
|
console.log(`${LOG_TAG}: location poll cache hit=${cached !== null} elapsed=${Date.now() - locationStartedAt}ms`);
|
|
2969
|
-
const location = cached ?? (await
|
|
2988
|
+
const location = cached ?? (await freshLocationOrStale());
|
|
2970
2989
|
console.log(`${LOG_TAG}: location poll resolved elapsed=${Date.now() - locationStartedAt}ms`);
|
|
2971
2990
|
this.sendResult(packageName, requestId, true, {
|
|
2972
2991
|
lat: location.coords.latitude,
|
|
@@ -5294,14 +5313,18 @@ class LocalMiniappRuntime {
|
|
|
5294
5313
|
const app = this.interopApps().find((a) => a.packageName === packageName);
|
|
5295
5314
|
if (!app)
|
|
5296
5315
|
return false;
|
|
5297
|
-
//
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5316
|
+
// session.miniapps.start comes from the glasses (the dashboard's Apps menu,
|
|
5317
|
+
// an Assist voice command), unlike a headless action wake, which carries no source.
|
|
5318
|
+
// The full start, as a phone open runs it: the standard peer stops so this
|
|
5319
|
+
// app owns the display, and an app already running hears the new launch.
|
|
5320
|
+
const launchSource = "glasses";
|
|
5321
|
+
const started = await useAppStatusStore.getState().start(app, { skipNavigation: true, launchSource });
|
|
5322
|
+
if (!started)
|
|
5323
|
+
return false;
|
|
5324
|
+
// The caller may message the app next; start() resolves at spawn.
|
|
5325
|
+
if (app.local)
|
|
5326
|
+
await miniappLauncher.ensureConnected(packageName, undefined, { launchSource });
|
|
5327
|
+
return true;
|
|
5305
5328
|
}
|
|
5306
5329
|
stopInteropApp(packageName) {
|
|
5307
5330
|
return useAppStatusStore.getState().stop(packageName);
|
|
@@ -5979,6 +6002,17 @@ class LocalMiniappRuntime {
|
|
|
5979
6002
|
}
|
|
5980
6003
|
this.sendToMiniapp(packageName, { type: MiniappResponseType.LINK, params });
|
|
5981
6004
|
}
|
|
6005
|
+
/**
|
|
6006
|
+
* Tell a running miniapp the user opened it again and from where. The
|
|
6007
|
+
* CONNECT_ACK only carries the source of the spawn, which is stale for a
|
|
6008
|
+
* background app that keeps running between opens.
|
|
6009
|
+
*/
|
|
6010
|
+
sendLaunchChange(packageName, launchSource) {
|
|
6011
|
+
const existing = this.connectedApps.get(packageName);
|
|
6012
|
+
if (existing)
|
|
6013
|
+
existing.launchSource = launchSource;
|
|
6014
|
+
this.sendToMiniapp(packageName, { type: MiniappResponseType.LAUNCH_CHANGE, launchSource });
|
|
6015
|
+
}
|
|
5982
6016
|
/**
|
|
5983
6017
|
* Send a VISIBILITY_CHANGE push to a miniapp.
|
|
5984
6018
|
*/
|