@glassly/engine 0.3.2-beta.572 → 0.3.2-beta.597
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 +1 -1
- package/build/engine.d.ts +15 -1
- package/build/engine.d.ts.map +1 -1
- package/build/engine.js +7 -3
- package/build/engine.js.map +1 -1
- package/build/facades/dev.d.ts +2 -2
- package/build/facades/dev.d.ts.map +1 -1
- package/build/facades/dev.js +2 -2
- package/build/facades/dev.js.map +1 -1
- package/build/facades/glasses.d.ts +20 -0
- package/build/facades/glasses.d.ts.map +1 -1
- package/build/facades/glasses.js +21 -0
- package/build/facades/glasses.js.map +1 -1
- package/build/facades/pairing.js +1 -1
- package/build/facades/pairing.js.map +1 -1
- package/build/facades/reports.js +2 -2
- package/build/facades/reports.js.map +1 -1
- package/build/facades/session.d.ts +1 -1
- package/build/facades/session.js +2 -2
- package/build/facades/session.js.map +1 -1
- package/build/generated/releaseMetadata.js +3 -3
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/index.d.ts +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/runtime/bootstrap.d.ts +2 -2
- package/build/runtime/bootstrap.d.ts.map +1 -1
- package/build/runtime/bootstrap.js.map +1 -1
- package/build/services/CloudAudioSubscriptionSync.d.ts +2 -2
- package/build/services/CloudAudioSubscriptionSync.js +2 -2
- package/build/services/CloudAudioSubscriptionSync.js.map +1 -1
- package/build/services/CloudClientService.d.ts +2 -2
- package/build/services/CloudClientService.d.ts.map +1 -1
- package/build/services/CloudClientService.js +4 -4
- package/build/services/CloudClientService.js.map +1 -1
- package/build/services/CloudTranscriptE2EMetrics.d.ts +2 -2
- package/build/services/CloudTranscriptE2EMetrics.d.ts.map +1 -1
- package/build/services/CloudTranscriptE2EMetrics.js +3 -3
- package/build/services/CloudTranscriptE2EMetrics.js.map +1 -1
- package/build/services/DeviceEventRouter.d.ts.map +1 -1
- package/build/services/DeviceEventRouter.js +5 -0
- package/build/services/DeviceEventRouter.js.map +1 -1
- package/build/services/GestureDotsService.d.ts +9 -9
- package/build/services/GestureDotsService.d.ts.map +1 -1
- package/build/services/GestureDotsService.js +75 -50
- package/build/services/GestureDotsService.js.map +1 -1
- package/build/services/GlassesTouchInput.d.ts +1 -1
- package/build/services/GlassesTouchInput.d.ts.map +1 -1
- package/build/services/GlassesTouchInput.js +7 -4
- package/build/services/GlassesTouchInput.js.map +1 -1
- package/build/services/LocalMiniappRuntime.d.ts +1 -1
- package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
- package/build/services/LocalMiniappRuntime.js +26 -7
- package/build/services/LocalMiniappRuntime.js.map +1 -1
- package/build/services/LocalSttFallbackCoordinator.d.ts +5 -2
- package/build/services/LocalSttFallbackCoordinator.d.ts.map +1 -1
- package/build/services/LocalSttFallbackCoordinator.js +7 -3
- package/build/services/LocalSttFallbackCoordinator.js.map +1 -1
- package/build/services/PhonePhotoCoordinator.d.ts +1 -1
- package/build/services/PhonePhotoCoordinator.js +4 -4
- package/build/services/PhonePhotoCoordinator.js.map +1 -1
- package/build/services/PhoneStreamCoordinator.d.ts +1 -1
- package/build/services/PhoneStreamCoordinator.js +1 -1
- package/build/services/PhoneStreamCoordinator.js.map +1 -1
- package/build/services/SupportProfileSync.d.ts +1 -1
- package/build/services/SupportProfileSync.js +2 -2
- package/build/services/SupportProfileSync.js.map +1 -1
- package/build/services/TranscriptionRouting.d.ts +6 -1
- package/build/services/TranscriptionRouting.d.ts.map +1 -1
- package/build/services/TranscriptionRouting.js +7 -3
- package/build/services/TranscriptionRouting.js.map +1 -1
- package/build/services/cloudStreamApi.d.ts +2 -2
- package/build/services/cloudStreamApi.js +2 -2
- package/build/services/cloudStreamApi.js.map +1 -1
- package/build/services/gestureDotGlyphs.d.ts +1 -1
- package/build/services/gestureDotGlyphs.d.ts.map +1 -1
- package/build/services/gestureDotGlyphs.js +5 -0
- package/build/services/gestureDotGlyphs.js.map +1 -1
- package/build/services/neuralBand/MetaAuth.d.ts +31 -0
- package/build/services/neuralBand/MetaAuth.d.ts.map +1 -0
- package/build/services/neuralBand/MetaAuth.js +161 -0
- package/build/services/neuralBand/MetaAuth.js.map +1 -0
- package/build/services/neuralBand/NeuralBandInput.d.ts +50 -0
- package/build/services/neuralBand/NeuralBandInput.d.ts.map +1 -0
- package/build/services/neuralBand/NeuralBandInput.js +114 -0
- package/build/services/neuralBand/NeuralBandInput.js.map +1 -0
- package/build/services/neuralBand/NeuralBandSettingsSync.d.ts +3 -0
- package/build/services/neuralBand/NeuralBandSettingsSync.d.ts.map +1 -0
- package/build/services/neuralBand/NeuralBandSettingsSync.js +52 -0
- package/build/services/neuralBand/NeuralBandSettingsSync.js.map +1 -0
- package/build/services/neuralBand/sha256.d.ts +7 -0
- package/build/services/neuralBand/sha256.d.ts.map +1 -0
- package/build/services/neuralBand/sha256.js +68 -0
- package/build/services/neuralBand/sha256.js.map +1 -0
- package/build/services/soniox/SonioxRealtimeClient.d.ts +2 -2
- package/build/services/soniox/SonioxRealtimeClient.js +2 -2
- package/build/services/soniox/SonioxRealtimeClient.js.map +1 -1
- package/build/services/soniox/SonioxTokenAssembler.d.ts +1 -1
- package/build/services/soniox/SonioxTokenAssembler.js +1 -1
- package/build/services/soniox/SonioxTokenAssembler.js.map +1 -1
- package/build/stores/cloudClientStatus.js +1 -1
- package/build/stores/cloudClientStatus.js.map +1 -1
- package/build/stores/settings.d.ts.map +1 -1
- package/build/stores/settings.js +25 -7
- package/build/stores/settings.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/cloudClient/cloudSecureStore.js +2 -2
- package/build/utils/cloudClient/cloudSecureStore.js.map +1 -1
- package/package.json +7 -7
- package/src/engine.ts +7 -3
- package/src/facades/dev.ts +2 -2
- package/src/facades/glasses.ts +27 -0
- package/src/facades/pairing.ts +1 -1
- package/src/facades/reports.ts +2 -2
- package/src/facades/session.ts +2 -2
- package/src/generated/releaseMetadata.ts +3 -3
- package/src/index.ts +15 -1
- package/src/runtime/bootstrap.ts +2 -2
- package/src/services/CloudAudioSubscriptionSync.ts +2 -2
- package/src/services/CloudClientService.ts +4 -4
- package/src/services/CloudTranscriptE2EMetrics.ts +3 -3
- package/src/services/DeviceEventRouter.ts +5 -0
- package/src/services/GestureDotsService.ts +72 -49
- package/src/services/GlassesTouchInput.ts +13 -5
- package/src/services/LocalMiniappRuntime.ts +46 -24
- package/src/services/LocalSttFallbackCoordinator.ts +18 -4
- package/src/services/PhonePhotoCoordinator.ts +4 -4
- package/src/services/PhoneStreamCoordinator.ts +1 -1
- package/src/services/SupportProfileSync.ts +2 -2
- package/src/services/TranscriptionRouting.ts +12 -4
- package/src/services/cloudStreamApi.ts +3 -3
- package/src/services/gestureDotGlyphs.ts +6 -1
- package/src/services/neuralBand/MetaAuth.ts +192 -0
- package/src/services/neuralBand/NeuralBandInput.ts +148 -0
- package/src/services/neuralBand/NeuralBandSettingsSync.ts +63 -0
- package/src/services/neuralBand/sha256.ts +70 -0
- package/src/services/soniox/SonioxRealtimeClient.ts +2 -2
- package/src/services/soniox/SonioxTokenAssembler.ts +1 -1
- package/src/stores/cloudClientStatus.ts +1 -1
- package/src/stores/settings.ts +25 -7
- package/src/types/enums.ts +1 -0
- package/src/utils/cloudClient/cloudSecureStore.ts +2 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Gesture dots — a debug indicator that flashes a small glyph top-right on the
|
|
3
3
|
* glasses when a touch gesture arrives, while nothing else is on the display:
|
|
4
|
-
* a filled circle for a single tap, an arrow for a swipe
|
|
5
|
-
* short pulse), a bullseye
|
|
4
|
+
* a filled circle for a single tap, two for a double tap, an arrow for a swipe
|
|
5
|
+
* (cleared after a short pulse), a bullseye for a recognized long press.
|
|
6
|
+
* The Neural Band's middle finger (index 1) draws the same shapes hollow. Extracted from
|
|
6
7
|
* the CFW dashboard service; it renders through
|
|
7
8
|
* the ordinary scene pipeline, so it works on any positioning device (stock
|
|
8
9
|
* G2 included), and is gated by the gesture_dots debug setting.
|
|
@@ -23,19 +24,26 @@ const DOTS_APP_ID = "system.gesture-dots";
|
|
|
23
24
|
const GESTURE_FLASH_MS = 700;
|
|
24
25
|
const MARGIN_X = 16;
|
|
25
26
|
const MARGIN_TOP = 10;
|
|
26
|
-
|
|
27
|
-
const
|
|
27
|
+
/** Gestures that flash a glyph. */
|
|
28
|
+
const FLASH_GLYPHS = {
|
|
29
|
+
single_tap: "dot",
|
|
30
|
+
double_tap: "double",
|
|
31
|
+
long_press: "hold",
|
|
32
|
+
swipe_up: "up",
|
|
33
|
+
swipe_down: "down",
|
|
34
|
+
swipe_left: "left",
|
|
35
|
+
swipe_right: "right",
|
|
36
|
+
};
|
|
37
|
+
/** The band's middle finger draws the filled shapes hollow. */
|
|
38
|
+
const MIDDLE_FINGER_GLYPHS = { dot: "ring", double: "doubleRing" };
|
|
28
39
|
class GestureDotsService {
|
|
29
40
|
started = false;
|
|
30
41
|
flash = null;
|
|
31
42
|
flashTimer = null;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
* event; the tap_end that follows on release is what clears it).
|
|
37
|
-
*/
|
|
38
|
-
holdRecognized = false;
|
|
43
|
+
/** Raw controller holds survive hold recognition/dial events until their own release. */
|
|
44
|
+
presses = new Map();
|
|
45
|
+
/** Avoid sending identical images for successive phases of the same press. */
|
|
46
|
+
renderedGlyph = null;
|
|
39
47
|
/** Whether the indicator scene currently has anything on it (needs a clear when the flash ends). */
|
|
40
48
|
visible = false;
|
|
41
49
|
unsubs = [];
|
|
@@ -71,13 +79,13 @@ class GestureDotsService {
|
|
|
71
79
|
BgTimer.clearTimeout(this.flashTimer);
|
|
72
80
|
this.flashTimer = null;
|
|
73
81
|
this.flash = null;
|
|
74
|
-
this.
|
|
75
|
-
this.holdRecognized = false;
|
|
82
|
+
this.presses.clear();
|
|
76
83
|
}
|
|
77
84
|
/** Another surface owns the display; forget the indicator without painting over it. */
|
|
78
85
|
relinquish() {
|
|
79
86
|
this.resetGesture();
|
|
80
87
|
this.visible = false;
|
|
88
|
+
this.renderedGlyph = null;
|
|
81
89
|
sceneRenderer.clearApp(DOTS_APP_ID);
|
|
82
90
|
this.trace("relinquish");
|
|
83
91
|
}
|
|
@@ -87,15 +95,16 @@ class GestureDotsService {
|
|
|
87
95
|
/**
|
|
88
96
|
* Flash a gesture on the indicator. Other gesture names are ignored.
|
|
89
97
|
* Claimed gestures cancel any earlier press/flash without starting a new
|
|
90
|
-
* one: the claimant may also consume the release edge.
|
|
98
|
+
* one: the claimant may also consume the release edge. `fingerIndex` is the
|
|
99
|
+
* Neural Band's finger on its pinches and press edges (1 = middle).
|
|
91
100
|
*/
|
|
92
|
-
noteGesture(gestureName, claimed = false) {
|
|
101
|
+
noteGesture(gestureName, claimed = false, fingerIndex) {
|
|
93
102
|
if (!this.started || !this.enabled())
|
|
94
103
|
return;
|
|
95
|
-
this.applyGesture(gestureName, claimed);
|
|
104
|
+
this.applyGesture(gestureName, claimed, fingerIndex);
|
|
96
105
|
this.trace("input", { gestureName, claimed });
|
|
97
106
|
}
|
|
98
|
-
applyGesture(gestureName, claimed) {
|
|
107
|
+
applyGesture(gestureName, claimed, fingerIndex) {
|
|
99
108
|
if (localDisplayManager.hasActiveDisplay() || useDisplayStore.getState().overlayOwner !== null) {
|
|
100
109
|
this.relinquish();
|
|
101
110
|
return;
|
|
@@ -105,52 +114,63 @@ class GestureDotsService {
|
|
|
105
114
|
this.render();
|
|
106
115
|
return;
|
|
107
116
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
const finger = fingerIndex ?? 0;
|
|
118
|
+
const press = this.presses.get(finger);
|
|
119
|
+
if (gestureName === "touch_down" || gestureName === "tap_start") {
|
|
120
|
+
if (press) {
|
|
121
|
+
// Both reports describe one press. Never restart its visual feedback.
|
|
122
|
+
if (gestureName === "touch_down")
|
|
123
|
+
press.raw = true;
|
|
115
124
|
return;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
}
|
|
126
|
+
this.clearFlash();
|
|
127
|
+
this.presses.set(finger, { raw: gestureName === "touch_down", glyph: finger === 1 ? "ring" : "dot" });
|
|
119
128
|
this.render();
|
|
120
129
|
return;
|
|
121
130
|
}
|
|
122
|
-
if (gestureName === "
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
if (gestureName === "tap_end") {
|
|
132
|
+
if (!press)
|
|
133
|
+
return;
|
|
134
|
+
this.presses.delete(finger);
|
|
135
|
+
// The band's resolved tap arrives after release (double-tap window).
|
|
136
|
+
// Keep the glyph lit across that gap so one pinch never flashes twice.
|
|
137
|
+
if (press.raw && this.presses.size === 0)
|
|
138
|
+
this.startFlash(press.glyph);
|
|
125
139
|
this.render();
|
|
126
140
|
return;
|
|
127
141
|
}
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
: gestureName === "swipe_down"
|
|
137
|
-
? "down"
|
|
138
|
-
: null;
|
|
139
|
-
if (!flash) {
|
|
140
|
-
if (released)
|
|
141
|
-
this.render();
|
|
142
|
+
const shape = FLASH_GLYPHS[gestureName];
|
|
143
|
+
const glyph = shape && finger === 1 ? MIDDLE_FINGER_GLYPHS[shape] ?? shape : shape;
|
|
144
|
+
if (press?.raw && (!glyph || gestureName === "long_press")) {
|
|
145
|
+
// Pinch-and-turn reports do not release a finger. A recognized hold
|
|
146
|
+
// stays visible until tap_end instead of expiring halfway through it.
|
|
147
|
+
if (glyph)
|
|
148
|
+
press.glyph = glyph;
|
|
149
|
+
this.render();
|
|
142
150
|
return;
|
|
143
151
|
}
|
|
144
|
-
|
|
152
|
+
// Completed taps/swipes become one continuous pulse, even if the device
|
|
153
|
+
// omits tap_end. Older tap_start-only devices retain the same fallback.
|
|
154
|
+
this.presses.delete(finger);
|
|
155
|
+
if (glyph)
|
|
156
|
+
this.startFlash(glyph);
|
|
157
|
+
this.render();
|
|
158
|
+
}
|
|
159
|
+
clearFlash() {
|
|
145
160
|
if (this.flashTimer !== null)
|
|
146
161
|
BgTimer.clearTimeout(this.flashTimer);
|
|
162
|
+
this.flashTimer = null;
|
|
163
|
+
this.flash = null;
|
|
164
|
+
}
|
|
165
|
+
startFlash(glyph) {
|
|
166
|
+
this.clearFlash();
|
|
167
|
+
this.flash = glyph;
|
|
147
168
|
this.flashTimer = BgTimer.setTimeout(() => {
|
|
148
169
|
this.flashTimer = null;
|
|
149
170
|
this.flash = null;
|
|
150
171
|
this.render();
|
|
151
172
|
this.trace("flash-ended");
|
|
152
173
|
}, GESTURE_FLASH_MS);
|
|
153
|
-
this.render();
|
|
154
174
|
}
|
|
155
175
|
/** Debug setting only; no payloads or retained history. Correlate seq with G2PERF. */
|
|
156
176
|
trace(reason, details = {}) {
|
|
@@ -160,7 +180,7 @@ class GestureDotsService {
|
|
|
160
180
|
JSON.stringify({
|
|
161
181
|
t: Date.now(),
|
|
162
182
|
reason,
|
|
163
|
-
held: this.
|
|
183
|
+
held: this.presses.size > 0,
|
|
164
184
|
flash: this.flash,
|
|
165
185
|
overlay: useDisplayStore.getState().overlayOwner,
|
|
166
186
|
active: localDisplayManager.hasActiveDisplay(),
|
|
@@ -183,16 +203,20 @@ class GestureDotsService {
|
|
|
183
203
|
return;
|
|
184
204
|
if (localDisplayManager.hasActiveDisplay() || useDisplayStore.getState().overlayOwner !== null)
|
|
185
205
|
return;
|
|
186
|
-
const shown =
|
|
206
|
+
const shown = Array.from(this.presses.values()).at(-1)?.glyph ?? this.flash;
|
|
187
207
|
if (!this.enabled()) {
|
|
188
208
|
if (this.visible) {
|
|
189
209
|
this.visible = false;
|
|
210
|
+
this.renderedGlyph = null;
|
|
190
211
|
sceneRenderer.emitScene(DOTS_APP_ID, "main", []);
|
|
191
212
|
}
|
|
192
213
|
return;
|
|
193
214
|
}
|
|
194
215
|
if (!shown && !this.visible)
|
|
195
216
|
return;
|
|
217
|
+
const glyph = shown ?? "blank";
|
|
218
|
+
if (glyph === this.renderedGlyph)
|
|
219
|
+
return;
|
|
196
220
|
const elements = [
|
|
197
221
|
{
|
|
198
222
|
type: "image",
|
|
@@ -204,13 +228,14 @@ class GestureDotsService {
|
|
|
204
228
|
h: GESTURE_DOT_GLYPH_SIZE,
|
|
205
229
|
anchor: "top-right",
|
|
206
230
|
},
|
|
207
|
-
data: GESTURE_DOT_GLYPHS[
|
|
231
|
+
data: GESTURE_DOT_GLYPHS[glyph],
|
|
208
232
|
},
|
|
209
233
|
];
|
|
210
234
|
this.visible = true;
|
|
235
|
+
this.renderedGlyph = glyph;
|
|
211
236
|
const result = sceneRenderer.emitScene(DOTS_APP_ID, "main", elements);
|
|
212
237
|
this.trace("render", {
|
|
213
|
-
glyph
|
|
238
|
+
glyph,
|
|
214
239
|
...(result?.kind === "scene" ? { seq: result.seq, sent: result.sent } : {}),
|
|
215
240
|
});
|
|
216
241
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureDotsService.js","sourceRoot":"","sources":["../../src/services/GestureDotsService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAE7D,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAuB,MAAM,oBAAoB,CAAA;AACnG,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,GAAG,qBAAqB,CAAA;AACzC,iDAAiD;AACjD,MA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AAA;QACvF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACpB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;gBACpB,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;YAClD,CAAC;YACD,OAAM;QACR,CAAC;QACD,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAM;QACnC,MAAM,QAAQ,GAAwB;YACpC;gBACE,IAAI,EAAE,OAAO;gBACb,EAAE,EAAE,aAAa;gBACjB,GAAG,EAAE;oBACH,CAAC,EAAE,QAAQ;oBACX,CAAC,EAAE,UAAU;oBACb,CAAC,EAAE,sBAAsB;oBACzB,CAAC,EAAE,sBAAsB;oBACzB,MAAM,EAAE,WAAW;iBACpB;gBACD,IAAI,EAAE,kBAAkB,CAAC,KAAK,IAAI,OAAO,CAAC;aAC3C;SACF,CAAA;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QACrE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACnB,KAAK,EAAE,KAAK,IAAI,OAAO;YACvB,GAAG,CAAC,MAAM,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1E,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAA;AACnD,eAAe,kBAAkB,CAAA;AACjC,OAAO,EAAC,kBAAkB,EAAC,CAAA","sourcesContent":["/**\n * Gesture dots — a debug indicator that flashes a small glyph top-right on the\n * glasses when a touch gesture arrives, while nothing else is on the display:\n * a filled circle for a single tap, an arrow for a swipe (cleared after a\n * short pulse), a bullseye while a CFW tap-then-hold is held. Extracted from\n * the CFW dashboard service; it renders through\n * the ordinary scene pipeline, so it works on any positioning device (stock\n * G2 included), and is gated by the gesture_dots debug setting.\n *\n * The glyphs are pre-baked images (not text): the stock firmware's builtin\n * font has no ●/↑/↓, and a single image element with a stable id and box maps\n * to ONE re-used firmware image container — flash and idle swap its bytes\n * (data-only update, no page rebuild) instead of creating/removing containers.\n */\nimport {useDisplayStore} from \"../stores/display\"\nimport {SETTINGS, useSettingsStore} from \"../stores/settings\"\nimport type {SceneElementInput} from \"../utils/display/scene\"\nimport {BgTimer} from \"../utils/timers\"\nimport {GESTURE_DOT_GLYPHS, GESTURE_DOT_GLYPH_SIZE, type GestureDotGlyph} from \"./gestureDotGlyphs\"\nimport localDisplayManager from \"./LocalDisplayManager\"\nimport sceneRenderer from \"./SceneRenderer\"\n\nconst DOTS_APP_ID = \"system.gesture-dots\"\n/** How long a gesture stays on the indicator. */\nconst GESTURE_FLASH_MS = 700\nconst MARGIN_X = 16\nconst MARGIN_TOP = 10\n// Off: tap_then_hold opens the side menu now.\nconst HOLD_GLYPH_ENABLED = false\n\nclass GestureDotsService {\n private started = false\n private flash: GestureDotGlyph | null = null\n private flashTimer: number | null = null\n /** Finger currently on the touch bar (tap_start..tap_end; the CFW forwards holds as these edges). */\n private held = false\n /**\n * The CFW's tap_then_hold fired during this press (discrete recognition\n * event; the tap_end that follows on release is what clears it).\n */\n private holdRecognized = false\n /** Whether the indicator scene currently has anything on it (needs a clear when the flash ends). */\n private visible = false\n private unsubs: Array<() => void> = []\n\n start(): void {\n if (this.started) return\n this.started = true\n this.unsubs.push(\n // The indicator owns the screen only while it is empty: drop our\n // retained state when something else takes over, and clear any\n // leftover flash when the display empties again.\n localDisplayManager.onActiveDisplayChange((active) => {\n if (active) this.relinquish()\n else this.render()\n }),\n // Overlays do not change the retained main display's occupancy.\n useDisplayStore.subscribe(\n (state) => state.overlayOwner,\n (owner) => {\n if (owner !== null) this.relinquish()\n },\n ),\n )\n }\n\n stop(): void {\n for (const unsub of this.unsubs) unsub()\n this.unsubs = []\n this.relinquish()\n this.started = false\n }\n\n private resetGesture(): void {\n if (this.flashTimer !== null) BgTimer.clearTimeout(this.flashTimer)\n this.flashTimer = null\n this.flash = null\n this.held = false\n this.holdRecognized = false\n }\n\n /** Another surface owns the display; forget the indicator without painting over it. */\n private relinquish(): void {\n this.resetGesture()\n this.visible = false\n sceneRenderer.clearApp(DOTS_APP_ID)\n this.trace(\"relinquish\")\n }\n\n private enabled(): boolean {\n return useSettingsStore.getState().getSetting(SETTINGS.gesture_dots.key) === true\n }\n\n /**\n * Flash a gesture on the indicator. Other gesture names are ignored.\n * Claimed gestures cancel any earlier press/flash without starting a new\n * one: the claimant may also consume the release edge.\n */\n noteGesture(gestureName: string, claimed = false): void {\n if (!this.started || !this.enabled()) return\n this.applyGesture(gestureName, claimed)\n this.trace(\"input\", {gestureName, claimed})\n }\n\n private applyGesture(gestureName: string, claimed: boolean): void {\n if (localDisplayManager.hasActiveDisplay() || useDisplayStore.getState().overlayOwner !== null) {\n this.relinquish()\n return\n }\n if (claimed) {\n this.resetGesture()\n this.render()\n return\n }\n // Tap edges show a steady circle for as long as the finger is down (on\n // CFW these arrive for holds: ET_LONG/ET_REL forwarded as\n // tap_start/tap_end), with no timer — tap_end clears it. The ring's\n // touch_down is the same finger-down edge; the ring's tap_end releases it.\n if (gestureName === \"tap_start\" || gestureName === \"touch_down\" || gestureName === \"tap_end\") {\n const held = gestureName !== \"tap_end\"\n if (this.held === held) return\n this.held = held\n if (!held) this.holdRecognized = false\n this.render()\n return\n }\n if (gestureName === \"tap_then_hold\" && HOLD_GLYPH_ENABLED) {\n this.held = true\n this.holdRecognized = true\n this.render()\n return\n }\n // Any other gesture implies the finger is up, even if tap_end was lost.\n const released = this.held\n this.held = false\n this.holdRecognized = false\n const flash: GestureDotGlyph | null =\n gestureName === \"single_tap\"\n ? \"dot\"\n : gestureName === \"swipe_up\"\n ? \"up\"\n : gestureName === \"swipe_down\"\n ? \"down\"\n : null\n if (!flash) {\n if (released) this.render()\n return\n }\n this.flash = flash\n if (this.flashTimer !== null) BgTimer.clearTimeout(this.flashTimer)\n this.flashTimer = BgTimer.setTimeout(() => {\n this.flashTimer = null\n this.flash = null\n this.render()\n this.trace(\"flash-ended\")\n }, GESTURE_FLASH_MS)\n this.render()\n }\n\n /** Debug setting only; no payloads or retained history. Correlate seq with G2PERF. */\n private trace(reason: string, details: Record<string, unknown> = {}): void {\n if (!this.enabled()) return\n console.log(\n \"GESTUREDOTS \" +\n JSON.stringify({\n t: Date.now(),\n reason,\n held: this.held,\n flash: this.flash,\n overlay: useDisplayStore.getState().overlayOwner,\n active: localDisplayManager.hasActiveDisplay(),\n ...details,\n }),\n )\n }\n\n /**\n * Paint or clear the indicator. Nothing is drawn while anything else is on\n * the glasses (miniapp frame or system screen) or when no gesture was just\n * received. The top-right anchor resolves against the device's real canvas,\n * so no size math here.\n *\n * Between flashes the element STAYS in the scene with the blank glyph:\n * removing it would tear down the firmware image container and rebuild the\n * page on every flash (a rebuild storm on stock firmware). Only disabling\n * the setting removes the element outright.\n */\n private render(): void {\n if (!this.started) return\n if (localDisplayManager.hasActiveDisplay() || useDisplayStore.getState().overlayOwner !== null) return\n const shown = this.flash ?? (this.held ? (this.holdRecognized ? \"hold\" : \"dot\") : null)\n if (!this.enabled()) {\n if (this.visible) {\n this.visible = false\n sceneRenderer.emitScene(DOTS_APP_ID, \"main\", [])\n }\n return\n }\n if (!shown && !this.visible) return\n const elements: SceneElementInput[] = [\n {\n type: \"image\",\n id: \"gesture-dot\",\n box: {\n x: MARGIN_X,\n y: MARGIN_TOP,\n w: GESTURE_DOT_GLYPH_SIZE,\n h: GESTURE_DOT_GLYPH_SIZE,\n anchor: \"top-right\",\n },\n data: GESTURE_DOT_GLYPHS[shown ?? \"blank\"],\n },\n ]\n this.visible = true\n const result = sceneRenderer.emitScene(DOTS_APP_ID, \"main\", elements)\n this.trace(\"render\", {\n glyph: shown ?? \"blank\",\n ...(result?.kind === \"scene\" ? {seq: result.seq, sent: result.sent} : {}),\n })\n }\n}\n\nconst gestureDotsService = new GestureDotsService()\nexport default gestureDotsService\nexport {GestureDotsService}\n"]}
|
|
1
|
+
{"version":3,"file":"GestureDotsService.js","sourceRoot":"","sources":["../../src/services/GestureDotsService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAE7D,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAuB,MAAM,oBAAoB,CAAA;AACnG,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,GAAG,qBAAqB,CAAA;AACzC,iDAAiD;AACjD,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAC5B,MAAM,QAAQ,GAAG,EAAE,CAAA;AACnB,MAAM,UAAU,GAAG,EAAE,CAAA;AACrB,mCAAmC;AACnC,MAAM,YAAY,GAAoC;IACpD,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,MAAM;IAClB,WAAW,EAAE,OAAO;CACrB,CAAA;AACD,+DAA+D;AAC/D,MAAM,oBAAoB,GAAsD,EAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAC,CAAA;AAEnH,MAAM,kBAAkB;IACd,OAAO,GAAG,KAAK,CAAA;IACf,KAAK,GAA2B,IAAI,CAAA;IACpC,UAAU,GAAkB,IAAI,CAAA;IACxC,yFAAy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nB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAA;QAC1B,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;QACrE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACnB,KAAK;YACL,GAAG,CAAC,MAAM,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1E,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAA;AACnD,eAAe,kBAAkB,CAAA;AACjC,OAAO,EAAC,kBAAkB,EAAC,CAAA","sourcesContent":["/**\n * Gesture dots — a debug indicator that flashes a small glyph top-right on the\n * glasses when a touch gesture arrives, while nothing else is on the display:\n * a filled circle for a single tap, two for a double tap, an arrow for a swipe\n * (cleared after a short pulse), a bullseye for a recognized long press.\n * The Neural Band's middle finger (index 1) draws the same shapes hollow. Extracted from\n * the CFW dashboard service; it renders through\n * the ordinary scene pipeline, so it works on any positioning device (stock\n * G2 included), and is gated by the gesture_dots debug setting.\n *\n * The glyphs are pre-baked images (not text): the stock firmware's builtin\n * font has no ●/↑/↓, and a single image element with a stable id and box maps\n * to ONE re-used firmware image container — flash and idle swap its bytes\n * (data-only update, no page rebuild) instead of creating/removing containers.\n */\nimport {useDisplayStore} from \"../stores/display\"\nimport {SETTINGS, useSettingsStore} from \"../stores/settings\"\nimport type {SceneElementInput} from \"../utils/display/scene\"\nimport {BgTimer} from \"../utils/timers\"\nimport {GESTURE_DOT_GLYPHS, GESTURE_DOT_GLYPH_SIZE, type GestureDotGlyph} from \"./gestureDotGlyphs\"\nimport localDisplayManager from \"./LocalDisplayManager\"\nimport sceneRenderer from \"./SceneRenderer\"\n\nconst DOTS_APP_ID = \"system.gesture-dots\"\n/** How long a gesture stays on the indicator. */\nconst GESTURE_FLASH_MS = 700\nconst MARGIN_X = 16\nconst MARGIN_TOP = 10\n/** Gestures that flash a glyph. */\nconst FLASH_GLYPHS: Record<string, GestureDotGlyph> = {\n single_tap: \"dot\",\n double_tap: \"double\",\n long_press: \"hold\",\n swipe_up: \"up\",\n swipe_down: \"down\",\n swipe_left: \"left\",\n swipe_right: \"right\",\n}\n/** The band's middle finger draws the filled shapes hollow. */\nconst MIDDLE_FINGER_GLYPHS: Partial<Record<GestureDotGlyph, GestureDotGlyph>> = {dot: \"ring\", double: \"doubleRing\"}\n\nclass GestureDotsService {\n private started = false\n private flash: GestureDotGlyph | null = null\n private flashTimer: number | null = null\n /** Raw controller holds survive hold recognition/dial events until their own release. */\n private presses = new Map<number, {raw: boolean; glyph: GestureDotGlyph}>()\n /** Avoid sending identical images for successive phases of the same press. */\n private renderedGlyph: GestureDotGlyph | null = null\n /** Whether the indicator scene currently has anything on it (needs a clear when the flash ends). */\n private visible = false\n private unsubs: Array<() => void> = []\n\n start(): void {\n if (this.started) return\n this.started = true\n this.unsubs.push(\n // The indicator owns the screen only while it is empty: drop our\n // retained state when something else takes over, and clear any\n // leftover flash when the display empties again.\n localDisplayManager.onActiveDisplayChange((active) => {\n if (active) this.relinquish()\n else this.render()\n }),\n // Overlays do not change the retained main display's occupancy.\n useDisplayStore.subscribe(\n (state) => state.overlayOwner,\n (owner) => {\n if (owner !== null) this.relinquish()\n },\n ),\n )\n }\n\n stop(): void {\n for (const unsub of this.unsubs) unsub()\n this.unsubs = []\n this.relinquish()\n this.started = false\n }\n\n private resetGesture(): void {\n if (this.flashTimer !== null) BgTimer.clearTimeout(this.flashTimer)\n this.flashTimer = null\n this.flash = null\n this.presses.clear()\n }\n\n /** Another surface owns the display; forget the indicator without painting over it. */\n private relinquish(): void {\n this.resetGesture()\n this.visible = false\n this.renderedGlyph = null\n sceneRenderer.clearApp(DOTS_APP_ID)\n this.trace(\"relinquish\")\n }\n\n private enabled(): boolean {\n return useSettingsStore.getState().getSetting(SETTINGS.gesture_dots.key) === true\n }\n\n /**\n * Flash a gesture on the indicator. Other gesture names are ignored.\n * Claimed gestures cancel any earlier press/flash without starting a new\n * one: the claimant may also consume the release edge. `fingerIndex` is the\n * Neural Band's finger on its pinches and press edges (1 = middle).\n */\n noteGesture(gestureName: string, claimed = false, fingerIndex?: number): void {\n if (!this.started || !this.enabled()) return\n this.applyGesture(gestureName, claimed, fingerIndex)\n this.trace(\"input\", {gestureName, claimed})\n }\n\n private applyGesture(gestureName: string, claimed: boolean, fingerIndex?: number): void {\n if (localDisplayManager.hasActiveDisplay() || useDisplayStore.getState().overlayOwner !== null) {\n this.relinquish()\n return\n }\n if (claimed) {\n this.resetGesture()\n this.render()\n return\n }\n const finger = fingerIndex ?? 0\n const press = this.presses.get(finger)\n if (gestureName === \"touch_down\" || gestureName === \"tap_start\") {\n if (press) {\n // Both reports describe one press. Never restart its visual feedback.\n if (gestureName === \"touch_down\") press.raw = true\n return\n }\n this.clearFlash()\n this.presses.set(finger, {raw: gestureName === \"touch_down\", glyph: finger === 1 ? \"ring\" : \"dot\"})\n this.render()\n return\n }\n if (gestureName === \"tap_end\") {\n if (!press) return\n this.presses.delete(finger)\n // The band's resolved tap arrives after release (double-tap window).\n // Keep the glyph lit across that gap so one pinch never flashes twice.\n if (press.raw && this.presses.size === 0) this.startFlash(press.glyph)\n this.render()\n return\n }\n const shape = FLASH_GLYPHS[gestureName]\n const glyph = shape && finger === 1 ? MIDDLE_FINGER_GLYPHS[shape] ?? shape : shape\n if (press?.raw && (!glyph || gestureName === \"long_press\")) {\n // Pinch-and-turn reports do not release a finger. A recognized hold\n // stays visible until tap_end instead of expiring halfway through it.\n if (glyph) press.glyph = glyph\n this.render()\n return\n }\n // Completed taps/swipes become one continuous pulse, even if the device\n // omits tap_end. Older tap_start-only devices retain the same fallback.\n this.presses.delete(finger)\n if (glyph) this.startFlash(glyph)\n this.render()\n }\n\n private clearFlash(): void {\n if (this.flashTimer !== null) BgTimer.clearTimeout(this.flashTimer)\n this.flashTimer = null\n this.flash = null\n }\n\n private startFlash(glyph: GestureDotGlyph): void {\n this.clearFlash()\n this.flash = glyph\n this.flashTimer = BgTimer.setTimeout(() => {\n this.flashTimer = null\n this.flash = null\n this.render()\n this.trace(\"flash-ended\")\n }, GESTURE_FLASH_MS)\n }\n\n /** Debug setting only; no payloads or retained history. Correlate seq with G2PERF. */\n private trace(reason: string, details: Record<string, unknown> = {}): void {\n if (!this.enabled()) return\n console.log(\n \"GESTUREDOTS \" +\n JSON.stringify({\n t: Date.now(),\n reason,\n held: this.presses.size > 0,\n flash: this.flash,\n overlay: useDisplayStore.getState().overlayOwner,\n active: localDisplayManager.hasActiveDisplay(),\n ...details,\n }),\n )\n }\n\n /**\n * Paint or clear the indicator. Nothing is drawn while anything else is on\n * the glasses (miniapp frame or system screen) or when no gesture was just\n * received. The top-right anchor resolves against the device's real canvas,\n * so no size math here.\n *\n * Between flashes the element STAYS in the scene with the blank glyph:\n * removing it would tear down the firmware image container and rebuild the\n * page on every flash (a rebuild storm on stock firmware). Only disabling\n * the setting removes the element outright.\n */\n private render(): void {\n if (!this.started) return\n if (localDisplayManager.hasActiveDisplay() || useDisplayStore.getState().overlayOwner !== null) return\n const shown = Array.from(this.presses.values()).at(-1)?.glyph ?? this.flash\n if (!this.enabled()) {\n if (this.visible) {\n this.visible = false\n this.renderedGlyph = null\n sceneRenderer.emitScene(DOTS_APP_ID, \"main\", [])\n }\n return\n }\n if (!shown && !this.visible) return\n const glyph = shown ?? \"blank\"\n if (glyph === this.renderedGlyph) return\n const elements: SceneElementInput[] = [\n {\n type: \"image\",\n id: \"gesture-dot\",\n box: {\n x: MARGIN_X,\n y: MARGIN_TOP,\n w: GESTURE_DOT_GLYPH_SIZE,\n h: GESTURE_DOT_GLYPH_SIZE,\n anchor: \"top-right\",\n },\n data: GESTURE_DOT_GLYPHS[glyph],\n },\n ]\n this.visible = true\n this.renderedGlyph = glyph\n const result = sceneRenderer.emitScene(DOTS_APP_ID, \"main\", elements)\n this.trace(\"render\", {\n glyph,\n ...(result?.kind === \"scene\" ? {seq: result.seq, sent: result.sent} : {}),\n })\n }\n}\n\nconst gestureDotsService = new GestureDotsService()\nexport default gestureDotsService\nexport {GestureDotsService}\n"]}
|
|
@@ -10,5 +10,5 @@ import { type TouchEvent } from "@glassly/bluetooth-sdk";
|
|
|
10
10
|
export declare function dispatchTouchEvent(event: TouchEvent): void;
|
|
11
11
|
export declare function resetTouchInput(): void;
|
|
12
12
|
/** Phone mirror input uses the same dashboard/miniapp policy as real glasses. */
|
|
13
|
-
export declare function sendGesture(gestureName: "single_tap" | "tap_start" | "double_tap" | "tap_end" | "tap_then_hold" | "touch_down" | "swipe_up" | "swipe_down"): void;
|
|
13
|
+
export declare function sendGesture(gestureName: "single_tap" | "tap_start" | "double_tap" | "tap_end" | "tap_then_hold" | "touch_down" | "swipe_up" | "swipe_down" | "swipe_left" | "swipe_right" | "long_press" | "dial_up" | "dial_down"): void;
|
|
14
14
|
//# sourceMappingURL=GlassesTouchInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlassesTouchInput.d.ts","sourceRoot":"","sources":["../../src/services/GlassesTouchInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,UAAU,EAAC,MAAM,wBAAwB,CAAA;AAwCpE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"GlassesTouchInput.d.ts","sourceRoot":"","sources":["../../src/services/GlassesTouchInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,UAAU,EAAC,MAAM,wBAAwB,CAAA;AAwCpE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAoD1D;AAED,wBAAgB,eAAe,IAAI,IAAI,CAGtC;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CACzB,WAAW,EACP,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,SAAS,GACT,eAAe,GACf,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,SAAS,GACT,WAAW,GACd,IAAI,CAQN"}
|
|
@@ -47,7 +47,10 @@ function shouldForwardScroll(event) {
|
|
|
47
47
|
export function dispatchTouchEvent(event) {
|
|
48
48
|
const gesture = event.gestureName;
|
|
49
49
|
const claimant = localMiniappRuntime.gestureClaimant(gesture);
|
|
50
|
-
|
|
50
|
+
// The Neural Band's middle finger (index 1) shares the tap names but is left
|
|
51
|
+
// to miniapps: the engine's own double-tap behaviors are the index finger's.
|
|
52
|
+
const osDoubleTap = gesture === "double_tap" && event.index !== 1;
|
|
53
|
+
if (osDoubleTap) {
|
|
51
54
|
// A visible main miniapp opts out of OS exit by registering double tap (the
|
|
52
55
|
// terminal's back-to-menu). The latest claimant still receives it. Otherwise
|
|
53
56
|
// the tap means "leave the app". The controller shows the bounded OS
|
|
@@ -66,7 +69,7 @@ export function dispatchTouchEvent(event) {
|
|
|
66
69
|
if (gesture === "double_tap" && isOverlayApp(claimant))
|
|
67
70
|
dashboardOpenTrace.trigger("double-tap", event.timestamp);
|
|
68
71
|
// The press may have started before this app claimed its release edge.
|
|
69
|
-
gestureDotsService.noteGesture(gesture, true);
|
|
72
|
+
gestureDotsService.noteGesture(gesture, true, event.index);
|
|
70
73
|
if (!shouldForwardScroll(event))
|
|
71
74
|
return;
|
|
72
75
|
localMiniappRuntime.forwardEvent("touch_event", event, undefined, claimant);
|
|
@@ -75,7 +78,7 @@ export function dispatchTouchEvent(event) {
|
|
|
75
78
|
// Gesture-dots debug indicator (any device, gated by its setting). It
|
|
76
79
|
// only paints while the screen is otherwise empty. Process even suppressed
|
|
77
80
|
// scroll repeats here so their completion still clears a held dot.
|
|
78
|
-
gestureDotsService.noteGesture(gesture);
|
|
81
|
+
gestureDotsService.noteGesture(gesture, false, event.index);
|
|
79
82
|
if (!shouldForwardScroll(event))
|
|
80
83
|
return;
|
|
81
84
|
localMiniappRuntime.forwardEvent("touch_event", event);
|
|
@@ -83,7 +86,7 @@ export function dispatchTouchEvent(event) {
|
|
|
83
86
|
// Glassly CFW glasses the dashboard miniapp claims it while it runs
|
|
84
87
|
// (ADR-0006); stock firmware keeps its native dashboard (ADR-0002). The
|
|
85
88
|
// modal nav UI owns the screen; showDashboard would fight it.
|
|
86
|
-
if (
|
|
89
|
+
if (osDoubleTap && !nativeNavigationService.isActive) {
|
|
87
90
|
useDisplayStore.getState().setDisplayEvent({ layout: { layoutType: "unavailable", reason: "firmware-dashboard" } });
|
|
88
91
|
void Promise.resolve(BluetoothSdk.showDashboard()).catch((err) => {
|
|
89
92
|
console.error("DeviceEventRouter: showDashboard failed:", err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlassesTouchInput.js","sourceRoot":"","sources":["../../src/services/GlassesTouchInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,YAAY,EAAkB,MAAM,wBAAwB,CAAA;AACpE,OAAO,YAAY,MAAM,iCAAiC,CAAA;AAE1D,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAA;AACvC,OAAO,kBAAkB,MAAM,4BAA4B,CAAA;AAC3D,OAAO,kBAAkB,MAAM,sBAAsB,CAAA;AACrD,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AACvD,OAAO,uBAAuB,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAA;AAEhD,MAA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,EAAE,KAAK,CAAC,CAAA;IAEtD,uEAAuE;IACvE,oEAAoE;IACpE,wEAAwE;IACxE,8DAA8D;IAC9D,IAAI,WAAW,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,CAAC;QACrD,eAAe,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,EAAC,EAAC,CAAC,CAAA;QAC/G,KAAK,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YAC/D,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE,GAAG,CAAC,CAAA;QAChE,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,kBAAkB,CAAC,KAAK,EAAE,CAAA;IAC1B,gBAAgB,GAAG,IAAI,CAAA;AACzB,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,WAAW,CACzB,WAae;IAEf,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAA;IACpD,kBAAkB,CAAC;QACjB,IAAI,EAAE,aAAa;QACnB,WAAW;QACX,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,KAAK,CAAC,IAAI,YAAY,CAAC,SAAS;QAC3G,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {useDisplayStore} from \"../stores/display\"\nimport {DeviceModels, type TouchEvent} from \"@glassly/bluetooth-sdk\"\nimport BluetoothSdk from \"@glassly/bluetooth-sdk/internal\"\n\nimport {useAppStatusStore} from \"../stores/apps\"\nimport {useGlassesStore} from \"../stores/glasses\"\nimport {BgTimer} from \"../utils/timers\"\nimport dashboardOpenTrace from \"./debug/DashboardOpenTrace\"\nimport gestureDotsService from \"./GestureDotsService\"\nimport localDisplayManager from \"./LocalDisplayManager\"\nimport localMiniappRuntime from \"./LocalMiniappRuntime\"\nimport {MiniappExitGesture} from \"./MiniappExitGesture\"\nimport nativeNavigationService from \"./NativeNavigationService\"\nimport {isOverlayApp} from \"./pages/overlayApps\"\n\nconst miniappExitGesture = new MiniappExitGesture({\n getState: () => useAppStatusStore.getState(),\n getVisiblePackageName: () => localDisplayManager.getVisibleMiniappPackageName(),\n beginExitNotice: (packageName, text) => localDisplayManager.beginMiniappExit(packageName, text),\n finishExitNotice: (packageName) => localDisplayManager.finishMiniappExit(packageName),\n cancelExitNotice: (packageName) => localDisplayManager.cancelMiniappExit(packageName),\n setTimeout: (callback, delay) => BgTimer.setTimeout(callback, delay),\n clearTimeout: (timerId) => BgTimer.clearTimeout(timerId),\n})\n\n// Raw ring reports include every scroll step, whether the CFW forwards them\n// (deviceModel G2) or the ring sends them to the phone itself (deviceModel R1);\n// both tag source 2. Rate-limit scroll actions separately from press/release\n// recognition, using native receipt timestamps so a JS backlog does not\n// collapse otherwise separate gestures.\nconst RING_SCROLL_INTERVAL_MS = 100\nlet lastRingScrollAt: number | null = null\n\nfunction shouldForwardScroll(event: TouchEvent): boolean {\n if (event.source !== 2 || (event.gestureName !== \"swipe_up\" && event.gestureName !== \"swipe_down\")) return true\n const elapsed = lastRingScrollAt === null ? null : event.timestamp - lastRingScrollAt\n if (elapsed !== null && elapsed >= 0 && elapsed < RING_SCROLL_INTERVAL_MS) return false\n lastRingScrollAt = event.timestamp\n return true\n}\n\n/**\n * Route both real glasses input and phone mirror controls through the same\n * policy. A claimed gesture goes to the app holding the claim, alone; an\n * unclaimed one goes to every subscriber and then the engine's default. The\n * one rule ahead of the claims: an unclaimed double tap on a miniapp whose\n * frame is visibly on the glasses leaves that app, whoever else claimed the\n * gesture — the dashboard's claim is for the empty screen.\n */\nexport function dispatchTouchEvent(event: TouchEvent): void {\n const gesture = event.gestureName\n const claimant = localMiniappRuntime.gestureClaimant(gesture)\n // The Neural Band's middle finger (index 1) shares the tap names but is left\n // to miniapps: the engine's own double-tap behaviors are the index finger's.\n const osDoubleTap = gesture === \"double_tap\" && event.index !== 1\n\n if (osDoubleTap) {\n // A visible main miniapp opts out of OS exit by registering double tap (the\n // terminal's back-to-menu). The latest claimant still receives it. Otherwise\n // the tap means \"leave the app\". The controller shows the bounded OS\n // notice first, then uses the normal\n // store stop path (and closes its phone overlay).\n const visible = localDisplayManager.getVisibleMiniappPackageName()\n if (\n visible !== null &&\n !localMiniappRuntime.hasGestureClaim(visible, gesture) &&\n miniappExitGesture.tryExitVisibleMiniapp()\n ) {\n gestureDotsService.noteGesture(gesture, true)\n return\n }\n }\n\n if (claimant !== null) {\n // An overlay app claims the double tap on an empty screen to open the dashboard.\n if (gesture === \"double_tap\" && isOverlayApp(claimant)) dashboardOpenTrace.trigger(\"double-tap\", event.timestamp)\n // The press may have started before this app claimed its release edge.\n gestureDotsService.noteGesture(gesture, true, event.index)\n if (!shouldForwardScroll(event)) return\n localMiniappRuntime.forwardEvent(\"touch_event\", event, undefined, claimant)\n return\n }\n\n // Gesture-dots debug indicator (any device, gated by its setting). It\n // only paints while the screen is otherwise empty. Process even suppressed\n // scroll repeats here so their completion still clears a held dot.\n gestureDotsService.noteGesture(gesture, false, event.index)\n\n if (!shouldForwardScroll(event)) return\n localMiniappRuntime.forwardEvent(\"touch_event\", event)\n\n // Nobody claimed a double tap: the glasses' own dashboard. On eligible\n // Glassly CFW glasses the dashboard miniapp claims it while it runs\n // (ADR-0006); stock firmware keeps its native dashboard (ADR-0002). The\n // modal nav UI owns the screen; showDashboard would fight it.\n if (osDoubleTap && !nativeNavigationService.isActive) {\n useDisplayStore.getState().setDisplayEvent({layout: {layoutType: \"unavailable\", reason: \"firmware-dashboard\"}})\n void Promise.resolve(BluetoothSdk.showDashboard()).catch((err) => {\n console.error(\"DeviceEventRouter: showDashboard failed:\", err)\n })\n }\n}\n\nexport function resetTouchInput(): void {\n miniappExitGesture.reset()\n lastRingScrollAt = null\n}\n\n/** Phone mirror input uses the same dashboard/miniapp policy as real glasses. */\nexport function sendGesture(\n gestureName:\n | \"single_tap\"\n | \"tap_start\"\n | \"double_tap\"\n | \"tap_end\"\n | \"tap_then_hold\"\n | \"touch_down\"\n | \"swipe_up\"\n | \"swipe_down\"\n | \"swipe_left\"\n | \"swipe_right\"\n | \"long_press\"\n | \"dial_up\"\n | \"dial_down\",\n): void {\n const model = useGlassesStore.getState().deviceModel\n dispatchTouchEvent({\n type: \"touch_event\",\n gestureName,\n deviceModel: Object.values(DeviceModels).find((candidate) => candidate === model) ?? DeviceModels.Simulated,\n timestamp: Date.now(),\n })\n}\n"]}
|
|
@@ -235,7 +235,7 @@ declare class LocalMiniappRuntime {
|
|
|
235
235
|
* When the cloud client (re)connects, immediately re-attempt the initial mint
|
|
236
236
|
* for any handshook app still missing its token, instead of waiting out the
|
|
237
237
|
* backoff. This is what turns "scan a dev app before the cloud is ready" from
|
|
238
|
-
* "dead until you manually reconnect Cloud
|
|
238
|
+
* "dead until you manually reconnect Cloud" into "authenticates on its own
|
|
239
239
|
* the instant the connection comes up".
|
|
240
240
|
*/
|
|
241
241
|
private redriveMiniappAuthDelivery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalMiniappRuntime.d.ts","sourceRoot":"","sources":["../../src/services/LocalMiniappRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAsBH,OAAO,KAAK,EAAkB,mBAAmB,EAAqB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"LocalMiniappRuntime.d.ts","sourceRoot":"","sources":["../../src/services/LocalMiniappRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAsBH,OAAO,KAAK,EAAkB,mBAAmB,EAAqB,MAAM,kBAAkB,CAAA;AA0G9F,OAAO,EAA+B,KAAK,gCAAgC,EAAC,MAAM,6BAA6B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AiB,IAAI,MAAM,CAErC;CACF;AAED,QAAA,MAAM,mBAAmB,qBAAoC,CAAA;AAC7D,eAAe,mBAAmB,CAAA"}
|
|
@@ -63,7 +63,7 @@ import { phonePhotoCoordinator } from "./PhonePhotoCoordinator";
|
|
|
63
63
|
import { phoneStreamCoordinator } from "./PhoneStreamCoordinator";
|
|
64
64
|
import { phoneVideoCoordinator } from "./PhoneVideoCoordinator";
|
|
65
65
|
import { runSentenceTtsPipeline } from "./SentenceTtsPipeline";
|
|
66
|
-
import { summarizeTranscriptionRoutes, transcriptionDeliveryRoute } from "./TranscriptionRouting";
|
|
66
|
+
import { summarizeTranscriptionRoutes, transcriptionDeliveryRoute, } from "./TranscriptionRouting";
|
|
67
67
|
import { prepareTtsSentences } from "./TtsTextSanitizer";
|
|
68
68
|
import { handleWifiAdbRequest } from "./WifiAdbRequest";
|
|
69
69
|
import { cloudClientService, setBlobNamespaceMigrator } from "./CloudClientService";
|
|
@@ -152,7 +152,7 @@ const MINIAPP_AUTH_REFRESH_MIN_DELAY_MS = 5_000;
|
|
|
152
152
|
// (e.g. the cloud client had not finished its first-boot Core token exchange
|
|
153
153
|
// when the miniapp connected). Exponential from base, capped, so a transient
|
|
154
154
|
// not-yet-connected client self-heals within seconds instead of needing a full
|
|
155
|
-
// manual Cloud
|
|
155
|
+
// manual Cloud reconnect.
|
|
156
156
|
const MINIAPP_AUTH_RETRY_BASE_MS = 1_000;
|
|
157
157
|
const MINIAPP_AUTH_RETRY_MAX_MS = 15_000;
|
|
158
158
|
const FOREGROUND_LIVENESS_PROBE_TIMEOUT_MS = 2_500;
|
|
@@ -835,6 +835,7 @@ class LocalMiniappRuntime {
|
|
|
835
835
|
subscriptions: new Set(),
|
|
836
836
|
forceLocalTranscriptionStreams: new Set(),
|
|
837
837
|
cloudTranscriptionStreams: new Set(),
|
|
838
|
+
noFallbackTranscriptionStreams: new Set(),
|
|
838
839
|
sendMessage: sendFn,
|
|
839
840
|
lastPongAt: Date.now(),
|
|
840
841
|
unansweredPingRounds: 0,
|
|
@@ -1538,7 +1539,7 @@ class LocalMiniappRuntime {
|
|
|
1538
1539
|
// right after app start. CONNECT_ACK already went out without auth; keep
|
|
1539
1540
|
// trying to mint (and re-drive on cloud-connect) so the app authenticates
|
|
1540
1541
|
// to its backend on its own, instead of staying dead until a full manual
|
|
1541
|
-
// Cloud
|
|
1542
|
+
// Cloud reconnect re-runs the whole handshake.
|
|
1542
1543
|
this.deliverInitialMiniappAuth(packageName, authPromise, 0);
|
|
1543
1544
|
}
|
|
1544
1545
|
this.sendCloudStatusToMiniapp(packageName);
|
|
@@ -1688,7 +1689,7 @@ class LocalMiniappRuntime {
|
|
|
1688
1689
|
* When the cloud client (re)connects, immediately re-attempt the initial mint
|
|
1689
1690
|
* for any handshook app still missing its token, instead of waiting out the
|
|
1690
1691
|
* backoff. This is what turns "scan a dev app before the cloud is ready" from
|
|
1691
|
-
* "dead until you manually reconnect Cloud
|
|
1692
|
+
* "dead until you manually reconnect Cloud" into "authenticates on its own
|
|
1692
1693
|
* the instant the connection comes up".
|
|
1693
1694
|
*/
|
|
1694
1695
|
redriveMiniappAuthDelivery() {
|
|
@@ -1798,6 +1799,7 @@ class LocalMiniappRuntime {
|
|
|
1798
1799
|
let requestedLocationRate = null;
|
|
1799
1800
|
const forceLocalTranscriptionStreams = new Set();
|
|
1800
1801
|
const cloudTranscriptionStreams = new Set();
|
|
1802
|
+
const noFallbackTranscriptionStreams = new Set();
|
|
1801
1803
|
const streams = rawStreams?.map((s) => {
|
|
1802
1804
|
if (typeof s === "object" && s !== null) {
|
|
1803
1805
|
if (s.stream === "location_stream") {
|
|
@@ -1811,6 +1813,8 @@ class LocalMiniappRuntime {
|
|
|
1811
1813
|
}
|
|
1812
1814
|
if (isSpeechTextStream(s.stream) && (s.forceLocal !== true || s.includeCloud === true)) {
|
|
1813
1815
|
cloudTranscriptionStreams.add(s.stream);
|
|
1816
|
+
if (s.localFallback === false)
|
|
1817
|
+
noFallbackTranscriptionStreams.add(s.stream);
|
|
1814
1818
|
}
|
|
1815
1819
|
return s.stream;
|
|
1816
1820
|
}
|
|
@@ -1875,6 +1879,7 @@ class LocalMiniappRuntime {
|
|
|
1875
1879
|
app.subscriptions = new Set(streams);
|
|
1876
1880
|
app.forceLocalTranscriptionStreams = new Set([...forceLocalTranscriptionStreams].filter((stream) => app.subscriptions.has(stream)));
|
|
1877
1881
|
app.cloudTranscriptionStreams = new Set([...cloudTranscriptionStreams].filter((stream) => app.subscriptions.has(stream)));
|
|
1882
|
+
app.noFallbackTranscriptionStreams = new Set([...noFallbackTranscriptionStreams].filter((stream) => app.subscriptions.has(stream)));
|
|
1878
1883
|
this.replaceStreamSubscribers(packageName, previousSubscriptions, app.subscriptions);
|
|
1879
1884
|
// The overlay app presents phone notifications on the glasses while it
|
|
1880
1885
|
// listens to them; recorded for every dashboard so the role can move.
|
|
@@ -4245,6 +4250,7 @@ class LocalMiniappRuntime {
|
|
|
4245
4250
|
const previousSubscriptions = app.subscriptions;
|
|
4246
4251
|
app.subscriptions = new Set(streams);
|
|
4247
4252
|
app.forceLocalTranscriptionStreams.clear();
|
|
4253
|
+
app.noFallbackTranscriptionStreams.clear();
|
|
4248
4254
|
app.cloudTranscriptionStreams = new Set(streams.filter(isSpeechTextStream));
|
|
4249
4255
|
this.replaceStreamSubscribers(packageName, previousSubscriptions, app.subscriptions);
|
|
4250
4256
|
this.recomputeMicRequirements();
|
|
@@ -4310,6 +4316,7 @@ class LocalMiniappRuntime {
|
|
|
4310
4316
|
let transcriptionLang = null;
|
|
4311
4317
|
let forceLocalTranscriptionLang = null;
|
|
4312
4318
|
let hasForceLocalTranscription = false;
|
|
4319
|
+
let hasFallbackTranscription = false;
|
|
4313
4320
|
const localTranslations = [];
|
|
4314
4321
|
for (const [stream, subscribers] of this.activeStreamSubscribers()) {
|
|
4315
4322
|
if (subscribers.size === 0)
|
|
@@ -4340,6 +4347,8 @@ class LocalMiniappRuntime {
|
|
|
4340
4347
|
if (forceLocalTranscriptionLang === null)
|
|
4341
4348
|
forceLocalTranscriptionLang = language;
|
|
4342
4349
|
}
|
|
4350
|
+
if (routes.hasFallbackSubscriber)
|
|
4351
|
+
hasFallbackTranscription = true;
|
|
4343
4352
|
if (routes.hasCloudSubscriber)
|
|
4344
4353
|
cloudStreams.add(stream);
|
|
4345
4354
|
}
|
|
@@ -4351,7 +4360,7 @@ class LocalMiniappRuntime {
|
|
|
4351
4360
|
localTranslationService.setSubscriptions(translatesLocally);
|
|
4352
4361
|
const hasForceLocalTranslation = translatesLocally.some((sub) => sub.forceLocal);
|
|
4353
4362
|
const localSourceLang = translatesLocally.length > 0 ? sttModelManager.getBcp47ForLanguage() : null;
|
|
4354
|
-
localSttFallbackCoordinator.onSubscriptionChange(transcriptionLang !== null || localSourceLang !== null, forceLocalTranscriptionLang ?? transcriptionLang ?? localSourceLang, hasForceLocalTranscription || hasForceLocalTranslation);
|
|
4363
|
+
localSttFallbackCoordinator.onSubscriptionChange(transcriptionLang !== null || localSourceLang !== null, forceLocalTranscriptionLang ?? transcriptionLang ?? localSourceLang, hasForceLocalTranscription || hasForceLocalTranslation, hasFallbackTranscription || localSourceLang !== null);
|
|
4355
4364
|
// Mirror the same set as typed AudioSubscription[]. When Soniox-direct is
|
|
4356
4365
|
// enabled (user API key set), the DIRECT service serves the whole set and
|
|
4357
4366
|
// the cloud gets an EMPTY one — pushed as a real PUT, not skipped, so
|
|
@@ -4500,12 +4509,15 @@ class LocalMiniappRuntime {
|
|
|
4500
4509
|
return;
|
|
4501
4510
|
if (!q.blocked) {
|
|
4502
4511
|
this.lastSttQuotaNoticeAt = 0;
|
|
4503
|
-
void localSttFallbackCoordinator.onSttQuotaBlockedChange(false);
|
|
4512
|
+
void localSttFallbackCoordinator.onSttQuotaBlockedChange(false).then(() => this.broadcastCloudStatus());
|
|
4504
4513
|
this.onQuotaRestored?.("transcription");
|
|
4505
4514
|
return;
|
|
4506
4515
|
}
|
|
4507
4516
|
console.warn(`${LOG_TAG}: cloud transcription blocked by plan quota`);
|
|
4508
4517
|
void localSttFallbackCoordinator.onSttQuotaBlockedChange(true).then(() => {
|
|
4518
|
+
// Miniapps learn of the block through the status snapshot; the lens
|
|
4519
|
+
// notice below is for the wearer.
|
|
4520
|
+
this.broadcastCloudStatus();
|
|
4509
4521
|
const localSttActive = localSttFallbackCoordinator.isActive();
|
|
4510
4522
|
const now = Date.now();
|
|
4511
4523
|
if (now - this.lastSttQuotaNoticeAt >= STT_QUOTA_NOTICE_DEBOUNCE_MS) {
|
|
@@ -4721,6 +4733,7 @@ class LocalMiniappRuntime {
|
|
|
4721
4733
|
return {
|
|
4722
4734
|
status: base.status,
|
|
4723
4735
|
audioTransport: fallbackActive || sonioxDegraded ? "offline" : base.audioTransport,
|
|
4736
|
+
quotaBlocked: localSttFallbackCoordinator.isSttQuotaBlocked() ? ["transcription"] : [],
|
|
4724
4737
|
};
|
|
4725
4738
|
}
|
|
4726
4739
|
broadcastCloudStatus() {
|
|
@@ -4967,6 +4980,7 @@ class LocalMiniappRuntime {
|
|
|
4967
4980
|
return {
|
|
4968
4981
|
cloud: app?.cloudTranscriptionStreams.has(stream) === true,
|
|
4969
4982
|
forceLocal: app?.forceLocalTranscriptionStreams.has(stream) === true,
|
|
4983
|
+
localFallback: app?.noFallbackTranscriptionStreams.has(stream) !== true,
|
|
4970
4984
|
};
|
|
4971
4985
|
}
|
|
4972
4986
|
appTranslationRoutesForEvent(packageName, patterns) {
|
|
@@ -4979,10 +4993,15 @@ class LocalMiniappRuntime {
|
|
|
4979
4993
|
appTranscriptionRoutesForEvent(packageName, stream) {
|
|
4980
4994
|
const app = this.connectedApps.get(packageName);
|
|
4981
4995
|
const autoStream = `${MiniappStreamType.TRANSCRIPTION}:auto`;
|
|
4996
|
+
const cloudExact = app?.cloudTranscriptionStreams.has(stream) === true;
|
|
4997
|
+
const cloudAuto = app?.cloudTranscriptionStreams.has(autoStream) === true;
|
|
4982
4998
|
return {
|
|
4983
|
-
cloud:
|
|
4999
|
+
cloud: cloudExact || cloudAuto,
|
|
4984
5000
|
forceLocal: app?.forceLocalTranscriptionStreams.has(stream) === true ||
|
|
4985
5001
|
app?.forceLocalTranscriptionStreams.has(autoStream) === true,
|
|
5002
|
+
// Fallback stays accepted while any matching default subscription takes it.
|
|
5003
|
+
localFallback: (cloudExact && app?.noFallbackTranscriptionStreams.has(stream) !== true) ||
|
|
5004
|
+
(cloudAuto && app?.noFallbackTranscriptionStreams.has(autoStream) !== true),
|
|
4986
5005
|
};
|
|
4987
5006
|
}
|
|
4988
5007
|
/**
|