@burdenoff/fe-libs 2026.912.4 → 2026.912.6

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.
@@ -6,44 +6,40 @@ import { useAssistantTr as r } from "../i18n.js";
6
6
  import { describeQuotaError as i } from "../quota.js";
7
7
  import { abortAssistantTurn as a, approvePendingWrite as o, createAssistantSandbox as s, createAssistantSession as c, extendAssistantSandboxTTL as l, findExistingSandbox as u, getAssistantArtifacts as ee, getAssistantMessages as te, getAssistantSession as d, releaseSupersededAssistantSandboxes as f, sendAssistantPromptAsync as ne, waitForAssistantServiceReady as p, waitForSandboxRunning as m } from "../api.js";
8
8
  import { getAssistantMedia as h, sanitize as re } from "../progress.js";
9
+ import { streamBudgetMs as ie, withIncompleteTurnNotice as ae } from "../streamBudget.js";
9
10
  import { isVoiceTurn as g, voiceMarker as _, voiceSessionIdOf as v } from "../voice/turnVisibility.js";
10
- import { buildContinuedFromVoiceNote as ie, buildVoiceTranscriptMarkdown as y, voiceTranscriptFilename as ae } from "../voice/voiceTranscript.js";
11
- import { pollDelayMs as oe } from "../voice/assistantPollSchedule.js";
12
- import { toCaptionText as se } from "../voice/captionText.js";
13
- import { resolveAssistantLanguage as ce } from "../voice/languages.js";
14
- import { resolveLanguagePair as le } from "../voice/languagePair.js";
11
+ import { buildContinuedFromVoiceNote as oe, buildVoiceTranscriptMarkdown as y, voiceTranscriptFilename as se } from "../voice/voiceTranscript.js";
12
+ import { pollDelayMs as ce } from "../voice/assistantPollSchedule.js";
13
+ import { toCaptionText as le } from "../voice/captionText.js";
14
+ import { resolveAssistantLanguage as ue } from "../voice/languages.js";
15
+ import { resolveLanguagePair as de } from "../voice/languagePair.js";
15
16
  import { findPendingWrite as b } from "../pendingWrite.js";
16
- import { buildPromptParts as ue, buildPromptWithAttachments as de, countInlineImageCandidates as fe, countInlinedImageParts as pe, getSendableAttachments as me, toMessageAttachment as he } from "../attachments.js";
17
+ import { buildPromptParts as fe, buildPromptWithAttachments as pe, countInlineImageCandidates as me, countInlinedImageParts as he, getSendableAttachments as ge, toMessageAttachment as _e } from "../attachments.js";
17
18
  import { useAssistantStore as x } from "../store.js";
