@burdenoff/fe-libs 2026.925.5 → 2026.925.7

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.
Files changed (56) hide show
  1. package/dist/chrome/MobileTabBar.js +6 -6
  2. package/dist/chrome/ProductSideNav.js +9 -9
  3. package/dist/chrome/sideNavigation/useSideNavigationState.js +3 -3
  4. package/dist/chrome.js +8 -8
  5. package/dist/shared/assistant/autoRouting.d.ts +3 -0
  6. package/dist/shared/assistant/autoRouting.d.ts.map +1 -1
  7. package/dist/shared/assistant/autoRouting.js +1 -1
  8. package/dist/shared/assistant/conversation.d.ts +20 -0
  9. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  10. package/dist/shared/assistant/i18nManifest.d.ts +11 -0
  11. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  12. package/dist/shared/assistant/i18nManifest.js +11 -0
  13. package/dist/shared/assistant/index.d.ts +3 -0
  14. package/dist/shared/assistant/index.d.ts.map +1 -1
  15. package/dist/shared/assistant/localUiCommandCopy.d.ts +26 -0
  16. package/dist/shared/assistant/localUiCommandCopy.d.ts.map +1 -0
  17. package/dist/shared/assistant/localUiCommandCopy.js +37 -0
  18. package/dist/shared/assistant/localUiCommands.d.ts +124 -0
  19. package/dist/shared/assistant/localUiCommands.d.ts.map +1 -0
  20. package/dist/shared/assistant/localUiCommands.js +173 -0
  21. package/dist/shared/assistant/prewarm.d.ts +139 -0
  22. package/dist/shared/assistant/prewarm.d.ts.map +1 -0
  23. package/dist/shared/assistant/prewarm.js +96 -0
  24. package/dist/shared/assistant/product.d.ts +13 -1
  25. package/dist/shared/assistant/product.d.ts.map +1 -1
  26. package/dist/shared/assistant/product.js +8 -6
  27. package/dist/shared/assistant/turnTimeline.d.ts +7 -0
  28. package/dist/shared/assistant/turnTimeline.d.ts.map +1 -1
  29. package/dist/shared/assistant/turnTimeline.js +2 -2
  30. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  31. package/dist/shared/assistant/ui/AssistantChatArea.js +663 -482
  32. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +6 -0
  33. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
  34. package/dist/shared/assistant/ui/AssistantMessageItem.js +3 -3
  35. package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
  36. package/dist/shared/assistant/ui/AssistantMessageList.js +14 -7
  37. package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts +9 -0
  38. package/dist/shared/assistant/ui/AssistantSpeechProvider.d.ts.map +1 -1
  39. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +243 -196
  40. package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +6 -0
  41. package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts.map +1 -1
  42. package/dist/shared/assistant/ui/composer/AssistantComposer.js +110 -106
  43. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  44. package/dist/shared/assistant/ui/useVoiceSession.js +44 -43
  45. package/dist/shared/assistant/voice/captionText.d.ts.map +1 -1
  46. package/dist/shared/assistant/voice/captionText.js +1 -1
  47. package/dist/shared/assistant/voice/speakableText.d.ts.map +1 -1
  48. package/dist/shared/assistant/voice/speakableText.js +63 -62
  49. package/dist/shared/hooks/shell/index.d.ts +1 -1
  50. package/dist/shared/hooks/shell/index.d.ts.map +1 -1
  51. package/dist/shared/providers/shell/ThemeProvider.d.ts +6 -0
  52. package/dist/shared/providers/shell/ThemeProvider.d.ts.map +1 -1
  53. package/dist/shared/providers/shell/ThemeProvider.js +28 -25
  54. package/dist/shared-assistant.js +17 -14
  55. package/dist/shared-hooks-shell.js +12 -12
  56. package/package.json +1 -1
@@ -1,179 +1,183 @@
1
1
  import { useI18n as e } from "../../../providers/shell/I18nProvider.js";
2
2
  import { useVoiceInput as t } from "../../voice/useVoiceInput.js";
3
- import { useAssistantTr as n } from "../../i18n.js";
4
- import { languageDisplayName as ee } from "../../voice/speechVoices.js";
3
+ import { useAssistantTr as ee } from "../../i18n.js";
4
+ import { languageDisplayName as n } from "../../voice/speechVoices.js";
5
5
  import { resolveAssistantLanguage as r } from "../../voice/languages.js";
