@burdenoff/fe-libs 2026.913.1 → 2026.914.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 (67) hide show
  1. package/dist/shared/assistant/conversation.d.ts +29 -0
  2. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  3. package/dist/shared/assistant/displayContent.d.ts +57 -0
  4. package/dist/shared/assistant/displayContent.d.ts.map +1 -0
  5. package/dist/shared/assistant/displayContent.js +26 -0
  6. package/dist/shared/assistant/exportConversation.d.ts +12 -2
  7. package/dist/shared/assistant/exportConversation.d.ts.map +1 -1
  8. package/dist/shared/assistant/exportConversation.js +24 -22
  9. package/dist/shared/assistant/index.d.ts +9 -0
  10. package/dist/shared/assistant/index.d.ts.map +1 -1
  11. package/dist/shared/assistant/legacyFiller.d.ts +60 -0
  12. package/dist/shared/assistant/legacyFiller.d.ts.map +1 -0
  13. package/dist/shared/assistant/legacyFiller.js +35 -0
  14. package/dist/shared/assistant/preview/previewTransitions.d.ts +15 -1
  15. package/dist/shared/assistant/preview/previewTransitions.d.ts.map +1 -1
  16. package/dist/shared/assistant/preview/previewTransitions.js +5 -2
  17. package/dist/shared/assistant/preview/useAssistantPreviewBridge.d.ts.map +1 -1
  18. package/dist/shared/assistant/preview/useAssistantPreviewBridge.js +51 -52
  19. package/dist/shared/assistant/spokenTurns.d.ts +25 -0
  20. package/dist/shared/assistant/spokenTurns.d.ts.map +1 -0
  21. package/dist/shared/assistant/spokenTurns.js +12 -0
  22. package/dist/shared/assistant/stageCopy.d.ts +23 -34
  23. package/dist/shared/assistant/stageCopy.d.ts.map +1 -1
  24. package/dist/shared/assistant/stageCopy.js +7 -16
  25. package/dist/shared/assistant/store.d.ts +10 -2
  26. package/dist/shared/assistant/store.d.ts.map +1 -1
  27. package/dist/shared/assistant/store.js +16 -9
  28. package/dist/shared/assistant/turnActivity.d.ts +66 -0
  29. package/dist/shared/assistant/turnActivity.d.ts.map +1 -0
  30. package/dist/shared/assistant/turnActivity.js +41 -0
  31. package/dist/shared/assistant/turnProgress.d.ts +51 -0
  32. package/dist/shared/assistant/turnProgress.d.ts.map +1 -0
  33. package/dist/shared/assistant/turnProgress.js +27 -0
  34. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  35. package/dist/shared/assistant/ui/AssistantChatArea.js +362 -379
  36. package/dist/shared/assistant/ui/AssistantConversationList.d.ts.map +1 -1
  37. package/dist/shared/assistant/ui/AssistantConversationList.js +81 -80
  38. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +12 -1
  39. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
  40. package/dist/shared/assistant/ui/AssistantMessageItem.js +103 -83
  41. package/dist/shared/assistant/ui/AssistantMessageList.d.ts +7 -1
  42. package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
  43. package/dist/shared/assistant/ui/AssistantMessageList.js +16 -15
  44. package/dist/shared/assistant/ui/AssistantMoreMenu.d.ts.map +1 -1
  45. package/dist/shared/assistant/ui/AssistantMoreMenu.js +23 -20
  46. package/dist/shared/assistant/ui/AssistantTurnActivity.d.ts +37 -0
  47. package/dist/shared/assistant/ui/AssistantTurnActivity.d.ts.map +1 -0
  48. package/dist/shared/assistant/ui/AssistantTurnActivity.js +33 -0
  49. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
  50. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +112 -102
  51. package/dist/shared/assistant/ui/voice/VoiceMiniController.d.ts +10 -0
  52. package/dist/shared/assistant/ui/voice/VoiceMiniController.d.ts.map +1 -1
  53. package/dist/shared/assistant/ui/voice/VoiceMiniController.js +29 -28
  54. package/dist/shared/assistant/ui/voice/VoiceStage.d.ts +10 -0
  55. package/dist/shared/assistant/ui/voice/VoiceStage.d.ts.map +1 -1
  56. package/dist/shared/assistant/ui/voice/VoiceStage.js +35 -34
  57. package/dist/shared/assistant/ui/voice/VoiceStatusText.d.ts +51 -0
  58. package/dist/shared/assistant/ui/voice/VoiceStatusText.d.ts.map +1 -0
  59. package/dist/shared/assistant/ui/voice/VoiceStatusText.js +42 -0
  60. package/dist/shared/assistant/voice/rotationClock.d.ts +31 -0
  61. package/dist/shared/assistant/voice/rotationClock.d.ts.map +1 -0
  62. package/dist/shared/assistant/voice/rotationClock.js +27 -0
  63. package/dist/shared/assistant/voice/voiceStatus.d.ts +81 -0
  64. package/dist/shared/assistant/voice/voiceStatus.d.ts.map +1 -0
  65. package/dist/shared/assistant/voice/voiceStatus.js +33 -0
  66. package/dist/shared-assistant.js +94 -85
  67. package/package.json +1 -1
@@ -5,188 +5,152 @@ import { useAssistantProduct as n } from "../product.js";
5
5
  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
