@burdenoff/fe-libs 2026.928.3 → 2026.930.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.
Files changed (129) hide show
  1. package/dist/shared/assistant/adminModeSendGate.d.ts +6 -5
  2. package/dist/shared/assistant/adminModeSendGate.d.ts.map +1 -1
  3. package/dist/shared/assistant/adminModeSendGate.js +11 -11
  4. package/dist/shared/assistant/api.d.ts +313 -28
  5. package/dist/shared/assistant/api.d.ts.map +1 -1
  6. package/dist/shared/assistant/api.js +351 -135
  7. package/dist/shared/assistant/autoRouting.d.ts +11 -3
  8. package/dist/shared/assistant/autoRouting.d.ts.map +1 -1
  9. package/dist/shared/assistant/autoRouting.js +7 -7
  10. package/dist/shared/assistant/capabilities.d.ts +28 -0
  11. package/dist/shared/assistant/capabilities.d.ts.map +1 -1
  12. package/dist/shared/assistant/capabilities.js +19 -10
  13. package/dist/shared/assistant/conversation.d.ts +24 -2
  14. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  15. package/dist/shared/assistant/createSandboxAssistantTransport.d.ts.map +1 -1
  16. package/dist/shared/assistant/createSandboxAssistantTransport.js +67 -54
  17. package/dist/shared/assistant/history/historyList.js +1 -1
  18. package/dist/shared/assistant/history/historyMapping.d.ts.map +1 -1
  19. package/dist/shared/assistant/history/historyMapping.js +5 -1
  20. package/dist/shared/assistant/history/historyResume.js +7 -7
  21. package/dist/shared/assistant/i18nManifest.d.ts +53 -0
  22. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  23. package/dist/shared/assistant/i18nManifest.js +75 -16
  24. package/dist/shared/assistant/index.d.ts +15 -0
  25. package/dist/shared/assistant/index.d.ts.map +1 -1
  26. package/dist/shared/assistant/modeCapabilities.js +1 -1
  27. package/dist/shared/assistant/operations.d.ts +22 -0
  28. package/dist/shared/assistant/operations.d.ts.map +1 -1
  29. package/dist/shared/assistant/operations.js +2 -2
  30. package/dist/shared/assistant/prewarm.d.ts +7 -0
  31. package/dist/shared/assistant/prewarm.d.ts.map +1 -1
  32. package/dist/shared/assistant/prewarm.js +1 -1
  33. package/dist/shared/assistant/product.d.ts +80 -2
  34. package/dist/shared/assistant/product.d.ts.map +1 -1
  35. package/dist/shared/assistant/product.js +10 -6
  36. package/dist/shared/assistant/proposalWriteRules.d.ts +40 -0
  37. package/dist/shared/assistant/proposalWriteRules.d.ts.map +1 -0
  38. package/dist/shared/assistant/proposalWriteRules.js +14 -0
  39. package/dist/shared/assistant/store.d.ts +17 -0
  40. package/dist/shared/assistant/store.d.ts.map +1 -1
  41. package/dist/shared/assistant/store.js +50 -43
  42. package/dist/shared/assistant/turnOutcome.d.ts +34 -2
  43. package/dist/shared/assistant/turnOutcome.d.ts.map +1 -1
  44. package/dist/shared/assistant/turnOutcome.js +28 -17
  45. package/dist/shared/assistant/turnOutcomeCopy.d.ts +29 -7
  46. package/dist/shared/assistant/turnOutcomeCopy.d.ts.map +1 -1
  47. package/dist/shared/assistant/turnOutcomeCopy.js +18 -6
  48. package/dist/shared/assistant/types.d.ts +5 -1
  49. package/dist/shared/assistant/types.d.ts.map +1 -1
  50. package/dist/shared/assistant/ui/AssistantApiCallsConsentDialog.js +4 -4
  51. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  52. package/dist/shared/assistant/ui/AssistantChatArea.js +992 -718
  53. package/dist/shared/assistant/ui/AssistantConversationList.js +6 -6
  54. package/dist/shared/assistant/ui/AssistantLanguageMenu.js +6 -6
  55. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +8 -1
  56. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
  57. package/dist/shared/assistant/ui/AssistantMessageItem.js +77 -76
  58. package/dist/shared/assistant/ui/AssistantMessageList.d.ts +13 -1
  59. package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
  60. package/dist/shared/assistant/ui/AssistantMessageList.js +15 -13
  61. package/dist/shared/assistant/ui/AssistantReplyLanguageSelector.js +5 -5
  62. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +209 -209
  63. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts +62 -0
  64. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts.map +1 -0
  65. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.js +253 -0
  66. package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts +72 -0
  67. package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts.map +1 -0
  68. package/dist/shared/assistant/ui/AssistantWriteProposalCard.js +439 -0
  69. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.d.ts +40 -0
  70. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.d.ts.map +1 -0
  71. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.js +35 -0
  72. package/dist/shared/assistant/ui/composer/AssistantComposer.js +8 -8
  73. package/dist/shared/assistant/ui/useVoiceSession.d.ts +28 -0
  74. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  75. package/dist/shared/assistant/ui/useVoiceSession.js +159 -110
  76. package/dist/shared/assistant/ui/useWriteProposalConfirm.d.ts +61 -0
  77. package/dist/shared/assistant/ui/useWriteProposalConfirm.d.ts.map +1 -0
  78. package/dist/shared/assistant/ui/useWriteProposalConfirm.js +109 -0
  79. package/dist/shared/assistant/ui/useWriteProposals.d.ts +128 -0
  80. package/dist/shared/assistant/ui/useWriteProposals.d.ts.map +1 -0
  81. package/dist/shared/assistant/ui/useWriteProposals.js +240 -0
  82. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +17 -1
  83. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
  84. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +141 -109
  85. package/dist/shared/assistant/ui/writeProposalPresentation.d.ts +76 -0
  86. package/dist/shared/assistant/ui/writeProposalPresentation.d.ts.map +1 -0
  87. package/dist/shared/assistant/ui/writeProposalPresentation.js +110 -0
  88. package/dist/shared/assistant/usageReporting.d.ts +108 -0
  89. package/dist/shared/assistant/usageReporting.d.ts.map +1 -0
  90. package/dist/shared/assistant/usageReporting.js +155 -0
  91. package/dist/shared/assistant/useAssistantApiAccess.d.ts +49 -14
  92. package/dist/shared/assistant/useAssistantApiAccess.d.ts.map +1 -1
  93. package/dist/shared/assistant/useAssistantApiAccess.js +43 -25
  94. package/dist/shared/assistant/useAssistantHeartbeat.d.ts.map +1 -1
  95. package/dist/shared/assistant/useAssistantHeartbeat.js +5 -5
  96. package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts +5 -6
  97. package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts.map +1 -1
  98. package/dist/shared/assistant/voice/voiceSession.d.ts +46 -0
  99. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  100. package/dist/shared/assistant/voice/voiceSession.js +35 -2
  101. package/dist/shared/assistant/writeConfirmSeam.d.ts +32 -0
  102. package/dist/shared/assistant/writeConfirmSeam.d.ts.map +1 -0
  103. package/dist/shared/assistant/writeConfirmSeam.js +23 -0
  104. package/dist/shared/assistant/writeModeConsent.d.ts +16 -8
  105. package/dist/shared/assistant/writeModeConsent.d.ts.map +1 -1
  106. package/dist/shared/assistant/writeModeConsent.js +2 -2
  107. package/dist/shared/assistant/writeProposalDiscovery.d.ts +187 -0
  108. package/dist/shared/assistant/writeProposalDiscovery.d.ts.map +1 -0
  109. package/dist/shared/assistant/writeProposalDiscovery.js +246 -0
  110. package/dist/shared/assistant/writeProposalErrorCopy.d.ts +135 -0
  111. package/dist/shared/assistant/writeProposalErrorCopy.d.ts.map +1 -0
  112. package/dist/shared/assistant/writeProposalErrorCopy.js +135 -0
  113. package/dist/shared/assistant/writeProposalVoice.d.ts +133 -0
  114. package/dist/shared/assistant/writeProposalVoice.d.ts.map +1 -0
  115. package/dist/shared/assistant/writeProposalVoice.js +66 -0
  116. package/dist/shared/assistant/writeProposals.d.ts +268 -0
  117. package/dist/shared/assistant/writeProposals.d.ts.map +1 -0
  118. package/dist/shared/assistant/writeProposals.js +445 -0
  119. package/dist/shared/assistant/writeReplyBinder.d.ts +166 -0
  120. package/dist/shared/assistant/writeReplyBinder.d.ts.map +1 -0
  121. package/dist/shared/assistant/writeReplyBinder.js +233 -0
  122. package/dist/shared/assistant/writeReplySend.d.ts +110 -0
  123. package/dist/shared/assistant/writeReplySend.d.ts.map +1 -0
  124. package/dist/shared/assistant/writeReplySend.js +93 -0
  125. package/dist/shared-assistant.js +168 -153
  126. package/dist/ui/modal-shell.d.ts +14 -1
  127. package/dist/ui/modal-shell.d.ts.map +1 -1
  128. package/dist/ui/modal-shell.js +8 -6
  129. package/package.json +1 -1
