@burdenoff/fe-libs 2026.904.16 → 2026.904.18
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 +1 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +71 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +190 -0
- package/dist/shared-assistant.js +2 -1
- package/package.json +1 -1
|
@@ -106,4 +106,5 @@ export * from './ui/AssistantEmptyState';
|
|
|
106
106
|
export * from './exportConversation';
|
|
107
107
|
export * from './ui/AssistantMessageItem';
|
|
108
108
|
export * from './ui/AssistantMessageList';
|
|
109
|
+
export * from './ui/voice/AssistantVoiceSession';
|
|
109
110
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/assistant/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAGxB,cAAc,wBAAwB,CAAC;AAKvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAG9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC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2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAE1C,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AssistantAttachment } from '../../attachments';
|
|
3
|
+
import { VoiceSessionSnapshot } from '../../voice/voiceSession';
|
|
4
|
+
import { VoiceSessionNotice } from '../useVoiceSession';
|
|
5
|
+
import { VoiceTranscriptTurn } from '../../voice/turnVisibility';
|
|
6
|
+
/** How much room the voice session takes: a strip, the panel, or the screen. */
|
|
7
|
+
export type VoiceView = "mini" | "panel" | "full";
|
|
8
|
+
interface Props {
|
|
9
|
+
session: VoiceSessionSnapshot;
|
|
10
|
+
/** Recent exchanges, oldest first — the running conversation. */
|
|
11
|
+
turns?: ReadonlyArray<VoiceTranscriptTurn>;
|
|
12
|
+
/** Download the spoken conversation. */
|
|
13
|
+
onSaveTranscript?: () => void;
|
|
14
|
+
/** Leave a note in the typed thread, end the session, and carry on there. */
|
|
15
|
+
onContinueInChat?: () => void;
|
|
16
|
+
/** Cut the assistant off mid-reply. */
|
|
17
|
+
onInterrupt?: () => void;
|
|
18
|
+
/** A recoverable problem to surface. Null when the microphone is healthy. */
|
|
19
|
+
notice?: VoiceSessionNotice | null;
|
|
20
|
+
/** The assistant's last reply, captioned while it is spoken. */
|
|
21
|
+
spoken: string | null;
|
|
22
|
+
onToggleMute: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Files attached to the NEXT spoken turn.
|
|
25
|
+
*
|
|
26
|
+
* ★ Deliberately a separate draft from the composer's. A photo taken during a
|
|
27
|
+
* voice session belongs to the question the user is about to ask aloud, not to
|
|
28
|
+
* whatever half-typed message is sitting in the text box behind the overlay.
|
|
29
|
+
*/
|
|
30
|
+
attachments?: AssistantAttachment[];
|
|
31
|
+
onAttachFiles?: (files: FileList | null) => void;
|
|
32
|
+
onRemoveAttachment?: (id: string) => void;
|
|
33
|
+
onRetryAttachment?: (id: string) => void;
|
|
34
|
+
canAttachMore?: boolean;
|
|
35
|
+
/** Files being read — placeholder chips, see AssistantAttachmentChips. */
|
|
36
|
+
preparingAttachments?: number;
|
|
37
|
+
/** Reveals the assistant caption in step with the audio. */
|
|
38
|
+
spokenChunks?: {
|
|
39
|
+
chunks: string[];
|
|
40
|
+
index: number;
|
|
41
|
+
} | null;
|
|
42
|
+
onEnd: () => void;
|
|
43
|
+
/** Is the recogniser actually running? Distinguishes CONNECTING from LISTENING. */
|
|
44
|
+
capturing?: boolean;
|
|
45
|
+
/** The user has cut the assistant off and capture has not resumed yet. */
|
|
46
|
+
interrupting?: boolean;
|
|
47
|
+
/** Quiet has fallen and the two-second correction window is running. */
|
|
48
|
+
awaitingEndpoint?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Full-screen voice conversation (BOFF-7120).
|
|
52
|
+
*
|
|
53
|
+
* ★ **Voice only, by explicit product decision.** The reference (Gemini Live)
|
|
54
|
+
* also offers camera and screen sharing; those are deliberately absent here.
|
|
55
|
+
* Attaching images is a separate, existing capability of the assistant and
|
|
56
|
+
* stays in the composer, and screen sharing could not work on the primary
|
|
57
|
+
* device anyway — `getDisplayMedia` is unsupported by every iOS browser, so
|
|
58
|
+
* that control would be dead on an iPhone.
|
|
59
|
+
*
|
|
60
|
+
* The controls are therefore the two that a voice conversation actually needs:
|
|
61
|
+
* mute, and end. Anything else would be a button the user has to think about
|
|
62
|
+
* while talking.
|
|
63
|
+
*
|
|
64
|
+
* This component is presentational: every transition is owned by
|
|
65
|
+
* `voiceSessionReducer`, which is pure and tested. That split exists because
|
|
66
|
+
* this file cannot be tested at all in this repo — vitest runs in `node` with
|
|
67
|
+
* no DOM and no audio.
|
|
68
|
+
*/
|
|
69
|
+
export declare const AssistantVoiceSession: FC<Props>;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=AssistantVoiceSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssistantVoiceSession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IACxB,0EAA0E;IAC1E,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,YAAY,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1D,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,KAAK,CAoiB3C,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { micIsInterrupt as e, voiceStageState as t } from "../../voice/voiceStageState.js";
|
|
2
|
+
import { spokenSoFar as n } from "../../voice/voiceSession.js";
|
|
3
|
+
import { useAssistantTr as r } from "../../i18n.js";
|
|
4
|
+
import { AssistantAttachmentButton as i } from "../composer/AssistantAttachmentButton.js";
|
|
5
|
+
import { AssistantAttachmentChips as ee } from "../composer/AssistantAttachmentChips.js";
|
|
6
|
+
import { AssistantVoiceOrb as a } from "./AssistantVoiceOrb.js";
|
|
7
|
+
import { VoiceMiniController as te } from "./VoiceMiniController.js";
|
|
8
|
+
import { VoiceStage as o } from "./VoiceStage.js";
|
|
9
|
+
import { VoiceTranscriptDrawer as s } from "./VoiceTranscriptDrawer.js";
|
|
10
|
+
import { useCallback as ne, useEffect as c, useRef as l, useState as u } from "react";
|
|
11
|
+
import { Maximize2 as d, Minimize2 as f, ScrollText as p, X as m } from "lucide-react";
|
|
12
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
13
|
+
//#region src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
|
|
14
|
+
var _ = ({ session: _, turns: b = [], onSaveTranscript: x, onContinueInChat: S, notice: C = null, spoken: w, onInterrupt: T, onToggleMute: E, attachments: D = [], onAttachFiles: O, onRemoveAttachment: re, onRetryAttachment: k, canAttachMore: ie = !0, preparingAttachments: A = 0, spokenChunks: ae = null, onEnd: j, capturing: M = !0, interrupting: N = !1, awaitingEndpoint: P = !1 }) => {
|
|
15
|
+
let F = r(), { muted: I, error: L } = _, R = l(null), z = l(null), [B, V] = u("mini"), H = B === "full", U = B === "mini", W = B === "mini" ? "panel" : B === "panel" ? "full" : "mini", [G, K] = u(!1), q = l(!1), J = l(E);
|
|
16
|
+
J.current = E;
|
|
17
|
+
let oe = ne(() => {
|
|
18
|
+
I || q.current || n(_) || (q.current = !0, J.current());
|
|
19
|
+
}, [I, _]);
|
|
20
|
+
c(() => {
|
|
21
|
+
let e = () => {
|
|
22
|
+
q.current && (q.current = !1, J.current());
|
|
23
|
+
};
|
|
24
|
+
return window.addEventListener("focus", e), () => {
|
|
25
|
+
window.removeEventListener("focus", e), q.current = !1;
|
|
26
|
+
};
|
|
27
|
+
}, []), c(() => {
|
|
28
|
+
R.current?.focus();
|
|
29
|
+
}, []), c(() => {
|
|
30
|
+
let e = (e) => {
|
|
31
|
+
if (e.key === "Escape") {
|
|
32
|
+
if (G) {
|
|
33
|
+
K(!1);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
j();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (e.key !== "Tab" || !H) return;
|
|
40
|
+
let t = (G ? z.current?.querySelector("[data-testid=\"assistant-voice-transcript\"]") : z.current)?.querySelectorAll("button:not([disabled])");
|
|
41
|
+
if (!t || t.length === 0) return;
|
|
42
|
+
let n = t[0], r = t[t.length - 1];
|
|
43
|
+
!n || !r || (e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus()));
|
|
44
|
+
};
|
|
45
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
46
|
+
}, [
|
|
47
|
+
j,
|
|
48
|
+
H,
|
|
49
|
+
G
|
|
50
|
+
]);
|
|
51
|
+
let Y = C !== null && L === null, X = n(_), Z = t({
|
|
52
|
+
snapshot: _,
|
|
53
|
+
capturing: M,
|
|
54
|
+
interrupting: N,
|
|
55
|
+
awaitingEndpoint: P
|
|
56
|
+
}), Q = (() => {
|
|
57
|
+
switch (Z) {
|
|
58
|
+
case "connecting": return F("voiceSession.connecting", "Starting the microphone…");
|
|
59
|
+
case "endpoint-grace": return F("voiceSession.endpointGrace", "Still listening — take your time");
|
|
60
|
+
case "interrupting": return F("voiceSession.interrupting", "Stopped — go ahead");
|
|
61
|
+
case "thinking": return F("voiceSession.thinking", "Thinking…");
|
|
62
|
+
case "speaking": return F("voiceSession.speaking", "Speaking — tap to stop");
|
|
63
|
+
case "mic-error":
|
|
64
|
+
case "ended": return "";
|
|
65
|
+
case "listening": return I ? F("voiceSession.muted", "Microphone off") : F("voiceSession.listening", "Listening…");
|
|
66
|
+
default: return Z;
|
|
67
|
+
}
|
|
68
|
+
})(), $ = I && Z !== "listening" && Q !== "" ? `${Q} · ${F("voiceSession.muted", "Microphone off")}` : Q;
|
|
69
|
+
return /* @__PURE__ */ g("div", {
|
|
70
|
+
ref: z,
|
|
71
|
+
className: `flex flex-col items-center justify-between bg-bg-sunken ${B === "full" ? "fixed inset-x-0 bottom-0 top-14 z-[60] px-6 py-8" : B === "panel" ? "absolute inset-0 z-20 px-4 py-6" : "absolute inset-x-0 bottom-0 z-20 h-[11.25rem] border-t border-border-subtle px-3 py-3 shadow-lg"}`,
|
|
72
|
+
role: "dialog",
|
|
73
|
+
"aria-modal": H || void 0,
|
|
74
|
+
"aria-label": F("voiceSession.title", "Voice conversation"),
|
|
75
|
+
"data-testid": "assistant-voice-session",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ g("button", {
|
|
78
|
+
ref: R,
|
|
79
|
+
type: "button",
|
|
80
|
+
onClick: j,
|
|
81
|
+
className: `absolute ${H ? "right-6 top-6 h-14 gap-2 px-5 text-base" : U ? "right-2 top-2 size-8" : "right-3 top-3 h-11 gap-2 px-4 text-sm"} flex items-center justify-center rounded-full border border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
82
|
+
"aria-label": U ? F("voiceSession.end", "End the voice conversation") : void 0,
|
|
83
|
+
"data-testid": "assistant-voice-end",
|
|
84
|
+
children: [/* @__PURE__ */ h(m, {
|
|
85
|
+
className: H ? "size-6" : U ? "size-4" : "size-5",
|
|
86
|
+
"aria-hidden": "true"
|
|
87
|
+
}), U ? null : /* @__PURE__ */ h("span", {
|
|
88
|
+
className: "max-w-[7rem] truncate whitespace-nowrap font-medium",
|
|
89
|
+
children: F("voiceSession.endShort", "End")
|
|
90
|
+
})]
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ h("div", {
|
|
93
|
+
className: `flex flex-col items-center ${U ? "px-3" : `min-h-[1.5rem] ${Y ? H ? "pt-14" : "pt-10" : ""}`}`,
|
|
94
|
+
children: Y ? /* @__PURE__ */ h("p", {
|
|
95
|
+
className: "max-w-xs text-center text-xs text-status-warning",
|
|
96
|
+
"data-testid": "assistant-voice-notice",
|
|
97
|
+
children: v(C, F)
|
|
98
|
+
}) : null
|
|
99
|
+
}),
|
|
100
|
+
(() => {
|
|
101
|
+
let t = /* @__PURE__ */ h(a, {
|
|
102
|
+
session: _,
|
|
103
|
+
compact: U,
|
|
104
|
+
connecting: Z === "connecting",
|
|
105
|
+
onPress: e(Z) ? T : E,
|
|
106
|
+
label: e(Z) ? F("voiceSession.interrupt", "Stop the assistant and speak") : I ? F("voiceSession.unmute", "Turn the microphone on") : F("voiceSession.mute", "Turn the microphone off")
|
|
107
|
+
}), n = e(Z) ? w : X || null, r = L === null ? null : y(L, F);
|
|
108
|
+
return U ? /* @__PURE__ */ h(te, {
|
|
109
|
+
state: Z,
|
|
110
|
+
caption: n,
|
|
111
|
+
statusText: $,
|
|
112
|
+
errorText: r,
|
|
113
|
+
control: t
|
|
114
|
+
}) : /* @__PURE__ */ h(o, {
|
|
115
|
+
state: Z,
|
|
116
|
+
userCaption: X || null,
|
|
117
|
+
spokenChunks: ae,
|
|
118
|
+
assistantCaption: w,
|
|
119
|
+
expanded: H,
|
|
120
|
+
statusText: $,
|
|
121
|
+
errorText: r,
|
|
122
|
+
control: t
|
|
123
|
+
});
|
|
124
|
+
})(),
|
|
125
|
+
G ? /* @__PURE__ */ h(s, {
|
|
126
|
+
turns: b,
|
|
127
|
+
onClose: () => K(!1),
|
|
128
|
+
onSave: x,
|
|
129
|
+
onContinueInChat: S
|
|
130
|
+
}) : null,
|
|
131
|
+
O ? /* @__PURE__ */ h("div", {
|
|
132
|
+
className: `absolute ${H ? "left-6 top-6" : U ? "left-11 top-2" : "left-3 top-3"}`,
|
|
133
|
+
children: /* @__PURE__ */ h(i, {
|
|
134
|
+
onFiles: (e) => {
|
|
135
|
+
O(e), V((e) => e === "mini" ? "panel" : e);
|
|
136
|
+
},
|
|
137
|
+
onPickerOpen: oe,
|
|
138
|
+
direction: "down",
|
|
139
|
+
canAddMore: ie
|
|
140
|
+
})
|
|
141
|
+
}) : null,
|
|
142
|
+
(D.length > 0 || A > 0) && !U ? /* @__PURE__ */ h("div", {
|
|
143
|
+
className: `absolute ${H ? "bottom-24 left-24 right-24" : "bottom-16 left-16 right-16"}`,
|
|
144
|
+
"data-testid": "assistant-voice-attachments",
|
|
145
|
+
children: /* @__PURE__ */ h(ee, {
|
|
146
|
+
attachments: D,
|
|
147
|
+
onRemove: re ?? (() => void 0),
|
|
148
|
+
onRetry: k ?? (() => void 0),
|
|
149
|
+
preparingCount: A
|
|
150
|
+
})
|
|
151
|
+
}) : null,
|
|
152
|
+
/* @__PURE__ */ h("button", {
|
|
153
|
+
type: "button",
|
|
154
|
+
onClick: () => K((e) => !e),
|
|
155
|
+
className: `absolute ${H ? "bottom-6 right-6 size-14" : U ? "right-11 top-2 size-8" : "bottom-3 right-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
156
|
+
"aria-pressed": G,
|
|
157
|
+
"aria-label": F("voiceSession.transcript", "Voice transcript"),
|
|
158
|
+
"data-testid": "assistant-voice-transcript-toggle",
|
|
159
|
+
children: /* @__PURE__ */ h(p, { className: H ? "size-6" : U ? "size-4" : "size-5" })
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ h("button", {
|
|
162
|
+
type: "button",
|
|
163
|
+
onClick: () => V(W),
|
|
164
|
+
className: `absolute ${H ? "bottom-6 left-6 size-14" : U ? "left-2 top-2 size-8" : "bottom-3 left-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
165
|
+
"aria-label": W === "panel" ? F("voiceSession.expandPanel", "Show the conversation in the panel") : W === "full" ? F("voiceSession.expand", "Expand the conversation to full screen") : F("voiceSession.collapse", "Shrink to the compact controller"),
|
|
166
|
+
"data-testid": "assistant-voice-expand",
|
|
167
|
+
children: H ? /* @__PURE__ */ h(f, { className: "size-5" }) : /* @__PURE__ */ h(d, { className: U ? "size-4" : "size-5" })
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
function v(e, t) {
|
|
173
|
+
switch (e) {
|
|
174
|
+
case "network": return t("voiceSession.noticeNetwork", "Speech recognition lost its connection. Check your network — it will retry.");
|
|
175
|
+
case "not-capturing": return t("voiceSession.noticeNotCapturing", "The microphone did not start. Check that this site is allowed to use it, then try again.");
|
|
176
|
+
case "recognition-failed": return t("voiceSession.noticeRecognitionFailed", "Speech recognition stopped unexpectedly. It will retry — if it keeps happening, reload the page.");
|
|
177
|
+
case "nothing-heard": return t("voiceSession.noticeNothingHeard", "Nothing heard yet. Check your microphone is not muted or in use by another app.");
|
|
178
|
+
default: return e;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function y(e, t) {
|
|
182
|
+
switch (e) {
|
|
183
|
+
case "mic-denied": return t("voiceSession.micDenied", "Microphone access is blocked. Allow it in your browser settings to talk.");
|
|
184
|
+
case "no-speech-support": return t("voiceSession.noSpeechSupport", "This browser cannot listen. Try a different browser, or type instead.");
|
|
185
|
+
case "no-voice-support": return t("voiceSession.noVoiceSupport", "This device has no voice that can speak this language.");
|
|
186
|
+
default: return e;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
export { _ as AssistantVoiceSession };
|
package/dist/shared-assistant.js
CHANGED
|
@@ -72,4 +72,5 @@ import { AssistantConversationList as Xr } from "./shared/assistant/ui/Assistant
|
|
|
72
72
|
import { AssistantEmptyState as Zr } from "./shared/assistant/ui/AssistantEmptyState.js";
|
|
73
73
|
import { AssistantMessageItem as Qr } from "./shared/assistant/ui/AssistantMessageItem.js";
|
|
74
74
|
import { AssistantMessageList as $r } from "./shared/assistant/ui/AssistantMessageList.js";
|
|
75
|
-
|
|
75
|
+
import { AssistantVoiceSession as ei } from "./shared/assistant/ui/voice/AssistantVoiceSession.js";
|
|
76
|
+
export { p as ASSISTANT_API_AUTH_STRATEGY, At as ASSISTANT_LANGUAGES, Mr as ASSISTANT_MODE_META, Cn as ATTACHMENT_ACCEPT, dr as ATTACHMENT_SOURCES, Ir as AUTO_VOICE, Or as AssistantAttachmentButton, kr as AssistantAttachmentChips, _r as AssistantAutoSpeakToggle, Xr as AssistantConversationList, Zr as AssistantEmptyState, Yr as AssistantHeader, Ht as AssistantI18nProvider, Ar as AssistantLanguageSelector, vr as AssistantMarkdownImage, xr as AssistantMarkdownRenderer, Cr as AssistantMessageAttachments, Qr as AssistantMessageItem, $r as AssistantMessageList, Nr as AssistantModeSelector, Jr as AssistantMoreMenu, wr as AssistantPendingWriteCard, Rt as AssistantProductProvider, Tr as AssistantReplyLanguageSelector, U as AssistantRuntimeManager, Er as AssistantSpeakButton, ir as AssistantSpeechProvider, Dr as AssistantSpokenTurnsNotice, nr as AssistantToolActivity, Fr as AssistantVoiceButton, Rr as AssistantVoiceOrb, Lr as AssistantVoiceSelector, ei as AssistantVoiceSession, zr as AssistantVoiceSessionButton, wn as AttachmentRejectedError, nn as BOILERPLATE_PAGE_SHARE, i as CHECK_AI_CREDITS, a as CREATE_SANDBOX, dt as DEFAULT_SPEAKABLE_LABELS, jt as DEFAULT_SPEECH_RATE, Re as ENDPOINT_GRACE_MS, o as EXTEND_SANDBOX_TTL, jr as FOLLOW_APP_LOCALE, s as GET_ACTIVE_SANDBOXES, c as GET_SANDBOX, me as HOSTED_TTS_MAX_CHARS, ue as HOSTED_TTS_TIER, de as HOSTED_VOICES, Xt as IDLE_PLAYBACK, ze as INITIAL_SESSION, Tn as INLINE_IMAGE_MAX_DIM, En as INLINE_IMAGE_QUALITY, Be as INTERRUPT_MAX_MS, Ve as INTERRUPT_MIN_MS, Dn as MAX_ATTACHMENTS, rn as MAX_BOILERPLATE_LINE_CHARS, an as MAX_EXTRACTED_CHARS, On as MAX_FILE_BYTES, kn as MAX_INLINE_CHARS_PER_FILE, An as MAX_INLINE_CHARS_TOTAL, en as MAX_INLINE_IMAGE_BASE64_BYTES, jn as MAX_INLINE_IMAGE_BASE64_CHARS, Mn as MAX_INLINE_IMAGE_PARTS, Nn as MAX_INLINE_TURN_BODY_BYTES, on as MAX_PDF_PAGES_SCANNED, tn as MAX_REQUEST_BODY_BYTES, ft as MAX_SPEAKABLE_CHARS, pt as MAX_SPOKEN_TABLE_ROWS, Pn as MAX_TURN_BODY_BYTES, sn as MIN_PAGE_TEXT_CHARS, cn as MIN_TEXT_PAGE_SHARE, Ct as POLL_FAST_MS, wt as POLL_FAST_UNTIL_MS, Tt as POLL_SLOW_MS, Et as POLL_STEADY_MS, Dt as POLL_STEADY_UNTIL_MS, xt as PREVIEW_LANGUAGES, Fn as PROMPT_ENVELOPE_RESERVE_BYTES, l as PROXY_SANDBOX_REQUEST, u as REPORT_AI_TOKEN_USAGE, mr as SANDBOX_READY_TTL_MS, He as SILENCE_SUBMIT_MS, he as SPEAKING_RATE_MAX, ge as SPEAKING_RATE_MAX_STREAMING, _e as SPEAKING_RATE_MAX_SYNC, ve as SPEAKING_RATE_MIN, mt as SPEECH_CHUNK_CHARS, ht as SPEECH_CHUNK_CJK_CHARS, Xe as SPEECH_LANG, Kt as SPOKEN_LABEL_LANGUAGES, d as STOP_ASSISTANT_SANDBOX, In as TURN_BODY_HEADROOM_BYTES, Ze as VOICE_LIST_TIMEOUT_MS, Br as VoiceCaption, Vr as VoiceConversationView, Ur as VoiceMiniController, Wr as VoiceStage, Gr as VoiceTranscriptDrawer, Hr as VoiceWaveform, f as WAIT_FOR_SANDBOX_RUNNING, Ut as assistantTranslationKey, Sr as assistantUrlTransform, fr as availableAttachmentSources, ye as base64ToBytes, le as browserSpeechEngine, C as buildAssistantSandboxEnv, Ln as buildAttachmentPromptBlock, ct as buildContinuedFromVoiceNote, W as buildProgress, Rn as buildPromptParts, w as buildPromptRequestBody, zn as buildPromptWithAttachments, be as buildRequest, t as buildSandboxContextInput, lt as buildVoiceTranscriptMarkdown, ne as chatTurns, T as checkAssistantAiCredits, gt as chunkForSpeech, Bn as classifyAttachment, xe as classifyHttpFailure, ln as columnLetterToIndex, De as configureSpeechEngine, _t as containsCjk, sr as copyToClipboard, Vn as countInlineImageCandidates, Hn as countInlinedImageParts, E as createAssistantSandbox, D as createAssistantSession, Te as createHostedTtsEngine, hr as createReadinessTracker, Ee as createRoutingSpeechEngine, ee as createSandboxAssistantTransport, Oe as createSpeechEngines, Se as decodeAudioResponse, un as decodeXmlEntities, Un as detectDocumentFormat, Jt as detectScriptLocale, pr as deviceHasCamera, dn as docxXmlToText, O as downloadAssistantArtifact, Kr as downloadFile, Wn as estimateTurnBodyBytes, n as executeSandboxGraphQL, qr as exportConversation, k as extendAssistantSandboxTTL, Mt as findAssistantLanguage, A as findExistingSandbox, It as findPendingWrite, fn as fitPdfPages, Gn as formatBytes, pn as formatPageRanges, cr as getActorId, j as getAssistantArtifacts, G as getAssistantMedia, M as getAssistantMessages, N as getAssistantSession, P as getAssistantStreamAccess, K as getAssistantText, Kn as getAttachmentSendBlocker, y as getCapability, qn as getExtension, m as getImageForMode, h as getImageTagForMode, lr as getOrganizationId, q as getRawMessageCreatedAt, g as getResourcesForMode, _ as getSandboxImageRegistry, Jn as getSendableAttachments, ke as getSpeechEngine, J as getToolProgress, ur as getWorkspaceId, re as groupBySession, ie as groupConsecutiveBySession, Yn as hasAttachmentWorkInFlight, fe as hostedLocaleFor, pe as hostedSupportsLanguage, yr as imageHostLabel, Ue as isCapturing, We as isEcho, mn as isMostlyImagePages, r as isQuotaExhaustedError, Y as isReapedSandboxConnectionError, gr as isRecentlyVerified, X as isRecoverable, br as isRemoteImageSrc, Zt as isSpeakingMessage, Qe as isSpeechBlocked, Ge as isSubmittable, tr as isTurnInFlight, b as isUnknownFieldError, ae as isVoiceTurn, hn as joinSheets, $e as languageDisplayName, Z as mapSessionToHistory, x as markSupported, S as markUnsupported, Q as mergeMessagesById, Me as micIsInterrupt, F as modeRequiresConfirmWrites, Pr as nextModeIndex, et as normalizeLangTag, Ke as orbMode, gn as pageMarker, Lt as parseConfirmationRefusal, Xn as parseDataUrl, _n as parseSharedStrings, rr as parseToolActivity, vn as parseWorkbookSheets, yn as pdfTextItemsToPage, qe as planReplyConsumption, Ot as pollDelayMs, tt as primaryLanguageSubtag, Ae as readSpeechEngineConfig, Pt as replyFollowsInput, I as reportAssistantAiTokenUsage, Qt as requiresCancel, je as resetSpeechEngine, Nt as resolveAssistantLanguage, Ft as resolveLanguagePair, zt as resolveModeConfig, v as resolveSandboxAssistantMode, Yt as resolveSpeechLocale, $ as sanitize, L as selectExistingAssistantSandbox, nt as selectVoiceForLocale, R as sendAssistantPromptAsync, z as sendHeartbeat, bn as sheetXmlToRows, Ce as shouldDisableEngine, Ne as showsAssistantCaption, Pe as showsUserCaption, vt as speakableEmail, rt as speechGate, qt as speechLabelsFor, it as speechLangForLocale, $t as speechPlaybackReducer, we as splitForVendor, yt as splitTableRow, Je as spokenSoFar, B as stopReapedAssistantSandbox, xn as summarisePageText, kt as toCaptionText, Zn as toMessageAttachment, bt as toSpeakableText, Qn as truncateForInline, Sn as truncatePagesForInline, Wt as useAssistantI18nNamespace, Bt as useAssistantProduct, Vt as useAssistantProductOrNull, ar as useAssistantSpeech, er as useAssistantStore, Gt as useAssistantTr, te as useSandboxAssistantTransport, e as useVoiceInput, or as useVoiceSession, $n as validateFile, at as voiceAvailability, oe as voiceMarker, St as voicePreviewText, ot as voiceQualityRank, se as voiceSessionIdOf, Ye as voiceSessionReducer, Fe as voiceStageState, ut as voiceTranscriptFilename, ce as voiceTurnsOnly, st as voicesForLocale, V as waitForAssistantServiceReady, H as waitForSandboxRunning, Ie as waveformIsActive, Le as waveformIsSettled };
|