@mentra/miniapp 0.3.0-dev.0 → 3.1.0-dev.4
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 +8 -6
- package/dist/background/index.d.ts +7 -4
- package/dist/background/index.d.ts.map +1 -1
- package/dist/background/index.js +1 -0
- package/dist/background/index.js.map +1 -1
- package/dist/background/register.d.ts +3 -2
- package/dist/background/register.d.ts.map +1 -1
- package/dist/background/register.js.map +1 -1
- package/dist/hardware.d.ts +24 -0
- package/dist/hardware.d.ts.map +1 -0
- package/dist/hardware.js +20 -0
- package/dist/hardware.js.map +1 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/modules/camera.d.ts +50 -4
- package/dist/modules/camera.d.ts.map +1 -1
- package/dist/modules/camera.js +20 -5
- package/dist/modules/camera.js.map +1 -1
- package/dist/modules/events.d.ts +10 -17
- package/dist/modules/events.d.ts.map +1 -1
- package/dist/modules/events.js +56 -11
- package/dist/modules/events.js.map +1 -1
- package/dist/modules/glasses.d.ts +8 -0
- package/dist/modules/glasses.d.ts.map +1 -1
- package/dist/modules/glasses.js +13 -0
- package/dist/modules/glasses.js.map +1 -1
- package/dist/modules/languages.d.ts +42 -0
- package/dist/modules/languages.d.ts.map +1 -0
- package/dist/modules/languages.js +57 -0
- package/dist/modules/languages.js.map +1 -0
- package/dist/modules/mic.d.ts +17 -0
- package/dist/modules/mic.d.ts.map +1 -1
- package/dist/modules/mic.js +28 -1
- package/dist/modules/mic.js.map +1 -1
- package/dist/modules/miniapps.d.ts +2 -0
- package/dist/modules/miniapps.d.ts.map +1 -1
- package/dist/modules/miniapps.js.map +1 -1
- package/dist/modules/phone.d.ts +38 -4
- package/dist/modules/phone.d.ts.map +1 -1
- package/dist/modules/phone.js +22 -6
- package/dist/modules/phone.js.map +1 -1
- package/dist/modules/speaker.d.ts +12 -0
- package/dist/modules/speaker.d.ts.map +1 -1
- package/dist/modules/speaker.js +7 -8
- package/dist/modules/speaker.js.map +1 -1
- package/dist/modules/stream.d.ts +6 -2
- package/dist/modules/stream.d.ts.map +1 -1
- package/dist/modules/stream.js +1 -0
- package/dist/modules/stream.js.map +1 -1
- package/dist/modules/system.d.ts +20 -1
- package/dist/modules/system.d.ts.map +1 -1
- package/dist/modules/system.js +13 -1
- package/dist/modules/system.js.map +1 -1
- package/dist/modules/transcription.d.ts +35 -8
- package/dist/modules/transcription.d.ts.map +1 -1
- package/dist/modules/transcription.js +32 -12
- package/dist/modules/transcription.js.map +1 -1
- package/dist/modules/translation.d.ts +9 -3
- package/dist/modules/translation.d.ts.map +1 -1
- package/dist/modules/translation.js +5 -3
- package/dist/modules/translation.js.map +1 -1
- package/dist/protocol.d.ts +24 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +24 -2
- package/dist/protocol.js.map +1 -1
- package/dist/react/capsuleHeaderLayout.d.ts +3 -0
- package/dist/react/capsuleHeaderLayout.d.ts.map +1 -0
- package/dist/react/capsuleHeaderLayout.js +5 -0
- package/dist/react/capsuleHeaderLayout.js.map +1 -0
- package/dist/react/useCapsuleHeaderStyle.d.ts.map +1 -1
- package/dist/react/useCapsuleHeaderStyle.js +6 -1
- package/dist/react/useCapsuleHeaderStyle.js.map +1 -1
- package/dist/session.d.ts +5 -3
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +7 -3
- package/dist/session.js.map +1 -1
- package/dist/sub-path-types.test-d.d.ts +12 -0
- package/dist/sub-path-types.test-d.d.ts.map +1 -1
- package/dist/sub-path-types.test-d.js.map +1 -1
- package/dist/transport/mock.js +5 -0
- package/dist/transport/mock.js.map +1 -1
- package/package.json +16 -3
- package/src/background/index.ts +18 -4
- package/src/background/register.ts +10 -3
- package/src/hardware.ts +25 -0
- package/src/index.ts +23 -9
- package/src/modules/camera.ts +75 -13
- package/src/modules/events.ts +54 -27
- package/src/modules/glasses.ts +14 -0
- package/src/modules/languages.ts +72 -0
- package/src/modules/mic.ts +30 -1
- package/src/modules/miniapps.ts +2 -0
- package/src/modules/phone.ts +59 -24
- package/src/modules/speaker.ts +21 -2
- package/src/modules/stream.ts +7 -2
- package/src/modules/system.ts +26 -1
- package/src/modules/transcription.ts +63 -16
- package/src/modules/translation.ts +22 -8
- package/src/protocol.ts +29 -3
- package/src/react/capsuleHeaderLayout.ts +11 -0
- package/src/react/useCapsuleHeaderStyle.ts +6 -1
- package/src/session.ts +19 -7
- package/src/sub-path-types.test-d.ts +12 -1
- package/src/transport/mock.ts +7 -0
package/dist/modules/events.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - session.imu.onHeadPosition(...)
|
|
10
10
|
* - session.location.onUpdate(...)
|
|
11
11
|
* - session.glasses.onBattery(...) / onConnection(...)
|
|
12
|
-
* - session.phone.
|
|
12
|
+
* - session.phone.notifications.on(...) / session.phone.onBattery(...)
|
|
13
13
|
*
|
|
14
14
|
* This module's only public method is `subscribe(rawStreamType, handler)` —
|
|
15
15
|
* a forward-compat escape hatch for new event types not yet wrapped on a
|
|
@@ -36,8 +36,10 @@ export class EventManager {
|
|
|
36
36
|
constructor(session) {
|
|
37
37
|
this.session = session;
|
|
38
38
|
this.emitter = new EventEmitter();
|
|
39
|
-
/** Stream -> ref count. Outbound SUBSCRIBE
|
|
39
|
+
/** Stream -> ref count. Outbound SUBSCRIBE tracks active streams and routing changes. */
|
|
40
40
|
this.refCounts = new Map();
|
|
41
|
+
/** Transcription stream -> refs that require on-device-only processing. */
|
|
42
|
+
this.forceLocalRefCounts = new Map();
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* Generic subscribe. `stream` is the raw wire value, including any language
|
|
@@ -51,42 +53,73 @@ export class EventManager {
|
|
|
51
53
|
* via a separate envelope `type`; the EventManager only routes them
|
|
52
54
|
* locally.
|
|
53
55
|
*/
|
|
54
|
-
subscribe(stream, handler) {
|
|
55
|
-
this.emitter.on(stream, handler);
|
|
56
|
+
subscribe(stream, handler, options = {}) {
|
|
56
57
|
const isInternal = stream.startsWith("_");
|
|
58
|
+
const forceLocal = options.forceLocal === true && stream.startsWith(`${MiniappStreamType.TRANSCRIPTION}:`);
|
|
59
|
+
const listener = (data, route) => {
|
|
60
|
+
if (stream.startsWith(`${MiniappStreamType.TRANSCRIPTION}:`)) {
|
|
61
|
+
// Hosts that predate routed transcription events omit `route`. Treat
|
|
62
|
+
// those events as the default/cloud path so a forceLocal listener can
|
|
63
|
+
// never accidentally receive cloud text.
|
|
64
|
+
if (forceLocal ? route !== "forceLocal" && route !== "all" : route === "forceLocal")
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
handler(data);
|
|
68
|
+
};
|
|
69
|
+
this.emitter.on(stream, listener);
|
|
57
70
|
if (!isInternal) {
|
|
58
71
|
const before = this.refCounts.get(stream) ?? 0;
|
|
59
72
|
this.refCounts.set(stream, before + 1);
|
|
60
|
-
|
|
73
|
+
const forceLocalBefore = this.forceLocalRefCounts.get(stream) ?? 0;
|
|
74
|
+
const defaultBefore = before - forceLocalBefore;
|
|
75
|
+
if (forceLocal)
|
|
76
|
+
this.forceLocalRefCounts.set(stream, forceLocalBefore + 1);
|
|
77
|
+
if (before === 0 || (forceLocal && forceLocalBefore === 0) || (!forceLocal && defaultBefore === 0)) {
|
|
61
78
|
this.sendSubscriptionUpdate();
|
|
62
79
|
}
|
|
63
80
|
}
|
|
64
81
|
return () => {
|
|
65
|
-
this.emitter.off(stream,
|
|
82
|
+
this.emitter.off(stream, listener);
|
|
66
83
|
if (isInternal)
|
|
67
84
|
return;
|
|
68
85
|
const current = this.refCounts.get(stream) ?? 0;
|
|
86
|
+
const forceLocalCurrent = this.forceLocalRefCounts.get(stream) ?? 0;
|
|
87
|
+
let subscriptionChanged = current <= 1;
|
|
69
88
|
if (current <= 1) {
|
|
70
89
|
this.refCounts.delete(stream);
|
|
71
|
-
this.sendSubscriptionUpdate();
|
|
72
90
|
}
|
|
73
91
|
else {
|
|
74
92
|
this.refCounts.set(stream, current - 1);
|
|
75
93
|
}
|
|
94
|
+
if (forceLocal) {
|
|
95
|
+
if (forceLocalCurrent <= 1) {
|
|
96
|
+
this.forceLocalRefCounts.delete(stream);
|
|
97
|
+
subscriptionChanged = true;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.forceLocalRefCounts.set(stream, forceLocalCurrent - 1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else if (current - forceLocalCurrent <= 1) {
|
|
104
|
+
subscriptionChanged = true;
|
|
105
|
+
}
|
|
106
|
+
if (subscriptionChanged)
|
|
107
|
+
this.sendSubscriptionUpdate();
|
|
76
108
|
};
|
|
77
109
|
}
|
|
78
110
|
/** Unsubscribe every handler on every stream this EventManager owns. */
|
|
79
111
|
unsubscribeAll() {
|
|
80
112
|
this.emitter.removeAllListeners();
|
|
81
113
|
this.refCounts.clear();
|
|
114
|
+
this.forceLocalRefCounts.clear();
|
|
82
115
|
this.sendSubscriptionUpdate();
|
|
83
116
|
}
|
|
84
117
|
// -------------------------------------------------------------------------
|
|
85
118
|
// Internal — called by MiniappSession when EVENT arrives from phone
|
|
86
119
|
// -------------------------------------------------------------------------
|
|
87
120
|
/** @internal */
|
|
88
|
-
_forwardEvent(stream, data) {
|
|
89
|
-
this.emitter.emit(stream, data);
|
|
121
|
+
_forwardEvent(stream, data, transcriptionRoute) {
|
|
122
|
+
this.emitter.emit(stream, data, transcriptionRoute);
|
|
90
123
|
// Wildcard fan-out: handlers register under wildcard patterns
|
|
91
124
|
// ("transcription:auto", "translation:*:<target>", …) but the host
|
|
92
125
|
// delivers events under the CONCRETE stream key
|
|
@@ -95,7 +128,7 @@ export class EventManager {
|
|
|
95
128
|
// LocalMiniappRuntime.forwardEvent matches on the host side —
|
|
96
129
|
// otherwise a wildcard subscriber never fires.
|
|
97
130
|
if (stream.startsWith("transcription:") && stream !== "transcription:auto") {
|
|
98
|
-
this.emitter.emit("transcription:auto", data);
|
|
131
|
+
this.emitter.emit("transcription:auto", data, transcriptionRoute);
|
|
99
132
|
}
|
|
100
133
|
else if (stream.startsWith("translation:")) {
|
|
101
134
|
const parts = stream.split(":");
|
|
@@ -113,7 +146,19 @@ export class EventManager {
|
|
|
113
146
|
}
|
|
114
147
|
}
|
|
115
148
|
sendSubscriptionUpdate() {
|
|
116
|
-
const subscriptions = Array.from(this.refCounts.keys()).map((stream) =>
|
|
149
|
+
const subscriptions = Array.from(this.refCounts.keys()).map((stream) => {
|
|
150
|
+
if (stream === MiniappStreamType.LOCATION_UPDATE)
|
|
151
|
+
return { stream: "location_stream", rate: "realtime" };
|
|
152
|
+
const forceLocalRefs = this.forceLocalRefCounts.get(stream) ?? 0;
|
|
153
|
+
if (forceLocalRefs === 0)
|
|
154
|
+
return stream;
|
|
155
|
+
const totalRefs = this.refCounts.get(stream) ?? 0;
|
|
156
|
+
return {
|
|
157
|
+
stream,
|
|
158
|
+
forceLocal: true,
|
|
159
|
+
...(totalRefs > forceLocalRefs ? { includeCloud: true } : {}),
|
|
160
|
+
};
|
|
161
|
+
});
|
|
117
162
|
this.session.sendOneShot({
|
|
118
163
|
type: MiniappRequestType.SUBSCRIBE,
|
|
119
164
|
subscriptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/modules/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/modules/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAA;AAE1C,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM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,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5D,CAAA;QACH,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YACvB,IAAI,EAAE,kBAAkB,CAAC,SAAS;YAClC,aAAa;SACd,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -24,5 +24,13 @@ export declare class GlassesModule {
|
|
|
24
24
|
* line shown in the setup prompt (e.g. "Streaming needs your glasses on Wi-Fi").
|
|
25
25
|
*/
|
|
26
26
|
requestWifiSetup(reason?: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Enable or disable Wi-Fi ADB (wireless debugging) on Mentra Live.
|
|
29
|
+
* Persisted on the glasses; boot applies the saved preference (default off).
|
|
30
|
+
*
|
|
31
|
+
* SYSTEM-only — rejects with `NOT_PERMITTED` unless this miniapp is a system
|
|
32
|
+
* app. Third-party miniapps must not expose wireless debugging controls.
|
|
33
|
+
*/
|
|
34
|
+
setWifiAdbState(enabled: boolean): Promise<void>;
|
|
27
35
|
}
|
|
28
36
|
//# sourceMappingURL=glasses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/modules/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAA;AAElF,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,cAAc;IAEpD,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,aAAa;IAI9D,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,GAAG,aAAa;IAIpE;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,GAAG,aAAa;IAIxD;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMvD"}
|
|
1
|
+
{"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/modules/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAA;AAElF,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,cAAc;IAEpD,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,aAAa;IAI9D,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,GAAG,aAAa;IAIpE;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,GAAG,aAAa;IAIxD;;;;OAIG;IACG,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtD;;;;;;OAMG;IACG,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAMvD"}
|
package/dist/modules/glasses.js
CHANGED
|
@@ -35,5 +35,18 @@ export class GlassesModule {
|
|
|
35
35
|
reason,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Enable or disable Wi-Fi ADB (wireless debugging) on Mentra Live.
|
|
40
|
+
* Persisted on the glasses; boot applies the saved preference (default off).
|
|
41
|
+
*
|
|
42
|
+
* SYSTEM-only — rejects with `NOT_PERMITTED` unless this miniapp is a system
|
|
43
|
+
* app. Third-party miniapps must not expose wireless debugging controls.
|
|
44
|
+
*/
|
|
45
|
+
async setWifiAdbState(enabled) {
|
|
46
|
+
await this.session.sendRequest({
|
|
47
|
+
type: MiniappRequestType.SET_WIFI_ADB_STATE,
|
|
48
|
+
enabled,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
38
51
|
}
|
|
39
52
|
//# sourceMappingURL=glasses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/modules/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;AAIjE,MAAM,OAAO,aAAa;IACxB,YAA6B,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAExD,SAAS,CAAC,OAAoC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,eAAe,EAAE,OAAkC,CAAC,CAAA;IACvG,CAAC;IAED,YAAY,CAAC,OAAuC;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,OAAkC,CAAC,CAAA;IAC1G,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAiC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,YAAY,EAAE,OAAkC,CAAC,CAAA;IACpG,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAAe;QACpC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAO;YACnC,IAAI,EAAE,kBAAkB,CAAC,kBAAkB;YAC3C,MAAM;SACP,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/modules/glasses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;AAIjE,MAAM,OAAO,aAAa;IACxB,YAA6B,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAExD,SAAS,CAAC,OAAoC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,eAAe,EAAE,OAAkC,CAAC,CAAA;IACvG,CAAC;IAED,YAAY,CAAC,OAAuC;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,OAAkC,CAAC,CAAA;IAC1G,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAiC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,YAAY,EAAE,OAAkC,CAAC,CAAA;IACpG,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAAe;QACpC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAO;YACnC,IAAI,EAAE,kBAAkB,CAAC,kBAAkB;YAC3C,MAAM;SACP,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,eAAe,CAAC,OAAgB;QACpC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAO;YACnC,IAAI,EAAE,kBAAkB,CAAC,kBAAkB;YAC3C,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Language validation at the SDK boundary (issue 021, WP2).
|
|
3
|
+
*
|
|
4
|
+
* The registry itself lives in `@mentra/cloud-protocol/languages` (single
|
|
5
|
+
* source of truth shared with the cloud). This module re-exports the types so
|
|
6
|
+
* miniapps import everything from `@mentra/miniapp`, and adds the throwing
|
|
7
|
+
* validators the typed module surfaces (`transcription.*`, `translation.*`)
|
|
8
|
+
* call on every language parameter.
|
|
9
|
+
*
|
|
10
|
+
* Contract (design doc docs/issues/021-typed-language-subscriptions):
|
|
11
|
+
* - Valid by construction: params are typed as literal unions, so TS users
|
|
12
|
+
* get autocomplete and compile errors.
|
|
13
|
+
* - Loud at runtime: JS users (or `any` casts) get a thrown
|
|
14
|
+
* `MiniappValidationError` with a suggestion, never silent fallback.
|
|
15
|
+
* - Canonical on the wire: bare codes ("fr") canonicalize to their default
|
|
16
|
+
* tag ("fr-FR") before becoming stream keys, so the phone/cloud only ever
|
|
17
|
+
* see registry tags.
|
|
18
|
+
*/
|
|
19
|
+
import { isTranscriptionLanguage, SUPPORTED_LANGUAGE_HINTS, SUPPORTED_TRANSCRIPTION_LANGUAGES } from "@mentra/cloud-protocol/languages";
|
|
20
|
+
import type { LanguageHint, TranscriptionLanguage } from "@mentra/cloud-protocol/languages";
|
|
21
|
+
export { SUPPORTED_LANGUAGE_HINTS, SUPPORTED_TRANSCRIPTION_LANGUAGES, isTranscriptionLanguage };
|
|
22
|
+
export type { LanguageHint, TranscriptionLanguage };
|
|
23
|
+
/**
|
|
24
|
+
* Thrown synchronously by SDK methods when a parameter fails validation.
|
|
25
|
+
* Deliberately a hard throw (not a warning, not a silent default): an invalid
|
|
26
|
+
* language previously produced a subscription that silently transcribed the
|
|
27
|
+
* wrong language or silently never spoke (OS-1746).
|
|
28
|
+
*/
|
|
29
|
+
export declare class MiniappValidationError extends Error {
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Canonicalize a subscription language or throw. Accepts registry tags
|
|
34
|
+
* ("fr-FR") and bare registry codes ("fr" -> "fr-FR").
|
|
35
|
+
*/
|
|
36
|
+
export declare function requireTranscriptionLanguage(value: string, param: string): TranscriptionLanguage;
|
|
37
|
+
/**
|
|
38
|
+
* Normalize a language hint to the bare code the STT provider accepts, or
|
|
39
|
+
* throw. Accepts bare codes ("fr") and registry tags ("fr-FR" -> "fr").
|
|
40
|
+
*/
|
|
41
|
+
export declare function requireLanguageHint(value: string, param: string): LanguageHint;
|
|
42
|
+
//# sourceMappingURL=languages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/modules/languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,uBAAuB,EAIvB,wBAAwB,EACxB,iCAAiC,EAClC,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAC,YAAY,EAAE,qBAAqB,EAAC,MAAM,kCAAkC,CAAA;AAEzF,OAAO,EAAC,wBAAwB,EAAE,iCAAiC,EAAE,uBAAuB,EAAC,CAAA;AAC7F,YAAY,EAAC,YAAY,EAAE,qBAAqB,EAAC,CAAA;AAEjD;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAShG;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAO9E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Language validation at the SDK boundary (issue 021, WP2).
|
|
3
|
+
*
|
|
4
|
+
* The registry itself lives in `@mentra/cloud-protocol/languages` (single
|
|
5
|
+
* source of truth shared with the cloud). This module re-exports the types so
|
|
6
|
+
* miniapps import everything from `@mentra/miniapp`, and adds the throwing
|
|
7
|
+
* validators the typed module surfaces (`transcription.*`, `translation.*`)
|
|
8
|
+
* call on every language parameter.
|
|
9
|
+
*
|
|
10
|
+
* Contract (design doc docs/issues/021-typed-language-subscriptions):
|
|
11
|
+
* - Valid by construction: params are typed as literal unions, so TS users
|
|
12
|
+
* get autocomplete and compile errors.
|
|
13
|
+
* - Loud at runtime: JS users (or `any` casts) get a thrown
|
|
14
|
+
* `MiniappValidationError` with a suggestion, never silent fallback.
|
|
15
|
+
* - Canonical on the wire: bare codes ("fr") canonicalize to their default
|
|
16
|
+
* tag ("fr-FR") before becoming stream keys, so the phone/cloud only ever
|
|
17
|
+
* see registry tags.
|
|
18
|
+
*/
|
|
19
|
+
import { isTranscriptionLanguage, suggestTranscriptionLanguage, toLanguageHint, toTranscriptionLanguage, SUPPORTED_LANGUAGE_HINTS, SUPPORTED_TRANSCRIPTION_LANGUAGES, } from "@mentra/cloud-protocol/languages";
|
|
20
|
+
export { SUPPORTED_LANGUAGE_HINTS, SUPPORTED_TRANSCRIPTION_LANGUAGES, isTranscriptionLanguage };
|
|
21
|
+
/**
|
|
22
|
+
* Thrown synchronously by SDK methods when a parameter fails validation.
|
|
23
|
+
* Deliberately a hard throw (not a warning, not a silent default): an invalid
|
|
24
|
+
* language previously produced a subscription that silently transcribed the
|
|
25
|
+
* wrong language or silently never spoke (OS-1746).
|
|
26
|
+
*/
|
|
27
|
+
export class MiniappValidationError extends Error {
|
|
28
|
+
constructor(message) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.name = "MiniappValidationError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Canonicalize a subscription language or throw. Accepts registry tags
|
|
35
|
+
* ("fr-FR") and bare registry codes ("fr" -> "fr-FR").
|
|
36
|
+
*/
|
|
37
|
+
export function requireTranscriptionLanguage(value, param) {
|
|
38
|
+
const canonical = toTranscriptionLanguage(value);
|
|
39
|
+
if (canonical)
|
|
40
|
+
return canonical;
|
|
41
|
+
const suggestion = suggestTranscriptionLanguage(value);
|
|
42
|
+
throw new MiniappValidationError(`${param}: unknown language ${JSON.stringify(value)}` +
|
|
43
|
+
(suggestion ? ` — did you mean ${JSON.stringify(suggestion)}?` : "") +
|
|
44
|
+
` Supported values are BCP-47 tags from SUPPORTED_TRANSCRIPTION_LANGUAGES (e.g. "en-US", "fr-FR").`);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Normalize a language hint to the bare code the STT provider accepts, or
|
|
48
|
+
* throw. Accepts bare codes ("fr") and registry tags ("fr-FR" -> "fr").
|
|
49
|
+
*/
|
|
50
|
+
export function requireLanguageHint(value, param) {
|
|
51
|
+
const hint = toLanguageHint(value);
|
|
52
|
+
if (hint)
|
|
53
|
+
return hint;
|
|
54
|
+
throw new MiniappValidationError(`${param}: unknown language hint ${JSON.stringify(value)}. ` +
|
|
55
|
+
`Hints are bare ISO 639-1 codes from SUPPORTED_LANGUAGE_HINTS (e.g. "en", "fr").`);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=languages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../../src/modules/languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,cAAc,EACd,uBAAuB,EACvB,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,kCAAkC,CAAA;AAGzC,OAAO,EAAC,wBAAwB,EAAE,iCAAiC,EAAE,uBAAuB,EAAC,CAAA;AAG7F;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;IACtC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAa,EAAE,KAAa;IACvE,MAAM,SAAS,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;IAChD,IAAI,SAAS;QAAE,OAAO,SAAS,CAAA;IAC/B,MAAM,UAAU,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAA;IACtD,MAAM,IAAI,sBAAsB,CAC9B,GAAG,KAAK,sBAAsB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACnD,CAAC,UAAU,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,mGAAmG,CACtG,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,KAAa;IAC9D,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;IAClC,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,IAAI,sBAAsB,CAC9B,GAAG,KAAK,2BAA2B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI;QAC1D,iFAAiF,CACpF,CAAA;AACH,CAAC"}
|
package/dist/modules/mic.d.ts
CHANGED
|
@@ -31,6 +31,23 @@ export declare class MicModule {
|
|
|
31
31
|
* (PCM or LC3, base64-encoded).
|
|
32
32
|
*/
|
|
33
33
|
onAudioChunk(handler: (data: AudioChunkData) => void): UnsubscribeFn;
|
|
34
|
+
/**
|
|
35
|
+
* Temporarily override glasses-side voice activity detection (GX8002) for
|
|
36
|
+
* this miniapp's lifetime. When disabled, mic gating falls back to the
|
|
37
|
+
* loudness gate only (if it is enabled). The Mentra App's configured value
|
|
38
|
+
* is restored when this miniapp disconnects.
|
|
39
|
+
*
|
|
40
|
+
* Requires `MICROPHONE` in the miniapp manifest.
|
|
41
|
+
*/
|
|
42
|
+
setVoiceActivityDetectionEnabled(enabled: boolean): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Temporarily override the center-mic loudness gate ("Barrier") for this
|
|
45
|
+
* miniapp's lifetime. It blocks quiet/self-talk audio independent of VAD.
|
|
46
|
+
* The Mentra App's configured value is restored when this miniapp disconnects.
|
|
47
|
+
*
|
|
48
|
+
* Requires `MICROPHONE` in the miniapp manifest.
|
|
49
|
+
*/
|
|
50
|
+
setLoudnessGateEnabled(enabled: boolean): Promise<void>;
|
|
34
51
|
/**
|
|
35
52
|
* Tear down every subscription this module owns. Useful when a component
|
|
36
53
|
* is unmounting and wants to free everything at once without tracking
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mic.d.ts","sourceRoot":"","sources":["../../src/modules/mic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAC,cAAc,EAAE,aAAa,EAAE,OAAO,EAAC,MAAM,UAAU,CAAA;AAEpE,qBAAa,SAAS;IAIR,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;gBAErB,OAAO,EAAE,cAAc;IAEpD;;;OAGG;IACH,eAAe,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,aAAa;IAIhE;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,GAAG,aAAa;IAIpE;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAWZ,mEAAmE;IACnE,IAAI,aAAa,IAAI,OAAO,CAE3B;IAID,OAAO,CAAC,KAAK;CAOd"}
|
|
1
|
+
{"version":3,"file":"mic.d.ts","sourceRoot":"","sources":["../../src/modules/mic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAC,cAAc,EAAE,aAAa,EAAE,OAAO,EAAC,MAAM,UAAU,CAAA;AAEpE,qBAAa,SAAS;IAIR,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;gBAErB,OAAO,EAAE,cAAc;IAEpD;;;OAGG;IACH,eAAe,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,aAAa;IAIhE;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,GAAG,aAAa;IAIpE;;;;;;;OAOG;IACH,gCAAgC,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjE;;;;;;OAMG;IACH,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvD;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAWZ,mEAAmE;IACnE,IAAI,aAAa,IAAI,OAAO,CAE3B;IAID,OAAO,CAAC,KAAK;CAOd"}
|
package/dist/modules/mic.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* subscriptions to succeed; the phone runtime rejects with
|
|
15
15
|
* PERMISSION_NOT_DECLARED otherwise.
|
|
16
16
|
*/
|
|
17
|
-
import { MiniappStreamType } from "../protocol";
|
|
17
|
+
import { MiniappRequestType, MiniappStreamType } from "../protocol";
|
|
18
18
|
export class MicModule {
|
|
19
19
|
constructor(session) {
|
|
20
20
|
this.session = session;
|
|
@@ -35,6 +35,33 @@ export class MicModule {
|
|
|
35
35
|
onAudioChunk(handler) {
|
|
36
36
|
return this.track(this.session._subscribe(MiniappStreamType.AUDIO_CHUNK, handler));
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Temporarily override glasses-side voice activity detection (GX8002) for
|
|
40
|
+
* this miniapp's lifetime. When disabled, mic gating falls back to the
|
|
41
|
+
* loudness gate only (if it is enabled). The Mentra App's configured value
|
|
42
|
+
* is restored when this miniapp disconnects.
|
|
43
|
+
*
|
|
44
|
+
* Requires `MICROPHONE` in the miniapp manifest.
|
|
45
|
+
*/
|
|
46
|
+
setVoiceActivityDetectionEnabled(enabled) {
|
|
47
|
+
return this.session.sendRequest({
|
|
48
|
+
type: MiniappRequestType.MIC_SET_VAD_ENABLED,
|
|
49
|
+
enabled,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Temporarily override the center-mic loudness gate ("Barrier") for this
|
|
54
|
+
* miniapp's lifetime. It blocks quiet/self-talk audio independent of VAD.
|
|
55
|
+
* The Mentra App's configured value is restored when this miniapp disconnects.
|
|
56
|
+
*
|
|
57
|
+
* Requires `MICROPHONE` in the miniapp manifest.
|
|
58
|
+
*/
|
|
59
|
+
setLoudnessGateEnabled(enabled) {
|
|
60
|
+
return this.session.sendRequest({
|
|
61
|
+
type: MiniappRequestType.MIC_SET_LOUDNESS_GATE_ENABLED,
|
|
62
|
+
enabled,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
38
65
|
/**
|
|
39
66
|
* Tear down every subscription this module owns. Useful when a component
|
|
40
67
|
* is unmounting and wants to free everything at once without tracking
|
package/dist/modules/mic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mic.js","sourceRoot":"","sources":["../../src/modules/mic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"mic.js","sourceRoot":"","sources":["../../src/modules/mic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;AAIjE,MAAM,OAAO,SAAS;IAIpB,YAA6B,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;QAHpD,wEAAwE;QACvD,WAAM,GAAG,IAAI,GAAG,EAAiB,CAAA;IAEK,CAAC;IAExD;;;OAGG;IACH,eAAe,CAAC,OAAgC;QAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAkC,CAAC,CAAC,CAAA;IACvG,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,OAAuC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,WAAW,EAAE,OAAkC,CAAC,CAAC,CAAA;IAC/G,CAAC;IAED;;;;;;;OAOG;IACH,gCAAgC,CAAC,OAAgB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAO;YACpC,IAAI,EAAE,kBAAkB,CAAC,mBAAmB;YAC5C,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;OAMG;IACH,sBAAsB,CAAC,OAAgB;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAO;YACpC,IAAI,EAAE,kBAAkB,CAAC,6BAA6B;YACtD,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACH,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,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"}
|
|
@@ -17,6 +17,8 @@ export interface MiniappActionInfo {
|
|
|
17
17
|
* to an MCP tool `inputSchema`. Undefined for actions that take no params.
|
|
18
18
|
*/
|
|
19
19
|
parameters?: Record<string, unknown>;
|
|
20
|
+
/** JSON-Schema descriptor for the structured value returned by the action. */
|
|
21
|
+
outputSchema?: Record<string, unknown>;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Hardware compatibility for a listed miniapp. Structurally mirrors the host's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"miniapps.d.ts","sourceRoot":"","sources":["../../src/modules/miniapps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AAEzC,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"miniapps.d.ts","sourceRoot":"","sources":["../../src/modules/miniapps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AAEzC,iEAAiE;AACjE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,OAAO,CAAA;IACrB,eAAe,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;IACtD,eAAe,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;IACtD,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,oBAAoB,CAAA;IACnC,6DAA6D;IAC7D,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAED,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,cAAc;IAEpD;;;;OAIG;IACG,IAAI,CAAC,IAAI,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAQ9D;;;;;;OAMG;IACG,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO/C,yCAAyC;IACnC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"miniapps.js","sourceRoot":"","sources":["../../src/modules/miniapps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,kBAAkB,EAAC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"miniapps.js","sourceRoot":"","sources":["../../src/modules/miniapps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,kBAAkB,EAAC,MAAM,aAAa,CAAA;AA4C9C,MAAM,OAAO,cAAc;IACzB,YAA6B,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAExD;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,IAA0B;QACnC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAgB;YAC3D,IAAI,EAAE,kBAAkB,CAAC,aAAa;YACtC,mBAAmB,EAAE,IAAI,EAAE,mBAAmB,IAAI,KAAK;SACxD,CAAC,CAAA;QACF,OAAO,MAAM,IAAI,EAAE,CAAA;IACrB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CAAC,WAAmB;QAC7B,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAO;YACnC,IAAI,EAAE,kBAAkB,CAAC,cAAc;YACvC,WAAW;SACZ,CAAC,CAAA;IACJ,CAAC;IAED,yCAAyC;IACzC,KAAK,CAAC,IAAI,CAAC,WAAmB;QAC5B,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAO;YACnC,IAAI,EAAE,kBAAkB,CAAC,aAAa;YACtC,WAAW;SACZ,CAAC,CAAA;IACJ,CAAC;CACF"}
|
package/dist/modules/phone.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Mirrors cloud SDK v3's PhoneManager structure. Sub-namespaced by concern:
|
|
5
5
|
*
|
|
6
6
|
* session.phone.notifications.{on, hasPermission, stop}
|
|
7
|
-
* session.phone.calendar.{
|
|
7
|
+
* session.phone.calendar.{listEvents, hasPermission}
|
|
8
8
|
* session.phone.onBattery(...) // stays flat
|
|
9
9
|
*
|
|
10
10
|
* Imperative phone-OS calls (share, openUrl, copyToClipboard, download) live
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* subscribing on iOS is a no-op even though the API is present.
|
|
17
17
|
*/
|
|
18
18
|
import { MiniappSession } from "../session";
|
|
19
|
-
import type { BatteryData,
|
|
19
|
+
import type { BatteryData, NotificationDismissedData, PhoneNotificationData, UnsubscribeFn } from "./events";
|
|
20
20
|
declare class TrackedSubs {
|
|
21
21
|
private readonly unsubs;
|
|
22
22
|
protected track(unsub: UnsubscribeFn): UnsubscribeFn;
|
|
@@ -39,10 +39,44 @@ export declare class PhoneNotificationsModule extends TrackedSubs {
|
|
|
39
39
|
/** True iff `READ_NOTIFICATIONS` is declared in the miniapp's manifest. */
|
|
40
40
|
get hasPermission(): boolean;
|
|
41
41
|
}
|
|
42
|
-
export
|
|
42
|
+
export interface CalendarListOptions {
|
|
43
|
+
/** Inclusive start of the query window. */
|
|
44
|
+
startsAt: string | Date;
|
|
45
|
+
/** Exclusive end of the query window. Must be after startsAt. */
|
|
46
|
+
endsAt: string | Date;
|
|
47
|
+
/** Maximum events to return. Defaults to 50 and may not exceed 100. */
|
|
48
|
+
limit?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface CalendarEvent {
|
|
51
|
+
/** Stable occurrence id, unique across calendars and recurring instances. */
|
|
52
|
+
id: string;
|
|
53
|
+
calendarId: string;
|
|
54
|
+
title: string;
|
|
55
|
+
/** ISO 8601 start time. All-day events preserve their calendar timezone offset. */
|
|
56
|
+
startsAt: string;
|
|
57
|
+
/** ISO 8601 end time. All-day events preserve their calendar timezone offset. */
|
|
58
|
+
endsAt: string;
|
|
59
|
+
timezone?: string;
|
|
60
|
+
allDay: boolean;
|
|
61
|
+
location?: string;
|
|
62
|
+
notes?: string;
|
|
63
|
+
url?: string;
|
|
64
|
+
/** Deduplicated HTTPS links found in the event URL, location, and notes. */
|
|
65
|
+
links: string[];
|
|
66
|
+
}
|
|
67
|
+
export interface CalendarListResult {
|
|
68
|
+
events: CalendarEvent[];
|
|
69
|
+
/** True when more matching events existed than the requested limit. */
|
|
70
|
+
truncated: boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare class PhoneCalendarModule {
|
|
43
73
|
private readonly session;
|
|
44
74
|
constructor(session: MiniappSession);
|
|
45
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Read calendar events in a bounded window. CALENDAR must be declared in
|
|
77
|
+
* miniapp.json and granted before the miniapp opens.
|
|
78
|
+
*/
|
|
79
|
+
listEvents(options: CalendarListOptions): Promise<CalendarListResult>;
|
|
46
80
|
/** True iff `CALENDAR` is declared in the miniapp's manifest. */
|
|
47
81
|
get hasPermission(): boolean;
|
|
48
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone.d.ts","sourceRoot":"","sources":["../../src/modules/phone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"phone.d.ts","sourceRoot":"","sources":["../../src/modules/phone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAC,WAAW,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,aAAa,EAAC,MAAM,UAAU,CAAA;AAE1G,cAAM,WAAW;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAElD,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa;IAQpD,IAAI,IAAI,IAAI;CAUb;AAED,qBAAa,wBAAyB,SAAQ,WAAW;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,cAAc;IAIpD,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,GAAG,aAAa;IAIjE;;;;;;;;OAQG;IACH,WAAW,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,yBAAyB,KAAK,IAAI,GAAG,aAAa;IAM9E,2EAA2E;IAC3E,IAAI,aAAa,IAAI,OAAO,CAE3B;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,iEAAiE;IACjE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAA;IAChB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,4EAA4E;IAC5E,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,aAAa,EAAE,CAAA;IACvB,uEAAuE;IACvE,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,cAAc;IAEpD;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWrE,iEAAiE;IACjE,IAAI,aAAa,IAAI,OAAO,CAE3B;CACF;AAQD,qBAAa,WAAW;IAIV,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,SAAgB,aAAa,EAAE,wBAAwB,CAAA;IACvD,SAAgB,QAAQ,EAAE,mBAAmB,CAAA;gBAEhB,OAAO,EAAE,cAAc;IAKpD;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,aAAa;CAG/D"}
|
package/dist/modules/phone.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Mirrors cloud SDK v3's PhoneManager structure. Sub-namespaced by concern:
|
|
5
5
|
*
|
|
6
6
|
* session.phone.notifications.{on, hasPermission, stop}
|
|
7
|
-
* session.phone.calendar.{
|
|
7
|
+
* session.phone.calendar.{listEvents, hasPermission}
|
|
8
8
|
* session.phone.onBattery(...) // stays flat
|
|
9
9
|
*
|
|
10
10
|
* Imperative phone-OS calls (share, openUrl, copyToClipboard, download) live
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* notification-dismiss callbacks to apps (Apple privacy restriction);
|
|
16
16
|
* subscribing on iOS is a no-op even though the API is present.
|
|
17
17
|
*/
|
|
18
|
-
import { MiniappStreamType } from "../protocol";
|
|
18
|
+
import { MiniappRequestType, MiniappStreamType } from "../protocol";
|
|
19
19
|
class TrackedSubs {
|
|
20
20
|
constructor() {
|
|
21
21
|
this.unsubs = new Set();
|
|
@@ -64,19 +64,35 @@ export class PhoneNotificationsModule extends TrackedSubs {
|
|
|
64
64
|
return this.session._hasManifestPermission("READ_NOTIFICATIONS");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
export class PhoneCalendarModule
|
|
67
|
+
export class PhoneCalendarModule {
|
|
68
68
|
constructor(session) {
|
|
69
|
-
super();
|
|
70
69
|
this.session = session;
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Read calendar events in a bounded window. CALENDAR must be declared in
|
|
73
|
+
* miniapp.json and granted before the miniapp opens.
|
|
74
|
+
*/
|
|
75
|
+
listEvents(options) {
|
|
76
|
+
const startsAt = normalizeCalendarDate(options?.startsAt, "startsAt");
|
|
77
|
+
const endsAt = normalizeCalendarDate(options?.endsAt, "endsAt");
|
|
78
|
+
return this.session.sendRequest({
|
|
79
|
+
type: MiniappRequestType.CALENDAR_LIST_EVENTS,
|
|
80
|
+
startsAt,
|
|
81
|
+
endsAt,
|
|
82
|
+
...(options.limit === undefined ? {} : { limit: options.limit }),
|
|
83
|
+
});
|
|
74
84
|
}
|
|
75
85
|
/** True iff `CALENDAR` is declared in the miniapp's manifest. */
|
|
76
86
|
get hasPermission() {
|
|
77
87
|
return this.session._hasManifestPermission("CALENDAR");
|
|
78
88
|
}
|
|
79
89
|
}
|
|
90
|
+
function normalizeCalendarDate(value, field) {
|
|
91
|
+
const date = value instanceof Date ? value : new Date(value ?? "");
|
|
92
|
+
if (Number.isNaN(date.getTime()))
|
|
93
|
+
throw new TypeError(`${field} must be a valid Date or ISO 8601 string`);
|
|
94
|
+
return date.toISOString();
|
|
95
|
+
}
|
|
80
96
|
export class PhoneModule {
|
|
81
97
|
constructor(session) {
|
|
82
98
|
this.session = session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone.js","sourceRoot":"","sources":["../../src/modules/phone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"phone.js","sourceRoot":"","sources":["../../src/modules/phone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;AAIjE,MAAM,WAAW;IAAjB;QACmB,WAAM,GAAG,IAAI,GAAG,EAAiB,CAAA;IAoBpD,CAAC;IAlBW,KAAK,CAAC,KAAoB;QAClC,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;IAED,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;CACF;AAED,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IACvD,YAA6B,OAAuB;QAClD,KAAK,EAAE,CAAA;QADo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gC,EAAE,KAAa;IAC5E,MAAM,IAAI,GAAG,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;IAClE,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,0CAA0C,CAAC,CAAA;IACzG,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;AAC3B,CAAC;AAED,MAAM,OAAO,WAAW;IAItB,YAA6B,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;QAClD,IAAI,CAAC,aAAa,GAAG,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAA;QAC1D,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAA;IAClD,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,OAAoC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,aAAa,EAAE,OAAkC,CAAC,CAAA;IACrG,CAAC;CACF"}
|
|
@@ -45,6 +45,17 @@ export interface SpeakOptions {
|
|
|
45
45
|
voice_settings?: Record<string, unknown>;
|
|
46
46
|
volume?: number;
|
|
47
47
|
stopOtherAudio?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Normalize display-oriented markup and symbols into natural spoken words.
|
|
50
|
+
* Defaults to true. Set false when exact characters must reach the TTS engine.
|
|
51
|
+
*/
|
|
52
|
+
enableSanitization?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Force this call to use on-device offline TTS, skipping cloud TTS
|
|
55
|
+
* entirely — even when cloud is connected. Rejects with `TTS_LOCAL_UNAVAILABLE`
|
|
56
|
+
* if the offline model isn't ready instead of falling back to cloud.
|
|
57
|
+
*/
|
|
58
|
+
forceLocal?: boolean;
|
|
48
59
|
}
|
|
49
60
|
export interface SpeakResult {
|
|
50
61
|
/** True if playback completed; false if playback was interrupted. */
|
|
@@ -136,6 +147,7 @@ export declare class SpeakerModule {
|
|
|
136
147
|
* TTS failures: `TTS_TEXT_TOO_LONG`, `TTS_INVALID_VOICE`, `TTS_UPSTREAM_ERROR`.
|
|
137
148
|
*/
|
|
138
149
|
speak(text: string, options?: SpeakOptions): Promise<SpeakResult>;
|
|
150
|
+
speak(sentences: string[], options?: SpeakOptions): Promise<SpeakResult>;
|
|
139
151
|
/**
|
|
140
152
|
* Open a live PCM output stream (16-bit LE) to the phone's audio playback
|
|
141
153
|
* service. Use from the background to play audio that arrives in chunks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speaker.d.ts","sourceRoot":"","sources":["../../src/modules/speaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AAEzC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACxC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"speaker.d.ts","sourceRoot":"","sources":["../../src/modules/speaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAA;AAEzC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAE3C,MAAM,WAAW,g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