@@ -1,24 +1,24 @@
1
1
  import { useI18n as e } from "../../providers/shell/I18nProvider.js";
2
2
  import { useAssistantTr as t } from "../i18n.js";
3
- import { isVoiceTurn as n } from "../voice/turnVisibility.js";
4
- import { VOICE_LIST_TIMEOUT_MS as r, languageDisplayName as i, selectVoiceForLocale as a, speechGate as o, speechLangForLocale as s, voiceAvailability as c, voicesForLocale as l } from "../voice/speechVoices.js";
3
+ import { useAssistantStore as n } from "../store.js";
4
+ import { isVoiceTurn as r } from "../voice/turnVisibility.js";
5
+ import { VOICE_LIST_TIMEOUT_MS as i, languageDisplayName as a, selectVoiceForLocale as o, speechGate as s, speechLangForLocale as c, voiceAvailability as ee, voicesForLocale as l } from "../voice/speechVoices.js";
5
6
  import { getSpeechEngine as u, subscribeSpeechEngine as d } from "../speech/createSpeechEngine.js";
6
- import { chunkForSpeech as ee, toSpeakableText as f } from "../voice/speakableText.js";
7
- import { voicePreviewText as p } from "../voice/voicePreview.js";
8
- import { findAssistantLanguage as m } from "../voice/languages.js";
9
- import { resolveLanguagePair as te } from "../voice/languagePair.js";
10
- import { speechLabelsFor as ne } from "../voice/speechLabels.js";
11
- import { resolveSpeechLocale as re } from "../voice/replyLanguage.js";
12
- import { IDLE_PLAYBACK as ie, isSpeakingMessage as ae, publishedChunks as oe, speechPlaybackReducer as se } from "../voice/speechPlayback.js";
13
- import { useAssistantStore as h } from "../store.js";
14
- import { isTurnInFlight as ce } from "../turnState.js";
15
- import { parseToolActivity as le } from "./AssistantToolActivity.js";
7
+ import { chunkForSpeech as te, toSpeakableText as f } from "../voice/speakableText.js";
8
+ import { voicePreviewText as ne } from "../voice/voicePreview.js";
9
+ import { findAssistantLanguage as re } from "../voice/languages.js";
10
+ import { resolveLanguagePair as ie } from "../voice/languagePair.js";
11
+ import { speechLabelsFor as ae } from "../voice/speechLabels.js";
12
+ import { resolveSpeechLocale as oe } from "../voice/replyLanguage.js";
13
+ import { IDLE_PLAYBACK as se, isSpeakingMessage as p, publishedChunks as ce, speechPlaybackReducer as le } from "../voice/speechPlayback.js";
14
+ import { isTurnInFlight as ue } from "../turnState.js";
15
+ import { parseToolActivity as de } from "./AssistantToolActivity.js";
16
16
  import "../speech/index.js";