18
- import { isTurnInFlight as ge, planAbandonedTurn as _e, planTurnAbort as ve } from "../turnState.js";
19
- import { STAGE_COPY as S, isStageCopy as ye, stageText as C, statusStageCopy as be, thinkingPhrase as xe } from "../stageCopy.js";
20
- import { parseToolActivity as Se } from "./AssistantToolActivity.js";
21
- import { useVoiceSession as Ce } from "./useVoiceSession.js";
22
- import { getOrganizationId as we, getWorkspaceId as Te } from "../context.js";
23
- import { createReadinessTracker as Ee } from "../sandboxReadiness.js";
24
- import { AssistantSpokenTurnsNotice as De } from "./AssistantSpokenTurnsNotice.js";
25
- import { VoiceTranscriptDrawer as Oe } from "./voice/VoiceTranscriptDrawer.js";
26
- import { downloadFile as ke } from "../exportConversation.js";
27
- import { AssistantEmptyState as Ae } from "./AssistantEmptyState.js";
28
- import { AssistantMessageList as je } from "./AssistantMessageList.js";
29
- import { AssistantVoiceSession as Me } from "./voice/AssistantVoiceSession.js";
30
- import { useAssistantApiAccess as Ne } from "../useAssistantApiAccess.js";
31
- import { useConversationTurns as Pe } from "../useConversationTurns.js";
32
- import { isMultimodalBodyRejection as Fe, isRecoverableAssistantError as Ie } from "../transportErrors.js";
33
- import { dispatchAssistantQuotaExhausted as Le, notifyAiCreditsUpdated as Re } from "../aiCredits.js";
34
- import { useAssistantAttachments as ze } from "../useAssistantAttachments.js";
35
- import { AssistantComposer as Be } from "./composer/AssistantComposer.js";
36
- import { isProdRuntime as Ve } from "../env.js";
37
- import { AssistantApiCallsConsentDialog as He } from "./AssistantApiCallsConsentDialog.js";
38
- import { useCallback as w, useEffect as T, useMemo as E, useRef as D, useState as Ue } from "react";
39
- import { jsx as O, jsxs as We } from "react/jsx-runtime";
19
+ import { isTurnInFlight as ve, planAbandonedTurn as ye, planTurnAbort as be } from "../turnState.js";
20
+ import { STAGE_COPY as S, isStageCopy as xe, stageText as C, statusStageCopy as Se, thinkingPhrase as Ce } from "../stageCopy.js";
21
+ import { parseToolActivity as we } from "./AssistantToolActivity.js";
22
+ import { useVoiceSession as Te } from "./useVoiceSession.js";
23
+ import { getOrganizationId as Ee, getWorkspaceId as De } from "../context.js";
24
+ import { createReadinessTracker as Oe } from "../sandboxReadiness.js";
25
+ import { AssistantSpokenTurnsNotice as ke } from "./AssistantSpokenTurnsNotice.js";
26
+ import { VoiceTranscriptDrawer as Ae } from "./voice/VoiceTranscriptDrawer.js";
27
+ import { downloadFile as je } from "../exportConversation.js";
28
+ import { AssistantEmptyState as Me } from "./AssistantEmptyState.js";
29
+ import { AssistantMessageList as Ne } from "./AssistantMessageList.js";
30
+ import { AssistantVoiceSession as Pe } from "./voice/AssistantVoiceSession.js";
31
+ import { useAssistantApiAccess as Fe } from "../useAssistantApiAccess.js";
32
+ import { useConversationTurns as Ie } from "../useConversationTurns.js";
33
+ import { isMultimodalBodyRejection as Le, isRecoverableAssistantError as Re } from "../transportErrors.js";
34
+ import { dispatchAssistantQuotaExhausted as ze, notifyAiCreditsUpdated as Be } from "../aiCredits.js";
35
+ import { useAssistantAttachments as Ve } from "../useAssistantAttachments.js";
36
+ import { AssistantComposer as He } from "./composer/AssistantComposer.js";
37
+ import { isProdRuntime as Ue } from "../env.js";
38
+ import { AssistantApiCallsConsentDialog as We } from "./AssistantApiCallsConsentDialog.js";
39
+ import { useCallback as w, useEffect as T, useMemo as E, useRef as D, useState as Ge } from "react";
40
+ import { jsx as O, jsxs as Ke } from "react/jsx-runtime";
40
41
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
41
- var Ge = {
42
- general: 18e4,
43
- assistant: 18e4,
44
- "api-calls": 18e4,
45
- "vibe-plugins": 6e5
46
- }, Ke = 18e4, qe = 600, Je = 2e4;
42
+ var qe = 600, Je = 2e4;
47
43
  function Ye() {
48
44
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
49
45
  }
@@ -80,11 +76,11 @@ function Ze(e, t) {
80
76
  };
81
77
  }
82
78
  var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
