@burdenoff/website-sdk 2026.1105.3 → 2026.1106.1
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 +79 -0
- package/dist/avatar-live-view/index.d.mts +1 -1
- package/dist/avatar-live-view/index.d.ts +1 -1
- package/dist/avatar-live-view/index.js +850 -175
- package/dist/avatar-live-view/index.js.map +1 -1
- package/dist/avatar-live-view/index.mjs +843 -168
- package/dist/avatar-live-view/index.mjs.map +1 -1
- package/dist/avatar-mic/index.d.mts +54 -60
- package/dist/avatar-mic/index.d.ts +54 -60
- package/dist/avatar-mic/index.js +283 -23
- package/dist/avatar-mic/index.js.map +1 -1
- package/dist/avatar-mic/index.mjs +283 -23
- package/dist/avatar-mic/index.mjs.map +1 -1
- package/dist/{chunk-JGU6JW4N.mjs → chunk-BHEHF3Y5.mjs} +2 -2
- package/dist/{chunk-JGU6JW4N.mjs.map → chunk-BHEHF3Y5.mjs.map} +1 -1
- package/dist/{chunk-3AIAJ2L4.js → chunk-Z2UP22GV.js} +2 -2
- package/dist/{chunk-3AIAJ2L4.js.map → chunk-Z2UP22GV.js.map} +1 -1
- package/dist/{explore-avatar-live-config-1zeXdMer.d.ts → explore-avatar-live-config-CJstiSAN.d.ts} +5 -1
- package/dist/{explore-avatar-live-config-BxiE66Im.d.mts → explore-avatar-live-config-D2PGF8fG.d.mts} +5 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -30,6 +30,19 @@ interface AvatarMicOffer {
|
|
|
30
30
|
* time).
|
|
31
31
|
*/
|
|
32
32
|
type AvatarMicFailure = "denied" | "unsupported" | "unavailable" | "limit" | "busy" | "failed";
|
|
33
|
+
/**
|
|
34
|
+
* Why a press of the voice conversation ended with text, or with none (Stage C2, a press with an
|
|
35
|
+
* {@link AvatarMicEndpoint} only):
|
|
36
|
+
*
|
|
37
|
+
* - `pause`: the visitor stopped speaking for the pause, after a question: the one way a question is sent by itself;
|
|
38
|
+
* - `tap`: the visitor stopped it;
|
|
39
|
+
* - `limit`: the question reached the longest one, counted from its first word;
|
|
40
|
+
* - `silence`: nothing that counts as speech was heard in the longest wait, or before the recognizer ended;
|
|
41
|
+
* - `failed`: the recognizer failed, or could no longer go on, after or before words.
|
|
42
|
+
*
|
|
43
|
+
* Only `pause` may be sent; every other one's words go into the box for the visitor, never sent.
|
|
44
|
+
*/
|
|
45
|
+
type AvatarMicDoneBy = "tap" | "pause" | "limit" | "silence" | "failed";
|
|
33
46
|
/**
|
|
34
47
|
* One press of the mic, as the view shows it. `epoch` names the press: a new press has a new one, and what an older one
|
|
35
48
|
* reports is never shown for a newer one.
|
|
@@ -40,6 +53,11 @@ type AvatarMicFailure = "denied" | "unsupported" | "unavailable" | "limit" | "bu
|
|
|
40
53
|
* - `finishing`: the recording has stopped (a tap, or the limit: `limit`), and the last of the text is on its way;
|
|
41
54
|
* - `done`: the text, final (empty when no words were heard);
|
|
42
55
|
* - `failed`: no text, and why (with any final text heard before it failed, which the view does not use).
|
|
56
|
+
*
|
|
57
|
+
* A press with an {@link AvatarMicEndpoint} (the voice conversation, Stage C2) says more, and only it: `listening`
|
|
58
|
+
* says whether what is heard counts as speech (`genuine`) and whether the visitor has paused (`pausing`); `done` says
|
|
59
|
+
* why it ended (`by`) and whether its words are the avatar's own voice (`echo`). A press without one reports exactly
|
|
60
|
+
* the shapes it did before.
|
|
43
61
|
*/
|
|
44
62
|
type AvatarMicState = {
|
|
45
63
|
name: "idle";
|
|
@@ -51,6 +69,10 @@ type AvatarMicState = {
|
|
|
51
69
|
epoch: number;
|
|
52
70
|
startedAt: number;
|
|
53
71
|
text: string;
|
|
72
|
+
/** With an endpoint: the words heard are speech, not silence, sounds or a stall (`isGenuineSpeech`). */
|
|
73
|
+
genuine?: boolean;
|
|
74
|
+
/** With an endpoint: no new word for a moment, after speech ("Still listening — take your time"). */
|
|
75
|
+
pausing?: boolean;
|
|
54
76
|
} | {
|
|
55
77
|
name: "finishing";
|
|
56
78
|
epoch: number;
|
|
@@ -61,6 +83,10 @@ type AvatarMicState = {
|
|
|
61
83
|
epoch: number;
|
|
62
84
|
text: string;
|
|
63
85
|
limit: boolean;
|
|
86
|
+
/** With an endpoint: why the press ended. */
|
|
87
|
+
by?: AvatarMicDoneBy;
|
|
88
|
+
/** With an endpoint: the words are the avatar's own answer, heard back through the microphone. */
|
|
89
|
+
echo?: boolean;
|
|
64
90
|
} | {
|
|
65
91
|
name: "failed";
|
|
66
92
|
epoch: number;
|
|
@@ -103,10 +129,36 @@ interface BrowserAvatarMicOptions {
|
|
|
103
129
|
lang: string;
|
|
104
130
|
/** Tried once, in the same press, when the browser does not recognise `lang` (`en-US`). */
|
|
105
131
|
fallbackLang: string;
|
|
106
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* The longest press, from the moment the browser starts listening: thirty seconds. With an `endpoint`, the longest
|
|
134
|
+
* wait for a question to start, and the longest question, from its first word.
|
|
135
|
+
*/
|
|
107
136
|
maxPressMs: number;
|
|
108
137
|
/** Every change of the press's state. */
|
|
109
138
|
onState: (state: AvatarMicState) => void;
|
|
139
|
+
/**
|
|
140
|
+
* The voice conversation (Stage C2): every press ends itself once the visitor has paused after a question (see
|
|
141
|
+
* {@link AvatarMicEndpoint}). Without it, a press is exactly the editable one: tap to start, tap to stop.
|
|
142
|
+
*/
|
|
143
|
+
endpoint?: AvatarMicEndpoint;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* How a press of the voice conversation ends itself (Stage C2): `done` with `by: "pause"` once what is heard is speech
|
|
147
|
+
* and no word of it has changed for `pauseMs` (twice that for a sentence left open), never sooner than
|
|
148
|
+
* `BROWSER_PAUSE_AFTER_START_MS` after its recognizer (re)started, and never between two recognizers.
|
|
149
|
+
*/
|
|
150
|
+
interface AvatarMicEndpoint {
|
|
151
|
+
/**
|
|
152
|
+
* The pause that ends a question, in milliseconds: the server's `mic.pauseMs` (2000 to 2500, read strictly by the
|
|
153
|
+
* view's API). Read within those bounds whatever is passed.
|
|
154
|
+
*/
|
|
155
|
+
pauseMs: number;
|
|
156
|
+
/**
|
|
157
|
+
* The words of the answer the avatar has just read (its captions), for the echo check, read as the press ends; null
|
|
158
|
+
* when there is none, or when the check is not for this press (the view's hook checks only the presses the
|
|
159
|
+
* conversation starts by itself).
|
|
160
|
+
*/
|
|
161
|
+
echoOf: () => string | null;
|
|
110
162
|
}
|
|
111
163
|
/** What the mic's chunk (`dist/avatar-mic/`) exports. */
|
|
112
164
|
interface AvatarMicModule {
|
|
@@ -114,64 +166,6 @@ interface AvatarMicModule {
|
|
|
114
166
|
createBrowserAvatarMic: (options: BrowserAvatarMicOptions) => AvatarMic;
|
|
115
167
|
}
|
|
116
168
|
|
|
117
|
-
/**
|
|
118
|
-
* BOFF-9797 (Stage C, the browser's own recognizer). The Avatar tab's mic through the browser's speech recognition
|
|
119
|
-
* (`SpeechRecognition`, `webkitSpeechRecognition`), as the product assistant listens: tap to start, tap to stop,
|
|
120
|
-
* thirty seconds at most. The browser turns the voice into text (its own speech service: Google's for Chrome, Apple's
|
|
121
|
-
* for Safari, Microsoft's for Edge); this module never sends anything anywhere, and the text goes only to the view,
|
|
122
|
-
* which puts it in the box for the visitor to check and Send.
|
|
123
|
-
*
|
|
124
|
-
* The phones' quirks are the ones the SDK's Chat dictation (`src/hooks/use-speech-input.ts`, live on the sites) met
|
|
125
|
-
* there, handled the same way: the permission prompt raised by opening the microphone first, a pause before the
|
|
126
|
-
* recognizer opens its own, one quiet retry after a fresh grant, and one utterance per recognizer on a touch device.
|
|
127
|
-
*
|
|
128
|
-
* A press, in order:
|
|
129
|
-
*
|
|
130
|
-
* 1. **The tap** (`start`, called inside the tap where the view can). Where the browser reports the microphone granted
|
|
131
|
-
* (or reports nothing, and a press on this page has had it), the recognizer starts inside the tap. Otherwise the
|
|
132
|
-
* microphone is opened and released at once, inside the tap (`getUserMedia`): that is what raises the browser's
|
|
133
|
-
* permission prompt on phones, where a recognizer's own `start()` is refused (`not-allowed`) without asking anyone.
|
|
134
|
-
* Nothing of that capture is kept, played or sent. Once it is granted, the recognizer starts
|
|
135
|
-
* {@link BROWSER_PRIME_SETTLE_MS} later, so it does not race the released capture for the microphone. The
|
|
136
|
-
* recognizer: interim results, one alternative, the press's language, and `continuous`, except on a touch device,
|
|
137
|
-
* whose recognizer hears one utterance whatever it is asked (and, asked for more, fails sooner). A press still
|
|
138
|
-
* finishing is superseded (aborted, its text never reported; the view lets no tap through meanwhile).
|
|
139
|
-
* 2. **The browser starts listening** (`onstart`, the honest signal: never while a prompt is up): `listening`, and the
|
|
140
|
-
* press's limit counts from here ({@link BrowserAvatarMicOptions.maxPressMs}).
|
|
141
|
-
* 3. **Words as they are recognised**: rebuilt from the whole result list each time (finals, then the words still
|
|
142
|
-
* being recognised), so a result sent again never doubles up, and a final that repeats the one before it with more
|
|
143
|
-
* words replaces it (Android's cumulative finals).
|
|
144
|
-
* 4. **The engine ending by itself** (a pause, a phone's one utterance, a quiet spell's `no-speech`) does NOT end the
|
|
145
|
-
* press: tap to stop holds on every platform. A new recognizer takes over in the same press, its words after the
|
|
146
|
-
* ones before: at once on a computer, after {@link BROWSER_TOUCH_RESTART_MS} on a touch device, and after
|
|
147
|
-
* {@link BROWSER_RESTART_COOLDOWN_MS} when one has just thrown on `start()` or, on a computer, ended as it began.
|
|
148
|
-
* Bounded against a recognizer that never listens: after {@link BROWSER_MAX_QUICK_ENDS} ends in a row as they
|
|
149
|
-
* began, or {@link BROWSER_MAX_RESTARTS} recognizers in all, the press gives what it has. Events of a recognizer that
|
|
150
|
-
* has been replaced are dropped.
|
|
151
|
-
* 5. **The stop** (the visitor's tap, or the limit): `stop()`, not `abort()`, as browsers deliver the last words after
|
|
152
|
-
* it; up to {@link BROWSER_FINAL_WAIT_MS} for its end. A tap while it is still starting (the prompt included) calls
|
|
153
|
-
* the press off.
|
|
154
|
-
* 6. **The text** (`done`): what was heard, final or not (an engine that never marks a result final, iOS Safari, still
|
|
155
|
-
* gives its words: the visitor checks them in the box anyway). Empty when nothing was heard.
|
|
156
|
-
*
|
|
157
|
-
* **Released on every way out.** `cancel()` (the view going, the page hidden, the Chat tab), a failure, a supersede and
|
|
158
|
-
* the end of a press all detach the recognizer's handlers first and then `abort()` it, so the browser's recording
|
|
159
|
-
* indicator goes and nothing it says later is reported. A microphone opened for the prompt is released as soon as it
|
|
160
|
-
* opens, whether or not the press is still there.
|
|
161
|
-
*
|
|
162
|
-
* Errors. Opening the microphone for the prompt: refused (`NotAllowedError`, `SecurityError`) is `denied`; no
|
|
163
|
-
* microphone (`NotFoundError`) is `unsupported`; anything else is `failed`. The recognizer's
|
|
164
|
-
* (`SpeechRecognitionErrorEvent.error`): `not-allowed` or `service-not-allowed` while the microphone is confirmed for
|
|
165
|
-
* the press (the browser reports it granted, or opening it just worked) is tried once more after
|
|
166
|
-
* {@link BROWSER_GRANT_RETRY_MS}, quietly (Android refuses the first start after a fresh grant and takes the next), and
|
|
167
|
-
* after that it is `unsupported`: the speech service refusing, not a permission the visitor can give. Unconfirmed,
|
|
168
|
-
* `not-allowed` is `denied` (and the next tap asks the browser again) and `service-not-allowed` (iOS with Siri and
|
|
169
|
-
* Dictation off, Edge's policy) is `unsupported`; `audio-capture` (no microphone) is `unsupported`;
|
|
170
|
-
* `language-not-supported` tries the fallback language once, then `unsupported`; `network` is `failed`, and
|
|
171
|
-
* `unsupported` the second time running on the page; `no-speech` is a quiet spell (a new recognizer); anything else is
|
|
172
|
-
* `failed`. A failure once words were heard, whatever it is, gives those words instead (`done`).
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
169
|
/** One alternative of a recognition result: what the browser heard. */
|
|
176
170
|
interface RecognitionAlternativeLike {
|
|
177
171
|
readonly transcript: string;
|
|
@@ -315,4 +309,4 @@ interface AvatarMicSeams {
|
|
|
315
309
|
/** The mic of one Avatar tab. See the file's comment for what a press does. */
|
|
316
310
|
declare function createAvatarMic(options: AvatarMicOptions, seams?: Partial<AvatarMicSeams>): AvatarMic;
|
|
317
311
|
|
|
318
|
-
export { type AvatarMic, type AvatarMicFailure, type AvatarMicModule, type AvatarMicOffer, type AvatarMicOptions, type AvatarMicState, type BrowserAvatarMicOptions, createAvatarMic, createBrowserAvatarMic };
|
|
312
|
+
export { type AvatarMic, type AvatarMicDoneBy, type AvatarMicEndpoint, type AvatarMicFailure, type AvatarMicModule, type AvatarMicOffer, type AvatarMicOptions, type AvatarMicState, type BrowserAvatarMicOptions, createAvatarMic, createBrowserAvatarMic };
|
|
@@ -30,6 +30,19 @@ interface AvatarMicOffer {
|
|
|
30
30
|
* time).
|
|
31
31
|
*/
|
|
32
32
|
type AvatarMicFailure = "denied" | "unsupported" | "unavailable" | "limit" | "busy" | "failed";
|
|
33
|
+
/**
|
|
34
|
+
* Why a press of the voice conversation ended with text, or with none (Stage C2, a press with an
|
|
35
|
+
* {@link AvatarMicEndpoint} only):
|
|
36
|
+
*
|
|
37
|
+
* - `pause`: the visitor stopped speaking for the pause, after a question: the one way a question is sent by itself;
|
|
38
|
+
* - `tap`: the visitor stopped it;
|
|
39
|
+
* - `limit`: the question reached the longest one, counted from its first word;
|
|
40
|
+
* - `silence`: nothing that counts as speech was heard in the longest wait, or before the recognizer ended;
|
|
41
|
+
* - `failed`: the recognizer failed, or could no longer go on, after or before words.
|
|
42
|
+
*
|
|
43
|
+
* Only `pause` may be sent; every other one's words go into the box for the visitor, never sent.
|
|
44
|
+
*/
|
|
45
|
+
type AvatarMicDoneBy = "tap" | "pause" | "limit" | "silence" | "failed";
|
|
33
46
|
/**
|
|
34
47
|
* One press of the mic, as the view shows it. `epoch` names the press: a new press has a new one, and what an older one
|
|
35
48
|
* reports is never shown for a newer one.
|
|
@@ -40,6 +53,11 @@ type AvatarMicFailure = "denied" | "unsupported" | "unavailable" | "limit" | "bu
|
|
|
40
53
|
* - `finishing`: the recording has stopped (a tap, or the limit: `limit`), and the last of the text is on its way;
|
|
41
54
|
* - `done`: the text, final (empty when no words were heard);
|
|
42
55
|
* - `failed`: no text, and why (with any final text heard before it failed, which the view does not use).
|
|
56
|
+
*
|
|
57
|
+
* A press with an {@link AvatarMicEndpoint} (the voice conversation, Stage C2) says more, and only it: `listening`
|
|
58
|
+
* says whether what is heard counts as speech (`genuine`) and whether the visitor has paused (`pausing`); `done` says
|
|
59
|
+
* why it ended (`by`) and whether its words are the avatar's own voice (`echo`). A press without one reports exactly
|
|
60
|
+
* the shapes it did before.
|
|
43
61
|
*/
|
|
44
62
|
type AvatarMicState = {
|
|
45
63
|
name: "idle";
|
|
@@ -51,6 +69,10 @@ type AvatarMicState = {
|
|
|
51
69
|
epoch: number;
|
|
52
70
|
startedAt: number;
|
|
53
71
|
text: string;
|
|
72
|
+
/** With an endpoint: the words heard are speech, not silence, sounds or a stall (`isGenuineSpeech`). */
|
|
73
|
+
genuine?: boolean;
|
|
74
|
+
/** With an endpoint: no new word for a moment, after speech ("Still listening — take your time"). */
|
|
75
|
+
pausing?: boolean;
|
|
54
76
|
} | {
|
|
55
77
|
name: "finishing";
|
|
56
78
|
epoch: number;
|
|
@@ -61,6 +83,10 @@ type AvatarMicState = {
|
|
|
61
83
|
epoch: number;
|
|
62
84
|
text: string;
|
|
63
85
|
limit: boolean;
|
|
86
|
+
/** With an endpoint: why the press ended. */
|
|
87
|
+
by?: AvatarMicDoneBy;
|
|
88
|
+
/** With an endpoint: the words are the avatar's own answer, heard back through the microphone. */
|
|
89
|
+
echo?: boolean;
|
|
64
90
|
} | {
|
|
65
91
|
name: "failed";
|
|
66
92
|
epoch: number;
|
|
@@ -103,10 +129,36 @@ interface BrowserAvatarMicOptions {
|
|
|
103
129
|
lang: string;
|
|
104
130
|
/** Tried once, in the same press, when the browser does not recognise `lang` (`en-US`). */
|
|
105
131
|
fallbackLang: string;
|
|
106
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* The longest press, from the moment the browser starts listening: thirty seconds. With an `endpoint`, the longest
|
|
134
|
+
* wait for a question to start, and the longest question, from its first word.
|
|
135
|
+
*/
|
|
107
136
|
maxPressMs: number;
|
|
108
137
|
/** Every change of the press's state. */
|
|
109
138
|
onState: (state: AvatarMicState) => void;
|
|
139
|
+
/**
|
|
140
|
+
* The voice conversation (Stage C2): every press ends itself once the visitor has paused after a question (see
|
|
141
|
+
* {@link AvatarMicEndpoint}). Without it, a press is exactly the editable one: tap to start, tap to stop.
|
|
142
|
+
*/
|
|
143
|
+
endpoint?: AvatarMicEndpoint;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* How a press of the voice conversation ends itself (Stage C2): `done` with `by: "pause"` once what is heard is speech
|
|
147
|
+
* and no word of it has changed for `pauseMs` (twice that for a sentence left open), never sooner than
|
|
148
|
+
* `BROWSER_PAUSE_AFTER_START_MS` after its recognizer (re)started, and never between two recognizers.
|
|
149
|
+
*/
|
|
150
|
+
interface AvatarMicEndpoint {
|
|
151
|
+
/**
|
|
152
|
+
* The pause that ends a question, in milliseconds: the server's `mic.pauseMs` (2000 to 2500, read strictly by the
|
|
153
|
+
* view's API). Read within those bounds whatever is passed.
|
|
154
|
+
*/
|
|
155
|
+
pauseMs: number;
|
|
156
|
+
/**
|
|
157
|
+
* The words of the answer the avatar has just read (its captions), for the echo check, read as the press ends; null
|
|
158
|
+
* when there is none, or when the check is not for this press (the view's hook checks only the presses the
|
|
159
|
+
* conversation starts by itself).
|
|
160
|
+
*/
|
|
161
|
+
echoOf: () => string | null;
|
|
110
162
|
}
|
|
111
163
|
/** What the mic's chunk (`dist/avatar-mic/`) exports. */
|
|
112
164
|
interface AvatarMicModule {
|
|
@@ -114,64 +166,6 @@ interface AvatarMicModule {
|
|
|
114
166
|
createBrowserAvatarMic: (options: BrowserAvatarMicOptions) => AvatarMic;
|
|
115
167
|
}
|
|
116
168
|
|
|
117
|
-
/**
|
|
118
|
-
* BOFF-9797 (Stage C, the browser's own recognizer). The Avatar tab's mic through the browser's speech recognition
|
|
119
|
-
* (`SpeechRecognition`, `webkitSpeechRecognition`), as the product assistant listens: tap to start, tap to stop,
|
|
120
|
-
* thirty seconds at most. The browser turns the voice into text (its own speech service: Google's for Chrome, Apple's
|
|
121
|
-
* for Safari, Microsoft's for Edge); this module never sends anything anywhere, and the text goes only to the view,
|
|
122
|
-
* which puts it in the box for the visitor to check and Send.
|
|
123
|
-
*
|
|
124
|
-
* The phones' quirks are the ones the SDK's Chat dictation (`src/hooks/use-speech-input.ts`, live on the sites) met
|
|
125
|
-
* there, handled the same way: the permission prompt raised by opening the microphone first, a pause before the
|
|
126
|
-
* recognizer opens its own, one quiet retry after a fresh grant, and one utterance per recognizer on a touch device.
|
|
127
|
-
*
|
|
128
|
-
* A press, in order:
|
|
129
|
-
*
|
|
130
|
-
* 1. **The tap** (`start`, called inside the tap where the view can). Where the browser reports the microphone granted
|
|
131
|
-
* (or reports nothing, and a press on this page has had it), the recognizer starts inside the tap. Otherwise the
|
|
132
|
-
* microphone is opened and released at once, inside the tap (`getUserMedia`): that is what raises the browser's
|
|
133
|
-
* permission prompt on phones, where a recognizer's own `start()` is refused (`not-allowed`) without asking anyone.
|
|
134
|
-
* Nothing of that capture is kept, played or sent. Once it is granted, the recognizer starts
|
|
135
|
-
* {@link BROWSER_PRIME_SETTLE_MS} later, so it does not race the released capture for the microphone. The
|
|
136
|
-
* recognizer: interim results, one alternative, the press's language, and `continuous`, except on a touch device,
|
|
137
|
-
* whose recognizer hears one utterance whatever it is asked (and, asked for more, fails sooner). A press still
|
|
138
|
-
* finishing is superseded (aborted, its text never reported; the view lets no tap through meanwhile).
|
|
139
|
-
* 2. **The browser starts listening** (`onstart`, the honest signal: never while a prompt is up): `listening`, and the
|
|
140
|
-
* press's limit counts from here ({@link BrowserAvatarMicOptions.maxPressMs}).
|
|
141
|
-
* 3. **Words as they are recognised**: rebuilt from the whole result list each time (finals, then the words still
|
|
142
|
-
* being recognised), so a result sent again never doubles up, and a final that repeats the one before it with more
|
|
143
|
-
* words replaces it (Android's cumulative finals).
|
|
144
|
-
* 4. **The engine ending by itself** (a pause, a phone's one utterance, a quiet spell's `no-speech`) does NOT end the
|
|
145
|
-
* press: tap to stop holds on every platform. A new recognizer takes over in the same press, its words after the
|
|
146
|
-
* ones before: at once on a computer, after {@link BROWSER_TOUCH_RESTART_MS} on a touch device, and after
|
|
147
|
-
* {@link BROWSER_RESTART_COOLDOWN_MS} when one has just thrown on `start()` or, on a computer, ended as it began.
|
|
148
|
-
* Bounded against a recognizer that never listens: after {@link BROWSER_MAX_QUICK_ENDS} ends in a row as they
|
|
149
|
-
* began, or {@link BROWSER_MAX_RESTARTS} recognizers in all, the press gives what it has. Events of a recognizer that
|
|
150
|
-
* has been replaced are dropped.
|
|
151
|
-
* 5. **The stop** (the visitor's tap, or the limit): `stop()`, not `abort()`, as browsers deliver the last words after
|
|
152
|
-
* it; up to {@link BROWSER_FINAL_WAIT_MS} for its end. A tap while it is still starting (the prompt included) calls
|
|
153
|
-
* the press off.
|
|
154
|
-
* 6. **The text** (`done`): what was heard, final or not (an engine that never marks a result final, iOS Safari, still
|
|
155
|
-
* gives its words: the visitor checks them in the box anyway). Empty when nothing was heard.
|
|
156
|
-
*
|
|
157
|
-
* **Released on every way out.** `cancel()` (the view going, the page hidden, the Chat tab), a failure, a supersede and
|
|
158
|
-
* the end of a press all detach the recognizer's handlers first and then `abort()` it, so the browser's recording
|
|
159
|
-
* indicator goes and nothing it says later is reported. A microphone opened for the prompt is released as soon as it
|
|
160
|
-
* opens, whether or not the press is still there.
|
|
161
|
-
*
|
|
162
|
-
* Errors. Opening the microphone for the prompt: refused (`NotAllowedError`, `SecurityError`) is `denied`; no
|
|
163
|
-
* microphone (`NotFoundError`) is `unsupported`; anything else is `failed`. The recognizer's
|
|
164
|
-
* (`SpeechRecognitionErrorEvent.error`): `not-allowed` or `service-not-allowed` while the microphone is confirmed for
|
|
165
|
-
* the press (the browser reports it granted, or opening it just worked) is tried once more after
|
|
166
|
-
* {@link BROWSER_GRANT_RETRY_MS}, quietly (Android refuses the first start after a fresh grant and takes the next), and
|
|
167
|
-
* after that it is `unsupported`: the speech service refusing, not a permission the visitor can give. Unconfirmed,
|
|
168
|
-
* `not-allowed` is `denied` (and the next tap asks the browser again) and `service-not-allowed` (iOS with Siri and
|
|
169
|
-
* Dictation off, Edge's policy) is `unsupported`; `audio-capture` (no microphone) is `unsupported`;
|
|
170
|
-
* `language-not-supported` tries the fallback language once, then `unsupported`; `network` is `failed`, and
|
|
171
|
-
* `unsupported` the second time running on the page; `no-speech` is a quiet spell (a new recognizer); anything else is
|
|
172
|
-
* `failed`. A failure once words were heard, whatever it is, gives those words instead (`done`).
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
169
|
/** One alternative of a recognition result: what the browser heard. */
|
|
176
170
|
interface RecognitionAlternativeLike {
|
|
177
171
|
readonly transcript: string;
|
|
@@ -315,4 +309,4 @@ interface AvatarMicSeams {
|
|
|
315
309
|
/** The mic of one Avatar tab. See the file's comment for what a press does. */
|
|
316
310
|
declare function createAvatarMic(options: AvatarMicOptions, seams?: Partial<AvatarMicSeams>): AvatarMic;
|
|
317
311
|
|
|
318
|
-
export { type AvatarMic, type AvatarMicFailure, type AvatarMicModule, type AvatarMicOffer, type AvatarMicOptions, type AvatarMicState, type BrowserAvatarMicOptions, createAvatarMic, createBrowserAvatarMic };
|
|
312
|
+
export { type AvatarMic, type AvatarMicDoneBy, type AvatarMicEndpoint, type AvatarMicFailure, type AvatarMicModule, type AvatarMicOffer, type AvatarMicOptions, type AvatarMicState, type BrowserAvatarMicOptions, createAvatarMic, createBrowserAvatarMic };
|