- import { getAssistantMedia as h, sanitize as re } from "../progress.js";
9
- import { streamBudgetMs as ie, withIncompleteTurnNotice as ae } from "../streamBudget.js";
10
- import { isVoiceTurn as g, voiceMarker as _, voiceSessionIdOf as v } from "../voice/turnVisibility.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";
16
- import { findPendingWrite as b } from "../pendingWrite.js";
17
- import { buildPromptParts as fe, buildPromptWithAttachments as pe, countInlineImageCandidates as me, countInlinedImageParts as he, getSendableAttachments as ge, toMessageAttachment as _e } from "../attachments.js";
18
- import { useAssistantStore as x } from "../store.js";
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";
8
+ import { getRawMessageCreatedAt as re, sanitize as ie } from "../progress.js";
9
+ import { streamBudgetMs as ae, withIncompleteTurnNotice as oe } from "../streamBudget.js";
10
+ import { isVoiceTurn as se, voiceMarker as h, voiceSessionIdOf as g } from "../voice/turnVisibility.js";
11
+ import { buildContinuedFromVoiceNote as _, buildVoiceTranscriptMarkdown as ce, voiceTranscriptFilename as v } from "../voice/voiceTranscript.js";
12
+ import { pollDelayMs as le } from "../voice/assistantPollSchedule.js";
13
+ import { toCaptionText as ue } from "../voice/captionText.js";
14
+ import { resolveAssistantLanguage as de } from "../voice/languages.js";
15
+ import { resolveLanguagePair as fe } from "../voice/languagePair.js";
16
+ import { buildPromptParts as pe, buildPromptWithAttachments as me, countInlineImageCandidates as he, countInlinedImageParts as ge, getSendableAttachments as _e, toMessageAttachment as ve } from "../attachments.js";
17
+ import { useAssistantStore as y } from "../store.js";
18
+ import { isTurnInFlight as b, planAbandonedTurn as ye, planTurnAbort as be } from "../turnState.js";
19
+ import { getAssistantDisplayContent as xe } from "../displayContent.js";
20
+ import { buildAssistantProgress as Se } from "../turnProgress.js";
21
+ import { parseToolActivity as Ce } from "./AssistantToolActivity.js";
22
+ import { countSpokenTurns as we, spokenTurnText as Te } from "../spokenTurns.js";
23
+ import { useVoiceSession as Ee } from "./useVoiceSession.js";
24
+ import { getOrganizationId as De, getWorkspaceId as Oe } from "../context.js";
25
+ import { createReadinessTracker as ke } from "../sandboxReadiness.js";
26
+ import { AssistantSpokenTurnsNotice as Ae } from "./AssistantSpokenTurnsNotice.js";
27
+ import { VoiceTranscriptDrawer as je } from "./voice/VoiceTranscriptDrawer.js";
28
+ import { downloadFile as Me } from "../exportConversation.js";
29
+ import { AssistantEmptyState as Ne } from "./AssistantEmptyState.js";
30
+ import { AssistantMessageList as Pe } from "./AssistantMessageList.js";
31
+ import { AssistantVoiceSession as Fe } from "./voice/AssistantVoiceSession.js";
32
+ import { useAssistantApiAccess as Ie } from "../useAssistantApiAccess.js";
33
+ import { useConversationTurns as Le } from "../useConversationTurns.js";
34
+ import { isMultimodalBodyRejection as Re, isRecoverableAssistantError as ze } from "../transportErrors.js";
35
+ import { dispatchAssistantQuotaExhausted as Be, notifyAiCreditsUpdated as Ve } from "../aiCredits.js";
36
+ import { useAssistantAttachments as He } from "../useAssistantAttachments.js";
37
+ import { AssistantComposer as Ue } from "./composer/AssistantComposer.js";
38
+ import { isProdRuntime as We } from "../env.js";
39
+ import { AssistantApiCallsConsentDialog as Ge } from "./AssistantApiCallsConsentDialog.js";
40
+ import { useCallback as x, useEffect as S, useMemo as C, useRef as w, useState as Ke } from "react";
41
+ import { jsx as T, jsxs as qe } from "react/jsx-runtime";
41
42
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
42
- var qe = 600, Je = 2e4;
43
- function Ye() {
43
+ var Je = 600, Ye = 2e4;
44
+ function Xe() {
44
45
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
45
46
  }
46
- function Xe(e) {
47
- return e.info?.time?.created ?? 0;
48
- }
49
- function k(e) {
50
- return (e ?? []).filter((e) => e.type === "text" && typeof e.text == "string").map((e) => e.text?.trim() ?? "").filter(Boolean).join("\n");
51
- }
52
- function A(e) {
53
- return (e ?? []).filter((e) => e.type === "tool" && e.tool).map((e) => {
54
- let t = e.state?.status ?? "running", n = e.tool ?? "tool";
55
- return t === "completed" ? `Completed: ${n}` : t === "failed" ? `Failed: ${n}` : `Running: ${n}`;
56
- });
57
- }
58
- function Ze(e, t) {
59
- let n = e.filter((e) => e.info?.role === "assistant" && Xe(e) > t).sort((e, t) => Xe(e) - Xe(t));
60
- if (n.length === 0) return {
61
- content: S.thinking.fallback,
62
- done: !1
63
- };
64
- let r = n[n.length - 1], i = k(r.parts), a = h(r.parts), o = A(r.parts), s = b(r.parts), c = [
65
- i,
66
- ...a,
67
- ...o
68
- ].filter(Boolean).join("\n\n") || S.thinking.fallback, l = r.info?.providerID, u = r.info?.modelID;
69
- return {
70
- content: c,
71
- done: !!r.info?.time?.completed && (!!i || a.length > 0 || o.length > 0),
72
- tokens: r.info?.tokens,
73
- messageId: r.info?.id,
74
- ...l && u ? { model: `${l}/${u}` } : {},
75
- ...s ? { pendingWrite: s } : {}
76
- };
77
- }
78
- var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
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), [
80
- nt,
47
+ var Ze = ({ visible: Ze = !0, writeAccess: Qe = "unknown" }) => {
48
+ let E = r(), { product: D, modes: O, gatherPageContext: $e, buildPrompt: et, reportTokenUsage: tt } = n(), { getAccessToken: k, getWorkspaceToken: A, userId: j } = t(), { locale: nt } = e(), rt = y((e) => e.assistantLanguage), it = y((e) => e.replyLanguage), at = C(() => fe(rt, it, nt), [
81
49
  rt,
82
- tt
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]);
84
- T(() => {
85
- Et || (!Pt || Pt.requiresAdmin && !Tt) && I !== "assistant" && ut("assistant");
50
+ it,
51
+ nt
52
+ ]), ot = at.reply.english, st = at.replyIsExplicit, ct = at.reply.code, { conversations: lt, activeConversationId: M, mode: N, processingByConversationId: ut, setMode: dt, setConversationMode: ft, setActiveConversation: pt, createConversation: P, addMessage: F, updateMessage: mt, patchMessage: I, mergeMessageMetadata: ht, setConversationProcessing: L, clearConversationProcessing: gt, setBackendSessionId: _t, clearBackendSessionId: vt, setSandbox: R, clearSandbox: yt, acknowledgeApiCalls: bt } = y(), xt = lt.find((e) => e.id === M), z = Le(xt), St = z.all, B = M ? ut[M] : void 0, Ct = b(B?.status), wt = Ct ? B?.messageId ?? null : null, Tt = B?.status === "error" ? B.messageId : null, { canUseApiCalls: Et, loading: Dt } = Ie(De()), Ot = C(() => O.filter((e) => !e.requiresAdmin || Et), [O, Et]), [kt, At] = Ke(null), [jt, V] = Ke(!1), Mt = w({}), H = w(ke()), Nt = w(/* @__PURE__ */ new Set()), U = C(() => O.find((e) => e.id === N), [O, N]);
53
+ S(() => {
54
+ Dt || (!U || U.requiresAdmin && !Et) && N !== "assistant" && dt("assistant");
86
55
  }, [
87
- I,
88
- Pt,
89
- Tt,
56
+ N,
57
+ U,
90
58
  Et,
91
- ut
59
+ Dt,
60
+ dt
92
61
  ]);
93
- let G = w((e, t, n, r) => {
94
- V(e, n, t, null), r ? z(e, t, r) : z(e, t, Se(k, n));
95
- }, [
96
- V,
97
- z,
98
- k
99
- ]), Ft = w(async (e, t, n, r, i) => {
100
- let a = x.getState().sandboxesByMode[n]?.sandboxId ?? null, o = async (e) => {
101
- if (W.current.isFresh(e)) return !0;
62
+ let W = x((e, t, n, r) => {
63
+ L(e, n, t, null, r);
64
+ }, [L]), Pt = x(async (e, t, n, r, i) => {
65
+ let a = y.getState().sandboxesByMode[n]?.sandboxId ?? null, o = async (e) => {
66
+ if (H.current.isFresh(e)) return !0;
102
67
  try {
103
- return await m(e, r, i, 3e5), await p(e, r, i, 9e4), W.current.markVerified(e), !0;
68
+ return await m(e, r, i, 3e5), await p(e, r, i, 9e4), H.current.markVerified(e), !0;
104
69
  } catch {
105
- return W.current.invalidate(e), !1;
70
+ return H.current.invalidate(e), !1;
106
71
  }
107
72
  };
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) {
109
- G(e, t, "provisioning", C(k, S.lookingForEnvironment));
110
- let s = await u(r, A, n, Ue(), i);
111
- s && (H(n, s, "provisioning"), G(e, t, "provisioning", C(k, S.reusingEnvironment)), await o(s) ? a = s : H(n, null, "provisioning"));
73
+ if (a && (R(n, a, "provisioning"), W(e, t, "provisioning", "reusingEnvironment"), await o(a) || (R(n, null, "provisioning"), a = null)), !a) {
74
+ W(e, t, "provisioning", "lookingForEnvironment");
75
+ let s = await u(r, D, n, We(), i);
76
+ s && (R(n, s, "provisioning"), W(e, t, "provisioning", "reusingEnvironment"), await o(s) ? a = s : R(n, null, "provisioning"));
112
77
  }
113
78
  if (!a) {
114
- if (n === "api-calls" && !M()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
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);
79
+ if (n === "api-calls" && !k()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
80
+ W(e, t, "provisioning", "startingEnvironment"), R(n, null, "provisioning"), await f(r, D, n, We(), i), a = await s(D, n, r, We(), Je, i), R(n, a, "provisioning"), await m(a, r, i, 3e5), await p(a, r, i, 9e4);
116
81
  }
117
- H(n, a, "running");
118
- let l = x.getState().conversations.find((t) => t.id === e)?.backendSessionId ?? null;
82
+ R(n, a, "running");
83
+ let l = y.getState().conversations.find((t) => t.id === e)?.backendSessionId ?? null;
119
84
  if (l) try {
120
85
  let e = await d(a, r, l, i);
121
86
  if (e.mode !== n) throw Error(`Session mode mismatch: expected ${n}, received ${e.mode}`);
122
87
  } catch {
123
- gt(e), l = null;
88
+ vt(e), l = null;
124
89
  }
125
- return l || (G(e, t, "connecting", C(k, S.preparingSession)), l = (await c(a, r, n, i)).sessionId, ht(e, l)), {
90
+ return l || (W(e, t, "connecting", "preparingSession"), l = (await c(a, r, n, i)).sessionId, _t(e, l)), {
126
91
  sandboxId: a,
127
92
  sessionId: l
128
93
  };
129
94
  }, [
130
- gt,
131
- M,
132
- A,
133
- ht,
134
- H,
95
+ vt,
135
96
  k,
136
- G
137
- ]), [It, Lt] = Ge(null), K = D(/* @__PURE__ */ new Set()), Rt = D(null), zt = w(() => {
138
- let e = x.getState(), t = e.activeConversationId;
97
+ D,
98
+ _t,
99
+ R,
100
+ W
101
+ ]), [Ft, It] = Ke(null), G = w(/* @__PURE__ */ new Set()), Lt = w(null), Rt = x(() => {
102
+ let e = y.getState(), t = e.activeConversationId;
139
103
  if (!t) return;
140
- let n = e.processingByConversationId[t], r = ve(n?.status) ? n?.messageId ?? null : null;
104
+ let n = e.processingByConversationId[t], r = b(n?.status) ? n?.messageId ?? null : null;
141
105
  if (!be({
142
106
  interruptedTurnId: r,
143
107
  activeTurnId: r,
144
- alreadyRequested: r ? K.current.has(r) : !1
108
+ alreadyRequested: r ? G.current.has(r) : !1
145
109
  }).send || !r) return;
146
- K.current.add(r);
147
- let i = e.sandboxesByMode[e.mode]?.sandboxId, o = De(), s = e.conversations.find((e) => e.id === t)?.backendSessionId;
110
+ G.current.add(r);
111
+ let i = e.sandboxesByMode[e.mode]?.sandboxId, o = Oe(), s = e.conversations.find((e) => e.id === t)?.backendSessionId;
148
112
  !i || !o || !s || a(i, o, s, {
149
- accessToken: M(),
150
- workspaceToken: N(),
151
- userId: P,
152
- organizationId: Ee()
113
+ accessToken: k(),
114
+ workspaceToken: A(),
115
+ userId: j,
116
+ organizationId: De()
153
117
  });
154
118
  }, [
155
- P,
156
- M,
157
- N
158
- ]), Bt = w(async (e) => {
159
- let t = x.getState(), n = t.sandboxesByMode[t.mode]?.sandboxId, r = De(), i = t.activeConversationId;
119
+ j,
120
+ k,
121
+ A
122
+ ]), zt = x(async (e) => {
123
+ let t = y.getState(), n = t.sandboxesByMode[t.mode]?.sandboxId, r = Oe(), i = t.activeConversationId;
160
124
  if (!(!n || !r || !i)) {
161
- Lt(e);
125
+ It(e);
162
126
  try {
163
127
  await o(n, r, e, {
164
- accessToken: M(),
165
- workspaceToken: N(),
166
- userId: P,
167
- organizationId: Ee()
128
+ accessToken: k(),
129
+ workspaceToken: A(),
130
+ userId: j,
131
+ organizationId: De()
168
132
  });
169
133
  } catch (e) {
170
- Lt(null), R(i, {
171
- id: Ye(),
134
+ It(null), F(i, {
135
+ id: Xe(),
172
136
  role: "system",
173
137
  content: e instanceof Error ? e.message : "The change could not be approved.",
174
138
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
175
139
  });
176
140
  return;
177
141
  }
178
- Lt(null), J.current(k("pendingWrite.approvedPrompt", "I approved that change — go ahead."));
142
+ It(null), q.current(E("pendingWrite.approvedPrompt", "I approved that change — go ahead."));
179
143
  }
180
144
  }, [
181
- P,
182
- R,
183
- k
184
- ]), q = w(async (e, t = [], n = {}) => {
185
- let r = n.voiceSessionId !== void 0, a = x.getState(), o = a.activeConversationId ?? F;
145
+ j,
146
+ F,
147
+ E
148
+ ]), K = x(async (e, t = [], n = {}) => {
149
+ let r = n.voiceSessionId !== void 0, a = y.getState(), o = a.activeConversationId ?? M;
186
150
  if (o) {
187
- if (ve(a.processingByConversationId[o]?.status)) {
151
+ if (b(a.processingByConversationId[o]?.status)) {
188
152
  let r = a.processingByConversationId[o]?.messageId ?? null;
189
- r && K.current.has(r) && (Rt.current = {
153
+ r && G.current.has(r) && (Lt.current = {
190
154
  conversationId: o,
191
155
  content: e,
192
156
  attachments: t,
@@ -196,366 +160,385 @@ var j = ({ visible: h = !0, writeAccess: b = "unknown" }) => {
196
160
  }
197
161
  if (Nt.current.has(o)) return;
198
162
  }
199
- let s = a.mode, c = F, u = c ? x.getState().conversations.find((e) => e.id === c) : void 0;
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;
163
+ let s = a.mode, c = M, u = c ? y.getState().conversations.find((e) => e.id === c) : void 0;
164
+ if (c ? u && u.mode !== s && (u.messages.length > 0 || u.backendSessionId) ? c = P(void 0, s) : u && u.mode !== s && ft(c, s) : c = P(void 0, s), !c) return;
201
165
  Mt.current[c] = t;
202
- let d = De(), f = {
203
- accessToken: M(),
204
- workspaceToken: N(),
205
- userId: P,
206
- organizationId: Ee()
166
+ let d = Oe(), f = {
167
+ accessToken: k(),
168
+ workspaceToken: A(),
169
+ userId: j,
170
+ organizationId: De()
207
171
  }, p = {
208
- id: Ye(),
172
+ id: Xe(),
209
173
  role: "user",
210
174
  content: e,
211
175
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
212
176
  metadata: {
213
- ...t.length ? { attachments: t.map(_e) } : {},
214
- ..._(n.voiceSessionId)
177
+ ...t.length ? { attachments: t.map(ve) } : {},
178
+ ...h(n.voiceSessionId)
215
179
  }
216
180
  };
217
- R(c, p);
218
- let m = Ye();
219
- R(c, {
181
+ F(c, p);
182
+ let m = Xe();
183
+ F(c, {
220
184
  id: m,
221
185
  role: "assistant",
222
186
  content: "",
223
187
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
224
188
  metadata: {
225
- lang: st,
226
- ..._(n.voiceSessionId)
189
+ lang: ct,
190
+ ...h(n.voiceSessionId)
227
191
  }
228
- }), V(c, "provisioning", m, null);
229
- let h = (e, t, r, i, a = st) => {
230
- B(c, m, { content: re(e) }), pt(c, m, {
192
+ }), L(c, "provisioning", m, null);
193
+ let se = (e, t, r, i, a = ct) => {
194
+ I(c, m, { content: ie(e) }), ht(c, m, {
231
195
  lang: a,
232
196
  ...t?.length ? { artifacts: t } : {},
233
197
  ...t?.length || r || i ? { mode: s } : {},
234
198
  ...r ? { sessionId: r } : {},
235
199
  ...i ? { sandboxId: i } : {},
236
- ..._(n.voiceSessionId)
200
+ ...h(n.voiceSessionId)
237
201
  });
238
202
  }, g = async (n = 1) => {
239
203
  let i = !1;
240
204
  try {
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);
242
- G(c, m, "streaming", C(k, S.thinking));
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) > _;
205
+ let { sandboxId: n, sessionId: a } = await Pt(c, m, s, d, f), o = (await te(n, d, a, f, { limit: 50 }).catch(() => [])).reduce((e, t) => Math.max(e, re(t)), 0);
206
+ W(c, m, "streaming", "thinking");
207
+ let u = me(e, t), p = et?.(s, u, ot, st, r) ?? u, h = pe(p, t), g = ge(h), _ = g > 0, ce = $e?.();
208
+ i = he(t) > g;
245
209
  try {
246
- await ne(n, d, a, p, s, oe, f, g?.length ? { parts: g } : void 0);
210
+ await ne(n, d, a, p, s, ce, f, h?.length ? { parts: h } : void 0);
247
211
  } catch (e) {
248
- if (!g || !Le(e)) throw e;
249
- await ne(n, d, a, p, s, oe, f, void 0), i ||= v;
212
+ if (!h || !Re(e)) throw e;
213
+ await ne(n, d, a, p, s, ce, f, void 0), i ||= _;
250
214
  }
251
- let y = Ze([], o), se = Date.now() + ie(s), le = Date.now(), ue = Date.now(), de = () => ye({
215
+ let v = Se([], o), ue = Date.now() + ae(s), de = Date.now(), fe = Date.now(), _e = () => ye({
252
216
  turnId: m,
253
- abortRequested: K.current.has(m),
254
- activeTurnId: x.getState().processingByConversationId[c]?.messageId ?? null
255
- }), b = () => {
256
- let e = x.getState().conversations.find((e) => e.id === c)?.messages.find((e) => e.id === m)?.content;
257
- xe(k, e) && z(c, m, C(k, S.stopped));
258
- };
259
- for (; Date.now() < se;) {
260
- let e = de();
217
+ abortRequested: G.current.has(m),
218
+ activeTurnId: y.getState().processingByConversationId[c]?.messageId ?? null
219
+ });
220
+ for (; Date.now() < ue;) {
221
+ let e = _e();
261
222
  if (e.abandon) {
262
- b(), e.clearProcessing && mt(c);
223
+ e.clearProcessing && gt(c);
263
224
  return;
264
225
  }
265
- if (y = Ze(await te(n, d, a, f, {
226
+ if (v = Se(await te(n, d, a, f, {
266
227
  limit: 50,
267
228
  sinceMs: o
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)));
229
+ }), o), I(c, m, { content: ie(v.content) }), v.pendingWrite && ht(c, m, { pendingWrite: v.pendingWrite }), v.done) break;
230
+ Date.now() - de > 3e4 && (await l(n, d, 600, f).catch(() => void 0), de = Date.now()), await new Promise((e) => setTimeout(e, le(Date.now() - fe)));
270
231
  }
271
- let ge = s === "vibe-plugins" ? await ee(n, d, a, f).then((e) => e).catch(() => []) : void 0;
272
- if (y.done || (y = {
273
- ...y,
274
- content: ae(y.content, s, k)
275
- }), i && (y = {
276
- ...y,
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._")}`
278
- }), h(y.content, ge, a, n), y.tokens) {
279
- B(c, m, { tokens: y.tokens });
232
+ let ve = s === "vibe-plugins" ? await ee(n, d, a, f).then((e) => e).catch(() => []) : void 0;
233
+ if (v.done || (v = {
234
+ ...v,
235
+ content: oe(v.content, s, E)
236
+ }), i && (v = {
237
+ ...v,
238
+ content: `${v.content}\n\n${E("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._")}`
239
+ }), se(v.content, ve, a, n), v.tokens) {
240
+ I(c, m, { tokens: v.tokens });
280
241
  try {
281
- await et?.({
242
+ await tt?.({
282
243
  workspaceId: d,
283
244
  sessionId: a,
284
- messageId: y.messageId,
285
- model: y.model,
286
- tokens: y.tokens
287
- }), Be(A);
245
+ messageId: v.messageId,
246
+ model: v.model,
247
+ tokens: v.tokens
248
+ }), Ve(D);
288
249
  } catch {}
289
250
  }
290
- let _e = de();
291
- if (_e.abandon) {
292
- b(), _e.clearProcessing && mt(c);
251
+ let b = _e();
252
+ if (b.abandon) {
253
+ b.clearProcessing && gt(c);
293
254
  return;
294
255
  }
295
- V(c, "complete", m, null);
256
+ L(c, "complete", m, null);
296
257
  } catch (e) {
297
- if (n === 1 && Re(e)) return gt(c), _t(s), g(2);
258
+ let t = ye({
259
+ turnId: m,
260
+ abortRequested: G.current.has(m),
261
+ activeTurnId: y.getState().processingByConversationId[c]?.messageId ?? null
262
+ });
263
+ if (t.abandon) {
264
+ t.clearProcessing && gt(c);
265
+ return;
266
+ }
267
+ if (n === 1 && ze(e)) return vt(c), yt(s), mt(c, m, ""), ht(c, m, { pendingWrite: void 0 }), g(2);
298
268
  throw e;
299
269
  }
300
- }, v = c;
301
- Nt.current.add(v);
270
+ }, _ = c;
271
+ Nt.current.add(_);
302
272
  try {
303
273
  if (!d) throw Error("Assistant backend is unavailable without an active workspace context.");
304
274
  await g();
305
275
  } catch (e) {
306
- W.current.invalidate(x.getState().sandboxesByMode[s]?.sandboxId ?? null);
276
+ H.current.invalidate(y.getState().sandboxesByMode[s]?.sandboxId ?? null);
307
277
  let t = i(e);
308
278
  if (t) {
309
- t.refusal === "exhausted" && ze(A, "sandbox");
279
+ t.refusal === "exhausted" && Be(D, "sandbox");
310
280
  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.";
311
- h(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"), V(c, "error", m, null);
281
+ se(e ? `${n}\n\n${e}` : n, void 0, void 0, void 0, "en"), L(c, "error", m, null);
312
282
  return;
313
283
  }
314
284
  let r = e instanceof Error ? e.message : "Something went wrong";
315
- V(c, "error", m, r), B(c, m, { content: `Sorry, an error occurred: ${r}. Please try again.` }), pt(c, m, {
285
+ L(c, "error", m, r), I(c, m, { content: `Sorry, an error occurred: ${r}. Please try again.` }), ht(c, m, {
316
286
  lang: "en",
317
- ..._(n.voiceSessionId)
287
+ ...h(n.voiceSessionId)
318
288
  });
319
289
  } finally {
320
- Nt.current.delete(v);
321
- let e = Rt.current;
322
- Rt.current = null, e && e.conversationId === v && J.current(e.content, e.attachments, e.options);
290
+ Nt.current.delete(_);
291
+ let e = Lt.current;
292
+ Lt.current = null, e && e.conversationId === _ && q.current(e.content, e.attachments, e.options);
323
293
  }
324
294
  }, [
295
+ M,
325
296
  F,
326
- R,
297
+ et,
298
+ vt,
299
+ yt,
300
+ lt,
301
+ P,
302
+ Pt,
327
303
  $e,
328
- gt,
329
- _t,
330
- ct,
331
- L,
332
- Ft,
333
- Qe,
334
- M,
335
- N,
336
- B,
304
+ k,
337
305
  A,
338
- et,
339
- ot,
306
+ I,
307
+ D,
308
+ tt,
340
309
  st,
341
- at,
342
- ht,
343
- dt,
344
- V,
310
+ ct,
311
+ ot,
312
+ _t,
313
+ ft,
314
+ L,
315
+ gt,
316
+ E,
317
+ W,
345
318
  mt,
346
- k,
347
- G,
348
- z,
349
- P
350
- ]), Vt = w((e) => {
351
- q(e);
352
- }, [q]), Ht = w(() => {
353
- let e = [...U.chat].reverse().find((e) => e.role === "user"), t = F ? Mt.current[F] ?? [] : [];
354
- e && q(e.content, t);
319
+ j
320
+ ]), Bt = x((e) => {
321
+ K(e);
322
+ }, [K]), Vt = x(() => {
323
+ let e = [...z.chat].reverse().find((e) => e.role === "user"), t = M ? Mt.current[M] ?? [] : [];
324
+ e && K(e.content, t);
355
325
  }, [
356
- bt,
357
- q,
358
- F
359
- ]), J = D(q);
360
- T(() => {
361
- J.current = q;
362
- }, [q]);
363
- let Y = E(() => {
364
- if (St) return null;
365
- for (let e = bt.length - 1; e >= 0; --e) {
366
- let t = bt[e];
367
- if (t?.role !== "assistant" || !g(t) || K.current.has(t.id)) continue;
368
- let n = we(t.content).text.trim();
369
- return n ? {
326
+ St,
327
+ K,
328
+ M
329
+ ]), q = w(K);
330
+ S(() => {
331
+ q.current = K;
332
+ }, [K]);
333
+ let J = C(() => {
334
+ if (Ct) return null;
335
+ for (let e = St.length - 1; e >= 0; --e) {
336
+ let t = St[e];
337
+ if (t?.role !== "assistant" || !se(t) || G.current.has(t.id)) continue;
338
+ let n = xe(t, B, E);
339
+ if (n.kind !== "output") return null;
340
+ let r = Ce(n.text).text.trim();
341
+ return r ? {
370
342
  id: t.id,
371
- text: n
343
+ text: r
372
344
  } : null;
373
345
  }
374
346
  return null;
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) => ({
347
+ }, [
348
+ St,
349
+ Ct,
350
+ B,
351
+ E
352
+ ]), Ht = C(() => J ? ue(J.text) : null, [J]), Ut = z.chat, Y = C(() => z.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
376
353
  id: e.id,
377
354
  role: e.role,
378
- text: we(e.content).text.trim(),
379
- sessionId: v(e),
355
+ text: Te(e, B, E),
356
+ sessionId: g(e),
380
357
  timestamp: e.timestamp
381
- })).filter((e) => e.text.length > 0), [U.voice]), Gt = w(() => {
382
- if (X.length === 0) return;
358
+ })).filter((e) => e.text.length > 0), [
359
+ z.voice,
360
+ B,
361
+ E
362
+ ]), Wt = x(() => {
363
+ if (Y.length === 0) return;
383
364
  let e = /* @__PURE__ */ new Date();
384
- je(y(X, {
385
- title: k("voiceSession.transcript", "Voice conversation"),
386
- savedAt: k("voiceSession.savedAt", "Saved"),
387
- session: k("voiceSession.sessionLabel", "Session"),
388
- earlier: k("voiceSession.earlierLabel", "Earlier"),
389
- you: k("voiceSession.speakerYou", "You"),
390
- assistant: k("voiceSession.speakerAssistant", "Assistant")
391
- }, e), se(A, e), "text/markdown");
365
+ Me(ce(Y, {
366
+ title: E("voiceSession.transcript", "Voice conversation"),
367
+ savedAt: E("voiceSession.savedAt", "Saved"),
368
+ session: E("voiceSession.sessionLabel", "Session"),
369
+ earlier: E("voiceSession.earlierLabel", "Earlier"),
370
+ you: E("voiceSession.speakerYou", "You"),
371
+ assistant: E("voiceSession.speakerAssistant", "Assistant")
372
+ }, e), v(D, e), "text/markdown");
392
373
  }, [
393
- A,
394
- X,
395
- k
396
- ]), Z = Ve(), Q = D(Z);
397
- Q.current = Z;
398
- let $ = Te({
399
- onSubmit: w((e, t) => {
374
+ D,
375
+ Y,
376
+ E
377
+ ]), X = He(), Z = w(X);
378
+ Z.current = X;
379
+ let Q = Ee({
380
+ onSubmit: x((e, t) => {
400
381
  let n = () => {
401
- let n = Q.current, r = ge(n.attachments);
402
- J.current(e, r, { voiceSessionId: t }), n.clear();
382
+ let n = Z.current, r = _e(n.attachments);
383
+ q.current(e, r, { voiceSessionId: t }), n.clear();
403
384
  };
404
- if (!Q.current.isBusy) {
385
+ if (!Z.current.isBusy) {
405
386
  n();
406
387
  return;
407
388
  }
408
389
  let r = Date.now(), i = window.setInterval(() => {
409
- Q.current.isBusy && Date.now() - r < Je || (window.clearInterval(i), n());
390
+ Z.current.isBusy && Date.now() - r < Ye || (window.clearInterval(i), n());
410
391
  }, 200);
411
392
  }, []),
412
- latestReply: Y,
413
- language: ue(nt, tt).tag
414
- }), Kt = E(() => (yt?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [yt?.messages]), qt = X.length > Kt, Jt = w(() => {
415
- let e = x.getState().activeConversationId;
416
- !e || X.length === 0 || (R(e, {
417
- id: Ye(),
393
+ latestReply: J,
394
+ language: de(rt, nt).tag
395
+ }), Gt = C(() => (xt?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [xt?.messages]), $ = we(z.voice, B, E), Kt = $ > Gt, qt = x(() => {
396
+ let e = y.getState().activeConversationId;
397
+ !e || Y.length === 0 || (F(e, {
398
+ id: Xe(),
418
399
  role: "system",
419
- content: oe(X.slice(Kt), {
420
- intro: k("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
421
- nothing: k("voiceSession.continuedNothing", "Continued from a voice conversation."),
422
- more: (e) => k("voiceSession.continuedMore", "…and {{count}} more", { count: e })
400
+ content: _(Y.slice(Gt), {
401
+ intro: E("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
402
+ nothing: E("voiceSession.continuedNothing", "Continued from a voice conversation."),
403
+ more: (e) => E("voiceSession.continuedMore", "…and {{count}} more", { count: e })
423
404
  }),
424
405
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
425
- metadata: { continuedVoiceTurns: X.length }
426
- }), jt(!1), $.end());
406
+ metadata: { continuedVoiceTurns: $ }
407
+ }), V(!1), Q.end());
427
408
  }, [
428
- X,
429
- Kt,
430
- R,
431
- k,
432
- $
433
- ]), Yt = D(0);
434
- T(() => {
435
- $.active && (Yt.current = X.length);
436
- }, [$.active]);
437
- let Xt = w(() => {
438
- let e = X.length > Yt.current;
439
- $.end(), e && jt(!0);
440
- }, [X, $]);
441
- T(() => {
442
- !h && $.active && $.end();
443
- }, [h, $]), T(() => {
444
- $.active || (Q.current.clear(), Rt.current = null);
445
- }, [$.active]), T(() => {
446
- let e = x.getState().consumePendingPrompt();
447
- return e && J.current(e), x.subscribe((e, t) => {
409
+ Y,
410
+ $,
411
+ Gt,
412
+ F,
413
+ E,
414
+ Q
415
+ ]), Jt = w(0);
416
+ S(() => {
417
+ Q.active && (Jt.current = $);
418
+ }, [Q.active]);
419
+ let Yt = x(() => {
420
+ let e = $ > Jt.current;
421
+ Q.end(), e && V(!0);
422
+ }, [$, Q]);
423
+ S(() => {
424
+ !Ze && Q.active && Q.end();
425
+ }, [Ze, Q]), S(() => {
426
+ Q.active || (Z.current.clear(), Lt.current = null);
427
+ }, [Q.active]), S(() => {
428
+ let e = y.getState().consumePendingPrompt();
429
+ return e && q.current(e), y.subscribe((e, t) => {
448
430
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
449
- let e = x.getState().consumePendingPrompt();
450
- e && J.current(e);
431
+ let e = y.getState().consumePendingPrompt();
432
+ e && q.current(e);
451
433
  }
452
434
  });
453
435
  }, []);
454
- let Zt = w((e) => {
455
- let t = F ? x.getState().conversations.find((e) => e.id === F) : void 0;
436
+ let Xt = x((e) => {
437
+ let t = M ? y.getState().conversations.find((e) => e.id === M) : void 0;
456
438
  if (t && (t.messages.length > 0 || t.backendSessionId)) {
457
439
  if (t.mode !== e) {
458
- let t = x.getState().conversations.find((t) => t.mode === e && t.messages.length === 0 && !t.backendSessionId && !x.getState().processingByConversationId[t.id]);
459
- t ? ft(t.id) : L(void 0, e);
440
+ let t = y.getState().conversations.find((t) => t.mode === e && t.messages.length === 0 && !t.backendSessionId && !y.getState().processingByConversationId[t.id]);
441
+ t ? pt(t.id) : P(void 0, e);
460
442
  }
461
- } else F && dt(F, e);
462
- ut(e);
443
+ } else M && ft(M, e);
444
+ dt(e);
463
445
  }, [
464
- F,
465
- L,
446
+ M,
447
+ P,
448
+ pt,
466
449
  ft,
467
- dt,
468
- ut
469
- ]), Qt = w((e) => {
470
- if (j.find((t) => t.id === e)?.writeCapable && !x.getState().apiCallsAcknowledged) {
471
- kt(e);
450
+ dt
451
+ ]), Zt = x((e) => {
452
+ if (O.find((t) => t.id === e)?.writeCapable && !y.getState().apiCallsAcknowledged) {
453
+ At(e);
472
454
  return;
473
455
  }
474
- Zt(e);
475
- }, [Zt, j]), $t = w(() => {
476
- let e = Ot;
477
- kt(null), vt(), e && Zt(e);
456
+ Xt(e);
457
+ }, [Xt, O]), Qt = x(() => {
458
+ let e = kt;
459
+ At(null), bt(), e && Xt(e);
478
460
  }, [
479
- Ot,
480
- vt,
481
- Zt
482
- ]), en = w(() => {
483
- kt(null);
461
+ kt,
462
+ bt,
463
+ Xt
464
+ ]), $t = x(() => {
465
+ At(null);
484
466
  }, []);
485
- return /* @__PURE__ */ Ke("div", {
467
+ return /* @__PURE__ */ qe("div", {
486
468
  className: "relative flex flex-1 flex-col overflow-hidden",
487
469
  children: [
488
- /* @__PURE__ */ Ke("div", {
470
+ /* @__PURE__ */ qe("div", {
489
471
  className: "contents",
490
- inert: $.active || void 0,
472
+ inert: Q.active || void 0,
491
473
  children: [
492
- X.length > 0 && !$.active ? /* @__PURE__ */ O(ke, {
493
- count: X.length,
494
- onOpenTranscript: () => jt(!0)
474
+ Y.length > 0 && !Q.active ? /* @__PURE__ */ T(Ae, {
475
+ count: Y.length,
476
+ onOpenTranscript: () => V(!0)
495
477
  }) : null,
496
- Wt.length === 0 ? /* @__PURE__ */ O(Me, {
497
- mode: I,
498
- onSuggestionClick: Vt
499
- }) : /* @__PURE__ */ O("div", {
478
+ Ut.length === 0 ? /* @__PURE__ */ T(Ne, {
479
+ mode: N,
480
+ onSuggestionClick: Bt
481
+ }) : /* @__PURE__ */ T("div", {
500
482
  className: "flex min-h-0 flex-1 flex-col",
501
- children: /* @__PURE__ */ O(Ne, {
502
- onApprovePendingWrite: Bt,
503
- approvingWriteRef: It,
504
- messages: Wt,
505
- streamingMessageId: Ct,
506
- failedMessageId: wt,
507
- onRetry: Ht
483
+ children: /* @__PURE__ */ T(Pe, {
484
+ onApprovePendingWrite: zt,
485
+ approvingWriteRef: Ft,
486
+ messages: Ut,
487
+ processing: B ?? null,
488
+ streamingMessageId: wt,
489
+ failedMessageId: Tt,
490
+ onRetry: Vt
508
491
  })
509
492
  }),
510
- /* @__PURE__ */ O(He, {
511
- onStartVoiceSession: $.available && I !== "api-calls" ? $.start : void 0,
512
- onSend: (e, t) => void q(e, t),
513
- disabled: St,
514
- placeholder: I === "api-calls" ? k("chatArea.placeholderActions", "What would you like me to do?") : k("chatArea.placeholderGeneral", "Ask me anything…"),
515
- mode: I,
516
- writeAccessDenied: b === "denied" && !!Pt?.writeCapable,
517
- availableModes: Dt,
518
- onModeChange: Qt
493
+ /* @__PURE__ */ T(Ue, {
494
+ onStartVoiceSession: Q.available && N !== "api-calls" ? Q.start : void 0,
495
+ onSend: (e, t) => void K(e, t),
496
+ disabled: Ct,
497
+ placeholder: N === "api-calls" ? E("chatArea.placeholderActions", "What would you like me to do?") : E("chatArea.placeholderGeneral", "Ask me anything…"),
498
+ mode: N,
499
+ writeAccessDenied: Qe === "denied" && !!U?.writeCapable,
500
+ availableModes: Ot,
501
+ onModeChange: Zt
519
502
  })
520
503
  ]
521
504
  }),
522
- At && !$.active ? /* @__PURE__ */ O(Ae, {
523
- turns: X,
524
- onClose: () => jt(!1),
525
- onSave: Gt,
526
- onContinueInChat: qt ? Jt : void 0,
505
+ jt && !Q.active ? /* @__PURE__ */ T(je, {
506
+ turns: Y,
507
+ onClose: () => V(!1),
508
+ onSave: Wt,
509
+ onContinueInChat: Kt ? qt : void 0,
527
510
  closeOnEscape: !0
528
511
  }) : null,
529
- $.active && /* @__PURE__ */ O(Pe, {
530
- session: $.session,
531
- notice: $.notice,
532
- capturing: $.capturing,
533
- interrupting: $.interrupting,
534
- awaitingEndpoint: $.awaitingEndpoint,
535
- turns: X,
536
- spokenChunks: $.spokenChunks,
537
- attachments: Z.attachments,
538
- onAttachFiles: Z.addFiles,
539
- onRemoveAttachment: Z.remove,
540
- onRetryAttachment: Z.retry,
541
- canAttachMore: Z.canAddMore,
542
- preparingAttachments: Z.preparingCount,
543
- onSaveTranscript: Gt,
544
- onContinueInChat: Jt,
512
+ Q.active && /* @__PURE__ */ T(Fe, {
513
+ session: Q.session,
514
+ notice: Q.notice,
515
+ capturing: Q.capturing,
516
+ interrupting: Q.interrupting,
517
+ awaitingEndpoint: Q.awaitingEndpoint,
518
+ turns: Y,
519
+ spokenChunks: Q.spokenChunks,
520
+ attachments: X.attachments,
521
+ onAttachFiles: X.addFiles,
522
+ onRemoveAttachment: X.remove,
523
+ onRetryAttachment: X.retry,
524
+ canAttachMore: X.canAddMore,
525
+ preparingAttachments: X.preparingCount,
526
+ onSaveTranscript: Wt,
527
+ onContinueInChat: qt,
545
528
  onInterrupt: () => {
546
- $.interrupt(), zt();
529
+ Q.interrupt(), Rt();
547
530
  },
548
- spoken: Ut,
549
- onToggleMute: $.toggleMute,
550
- onEnd: Xt
531
+ spoken: Ht,
532
+ onToggleMute: Q.toggleMute,
533
+ onEnd: Yt
551
534
  }),
552
- /* @__PURE__ */ O(We, {
553
- open: Ot !== null,
554
- onConfirm: $t,
555
- onCancel: en
535
+ /* @__PURE__ */ T(Ge, {
536
+ open: kt !== null,
537
+ onConfirm: Qt,
538
+ onCancel: $t
556
539
  })
557
540
  ]
558
541
  });
559
542
  };
560
543
  //#endregion
561
- export { j as AssistantChatArea };
544
+ export { Ze as AssistantChatArea };