83
- let k = r(), { product: A, modes: j, gatherPageContext: Qe, buildPrompt: $e, reportTokenUsage: et } = n(), { getAccessToken: M, getWorkspaceToken: N, userId: P } = t(), { locale: tt } = e(), nt = x((e) => e.assistantLanguage), rt = x((e) => e.replyLanguage), it = E(() => le(nt, rt, tt), [
79
+ let k = r(), { product: A, modes: j, gatherPageContext: Qe, buildPrompt: $e, reportTokenUsage: et } = n(), { getAccessToken: M, getWorkspaceToken: N, userId: P } = t(), { locale: tt } = e(), nt = x((e) => e.assistantLanguage), rt = x((e) => e.replyLanguage), it = E(() => de(nt, rt, tt), [
84
80
  nt,
85
81
  rt,
86
82
  tt
87
- ]), at = it.reply.english, ot = it.replyIsExplicit, st = it.reply.code, { conversations: ct, activeConversationId: F, mode: I, processingByConversationId: lt, setMode: ut, setConversationMode: dt, setActiveConversation: ft, createConversation: L, addMessage: R, updateMessage: z, patchMessage: B, mergeMessageMetadata: pt, setConversationProcessing: V, clearConversationProcessing: mt, setBackendSessionId: ht, clearBackendSessionId: gt, setSandbox: H, clearSandbox: _t, acknowledgeApiCalls: vt } = x(), yt = ct.find((e) => e.id === F), U = Pe(yt), bt = U.all, xt = F ? lt[F] : void 0, St = ge(xt?.status), Ct = St ? xt?.messageId ?? null : null, wt = xt?.status === "error" ? xt.messageId : null, { canUseApiCalls: Tt, loading: Et } = Ne(we()), Dt = E(() => j.filter((e) => !e.requiresAdmin || Tt), [j, Tt]), [Ot, kt] = Ue(null), [At, W] = Ue(!1), jt = D({}), Mt = D(Ee()), Nt = D(/* @__PURE__ */ new Set()), Pt = E(() => j.find((e) => e.id === I), [j, I]);
83
+ ]), at = it.reply.english, ot = it.replyIsExplicit, st = it.reply.code, { conversations: ct, activeConversationId: F, mode: I, processingByConversationId: lt, setMode: ut, setConversationMode: dt, setActiveConversation: ft, createConversation: L, addMessage: R, updateMessage: z, patchMessage: B, mergeMessageMetadata: pt, setConversationProcessing: V, clearConversationProcessing: mt, setBackendSessionId: ht, clearBackendSessionId: gt, setSandbox: H, clearSandbox: _t, acknowledgeApiCalls: vt } = x(), yt = ct.find((e) => e.id === F), U = Ie(yt), bt = U.all, xt = F ? lt[F] : void 0, St = ve(xt?.status), Ct = St ? xt?.messageId ?? null : null, wt = xt?.status === "error" ? xt.messageId : null, { canUseApiCalls: Tt, loading: Et } = Fe(Ee()), Dt = E(() => j.filter((e) => !e.requiresAdmin || Tt), [j, Tt]), [Ot, kt] = Ge(null), [At, jt] = Ge(!1), Mt = D({}), W = D(Oe()), Nt = D(/* @__PURE__ */ new Set()), Pt = E(() => j.find((e) => e.id === I), [j, I]);
88
84
  T(() => {
89
85
  Et || (!Pt || Pt.requiresAdmin && !Tt) && I !== "assistant" && ut("assistant");
90
86
  }, [
@@ -95,28 +91,28 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
95
91
  ut
96
92
  ]);