17
- import { markTurn as ue } from "../turnTimeline.js";
18
- import { createContext as de, useCallback as g, useContext as _, useEffect as v, useMemo as y, useReducer as fe, useRef as b, useState as x, useSyncExternalStore as pe } from "react";
19
- import { jsx as me } from "react/jsx-runtime";
17
+ import { markTurn as fe } from "../turnTimeline.js";
18
+ import { createContext as pe, useCallback as m, useContext as h, useEffect as g, useMemo as _, useReducer as me, useRef as v, useState as y, useSyncExternalStore as he } from "react";
19
+ import { jsx as ge } from "react/jsx-runtime";
20
20
  //#region src/shared/assistant/ui/AssistantSpeechProvider.tsx
21
- var he = {
21
+ var _e = {
22
22
  codeBlock: "",
23
23
  image: "",
24
24
  link: "",
@@ -27,7 +27,7 @@ var he = {
27
27
  emailAt: "at",
28
28
  emailDot: "dot",
29
29
  nestedItem: ""
30
- }, ge = 4e3, _e = de({
30
+ }, ve = 4e3, b = pe({
31
31
  isSupported: !1,
32
32
  availability: "unsupported",
33
33
  isBlocked: !0,
@@ -50,36 +50,36 @@ var he = {
50
50
  speakFinishedReply: () => {},
51
51
  previewVoice: () => {}
52
52
  });
53
- function ve() {
54
- return _(_e);
53
+ function x() {
54
+ return h(b);
55
55
  }
56
- var ye = ({ children: de, visible: _ = !0, engine: ve }) => {
57
- let ye = pe(d, u, u), S = ve ?? ye, C = t(), { locale: w } = e(), [T, E] = fe(se, ie), [D, O] = x(() => S.listVoices()), [k, be] = x(!1), [xe, A] = x(() => /* @__PURE__ */ new Map()), j = b(0), M = b(null), N = b(null);
58
- v(() => () => {
59
- N.current !== null && clearTimeout(N.current);
56
+ var ye = ({ children: pe, visible: h = !0, engine: x }) => {
57
+ let ye = he(d, u, u), S = x ?? ye, C = t(), { locale: w } = e(), [T, E] = me(le, se), [D, O] = y(() => S.listVoices()), [k, be] = y(!1), [A, j] = y(() => /* @__PURE__ */ new Map()), M = v(0), N = v(null), P = v(null);
58
+ g(() => () => {
59
+ P.current !== null && clearTimeout(P.current);
60
60
  }, []);
61
- let [Se, P] = x(null), F = b(null), Ce = b(() => {}), I = g(() => {
62
- F.current?.(), F.current = null;
63
- }, []), L = h((e) => e.autoSpeakEnabled), we = h((e) => e.setAutoSpeak), [R, Te] = x(!1), Ee = b(!1), z = g((e) => {
64
- Ee.current = e;
65
- }, []), B = h((e) => e.activeConversationId), V = y(() => S.isSupported(), [S]);
66
- v(() => {
67
- if (!V) return;
61
+ let [F, I] = y(null), L = v(null), xe = v(() => {}), R = m(() => {
62
+ L.current?.(), L.current = null;
63
+ }, []), z = n((e) => e.autoSpeakEnabled), Se = n((e) => e.setAutoSpeak), [B, Ce] = y(!1), we = v(!1), Te = m((e) => {
64
+ we.current = e;
65
+ }, []), V = n((e) => e.activeConversationId), H = _(() => S.isSupported(), [S]);
66
+ g(() => {
67
+ if (!H) return;
68
68
  let e = () => {
69
- O(S.listVoices()), A((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
69
+ O(S.listVoices()), j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
70
70
  };
71
71
  return e(), S.subscribeVoices(e);
72
- }, [S, V]);
73
- let De = h((e) => e.assistantLanguage), Oe = h((e) => e.replyLanguage), H = h((e) => e.preferredVoices), ke = h((e) => e.setPreferredVoice), U = y(() => te(De, Oe, w).reply, [
72
+ }, [S, H]);
73
+ let Ee = n((e) => e.assistantLanguage), De = n((e) => e.replyLanguage), U = n((e) => e.preferredVoices), Oe = n((e) => e.setPreferredVoice), W = _(() => ie(Ee, De, w).reply, [
74
+ Ee,
74
75
  De,
75
- Oe,
76
76
  w
77
- ]), W = U.code, G = g((e) => m(e)?.tag ?? s(e), []), Ae = g((e) => m(e)?.rate ?? .9, []), K = y(() => c(V, D, U.tag, k), [
78
- V,
77
+ ]), G = W.code, K = m((e) => re(e)?.tag ?? c(e), []), ke = m((e) => re(e)?.rate ?? .9, []), q = _(() => ee(H, D, W.tag, k), [
78
+ H,
79
79
  D,
80
- U,
80
+ W,
81
81
  k
82
- ]), je = y(() => ({
82
+ ]), Ae = _(() => ({
83
83
  codeBlock: C("speech.codeBlock", "Code block"),
84
84
  image: C("speech.image", "image"),
85
85
  link: C("speech.link", "link"),
@@ -88,293 +88,293 @@ var ye = ({ children: de, visible: _ = !0, engine: ve }) => {
88
88
  nestedItem: C("speech.nestedItem", "Sub-item {{ordinal}}"),
89
89
  emailAt: C("speech.emailAt", "at"),
90
90
  emailDot: C("speech.emailDot", "dot")
91
- }), [C]), q = g(() => {
92
- I(), M.current = null, S.cancel(), E({ type: "stop" });
93
- }, [I, S]), Me = g((e) => {
91
+ }), [C]), J = m(() => {
92
+ R(), N.current = null, S.cancel(), E({ type: "stop" });
93
+ }, [R, S]), je = m((e) => {
94
94
  let t = S.listVoices().find((t) => t.name === e) ?? null;
95
95
  if (t) {
96
- q();
96
+ J();
97
97
  try {
98
- S.speak([p(W)], {
98
+ S.speak([ne(G)], {
99
99
  voice: t,
100
- lang: G(W),
100
+ lang: K(G),
101
101
  fallback: !1
102
102
  });
103
103
  } catch {}
104
104
  }
105
105
  }, [
106
106
  S,
107
- W,
108
- q,
109
- G
110
- ]), Ne = g((e) => xe.get(e) ?? null, [xe]), Pe = g((e, t, n, i) => {
111
- I();
112
- let a = !1, o = () => {}, s = (r) => {
107
+ G,
108
+ J,
109
+ K
110
+ ]), Me = m((e) => A.get(e) ?? null, [A]), Ne = m((e, t, n, r) => {
111
+ R();
112
+ let a = !1, o = () => {}, s = (i) => {
113
113
  if (!a) {
114
- if (a = !0, F.current = null, clearTimeout(c), o(), r.length === 0) {
114
+ if (a = !0, L.current = null, clearTimeout(c), o(), i.length === 0) {
115
115
  be(!0);
116
116
  return;
117
117
  }
118
- O(r), Ce.current(e, t, r, n, i);
118
+ O(i), xe.current(e, t, i, n, r);
119
119
  }
120
- }, c = setTimeout(() => s(S.listVoices()), r);
121
- o = S.subscribeVoices(() => s(S.listVoices())), F.current = () => {
122
- a || (a = !0, clearTimeout(c), o(), F.current = null);
120
+ }, c = setTimeout(() => s(S.listVoices()), i);
121
+ o = S.subscribeVoices(() => s(S.listVoices())), L.current = () => {
122
+ a || (a = !0, clearTimeout(c), o(), L.current = null);
123
123
  };
124
- }, [I, S]), J = g((e, t, n, r, s = !1) => {
125
- let l = n;
126
- if (l.length === 0) {
124
+ }, [R, S]), Y = m((e, t, n, r, i = !1) => {
125
+ let c = n;
126
+ if (c.length === 0) {
127
127
  let e = S.listVoices();
128
- e.length > 0 && (l = e, O(e));
128
+ e.length > 0 && (c = e, O(e));
129
129
  }
130
- let u = G(r), d = o(c(!0, l, r, k));
131
- if (d === "block") {
132
- let t = C("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: i(u, w) });
133
- A((n) => new Map(n).set(e, t));
130
+ let l = K(r), u = s(ee(!0, c, r, k));
131
+ if (u === "block") {
132
+ let t = C("speech.noVoiceForReply", "This reply is in {{language}}, and no {{language}} voice is installed on this device.", { language: a(l, w) });
133
+ j((n) => new Map(n).set(e, t));
134
134
  return;
135
135
  }
136
- if (d === "wait-for-voices") {
137
- Pe(e, t, r, s);
136
+ if (u === "wait-for-voices") {
137
+ Ne(e, t, r, i);
138
138
  return;
139
139
  }
140
- A((t) => {
140
+ j((t) => {
141
141
  if (!t.has(e)) return t;
142
142
  let n = new Map(t);
143
143
  return n.delete(e), n;
144
- }), I();
145
- let f = j.current + 1;
146
- j.current = f, E({
144
+ }), R();
145
+ let d = M.current + 1;
146
+ M.current = d, E({
147
147
  type: "start",
148
148
  messageId: e,
149
- requestId: f
150
- }), M.current = s ? f : null, s && ue(e, "ttsStarted");
151
- let p = ee(t);
152
- P({
153
- requestId: f,
154
- chunks: p,
149
+ requestId: d
150
+ }), N.current = i ? d : null, i && fe(e, "ttsStarted");
151
+ let f = te(t);
152
+ I({
153
+ requestId: d,
154
+ chunks: f,
155
155
  index: -1
156
- }), N.current !== null && clearTimeout(N.current), N.current = setTimeout(() => {
157
- P((e) => e?.requestId === f && e.index < 0 ? null : e);
158
- }, ge);
159
- let m = () => {
160
- j.current === f && N.current !== null && (clearTimeout(N.current), N.current = null), E({
156
+ }), P.current !== null && clearTimeout(P.current), P.current = setTimeout(() => {
157
+ I((e) => e?.requestId === d && e.index < 0 ? null : e);
158
+ }, ve);
159
+ let ne = () => {
160
+ M.current === d && P.current !== null && (clearTimeout(P.current), P.current = null), E({
161
161
  type: "failed",
162
- requestId: f
162
+ requestId: d
163
163
  });
164
164
  };
165
165
  try {
166
- S.speak(p, {
167
- voice: a(l, u, H[r]),
168
- lang: u,
169
- rate: Ae(r)
166
+ S.speak(f, {
167
+ voice: o(c, l, U[r]),
168
+ lang: l,
169
+ rate: ke(r)
170
170
  }, {
171
171
  onStart: () => {
172
- j.current === f && M.current === f && ue(e, "firstAudio");
172
+ M.current === d && N.current === d && fe(e, "firstAudio");
173
173
  },
174
174
  onChunkStart: (e) => {
175
- j.current === f && N.current !== null && (clearTimeout(N.current), N.current = null), P((t) => t?.requestId === f ? {
175
+ M.current === d && P.current !== null && (clearTimeout(P.current), P.current = null), I((t) => t?.requestId === d ? {
176
176
  ...t,
177
177
  index: e
178
- } : j.current === f ? {
179
- requestId: f,
180
- chunks: p,
178
+ } : M.current === d ? {
179
+ requestId: d,
180
+ chunks: f,
181
181
  index: e
182
182
  } : t);
183
183
  },
184
184
  onEnd: () => E({
185
185
  type: "finished",
186
- requestId: f
186
+ requestId: d
187
187
  }),
188
188
  onError: () => E({
189
189
  type: "failed",
190
- requestId: f
190
+ requestId: d
191
191
  })
192
192
  });
193
193
  } catch {
194
- m();
194
+ ne();
195
195
  }
196
196
  }, [
197
- I,
197
+ R,
198
198
  S,
199
199
  w,
200
- H,
201
- Ae,
202
- G,
200
+ U,
201
+ ke,
202
+ K,
203
203
  C,
204
204
  k,
205
- Pe
205
+ Ne
206
206
  ]);
207
- v(() => {
208
- Ce.current = J;
209
- }, [J]);
210
- let Y = g((e, t, n, r) => {
211
- if (!V) return;
212
- let i = re(f(t, { labels: he }), n ?? W), a = f(t, { labels: ne(i, je) });
213
- a && J(e, a, D, i, r?.auto === !0);
207
+ g(() => {
208
+ xe.current = Y;
209
+ }, [Y]);
210
+ let X = m((e, t, n, r) => {
211
+ if (!H) return;
212
+ let i = oe(f(t, { labels: _e }), n ?? G), a = f(t, { labels: ae(i, Ae) });
213
+ a && Y(e, a, D, i, r?.auto === !0);
214
214
  }, [
215
- V,
216
- je,
217
- W,
218
- J,
215
+ H,
216
+ Ae,
217
+ G,
218
+ Y,
219
219
  D
220
- ]), X = g((e, t, n) => {
221
- if (ae(T, e)) {
222
- q();
220
+ ]), Pe = m((e, t, n) => {
221
+ if (p(T, e)) {
222
+ J();
223
223
  return;
224
224
  }
225
- Y(e, t, n);
225
+ X(e, t, n);
226
226
  }, [
227
227
  T,
228
- Y,
229
- q
228
+ X,
229
+ J
230
230
  ]);
231
- v(() => {
232
- _ || q();
233
- }, [_, q]);
234
- let Fe = b({
235
- autoSpeakEnabled: L,
236
- sessionSpeaking: R,
237
- visible: _,
238
- isSupported: V
231
+ g(() => {
232
+ h || J();
233
+ }, [h, J]);
234
+ let Fe = v({
235
+ autoSpeakEnabled: z,
236
+ sessionSpeaking: B,
237
+ visible: h,
238
+ isSupported: H
239
239
  });
240
- v(() => {
240
+ g(() => {
241
241
  Fe.current = {
242
- autoSpeakEnabled: L,
243
- sessionSpeaking: R,
244
- visible: _,
245
- isSupported: V
242
+ autoSpeakEnabled: z,
243
+ sessionSpeaking: B,
244
+ visible: h,
245
+ isSupported: H
246
246
  };
247
247
  }, [
248
- L,
249
- R,
250
- _,
251
- V
248
+ z,
249
+ B,
250
+ h,
251
+ H
252
252
  ]);
253
- let Ie = b(null), Z = b(null), Le = b(() => {});
254
- v(() => {
255
- q(), A(/* @__PURE__ */ new Map()), Ie.current = B;
253
+ let Ie = v(null), Z = v(null), Le = v(() => {});
254
+ g(() => {
255
+ J(), j(/* @__PURE__ */ new Map()), Ie.current = V;
256
256
  let e = Z.current;
257
- Z.current = null, e && e.conversationId === B && Le.current(e.conversationId, e.messageId);
258
- }, [B, q]), v(() => {
259
- A((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), q();
260
- }, [W, q]), v(() => () => {
261
- F.current?.(), F.current = null, S.cancel();
262
- }, [S]), v(() => {
257
+ Z.current = null, e && e.conversationId === V && Le.current(e.conversationId, e.messageId);
258
+ }, [V, J]), g(() => {
259
+ j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map()), J();
260
+ }, [G, J]), g(() => () => {
261
+ L.current?.(), L.current = null, S.cancel();
262
+ }, [S]), g(() => {
263
263
  if (typeof window > "u") return;
264
264
  let e = () => S.cancel();
265
265
  return window.addEventListener("pagehide", e), () => window.removeEventListener("pagehide", e);
266
- }, [S]), v(() => {
267
- if (typeof document > "u" || !V) return;
266
+ }, [S]), g(() => {
267
+ if (typeof document > "u" || !H) return;
268
268
  let e = () => {
269
269
  if (document.visibilityState !== "visible") return;
270
270
  let e = S.listVoices();
271
- e.length > 0 && I(), O(e), be(!1), A((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
271
+ e.length > 0 && R(), O(e), be(!1), j((e) => e.size === 0 ? e : /* @__PURE__ */ new Map());
272
272
  };
273
273
  return document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), () => {
274
274
  document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e);
275
275
  };
276
276
  }, [
277
- I,
277
+ R,
278
278
  S,
279
- V
279
+ H
280
280
  ]);
281
- let Re = b(Y);
282
- v(() => {
283
- Re.current = Y;
284
- }, [Y]);
285
- let Q = g((e, t) => {
286
- if (n(e) !== t || Ee.current) return;
287
- let { text: r } = le(e.content);
288
- if (r.trim()) try {
289
- Re.current(e.id, r, e.metadata?.lang, { auto: !0 });
281
+ let Re = v(X);
282
+ g(() => {
283
+ Re.current = X;
284
+ }, [X]);
285
+ let Q = m((e, t) => {
286
+ if (r(e) !== t || we.current) return;
287
+ let { text: n } = de(e.content);
288
+ if (n.trim()) try {
289
+ Re.current(e.id, n, e.metadata?.lang, { auto: !0 });
290
290
  } catch {}
291
- }, []), $ = g((e, t) => {
291
+ }, []), $ = m((e, t) => {
292
292
  if (e !== Ie.current) {
293
- h.getState().activeConversationId === e && (Z.current = {
293
+ n.getState().activeConversationId === e && (Z.current = {
294
294
  conversationId: e,
295
295
  messageId: t
296
296
  });
297
297
  return;
298
298
  }
299
- let n = Fe.current;
300
- if (!n.autoSpeakEnabled && !n.sessionSpeaking || !n.visible || !n.isSupported) return;
301
- let r = h.getState();
302
- if (r.activeConversationId !== e) return;
303
- let i = r.conversations.find((t) => t.id === e)?.messages.find((e) => e.id === t);
304
- !i || i.role !== "assistant" || Q(i, n.sessionSpeaking);
299
+ let r = Fe.current;
300
+ if (!r.autoSpeakEnabled && !r.sessionSpeaking || !r.visible || !r.isSupported) return;
301
+ let i = n.getState();
302
+ if (i.activeConversationId !== e) return;
303
+ let a = i.conversations.find((t) => t.id === e)?.messages.find((e) => e.id === t);
304
+ !a || a.role !== "assistant" || Q(a, r.sessionSpeaking);
305
305
  }, [Q]);
306
- v(() => {
306
+ g(() => {
307
307
  Le.current = $;
308
- }, [$]), v(() => {
309
- if (!(!L && !R || !_ || !V)) return h.subscribe((e, t) => {
308
+ }, [$]), g(() => {
309
+ if (!(!z && !B || !h || !H)) return n.subscribe((e, t) => {
310
310
  let n = e.activeConversationId;
311
311
  if (!n || n !== t.activeConversationId) return;
312
312
  let r = e.processingByConversationId[n], i = t.processingByConversationId[n];
313
- if (r?.status !== "complete" || !ce(i?.status)) return;
313
+ if (r?.status !== "complete" || !ue(i?.status)) return;
314
314
  let a = r.messageId ?? i?.messageId ?? null;
315
315
  if (!a) return;
316
316
  let o = e.conversations.find((e) => e.id === n)?.messages.find((e) => e.id === a);
317
- !o || o.role !== "assistant" || Q(o, R);
317
+ !o || o.role !== "assistant" || Q(o, B);
318
318
  });
319
319
  }, [
320
- L,
321
- R,
322
- V,
323
- _,
320
+ z,
321
+ B,
322
+ H,
323
+ h,
324
324
  Q
325
325
  ]);
326
- let ze = y(() => l(D, U.tag), [D, U]), Be = y(() => a(D, U.tag, H[W]), [
326
+ let ze = _(() => l(D, W.tag), [D, W]), Be = _(() => o(D, W.tag, U[G]), [
327
327
  D,
328
+ W,
328
329
  U,
329
- H,
330
- W
331
- ]), Ve = y(() => ({
332
- isSupported: V,
333
- availability: K,
334
- isBlocked: K === "no-voices",
335
- disabledReason: K === "no-voices" ? C("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
336
- blockedFor: Ne,
330
+ G
331
+ ]), Ve = _(() => ({
332
+ isSupported: H,
333
+ availability: q,
334
+ isBlocked: q === "no-voices",
335
+ disabledReason: q === "no-voices" ? C("speech.noVoicesOnDevice", "This device has no speech voices installed. Add one in your device speech or accessibility settings.") : null,
336
+ blockedFor: Me,
337
337
  voiceChoices: ze,
338
- spokenChunks: oe(T, Se),
338
+ spokenChunks: ce(T, F),
339
339
  activeVoiceName: Be?.name ?? null,
340
- preferredVoiceName: H[W] ?? null,
341
- setVoice: (e) => ke(W, e),
340
+ preferredVoiceName: U[G] ?? null,
341
+ setVoice: (e) => Oe(G, e),
342
342
  speakingMessageId: T.status === "speaking" ? T.messageId : null,
343
- isSpeaking: (e) => ae(T, e),
344
- toggle: X,
345
- stop: q,
346
- autoSpeakEnabled: L,
347
- setAutoSpeak: we,
348
- sessionSpeaking: R,
349
- setSessionSpeaking: Te,
350
- setSessionMicOpen: z,
343
+ isSpeaking: (e) => p(T, e),
344
+ toggle: Pe,
345
+ stop: J,
346
+ autoSpeakEnabled: z,
347
+ setAutoSpeak: Se,
348
+ sessionSpeaking: B,
349
+ setSessionSpeaking: Ce,
350
+ setSessionMicOpen: Te,
351
351
  speakFinishedReply: $,
352
- previewVoice: Me
352
+ previewVoice: je
353
353
  }), [
354
- V,
355
- K,
356
- Ne,
354
+ H,
355
+ q,
356
+ Me,
357
357
  ze,
358
358
  Be,
359
- H,
360
- ke,
361
- W,
359
+ U,
360
+ Oe,
361
+ G,
362
362
  T,
363
- X,
364
- q,
365
- L,
366
- we,
367
- R,
363
+ Pe,
364
+ J,
368
365
  z,
366
+ Se,
367
+ B,
368
+ Te,
369
369
  $,
370
- Me,
370
+ je,
371
371
  C,
372
- Se
372
+ F
373
373
  ]);
374
- return /* @__PURE__ */ me(_e.Provider, {
374
+ return /* @__PURE__ */ ge(b.Provider, {
375
375
  value: Ve,
376
- children: de
376
+ children: pe
377
377
  });
378
378
  };
379
379
  //#endregion
380
- export { ye as AssistantSpeechProvider, ve as useAssistantSpeech };
380
+ export { ye as AssistantSpeechProvider, x as useAssistantSpeech };
@@ -0,0 +1,62 @@
1
+ import { FC } from 'react';
2
+ import { AssistantTr } from '../i18n';
3
+ import { SandboxWriteCapabilities, WriteProposalView } from '../writeProposals';
4
+ /**
5
+ * The stronger confirmation for a HIGH-risk write proposal (BOFF-7803 5a,
6
+ * unit FE5; OD-12). It opens only for the dialog kinds — destructive,
7
+ * financial, bulk, permission, credential, irreversible — and every other
8
+ * proposal confirms with the card's single button.
9
+ *
10
+ * ★★ 5a is a safety floor, not the final security boundary. This dialog
11
+ * authorises nothing. Its confirm hands a person's press to the parent, which
12
+ * asks the ISSUING sandbox; the sandbox's store and wspace-sandbox-svc (route
13
+ * policy, live admin re-check, session relay) decide whether anything runs.
14
+ *
15
+ * ★★ What makes it stronger than the card, each one a rule:
16
+ * - Focus starts on Cancel, never on confirm.
17
+ * - Enter makes no decision: on either button it is swallowed, so a key held
18
+ * or repeated from the composer can neither confirm nor cancel.
19
+ * - Confirm is armed only `WRITE_CONFIRM_ARM_MS` after the dialog opens, and
20
+ * counts a trusted activation only (`event.isTrusted`): a click a script
21
+ * dispatched is ignored, however late.
22
+ * - Esc, the overlay and the close button only CLOSE it. The proposal stays
23
+ * pending and the card can open it again; only Cancel declines.
24
+ *
25
+ * ★ Presentational: it shows `view` and nothing else, so what a person
26
+ * confirms is the record's payload, never the model's description of it. The
27
+ * values, masking, countdown and the rule for offering a confirm are the
28
+ * card's own (`writeProposalPresentation`), so the two cannot disagree.
29
+ *
30
+ * ★ Portalled. `ModalShell` renders into `document.body`, outside the panel
31
+ * and outside the `inert` wrapper the voice session puts over the chat, so it
32
+ * stays operable during a live voice session. Its `alertdialog` role is one of
33
+ * the layers the voice session's Escape stands aside for (BOFF-8065).
34
+ */
35
+ /** How long after opening before confirm counts a press. */
36
+ export declare const WRITE_CONFIRM_ARM_MS = 600;
37
+ export interface AssistantWriteConfirmDialogProps {
38
+ /** Whether the dialog is showing. It shows only with a `view` of a dialog kind. */
39
+ open: boolean;
40
+ /** The proposal, as the ISSUING sandbox last reported it. */
41
+ view: WriteProposalView | null;
42
+ /** The issuing sandbox's clock when `view` was read (`list().serverNow`). */
43
+ serverNow: number;
44
+ /** The ISSUING sandbox's `/health` write capabilities; absent = unknown. */
45
+ capabilities: SandboxWriteCapabilities | null | undefined;
46
+ /** A turn is running in this conversation: no decision can be made. */
47
+ turnInFlight: boolean;
48
+ tr: AssistantTr;
49
+ /**
50
+ * Confirm was pressed: armed, trusted, not by Enter. Return the approve
51
+ * call's promise; both buttons stay disabled until it settles.
52
+ */
53
+ onApprove: (surface: "assistant_modal") => void | Promise<unknown>;
54
+ /** Cancel was pressed. Same latch as `onApprove`. */
55
+ onDecline: (reason: "user_declined", surface: "assistant_modal") => void | Promise<unknown>;
56
+ /** The dialog opened on a pending proposal. Once per opening. */
57
+ onPresented: (surface: "modal") => void;
58
+ /** Esc, the overlay or the close button: close only; nothing is declined. */
59
+ onDismiss: () => void;
60
+ }
61
+ export declare const AssistantWriteConfirmDialog: FC<AssistantWriteConfirmDialogProps>;
62
+ //# sourceMappingURL=AssistantWriteConfirmDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssistantWriteConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantWriteConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EACV,wBAAwB,EAExB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAmB3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,4DAA4D;AAC5D,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,MAAM,WAAW,gCAAgC;IAC/C,mFAAmF;IACnF,IAAI,EAAE,OAAO,CAAC;IACd,6DAA6D;IAC7D,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,YAAY,EAAE,wBAAwB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1D,uEAAuE;IACvE,YAAY,EAAE,OAAO,CAAC;IACtB,EAAE,EAAE,WAAW,CAAC;IAChB;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,qDAAqD;IACrD,SAAS,EAAE,CACT,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,iBAAiB,KACvB,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,iEAAiE;IACjE,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,6EAA6E;IAC7E,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAiBD,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,gCAAgC,CAUjC,CAAC"}