@burdenoff/fe-libs 2026.907.1 → 2026.908.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/dist/shared/assistant/quota.d.ts +30 -0
- package/dist/shared/assistant/quota.d.ts.map +1 -1
- package/dist/shared/assistant/quota.js +33 -2
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +9 -5
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts +15 -0
- package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +162 -157
- package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/useVoiceSession.js +77 -72
- package/dist/shared-assistant.js +92 -92
- package/package.json +1 -1
|
@@ -43,6 +43,36 @@ export type QuotaRefusal = "exhausted" | "not-provisioned";
|
|
|
43
43
|
* would not help.
|
|
44
44
|
*/
|
|
45
45
|
export declare function classifyQuotaError(error: unknown): QuotaRefusal | null;
|
|
46
|
+
/**
|
|
47
|
+
* A quota refusal, plus the facts needed to act on it.
|
|
48
|
+
*
|
|
49
|
+
* ★★★ Why this exists (prod, 2026-09-07). The assistant was dead for hours and
|
|
50
|
+
* the only thing anyone could see was "You've reached your sandbox limit on the
|
|
51
|
+
* current plan." The gateway had named the exact ceiling —
|
|
52
|
+
* `platform.sandbox.runtime_hours` — in `extensions.quotaName`, and we threw it
|
|
53
|
+
* away. The workspace had TWO sandbox quotas; the one everybody stared at
|
|
54
|
+
* (`platform.sandbox.environments`, 0 of 60 used) was fine, and the one that was
|
|
55
|
+
* actually blocking went unexamined because nothing on screen named it.
|
|
56
|
+
*
|
|
57
|
+
* A ceiling you cannot name is a ceiling you cannot raise.
|
|
58
|
+
*/
|
|
59
|
+
export interface QuotaRefusalDetail {
|
|
60
|
+
refusal: QuotaRefusal;
|
|
61
|
+
/** WHICH ceiling — e.g. `platform.sandbox.runtime_hours`. */
|
|
62
|
+
quotaName: string | null;
|
|
63
|
+
/** The refusing service's trace id, so support can find the request. */
|
|
64
|
+
traceId: string | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Which refusal this is AND what it was about, or null when not a quota wall.
|
|
68
|
+
*
|
|
69
|
+
* ★ Deliberately falls back to {@link isQuotaExhaustedError} rather than using
|
|
70
|
+
* {@link classifyQuotaError} alone: the classifier keys on `extensions.code`,
|
|
71
|
+
* but the assistant's raw-fetch transport can surface a bare quota string with
|
|
72
|
+
* no code at all. Dropping that path here would have quietly narrowed the wall
|
|
73
|
+
* the chat area already catches.
|
|
74
|
+
*/
|
|
75
|
+
export declare function describeQuotaError(error: unknown): QuotaRefusalDetail | null;
|
|
46
76
|
export type QuotaKind = "sandbox" | "ai-credits" | "generic";
|
|
47
77
|
/**
|
|
48
78
|
* Event the assistant dispatches on a quota wall, namespaced by product.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quota.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/quota.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmBH;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmB7D;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,iBAAiB,CAAC;AA0C3D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAStE;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
|
1
|
+
{"version":3,"file":"quota.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/quota.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmBH;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmB7D;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,iBAAiB,CAAC;AA0C3D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAStE;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,YAAY,CAAC;IACtB,6DAA6D;IAC7D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,wEAAwE;IACxE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAwBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAmB5E;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
|
@@ -38,8 +38,39 @@ function i(e) {
|
|
|
38
38
|
let n = e?.statusCode;
|
|
39
39
|
return typeof n == "number" && n === 429 ? "exhausted" : null;
|
|
40
40
|
}
|
|
41
|
-
function a(
|
|
41
|
+
function a(t) {
|
|
42
|
+
if (!t || typeof t != "object") return [];
|
|
43
|
+
let n = [
|
|
44
|
+
t,
|
|
45
|
+
t.result,
|
|
46
|
+
t.networkError
|
|
47
|
+
], r = [];
|
|
48
|
+
for (let t of n) {
|
|
49
|
+
if (!t || typeof t != "object") continue;
|
|
50
|
+
let n = t.extensions;
|
|
51
|
+
n && typeof n == "object" && r.push(n);
|
|
52
|
+
for (let n of e(t, "errors") ?? []) n.extensions && typeof n.extensions == "object" && r.push(n.extensions);
|
|
53
|
+
}
|
|
54
|
+
return r;
|
|
55
|
+
}
|
|
56
|
+
function o(e) {
|
|
57
|
+
let n = i(e) ?? (t(e) ? "exhausted" : null);
|
|
58
|
+
if (!n) return null;
|
|
59
|
+
let r = (t) => {
|
|
60
|
+
for (let n of a(e)) {
|
|
61
|
+
let e = n[t];
|
|
62
|
+
if (typeof e == "string" && e.length > 0) return e;
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
refusal: n,
|
|
68
|
+
quotaName: r("quotaName"),
|
|
69
|
+
traceId: r("traceId")
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function s(e) {
|
|
42
73
|
return `${e}:quota-exhausted`;
|
|
43
74
|
}
|
|
44
75
|
//#endregion
|
|
45
|
-
export { i as classifyQuotaError, t as isQuotaExhaustedError,
|
|
76
|
+
export { i as classifyQuotaError, o as describeQuotaError, t as isQuotaExhaustedError, s as quotaExhaustedEventName };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAoEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAoLvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAoEf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAoLvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAgtDxD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useI18n as e } from "../../providers/shell/I18nProvider.js";
|
|
2
2
|
import { useAuthToken as t } from "../../providers/shell/AuthTokenProvider.js";
|
|
3
3
|
import "../../../shared-providers-shell.js";
|
|
4
|
-
import {
|
|
4
|
+
import { describeQuotaError as n } from "../quota.js";
|
|
5
5
|
import { approvePendingWrite as r, createAssistantSandbox as i, createAssistantSession as a, extendAssistantSandboxTTL as o, findExistingSandbox as s, getAssistantArtifacts as c, getAssistantMessages as l, getAssistantSession as u, releaseSupersededAssistantSandboxes as d, sendAssistantPromptAsync as f, waitForAssistantServiceReady as p, waitForSandboxRunning as m } from "../api.js";
|
|
6
6
|
import { getAssistantMedia as h, sanitize as ee } from "../progress.js";
|
|
7
7
|
import { isVoiceTurn as g, voiceMarker as _, voiceSessionIdOf as v } from "../voice/turnVisibility.js";
|
|
@@ -257,12 +257,16 @@ var k = ({ visible: h = !0, writeAccess: oe = "unknown" }) => {
|
|
|
257
257
|
if (!m) throw Error("Assistant backend is unavailable without an active workspace context.");
|
|
258
258
|
await y();
|
|
259
259
|
} catch (e) {
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
G.current.invalidate(x.getState().sandboxesByMode[u]?.sandboxId ?? null);
|
|
261
|
+
let t = n(e);
|
|
262
|
+
if (t) {
|
|
263
|
+
t.refusal === "exhausted" && je(O, "sandbox");
|
|
264
|
+
let e = [t.quotaName, t.traceId ? `reference ${t.traceId}` : null].filter(Boolean).join(" · "), n = t.refusal === "exhausted" ? "You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant." : "This workspace has no sandbox allowance provisioned, so the AI assistant cannot start. Upgrading will not help — ask an administrator to provision it.";
|
|
265
|
+
te(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"), L(d, "error", v, null);
|
|
262
266
|
return;
|
|
263
267
|
}
|
|
264
|
-
let
|
|
265
|
-
L(d, "error", v,
|
|
268
|
+
let i = e instanceof Error ? e.message : "Something went wrong";
|
|
269
|
+
L(d, "error", v, i), I(d, v, { content: `Sorry, an error occurred: ${i}. Please try again.` }), ut(d, v, {
|
|
266
270
|
lang: "en",
|
|
267
271
|
..._(r.voiceSessionId)
|
|
268
272
|
});
|
|
@@ -83,6 +83,21 @@ export interface AssistantSpeechContextValue {
|
|
|
83
83
|
*/
|
|
84
84
|
sessionSpeaking: boolean;
|
|
85
85
|
setSessionSpeaking: (enabled: boolean) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Is the live session's MICROPHONE open right now?
|
|
88
|
+
*
|
|
89
|
+
* ★ Reported by `useVoiceSession` so the auto-speak subscription below can
|
|
90
|
+
* refuse to play audio into an open microphone. `sessionSpeaking` cannot
|
|
91
|
+
* answer this: it is session-scoped — set once on start and cleared on end —
|
|
92
|
+
* so it stays true for the whole conversation, including the `listening`
|
|
93
|
+
* phases between turns.
|
|
94
|
+
*
|
|
95
|
+
* Write-only by design, and deliberately NOT React state: nothing renders it,
|
|
96
|
+
* and making it state would re-render every speech consumer on each phase
|
|
97
|
+
* change AND re-subscribe the store listener mid-turn, which can drop the
|
|
98
|
+
* in-flight → complete edge the subscription exists to catch.
|
|
99
|
+
*/
|
|
100
|
+
setSessionMicOpen: (open: boolean) => void;
|
|
86
101
|
/** Play a short sample in a named voice. No model call, no message, no tokens. */
|
|
87
102
|
previewVoice: (voiceName: string) => void;
|
|
88
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantSpeechProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantSpeechProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EASL,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AA2B/D,OAAO,EAQL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAiB/B,MAAM,WAAW,2BAA2B;IAC1C,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,iBAAiB,CAAC;IAChC;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACjD;;;;OAIG;IACH,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,8EAA8E;IAC9E;;;;;;OAMG;IACH,YAAY,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzD,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;;;;OAQG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mEAAmE;IACnE,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3C;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;;;;;;;;;;;;OAaG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,kFAAkF;IAClF,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;
|
|
1
|
+
{"version":3,"file":"AssistantSpeechProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantSpeechProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EASL,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AA2B/D,OAAO,EAQL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAiB/B,MAAM,WAAW,2BAA2B;IAC1C,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,iBAAiB,CAAC;IAChC;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACjD;;;;OAIG;IACH,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,8EAA8E;IAC9E;;;;;;OAMG;IACH,YAAY,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzD,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;;;;OAQG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mEAAmE;IACnE,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3C;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC;;;;;;;;;;;;;OAaG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C;;;;;;;;;;;;;OAaG;IACH,iBAAiB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,kFAAkF;IAClF,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AA4BD,wBAAgB,kBAAkB,IAAI,2BAA2B,CAEhE;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,KAAK,CAwyB7C,CAAC"}
|
|
@@ -9,15 +9,15 @@ import { resolveLanguagePair as te } from "../voice/languagePair.js";
|
|
|
9
9
|
import { useAssistantTr as ne } from "../i18n.js";
|
|
10
10
|
import { speechLabelsFor as re } from "../voice/speechLabels.js";
|
|
11
11
|
import { resolveSpeechLocale as ie } from "../voice/replyLanguage.js";
|
|
12
|
-
import { IDLE_PLAYBACK as ae, isSpeakingMessage as
|
|
13
|
-
import { useAssistantStore as
|
|
14
|
-
import { isTurnInFlight as
|
|
15
|
-
import { parseToolActivity as
|
|
12
|
+
import { IDLE_PLAYBACK as ae, isSpeakingMessage as oe, speechPlaybackReducer as se } from "../voice/speechPlayback.js";
|
|
13
|
+
import { useAssistantStore as p } from "../store.js";
|
|
14
|
+
import { isTurnInFlight as ce } from "../turnState.js";
|
|
15
|
+
import { parseToolActivity as le } from "./AssistantToolActivity.js";
|
|
16
16
|
import "../speech/index.js";
|
|
17
|
-
import { createContext as
|
|
18
|
-
import { jsx as
|
|
17
|
+
import { createContext as ue, useCallback as m, useContext as h, useEffect as g, useMemo as _, useReducer as de, useRef as v, useState as y } from "react";
|
|
18
|
+
import { jsx as fe } from "react/jsx-runtime";
|
|
19
19
|
//#region src/shared/assistant/ui/AssistantSpeechProvider.tsx
|
|
20
|
-
var
|
|
20
|
+
var pe = {
|
|
21
21
|
codeBlock: "",
|
|
22
22
|
image: "",
|
|
23
23
|
link: "",
|
|
@@ -26,7 +26,7 @@ var de = {
|
|
|
26
26
|
emailAt: "at",
|
|
27
27
|
emailDot: "dot",
|
|
28
28
|
nestedItem: ""
|
|
29
|
-
},
|
|
29
|
+
}, me = 4e3, b = ue({
|
|
30
30
|
isSupported: !1,
|
|
31
31
|
availability: "unsupported",
|
|
32
32
|
isBlocked: !0,
|
|
@@ -45,263 +45,268 @@ var de = {
|
|
|
45
45
|
setAutoSpeak: () => {},
|
|
46
46
|
sessionSpeaking: !1,
|
|
47
47
|
setSessionSpeaking: () => {},
|
|
48
|
+
setSessionMicOpen: () => {},
|
|
48
49
|
previewVoice: () => {}
|
|
49
50
|
});
|
|
50
|
-
function
|
|
51
|
-
return
|
|
51
|
+
function x() {
|
|
52
|
+
return h(b);
|
|
52
53
|
}
|
|
53
|
-
var
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
var S = ({ children: ue, visible: h = !0, engine: x = n() }) => {
|
|
55
|
+
let S = ne(), { locale: C } = e(), [w, T] = de(se, ae), [E, D] = y(() => x.listVoices()), [O, k] = y(!1), [A, j] = y(() => /* @__PURE__ */ new Map()), M = v(0), N = v(null);
|
|
56
|
+
g(() => () => {
|
|
57
|
+
N.current !== null && clearTimeout(N.current);
|
|
57
58
|
}, []);
|
|
58
|
-
let [
|
|
59
|
-
|
|
60
|
-
}, []),
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
let [P, F] = y(null), I = v(null), he = v(() => {}), L = m(() => {
|
|
60
|
+
I.current?.(), I.current = null;
|
|
61
|
+
}, []), R = p((e) => e.autoSpeakEnabled), z = p((e) => e.setAutoSpeak), [B, ge] = y(!1), V = v(!1), H = m((e) => {
|
|
62
|
+
V.current = e;
|
|
63
|
+
}, []), _e = p((e) => e.activeConversationId), U = _(() => x.isSupported(), [x]);
|
|
64
|
+
g(() => {
|
|
65
|
+
if (!U) return;
|
|
63
66
|
let e = () => {
|
|
64
|
-
|
|
67
|
+
D(x.listVoices()), j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
65
68
|
};
|
|
66
|
-
return e(),
|
|
67
|
-
}, [
|
|
68
|
-
let
|
|
69
|
-
he,
|
|
70
|
-
ge,
|
|
71
|
-
T
|
|
72
|
-
]), q = K.code, J = g((e) => f(e)?.tag ?? s(e), []), ve = g((e) => f(e)?.rate ?? .9, []), Y = y(() => c(W, O, K.tag, A), [
|
|
69
|
+
return e(), x.subscribeVoices(e);
|
|
70
|
+
}, [x, U]);
|
|
71
|
+
let W = p((e) => e.assistantLanguage), ve = p((e) => e.replyLanguage), G = p((e) => e.preferredVoices), ye = p((e) => e.setPreferredVoice), K = _(() => te(W, ve, C).reply, [
|
|
73
72
|
W,
|
|
74
|
-
|
|
73
|
+
ve,
|
|
74
|
+
C
|
|
75
|
+
]), q = K.code, J = m((e) => f(e)?.tag ?? s(e), []), be = m((e) => f(e)?.rate ?? .9, []), Y = _(() => c(U, E, K.tag, O), [
|
|
76
|
+
U,
|
|
77
|
+
E,
|
|
75
78
|
K,
|
|
76
|
-
|
|
77
|
-
]),
|
|
78
|
-
codeBlock:
|
|
79
|
-
image:
|
|
80
|
-
link:
|
|
81
|
-
largeTable:
|
|
82
|
-
truncated:
|
|
83
|
-
nestedItem:
|
|
84
|
-
emailAt:
|
|
85
|
-
emailDot:
|
|
86
|
-
}), [
|
|
87
|
-
|
|
88
|
-
}, [
|
|
89
|
-
let t =
|
|
90
|
-
t && (X(),
|
|
79
|
+
O
|
|
80
|
+
]), xe = _(() => ({
|
|
81
|
+
codeBlock: S("speech.codeBlock", "Code block"),
|
|
82
|
+
image: S("speech.image", "image"),
|
|
83
|
+
link: S("speech.link", "link"),
|
|
84
|
+
largeTable: S("speech.largeTable", "Table with {{rows}} rows and {{columns}} columns"),
|
|
85
|
+
truncated: S("speech.truncated", "The rest of this message is not read aloud"),
|
|
86
|
+
nestedItem: S("speech.nestedItem", "Sub-item {{ordinal}}"),
|
|
87
|
+
emailAt: S("speech.emailAt", "at"),
|
|
88
|
+
emailDot: S("speech.emailDot", "dot")
|
|
89
|
+
}), [S]), X = m(() => {
|
|
90
|
+
L(), x.cancel(), T({ type: "stop" });
|
|
91
|
+
}, [L, x]), Se = m((e) => {
|
|
92
|
+
let t = x.listVoices().find((t) => t.name === e) ?? null;
|
|
93
|
+
t && (X(), x.speak([d(q)], {
|
|
91
94
|
voice: t,
|
|
92
95
|
lang: J(q)
|
|
93
96
|
}));
|
|
94
97
|
}, [
|
|
95
|
-
|
|
98
|
+
x,
|
|
96
99
|
q,
|
|
97
100
|
X,
|
|
98
101
|
J
|
|
99
|
-
]),
|
|
100
|
-
|
|
102
|
+
]), Z = m((e) => A.get(e) ?? null, [A]), Ce = m((e, t, n) => {
|
|
103
|
+
L();
|
|
101
104
|
let i = !1, a = () => {}, o = (r) => {
|
|
102
105
|
if (!i) {
|
|
103
|
-
if (i = !0,
|
|
104
|
-
|
|
106
|
+
if (i = !0, I.current = null, clearTimeout(s), a(), r.length === 0) {
|
|
107
|
+
k(!0);
|
|
105
108
|
return;
|
|
106
109
|
}
|
|
107
|
-
|
|
110
|
+
D(r), he.current(e, t, r, n);
|
|
108
111
|
}
|
|
109
|
-
}, s = setTimeout(() => o(
|
|
110
|
-
a =
|
|
111
|
-
i || (i = !0, clearTimeout(s), a(),
|
|
112
|
+
}, s = setTimeout(() => o(x.listVoices()), r);
|
|
113
|
+
a = x.subscribeVoices(() => o(x.listVoices())), I.current = () => {
|
|
114
|
+
i || (i = !0, clearTimeout(s), a(), I.current = null);
|
|
112
115
|
};
|
|
113
|
-
}, [
|
|
116
|
+
}, [L, x]), Q = m((e, t, n, r) => {
|
|
114
117
|
let s = n;
|
|
115
118
|
if (s.length === 0) {
|
|
116
|
-
let e =
|
|
117
|
-
e.length > 0 && (s = e,
|
|
119
|
+
let e = x.listVoices();
|
|
120
|
+
e.length > 0 && (s = e, D(e));
|
|
118
121
|
}
|
|
119
|
-
let l = J(r), u = o(c(!0, s, r,
|
|
122
|
+
let l = J(r), u = o(c(!0, s, r, O));
|
|
120
123
|
if (u === "block") {
|
|
121
|
-
let t =
|
|
122
|
-
|
|
124
|
+
let t = S("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: i(l, C) });
|
|
125
|
+
j((n) => new Map(n).set(e, t));
|
|
123
126
|
return;
|
|
124
127
|
}
|
|
125
128
|
if (u === "wait-for-voices") {
|
|
126
|
-
|
|
129
|
+
Ce(e, t, r);
|
|
127
130
|
return;
|
|
128
131
|
}
|
|
129
|
-
|
|
132
|
+
j((t) => {
|
|
130
133
|
if (!t.has(e)) return t;
|
|
131
134
|
let n = new Map(t);
|
|
132
135
|
return n.delete(e), n;
|
|
133
136
|
});
|
|
134
|
-
let d =
|
|
135
|
-
|
|
137
|
+
let d = M.current + 1;
|
|
138
|
+
M.current = d, T({
|
|
136
139
|
type: "start",
|
|
137
140
|
messageId: e,
|
|
138
141
|
requestId: d
|
|
139
142
|
});
|
|
140
143
|
let f = ee(t);
|
|
141
|
-
|
|
144
|
+
F({
|
|
142
145
|
requestId: d,
|
|
143
146
|
chunks: f,
|
|
144
147
|
index: -1
|
|
145
|
-
}),
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
+
}), N.current !== null && clearTimeout(N.current), N.current = setTimeout(() => {
|
|
149
|
+
F((e) => e?.requestId === d && e.index < 0 ? null : e);
|
|
150
|
+
}, me), x.speak(f, {
|
|
148
151
|
voice: a(s, l, G[r]),
|
|
149
152
|
lang: l,
|
|
150
|
-
rate:
|
|
153
|
+
rate: be(r)
|
|
151
154
|
}, {
|
|
152
155
|
onChunkStart: (e) => {
|
|
153
|
-
|
|
156
|
+
M.current === d && N.current !== null && (clearTimeout(N.current), N.current = null), F((t) => t?.requestId === d ? {
|
|
154
157
|
...t,
|
|
155
158
|
index: e
|
|
156
|
-
} :
|
|
159
|
+
} : M.current === d ? {
|
|
157
160
|
requestId: d,
|
|
158
161
|
chunks: f,
|
|
159
162
|
index: e
|
|
160
163
|
} : t);
|
|
161
164
|
},
|
|
162
|
-
onEnd: () =>
|
|
165
|
+
onEnd: () => T({
|
|
163
166
|
type: "finished",
|
|
164
167
|
requestId: d
|
|
165
168
|
}),
|
|
166
|
-
onError: () =>
|
|
169
|
+
onError: () => T({
|
|
167
170
|
type: "failed",
|
|
168
171
|
requestId: d
|
|
169
172
|
})
|
|
170
173
|
});
|
|
171
174
|
}, [
|
|
175
|
+
x,
|
|
172
176
|
C,
|
|
173
|
-
T,
|
|
174
177
|
G,
|
|
175
|
-
|
|
178
|
+
be,
|
|
176
179
|
J,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
S,
|
|
181
|
+
O,
|
|
182
|
+
Ce
|
|
180
183
|
]);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}, [
|
|
184
|
-
let
|
|
185
|
-
if (!
|
|
186
|
-
let r = ie(u(t, { labels:
|
|
187
|
-
i &&
|
|
184
|
+
g(() => {
|
|
185
|
+
he.current = Q;
|
|
186
|
+
}, [Q]);
|
|
187
|
+
let $ = m((e, t, n) => {
|
|
188
|
+
if (!U) return;
|
|
189
|
+
let r = ie(u(t, { labels: pe }), n ?? q), i = u(t, { labels: re(r, xe) });
|
|
190
|
+
i && Q(e, i, E, r);
|
|
188
191
|
}, [
|
|
189
|
-
|
|
190
|
-
|
|
192
|
+
U,
|
|
193
|
+
xe,
|
|
191
194
|
q,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
]),
|
|
195
|
-
if (
|
|
195
|
+
Q,
|
|
196
|
+
E
|
|
197
|
+
]), we = m((e, t, n) => {
|
|
198
|
+
if (oe(w, e)) {
|
|
196
199
|
X();
|
|
197
200
|
return;
|
|
198
201
|
}
|
|
199
|
-
|
|
202
|
+
$(e, t, n);
|
|
200
203
|
}, [
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
w,
|
|
205
|
+
$,
|
|
203
206
|
X
|
|
204
207
|
]);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}, [
|
|
208
|
-
X(),
|
|
209
|
-
}, [
|
|
210
|
-
|
|
211
|
-
}, [q, X]),
|
|
212
|
-
|
|
213
|
-
}, [
|
|
208
|
+
g(() => {
|
|
209
|
+
h || X();
|
|
210
|
+
}, [h, X]), g(() => {
|
|
211
|
+
X(), j(/* @__PURE__ */ new Map());
|
|
212
|
+
}, [_e, X]), g(() => {
|
|
213
|
+
j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), X();
|
|
214
|
+
}, [q, X]), g(() => () => {
|
|
215
|
+
I.current?.(), I.current = null, x.cancel();
|
|
216
|
+
}, [x]), g(() => {
|
|
214
217
|
if (typeof window > "u") return;
|
|
215
|
-
let e = () =>
|
|
218
|
+
let e = () => x.cancel();
|
|
216
219
|
return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
|
|
217
|
-
}, [
|
|
218
|
-
if (typeof document > "u" || !
|
|
220
|
+
}, [x]), g(() => {
|
|
221
|
+
if (typeof document > "u" || !U) return;
|
|
219
222
|
let e = () => {
|
|
220
223
|
if (document.visibilityState !== "visible") return;
|
|
221
|
-
let e =
|
|
222
|
-
e.length > 0 &&
|
|
224
|
+
let e = x.listVoices();
|
|
225
|
+
e.length > 0 && L(), D(e), k(!1), j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
|
|
223
226
|
};
|
|
224
227
|
return document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), () => {
|
|
225
228
|
document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e);
|
|
226
229
|
};
|
|
227
230
|
}, [
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
+
L,
|
|
232
|
+
x,
|
|
233
|
+
U
|
|
231
234
|
]);
|
|
232
|
-
let
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}, [
|
|
236
|
-
if (!(!
|
|
235
|
+
let Te = v($);
|
|
236
|
+
g(() => {
|
|
237
|
+
Te.current = $;
|
|
238
|
+
}, [$]), g(() => {
|
|
239
|
+
if (!(!R && !B || !h || !U)) return p.subscribe((e, n) => {
|
|
237
240
|
let r = e.activeConversationId;
|
|
238
241
|
if (!r || r !== n.activeConversationId) return;
|
|
239
242
|
let i = e.processingByConversationId[r], a = n.processingByConversationId[r];
|
|
240
|
-
if (i?.status !== "complete" || !
|
|
243
|
+
if (i?.status !== "complete" || !ce(a?.status)) return;
|
|
241
244
|
let o = i.messageId ?? a?.messageId ?? null;
|
|
242
245
|
if (!o) return;
|
|
243
246
|
let s = e.conversations.find((e) => e.id === r)?.messages.find((e) => e.id === o);
|
|
244
|
-
if (!s || s.role !== "assistant" || t(s) !==
|
|
245
|
-
let { text: c } =
|
|
246
|
-
c.trim() &&
|
|
247
|
+
if (!s || s.role !== "assistant" || t(s) !== B || V.current) return;
|
|
248
|
+
let { text: c } = le(s.content);
|
|
249
|
+
c.trim() && Te.current(o, c, s.metadata?.lang);
|
|
247
250
|
});
|
|
248
251
|
}, [
|
|
249
|
-
|
|
252
|
+
R,
|
|
253
|
+
B,
|
|
250
254
|
U,
|
|
251
|
-
|
|
252
|
-
_
|
|
255
|
+
h
|
|
253
256
|
]);
|
|
254
|
-
let
|
|
255
|
-
|
|
257
|
+
let Ee = _(() => l(E, K.tag), [E, K]), De = _(() => a(E, K.tag, G[q]), [
|
|
258
|
+
E,
|
|
256
259
|
K,
|
|
257
260
|
G,
|
|
258
261
|
q
|
|
259
|
-
]),
|
|
260
|
-
isSupported:
|
|
262
|
+
]), Oe = _(() => ({
|
|
263
|
+
isSupported: U,
|
|
261
264
|
availability: Y,
|
|
262
265
|
isBlocked: Y === "no-voices",
|
|
263
|
-
disabledReason: Y === "no-voices" ?
|
|
264
|
-
blockedFor:
|
|
265
|
-
voiceChoices:
|
|
266
|
-
spokenChunks:
|
|
267
|
-
chunks:
|
|
268
|
-
index:
|
|
266
|
+
disabledReason: Y === "no-voices" ? S("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
|
|
267
|
+
blockedFor: Z,
|
|
268
|
+
voiceChoices: Ee,
|
|
269
|
+
spokenChunks: P ? {
|
|
270
|
+
chunks: P.chunks,
|
|
271
|
+
index: P.index
|
|
269
272
|
} : null,
|
|
270
|
-
activeVoiceName:
|
|
273
|
+
activeVoiceName: De?.name ?? null,
|
|
271
274
|
preferredVoiceName: G[q] ?? null,
|
|
272
|
-
setVoice: (e) =>
|
|
273
|
-
speakingMessageId:
|
|
274
|
-
isSpeaking: (e) =>
|
|
275
|
-
toggle:
|
|
275
|
+
setVoice: (e) => ye(q, e),
|
|
276
|
+
speakingMessageId: w.status === "speaking" ? w.messageId : null,
|
|
277
|
+
isSpeaking: (e) => oe(w, e),
|
|
278
|
+
toggle: we,
|
|
276
279
|
stop: X,
|
|
277
|
-
autoSpeakEnabled:
|
|
278
|
-
setAutoSpeak:
|
|
279
|
-
sessionSpeaking:
|
|
280
|
-
setSessionSpeaking:
|
|
281
|
-
|
|
280
|
+
autoSpeakEnabled: R,
|
|
281
|
+
setAutoSpeak: z,
|
|
282
|
+
sessionSpeaking: B,
|
|
283
|
+
setSessionSpeaking: ge,
|
|
284
|
+
setSessionMicOpen: H,
|
|
285
|
+
previewVoice: Se
|
|
282
286
|
}), [
|
|
283
|
-
|
|
287
|
+
U,
|
|
284
288
|
Y,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
289
|
+
Z,
|
|
290
|
+
Ee,
|
|
291
|
+
De,
|
|
288
292
|
G,
|
|
289
|
-
|
|
293
|
+
ye,
|
|
290
294
|
q,
|
|
291
|
-
|
|
292
|
-
|
|
295
|
+
w,
|
|
296
|
+
we,
|
|
293
297
|
X,
|
|
294
|
-
|
|
298
|
+
R,
|
|
299
|
+
z,
|
|
300
|
+
B,
|
|
295
301
|
H,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
I
|
|
302
|
+
Se,
|
|
303
|
+
S,
|
|
304
|
+
P
|
|
300
305
|
]);
|
|
301
|
-
return /* @__PURE__ */
|
|
302
|
-
value:
|
|
303
|
-
children:
|
|
306
|
+
return /* @__PURE__ */ fe(b.Provider, {
|
|
307
|
+
value: Oe,
|
|
308
|
+
children: ue
|
|
304
309
|
});
|
|
305
310
|
};
|
|
306
311
|
//#endregion
|
|
307
|
-
export {
|
|
312
|
+
export { S as AssistantSpeechProvider, x as useAssistantSpeech };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceSession.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useVoiceSession.ts"],"names":[],"mappings":"AAUA,OAAO,EAWL,KAAK,oBAAoB,EAE1B,MAAM,uBAAuB,CAAC;AAsC/B;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,eAAe,GACf,eAAe,GACf,oBAAoB,CAAC;AAMzB,UAAU,OAAO;IACf,+EAA+E;IAC/E;;;;;;;OAOG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD;;;;OAIG;IACH,WAAW,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,OAAO;;
|
|
1
|
+
{"version":3,"file":"useVoiceSession.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useVoiceSession.ts"],"names":[],"mappings":"AAUA,OAAO,EAWL,KAAK,oBAAoB,EAE1B,MAAM,uBAAuB,CAAC;AAsC/B;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,eAAe,GACf,eAAe,GACf,oBAAoB,CAAC;AAMzB,UAAU,OAAO;IACf,+EAA+E;IAC/E;;;;;;;OAOG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD;;;;OAIG;IACH,WAAW,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,OAAO;;IAuiBtE,qEAAqE;;IAErE;;;;;;;OAOG;;;;;IAEH,+DAA+D;;IAE/D;;;;;;;OAOG;;IAIH,0EAA0E;;IAE1E,6DAA6D;;IAE7D,sDAAsD;;;;;;EA4B3D"}
|
|
@@ -5,10 +5,10 @@ import { useCallback as u, useEffect as d, useMemo as f, useReducer as p, useRef
|
|
|
5
5
|
//#region src/shared/assistant/ui/useVoiceSession.ts
|
|
6
6
|
var g = 4e3, _ = 2500, v = 5e3, y = 12e3, b = "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=";
|
|
7
7
|
function x({ onSubmit: x, latestReply: S, language: C }) {
|
|
8
|
-
let w = m(null), [T, E] = p(u((e, t) => c(e, t, w.current), []), t), D = l(), { setSessionSpeaking: O,
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
8
|
+
let w = m(null), [T, E] = p(u((e, t) => c(e, t, w.current), []), t), D = l(), { setSessionSpeaking: O, setSessionMicOpen: k, speakingMessageId: A, stop: j } = D, M = m(null), N = m(null), P = m(!1), [F, I] = h(null), [L, R] = h(!1), [z, B] = h(!1), V = m(T);
|
|
9
|
+
V.current = T;
|
|
10
|
+
let H = m(S);
|
|
11
|
+
H.current = S, d(() => {
|
|
12
12
|
if (T.phase === "speaking") {
|
|
13
13
|
w.current = S?.text ?? null;
|
|
14
14
|
return;
|
|
@@ -19,78 +19,83 @@ function x({ onSubmit: x, latestReply: S, language: C }) {
|
|
|
19
19
|
}, _);
|
|
20
20
|
return () => clearTimeout(e);
|
|
21
21
|
}, [T.phase, S]);
|
|
22
|
-
let
|
|
22
|
+
let U = u((e, t) => {
|
|
23
23
|
E({
|
|
24
24
|
type: "speech",
|
|
25
25
|
transcript: e,
|
|
26
26
|
final: t
|
|
27
27
|
});
|
|
28
|
-
}, []),
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
onFinalize: u((e) =>
|
|
28
|
+
}, []), W = m(0), G = u(() => {
|
|
29
|
+
j(), W.current = Date.now(), R(!0), E({ type: "interrupt" });
|
|
30
|
+
}, [j]), K = e({
|
|
31
|
+
onFinalize: u((e) => U(e, !0), [U]),
|
|
32
32
|
language: C
|
|
33
33
|
});
|
|
34
34
|
d(() => {
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
if (
|
|
38
|
-
let e = setTimeout(() =>
|
|
39
|
-
return
|
|
40
|
-
clearTimeout(e),
|
|
35
|
+
K.interim && U(K.interim, !1);
|
|
36
|
+
}, [K.interim, U]), d(() => {
|
|
37
|
+
if (M.current && clearTimeout(M.current), B(!1), T.phase !== "listening" || T.muted || !a(s(T))) return;
|
|
38
|
+
let e = setTimeout(() => B(!0), 800);
|
|
39
|
+
return M.current = setTimeout(() => E({ type: "silence" }), r), () => {
|
|
40
|
+
clearTimeout(e), M.current && clearTimeout(M.current);
|
|
41
41
|
};
|
|
42
42
|
}, [T]), d(() => {
|
|
43
|
-
if (!
|
|
44
|
-
let e = Date.now() -
|
|
43
|
+
if (!L) return;
|
|
44
|
+
let e = Date.now() - W.current, t = K.isListening ? Math.max(0, 500 - e) : Math.max(0, n - e), r = setTimeout(() => R(!1), t);
|
|
45
45
|
return () => clearTimeout(r);
|
|
46
|
-
}, [
|
|
47
|
-
let
|
|
48
|
-
T.phase === "listening" && (
|
|
46
|
+
}, [L, K.isListening]);
|
|
47
|
+
let q = m("");
|
|
48
|
+
T.phase === "listening" && (q.current = s(T)), d(() => {
|
|
49
49
|
if (T.phase !== "thinking") return;
|
|
50
|
-
let e =
|
|
51
|
-
e && x(e,
|
|
50
|
+
let e = q.current.trim();
|
|
51
|
+
e && x(e, J.current ?? `vs-orphan-${Date.now().toString(36)}`);
|
|
52
52
|
}, [T.phase]), d(() => {
|
|
53
|
-
let e = o(S?.id, T.phase,
|
|
54
|
-
e.claim && (
|
|
53
|
+
let e = o(S?.id, T.phase, N.current);
|
|
54
|
+
e.claim && (N.current = S?.id ?? null, e.advance && S && E({
|
|
55
55
|
type: "reply",
|
|
56
56
|
text: S.text
|
|
57
57
|
}));
|
|
58
58
|
}, [S, T.phase]), d(() => {
|
|
59
|
-
let e =
|
|
60
|
-
|
|
61
|
-
}, [
|
|
62
|
-
T.phase !== "listening" &&
|
|
59
|
+
let e = A !== null;
|
|
60
|
+
P.current && !e && E({ type: "speech-ended" }), P.current = e;
|
|
61
|
+
}, [A]), d(() => {
|
|
62
|
+
T.phase !== "listening" && I((e) => e === "nothing-heard" ? null : e);
|
|
63
63
|
}, [T.phase]), d(() => {
|
|
64
|
-
if (T.phase !== "speaking" ||
|
|
64
|
+
if (T.phase !== "speaking" || A !== null) return;
|
|
65
65
|
let e = setTimeout(() => {
|
|
66
|
-
|
|
66
|
+
P.current || E({ type: "speech-ended" });
|
|
67
67
|
}, g);
|
|
68
68
|
return () => clearTimeout(e);
|
|
69
|
-
}, [T.phase,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
}, [T.phase, A]), d(() => {
|
|
70
|
+
let e = i(T);
|
|
71
|
+
k(e), e ? K.isActive || K.start() : K.isActive && K.stop();
|
|
72
|
+
}, [
|
|
73
|
+
T,
|
|
74
|
+
K,
|
|
75
|
+
k
|
|
76
|
+
]), d(() => {
|
|
77
|
+
K.error === "not-allowed" || K.error === "audio-capture" ? E({
|
|
73
78
|
type: "fail",
|
|
74
79
|
error: "mic-denied"
|
|
75
|
-
}) :
|
|
80
|
+
}) : K.error === "language-not-supported" ? E({
|
|
76
81
|
type: "fail",
|
|
77
82
|
error: "no-speech-support"
|
|
78
|
-
}) :
|
|
79
|
-
}, [
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
if (
|
|
83
|
-
let e = setTimeout(() =>
|
|
83
|
+
}) : K.error === "network" ? I("network") : K.error === "unknown" && I("recognition-failed");
|
|
84
|
+
}, [K.error]), d(() => {
|
|
85
|
+
K.error !== null || !K.isListening || I((e) => e === "network" || e === "recognition-failed" ? null : e);
|
|
86
|
+
}, [K.error, K.isListening]), d(() => {
|
|
87
|
+
if (K.isListening && I((e) => e === "not-capturing" ? null : e), !i(T) || K.isListening) return;
|
|
88
|
+
let e = setTimeout(() => I("not-capturing"), v);
|
|
84
89
|
return () => clearTimeout(e);
|
|
85
|
-
}, [T,
|
|
86
|
-
if (T.phase !== "listening" || T.muted || !
|
|
87
|
-
let e = setTimeout(() =>
|
|
90
|
+
}, [T, K.isListening]), d(() => {
|
|
91
|
+
if (T.phase !== "listening" || T.muted || !K.isListening || s(T) !== "") return;
|
|
92
|
+
let e = setTimeout(() => I("nothing-heard"), y);
|
|
88
93
|
return () => clearTimeout(e);
|
|
89
|
-
}, [T,
|
|
90
|
-
s(T) !== "" &&
|
|
94
|
+
}, [T, K.isListening]), d(() => {
|
|
95
|
+
s(T) !== "" && I(null);
|
|
91
96
|
}, [T]);
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
97
|
+
let J = m(null), Y = u(() => {
|
|
98
|
+
if (R(!1), B(!1), !K.isSupported) {
|
|
94
99
|
E({
|
|
95
100
|
type: "fail",
|
|
96
101
|
error: "no-speech-support"
|
|
@@ -117,47 +122,47 @@ function x({ onSubmit: x, latestReply: S, language: C }) {
|
|
|
117
122
|
e.volume = 0, e.play().catch(() => {});
|
|
118
123
|
}
|
|
119
124
|
} catch {}
|
|
120
|
-
O(!0),
|
|
125
|
+
O(!0), I(null), N.current = H.current?.id ?? null, J.current = `vs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`, E({ type: "start" });
|
|
121
126
|
}, [
|
|
122
|
-
|
|
127
|
+
K.isSupported,
|
|
123
128
|
D.isBlocked,
|
|
124
129
|
O
|
|
125
|
-
]),
|
|
126
|
-
|
|
127
|
-
}, [
|
|
130
|
+
]), X = u(() => {
|
|
131
|
+
R(!1), B(!1), J.current = null, E({ type: "end" }), j(), O(!1);
|
|
132
|
+
}, [j, O]), Z = u(() => {
|
|
128
133
|
E({
|
|
129
134
|
type: "mute",
|
|
130
|
-
muted: !
|
|
135
|
+
muted: !V.current.muted
|
|
131
136
|
});
|
|
132
137
|
}, []);
|
|
133
138
|
return d(() => () => {
|
|
134
|
-
O(!1);
|
|
135
|
-
}, [O]), f(() => ({
|
|
139
|
+
O(!1), k(!1);
|
|
140
|
+
}, [O, k]), f(() => ({
|
|
136
141
|
session: T,
|
|
137
|
-
notice:
|
|
142
|
+
notice: F,
|
|
138
143
|
spokenChunks: D.spokenChunks,
|
|
139
|
-
capturing:
|
|
144
|
+
capturing: K.isListening,
|
|
140
145
|
active: T.phase !== "idle" && (T.phase !== "ended" || T.error !== null),
|
|
141
|
-
interrupting:
|
|
142
|
-
awaitingEndpoint:
|
|
143
|
-
available:
|
|
144
|
-
start:
|
|
145
|
-
end:
|
|
146
|
-
toggleMute:
|
|
147
|
-
interrupt:
|
|
146
|
+
interrupting: L,
|
|
147
|
+
awaitingEndpoint: z,
|
|
148
|
+
available: K.isSupported && !D.isBlocked,
|
|
149
|
+
start: Y,
|
|
150
|
+
end: X,
|
|
151
|
+
toggleMute: Z,
|
|
152
|
+
interrupt: G
|
|
148
153
|
}), [
|
|
149
154
|
T,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
F,
|
|
156
|
+
L,
|
|
157
|
+
z,
|
|
158
|
+
K.isListening,
|
|
159
|
+
K.isSupported,
|
|
155
160
|
D.isBlocked,
|
|
156
161
|
D.spokenChunks,
|
|
157
|
-
J,
|
|
158
162
|
Y,
|
|
159
163
|
X,
|
|
160
|
-
|
|
164
|
+
Z,
|
|
165
|
+
G
|
|
161
166
|
]);
|
|
162
167
|
}
|
|
163
168
|
//#endregion
|
package/dist/shared-assistant.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
1
|
import { useVoiceInput as e } from "./shared/assistant/voice/useVoiceInput.js";
|
|
2
|
-
import { classifyQuotaError as t,
|
|
3
|
-
import { buildSandboxContextInput as
|
|
4
|
-
import { CHECK_AI_CREDITS as
|
|
5
|
-
import { ASSISTANT_API_AUTH_STRATEGY as
|
|
6
|
-
import { getCapability as
|
|
7
|
-
import { approvePendingWrite as
|
|
8
|
-
import { AssistantRuntimeManager as
|
|
9
|
-
import { buildProgress as
|
|
10
|
-
import { createSandboxAssistantTransport as
|
|
11
|
-
import { useSandboxAssistantTransport as
|
|
12
|
-
import { chatTurns as
|
|
13
|
-
import { browserSpeechEngine as
|
|
14
|
-
import { HOSTED_TTS_TIER as
|
|
15
|
-
import { HOSTED_TTS_MAX_CHARS as
|
|
16
|
-
import { createHostedTtsEngine as
|
|
17
|
-
import { createRoutingSpeechEngine as
|
|
18
|
-
import { configureSpeechEngine as
|
|
19
|
-
import { micIsInterrupt as
|
|
20
|
-
import { ENDPOINT_GRACE_MS as
|
|
21
|
-
import { SPEECH_LANG as
|
|
22
|
-
import { buildContinuedFromVoiceNote as
|
|
23
|
-
import { DEFAULT_SPEAKABLE_LABELS as
|
|
24
|
-
import { PREVIEW_LANGUAGES as
|
|
25
|
-
import { MINI_CAPTION_BUDGET as
|
|
26
|
-
import { POLL_FAST_MS as
|
|
27
|
-
import { toCaptionText as
|
|
28
|
-
import { ASSISTANT_LANGUAGES as
|
|
29
|
-
import { replyFollowsInput as
|
|
30
|
-
import { findPendingWrite as
|
|
31
|
-
import { AssistantProductProvider as
|
|
32
|
-
import { AssistantI18nProvider as
|
|
33
|
-
import { SPOKEN_LABEL_LANGUAGES as
|
|
34
|
-
import { detectScriptLocale as
|
|
35
|
-
import { IDLE_PLAYBACK as
|
|
36
|
-
import { MAX_INLINE_IMAGE_BASE64_BYTES as
|
|
37
|
-
import { BOILERPLATE_PAGE_SHARE as
|
|
38
|
-
import { ATTACHMENT_ACCEPT as
|
|
39
|
-
import { useAssistantStore as
|
|
40
|
-
import { isTurnInFlight as
|
|
41
|
-
import { AssistantToolActivity as
|
|
42
|
-
import { AssistantSpeechProvider as
|
|
43
|
-
import { useVoiceSession as
|
|
44
|
-
import { copyToClipboard as
|
|
45
|
-
import { getActorId as
|
|
46
|
-
import { ATTACHMENT_SOURCES as
|
|
47
|
-
import { SANDBOX_READY_TTL_MS as
|
|
48
|
-
import { AssistantAutoSpeakToggle as
|
|
49
|
-
import { AssistantMarkdownImage as
|
|
50
|
-
import { AssistantMarkdownRenderer as
|
|
51
|
-
import { AssistantMessageAttachments as
|
|
52
|
-
import { AssistantPendingWriteCard as
|
|
53
|
-
import { AssistantLanguageMenu as
|
|
54
|
-
import { AssistantReplyLanguageSelector as
|
|
55
|
-
import { AssistantSpeakButton as
|
|
56
|
-
import { AssistantSpokenTurnsNotice as
|
|
57
|
-
import { AssistantAttachmentButton as
|
|
58
|
-
import { AssistantAttachmentChips as
|
|
59
|
-
import { AssistantLanguageSelector as
|
|
60
|
-
import { ASSISTANT_MODE_META as
|
|
61
|
-
import { AssistantVoiceButton as
|
|
62
|
-
import { AUTO_VOICE as
|
|
63
|
-
import { AssistantVoiceOrb as
|
|
64
|
-
import { AssistantVoiceSessionButton as
|
|
65
|
-
import { CAPTION_SCROLL_ATTR as
|
|
66
|
-
import { VoiceConversationView as
|
|
67
|
-
import { VoiceWaveform as
|
|
68
|
-
import { VoiceMiniController as
|
|
69
|
-
import { VoiceStage as
|
|
70
|
-
import { VoiceTranscriptDrawer as
|
|
71
|
-
import { downloadFile as
|
|
72
|
-
import { AssistantMoreMenu as
|
|
73
|
-
import { AssistantHeader as
|
|
74
|
-
import { AssistantConversationList as
|
|
75
|
-
import { AssistantEmptyState as
|
|
76
|
-
import { AssistantMessageItem as
|
|
77
|
-
import { AssistantMessageList as
|
|
78
|
-
import { AssistantVoiceSession as
|
|
79
|
-
import { useAssistantApiAccess as
|
|
80
|
-
import { useConversationTurns as
|
|
81
|
-
import { isMultimodalBodyRejection as
|
|
82
|
-
import { aiCreditsUpdatedEventName as
|
|
83
|
-
import { useWorkspaceWriteAccess as
|
|
84
|
-
import { extractDocumentText as
|
|
85
|
-
import { useAssistantAttachments as
|
|
86
|
-
import { AssistantComposer as
|
|
87
|
-
import { isProdRuntime as
|
|
88
|
-
import { useAssistantHeartbeat as
|
|
89
|
-
import { useAssistantKeyboardShortcuts as
|
|
90
|
-
import { AssistantApiCallsConsentDialog as
|
|
91
|
-
import { AssistantChatArea as
|
|
92
|
-
import { AIAssistantPanel as
|
|
93
|
-
export {
|
|
2
|
+
import { classifyQuotaError as t, describeQuotaError as n, isQuotaExhaustedError as r, quotaExhaustedEventName as i } from "./shared/assistant/quota.js";
|
|
3
|
+
import { buildSandboxContextInput as a, executeSandboxGraphQL as o } from "./shared/assistant/gatewayClient.js";
|
|
4
|
+
import { CHECK_AI_CREDITS as s, CREATE_SANDBOX as c, EXTEND_SANDBOX_TTL as l, GET_ACTIVE_SANDBOXES as u, GET_SANDBOX as d, PROXY_SANDBOX_REQUEST as f, REPORT_AI_TOKEN_USAGE as p, STOP_ASSISTANT_SANDBOX as m, WAIT_FOR_SANDBOX_RUNNING as h } from "./shared/assistant/operations.js";
|
|
5
|
+
import { ASSISTANT_API_AUTH_STRATEGY as g, getImageForMode as _, getImageTagForMode as v, getResourcesForMode as y, getSandboxImageRegistry as b, resolveSandboxAssistantMode as x } from "./shared/assistant/images.js";
|
|
6
|
+
import { getCapability as S, isUnknownFieldError as C, markSupported as w, markUnsupported as T } from "./shared/assistant/capabilities.js";
|
|
7
|
+
import { approvePendingWrite as E, buildAssistantSandboxEnv as D, buildPromptRequestBody as O, checkAssistantAiCredits as k, createAssistantSandbox as A, createAssistantSession as j, downloadAssistantArtifact as M, extendAssistantSandboxTTL as N, findExistingSandbox as P, getAssistantArtifacts as F, getAssistantMessages as I, getAssistantSession as L, getAssistantStreamAccess as R, modeRequiresConfirmWrites as z, releaseSupersededAssistantSandboxes as B, reportAssistantAiTokenUsage as V, selectExistingAssistantSandbox as H, selectSupersededAssistantSandboxes as U, sendAssistantPromptAsync as W, sendHeartbeat as G, stopReapedAssistantSandbox as K, waitForAssistantServiceReady as q, waitForSandboxRunning as J } from "./shared/assistant/api.js";
|
|
8
|
+
import { AssistantRuntimeManager as Y } from "./shared/assistant/runtime.js";
|
|
9
|
+
import { buildProgress as X, getAssistantMedia as Z, getAssistantText as Q, getRawMessageCreatedAt as $, getToolProgress as ee, isReapedSandboxConnectionError as te, isRecoverable as ne, mapSessionToHistory as re, mergeMessagesById as ie, sanitize as ae } from "./shared/assistant/progress.js";
|
|
10
|
+
import { createSandboxAssistantTransport as oe } from "./shared/assistant/createSandboxAssistantTransport.js";
|
|
11
|
+
import { useSandboxAssistantTransport as se } from "./shared/assistant/useSandboxAssistantTransport.js";
|
|
12
|
+
import { chatTurns as ce, groupBySession as le, groupConsecutiveBySession as ue, isVoiceTurn as de, voiceMarker as fe, voiceSessionIdOf as pe, voiceTurnsOnly as me } from "./shared/assistant/voice/turnVisibility.js";
|
|
13
|
+
import { browserSpeechEngine as he } from "./shared/assistant/speech/browserSpeechEngine.js";
|
|
14
|
+
import { HOSTED_TTS_TIER as ge, HOSTED_VOICES as _e, hostedLocaleFor as ve, hostedSupportsLanguage as ye } from "./shared/assistant/speech/hostedVoiceCatalogue.js";
|
|
15
|
+
import { HOSTED_TTS_MAX_CHARS as be, SPEAKING_RATE_MAX as xe, SPEAKING_RATE_MAX_STREAMING as Se, SPEAKING_RATE_MAX_SYNC as Ce, SPEAKING_RATE_MIN as we, base64ToBytes as Te, buildRequest as Ee, classifyHttpFailure as De, decodeAudioResponse as Oe, shouldDisableEngine as ke, splitForVendor as Ae } from "./shared/assistant/speech/hostedTtsProtocol.js";
|
|
16
|
+
import { createHostedTtsEngine as je } from "./shared/assistant/speech/hostedTtsSpeechEngine.js";
|
|
17
|
+
import { createRoutingSpeechEngine as Me } from "./shared/assistant/speech/routingSpeechEngine.js";
|
|
18
|
+
import { configureSpeechEngine as Ne, createSpeechEngines as Pe, getSpeechEngine as Fe, readSpeechEngineConfig as Ie, resetSpeechEngine as Le } from "./shared/assistant/speech/createSpeechEngine.js";
|
|
19
|
+
import { micIsInterrupt as Re, showsAssistantCaption as ze, showsUserCaption as Be, voiceStageState as Ve, waveformIsActive as He, waveformIsSettled as Ue } from "./shared/assistant/voice/voiceStageState.js";
|
|
20
|
+
import { ENDPOINT_GRACE_MS as We, INITIAL_SESSION as Ge, INTERRUPT_MAX_MS as Ke, INTERRUPT_MIN_MS as qe, SILENCE_SUBMIT_MS as Je, isCapturing as Ye, isEcho as Xe, isSubmittable as Ze, orbMode as Qe, planReplyConsumption as $e, spokenSoFar as et, voiceSessionReducer as tt } from "./shared/assistant/voice/voiceSession.js";
|
|
21
|
+
import { SPEECH_LANG as nt, VOICE_LIST_TIMEOUT_MS as rt, isSpeechBlocked as it, languageDisplayName as at, normalizeLangTag as ot, primaryLanguageSubtag as st, selectVoiceForLocale as ct, speechGate as lt, speechLangForLocale as ut, voiceAvailability as dt, voiceQualityRank as ft, voicesForLocale as pt } from "./shared/assistant/voice/speechVoices.js";
|
|
22
|
+
import { buildContinuedFromVoiceNote as mt, buildVoiceTranscriptMarkdown as ht, voiceTranscriptFilename as gt } from "./shared/assistant/voice/voiceTranscript.js";
|
|
23
|
+
import { DEFAULT_SPEAKABLE_LABELS as _t, MAX_SPEAKABLE_CHARS as vt, MAX_SPOKEN_TABLE_ROWS as yt, SPEECH_CHUNK_CHARS as bt, SPEECH_CHUNK_CJK_CHARS as xt, chunkForSpeech as St, containsCjk as Ct, speakableEmail as wt, splitTableRow as Tt, toSpeakableText as Et } from "./shared/assistant/voice/speakableText.js";
|
|
24
|
+
import { PREVIEW_LANGUAGES as Dt, voicePreviewText as Ot } from "./shared/assistant/voice/voicePreview.js";
|
|
25
|
+
import { MINI_CAPTION_BUDGET as kt, showPreviousChunk as At } from "./shared/assistant/voice/miniCaptionBudget.js";
|
|
26
|
+
import { POLL_FAST_MS as jt, POLL_FAST_UNTIL_MS as Mt, POLL_SLOW_MS as Nt, POLL_STEADY_MS as Pt, POLL_STEADY_UNTIL_MS as Ft, pollDelayMs as It } from "./shared/assistant/voice/assistantPollSchedule.js";
|
|
27
|
+
import { toCaptionText as Lt } from "./shared/assistant/voice/captionText.js";
|
|
28
|
+
import { ASSISTANT_LANGUAGES as Rt, DEFAULT_SPEECH_RATE as zt, findAssistantLanguage as Bt, resolveAssistantLanguage as Vt } from "./shared/assistant/voice/languages.js";
|
|
29
|
+
import { replyFollowsInput as Ht, resolveLanguagePair as Ut } from "./shared/assistant/voice/languagePair.js";
|
|
30
|
+
import { findPendingWrite as Wt, parseConfirmationRefusal as Gt } from "./shared/assistant/pendingWrite.js";
|
|
31
|
+
import { AssistantProductProvider as Kt, resolveModeConfig as qt, useAssistantPageLabel as Jt, useAssistantProduct as Yt, useAssistantProductOrNull as Xt, useAssistantStorageFolders as Zt } from "./shared/assistant/product.js";
|
|
32
|
+
import { AssistantI18nProvider as Qt, assistantTranslationKey as $t, useAssistantI18nNamespace as en, useAssistantTr as tn } from "./shared/assistant/i18n.js";
|
|
33
|
+
import { SPOKEN_LABEL_LANGUAGES as nn, speechLabelsFor as rn } from "./shared/assistant/voice/speechLabels.js";
|
|
34
|
+
import { detectScriptLocale as an, resolveSpeechLocale as on } from "./shared/assistant/voice/replyLanguage.js";
|
|
35
|
+
import { IDLE_PLAYBACK as sn, isSpeakingMessage as cn, requiresCancel as ln, speechPlaybackReducer as un } from "./shared/assistant/voice/speechPlayback.js";
|
|
36
|
+
import { MAX_INLINE_IMAGE_BASE64_BYTES as dn, MAX_REQUEST_BODY_BYTES as fn } from "./shared/assistant/gatewayLimits.js";
|
|
37
|
+
import { BOILERPLATE_PAGE_SHARE as pn, MAX_BOILERPLATE_LINE_CHARS as mn, MAX_EXTRACTED_CHARS as hn, MAX_PDF_PAGES_SCANNED as gn, MIN_PAGE_TEXT_CHARS as _n, MIN_TEXT_PAGE_SHARE as vn, columnLetterToIndex as yn, decodeXmlEntities as bn, docxXmlToText as xn, fitPdfPages as Sn, formatPageRanges as Cn, isMostlyImagePages as wn, joinSheets as Tn, pageMarker as En, parseSharedStrings as Dn, parseWorkbookSheets as On, pdfTextItemsToPage as kn, sheetXmlToRows as An, summarisePageText as jn, truncatePagesForInline as Mn } from "./shared/assistant/documentText.js";
|
|
38
|
+
import { ATTACHMENT_ACCEPT as Nn, AttachmentRejectedError as Pn, INLINE_IMAGE_MAX_DIM as Fn, INLINE_IMAGE_QUALITY as In, MAX_ATTACHMENTS as Ln, MAX_FILE_BYTES as Rn, MAX_INLINE_CHARS_PER_FILE as zn, MAX_INLINE_CHARS_TOTAL as Bn, MAX_INLINE_IMAGE_BASE64_CHARS as Vn, MAX_INLINE_IMAGE_PARTS as Hn, MAX_INLINE_TURN_BODY_BYTES as Un, MAX_TURN_BODY_BYTES as Wn, PROMPT_ENVELOPE_RESERVE_BYTES as Gn, TURN_BODY_HEADROOM_BYTES as Kn, buildAttachmentPromptBlock as qn, buildPromptParts as Jn, buildPromptWithAttachments as Yn, classifyAttachment as Xn, countInlineImageCandidates as Zn, countInlinedImageParts as Qn, detectDocumentFormat as $n, estimateTurnBodyBytes as er, formatBytes as tr, getAttachmentSendBlocker as nr, getExtension as rr, getSendableAttachments as ir, hasAttachmentWorkInFlight as ar, parseDataUrl as or, toMessageAttachment as sr, truncateForInline as cr, validateFile as lr } from "./shared/assistant/attachments.js";
|
|
39
|
+
import { useAssistantStore as ur } from "./shared/assistant/store.js";
|
|
40
|
+
import { isTurnInFlight as dr } from "./shared/assistant/turnState.js";
|
|
41
|
+
import { AssistantToolActivity as fr, parseToolActivity as pr } from "./shared/assistant/ui/AssistantToolActivity.js";
|
|
42
|
+
import { AssistantSpeechProvider as mr, useAssistantSpeech as hr } from "./shared/assistant/ui/AssistantSpeechProvider.js";
|
|
43
|
+
import { useVoiceSession as gr } from "./shared/assistant/ui/useVoiceSession.js";
|
|
44
|
+
import { copyToClipboard as _r } from "./shared/assistant/clipboard.js";
|
|
45
|
+
import { getActorId as vr, getOrganizationId as yr, getWorkspaceId as br } from "./shared/assistant/context.js";
|
|
46
|
+
import { ATTACHMENT_SOURCES as xr, availableAttachmentSources as Sr, deviceHasCamera as Cr } from "./shared/assistant/attachmentSources.js";
|
|
47
|
+
import { SANDBOX_READY_TTL_MS as wr, createReadinessTracker as Tr, isRecentlyVerified as Er } from "./shared/assistant/sandboxReadiness.js";
|
|
48
|
+
import { AssistantAutoSpeakToggle as Dr } from "./shared/assistant/ui/AssistantAutoSpeakToggle.js";
|
|
49
|
+
import { AssistantMarkdownImage as Or, imageHostLabel as kr, isRemoteImageSrc as Ar } from "./shared/assistant/ui/AssistantMarkdownImage.js";
|
|
50
|
+
import { AssistantMarkdownRenderer as jr, assistantUrlTransform as Mr } from "./shared/assistant/ui/AssistantMarkdownRenderer.js";
|
|
51
|
+
import { AssistantMessageAttachments as Nr } from "./shared/assistant/ui/AssistantMessageAttachments.js";
|
|
52
|
+
import { AssistantPendingWriteCard as Pr } from "./shared/assistant/ui/AssistantPendingWriteCard.js";
|
|
53
|
+
import { AssistantLanguageMenu as Fr } from "./shared/assistant/ui/AssistantLanguageMenu.js";
|
|
54
|
+
import { AssistantReplyLanguageSelector as Ir } from "./shared/assistant/ui/AssistantReplyLanguageSelector.js";
|
|
55
|
+
import { AssistantSpeakButton as Lr } from "./shared/assistant/ui/AssistantSpeakButton.js";
|
|
56
|
+
import { AssistantSpokenTurnsNotice as Rr } from "./shared/assistant/ui/AssistantSpokenTurnsNotice.js";
|
|
57
|
+
import { AssistantAttachmentButton as zr } from "./shared/assistant/ui/composer/AssistantAttachmentButton.js";
|
|
58
|
+
import { AssistantAttachmentChips as Br } from "./shared/assistant/ui/composer/AssistantAttachmentChips.js";
|
|
59
|
+
import { AssistantLanguageSelector as Vr, FOLLOW_APP_LOCALE as Hr } from "./shared/assistant/ui/composer/AssistantLanguageSelector.js";
|
|
60
|
+
import { ASSISTANT_MODE_META as Ur, AssistantModeSelector as Wr, nextModeIndex as Gr } from "./shared/assistant/ui/composer/AssistantModeSelector.js";
|
|
61
|
+
import { AssistantVoiceButton as Kr } from "./shared/assistant/ui/composer/AssistantVoiceButton.js";
|
|
62
|
+
import { AUTO_VOICE as qr, AssistantVoiceSelector as Jr } from "./shared/assistant/ui/composer/AssistantVoiceSelector.js";
|
|
63
|
+
import { AssistantVoiceOrb as Yr } from "./shared/assistant/ui/voice/AssistantVoiceOrb.js";
|
|
64
|
+
import { AssistantVoiceSessionButton as Xr } from "./shared/assistant/ui/voice/AssistantVoiceSessionButton.js";
|
|
65
|
+
import { CAPTION_SCROLL_ATTR as Zr, VoiceCaption as Qr } from "./shared/assistant/ui/voice/VoiceCaption.js";
|
|
66
|
+
import { VoiceConversationView as $r } from "./shared/assistant/ui/voice/VoiceConversationView.js";
|
|
67
|
+
import { VoiceWaveform as ei } from "./shared/assistant/ui/voice/VoiceWaveform.js";
|
|
68
|
+
import { VoiceMiniController as ti } from "./shared/assistant/ui/voice/VoiceMiniController.js";
|
|
69
|
+
import { VoiceStage as ni } from "./shared/assistant/ui/voice/VoiceStage.js";
|
|
70
|
+
import { VoiceTranscriptDrawer as ri } from "./shared/assistant/ui/voice/VoiceTranscriptDrawer.js";
|
|
71
|
+
import { downloadFile as ii, exportConversation as ai } from "./shared/assistant/exportConversation.js";
|
|
72
|
+
import { AssistantMoreMenu as oi } from "./shared/assistant/ui/AssistantMoreMenu.js";
|
|
73
|
+
import { AssistantHeader as si } from "./shared/assistant/ui/AssistantHeader.js";
|
|
74
|
+
import { AssistantConversationList as ci } from "./shared/assistant/ui/AssistantConversationList.js";
|
|
75
|
+
import { AssistantEmptyState as li } from "./shared/assistant/ui/AssistantEmptyState.js";
|
|
76
|
+
import { AssistantMessageItem as ui } from "./shared/assistant/ui/AssistantMessageItem.js";
|
|
77
|
+
import { AssistantMessageList as di } from "./shared/assistant/ui/AssistantMessageList.js";
|
|
78
|
+
import { AssistantVoiceSession as fi } from "./shared/assistant/ui/voice/AssistantVoiceSession.js";
|
|
79
|
+
import { useAssistantApiAccess as pi } from "./shared/assistant/useAssistantApiAccess.js";
|
|
80
|
+
import { useConversationTurns as mi } from "./shared/assistant/useConversationTurns.js";
|
|
81
|
+
import { isMultimodalBodyRejection as hi, isRecoverableAssistantError as gi } from "./shared/assistant/transportErrors.js";
|
|
82
|
+
import { aiCreditsUpdatedEventName as _i, dispatchAssistantQuotaExhausted as vi, notifyAiCreditsUpdated as yi } from "./shared/assistant/aiCredits.js";
|
|
83
|
+
import { useWorkspaceWriteAccess as bi } from "./shared/assistant/useWorkspaceWriteAccess.js";
|
|
84
|
+
import { extractDocumentText as xi } from "./shared/assistant/documentExtract.js";
|
|
85
|
+
import { useAssistantAttachments as Si } from "./shared/assistant/useAssistantAttachments.js";
|
|
86
|
+
import { AssistantComposer as Ci } from "./shared/assistant/ui/composer/AssistantComposer.js";
|
|
87
|
+
import { isProdRuntime as wi } from "./shared/assistant/env.js";
|
|
88
|
+
import { useAssistantHeartbeat as Ti } from "./shared/assistant/useAssistantHeartbeat.js";
|
|
89
|
+
import { useAssistantKeyboardShortcuts as Ei } from "./shared/assistant/useAssistantKeyboardShortcuts.js";
|
|
90
|
+
import { AssistantApiCallsConsentDialog as Di } from "./shared/assistant/ui/AssistantApiCallsConsentDialog.js";
|
|
91
|
+
import { AssistantChatArea as Oi } from "./shared/assistant/ui/AssistantChatArea.js";
|
|
92
|
+
import { AIAssistantPanel as ki } from "./shared/assistant/ui/AIAssistantPanel.js";
|
|
93
|
+
export { ki as AIAssistantPanel, g as ASSISTANT_API_AUTH_STRATEGY, Rt as ASSISTANT_LANGUAGES, Ur as ASSISTANT_MODE_META, Nn as ATTACHMENT_ACCEPT, xr as ATTACHMENT_SOURCES, qr as AUTO_VOICE, Di as AssistantApiCallsConsentDialog, zr as AssistantAttachmentButton, Br as AssistantAttachmentChips, Dr as AssistantAutoSpeakToggle, Oi as AssistantChatArea, Ci as AssistantComposer, ci as AssistantConversationList, li as AssistantEmptyState, si as AssistantHeader, Qt as AssistantI18nProvider, Fr as AssistantLanguageMenu, Vr as AssistantLanguageSelector, Or as AssistantMarkdownImage, jr as AssistantMarkdownRenderer, Nr as AssistantMessageAttachments, ui as AssistantMessageItem, di as AssistantMessageList, Wr as AssistantModeSelector, oi as AssistantMoreMenu, Pr as AssistantPendingWriteCard, Kt as AssistantProductProvider, Ir as AssistantReplyLanguageSelector, Y as AssistantRuntimeManager, Lr as AssistantSpeakButton, mr as AssistantSpeechProvider, Rr as AssistantSpokenTurnsNotice, fr as AssistantToolActivity, Kr as AssistantVoiceButton, Yr as AssistantVoiceOrb, Jr as AssistantVoiceSelector, fi as AssistantVoiceSession, Xr as AssistantVoiceSessionButton, Pn as AttachmentRejectedError, pn as BOILERPLATE_PAGE_SHARE, Zr as CAPTION_SCROLL_ATTR, s as CHECK_AI_CREDITS, c as CREATE_SANDBOX, _t as DEFAULT_SPEAKABLE_LABELS, zt as DEFAULT_SPEECH_RATE, We as ENDPOINT_GRACE_MS, l as EXTEND_SANDBOX_TTL, Hr as FOLLOW_APP_LOCALE, u as GET_ACTIVE_SANDBOXES, d as GET_SANDBOX, be as HOSTED_TTS_MAX_CHARS, ge as HOSTED_TTS_TIER, _e as HOSTED_VOICES, sn as IDLE_PLAYBACK, Ge as INITIAL_SESSION, Fn as INLINE_IMAGE_MAX_DIM, In as INLINE_IMAGE_QUALITY, Ke as INTERRUPT_MAX_MS, qe as INTERRUPT_MIN_MS, Ln as MAX_ATTACHMENTS, mn as MAX_BOILERPLATE_LINE_CHARS, hn as MAX_EXTRACTED_CHARS, Rn as MAX_FILE_BYTES, zn as MAX_INLINE_CHARS_PER_FILE, Bn as MAX_INLINE_CHARS_TOTAL, dn as MAX_INLINE_IMAGE_BASE64_BYTES, Vn as MAX_INLINE_IMAGE_BASE64_CHARS, Hn as MAX_INLINE_IMAGE_PARTS, Un as MAX_INLINE_TURN_BODY_BYTES, gn as MAX_PDF_PAGES_SCANNED, fn as MAX_REQUEST_BODY_BYTES, vt as MAX_SPEAKABLE_CHARS, yt as MAX_SPOKEN_TABLE_ROWS, Wn as MAX_TURN_BODY_BYTES, kt as MINI_CAPTION_BUDGET, _n as MIN_PAGE_TEXT_CHARS, vn as MIN_TEXT_PAGE_SHARE, jt as POLL_FAST_MS, Mt as POLL_FAST_UNTIL_MS, Nt as POLL_SLOW_MS, Pt as POLL_STEADY_MS, Ft as POLL_STEADY_UNTIL_MS, Dt as PREVIEW_LANGUAGES, Gn as PROMPT_ENVELOPE_RESERVE_BYTES, f as PROXY_SANDBOX_REQUEST, p as REPORT_AI_TOKEN_USAGE, wr as SANDBOX_READY_TTL_MS, Je as SILENCE_SUBMIT_MS, xe as SPEAKING_RATE_MAX, Se as SPEAKING_RATE_MAX_STREAMING, Ce as SPEAKING_RATE_MAX_SYNC, we as SPEAKING_RATE_MIN, bt as SPEECH_CHUNK_CHARS, xt as SPEECH_CHUNK_CJK_CHARS, nt as SPEECH_LANG, nn as SPOKEN_LABEL_LANGUAGES, m as STOP_ASSISTANT_SANDBOX, Kn as TURN_BODY_HEADROOM_BYTES, rt as VOICE_LIST_TIMEOUT_MS, Qr as VoiceCaption, $r as VoiceConversationView, ti as VoiceMiniController, ni as VoiceStage, ri as VoiceTranscriptDrawer, ei as VoiceWaveform, h as WAIT_FOR_SANDBOX_RUNNING, _i as aiCreditsUpdatedEventName, E as approvePendingWrite, $t as assistantTranslationKey, Mr as assistantUrlTransform, Sr as availableAttachmentSources, Te as base64ToBytes, he as browserSpeechEngine, D as buildAssistantSandboxEnv, qn as buildAttachmentPromptBlock, mt as buildContinuedFromVoiceNote, X as buildProgress, Jn as buildPromptParts, O as buildPromptRequestBody, Yn as buildPromptWithAttachments, Ee as buildRequest, a as buildSandboxContextInput, ht as buildVoiceTranscriptMarkdown, ce as chatTurns, k as checkAssistantAiCredits, St as chunkForSpeech, Xn as classifyAttachment, De as classifyHttpFailure, t as classifyQuotaError, yn as columnLetterToIndex, Ne as configureSpeechEngine, Ct as containsCjk, _r as copyToClipboard, Zn as countInlineImageCandidates, Qn as countInlinedImageParts, A as createAssistantSandbox, j as createAssistantSession, je as createHostedTtsEngine, Tr as createReadinessTracker, Me as createRoutingSpeechEngine, oe as createSandboxAssistantTransport, Pe as createSpeechEngines, Oe as decodeAudioResponse, bn as decodeXmlEntities, n as describeQuotaError, $n as detectDocumentFormat, an as detectScriptLocale, Cr as deviceHasCamera, vi as dispatchAssistantQuotaExhausted, xn as docxXmlToText, M as downloadAssistantArtifact, ii as downloadFile, er as estimateTurnBodyBytes, o as executeSandboxGraphQL, ai as exportConversation, N as extendAssistantSandboxTTL, xi as extractDocumentText, Bt as findAssistantLanguage, P as findExistingSandbox, Wt as findPendingWrite, Sn as fitPdfPages, tr as formatBytes, Cn as formatPageRanges, vr as getActorId, F as getAssistantArtifacts, Z as getAssistantMedia, I as getAssistantMessages, L as getAssistantSession, R as getAssistantStreamAccess, Q as getAssistantText, nr as getAttachmentSendBlocker, S as getCapability, rr as getExtension, _ as getImageForMode, v as getImageTagForMode, yr as getOrganizationId, $ as getRawMessageCreatedAt, y as getResourcesForMode, b as getSandboxImageRegistry, ir as getSendableAttachments, Fe as getSpeechEngine, ee as getToolProgress, br as getWorkspaceId, le as groupBySession, ue as groupConsecutiveBySession, ar as hasAttachmentWorkInFlight, ve as hostedLocaleFor, ye as hostedSupportsLanguage, kr as imageHostLabel, Ye as isCapturing, Xe as isEcho, wn as isMostlyImagePages, hi as isMultimodalBodyRejection, wi as isProdRuntime, r as isQuotaExhaustedError, te as isReapedSandboxConnectionError, Er as isRecentlyVerified, ne as isRecoverable, gi as isRecoverableAssistantError, Ar as isRemoteImageSrc, cn as isSpeakingMessage, it as isSpeechBlocked, Ze as isSubmittable, dr as isTurnInFlight, C as isUnknownFieldError, de as isVoiceTurn, Tn as joinSheets, at as languageDisplayName, re as mapSessionToHistory, w as markSupported, T as markUnsupported, ie as mergeMessagesById, Re as micIsInterrupt, z as modeRequiresConfirmWrites, Gr as nextModeIndex, ot as normalizeLangTag, yi as notifyAiCreditsUpdated, Qe as orbMode, En as pageMarker, Gt as parseConfirmationRefusal, or as parseDataUrl, Dn as parseSharedStrings, pr as parseToolActivity, On as parseWorkbookSheets, kn as pdfTextItemsToPage, $e as planReplyConsumption, It as pollDelayMs, st as primaryLanguageSubtag, i as quotaExhaustedEventName, Ie as readSpeechEngineConfig, B as releaseSupersededAssistantSandboxes, Ht as replyFollowsInput, V as reportAssistantAiTokenUsage, ln as requiresCancel, Le as resetSpeechEngine, Vt as resolveAssistantLanguage, Ut as resolveLanguagePair, qt as resolveModeConfig, x as resolveSandboxAssistantMode, on as resolveSpeechLocale, ae as sanitize, H as selectExistingAssistantSandbox, U as selectSupersededAssistantSandboxes, ct as selectVoiceForLocale, W as sendAssistantPromptAsync, G as sendHeartbeat, An as sheetXmlToRows, ke as shouldDisableEngine, At as showPreviousChunk, ze as showsAssistantCaption, Be as showsUserCaption, wt as speakableEmail, lt as speechGate, rn as speechLabelsFor, ut as speechLangForLocale, un as speechPlaybackReducer, Ae as splitForVendor, Tt as splitTableRow, et as spokenSoFar, K as stopReapedAssistantSandbox, jn as summarisePageText, Lt as toCaptionText, sr as toMessageAttachment, Et as toSpeakableText, cr as truncateForInline, Mn as truncatePagesForInline, pi as useAssistantApiAccess, Si as useAssistantAttachments, Ti as useAssistantHeartbeat, en as useAssistantI18nNamespace, Ei as useAssistantKeyboardShortcuts, Jt as useAssistantPageLabel, Yt as useAssistantProduct, Xt as useAssistantProductOrNull, hr as useAssistantSpeech, Zt as useAssistantStorageFolders, ur as useAssistantStore, tn as useAssistantTr, mi as useConversationTurns, se as useSandboxAssistantTransport, e as useVoiceInput, gr as useVoiceSession, bi as useWorkspaceWriteAccess, lr as validateFile, dt as voiceAvailability, fe as voiceMarker, Ot as voicePreviewText, ft as voiceQualityRank, pe as voiceSessionIdOf, tt as voiceSessionReducer, Ve as voiceStageState, gt as voiceTranscriptFilename, me as voiceTurnsOnly, pt as voicesForLocale, q as waitForAssistantServiceReady, J as waitForSandboxRunning, He as waveformIsActive, Ue as waveformIsSettled };
|