97
93
  let G = w((e, t, n, r) => {
98
- V(e, n, t, null), r ? z(e, t, r) : z(e, t, be(k, n));
94
+ V(e, n, t, null), r ? z(e, t, r) : z(e, t, Se(k, n));
99
95
  }, [
100
96
  V,
101
97
  z,
102
98
  k
103
99
  ]), Ft = w(async (e, t, n, r, i) => {
104
100
  let a = x.getState().sandboxesByMode[n]?.sandboxId ?? null, o = async (e) => {
105
- if (Mt.current.isFresh(e)) return !0;
101
+ if (W.current.isFresh(e)) return !0;
106
102
  try {
107
- return await m(e, r, i, 3e5), await p(e, r, i, 9e4), Mt.current.markVerified(e), !0;
103
+ return await m(e, r, i, 3e5), await p(e, r, i, 9e4), W.current.markVerified(e), !0;
108
104
  } catch {
109
- return Mt.current.invalidate(e), !1;
105
+ return W.current.invalidate(e), !1;
110
106
  }
111
107
  };
112
108
  if (a && (H(n, a, "provisioning"), G(e, t, "provisioning", C(k, S.reusingEnvironment)), await o(a) || (H(n, null, "provisioning"), a = null)), !a) {
113
109
  G(e, t, "provisioning", C(k, S.lookingForEnvironment));
114
- let s = await u(r, A, n, Ve(), i);
110
+ let s = await u(r, A, n, Ue(), i);
115
111
  s && (H(n, s, "provisioning"), G(e, t, "provisioning", C(k, S.reusingEnvironment)), await o(s) ? a = s : H(n, null, "provisioning"));
116
112
  }
117
113
  if (!a) {
118
114
  if (n === "api-calls" && !M()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
119
- G(e, t, "provisioning", C(k, S.startingEnvironment)), H(n, null, "provisioning"), await f(r, A, n, Ve(), i), a = await s(A, n, r, Ve(), qe, i), H(n, a, "provisioning"), await m(a, r, i, 3e5), await p(a, r, i, 9e4);
115
+ G(e, t, "provisioning", C(k, S.startingEnvironment)), H(n, null, "provisioning"), await f(r, A, n, Ue(), i), a = await s(A, n, r, Ue(), qe, i), H(n, a, "provisioning"), await m(a, r, i, 3e5), await p(a, r, i, 9e4);
120
116
  }
121
117
  H(n, a, "running");
122
118
  let l = x.getState().conversations.find((t) => t.id === e)?.backendSessionId ?? null;
@@ -138,29 +134,29 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
138
134
  H,
139
135
  k,
140
136
  G
141
- ]), [It, Lt] = Ue(null), K = D(/* @__PURE__ */ new Set()), Rt = D(null), zt = w(() => {
137
+ ]), [It, Lt] = Ge(null), K = D(/* @__PURE__ */ new Set()), Rt = D(null), zt = w(() => {
142
138
  let e = x.getState(), t = e.activeConversationId;
143
139
  if (!t) return;
144
- let n = e.processingByConversationId[t], r = ge(n?.status) ? n?.messageId ?? null : null;
145
- if (!ve({
140
+ let n = e.processingByConversationId[t], r = ve(n?.status) ? n?.messageId ?? null : null;
141
+ if (!be({
146
142
  interruptedTurnId: r,
147
143
  activeTurnId: r,
148
144
  alreadyRequested: r ? K.current.has(r) : !1
149
145
  }).send || !r) return;
150
146
  K.current.add(r);
151
- let i = e.sandboxesByMode[e.mode]?.sandboxId, o = Te(), s = e.conversations.find((e) => e.id === t)?.backendSessionId;
147
+ let i = e.sandboxesByMode[e.mode]?.sandboxId, o = De(), s = e.conversations.find((e) => e.id === t)?.backendSessionId;
152
148
  !i || !o || !s || a(i, o, s, {
153
149
  accessToken: M(),
154
150
  workspaceToken: N(),
155
151
  userId: P,
156
- organizationId: we()
152
+ organizationId: Ee()
157
153
  });
158
154
  }, [
159
155
  P,
160
156
  M,
161
157
  N
162
158
  ]), Bt = w(async (e) => {
163
- let t = x.getState(), n = t.sandboxesByMode[t.mode]?.sandboxId, r = Te(), i = t.activeConversationId;
159
+ let t = x.getState(), n = t.sandboxesByMode[t.mode]?.sandboxId, r = De(), i = t.activeConversationId;
164
160
  if (!(!n || !r || !i)) {
165
161
  Lt(e);
166
162
  try {
@@ -168,7 +164,7 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
168
164
  accessToken: M(),
169
165
  workspaceToken: N(),
170
166
  userId: P,
171
- organizationId: we()
167
+ organizationId: Ee()
172
168
  });
173
169
  } catch (e) {
174
170
  Lt(null), R(i, {
@@ -188,7 +184,7 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
188
184
  ]), q = w(async (e, t = [], n = {}) => {
189
185
  let r = n.voiceSessionId !== void 0, a = x.getState(), o = a.activeConversationId ?? F;
190
186
  if (o) {
191
- if (ge(a.processingByConversationId[o]?.status)) {
187
+ if (ve(a.processingByConversationId[o]?.status)) {
192
188
  let r = a.processingByConversationId[o]?.messageId ?? null;
193
189
  r && K.current.has(r) && (Rt.current = {
194
190
  conversationId: o,
@@ -202,19 +198,19 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
202
198
  }
203
199
  let s = a.mode, c = F, u = c ? x.getState().conversations.find((e) => e.id === c) : void 0;
204
200
  if (c ? u && u.mode !== s && (u.messages.length > 0 || u.backendSessionId) ? c = L(void 0, s) : u && u.mode !== s && dt(c, s) : c = L(void 0, s), !c) return;
205
- jt.current[c] = t;
206
- let d = Te(), f = {
201
+ Mt.current[c] = t;
202
+ let d = De(), f = {
207
203
  accessToken: M(),
208
204
  workspaceToken: N(),
209
205
  userId: P,
210
- organizationId: we()
206
+ organizationId: Ee()
211
207
  }, p = {
212
208
  id: Ye(),
213
209
  role: "user",
214
210
  content: e,
215
211
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
216
212
  metadata: {
217
- ...t.length ? { attachments: t.map(he) } : {},
213
+ ...t.length ? { attachments: t.map(_e) } : {},
218
214
  ..._(n.voiceSessionId)
219
215
  }
220
216
  };
@@ -244,24 +240,24 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
244
240
  try {
245
241
  let { sandboxId: n, sessionId: a } = await Ft(c, m, s, d, f), o = (await te(n, d, a, f, { limit: 50 }).catch(() => [])).reduce((e, t) => Math.max(e, Xe(t)), 0);
246
242
  G(c, m, "streaming", C(k, S.thinking));
247
- let u = de(e, t), p = $e?.(s, u, at, ot, r) ?? u, g = ue(p, t), _ = pe(g), v = _ > 0, ie = Qe?.();
248
- i = fe(t) > _;
243
+ let u = pe(e, t), p = $e?.(s, u, at, ot, r) ?? u, g = fe(p, t), _ = he(g), v = _ > 0, oe = Qe?.();
244
+ i = me(t) > _;
249
245
  try {
250
- await ne(n, d, a, p, s, ie, f, g?.length ? { parts: g } : void 0);
246
+ await ne(n, d, a, p, s, oe, f, g?.length ? { parts: g } : void 0);
251
247
  } catch (e) {
252
- if (!g || !Fe(e)) throw e;
253
- await ne(n, d, a, p, s, ie, f, void 0), i ||= v;
248
+ if (!g || !Le(e)) throw e;
249
+ await ne(n, d, a, p, s, oe, f, void 0), i ||= v;
254
250
  }
255
- let y = Ze([], o), ae = Date.now() + (Ge[s] ?? Ke), se = Date.now(), ce = Date.now(), le = () => _e({
251
+ let y = Ze([], o), se = Date.now() + ie(s), le = Date.now(), ue = Date.now(), de = () => ye({
256
252
  turnId: m,
257
253
  abortRequested: K.current.has(m),
258
254
  activeTurnId: x.getState().processingByConversationId[c]?.messageId ?? null
259
255
  }), b = () => {
260
256
  let e = x.getState().conversations.find((e) => e.id === c)?.messages.find((e) => e.id === m)?.content;
261
- ye(k, e) && z(c, m, C(k, S.stopped));
257
+ xe(k, e) && z(c, m, C(k, S.stopped));
262
258
  };
263
- for (; Date.now() < ae;) {
264
- let e = le();
259
+ for (; Date.now() < se;) {
260
+ let e = de();
265
261
  if (e.abandon) {
266
262
  b(), e.clearProcessing && mt(c);
267
263
  return;
@@ -269,18 +265,17 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
269
265
  if (y = Ze(await te(n, d, a, f, {
270
266
  limit: 50,
271
267
  sinceMs: o
272
- }), o), B(c, m, { content: ye(k, y.content) ? xe(k, Date.now() - ce) : re(y.content) }), y.pendingWrite && pt(c, m, { pendingWrite: y.pendingWrite }), y.done) break;
273
- Date.now() - se > 3e4 && (await l(n, d, 600, f).catch(() => void 0), se = Date.now()), await new Promise((e) => setTimeout(e, oe(Date.now() - ce)));
268
+ }), o), B(c, m, { content: xe(k, y.content) ? Ce(k, Date.now() - ue) : re(y.content) }), y.pendingWrite && pt(c, m, { pendingWrite: y.pendingWrite }), y.done) break;
269
+ Date.now() - le > 3e4 && (await l(n, d, 600, f).catch(() => void 0), le = Date.now()), await new Promise((e) => setTimeout(e, ce(Date.now() - ue)));
274
270
  }
275
- if (!y.done && s !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
276
- let me = s === "vibe-plugins" ? await ee(n, d, a, f).then((e) => e).catch(() => []) : void 0;
271
+ let ge = s === "vibe-plugins" ? await ee(n, d, a, f).then((e) => e).catch(() => []) : void 0;
277
272
  if (y.done || (y = {
278
273
  ...y,
279
- content: `${y.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
274
+ content: ae(y.content, s, k)
280
275
  }), i && (y = {
281
276
  ...y,
282
277
  content: `${y.content}\n\n${k("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
283
- }), h(y.content, me, a, n), y.tokens) {
278
+ }), h(y.content, ge, a, n), y.tokens) {
284
279
  B(c, m, { tokens: y.tokens });
285
280
  try {
286
281
  await et?.({
@@ -289,17 +284,17 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
289
284
  messageId: y.messageId,
290
285
  model: y.model,
291
286
  tokens: y.tokens
292
- }), Re(A);
287
+ }), Be(A);
293
288
  } catch {}
294
289
  }
295
- let he = le();
296
- if (he.abandon) {
297
- b(), he.clearProcessing && mt(c);
290
+ let _e = de();
291
+ if (_e.abandon) {
292
+ b(), _e.clearProcessing && mt(c);
298
293
  return;
299
294
  }
300
295
  V(c, "complete", m, null);
301
296
  } catch (e) {
302
- if (n === 1 && Ie(e)) return gt(c), _t(s), g(2);
297
+ if (n === 1 && Re(e)) return gt(c), _t(s), g(2);
303
298
  throw e;
304
299
  }
305
300
  }, v = c;
@@ -308,10 +303,10 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
308
303
  if (!d) throw Error("Assistant backend is unavailable without an active workspace context.");
309
304
  await g();
310
305
  } catch (e) {
311
- Mt.current.invalidate(x.getState().sandboxesByMode[s]?.sandboxId ?? null);
306
+ W.current.invalidate(x.getState().sandboxesByMode[s]?.sandboxId ?? null);
312
307
  let t = i(e);
313
308
  if (t) {
314
- t.refusal === "exhausted" && Le(A, "sandbox");
309
+ t.refusal === "exhausted" && ze(A, "sandbox");
315
310
  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.";
316
311
  h(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"), V(c, "error", m, null);
317
312
  return;
@@ -355,7 +350,7 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
355
350
  ]), Vt = w((e) => {
356
351
  q(e);
357
352
  }, [q]), Ht = w(() => {
358
- let e = [...U.chat].reverse().find((e) => e.role === "user"), t = F ? jt.current[F] ?? [] : [];
353
+ let e = [...U.chat].reverse().find((e) => e.role === "user"), t = F ? Mt.current[F] ?? [] : [];
359
354
  e && q(e.content, t);
360
355
  }, [
361
356
  bt,
@@ -370,40 +365,40 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
370
365
  for (let e = bt.length - 1; e >= 0; --e) {
371
366
  let t = bt[e];
372
367
  if (t?.role !== "assistant" || !g(t) || K.current.has(t.id)) continue;
373
- let n = Se(t.content).text.trim();
368
+ let n = we(t.content).text.trim();
374
369
  return n ? {
375
370
  id: t.id,
376
371
  text: n
377
372
  } : null;
378
373
  }
379
374
  return null;
380
- }, [bt, St]), Ut = E(() => Y ? se(Y.text) : null, [Y]), Wt = U.chat, X = E(() => U.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
375
+ }, [bt, St]), Ut = E(() => Y ? le(Y.text) : null, [Y]), Wt = U.chat, X = E(() => U.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
381
376
  id: e.id,
382
377
  role: e.role,
383
- text: Se(e.content).text.trim(),
378
+ text: we(e.content).text.trim(),
384
379
  sessionId: v(e),
385
380
  timestamp: e.timestamp
386
381
  })).filter((e) => e.text.length > 0), [U.voice]), Gt = w(() => {
387
382
  if (X.length === 0) return;
388
383
  let e = /* @__PURE__ */ new Date();
389
- ke(y(X, {
384
+ je(y(X, {
390
385
  title: k("voiceSession.transcript", "Voice conversation"),
391
386
  savedAt: k("voiceSession.savedAt", "Saved"),
392
387
  session: k("voiceSession.sessionLabel", "Session"),
393
388
  earlier: k("voiceSession.earlierLabel", "Earlier"),
394
389
  you: k("voiceSession.speakerYou", "You"),
395
390
  assistant: k("voiceSession.speakerAssistant", "Assistant")
396
- }, e), ae(A, e), "text/markdown");
391
+ }, e), se(A, e), "text/markdown");
397
392
  }, [
398
393
  A,
399
394
  X,
400
395
  k
401
- ]), Z = ze(), Q = D(Z);
396
+ ]), Z = Ve(), Q = D(Z);
402
397
  Q.current = Z;
403
- let $ = Ce({
398
+ let $ = Te({
404
399
  onSubmit: w((e, t) => {
405
400
  let n = () => {
406
- let n = Q.current, r = me(n.attachments);
401
+ let n = Q.current, r = ge(n.attachments);
407
402
  J.current(e, r, { voiceSessionId: t }), n.clear();
408
403
  };
409
404
  if (!Q.current.isBusy) {
@@ -415,20 +410,20 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
415
410
  }, 200);
416
411
  }, []),
417
412
  latestReply: Y,
418
- language: ce(nt, tt).tag
413
+ language: ue(nt, tt).tag
419
414
  }), Kt = E(() => (yt?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [yt?.messages]), qt = X.length > Kt, Jt = w(() => {
420
415
  let e = x.getState().activeConversationId;
421
416
  !e || X.length === 0 || (R(e, {
422
417
  id: Ye(),
423
418
  role: "system",
424
- content: ie(X.slice(Kt), {
419
+ content: oe(X.slice(Kt), {
425
420
  intro: k("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
426
421
  nothing: k("voiceSession.continuedNothing", "Continued from a voice conversation."),
427
422
  more: (e) => k("voiceSession.continuedMore", "…and {{count}} more", { count: e })
428
423
  }),
429
424
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
430
425
  metadata: { continuedVoiceTurns: X.length }
431
- }), W(!1), $.end());
426
+ }), jt(!1), $.end());
432
427
  }, [
433
428
  X,
434
429
  Kt,
@@ -441,7 +436,7 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
441
436
  }, [$.active]);
442
437
  let Xt = w(() => {
443
438
  let e = X.length > Yt.current;
444
- $.end(), e && W(!0);
439
+ $.end(), e && jt(!0);
445
440
  }, [X, $]);
446
441
  T(() => {
447
442
  !h && $.active && $.end();
@@ -487,23 +482,23 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
487
482
  ]), en = w(() => {
488
483
  kt(null);
489
484
  }, []);
490
- return /* @__PURE__ */ We("div", {
485
+ return /* @__PURE__ */ Ke("div", {
491
486
  className: "relative flex flex-1 flex-col overflow-hidden",
492
487
  children: [
493
- /* @__PURE__ */ We("div", {
488
+ /* @__PURE__ */ Ke("div", {
494
489
  className: "contents",
495
490
  inert: $.active || void 0,
496
491
  children: [
497
- X.length > 0 && !$.active ? /* @__PURE__ */ O(De, {
492
+ X.length > 0 && !$.active ? /* @__PURE__ */ O(ke, {
498
493
  count: X.length,
499
- onOpenTranscript: () => W(!0)
494
+ onOpenTranscript: () => jt(!0)
500
495
  }) : null,
501
- Wt.length === 0 ? /* @__PURE__ */ O(Ae, {
496
+ Wt.length === 0 ? /* @__PURE__ */ O(Me, {
502
497
  mode: I,
503
498
  onSuggestionClick: Vt
504
499
  }) : /* @__PURE__ */ O("div", {
505
500
  className: "flex min-h-0 flex-1 flex-col",
506
- children: /* @__PURE__ */ O(je, {
501
+ children: /* @__PURE__ */ O(Ne, {
507
502
  onApprovePendingWrite: Bt,
508
503
  approvingWriteRef: It,
509
504
  messages: Wt,
@@ -512,7 +507,7 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
512
507
  onRetry: Ht
513
508
  })
514
509
  }),
515
- /* @__PURE__ */ O(Be, {
510
+ /* @__PURE__ */ O(He, {
516
511
  onStartVoiceSession: $.available && I !== "api-calls" ? $.start : void 0,
517
512
  onSend: (e, t) => void q(e, t),
518
513
  disabled: St,
@@ -524,14 +519,14 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
524
519
  })
525
520
  ]
526
521
  }),
527
- At && !$.active ? /* @__PURE__ */ O(Oe, {
522
+ At && !$.active ? /* @__PURE__ */ O(Ae, {
528
523
  turns: X,
529
- onClose: () => W(!1),
524
+ onClose: () => jt(!1),
530
525
  onSave: Gt,
531
526
  onContinueInChat: qt ? Jt : void 0,
532
527
  closeOnEscape: !0
533
528
  }) : null,
534
- $.active && /* @__PURE__ */ O(Me, {
529
+ $.active && /* @__PURE__ */ O(Pe, {
535
530
  session: $.session,
536
531
  notice: $.notice,
537
532
  capturing: $.capturing,
@@ -554,7 +549,7 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
554
549
  onToggleMute: $.toggleMute,
555
550
  onEnd: Xt
556
551
  }),
557
- /* @__PURE__ */ O(He, {
552
+ /* @__PURE__ */ O(We, {
558
553
  open: Ot !== null,
559
554
  onConfirm: $t,
560
555
  onCancel: en