6
- import { getSendableAttachments as te } from "../../attachments.js";
7
- import { useAssistantStore as ne } from "../../store.js";
8
- import { AssistantAttachmentButton as re } from "./AssistantAttachmentButton.js";
9
- import { AssistantAttachmentChips as i } from "./AssistantAttachmentChips.js";
10
- import { AssistantModeSelector as a } from "./AssistantModeSelector.js";
11
- import { AssistantVoiceButton as o } from "./AssistantVoiceButton.js";
12
- import { AssistantVoiceSessionButton as s } from "../voice/AssistantVoiceSessionButton.js";
13
- import { useAssistantAttachments as c } from "../../useAssistantAttachments.js";
14
- import { useCallback as l, useLayoutEffect as u, useMemo as ie, useRef as d, useState as f } from "react";
15
- import { ArrowUp as ae, Loader2 as oe } from "lucide-react";
16
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
6
+ import { getSendableAttachments as i } from "../../attachments.js";
7
+ import { useAssistantStore as a } from "../../store.js";
8
+ import { AssistantAttachmentButton as o } from "./AssistantAttachmentButton.js";
9
+ import { AssistantAttachmentChips as s } from "./AssistantAttachmentChips.js";
10
+ import { AssistantModeSelector as c } from "./AssistantModeSelector.js";
11
+ import { AssistantVoiceButton as te } from "./AssistantVoiceButton.js";
12
+ import { AssistantVoiceSessionButton as ne } from "../voice/AssistantVoiceSessionButton.js";
13
+ import { useAssistantAttachments as re } from "../../useAssistantAttachments.js";
14
+ import { useCallback as l, useEffect as ie, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
15
+ import { ArrowUp as m, Loader2 as h } from "lucide-react";
16
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
17
17
  //#region src/shared/assistant/ui/composer/AssistantComposer.tsx
18
- var h = 200, g = ({ writeAccessDenied: g = !1, onSend: _, disabled: v = !1, placeholder: y, mode: b, availableModes: x, attachmentCharsPerFile: S, onModeChange: C, auto: w, onStartVoiceSession: T }) => {
19
- let E = n(), { locale: D } = e(), O = d(null), [k, A] = f(""), [j, M] = f(!1), N = d(0), { attachments: P, isBusy: F, preparingCount: I, sendBlocker: L, rejection: R, addFiles: z, remove: B, retry: V, clear: H, clearRejection: se, canAddMore: U } = c({ perFileChars: S }), W = l((e) => {
20
- A((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
21
- }, []), G = ne((e) => e.assistantLanguage), K = t({
22
- onFinalize: W,
23
- language: ie(() => r(G, D), [G, D]).tag
24
- }), ce = y ?? E("composer.placeholder", "Ask me anything…"), q = k.trim(), J = te(P), Y = P.filter((e) => e.status === "error"), X = (q.length > 0 || J.length > 0) && !v && L === null;
18
+ var v = 200, y = ({ writeAccessDenied: y = !1, onSend: b, disabled: x = !1, placeholder: ae, mode: oe, availableModes: S, attachmentCharsPerFile: se, onModeChange: ce, auto: le, onStartVoiceSession: C, onDraftStart: w }) => {
19
+ let T = ee(), { locale: E } = e(), D = f(null), [O, k] = p(""), [A, j] = p(!1), M = f(0), { attachments: N, isBusy: P, preparingCount: F, sendBlocker: I, rejection: L, addFiles: R, remove: z, retry: B, clear: V, clearRejection: H, canAddMore: ue } = re({ perFileChars: se }), U = O.trim() !== "" || N.length > 0, W = f(!1);
20
+ ie(() => {
21
+ U && !W.current ? (W.current = !0, w?.()) : U || (W.current = !1);
22
+ }, [U, w]);
23
+ let de = l((e) => {
24
+ k((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
25
+ }, []), G = a((e) => e.assistantLanguage), K = t({
26
+ onFinalize: de,
27
+ language: d(() => r(G, E), [G, E]).tag
28
+ }), fe = ae ?? T("composer.placeholder", "Ask me anything…"), q = O.trim(), J = i(N), Y = N.filter((e) => e.status === "error"), X = (q.length > 0 || J.length > 0) && !x && I === null;
25
29
  u(() => {
26
- let e = O.current;
27
- e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, h)}px`);
28
- }, [k]);
30
+ let e = D.current;
31
+ e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, v)}px`);
32
+ }, [O]);
29
33
  let Z = l(() => {
30
- X && (K.isActive && K.stop(), _(k.trim(), J), A(""), H());
34
+ X && (K.isActive && K.stop(), b(O.trim(), J), k(""), V());
31
35
  }, [
32
36
  X,
33
- _,
34
- k,
37
+ b,
38
+ O,
35
39
  J,
36
- H,
40
+ V,
37
41
  K
38
- ]), le = l((e) => {
42
+ ]), pe = l((e) => {
39
43
  e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Z());
40
- }, [Z]), Q = l((e) => {
44
+ }, [Z]), me = l((e) => {
41
45
  let t = Array.from(e.clipboardData?.files ?? []);
42
- t.length !== 0 && (e.preventDefault(), z(t));
43
- }, [z]), ue = l((e) => {
44
- Array.from(e.dataTransfer?.types ?? []).includes("Files") && (N.current += 1, M(!0));
45
- }, []), de = l(() => {
46
- N.current = Math.max(0, N.current - 1), N.current === 0 && M(!1);
47
- }, []), fe = l((e) => {
46
+ t.length !== 0 && (e.preventDefault(), R(t));
47
+ }, [R]), he = l((e) => {
48
+ Array.from(e.dataTransfer?.types ?? []).includes("Files") && (M.current += 1, j(!0));
49
+ }, []), ge = l(() => {
50
+ M.current = Math.max(0, M.current - 1), M.current === 0 && j(!1);
51
+ }, []), _e = l((e) => {
48
52
  Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
49
- }, []), pe = l((e) => {
50
- e.preventDefault(), N.current = 0, M(!1), z(e.dataTransfer?.files ?? null);
51
- }, [z]), me = (e) => {
53
+ }, []), Q = l((e) => {
54
+ e.preventDefault(), M.current = 0, j(!1), R(e.dataTransfer?.files ?? null);
55
+ }, [R]), ve = (e) => {
52
56
  switch (e) {
53
- case "too-many": return E("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
54
- case "too-large": return E("attachments.tooLarge", "That file is larger than 10 MB.");
55
- case "empty": return E("attachments.empty", "That file is empty.");
56
- case "unreadable": return E("attachments.unreadable", "That file could not be read.");
57
- case "unsupported-image": return E("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
57
+ case "too-many": return T("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
58
+ case "too-large": return T("attachments.tooLarge", "That file is larger than 10 MB.");
59
+ case "empty": return T("attachments.empty", "That file is empty.");
60
+ case "unreadable": return T("attachments.unreadable", "That file could not be read.");
61
+ case "unsupported-image": return T("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
58
62
  }
59
63
  }, $ = (() => {
60
64
  switch (K.error) {
61
- case "not-allowed": return E("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
62
- case "audio-capture": return E("voice.noMic", "No microphone was found.");
63
- case "network": return E("voice.network", "Speech recognition is offline right now.");
64
- case "language-not-supported": return E("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: ee(K.language, D) });
65
- case "unknown": return E("voice.failed", "Dictation stopped unexpectedly.");
65
+ case "not-allowed": return T("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
66
+ case "audio-capture": return T("voice.noMic", "No microphone was found.");
67
+ case "network": return T("voice.network", "Speech recognition is offline right now.");
68
+ case "language-not-supported": return T("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: n(K.language, E) });
69
+ case "unknown": return T("voice.failed", "Dictation stopped unexpectedly.");
66
70
  default: return null;
67
71
  }
68
72
  })();
69
- return /* @__PURE__ */ m("div", {
73
+ return /* @__PURE__ */ _("div", {
70
74
  className: "flex-shrink-0 px-3 pb-3 pt-1.5",
71
75
  children: [
72
- /* @__PURE__ */ m("div", {
73
- onDragEnter: ue,
74
- onDragLeave: de,
75
- onDragOver: fe,
76
- onDrop: pe,
77
- className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${j ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
76
+ /* @__PURE__ */ _("div", {
77
+ onDragEnter: he,
78
+ onDragLeave: ge,
79
+ onDragOver: _e,
80
+ onDrop: Q,
81
+ className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${A ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
78
82
  "data-testid": "assistant-composer",
79
83
  children: [
80
- /* @__PURE__ */ p(i, {
81
- attachments: P,
82
- onRemove: B,
83
- onRetry: V,
84
- disabled: v,
85
- preparingCount: I
84
+ /* @__PURE__ */ g(s, {
85
+ attachments: N,
86
+ onRemove: z,
87
+ onRetry: B,
88
+ disabled: x,
89
+ preparingCount: F
86
90
  }),
87
- /* @__PURE__ */ m("div", {
91
+ /* @__PURE__ */ _("div", {
88
92
  className: "flex items-end gap-2",
89
93
  children: [
90
- /* @__PURE__ */ p(re, {
91
- onFiles: z,
92
- canAddMore: U,
93
- disabled: v
94
+ /* @__PURE__ */ g(o, {
95
+ onFiles: R,
96
+ canAddMore: ue,
97
+ disabled: x
94
98
  }),
95
- /* @__PURE__ */ p("textarea", {
96
- ref: O,
97
- value: k,
98
- onChange: (e) => A(e.target.value),
99
- onKeyDown: le,
100
- onPaste: Q,
101
- disabled: v,
102
- placeholder: j ? E("composer.dropHere", "Drop files to attach") : ce,
99
+ /* @__PURE__ */ g("textarea", {
100
+ ref: D,
101
+ value: O,
102
+ onChange: (e) => k(e.target.value),
103
+ onKeyDown: pe,
104
+ onPaste: me,
105
+ disabled: x,
106
+ placeholder: A ? T("composer.dropHere", "Drop files to attach") : fe,
103
107
  rows: 1,
104
108
  className: "min-h-[36px] flex-1 resize-none self-center bg-transparent px-1 py-2 text-[15px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
105
- "aria-label": E("chatInput.ariaLabel", "Message input"),
109
+ "aria-label": T("chatInput.ariaLabel", "Message input"),
106
110
  "data-testid": "assistant-input"
107
111
  }),
108
- K.isSupported && /* @__PURE__ */ p(o, {
112
+ K.isSupported && /* @__PURE__ */ g(te, {
109
113
  isListening: K.isListening,
110
114
  isStarting: K.isStarting,
111
115
  onToggle: K.toggle,
112
- disabled: v
116
+ disabled: x
113
117
  }),
114
- T && q.length === 0 && P.length === 0 && !K.isActive ? /* @__PURE__ */ p(s, {
115
- onStart: T,
116
- disabled: v
117
- }) : /* @__PURE__ */ p("button", {
118
+ C && q.length === 0 && N.length === 0 && !K.isActive ? /* @__PURE__ */ g(ne, {
119
+ onStart: C,
120
+ disabled: x
121
+ }) : /* @__PURE__ */ g("button", {
118
122
  type: "button",
119
123
  onClick: Z,
120
124
  disabled: !X,
121
125
  className: `flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${X ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
122
- "aria-label": E("chatInput.send", "Send message"),
126
+ "aria-label": T("chatInput.send", "Send message"),
123
127
  "data-testid": "assistant-send",
124
- children: v || F ? /* @__PURE__ */ p(oe, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ p(ae, { className: "size-4" })
128
+ children: x || P ? /* @__PURE__ */ g(h, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ g(m, { className: "size-4" })
125
129
  })
126
130
  ]
127
131
  }),
128
- x.length > 1 && /* @__PURE__ */ p("div", {
132
+ S.length > 1 && /* @__PURE__ */ g("div", {
129
133
  className: "mt-2 px-0.5",
130
- children: /* @__PURE__ */ p(a, {
131
- mode: b,
132
- availableModes: x,
133
- onModeChange: C,
134
- disabled: v,
135
- auto: w
134
+ children: /* @__PURE__ */ g(c, {
135
+ mode: oe,
136
+ availableModes: S,
137
+ onModeChange: ce,
138
+ disabled: x,
139
+ auto: le
136
140
  })
137
141
  })
138
142
  ]
139
143
  }),
140
- g ? /* @__PURE__ */ p("p", {
144
+ y ? /* @__PURE__ */ g("p", {
141
145
  className: "mt-1.5 px-1 text-center text-[11px] text-status-warning",
142
146
  "data-testid": "assistant-write-access-warning",
143
- children: E("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
147
+ children: T("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
144
148
  }) : null,
145
- /* @__PURE__ */ p("div", {
149
+ /* @__PURE__ */ g("div", {
146
150
  className: "mt-1.5 px-1 text-center text-[11px]",
147
151
  "aria-live": "polite",
148
- children: K.isStarting && !K.isListening ? /* @__PURE__ */ p("p", {
152
+ children: K.isStarting && !K.isListening ? /* @__PURE__ */ g("p", {
149
153
  className: "text-text-muted",
150
154
  "data-testid": "assistant-voice-starting",
151
- children: E("voice.starting", "Starting the microphone…")
152
- }) : K.isListening ? /* @__PURE__ */ m("p", {
155
+ children: T("voice.starting", "Starting the microphone…")
156
+ }) : K.isListening ? /* @__PURE__ */ _("p", {
153
157
  className: "text-status-error-text",
154
158
  "data-testid": "assistant-voice-status",
155
- children: [/* @__PURE__ */ p("span", { className: "mr-1 inline-block size-1.5 rounded-full bg-status-error-text align-middle motion-safe:animate-pulse" }), K.interim || E("voice.listening", "Listening… speak now, tap the square to stop")]
156
- }) : $ ? /* @__PURE__ */ p("p", {
159
+ children: [/* @__PURE__ */ g("span", { className: "mr-1 inline-block size-1.5 rounded-full bg-status-error-text align-middle motion-safe:animate-pulse" }), K.interim || T("voice.listening", "Listening… speak now, tap the square to stop")]
160
+ }) : $ ? /* @__PURE__ */ g("p", {
157
161
  className: "text-status-error-text",
158
162
  "data-testid": "assistant-voice-error",
159
163
  children: $
160
- }) : R ? /* @__PURE__ */ p("button", {
164
+ }) : L ? /* @__PURE__ */ g("button", {
161
165
  type: "button",
162
- onClick: se,
166
+ onClick: H,
163
167
  className: "text-status-error-text underline-offset-2 hover:underline",
164
168
  "data-testid": "assistant-attachment-rejection",
165
- children: me(R)
166
- }) : L === "failed" ? /* @__PURE__ */ p("p", {
169
+ children: ve(L)
170
+ }) : I === "failed" ? /* @__PURE__ */ g("p", {
167
171
  className: "text-status-error-text",
168
172
  "data-testid": "assistant-attachment-blocked",
169
- children: Y.length === 1 ? E("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: Y[0].filename }) : E("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: Y.length })
170
- }) : /* @__PURE__ */ p("p", {
173
+ children: Y.length === 1 ? T("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: Y[0].filename }) : T("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: Y.length })
174
+ }) : /* @__PURE__ */ g("p", {
171
175
  className: "text-text-muted",
172
- children: E("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
176
+ children: T("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
173
177
  })
174
178
  })
175
179
  ]
176
180
  });
177
181
  };
178
182
  //#endregion
179
- export { g as AssistantComposer };
183
+ export { y as AssistantComposer };
@@ -1 +1 @@
1
- {"version":3,"file":"useVoiceSession.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useVoiceSession.ts"],"names":[],"mappings":"AASA,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAcL,KAAK,oBAAoB,EAE1B,MAAM,uBAAuB,CAAC;AAsC/B;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAC5B,SAAS,GAAG,eAAe,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAMvE,UAAU,OAAO;IACf,+EAA+E;IAC/E;;;;;;;OAOG;IACH,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM;IACtB;;;OAGG;IACH,MAAM,EAAE,eAAe,KACpB,IAAI,CAAC;IACV;;;;OAIG;IACH,WAAW,EAAE;QAAE,EAAE,E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0EAA0E;;IAE1E,6DAA6D;;IAE7D,sDAAsD;;;;;;EA4B3D"}
@@ -1,15 +1,15 @@
1
1
  import { useVoiceInput as e } from "../voice/useVoiceInput.js";
2
- import { INITIAL_SESSION as t, INTERRUPT_MAX_MS as n, NOTHING_HEARD as r, SILENCE_SUBMIT_MS as ee, advanceHeardClock as i, isCapturing as a, isSubmittable as o, planReplyConsumption as s, spokenSoFar as c, voiceSessionReducer as te } from "../voice/voiceSession.js";
3
- import { turnClockMs as l } from "../turnTimeline.js";
4
- import { useAssistantSpeech as u } from "./AssistantSpeechProvider.js";
5
- import { useCallback as d, useEffect as f, useMemo as p, useReducer as m, useRef as h, useState as g } from "react";
2
+ import { INITIAL_SESSION as t, INTERRUPT_MAX_MS as n, NOTHING_HEARD as r, SILENCE_SUBMIT_MS as i, advanceHeardClock as a, isCapturing as o, isSubmittable as s, planReplyConsumption as c, spokenSoFar as l, voiceSessionReducer as ee } from "../voice/voiceSession.js";
3
+ import { turnClockMs as u } from "../turnTimeline.js";
4
+ import { useAssistantSpeech as d } from "./AssistantSpeechProvider.js";
5
+ import { useCallback as f, useEffect as p, useMemo as m, useReducer as h, useRef as g, useState as _ } from "react";
6
6
  //#region src/shared/assistant/ui/useVoiceSession.ts
7
- var ne = 4e3, _ = 2500, v = 5e3, y = 12e3, b = "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=";
7
+ var v = 4e3, te = 2500, ne = 5e3, y = 12e3, b = "data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=";
8
8
  function x({ onSubmit: x, latestReply: S, language: C }) {
9
- let w = h(null), [T, E] = m(d((e, t) => te(e, t, w.current), []), t), D = u(), { setSessionSpeaking: O, setSessionMicOpen: k, speakingMessageId: A, stop: j } = D, M = h(null), N = h({}), P = h(r), F = h(null), I = h(!1), [L, R] = g(null), [z, B] = g(!1), [V, H] = g(!1), U = h(T);
9
+ let w = g(null), [T, E] = h(f((e, t) => ee(e, t, w.current), []), t), D = d(), { setSessionSpeaking: O, setSessionMicOpen: k, speakingMessageId: A, stop: j } = D, M = g(null), N = g({}), P = g(r), F = g(null), I = g(!1), [L, R] = _(null), [z, B] = _(!1), [V, H] = _(!1), U = g(T);
10
10
  U.current = T;
11
- let W = h(S);
12
- W.current = S, f(() => {
11
+ let W = g(S);
12
+ W.current = S, p(() => {
13
13
  if (T.phase === "speaking") {
14
14
  w.current = S?.text ?? null;
15
15
  return;
@@ -17,70 +17,71 @@ function x({ onSubmit: x, latestReply: S, language: C }) {
17
17
  if (w.current === null) return;
18
18
  let e = setTimeout(() => {
19
19
  w.current = null;
20
- }, _);
20
+ }, te);
21
21
  return () => clearTimeout(e);
22
22
  }, [T.phase, S]);
23
- let G = d((e, t) => {
23
+ let G = f((e, t) => {
24
24
  E({
25
25
  type: "speech",
26
26
  transcript: e,
27
27
  final: t
28
28
  });
29
- }, []), K = h(0), q = d(() => {
29
+ }, []), K = g(0), q = f(() => {
30
30
  j(), K.current = Date.now(), B(!0), E({ type: "interrupt" });
31
31
  }, [j]), J = e({
32
- onFinalize: d((e) => G(e, !0), [G]),
32
+ onFinalize: f((e) => G(e, !0), [G]),
33
33
  language: C
34
34
  });
35
- f(() => {
35
+ p(() => {
36
36
  J.interim && G(J.interim, !1);
37
- }, [J.interim, G]), f(() => {
38
- if (M.current && clearTimeout(M.current), H(!1), P.current = i(P.current, T, l()), T.phase !== "listening" || T.muted || !o(c(T))) return;
39
- let e = setTimeout(() => H(!0), 800), t = l();
37
+ }, [J.interim, G]), p(() => {
38
+ if (M.current && clearTimeout(M.current), H(!1), P.current = a(P.current, T, u()), T.phase !== "listening" || T.muted || !s(l(T))) return;
39
+ let e = setTimeout(() => H(!0), 800), t = u();
40
40
  return M.current = setTimeout(() => {
41
41
  N.current = {
42
42
  speechEnded: P.current.at ?? t,
43
43
  graceStarted: t,
44
- graceEnded: l()
44
+ graceEnded: u()
45
45
  }, E({ type: "silence" });
46
- }, ee), () => {
46
+ }, i), () => {
47
47
  clearTimeout(e), M.current && clearTimeout(M.current);
48
48
  };
49
- }, [T]), f(() => {
49
+ }, [T]), p(() => {
50
50
  if (!z) return;
51
51
  let e = Date.now() - K.current, t = J.isListening ? Math.max(0, 500 - e) : Math.max(0, n - e), r = setTimeout(() => B(!1), t);
52
52
  return () => clearTimeout(r);
53
53
  }, [z, J.isListening]);
54
- let Y = h("");
55
- T.phase === "listening" && (Y.current = c(T)), f(() => {
54
+ let Y = g("");
55
+ T.phase === "listening" && (Y.current = l(T)), p(() => {
56
56
  if (T.phase !== "thinking") return;
57
+ k(!1);
57
58
  let e = Y.current.trim();
58
59
  e && x(e, X.current ?? `vs-orphan-${Date.now().toString(36)}`, N.current), N.current = {}, P.current = r;
59
- }, [T.phase]), f(() => {
60
- let e = s(S?.id, T.phase, F.current);
60
+ }, [T.phase]), p(() => {
61
+ let e = c(S?.id, T.phase, F.current);
61
62
  e.claim && (F.current = S?.id ?? null, e.advance && S && E({
62
63
  type: "reply",
63
64
  text: S.text
64
65
  }));
65
- }, [S, T.phase]), f(() => {
66
+ }, [S, T.phase]), p(() => {
66
67
  let e = A !== null;
67
68
  I.current && !e && E({ type: "speech-ended" }), I.current = e;
68
- }, [A]), f(() => {
69
+ }, [A]), p(() => {
69
70
  T.phase !== "listening" && R((e) => e === "nothing-heard" ? null : e);
70
- }, [T.phase]), f(() => {
71
+ }, [T.phase]), p(() => {
71
72
  if (T.phase !== "speaking" || A !== null) return;
72
73
  let e = setTimeout(() => {
73
74
  I.current || E({ type: "speech-ended" });
74
- }, ne);
75
+ }, v);
75
76
  return () => clearTimeout(e);
76
- }, [T.phase, A]), f(() => {
77
- let e = a(T);
77
+ }, [T.phase, A]), p(() => {
78
+ let e = o(T);
78
79
  k(e), e ? J.isActive || J.start("auto") : J.isActive && J.stop();
79
80
  }, [
80
81
  T,
81
82
  J,
82
83
  k
83
- ]), f(() => {
84
+ ]), p(() => {
84
85
  J.error === "not-allowed" || J.error === "audio-capture" ? E({
85
86
  type: "fail",
86
87
  error: "mic-denied"
@@ -88,20 +89,20 @@ function x({ onSubmit: x, latestReply: S, language: C }) {
88
89
  type: "fail",
89
90
  error: "no-speech-support"
90
91
  }) : J.error === "network" ? R("network") : J.error === "unknown" && R("recognition-failed");
91
- }, [J.error]), f(() => {
92
+ }, [J.error]), p(() => {
92
93
  J.error !== null || !J.isListening || R((e) => e === "network" || e === "recognition-failed" ? null : e);
93
- }, [J.error, J.isListening]), f(() => {
94
- if (J.isListening && R((e) => e === "not-capturing" ? null : e), !a(T) || J.isListening) return;
95
- let e = setTimeout(() => R("not-capturing"), v);
94
+ }, [J.error, J.isListening]), p(() => {
95
+ if (J.isListening && R((e) => e === "not-capturing" ? null : e), !o(T) || J.isListening) return;
96
+ let e = setTimeout(() => R("not-capturing"), ne);
96
97
  return () => clearTimeout(e);
97
- }, [T, J.isListening]), f(() => {
98
- if (T.phase !== "listening" || T.muted || !J.isListening || c(T) !== "") return;
98
+ }, [T, J.isListening]), p(() => {
99
+ if (T.phase !== "listening" || T.muted || !J.isListening || l(T) !== "") return;
99
100
  let e = setTimeout(() => R("nothing-heard"), y);
100
101
  return () => clearTimeout(e);
101
- }, [T, J.isListening]), f(() => {
102
- c(T) !== "" && R(null);
102
+ }, [T, J.isListening]), p(() => {
103
+ l(T) !== "" && R(null);
103
104
  }, [T]);
104
- let X = h(null), Z = d(() => {
105
+ let X = g(null), Z = f(() => {
105
106
  if (B(!1), H(!1), !J.isSupported) {
106
107
  E({
107
108
  type: "fail",
@@ -134,17 +135,17 @@ function x({ onSubmit: x, latestReply: S, language: C }) {
134
135
  J.isSupported,
135
136
  D.isBlocked,
136
137
  O
137
- ]), Q = d(() => {
138
+ ]), Q = f(() => {
138
139
  B(!1), H(!1), X.current = null, E({ type: "end" }), j(), O(!1);
139
- }, [j, O]), $ = d(() => {
140
+ }, [j, O]), $ = f(() => {
140
141
  E({
141
142
  type: "mute",
142
143
  muted: !U.current.muted
143
144
  });
144
145
  }, []);
145
- return f(() => () => {
146
+ return p(() => () => {
146
147
  O(!1), k(!1);
147
- }, [O, k]), p(() => ({
148
+ }, [O, k]), m(() => ({
148
149
  session: T,
149
150
  notice: L,
150
151
  spokenChunks: D.spokenChunks,
@@ -1 +1 @@
1
- {"version":3,"file":"captionText.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/captionText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAkKH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA2CtD"}
1
+ {"version":3,"file":"captionText.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/captionText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAuKH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA2CtD"}
@@ -18,7 +18,7 @@ function o(e) {
18
18
  }
19
19
  function s(n, r) {
20
20
  let i = (t) => (r.push(t), `${e}${r.length - 1}${e}`);
21
- return n.replace(/^ {0,3}```[^\n]*\n([\s\S]*?)^ {0,3}```[^\n]*$/gm, (e, t) => i(t.replace(/\n$/, ""))).replace(/^ {0,3}```[^\n]*\n?([\s\S]*)$/m, (e, t) => i(t)).replace(/`([^`\n]+)`/g, (e, t) => i(t)).replace(RegExp(`<((?:https?://|mailto:)[^>\\s${t}]+)>`, "gi"), (e, t) => i(t)).replace(RegExp(`<([^@<>\\s${t}]+@[^@<>\\s${t}]+\\.[^@<>\\s${t}]+)>`, "g"), (e, t) => i(t)).replace(RegExp(`\\b(?:https?://|www\\.)[^\\s<>()\\[\\]${t}]+`, "gi"), (e) => i(e)).replace(/\b[\w.+-]{1,64}@[\w-]{1,63}\.[\w.-]{1,63}\b/g, (e) => i(e));
21
+ return n.replace(/^ {0,3}```[^\n]*\n([\s\S]*?)^ {0,3}```[^\n]*$/gm, (e, t) => i(t.replace(/\n$/, ""))).replace(/^ {0,3}```[^\n]*\n?([\s\S]*)$/m, (e, t) => i(t)).replace(/`([^`\n]+)`/g, (e, t) => i(t)).replace(/\\([!-/:-@[-`{-~])/g, (e, t) => i(t)).replace(RegExp(`<((?:https?://|mailto:)[^>\\s${t}]+)>`, "gi"), (e, t) => i(t)).replace(RegExp(`<([^@<>\\s${t}]+@[^@<>\\s${t}]+\\.[^@<>\\s${t}]+)>`, "g"), (e, t) => i(t)).replace(RegExp(`\\b(?:https?://|www\\.)[^\\s<>()\\[\\]${t}]+`, "gi"), (e) => i(e)).replace(/\b[\w.+-]{1,64}@[\w-]{1,63}\.[\w.-]{1,63}\b/g, (e) => i(e));
22
22
  }
23
23
  function c(t, n) {
24
24
  let r = RegExp(`${e}(\\d+)${e}`, "g"), i = t;
@@ -1 +1 @@
1
- {"version":3,"file":"speakableText.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/voice/speakableText.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,eAStC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,mFAAmF;AACnF,eAAO,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