@burdenoff/fe-libs 2026.903.1 → 2026.903.2
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/dist/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/voice/useVoiceInput.d.ts +81 -0
- package/dist/shared/assistant/voice/useVoiceInput.d.ts.map +1 -0
- package/dist/shared/assistant/voice/useVoiceInput.js +100 -0
- package/dist/shared/components/assistantWidget/useVoiceInput.d.ts +24 -6
- package/dist/shared/components/assistantWidget/useVoiceInput.d.ts.map +1 -1
- package/dist/shared/components/assistantWidget/useVoiceInput.js +17 -37
- package/dist/shared-assistant.js +9 -8
- package/package.json +1 -1
|
@@ -14,4 +14,6 @@ export { buildPromptRequestBody, findExistingSandbox, createAssistantSandbox, wa
|
|
|
14
14
|
export type { AssistantMode, AssistantPromptPart, PageContext, SandboxAssistantConfig, SandboxAssistantTransport, AssistantSendArgs, PrewarmLevel, AssistantRawMessage, AssistantRawMessagePart, AssistantWidgetMessage, AssistantArtifact, AssistantSandboxAuthContext, AssistantSessionInfo, DownloadedAssistantArtifact, StreamAccess, } from './types';
|
|
15
15
|
export { isVoiceTurn, voiceSessionIdOf, voiceMarker, chatTurns, voiceTurnsOnly, groupBySession, groupConsecutiveBySession, } from './voice/turnVisibility';
|
|
16
16
|
export type { VoiceSessionGroup, VoiceTranscriptTurn } from './voice/turnVisibility';
|
|
17
|
+
export { useVoiceInput } from './voice/useVoiceInput';
|
|
18
|
+
export type { UseVoiceInputOptions, UseVoiceInputResult, VoiceInputError } from './voice/useVoiceInput';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,OAAO,CAAC;AAEf,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,cAAc,EACd,cAAc,EACd,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,OAAO,CAAC;AAEf,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,sBAAsB,EACtB,yBAAyB,EACzB,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,cAAc,EACd,cAAc,EACd,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Speech-to-text for the assistant composer (Workstream 2 of the AI Assistant
|
|
3
|
+
* V2 multimodal effort).
|
|
4
|
+
*
|
|
5
|
+
* Input-only, browser-native (Web Speech API). It degrades gracefully:
|
|
6
|
+
* `isSupported` is false on engines without SpeechRecognition (notably Firefox),
|
|
7
|
+
* and the composer hides the mic entirely in that case rather than showing a
|
|
8
|
+
* dead control.
|
|
9
|
+
*
|
|
10
|
+
* ⚠️ This does NOT mean the audio stays on the device. Chrome's
|
|
11
|
+
* `webkitSpeechRecognition` is a NETWORK service — the audio is streamed to the
|
|
12
|
+
* browser vendor for recognition, and the supported language list is theirs, not
|
|
13
|
+
* ours. We neither receive nor store it, which is all an earlier version of this
|
|
14
|
+
* comment ("no audio ever leaves the device through us") actually claimed; read
|
|
15
|
+
* literally it implied something stronger and untrue. Whether recording farmers'
|
|
16
|
+
* speech this way needs disclosure or consent is a product/legal call, not a
|
|
17
|
+
* code one.
|
|
18
|
+
*
|
|
19
|
+
* Output (reading replies aloud) is a separate concern and lives in
|
|
20
|
+
* `AssistantSpeechProvider`; an earlier version of this note said the assistant
|
|
21
|
+
* does not speak, which stopped being true when BOFF-6290 shipped.
|
|
22
|
+
*
|
|
23
|
+
* Differences from the fe-libs `assistantWidget/useVoiceInput` this is modelled
|
|
24
|
+
* on, all of which the composer needs:
|
|
25
|
+
* - **interim results are exposed**, so the user sees words appear while
|
|
26
|
+
* speaking instead of staring at a silent button until a phrase finalises;
|
|
27
|
+
* - **errors are surfaced** (`error`) so a denied mic permission can be
|
|
28
|
+
* explained rather than looking like a no-op;
|
|
29
|
+
* - **the recogniser language follows the app locale** (a Tamil or Hindi
|
|
30
|
+
* farmer dictating into an `en-US` recogniser gets garbage);
|
|
31
|
+
* - **`stop()` resolves the final transcript** through `onFinalize`, so the
|
|
32
|
+
* composer can commit exactly once when the user stops.
|
|
33
|
+
*/
|
|
34
|
+
export type VoiceInputError = 'not-allowed' | 'no-speech' | 'audio-capture' | 'network' | 'language-not-supported' | 'unknown';
|
|
35
|
+
export interface UseVoiceInputOptions {
|
|
36
|
+
/**
|
|
37
|
+
* Called with each newly finalised phrase. The composer appends it to the
|
|
38
|
+
* draft; keeping the committed text in the caller (rather than accumulating
|
|
39
|
+
* here) means the user can freely edit while dictation continues.
|
|
40
|
+
*/
|
|
41
|
+
onFinalize: (text: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* BCP-47 tag to listen for. Omit to follow the app locale, which is what this
|
|
44
|
+
* hook did unconditionally before (BOFF-7108).
|
|
45
|
+
*
|
|
46
|
+
* The two are genuinely independent: a farmer whose interface is English may
|
|
47
|
+
* well speak Tamil, and deriving the recogniser language from the UI meant the
|
|
48
|
+
* only way to dictate Tamil was to translate the entire app.
|
|
49
|
+
*/
|
|
50
|
+
language?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface UseVoiceInputResult {
|
|
53
|
+
isSupported: boolean;
|
|
54
|
+
isListening: boolean;
|
|
55
|
+
/** Requested, not yet capturing. Distinguishes starting up from listening. */
|
|
56
|
+
isStarting: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Starting OR listening — "the microphone is busy".
|
|
59
|
+
*
|
|
60
|
+
* ★ Most callers mean THIS and were testing `isListening`, which was the same
|
|
61
|
+
* thing only while capture was assumed the instant start() returned. Exposing
|
|
62
|
+
* it once stops four call sites disagreeing about what counts as active.
|
|
63
|
+
*/
|
|
64
|
+
isActive: boolean;
|
|
65
|
+
/** Words recognised but not yet finalised — render as a live hint. */
|
|
66
|
+
interim: string;
|
|
67
|
+
error: VoiceInputError | null;
|
|
68
|
+
/**
|
|
69
|
+
* BCP-47 tag the recogniser was asked for. Exposed so error copy can name the
|
|
70
|
+
* language that failed ("Tamil dictation is not supported…") rather than
|
|
71
|
+
* leaving the user to guess which language the browser rejected.
|
|
72
|
+
*/
|
|
73
|
+
language: string;
|
|
74
|
+
start: () => void;
|
|
75
|
+
stop: () => void;
|
|
76
|
+
/** Start if idle, stop if listening — what the mic button binds to. */
|
|
77
|
+
toggle: () => void;
|
|
78
|
+
clearError: () => void;
|
|
79
|
+
}
|
|
80
|
+
export declare function useVoiceInput({ onFinalize, language: requested }: UseVoiceInputOptions): UseVoiceInputResult;
|
|
81
|
+
//# sourceMappingURL=useVoiceInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVoiceInput.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/useVoiceInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AA+DH,MAAM,MAAM,eAAe,GACzB,aAAa,GAAG,WAAW,GAAG,eAAe,GAAG,SAAS,GAAG,wBAAwB,GAAG,SAAS,CAAC;AA+BnG,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,8EAA8E;IAC9E,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,uEAAuE;IACvE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,oBAAoB,GAAG,mBAAmB,CA+K5G"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useI18n as e } from "../../providers/shell/I18nProvider.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
//#region src/shared/assistant/voice/useVoiceInput.ts
|
|
4
|
+
var a = {
|
|
5
|
+
en: "en-US",
|
|
6
|
+
es: "es-ES",
|
|
7
|
+
fr: "fr-FR",
|
|
8
|
+
de: "de-DE",
|
|
9
|
+
ja: "ja-JP",
|
|
10
|
+
zh: "zh-CN",
|
|
11
|
+
ta: "ta-IN",
|
|
12
|
+
hi: "hi-IN",
|
|
13
|
+
ar: "ar-SA"
|
|
14
|
+
};
|
|
15
|
+
function o() {
|
|
16
|
+
if (typeof window > "u") return null;
|
|
17
|
+
let e = window;
|
|
18
|
+
return e.SpeechRecognition ?? e.webkitSpeechRecognition ?? null;
|
|
19
|
+
}
|
|
20
|
+
function s(e) {
|
|
21
|
+
switch (e) {
|
|
22
|
+
case "not-allowed":
|
|
23
|
+
case "service-not-allowed": return "not-allowed";
|
|
24
|
+
case "no-speech": return "no-speech";
|
|
25
|
+
case "audio-capture": return "audio-capture";
|
|
26
|
+
case "network": return "network";
|
|
27
|
+
case "language-not-supported": return "language-not-supported";
|
|
28
|
+
default: return "unknown";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function c({ onFinalize: c, language: l }) {
|
|
32
|
+
let { locale: u } = e(), [d, f] = i(!1), [p, m] = i(!1), [h, g] = i(""), [_, v] = i(null), y = r(null), b = r(0), x = r(c);
|
|
33
|
+
n(() => {
|
|
34
|
+
x.current = c;
|
|
35
|
+
}, [c]);
|
|
36
|
+
let S = o() !== null, C = l ?? a[u] ?? "en-US";
|
|
37
|
+
n(() => () => {
|
|
38
|
+
y.current?.abort(), y.current = null;
|
|
39
|
+
}, []);
|
|
40
|
+
let w = t(() => {
|
|
41
|
+
let e = o();
|
|
42
|
+
if (!e || y.current) return;
|
|
43
|
+
let t = new e();
|
|
44
|
+
t.continuous = !0, t.interimResults = !0, t.lang = C;
|
|
45
|
+
let n = b.current;
|
|
46
|
+
t.onresult = (e) => {
|
|
47
|
+
if (n !== b.current) return;
|
|
48
|
+
let t = "", r = "";
|
|
49
|
+
for (let n = e.resultIndex; n < e.results.length; n += 1) {
|
|
50
|
+
let i = e.results[n], a = i[0]?.transcript ?? "";
|
|
51
|
+
i.isFinal ? t += a : r += a;
|
|
52
|
+
}
|
|
53
|
+
t.trim() && x.current(t.trim()), g(r.trim());
|
|
54
|
+
}, t.onerror = (e) => {
|
|
55
|
+
if (n !== b.current) return;
|
|
56
|
+
let t = s(e.error);
|
|
57
|
+
t !== "no-speech" && v(t);
|
|
58
|
+
}, t.onend = () => {
|
|
59
|
+
n === b.current && (y.current = null, m(!1), f(!1), g(""));
|
|
60
|
+
}, t.onstart = () => {
|
|
61
|
+
n === b.current && (m(!1), f(!0));
|
|
62
|
+
}, m(!0);
|
|
63
|
+
try {
|
|
64
|
+
t.start();
|
|
65
|
+
} catch {
|
|
66
|
+
y.current = null, m(!1), f(!1);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
y.current = t, v(null), g("");
|
|
70
|
+
}, [C]), T = t(() => {
|
|
71
|
+
let e = y.current;
|
|
72
|
+
y.current = null, b.current += 1, e?.stop(), m(!1), f(!1), g("");
|
|
73
|
+
}, []), E = r(C);
|
|
74
|
+
n(() => {
|
|
75
|
+
E.current !== C && (E.current = C, T(), v(null));
|
|
76
|
+
}, [C, T]);
|
|
77
|
+
let D = t(() => {
|
|
78
|
+
d || p ? T() : w();
|
|
79
|
+
}, [
|
|
80
|
+
d,
|
|
81
|
+
p,
|
|
82
|
+
w,
|
|
83
|
+
T
|
|
84
|
+
]), O = t(() => v(null), []);
|
|
85
|
+
return {
|
|
86
|
+
isSupported: S,
|
|
87
|
+
isListening: d,
|
|
88
|
+
isStarting: p,
|
|
89
|
+
isActive: d || p,
|
|
90
|
+
interim: h,
|
|
91
|
+
error: _,
|
|
92
|
+
language: C,
|
|
93
|
+
start: w,
|
|
94
|
+
stop: T,
|
|
95
|
+
toggle: D,
|
|
96
|
+
clearError: O
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { c as useVoiceInput };
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The widget's dictation hook — now a thin wrapper over the shared engine.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* ★ WHY A WRAPPER AND NOT A REPLACEMENT. This file's API (`transcript`, `reset`)
|
|
5
|
+
* is what every shell mounting `AssistantWidget` already calls. The shared engine
|
|
6
|
+
* has a different, better contract — it reports finalised phrases through a
|
|
7
|
+
* callback instead of accumulating a string — so swapping it in directly would
|
|
8
|
+
* have broken every one of those consumers at once, for a change that is meant to
|
|
9
|
+
* FIX them.
|
|
10
|
+
*
|
|
11
|
+
* ★ WHAT CONSUMERS SILENTLY GAIN. This file was 122 lines and the engine it now
|
|
12
|
+
* delegates to is 350, because that engine carries fixes this copy never got:
|
|
13
|
+
*
|
|
14
|
+
* - `onstart` as the real capture signal. `isListening` set after `start()`
|
|
15
|
+
* returns only means the request was accepted, so the button reported
|
|
16
|
+
* "listening" while the microphone was still closed.
|
|
17
|
+
* - `isStarting`, cleared on every terminal path — the permission window used to
|
|
18
|
+
* leave the control dead with no way to recover but a reload.
|
|
19
|
+
* - `no-speech` and the other transient recogniser errors treated as recoverable
|
|
20
|
+
* rather than fatal.
|
|
21
|
+
*
|
|
22
|
+
* Those were fixed in one product weeks ago. Every other product kept the broken
|
|
23
|
+
* button until this wrapper landed.
|
|
24
|
+
*
|
|
25
|
+
* Deprecated in favour of importing the engine directly: the callback contract
|
|
26
|
+
* loses nothing and avoids accumulating a string the caller may not want.
|
|
8
27
|
*/
|
|
9
28
|
export interface UseVoiceInputReturn {
|
|
10
29
|
isSupported: boolean;
|
|
11
30
|
isListening: boolean;
|
|
12
|
-
/** Final transcript accumulated since the last `reset()`. */
|
|
13
31
|
transcript: string;
|
|
14
32
|
start: () => void;
|
|
15
33
|
stop: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceInput.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/useVoiceInput.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useVoiceInput.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/useVoiceInput.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAC,IAAI,SAAU,GAAG,mBAAmB,CA4BjE"}
|
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useVoiceInput as e } from "../../assistant/voice/useVoiceInput.js";
|
|
2
|
+
import { useCallback as t, useRef as n, useState as r } from "react";
|
|
2
3
|
//#region src/shared/components/assistantWidget/useVoiceInput.ts
|
|
3
|
-
function i() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (!d || u.current) return;
|
|
18
|
-
let e = new d();
|
|
19
|
-
e.continuous = !0, e.interimResults = !0, e.lang = a, e.onresult = (e) => {
|
|
20
|
-
let t = "";
|
|
21
|
-
for (let n = e.resultIndex; n < e.results.length; n++) {
|
|
22
|
-
let r = e.results[n];
|
|
23
|
-
r.isFinal && (t += r[0].transcript);
|
|
24
|
-
}
|
|
25
|
-
t && l((e) => e ? `${e} ${t}` : t);
|
|
26
|
-
}, e.onerror = () => {
|
|
27
|
-
s(!1), u.current = null;
|
|
28
|
-
}, e.onend = () => {
|
|
29
|
-
s(!1), u.current = null;
|
|
30
|
-
}, u.current = e, e.start(), s(!0);
|
|
31
|
-
}, [d, a]),
|
|
32
|
-
stop: e(() => {
|
|
33
|
-
u.current &&= (u.current.stop(), null), s(!1);
|
|
34
|
-
}, []),
|
|
35
|
-
reset: e(() => {
|
|
36
|
-
l("");
|
|
37
|
-
}, [])
|
|
4
|
+
function i(i = "en-US") {
|
|
5
|
+
let [a, o] = r(""), s = n((e) => {
|
|
6
|
+
o((t) => t ? `${t} ${e}` : e);
|
|
7
|
+
}), c = e({
|
|
8
|
+
onFinalize: (e) => s.current(e),
|
|
9
|
+
language: i
|
|
10
|
+
}), l = t(() => o(""), []);
|
|
11
|
+
return {
|
|
12
|
+
isSupported: c.isSupported,
|
|
13
|
+
isListening: c.isActive,
|
|
14
|
+
transcript: a,
|
|
15
|
+
start: c.start,
|
|
16
|
+
stop: c.stop,
|
|
17
|
+
reset: l
|
|
38
18
|
};
|
|
39
19
|
}
|
|
40
20
|
//#endregion
|
|
41
|
-
export {
|
|
21
|
+
export { i as useVoiceInput };
|
package/dist/shared-assistant.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { useVoiceInput as e } from "./shared/assistant/voice/useVoiceInput.js";
|
|
2
|
+
import { isQuotaExhaustedError as t } from "./shared/assistant/gatewayClient.js";
|
|
3
|
+
import { buildPromptRequestBody as n, checkAssistantAiCredits as r, createAssistantSandbox as i, createAssistantSession as a, downloadAssistantArtifact as o, extendAssistantSandboxTTL as s, findExistingSandbox as c, getAssistantArtifacts as l, getAssistantMessages as u, getAssistantSession as d, getAssistantStreamAccess as f, reportAssistantAiTokenUsage as p, sendAssistantPromptAsync as m, sendHeartbeat as h, waitForAssistantServiceReady as g, waitForSandboxRunning as _ } from "./shared/assistant/api.js";
|
|
4
|
+
import { AssistantRuntimeManager as v } from "./shared/assistant/runtime.js";
|
|
5
|
+
import { buildProgress as y, getAssistantMedia as b, isRecoverable as x, mapSessionToHistory as S, mergeMessagesById as C, sanitize as w } from "./shared/assistant/progress.js";
|
|
6
|
+
import { createSandboxAssistantTransport as T } from "./shared/assistant/createSandboxAssistantTransport.js";
|
|
7
|
+
import { useSandboxAssistantTransport as E } from "./shared/assistant/useSandboxAssistantTransport.js";
|
|
8
|
+
import { chatTurns as D, groupBySession as O, groupConsecutiveBySession as k, isVoiceTurn as A, voiceMarker as j, voiceSessionIdOf as M, voiceTurnsOnly as N } from "./shared/assistant/voice/turnVisibility.js";
|
|
9
|
+
export { v as AssistantRuntimeManager, y as buildProgress, n as buildPromptRequestBody, D as chatTurns, r as checkAssistantAiCredits, i as createAssistantSandbox, a as createAssistantSession, T as createSandboxAssistantTransport, o as downloadAssistantArtifact, s as extendAssistantSandboxTTL, c as findExistingSandbox, l as getAssistantArtifacts, b as getAssistantMedia, u as getAssistantMessages, d as getAssistantSession, f as getAssistantStreamAccess, O as groupBySession, k as groupConsecutiveBySession, t as isQuotaExhaustedError, x as isRecoverable, A as isVoiceTurn, S as mapSessionToHistory, C as mergeMessagesById, p as reportAssistantAiTokenUsage, w as sanitize, m as sendAssistantPromptAsync, h as sendHeartbeat, E as useSandboxAssistantTransport, e as useVoiceInput, j as voiceMarker, M as voiceSessionIdOf, N as voiceTurnsOnly, g as waitForAssistantServiceReady, _ as waitForSandboxRunning };
|