@mentra/miniapp 3.4.0-dev.999 → 3.5.0-dev.1238
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 +7 -7
- package/dist/background/index.d.ts +5 -2
- package/dist/background/index.d.ts.map +1 -1
- package/dist/background/index.js.map +1 -1
- package/dist/background/register.d.ts +3 -1
- package/dist/background/register.d.ts.map +1 -1
- package/dist/background/register.js +19 -2
- package/dist/background/register.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/blob.d.ts +2 -1
- package/dist/modules/blob.d.ts.map +1 -1
- package/dist/modules/blob.js +2 -1
- package/dist/modules/blob.js.map +1 -1
- package/dist/modules/events.d.ts +16 -6
- package/dist/modules/events.d.ts.map +1 -1
- package/dist/modules/events.js +53 -47
- package/dist/modules/events.js.map +1 -1
- package/dist/modules/mic.d.ts +26 -4
- package/dist/modules/mic.d.ts.map +1 -1
- package/dist/modules/mic.js +13 -4
- package/dist/modules/mic.js.map +1 -1
- package/dist/modules/miniapps.d.ts +44 -57
- package/dist/modules/miniapps.d.ts.map +1 -1
- package/dist/modules/miniapps.js +21 -24
- package/dist/modules/miniapps.js.map +1 -1
- package/dist/modules/speaker.d.ts +41 -10
- package/dist/modules/speaker.d.ts.map +1 -1
- package/dist/modules/speaker.js +17 -6
- package/dist/modules/speaker.js.map +1 -1
- package/dist/modules/speechProcessing.d.ts +29 -0
- package/dist/modules/speechProcessing.d.ts.map +1 -0
- package/dist/modules/speechProcessing.js +22 -0
- package/dist/modules/speechProcessing.js.map +1 -0
- package/dist/modules/system.d.ts +8 -3
- package/dist/modules/system.d.ts.map +1 -1
- package/dist/modules/system.js +1 -1
- package/dist/modules/system.js.map +1 -1
- package/dist/modules/telemetry.d.ts +25 -0
- package/dist/modules/telemetry.d.ts.map +1 -0
- package/dist/modules/telemetry.js +61 -0
- package/dist/modules/telemetry.js.map +1 -0
- package/dist/modules/transcription.d.ts +70 -3
- package/dist/modules/transcription.d.ts.map +1 -1
- package/dist/modules/transcription.js +68 -2
- package/dist/modules/transcription.js.map +1 -1
- package/dist/protocol.d.ts +29 -15
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +30 -15
- package/dist/protocol.js.map +1 -1
- package/dist/react/MentraProvider.d.ts +13 -1
- package/dist/react/MentraProvider.d.ts.map +1 -1
- package/dist/react/MentraProvider.js +31 -1
- package/dist/react/MentraProvider.js.map +1 -1
- package/dist/session.d.ts +59 -6
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +203 -43
- package/dist/session.js.map +1 -1
- package/dist/transport/auto.js +6 -0
- package/dist/transport/auto.js.map +1 -1
- package/dist/transport/dispatch.d.ts +2 -0
- package/dist/transport/dispatch.d.ts.map +1 -1
- package/dist/transport/dispatch.js +7 -2
- package/dist/transport/dispatch.js.map +1 -1
- package/dist/transport/local-socket.d.ts +6 -0
- package/dist/transport/local-socket.d.ts.map +1 -1
- package/dist/transport/local-socket.js +34 -2
- package/dist/transport/local-socket.js.map +1 -1
- package/dist/transport/types.d.ts +4 -1
- package/dist/transport/types.d.ts.map +1 -1
- package/dist/ui/index.d.ts +7 -4
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js.map +1 -1
- package/package.json +2 -2
- package/src/background/index.ts +6 -3
- package/src/background/register.ts +24 -2
- package/src/index.ts +11 -3
- package/src/modules/blob.ts +2 -1
- package/src/modules/events.ts +65 -51
- package/src/modules/mic.ts +30 -4
- package/src/modules/miniapps.ts +59 -71
- package/src/modules/speaker.ts +56 -12
- package/src/modules/speechProcessing.ts +42 -0
- package/src/modules/system.ts +8 -3
- package/src/modules/telemetry.ts +62 -0
- package/src/modules/transcription.ts +106 -9
- package/src/protocol.ts +32 -16
- package/src/react/MentraProvider.tsx +23 -2
- package/src/session.ts +206 -52
- package/src/transport/auto.ts +5 -0
- package/src/transport/dispatch.ts +7 -2
- package/src/transport/local-socket.ts +30 -1
- package/src/transport/types.ts +4 -1
- package/src/ui/index.ts +7 -4
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* session.transcription.on(handler) // auto-detect
|
|
7
7
|
* session.transcription.forLanguage("en-US", handler) // single language
|
|
8
8
|
* session.transcription.forLanguage(["en-US", "es-ES"], handler) // multi-language
|
|
9
|
+
* session.transcription.on(handler, {processing: "preferLocal"}) // on-device when it can
|
|
9
10
|
* session.transcription.configure({languageHints, vocabulary, diarization})
|
|
11
|
+
* session.transcription.onModelStatus(handler) // on-device model state
|
|
12
|
+
* session.transcription.finishUtterance() // end the on-device line now
|
|
10
13
|
* session.transcription.stop() // tear down all
|
|
11
14
|
*
|
|
12
15
|
* Hoisted to top-level (vs. nested under `session.mic`) because transcription
|
|
@@ -19,11 +22,15 @@
|
|
|
19
22
|
*/
|
|
20
23
|
import { MiniappRequestType, MiniappStreamType } from "../protocol";
|
|
21
24
|
import { requireLanguageHint, requireTranscriptionLanguage } from "./languages";
|
|
25
|
+
import { resolveSpeechProcessing } from "./speechProcessing";
|
|
22
26
|
export class TranscriptionModule {
|
|
23
27
|
constructor(session) {
|
|
24
28
|
this.session = session;
|
|
25
29
|
this.unsubs = new Set();
|
|
26
30
|
this.currentConfig = null;
|
|
31
|
+
this.modelStatusHandlers = new Set();
|
|
32
|
+
this.modelStatusUnsub = null;
|
|
33
|
+
this.modelStatus = null;
|
|
27
34
|
}
|
|
28
35
|
/**
|
|
29
36
|
* Subscribe to all transcription events (auto-detect language). The
|
|
@@ -34,7 +41,10 @@ export class TranscriptionModule {
|
|
|
34
41
|
* event) preserves existing semantics.
|
|
35
42
|
*/
|
|
36
43
|
on(handler, options = {}) {
|
|
37
|
-
|
|
44
|
+
const processing = resolveSpeechProcessing(options, "transcription.on(options)");
|
|
45
|
+
return this.track(this.session._subscribe(`${MiniappStreamType.TRANSCRIPTION}:auto`, handler, {
|
|
46
|
+
processing,
|
|
47
|
+
}));
|
|
38
48
|
}
|
|
39
49
|
/**
|
|
40
50
|
* Subscribe to transcription for one or more specific languages. Each call
|
|
@@ -52,11 +62,14 @@ export class TranscriptionModule {
|
|
|
52
62
|
*/
|
|
53
63
|
forLanguage(language, handler, options = {}) {
|
|
54
64
|
const langs = (Array.isArray(language) ? language : [language]).map((lang) => requireTranscriptionLanguage(lang, "transcription.forLanguage(language)"));
|
|
65
|
+
const processing = resolveSpeechProcessing(options, "transcription.forLanguage(options)");
|
|
55
66
|
if (langs.length === 0)
|
|
56
67
|
return () => { };
|
|
57
68
|
const unsubs = [];
|
|
58
69
|
for (const lang of langs) {
|
|
59
|
-
unsubs.push(this.session._subscribe(`${MiniappStreamType.TRANSCRIPTION}:${lang}`, handler,
|
|
70
|
+
unsubs.push(this.session._subscribe(`${MiniappStreamType.TRANSCRIPTION}:${lang}`, handler, {
|
|
71
|
+
processing,
|
|
72
|
+
}));
|
|
60
73
|
}
|
|
61
74
|
const combined = () => {
|
|
62
75
|
for (const u of unsubs) {
|
|
@@ -94,6 +107,59 @@ export class TranscriptionModule {
|
|
|
94
107
|
})
|
|
95
108
|
.then(() => undefined);
|
|
96
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Follow the on-device speech-to-text model's state. You get the current
|
|
112
|
+
* state right away, then every change. Use it to show "downloading 40%" or
|
|
113
|
+
* to wait for `ready` before relying on on-device transcripts.
|
|
114
|
+
*/
|
|
115
|
+
onModelStatus(handler) {
|
|
116
|
+
this.modelStatusHandlers.add(handler);
|
|
117
|
+
if (!this.modelStatusUnsub) {
|
|
118
|
+
// One stream subscription per module; the host sends its current state on subscribe.
|
|
119
|
+
this.modelStatusUnsub = this.session._subscribe(MiniappStreamType.TRANSCRIPTION_MODEL_STATUS, (data) => {
|
|
120
|
+
const status = data;
|
|
121
|
+
this.modelStatus = status;
|
|
122
|
+
for (const listener of [...this.modelStatusHandlers])
|
|
123
|
+
listener(status);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
else if (this.modelStatus) {
|
|
127
|
+
// Later handlers get the last state locally, since the host only replays on subscribe.
|
|
128
|
+
const current = this.modelStatus;
|
|
129
|
+
queueMicrotask(() => {
|
|
130
|
+
if (this.modelStatusHandlers.has(handler) && this.modelStatus === current)
|
|
131
|
+
handler(current);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return this.track(() => {
|
|
135
|
+
this.modelStatusHandlers.delete(handler);
|
|
136
|
+
if (this.modelStatusHandlers.size > 0)
|
|
137
|
+
return;
|
|
138
|
+
this.modelStatusUnsub?.();
|
|
139
|
+
this.modelStatusUnsub = null;
|
|
140
|
+
this.modelStatus = null;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* End the current on-device utterance now, instead of waiting for the
|
|
145
|
+
* recognizer's own end-of-speech pause. Call it when your own end-of-turn
|
|
146
|
+
* rule fires (for example after `mic.onVoiceActivity` reports enough
|
|
147
|
+
* silence).
|
|
148
|
+
*
|
|
149
|
+
* Resolves with the final text once that final transcript has been
|
|
150
|
+
* delivered to your on-device handlers, or `""` when nothing was pending.
|
|
151
|
+
* Resolves `null` when no on-device recognizer is running or the picked
|
|
152
|
+
* model can't finish early (models that transcribe in fixed chunks); their
|
|
153
|
+
* final text still arrives on its own.
|
|
154
|
+
*
|
|
155
|
+
* Applies only to on-device transcription and needs a `localOnly` listener
|
|
156
|
+
* or one that is getting on-device text right now. The phone runs one
|
|
157
|
+
* recognizer for every miniapp, so this ends the current line for every
|
|
158
|
+
* on-device subscriber, Captions included.
|
|
159
|
+
*/
|
|
160
|
+
finishUtterance() {
|
|
161
|
+
return this.session.sendRequest({ type: MiniappRequestType.TRANSCRIPTION_FINISH });
|
|
162
|
+
}
|
|
97
163
|
/** Tear down every transcription subscription this module owns. */
|
|
98
164
|
stop() {
|
|
99
165
|
for (const u of this.unsubs) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcription.js","sourceRoot":"","sources":["../../src/modules/transcription.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
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AoB,EAAC,CAAC,CAAA;IACjG,CAAC;IAED,mEAAmE;IACnE,IAAI;QACF,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC5B,IAAI,CAAC;gBACH,CAAC,EAAE,CAAA;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,YAAY;YACd,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IAED,mEAAmE;IACnE,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAA;IAC1D,CAAC;IAED,0EAA0E;IAC1E,UAAU;QACR,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAC,GAAG,IAAI,CAAC,aAAa,EAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC5D,CAAC;IAED,2EAA2E;IAEnE,KAAK,CAAC,KAAoB;QAChC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACtB,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YACzB,KAAK,EAAE,CAAA;QACT,CAAC,CAAA;IACH,CAAC;CACF"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -18,7 +18,16 @@ export declare enum MiniappRequestType {
|
|
|
18
18
|
READY = "miniapp_ready",
|
|
19
19
|
/** Request a fresh miniapp-scoped backend auth token. */
|
|
20
20
|
AUTH_REFRESH = "miniapp_auth_refresh",
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Update the set of streams the miniapp is subscribed to. `subscriptions`
|
|
23
|
+
* lists stream names; a transcription stream is `{stream, processing}`, one
|
|
24
|
+
* entry per processing its listeners ask for, and `transcriptionListeners`
|
|
25
|
+
* lists every transcription listener as `{id, stream, processing}`. Both
|
|
26
|
+
* also carry `forceLocal: true` for `localOnly`, the form hosts before
|
|
27
|
+
* `processing` read. Hosts accept that older form,
|
|
28
|
+
* `{stream, forceLocal?, includeCloud?}`, from SDKs that predate
|
|
29
|
+
* `processing`.
|
|
30
|
+
*/
|
|
22
31
|
SUBSCRIBE = "miniapp_subscribe",
|
|
23
32
|
/**
|
|
24
33
|
* Push a legacy display layout to the glasses. The SDK no longer emits this
|
|
@@ -32,7 +41,7 @@ export declare enum MiniappRequestType {
|
|
|
32
41
|
PLAY_AUDIO = "miniapp_play_audio",
|
|
33
42
|
/** Stop any audio playback this miniapp initiated. */
|
|
34
43
|
STOP_AUDIO = "miniapp_stop_audio",
|
|
35
|
-
/** Speak text via cloud TTS
|
|
44
|
+
/** Speak text via cloud or on-device TTS, as its `processing` says. */
|
|
36
45
|
SPEAK = "miniapp_speak",
|
|
37
46
|
/**
|
|
38
47
|
* Live PCM output stream to the phone's audio playback service
|
|
@@ -161,6 +170,14 @@ export declare enum MiniappRequestType {
|
|
|
161
170
|
* so future reconnect logic can re-send.
|
|
162
171
|
*/
|
|
163
172
|
TRANSCRIPTION_CONFIG = "miniapp_transcription_config",
|
|
173
|
+
/**
|
|
174
|
+
* End the current on-device utterance now (transcription.finishUtterance).
|
|
175
|
+
* Result: the final text, "" when nothing was pending, or null when the
|
|
176
|
+
* model can't finish early.
|
|
177
|
+
*/
|
|
178
|
+
TRANSCRIPTION_FINISH = "miniapp_transcription_finish",
|
|
179
|
+
/** A miniapp's own analytics event (`session.telemetry.capture`). One-shot; hosts with `hostFeatures.telemetry`. */
|
|
180
|
+
TELEMETRY_CAPTURE = "miniapp_telemetry_capture",
|
|
164
181
|
/** Dashboard content update. Noop in v1. */
|
|
165
182
|
DASHBOARD_CONTENT_UPDATE = "miniapp_dashboard_content_update",
|
|
166
183
|
PHOTO = "miniapp_photo",
|
|
@@ -189,11 +206,11 @@ export declare enum MiniappRequestType {
|
|
|
189
206
|
MINIAPPS_START = "miniapp_apps_start",
|
|
190
207
|
/** Stop another miniapp. */
|
|
191
208
|
MINIAPPS_STOP = "miniapp_apps_stop",
|
|
192
|
-
/** Install
|
|
209
|
+
/** Install the miniapp at a miniapp URL. System-list miniapps only. */
|
|
193
210
|
MINIAPPS_INSTALL = "miniapp_apps_install",
|
|
194
211
|
/** Preflight a release's host/SDK/hardware requirements without downloading it. */
|
|
195
212
|
MINIAPPS_INSTALL_CHECK = "miniapp_apps_install_check",
|
|
196
|
-
/** Uninstall a
|
|
213
|
+
/** Uninstall a miniapp installed from a miniapp URL. System-list miniapps only. */
|
|
197
214
|
MINIAPPS_UNINSTALL = "miniapp_apps_uninstall",
|
|
198
215
|
/** Invoke a declared action on another miniapp; headless-wakes it if stopped. */
|
|
199
216
|
ACTION_INVOKE = "miniapp_action_invoke",
|
|
@@ -246,8 +263,6 @@ export declare enum MiniappResponseType {
|
|
|
246
263
|
VISIBILITY_CHANGE = "miniapp_visibility_change",
|
|
247
264
|
/** Push: host color scheme (light/dark) changed. */
|
|
248
265
|
COLOR_SCHEME_CHANGE = "miniapp_color_scheme_change",
|
|
249
|
-
/** Push: a Store installation moved to another host-side phase. */
|
|
250
|
-
MINIAPPS_INSTALL_PROGRESS = "miniapp_apps_install_progress",
|
|
251
266
|
/**
|
|
252
267
|
* Push: speaker playback state transitioned. Per-miniapp; the runtime sends
|
|
253
268
|
* to the owning miniapp only. Carries {state, errorCode?, errorMessage?,
|
|
@@ -322,6 +337,10 @@ export declare enum MiniappStreamType {
|
|
|
322
337
|
GLASSES_WIFI = "glasses_wifi",
|
|
323
338
|
TRANSCRIPTION = "transcription",// language variant: "transcription:en-US"
|
|
324
339
|
TRANSLATION = "translation",// language variant: "translation:en-US"
|
|
340
|
+
/** State of the on-device speech-to-text model (session.transcription.onModelStatus). */
|
|
341
|
+
TRANSCRIPTION_MODEL_STATUS = "transcription_model_status",
|
|
342
|
+
/** On-device "Hey Mentra" keyword spotter (session.mic.onWakeWord). */
|
|
343
|
+
WAKE_WORD = "wake_word",
|
|
325
344
|
AUDIO_CHUNK = "audio_chunk",
|
|
326
345
|
VAD = "vad",
|
|
327
346
|
LOCATION_UPDATE = "location_update",
|
|
@@ -360,7 +379,7 @@ export declare enum MiniappErrorCode {
|
|
|
360
379
|
TTS_TEXT_TOO_LONG = "TTS_TEXT_TOO_LONG",
|
|
361
380
|
TTS_INVALID_VOICE = "TTS_INVALID_VOICE",
|
|
362
381
|
TTS_UPSTREAM_ERROR = "TTS_UPSTREAM_ERROR",
|
|
363
|
-
/** `speak({
|
|
382
|
+
/** `speak({processing: "localOnly"})` but the on-device TTS model isn't downloaded/ready. */
|
|
364
383
|
TTS_LOCAL_UNAVAILABLE = "TTS_LOCAL_UNAVAILABLE",
|
|
365
384
|
/** Not connected / pre-ACK and transport closed. */
|
|
366
385
|
NOT_CONNECTED = "NOT_CONNECTED",
|
|
@@ -370,21 +389,16 @@ export declare enum MiniappErrorCode {
|
|
|
370
389
|
MIC_SOURCE_CONFLICT = "MIC_SOURCE_CONFLICT",
|
|
371
390
|
/**
|
|
372
391
|
* Caller is not a system app — SYSTEM-only APIs (interop list/start/stop/invoke,
|
|
373
|
-
* setWifiAdbState) reject with this code
|
|
392
|
+
* setWifiAdbState) reject with this code, as installs do from any miniapp off
|
|
393
|
+
* the system list. Also: an uninstall of a miniapp that isn't a URL install.
|
|
374
394
|
*/
|
|
375
395
|
NOT_PERMITTED = "NOT_PERMITTED",
|
|
376
396
|
/** Target miniapp is not installed. */
|
|
377
397
|
APP_NOT_FOUND = "APP_NOT_FOUND",
|
|
378
398
|
/** Target miniapp is incompatible with the connected glasses. */
|
|
379
399
|
APP_NOT_COMPATIBLE = "APP_NOT_COMPATIBLE",
|
|
380
|
-
/**
|
|
400
|
+
/** The miniapp didn't install; the error's `reason` says why (`InstallMiniappFailureReason`). */
|
|
381
401
|
INSTALL_FAILED = "INSTALL_FAILED",
|
|
382
|
-
/** Another Store installation is already in progress for the same package. */
|
|
383
|
-
INSTALL_IN_PROGRESS = "INSTALL_IN_PROGRESS",
|
|
384
|
-
/** An automatic update was deferred because the target is running or starting. */
|
|
385
|
-
APP_RUNNING = "APP_RUNNING",
|
|
386
|
-
/** Another Store owns the installed package's update provenance. */
|
|
387
|
-
STORE_OWNERSHIP_CONFLICT = "STORE_OWNERSHIP_CONFLICT",
|
|
388
402
|
/** Target miniapp does not declare the requested action. */
|
|
389
403
|
ACTION_NOT_FOUND = "ACTION_NOT_FOUND",
|
|
390
404
|
/** Target connected but never registered a handler for the action (within the buffer window). */
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,oBAAY,kBAAkB;IAC5B,8EAA8E;IAC9E,OAAO,oBAAoB;IAE3B;;;;OAIG;IACH,KAAK,kBAAkB;IAEvB,yDAAyD;IACzD,YAAY,yBAAyB;IAErC
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,oBAAY,kBAAkB;IAC5B,8EAA8E;IAC9E,OAAO,oBAAoB;IAE3B;;;;OAIG;IACH,KAAK,kBAAkB;IAEvB,yDAAyD;IACzD,YAAY,yBAAyB;IAErC;;;;;;;;;OASG;IACH,SAAS,sBAAsB;IAE/B;;;;OAIG;IACH,OAAO,oBAAoB;IAE3B,uEAAuE;IACvE,MAAM,mBAAmB;IAEzB,8EAA8E;IAC9E,UAAU,uBAAuB;IAEjC,sDAAsD;IACtD,UAAU,uBAAuB;IAEjC,uEAAuE;IACvE,KAAK,kBAAkB;IAEvB;;;;;OAKG;IACH,mBAAmB,gCAAgC;IACnD,oBAAoB,iCAAiC;IACrD,oBAAoB,iCAAiC;IACrD,oBAAoB,iCAAiC;IAErD,mCAAmC;IACnC,OAAO,oBAAoB;IAE3B,8BAA8B;IAC9B,aAAa,0BAA0B;IAEvC,wDAAwD;IACxD,oBAAoB,iCAAiC;IAErD,0DAA0D;IAC1D,gBAAg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AsB;IAGvC,6DAA6D;IAC7D,cAAc,mBAAmB;IACjC,6DAA6D;IAC7D,mBAAmB,wBAAwB;IAC3C,iEAAiE;IACjE,cAAc,mBAAmB;IACjC,gFAAgF;IAChF,mBAAmB,wBAAwB;IAC3C,gEAAgE;IAChE,iBAAiB,sBAAsB;IACvC,wEAAwE;IACxE,oBAAoB,yBAAyB;IAC7C,kFAAkF;IAClF,kBAAkB,uBAAuB;CAC1C;AAMD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,CAAA;AAE9C;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,mBAAmB,GACnB,mBAAmB,GACnB,cAAc,GACd,mBAAmB,GACnB,cAAc,GACd,aAAa,GACb,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,mBAAmB,GACnB,sBAAsB,CAAA;AAE1B,eAAO,MAAM,mBAAmB,EAAE,SAAS,gBAAgB,EAY1D,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E;AAED,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,aAAa,CAAA"}
|
package/dist/protocol.js
CHANGED
|
@@ -22,7 +22,16 @@ export var MiniappRequestType;
|
|
|
22
22
|
MiniappRequestType["READY"] = "miniapp_ready";
|
|
23
23
|
/** Request a fresh miniapp-scoped backend auth token. */
|
|
24
24
|
MiniappRequestType["AUTH_REFRESH"] = "miniapp_auth_refresh";
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Update the set of streams the miniapp is subscribed to. `subscriptions`
|
|
27
|
+
* lists stream names; a transcription stream is `{stream, processing}`, one
|
|
28
|
+
* entry per processing its listeners ask for, and `transcriptionListeners`
|
|
29
|
+
* lists every transcription listener as `{id, stream, processing}`. Both
|
|
30
|
+
* also carry `forceLocal: true` for `localOnly`, the form hosts before
|
|
31
|
+
* `processing` read. Hosts accept that older form,
|
|
32
|
+
* `{stream, forceLocal?, includeCloud?}`, from SDKs that predate
|
|
33
|
+
* `processing`.
|
|
34
|
+
*/
|
|
26
35
|
MiniappRequestType["SUBSCRIBE"] = "miniapp_subscribe";
|
|
27
36
|
/**
|
|
28
37
|
* Push a legacy display layout to the glasses. The SDK no longer emits this
|
|
@@ -36,7 +45,7 @@ export var MiniappRequestType;
|
|
|
36
45
|
MiniappRequestType["PLAY_AUDIO"] = "miniapp_play_audio";
|
|
37
46
|
/** Stop any audio playback this miniapp initiated. */
|
|
38
47
|
MiniappRequestType["STOP_AUDIO"] = "miniapp_stop_audio";
|
|
39
|
-
/** Speak text via cloud TTS
|
|
48
|
+
/** Speak text via cloud or on-device TTS, as its `processing` says. */
|
|
40
49
|
MiniappRequestType["SPEAK"] = "miniapp_speak";
|
|
41
50
|
/**
|
|
42
51
|
* Live PCM output stream to the phone's audio playback service
|
|
@@ -165,6 +174,15 @@ export var MiniappRequestType;
|
|
|
165
174
|
* so future reconnect logic can re-send.
|
|
166
175
|
*/
|
|
167
176
|
MiniappRequestType["TRANSCRIPTION_CONFIG"] = "miniapp_transcription_config";
|
|
177
|
+
/**
|
|
178
|
+
* End the current on-device utterance now (transcription.finishUtterance).
|
|
179
|
+
* Result: the final text, "" when nothing was pending, or null when the
|
|
180
|
+
* model can't finish early.
|
|
181
|
+
*/
|
|
182
|
+
MiniappRequestType["TRANSCRIPTION_FINISH"] = "miniapp_transcription_finish";
|
|
183
|
+
// ----- Telemetry -----
|
|
184
|
+
/** A miniapp's own analytics event (`session.telemetry.capture`). One-shot; hosts with `hostFeatures.telemetry`. */
|
|
185
|
+
MiniappRequestType["TELEMETRY_CAPTURE"] = "miniapp_telemetry_capture";
|
|
168
186
|
// ----- Deferred in v1 -----
|
|
169
187
|
/** Dashboard content update. Noop in v1. */
|
|
170
188
|
MiniappRequestType["DASHBOARD_CONTENT_UPDATE"] = "miniapp_dashboard_content_update";
|
|
@@ -196,11 +214,11 @@ export var MiniappRequestType;
|
|
|
196
214
|
MiniappRequestType["MINIAPPS_START"] = "miniapp_apps_start";
|
|
197
215
|
/** Stop another miniapp. */
|
|
198
216
|
MiniappRequestType["MINIAPPS_STOP"] = "miniapp_apps_stop";
|
|
199
|
-
/** Install
|
|
217
|
+
/** Install the miniapp at a miniapp URL. System-list miniapps only. */
|
|
200
218
|
MiniappRequestType["MINIAPPS_INSTALL"] = "miniapp_apps_install";
|
|
201
219
|
/** Preflight a release's host/SDK/hardware requirements without downloading it. */
|
|
202
220
|
MiniappRequestType["MINIAPPS_INSTALL_CHECK"] = "miniapp_apps_install_check";
|
|
203
|
-
/** Uninstall a
|
|
221
|
+
/** Uninstall a miniapp installed from a miniapp URL. System-list miniapps only. */
|
|
204
222
|
MiniappRequestType["MINIAPPS_UNINSTALL"] = "miniapp_apps_uninstall";
|
|
205
223
|
/** Invoke a declared action on another miniapp; headless-wakes it if stopped. */
|
|
206
224
|
MiniappRequestType["ACTION_INVOKE"] = "miniapp_action_invoke";
|
|
@@ -257,8 +275,6 @@ export var MiniappResponseType;
|
|
|
257
275
|
MiniappResponseType["VISIBILITY_CHANGE"] = "miniapp_visibility_change";
|
|
258
276
|
/** Push: host color scheme (light/dark) changed. */
|
|
259
277
|
MiniappResponseType["COLOR_SCHEME_CHANGE"] = "miniapp_color_scheme_change";
|
|
260
|
-
/** Push: a Store installation moved to another host-side phase. */
|
|
261
|
-
MiniappResponseType["MINIAPPS_INSTALL_PROGRESS"] = "miniapp_apps_install_progress";
|
|
262
278
|
/**
|
|
263
279
|
* Push: speaker playback state transitioned. Per-miniapp; the runtime sends
|
|
264
280
|
* to the owning miniapp only. Carries {state, errorCode?, errorMessage?,
|
|
@@ -340,6 +356,10 @@ export var MiniappStreamType;
|
|
|
340
356
|
// Speech / audio (cloud or local)
|
|
341
357
|
MiniappStreamType["TRANSCRIPTION"] = "transcription";
|
|
342
358
|
MiniappStreamType["TRANSLATION"] = "translation";
|
|
359
|
+
/** State of the on-device speech-to-text model (session.transcription.onModelStatus). */
|
|
360
|
+
MiniappStreamType["TRANSCRIPTION_MODEL_STATUS"] = "transcription_model_status";
|
|
361
|
+
/** On-device "Hey Mentra" keyword spotter (session.mic.onWakeWord). */
|
|
362
|
+
MiniappStreamType["WAKE_WORD"] = "wake_word";
|
|
343
363
|
MiniappStreamType["AUDIO_CHUNK"] = "audio_chunk";
|
|
344
364
|
MiniappStreamType["VAD"] = "vad";
|
|
345
365
|
// Phone sensors
|
|
@@ -384,7 +404,7 @@ export var MiniappErrorCode;
|
|
|
384
404
|
MiniappErrorCode["TTS_TEXT_TOO_LONG"] = "TTS_TEXT_TOO_LONG";
|
|
385
405
|
MiniappErrorCode["TTS_INVALID_VOICE"] = "TTS_INVALID_VOICE";
|
|
386
406
|
MiniappErrorCode["TTS_UPSTREAM_ERROR"] = "TTS_UPSTREAM_ERROR";
|
|
387
|
-
/** `speak({
|
|
407
|
+
/** `speak({processing: "localOnly"})` but the on-device TTS model isn't downloaded/ready. */
|
|
388
408
|
MiniappErrorCode["TTS_LOCAL_UNAVAILABLE"] = "TTS_LOCAL_UNAVAILABLE";
|
|
389
409
|
/** Not connected / pre-ACK and transport closed. */
|
|
390
410
|
MiniappErrorCode["NOT_CONNECTED"] = "NOT_CONNECTED";
|
|
@@ -395,21 +415,16 @@ export var MiniappErrorCode;
|
|
|
395
415
|
// ----- Inter-miniapp interop -----
|
|
396
416
|
/**
|
|
397
417
|
* Caller is not a system app — SYSTEM-only APIs (interop list/start/stop/invoke,
|
|
398
|
-
* setWifiAdbState) reject with this code
|
|
418
|
+
* setWifiAdbState) reject with this code, as installs do from any miniapp off
|
|
419
|
+
* the system list. Also: an uninstall of a miniapp that isn't a URL install.
|
|
399
420
|
*/
|
|
400
421
|
MiniappErrorCode["NOT_PERMITTED"] = "NOT_PERMITTED";
|
|
401
422
|
/** Target miniapp is not installed. */
|
|
402
423
|
MiniappErrorCode["APP_NOT_FOUND"] = "APP_NOT_FOUND";
|
|
403
424
|
/** Target miniapp is incompatible with the connected glasses. */
|
|
404
425
|
MiniappErrorCode["APP_NOT_COMPATIBLE"] = "APP_NOT_COMPATIBLE";
|
|
405
|
-
/**
|
|
426
|
+
/** The miniapp didn't install; the error's `reason` says why (`InstallMiniappFailureReason`). */
|
|
406
427
|
MiniappErrorCode["INSTALL_FAILED"] = "INSTALL_FAILED";
|
|
407
|
-
/** Another Store installation is already in progress for the same package. */
|
|
408
|
-
MiniappErrorCode["INSTALL_IN_PROGRESS"] = "INSTALL_IN_PROGRESS";
|
|
409
|
-
/** An automatic update was deferred because the target is running or starting. */
|
|
410
|
-
MiniappErrorCode["APP_RUNNING"] = "APP_RUNNING";
|
|
411
|
-
/** Another Store owns the installed package's update provenance. */
|
|
412
|
-
MiniappErrorCode["STORE_OWNERSHIP_CONFLICT"] = "STORE_OWNERSHIP_CONFLICT";
|
|
413
428
|
/** Target miniapp does not declare the requested action. */
|
|
414
429
|
MiniappErrorCode["ACTION_NOT_FOUND"] = "ACTION_NOT_FOUND";
|
|
415
430
|
/** Target connected but never registered a handler for the action (within the buffer window). */
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,iDAAiD;AACjD,+EAA+E;AAE/E,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,iDAAiD;AACjD,+EAA+E;AAE/E,MAAM,CAAN,IAAY,kBAqRX;AArRD,WAAY,kBAAkB;IAC5B,8EAA8E;IAC9E,iDAA2B,CAAA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BAAmB;IACnB,cAAc;IACd,mBAAmB;IACnB,cAAc;IACd,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,aAAa;IACb,mBAAmB;IACnB,sBAAsB;CACvB,CAAA;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,mBAAyC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAChG,CAAC;AAUD,kFAAkF;AAClF,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAA"}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* miniapp. Currently:
|
|
6
6
|
* - Keeps `<html class="dark">` in sync with the host's color scheme so the
|
|
7
7
|
* shared theme CSS switches automatically.
|
|
8
|
+
* - Calls `mentra.ready()` once the app has mounted, which lifts the host's
|
|
9
|
+
* splash and fires the background's `session.ui.onOpen` handlers.
|
|
8
10
|
*
|
|
9
11
|
* Usage:
|
|
10
12
|
* createRoot(root).render(
|
|
@@ -28,6 +30,16 @@ export interface MentraProviderProps {
|
|
|
28
30
|
* (e.g. you integrate a theming library like next-themes).
|
|
29
31
|
*/
|
|
30
32
|
syncColorScheme?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Call `mentra.ready()` after the first mount. A parent's effects run after
|
|
35
|
+
* its children's, so every `mentra.on` subscription the app makes on mount
|
|
36
|
+
* is attached before the background is told the UI is open. Without
|
|
37
|
+
* `ready()` the host keeps its splash up and reports the miniapp as failed.
|
|
38
|
+
*
|
|
39
|
+
* Default: true. Set to false to call `mentra.ready()` yourself, e.g. to keep
|
|
40
|
+
* the splash up until the first screen has its data.
|
|
41
|
+
*/
|
|
42
|
+
autoReady?: boolean;
|
|
31
43
|
}
|
|
32
|
-
export declare function MentraProvider({ children, syncColorScheme }: MentraProviderProps): import("react").JSX.Element;
|
|
44
|
+
export declare function MentraProvider({ children, syncColorScheme, autoReady }: MentraProviderProps): import("react").JSX.Element;
|
|
33
45
|
//# sourceMappingURL=MentraProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentraProvider.d.ts","sourceRoot":"","sources":["../../src/react/MentraProvider.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"MentraProvider.d.ts","sourceRoot":"","sources":["../../src/react/MentraProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAI/C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAOD,wBAAgB,cAAc,CAAC,EAAC,QAAQ,EAAE,eAAsB,EAAE,SAAgB,EAAC,EAAE,mBAAmB,+BAiBvG"}
|
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview MentraProvider — optional root provider for miniapp apps.
|
|
4
|
+
*
|
|
5
|
+
* Opt-in conveniences that would otherwise require boilerplate in every
|
|
6
|
+
* miniapp. Currently:
|
|
7
|
+
* - Keeps `<html class="dark">` in sync with the host's color scheme so the
|
|
8
|
+
* shared theme CSS switches automatically.
|
|
9
|
+
* - Calls `mentra.ready()` once the app has mounted, which lifts the host's
|
|
10
|
+
* splash and fires the background's `session.ui.onOpen` handlers.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* createRoot(root).render(
|
|
14
|
+
* <MentraProvider>
|
|
15
|
+
* <App />
|
|
16
|
+
* </MentraProvider>
|
|
17
|
+
* )
|
|
18
|
+
*
|
|
19
|
+
* Each convenience is controllable via props so miniapps that manage these
|
|
20
|
+
* things themselves can opt out without forking the provider.
|
|
21
|
+
*/
|
|
22
|
+
import { useEffect } from "react";
|
|
2
23
|
import { useColorScheme } from "./useColorScheme";
|
|
3
|
-
|
|
24
|
+
function getBridge() {
|
|
25
|
+
if (typeof window === "undefined")
|
|
26
|
+
return null;
|
|
27
|
+
return window.mentra ?? null;
|
|
28
|
+
}
|
|
29
|
+
export function MentraProvider({ children, syncColorScheme = true, autoReady = true }) {
|
|
4
30
|
const scheme = useColorScheme();
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (autoReady)
|
|
33
|
+
getBridge()?.ready?.();
|
|
34
|
+
}, [autoReady]);
|
|
5
35
|
// Runs during render — before children paint, before effects fire.
|
|
6
36
|
if (syncColorScheme && typeof document !== "undefined") {
|
|
7
37
|
const el = document.documentElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentraProvider.js","sourceRoot":"","sources":["../../src/react/MentraProvider.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"MentraProvider.js","sourceRoot":"","sources":["../../src/react/MentraProvider.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAiB,SAAS,EAAC,MAAM,OAAO,CAAA;AAE/C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAyB/C,SAAS,SAAS;IAChB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IAC9C,OAAQ,MAAqD,CAAC,MAAM,IAAI,IAAI,CAAA;AAC9E,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,EAAE,SAAS,GAAG,IAAI,EAAsB;IACtG,MAAM,MAAM,GAAG,cAAc,EAAE,CAAA;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS;YAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,CAAA;IACvC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;IAEf,mEAAmE;IACnE,IAAI,eAAe,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACvD,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAA;QACnC,MAAM,YAAY,GAAG,MAAM,KAAK,MAAM,CAAA;QACtC,IAAI,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,YAAY,EAAE,CAAC;YACnD,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,4BAAG,QAAQ,GAAI,CAAA;AACxB,CAAC"}
|
package/dist/session.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { ConfigurationModule } from "./modules/configuration";
|
|
|
21
21
|
import { DashboardAPI } from "./modules/dashboard";
|
|
22
22
|
import { DisplayManager } from "./modules/display";
|
|
23
23
|
import { EventManager, type UnsubscribeFn } from "./modules/events";
|
|
24
|
+
import type { SpeechProcessingOptions } from "./modules/speechProcessing";
|
|
24
25
|
import { GlassesModule } from "./modules/glasses";
|
|
25
26
|
import { HeadingModule } from "./modules/heading";
|
|
26
27
|
import { ImuModule } from "./modules/imu";
|
|
@@ -40,6 +41,7 @@ import { StreamModule } from "./modules/stream";
|
|
|
40
41
|
import { SystemModule } from "./modules/system";
|
|
41
42
|
import { MiniappsModule } from "./modules/miniapps";
|
|
42
43
|
import { ActionsModule } from "./modules/actions";
|
|
44
|
+
import { TelemetryModule } from "./modules/telemetry";
|
|
43
45
|
import { BlobModule } from "./modules/blob";
|
|
44
46
|
import { MeetingModule } from "./modules/meeting";
|
|
45
47
|
/**
|
|
@@ -113,6 +115,13 @@ export interface HostFeatures {
|
|
|
113
115
|
captureAudio?: boolean;
|
|
114
116
|
/** Host keeps the UI closed until a background session that announced it sends READY. */
|
|
115
117
|
initReady?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Host installs miniapps from a miniapp URL through `session.miniapps.install({url})`. Only a miniapp on the
|
|
120
|
+
* Mentra App's system list may call it; older Mentra Apps answer NOT_PERMITTED.
|
|
121
|
+
*/
|
|
122
|
+
miniappInstall?: boolean;
|
|
123
|
+
/** Host takes the miniapp's own events from `session.telemetry.capture` (Fleet Management's miniapp telemetry). */
|
|
124
|
+
telemetry?: boolean;
|
|
116
125
|
}
|
|
117
126
|
export interface MiniappAuthState {
|
|
118
127
|
mentraUserId: string;
|
|
@@ -134,9 +143,18 @@ export declare class NotConnectedError extends Error {
|
|
|
134
143
|
readonly code = MiniappErrorCode.NOT_CONNECTED;
|
|
135
144
|
constructor(message?: string);
|
|
136
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* @internal — `connect()` rejects with this when the host did not answer CONNECT
|
|
148
|
+
* within `connectTimeoutMs`. The session stays usable: `connect()` sends CONNECT again.
|
|
149
|
+
*/
|
|
150
|
+
export declare class ConnectAckTimeoutError extends Error {
|
|
151
|
+
constructor();
|
|
152
|
+
}
|
|
137
153
|
export interface MiniappRequestError {
|
|
138
154
|
code: string;
|
|
139
155
|
message: string;
|
|
156
|
+
/** A finer cause, where a request documents one (`INSTALL_FAILED` from `session.miniapps.install`). */
|
|
157
|
+
reason?: string;
|
|
140
158
|
}
|
|
141
159
|
type SessionEmitterEvents = {
|
|
142
160
|
ready: () => void;
|
|
@@ -217,6 +235,8 @@ export declare class MiniappSession<TChannels extends object = any> {
|
|
|
217
235
|
* declared action; `handle` (open to all) exposes one of your own.
|
|
218
236
|
*/
|
|
219
237
|
readonly actions: ActionsModule;
|
|
238
|
+
/** The miniapp's own analytics, shown in its organization's Fleet Management (see {@link TelemetryModule}). */
|
|
239
|
+
readonly telemetry: TelemetryModule;
|
|
220
240
|
/** Phone-declared glasses capabilities. Null until CONNECT_ACK arrives. */
|
|
221
241
|
capabilities: GlassesCapabilities | null;
|
|
222
242
|
/**
|
|
@@ -240,11 +260,26 @@ export declare class MiniappSession<TChannels extends object = any> {
|
|
|
240
260
|
private authRefreshPromise;
|
|
241
261
|
/**
|
|
242
262
|
* Outbound queue for anything sent before CONNECT_ACK. Flushed in FIFO order
|
|
243
|
-
* once the phone responds with CONNECT_ACK.
|
|
263
|
+
* once the phone responds with CONNECT_ACK. A queued request carries its id so
|
|
264
|
+
* one that has already been rejected is dropped instead of sent.
|
|
244
265
|
*/
|
|
245
266
|
private readonly outboundQueue;
|
|
246
267
|
private readonly pendingRequests;
|
|
268
|
+
/** In flight or succeeded. A failed attempt clears it so `connect()` can send CONNECT again. */
|
|
247
269
|
private connectPromise;
|
|
270
|
+
/**
|
|
271
|
+
* Set by the first CONNECT_ACK and never cleared: the handshake completes once
|
|
272
|
+
* per session. The host answers every CONNECT, so after a retry the ACK for
|
|
273
|
+
* another CONNECT of this session can still arrive, in either order. Unlike
|
|
274
|
+
* `ready`, this survives a transport drop, which a session does not recover from.
|
|
275
|
+
*/
|
|
276
|
+
private handshakeComplete;
|
|
277
|
+
/** Rejects the handshake in flight. Set only while waiting for CONNECT_ACK. */
|
|
278
|
+
private failHandshake;
|
|
279
|
+
/** Set by `registerMiniapp`: a CONNECT_ACK timeout sends CONNECT again instead of failing `connect()`. */
|
|
280
|
+
private retryHandshake;
|
|
281
|
+
/** Ends the pause before CONNECT is sent again, with the failure that ended it if any. Set only during that pause. */
|
|
282
|
+
private endRetryPause;
|
|
248
283
|
private disposed;
|
|
249
284
|
/**
|
|
250
285
|
* Set by `registerMiniapp` to the host's id for this spawn: CONNECT tells the
|
|
@@ -255,6 +290,8 @@ export declare class MiniappSession<TChannels extends object = any> {
|
|
|
255
290
|
/** Manifest-declared permission cache. Updated on CONNECT_ACK / PERMISSIONS_UPDATE. */
|
|
256
291
|
private _permissions;
|
|
257
292
|
constructor(options?: MiniappSessionOptions);
|
|
293
|
+
/** @internal Whether CONNECT_ACK arrived, so `hostFeatures` is the host's answer and not just unknown. */
|
|
294
|
+
get handshakeDone(): boolean;
|
|
258
295
|
/**
|
|
259
296
|
* @internal — synchronous lookup against the cached manifest-declared
|
|
260
297
|
* permission record from CONNECT_ACK / PERMISSIONS_UPDATE. Domain modules
|
|
@@ -288,14 +325,30 @@ export declare class MiniappSession<TChannels extends object = any> {
|
|
|
288
325
|
* session.transcription.on(...)
|
|
289
326
|
* etc. instead."
|
|
290
327
|
*/
|
|
291
|
-
_subscribe(streamType: string, handler: (data: unknown) => void, options?:
|
|
292
|
-
forceLocal?: boolean;
|
|
293
|
-
}): UnsubscribeFn;
|
|
328
|
+
_subscribe(streamType: string, handler: (data: unknown) => void, options?: SpeechProcessingOptions): UnsubscribeFn;
|
|
294
329
|
/**
|
|
295
|
-
* Connect to LocalMiniappRuntime. Idempotent
|
|
296
|
-
*
|
|
330
|
+
* Connect to LocalMiniappRuntime. Idempotent while a handshake is in flight
|
|
331
|
+
* or has succeeded: repeat calls return the same Promise. A failed attempt
|
|
332
|
+
* (CONNECT_ACK timeout, transport failure) does not stick, so a later call
|
|
333
|
+
* sends CONNECT again. A session started by `registerMiniapp` keeps sending
|
|
334
|
+
* CONNECT after a timeout, so this Promise (and `waitForReady()`) settles
|
|
335
|
+
* only when the host answers, the transport fails, or the session ends.
|
|
297
336
|
*/
|
|
298
337
|
connect(): Promise<void>;
|
|
338
|
+
/**
|
|
339
|
+
* @internal — called by `registerMiniapp` before its handler runs. The host
|
|
340
|
+
* owns this context's lifetime, so a host that has not answered CONNECT is
|
|
341
|
+
* stalled rather than gone: send CONNECT again instead of failing.
|
|
342
|
+
*/
|
|
343
|
+
retryHandshakeOnTimeout(): void;
|
|
344
|
+
private connectUntilAcknowledged;
|
|
345
|
+
/**
|
|
346
|
+
* Resolves after CONNECT_RETRY_MS, or as soon as CONNECT_ACK lands or the
|
|
347
|
+
* session ends. Resolves with the error when the transport failed meanwhile.
|
|
348
|
+
*/
|
|
349
|
+
private pauseBeforeRetry;
|
|
350
|
+
/** Send one CONNECT and wait for its CONNECT_ACK. */
|
|
351
|
+
private sendConnect;
|
|
299
352
|
/**
|
|
300
353
|
* @internal — called by `registerMiniapp` before `connect()`. The host then
|
|
301
354
|
* keeps the UI closed until {@link reportInitReady}, so UI requests cannot
|