@burdenoff/fe-libs 2026.926.1 → 2026.926.3

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 (33) hide show
  1. package/dist/shared/assistant/capabilities.d.ts +5 -0
  2. package/dist/shared/assistant/capabilities.d.ts.map +1 -1
  3. package/dist/shared/assistant/capabilities.js +2 -1
  4. package/dist/shared/assistant/index.d.ts +2 -0
  5. package/dist/shared/assistant/index.d.ts.map +1 -1
  6. package/dist/shared/assistant/operations.d.ts +7 -0
  7. package/dist/shared/assistant/operations.d.ts.map +1 -1
  8. package/dist/shared/assistant/operations.js +2 -2
  9. package/dist/shared/assistant/prewarm.d.ts +32 -4
  10. package/dist/shared/assistant/prewarm.d.ts.map +1 -1
  11. package/dist/shared/assistant/prewarm.js +35 -15
  12. package/dist/shared/assistant/product.d.ts +11 -1
  13. package/dist/shared/assistant/product.d.ts.map +1 -1
  14. package/dist/shared/assistant/product.js +8 -6
  15. package/dist/shared/assistant/turnProgress.d.ts +56 -2
  16. package/dist/shared/assistant/turnProgress.d.ts.map +1 -1
  17. package/dist/shared/assistant/turnProgress.js +23 -12
  18. package/dist/shared/assistant/turnTimeline.d.ts +37 -3
  19. package/dist/shared/assistant/turnTimeline.d.ts.map +1 -1
  20. package/dist/shared/assistant/turnTimeline.js +45 -33
  21. package/dist/shared/assistant/turnTimingReport.d.ts +86 -0
  22. package/dist/shared/assistant/turnTimingReport.d.ts.map +1 -0
  23. package/dist/shared/assistant/turnTimingReport.js +123 -0
  24. package/dist/shared/assistant/turnTimingReporter.d.ts +146 -0
  25. package/dist/shared/assistant/turnTimingReporter.d.ts.map +1 -0
  26. package/dist/shared/assistant/turnTimingReporter.js +321 -0
  27. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  28. package/dist/shared/assistant/ui/AssistantChatArea.js +510 -482
  29. package/dist/shared/graphql/fetch.d.ts +10 -0
  30. package/dist/shared/graphql/fetch.d.ts.map +1 -1
  31. package/dist/shared/graphql/fetch.js +64 -62
  32. package/dist/shared-assistant.js +133 -131
  33. package/package.json +2 -2
@@ -6,7 +6,7 @@ import { useAssistantProduct as r } from "../product.js";
6
6
  import { useAssistantTr as i } from "../i18n.js";
7
7
  import { useAssistantNavigate as a } from "./AssistantMarkdownRenderer.js";
8
8
  import { isAssistantModeId as o } from "../modeIds.js";
9
- import { abortAssistantTurn as s, approvePendingWrite as c, createAssistantSandbox as l, createAssistantSession as u, extendAssistantSandboxTTL as d, findExistingSandboxWithStatus as f, getAssistantArtifacts as p, getAssistantMessages as ee, getAssistantSession as m, modeRequiresConfirmWrites as te, promptGatewayRequestBytes as ne, releaseSupersededAssistantSandboxes as h, sendAssistantPromptAsync as re, waitForAssistantServiceReady as g, waitForSandboxRunning as _ } from "../api.js";
9
+ import { abortAssistantTurn as s, approvePendingWrite as c, createAssistantSandbox as l, createAssistantSession as u, extendAssistantSandboxTTL as ee, findExistingSandboxWithStatus as d, getAssistantArtifacts as f, getAssistantMessages as p, getAssistantSession as m, modeRequiresConfirmWrites as te, promptGatewayRequestBytes as ne, releaseSupersededAssistantSandboxes as re, sendAssistantPromptAsync as h, waitForAssistantServiceReady as g, waitForSandboxRunning as _ } from "../api.js";
10
10
  import { sanitize as ie } from "../progress.js";
11
11
  import { withIncompleteTurnNotice as ae } from "../streamBudget.js";
12
12
  import { isVoiceTurn as oe, voiceMarker as v, voiceSessionIdOf as y } from "../voice/turnVisibility.js";
@@ -16,7 +16,7 @@ import { toCaptionText as ue } from "../voice/captionText.js";
16
16
  import { resolveAssistantLanguage as de } from "../voice/languages.js";
17
17
  import { resolveLanguagePair as fe } from "../voice/languagePair.js";
18
18
  import { countInlineImageCandidates as pe, countInlinedImageParts as me, getSendableAttachments as he, largestInlineCharsPerFile as ge, resolveAssistantInlineLimits as _e, toMessageAttachment as ve } from "../attachments.js";
19
- import { AssistantSendRefusal as ye, classifyTurnFailure as x, turnOutcomeCopy as be } from "../turnOutcome.js";
19
+ import { AssistantSendRefusal as ye, classifyTurnFailure as be, turnOutcomeCopy as x } from "../turnOutcome.js";
20
20
  import { createAdminModeAccessGate as xe, resolveAssistantSendModeAfterAccess as Se } from "../adminModeSendGate.js";
21
21
  import { buildBoundedAttachmentTurn as Ce } from "../attachmentTurn.js";
22
22
  import { isWriteModeAcknowledged as we, writeModeSendRefusalReason as Te } from "../writeModeConsent.js";
@@ -24,329 +24,357 @@ import { AUTO_READ_MODE as Ee, autoCarryOverFor as De, autoSuggestions as Oe, cl
24
24
  import { resolveActiveModeSandbox as Ne, useAssistantStore as S } from "../store.js";
25
25
  import { isTurnInFlight as Pe, planAbandonedTurn as Fe, planTurnAbort as Ie } from "../turnState.js";
26
26
  import { getAssistantDisplayContent as Le } from "../displayContent.js";
27
- import { NO_FIRST_TEXT as Re, buildAssistantProgress as ze, snapshotReplyFloor as Be, trackFirstText as Ve } from "../turnProgress.js";
28
- import { parseToolActivity as He } from "./AssistantToolActivity.js";
29
- import { countSpokenTurns as Ue, spokenTurnText as We } from "../spokenTurns.js";
30
- import { beginTurn as Ge, describeTurn as C, detectTurnDevice as Ke, markTurn as w, restartAttempt as qe, turnClockMs as Je } from "../turnTimeline.js";
31
- import { useAssistantSpeech as Ye } from "./AssistantSpeechProvider.js";
32
- import { useVoiceSession as Xe } from "./useVoiceSession.js";
33
- import { getOrganizationId as Ze, getWorkspaceId as Qe } from "../context.js";
34
- import { isMultimodalBodyRejection as $e, isRecoverableAssistantError as et } from "../transportErrors.js";
35
- import { createReadinessTracker as tt, planAfterTransportFailure as nt, planTrustedSandboxFailure as rt } from "../sandboxReadiness.js";
36
- import { AssistantSpokenTurnsNotice as it } from "./AssistantSpokenTurnsNotice.js";
37
- import { VoiceTranscriptDrawer as at } from "./voice/VoiceTranscriptDrawer.js";
38
- import { downloadFile as ot } from "../exportConversation.js";
39
- import { AssistantEmptyState as st } from "./AssistantEmptyState.js";
40
- import { AssistantMessageList as ct } from "./AssistantMessageList.js";
41
- import { AssistantVoiceSession as lt } from "./voice/AssistantVoiceSession.js";
42
- import { useAssistantApiAccess as ut } from "../useAssistantApiAccess.js";
43
- import { useConversationTurns as dt } from "../useConversationTurns.js";
44
- import { WarmCancelled as ft, consumeWarm as pt, prewarmTarget as mt, settleWarmBeforeSend as ht, startWarm as gt, warmState as _t } from "../prewarm.js";
45
- import { isAlreadyThere as vt, matchLocalUiCommand as yt, navDestinations as bt, planThemeChange as xt } from "../localUiCommands.js";
46
- import { chooseDestinationCopy as St, navigationCommandCopy as Ct, themeCommandCopy as wt } from "../localUiCommandCopy.js";
47
- import { dispatchAssistantQuotaExhausted as Tt, notifyAiCreditsUpdated as Et } from "../aiCredits.js";
48
- import { useAssistantAttachments as Dt } from "../useAssistantAttachments.js";
49
- import { AssistantComposer as Ot } from "./composer/AssistantComposer.js";
50
- import { isProdRuntime as kt } from "../env.js";
51
- import { AssistantApiCallsConsentDialog as At } from "./AssistantApiCallsConsentDialog.js";
52
- import { useVisibleNavItems as jt } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
53
- import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as Mt } from "react";
54
- import { jsx as k, jsxs as Nt } from "react/jsx-runtime";
27
+ import { NO_FIRST_TEXT as Re, buildAssistantProgress as ze, readAheadFor as Be, snapshotReplyFloor as Ve, startSessionReadAhead as He, trackFirstText as Ue } from "../turnProgress.js";
28
+ import { parseToolActivity as We } from "./AssistantToolActivity.js";
29
+ import { countSpokenTurns as Ge, spokenTurnText as Ke } from "../spokenTurns.js";
30
+ import { beginTurn as qe, describeTurn as C, detectTurnDevice as Je, markTurn as w, restartAttempt as Ye, turnClockMs as Xe } from "../turnTimeline.js";
31
+ import { useAssistantSpeech as Ze } from "./AssistantSpeechProvider.js";
32
+ import { useVoiceSession as Qe } from "./useVoiceSession.js";
33
+ import { getOrganizationId as $e, getWorkspaceId as T } from "../context.js";
34
+ import { isMultimodalBodyRejection as et, isRecoverableAssistantError as tt } from "../transportErrors.js";
35
+ import { createReadinessTracker as nt, planAfterTransportFailure as rt, planTrustedSandboxFailure as it } from "../sandboxReadiness.js";
36
+ import { AssistantSpokenTurnsNotice as at } from "./AssistantSpokenTurnsNotice.js";
37
+ import { VoiceTranscriptDrawer as ot } from "./voice/VoiceTranscriptDrawer.js";
38
+ import { downloadFile as st } from "../exportConversation.js";
39
+ import { AssistantEmptyState as ct } from "./AssistantEmptyState.js";
40
+ import { AssistantMessageList as lt } from "./AssistantMessageList.js";
41
+ import { AssistantVoiceSession as ut } from "./voice/AssistantVoiceSession.js";
42
+ import { useAssistantApiAccess as dt } from "../useAssistantApiAccess.js";
43
+ import { useConversationTurns as ft } from "../useConversationTurns.js";
44
+ import { sendAssistantTurnTimings as pt, startTurnTimingReporting as mt } from "../turnTimingReporter.js";
45
+ import { WarmCancelled as ht, consumeWarm as gt, prewarmTarget as _t, settleWarmBeforeSend as vt, startWarm as yt, warmState as bt } from "../prewarm.js";
46
+ import { isAlreadyThere as xt, matchLocalUiCommand as St, navDestinations as Ct, planThemeChange as wt } from "../localUiCommands.js";
47
+ import { chooseDestinationCopy as Tt, navigationCommandCopy as Et, themeCommandCopy as Dt } from "../localUiCommandCopy.js";
48
+ import { dispatchAssistantQuotaExhausted as Ot, notifyAiCreditsUpdated as kt } from "../aiCredits.js";
49
+ import { useAssistantAttachments as At } from "../useAssistantAttachments.js";
50
+ import { AssistantComposer as jt } from "./composer/AssistantComposer.js";
51
+ import { isProdRuntime as Mt } from "../env.js";
52
+ import { AssistantApiCallsConsentDialog as Nt } from "./AssistantApiCallsConsentDialog.js";
53
+ import { useVisibleNavItems as Pt } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
54
+ import { useCallback as E, useEffect as D, useMemo as O, useRef as k, useState as Ft } from "react";
55
+ import { jsx as A, jsxs as It } from "react/jsx-runtime";
55
56
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
56
- var Pt = 600, Ft = 2e4;
57
- function It() {
57
+ var Lt = 600, Rt = 2e4;
58
+ function zt() {
58
59
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
59
60
  }
60
- var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
61
- let A = i(), { product: j, modes: M, gatherPageContext: zt, buildPrompt: Bt, reportTokenUsage: Vt, localUiCommands: Ht } = r(), { getAccessToken: N, getWorkspaceToken: P, userId: F } = n(), { locale: I } = t(), Ut = S((e) => e.assistantLanguage), Wt = S((e) => e.replyLanguage), Gt = D(() => fe(Ut, Wt, I), [
62
- Ut,
63
- Wt,
64
- I
65
- ]), Kt = Gt.reply.english, qt = Gt.replyIsExplicit, Jt = Gt.reply.code, { conversations: Yt, activeConversationId: L, mode: R, processingByConversationId: Xt, setMode: z, setConversationMode: Zt, setActiveConversation: Qt, createConversation: B, addMessage: V, updateMessage: $t, patchMessage: en, mergeMessageMetadata: tn, setConversationProcessing: nn, clearConversationProcessing: rn, setBackendSessionId: an, clearBackendSessionId: on, setSandbox: H, clearSandbox: U, acknowledgedWriteModes: sn, acknowledgeWriteMode: cn, autoRouting: ln, setAutoRouting: un, routeConversation: dn } = S(), fn = Yt.find((e) => e.id === L), pn = dt(fn), mn = pn.all, W = L ? Xt[L] : void 0, hn = Pe(W?.status), gn = hn ? W?.messageId ?? null : null, _n = W?.status === "error" ? W.messageId : null, { canUseApiCalls: vn, loading: yn } = ut(Ze()), G = O(xe({
66
- loading: yn,
67
- canUseAdminModes: vn
68
- })).current, bn = O(M);
69
- E(() => {
70
- bn.current = M;
71
- }, [M]), E(() => {
72
- G.update({
73
- loading: yn,
74
- canUseAdminModes: vn
61
+ var Bt = ({ visible: Bt = !0, writeAccess: Vt = "unknown" }) => {
62
+ let j = i(), { product: M, modes: N, gatherPageContext: Ht, buildPrompt: Ut, reportTurnTimings: Wt, reportTokenUsage: Gt, localUiCommands: Kt } = r(), { getAccessToken: P, getWorkspaceToken: qt, userId: F } = n(), { locale: Jt } = t(), Yt = S((e) => e.assistantLanguage), Xt = S((e) => e.replyLanguage), Zt = O(() => fe(Yt, Xt, Jt), [
63
+ Yt,
64
+ Xt,
65
+ Jt
66
+ ]), Qt = Zt.reply.english, $t = Zt.replyIsExplicit, en = Zt.reply.code, { conversations: tn, activeConversationId: I, mode: L, processingByConversationId: nn, setMode: R, setConversationMode: rn, setActiveConversation: an, createConversation: z, addMessage: B, updateMessage: on, patchMessage: sn, mergeMessageMetadata: cn, setConversationProcessing: ln, clearConversationProcessing: un, setBackendSessionId: dn, clearBackendSessionId: fn, setSandbox: V, clearSandbox: H, acknowledgedWriteModes: pn, acknowledgeWriteMode: mn, autoRouting: hn, setAutoRouting: gn, routeConversation: U } = S(), _n = tn.find((e) => e.id === I), vn = ft(_n), yn = vn.all, W = I ? nn[I] : void 0, bn = Pe(W?.status), xn = bn ? W?.messageId ?? null : null, Sn = W?.status === "error" ? W.messageId : null, { canUseApiCalls: G, loading: Cn } = dt($e()), K = k(xe({
67
+ loading: Cn,
68
+ canUseAdminModes: G
69
+ })).current, wn = k(N);
70
+ D(() => {
71
+ wn.current = N;
72
+ }, [N]);
73
+ let Tn = k(P);
74
+ D(() => {
75
+ Tn.current = P;
76
+ }, [P]);
77
+ let En = !!M && Wt !== !1;
78
+ D(() => {
79
+ if (En) return mt({ send: (e) => pt(e, {
80
+ workspaceId: T(),
81
+ authContext: {
82
+ accessToken: Tn.current(),
83
+ organizationId: $e()
84
+ }
85
+ }) });
86
+ }, [En]), D(() => {
87
+ K.update({
88
+ loading: Cn,
89
+ canUseAdminModes: G
75
90
  });
76
91
  }, [
77
- G,
78
- yn,
79
- vn
80
- ]), E(() => () => {
81
- G.abandon();
82
- }, [G]);
83
- let xn = D(() => M.filter((e) => !e.requiresAdmin || vn), [M, vn]), Sn = je(xn), Cn = ln && Sn, wn = O(Sn);
84
- E(() => {
85
- wn.current = Sn;
86
- }, [Sn]);
87
- let Tn = O(null), En = ge(M), [Dn, On] = Mt(null), [kn, An] = Mt(!1), jn = O({}), K = O(tt()), q = O(/* @__PURE__ */ new Set()), Mn = O(/* @__PURE__ */ new Set()), J = D(() => M.find((e) => e.id === R), [M, R]), Nn = R === "assistant" || J !== void 0 && !J.writeCapable && !te(R);
88
- E(() => {
89
- if (R !== "assistant" && J?.writeCapable && !we(sn, R)) {
90
- z("assistant");
92
+ K,
93
+ Cn,
94
+ G
95
+ ]), D(() => () => {
96
+ K.abandon();
97
+ }, [K]);
98
+ let Dn = O(() => N.filter((e) => !e.requiresAdmin || G), [N, G]), On = je(Dn), kn = hn && On, An = k(On);
99
+ D(() => {
100
+ An.current = On;
101
+ }, [On]);
102
+ let jn = k(null), Mn = ge(N), [Nn, Pn] = Ft(null), [Fn, In] = Ft(!1), Ln = k({}), q = k(nt()), J = k(/* @__PURE__ */ new Set()), Rn = k(/* @__PURE__ */ new Set()), Y = O(() => N.find((e) => e.id === L), [N, L]), zn = L === "assistant" || Y !== void 0 && !Y.writeCapable && !te(L);
103
+ D(() => {
104
+ if (L !== "assistant" && Y?.writeCapable && !we(pn, L)) {
105
+ R("assistant");
91
106
  return;
92
107
  }
93
- yn || (!J || J.requiresAdmin && !vn) && R !== "assistant" && z("assistant");
108
+ Cn || (!Y || Y.requiresAdmin && !G) && L !== "assistant" && R("assistant");
94
109
  }, [
110
+ L,
111
+ Y,
112
+ G,
113
+ Cn,
95
114
  R,
96
- J,
97
- vn,
98
- yn,
99
- z,
100
- sn
115
+ pn
101
116
  ]);
102
- let Y = T((e, t, n, r) => {
103
- nn(e, n, t, null, r);
104
- }, [nn]), Pn = T(async (e, t, n, r, i, a = null) => {
117
+ let Bn = E((e, t, n, r) => {
118
+ ln(e, n, t, null, r);
119
+ }, [ln]), Vn = E(async (e, t, n, r, i, a = null) => {
105
120
  let s = (e, t) => {
106
- r && Y(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
121
+ r && Bn(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
107
122
  }, c = (e) => {
108
123
  r && w(r.assistantMessageId, e);
109
- }, u = () => a !== null && (a.signal.aborted || Qe() !== t), d = () => {
110
- if (u()) throw new ft("cancelled");
111
- }, p = S.getState().sandboxesByMode[e]?.sandboxId ?? null, ee = !1, m = !1, te = !1, ne = !1, re = !1, ie = async (r) => {
112
- if (i && !q.current.has(r) && K.current.isFresh(r)) return ee = !0, !0;
113
- te = !0;
124
+ }, u = () => {
125
+ c("bootAdopted"), a?.beginBoot();
126
+ }, ee = () => a !== null && (a.signal.aborted || T() !== t), f = () => {
127
+ if (ee()) throw new ht("cancelled");
128
+ }, p = S.getState().sandboxesByMode[e]?.sandboxId ?? null, m = !1, te = !1, ne = !1, h = !1, ie = !1, ae = async (r) => {
129
+ if (i && !J.current.has(r) && q.current.isFresh(r)) return m = !0, !0;
130
+ ne = !0;
114
131
  let o = !1;
115
132
  try {
116
133
  await _(r, t, n, 3e5), await g(r, t, e, n, 9e4, () => {
117
- o = !0;
134
+ o = !0, u();
118
135
  });
119
136
  } catch {
120
- if (u()) throw new ft("cancelled");
121
- return K.current.invalidate(r), q.current.add(r), a?.dead.push(r), re = !0, !1;
137
+ if (ee()) throw new ht("cancelled");
138
+ return q.current.invalidate(r), J.current.add(r), a?.dead.push(r), ie = !0, !1;
122
139
  }
123
- return d(), K.current.markVerified(r), o && (ne = !0), !0;
140
+ return f(), q.current.markVerified(r), o && (h = !0), !0;
124
141
  };
125
- if (p && (H(e, p, "provisioning"), s("provisioning", "reusingEnvironment"), await ie(p) || (H(e, null, "provisioning"), p = null)), !p) {
142
+ if (p && (V(e, p, "provisioning"), s("provisioning", "reusingEnvironment"), await ae(p) || (V(e, null, "provisioning"), p = null)), !p) {
126
143
  s("provisioning", "lookingForEnvironment");
127
- let r = await f(t, j, e, kt(), n, q.current);
128
- d();
144
+ let r = await d(t, M, e, Mt(), n, J.current);
145
+ f();
129
146
  let i = r?.id ?? null;
130
- i && (H(e, i, "provisioning"), s("provisioning", "reusingEnvironment"), await ie(i) ? (p = i, (r?.status === "PROVISIONING" || r?.status === "PENDING") && (ne = !0)) : H(e, null, "provisioning"));
147
+ if (i) {
148
+ V(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
149
+ let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
150
+ t && u(), await ae(i) ? (p = i, t && (h = !0)) : V(e, null, "provisioning");
151
+ }
131
152
  }
132
153
  if (!p) {
133
- if (a && !a.mayCreate) throw new ft("no-create");
134
- if (c("provisionStarted"), e === "api-calls" && !N()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
135
- s("provisioning", "startingEnvironment"), H(e, null, "provisioning");
136
- let r = a ? [] : await h(t, j, e, kt(), n, q.current);
154
+ if (a && !a.mayCreate) throw new ht("no-create");
155
+ if (c("provisionStarted"), e === "api-calls" && !P()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
156
+ s("provisioning", "startingEnvironment"), V(e, null, "provisioning");
157
+ let r = a ? [] : await re(t, M, e, Mt(), n, J.current);
137
158
  if (r.length > 0) {
138
159
  let e = new Set(r);
139
- for (let e of r) K.current.invalidate(e), q.current.add(e);
160
+ for (let e of r) q.current.invalidate(e), J.current.add(e);
140
161
  let t = S.getState().sandboxesByMode;
141
- for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && U(n);
162
+ for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && H(n);
142
163
  }
143
164
  c("createRequested");
144
165
  let i = a?.beginCreate();
145
166
  try {
146
- p = await l(j, e, t, kt(), Pt, n);
167
+ p = await l(M, e, t, Mt(), Lt, n);
147
168
  } finally {
148
169
  i?.();
149
170
  }
150
- m = !0, d(), H(e, p, "provisioning"), await _(p, t, n, 3e5), d(), c("sandboxRunning"), await g(p, t, e, n, 9e4), d(), c("serviceReady"), K.current.markVerified(p);
171
+ te = !0, f(), V(e, p, "provisioning"), await _(p, t, n, 3e5), f(), c("sandboxRunning"), await g(p, t, e, n, 9e4), f(), c("serviceReady"), q.current.markVerified(p);
151
172
  }
152
- return H(e, p, "running"), {
173
+ return V(e, p, "running"), {
153
174
  sandboxId: p,
154
- sandboxIsNew: m,
155
- sandboxProbed: te,
156
- sandboxAdopted: ne,
157
- deadSandboxProbe: re,
158
- trustedFromCache: ee
175
+ sandboxIsNew: te,
176
+ sandboxProbed: ne,
177
+ sandboxAdopted: h,
178
+ deadSandboxProbe: ie,
179
+ trustedFromCache: m
159
180
  };
160
181
  }, [
161
- U,
162
- N,
163
- j,
164
182
  H,
165
- Y
166
- ]), Fn = T(async function e(t, n, r, i, a, o = {}) {
167
- let s = await ht(i, r, (e) => Y(t, n, "provisioning", e));
168
- for (let e of s.dead) K.current.invalidate(e), q.current.add(e);
169
- s.verified && !q.current.has(s.verified) && K.current.markVerified(s.verified), s.joined && C(n, { prewarm: s.joined });
170
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: d, sandboxAdopted: p, deadSandboxProbe: ee, trustedFromCache: te } = await Pn(r, i, a, {
183
+ P,
184
+ M,
185
+ V,
186
+ Bn
187
+ ]), Hn = E(async function e(t, n, r, i, a, o = {}) {
188
+ let s = await vt(i, r, (e) => Bn(t, n, "provisioning", e), () => w(n, "prewarmJoined"));
189
+ for (let e of s.dead) q.current.invalidate(e), J.current.add(e);
190
+ s.verified && !J.current.has(s.verified) && q.current.markVerified(s.verified), s.joined && C(n, { prewarm: s.joined });
191
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: ee, sandboxAdopted: f, deadSandboxProbe: te, trustedFromCache: ne } = await Vn(r, i, a, {
171
192
  conversationId: t,
172
193
  assistantMessageId: n
173
- }, o.trustCache !== !1), ne = pt(i, r, c);
174
- !s.joined && ne && C(n, { prewarm: "hit" });
175
- let h = S.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, re = !1;
176
- if (h) try {
177
- let e = await m(c, i, h, r, a);
178
- if (e.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${e.mode}`);
179
- } catch {
180
- on(t), h = null;
194
+ }, o.trustCache !== !1), re = gt(i, r, c);
195
+ !s.waited && re && C(n, { prewarm: "hit" });
196
+ let h = S.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, g = !1, _ = null;
197
+ if (h) {
198
+ let e = He(c, h, (e, t) => p(e, i, t, r, a, { limit: 50 }));
199
+ try {
200
+ let t = await m(c, i, h, r, a);
201
+ if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
202
+ _ = e;
203
+ } catch {
204
+ fn(t), h = null;
205
+ }
181
206
  }
182
207
  if (!h) {
183
- Y(t, n, "connecting", "preparingSession");
208
+ Bn(t, n, "connecting", "preparingSession");
184
209
  let s;
185
210
  try {
186
211
  s = await u(c, i, r, a);
187
212
  } catch (s) {
188
- if (te) {
189
- K.current.invalidate(c);
190
- let l = rt(s, o.isAbandoned?.() ?? !1), u = l === "check-network";
191
- if (l === "check-network" && (l = await nt(() => f(i, j, r, kt(), a, q.current))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
192
- u || C(n, { cacheProofFailed: !0 }), l === "replace" && (q.current.add(c), on(t), U(r));
213
+ if (ne) {
214
+ q.current.invalidate(c);
215
+ let l = it(s, o.isAbandoned?.() ?? !1), u = l === "check-network";
216
+ if (l === "check-network" && (l = await rt(() => d(i, M, r, Mt(), a, J.current))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
217
+ u || C(n, { cacheProofFailed: !0 }), l === "replace" && (J.current.add(c), fn(t), H(r));
193
218
  let s = await e(t, n, r, i, a, {
194
219
  ...o,
195
220
  trustCache: !1
196
221
  });
197
222
  return u && (s.deadSandboxProbe || s.sandboxId !== c) && C(n, { cacheProofFailed: !0 }), {
198
223
  ...s,
199
- sandboxProbed: s.sandboxProbed || d,
200
- sandboxAdopted: s.sandboxAdopted || p,
201
- deadSandboxProbe: s.deadSandboxProbe || ee
224
+ sandboxProbed: s.sandboxProbed || ee,
225
+ sandboxAdopted: s.sandboxAdopted || f,
226
+ deadSandboxProbe: s.deadSandboxProbe || te
202
227
  };
203
228
  }
204
229
  }
205
230
  throw s;
206
231
  }
207
- h = s.sessionId, an(t, h), re = !0;
232
+ h = s.sessionId, dn(t, h), g = !0;
208
233
  }
209
234
  return {
210
235
  sandboxId: c,
211
236
  sessionId: h,
212
- sessionIsNew: re,
237
+ sessionIsNew: g,
238
+ readAhead: _,
213
239
  sandboxIsNew: l,
214
- sandboxProbed: d,
215
- sandboxAdopted: p,
216
- deadSandboxProbe: ee
240
+ sandboxProbed: ee,
241
+ sandboxAdopted: f,
242
+ deadSandboxProbe: te
217
243
  };
218
244
  }, [
219
- Pn,
220
- on,
221
- U,
222
- j,
223
- an,
224
- Y
225
- ]), In = T((e) => {
226
- let t = Qe();
245
+ Vn,
246
+ fn,
247
+ H,
248
+ M,
249
+ dn,
250
+ Bn
251
+ ]), Un = E((e) => {
252
+ let t = T();
227
253
  if (!t) return;
228
- let n = S.getState(), r = Date.now(), i = mt({
254
+ let n = S.getState(), r = Date.now(), i = _t({
229
255
  autoRouting: n.autoRouting,
230
- autoOffered: wn.current,
256
+ autoOffered: An.current,
231
257
  active: n.activeConversationId ? n.conversations.find((e) => e.id === n.activeConversationId) : void 0,
232
258
  selectedMode: n.mode,
233
259
  autoReadMode: Ee,
234
- modes: bn.current,
260
+ modes: wn.current,
235
261
  acknowledgedWriteModes: n.acknowledgedWriteModes,
236
- adminAccess: G.read(),
262
+ adminAccess: K.read(),
237
263
  dictated: e,
238
264
  turnInFlight: Object.values(n.processingByConversationId).some((e) => Pe(e?.status)),
239
- ..._t(t),
265
+ ...bt(t),
240
266
  now: r
241
267
  });
242
268
  if (!i) return;
243
- let a = gt(t, i, r), o = {
244
- accessToken: N(),
245
- workspaceToken: P(),
269
+ let a = yt(t, i, r), o = {
270
+ accessToken: P(),
271
+ workspaceToken: qt(),
246
272
  userId: F,
247
- organizationId: Ze()
273
+ organizationId: $e()
248
274
  };
249
- Pn(i.mode, t, o, null, !0, a).then((e) => a.finish({
275
+ Vn(i.mode, t, o, null, !0, a).then((e) => a.finish({
250
276
  ok: !0,
251
277
  sandboxId: e.sandboxId,
252
278
  didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
279
+ booted: e.sandboxIsNew || e.sandboxAdopted,
253
280
  dead: a.dead
254
281
  }), (e) => {
255
- if (!(e instanceof ft) && !a.signal.aborted && Qe() === t) {
282
+ if (!(e instanceof ht) && !a.signal.aborted && T() === t) {
256
283
  let e = S.getState().sandboxesByMode[i.mode]?.sandboxId ?? null;
257
- e && (K.current.invalidate(e), q.current.add(e), a.dead.push(e), U(i.mode));
284
+ e && (q.current.invalidate(e), J.current.add(e), a.dead.push(e), H(i.mode));
258
285
  }
259
286
  a.finish({
260
287
  ok: !1,
261
288
  didWork: !1,
289
+ booted: !1,
262
290
  dead: a.dead
263
291
  });
264
292
  });
265
293
  }, [
266
- Pn,
267
- G,
268
- U,
269
- N,
294
+ Vn,
295
+ K,
296
+ H,
270
297
  P,
298
+ qt,
271
299
  F
272
- ]), Ln = T(() => In(!1), [In]), [Rn, zn] = Mt(null), Bn = O(/* @__PURE__ */ new Set()), Vn = O(null), Hn = T(() => {
300
+ ]), Wn = E(() => Un(!1), [Un]), [Gn, Kn] = Ft(null), qn = k(/* @__PURE__ */ new Set()), Jn = k(null), Yn = E(() => {
273
301
  let e = S.getState(), t = e.activeConversationId;
274
302
  if (!t) return;
275
303
  let n = e.processingByConversationId[t], r = Pe(n?.status) ? n?.messageId ?? null : null;
276
304
  if (!Ie({
277
305
  interruptedTurnId: r,
278
306
  activeTurnId: r,
279
- alreadyRequested: r ? Bn.current.has(r) : !1
307
+ alreadyRequested: r ? qn.current.has(r) : !1
280
308
  }).send || !r) return;
281
- Bn.current.add(r);
282
- let i = Ne(e), a = Qe(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
309
+ qn.current.add(r);
310
+ let i = Ne(e), a = T(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
283
311
  !i || !a || !o || s(i.sandboxId, a, o, i.mode, {
284
- accessToken: N(),
285
- workspaceToken: P(),
312
+ accessToken: P(),
313
+ workspaceToken: qt(),
286
314
  userId: F,
287
- organizationId: Ze()
315
+ organizationId: $e()
288
316
  });
289
317
  }, [
290
318
  F,
291
- N,
292
- P
293
- ]), Un = T(async (e) => {
294
- let t = S.getState(), n = Ne(t), r = Qe(), i = t.activeConversationId;
319
+ P,
320
+ qt
321
+ ]), Xn = E(async (e) => {
322
+ let t = S.getState(), n = Ne(t), r = T(), i = t.activeConversationId;
295
323
  if (!(!n || !r || !i)) {
296
- zn(e);
324
+ Kn(e);
297
325
  try {
298
326
  await c(n.sandboxId, r, e, n.mode, {
299
- accessToken: N(),
300
- workspaceToken: P(),
327
+ accessToken: P(),
328
+ workspaceToken: qt(),
301
329
  userId: F,
302
- organizationId: Ze()
330
+ organizationId: $e()
303
331
  });
304
332
  } catch (e) {
305
- zn(null), V(i, {
306
- id: It(),
333
+ Kn(null), B(i, {
334
+ id: zt(),
307
335
  role: "system",
308
336
  content: e instanceof Error ? e.message : "The change could not be approved.",
309
337
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
310
338
  });
311
339
  return;
312
340
  }
313
- zn(null), Qn.current(A("pendingWrite.approvedPrompt", "I approved that change — go ahead."));
341
+ Kn(null), ar.current(j("pendingWrite.approvedPrompt", "I approved that change — go ahead."));
314
342
  }
315
343
  }, [
316
344
  F,
317
- V,
318
- A
319
- ]), Wn = e(), { speakFinishedReply: Gn } = Ye(), Kn = a(), { items: qn } = jt(), Jn = O({
320
- theme: Wn,
321
- navigate: Kn,
322
- navItems: qn,
323
- options: Ht ?? {}
345
+ B,
346
+ j
347
+ ]), Zn = e(), { speakFinishedReply: Qn } = Ze(), $n = a(), { items: er } = Pt(), tr = k({
348
+ theme: Zn,
349
+ navigate: $n,
350
+ navItems: er,
351
+ options: Kt ?? {}
324
352
  });
325
- E(() => {
326
- Jn.current = {
327
- theme: Wn,
328
- navigate: Kn,
329
- navItems: qn,
330
- options: Ht ?? {}
353
+ D(() => {
354
+ tr.current = {
355
+ theme: Zn,
356
+ navigate: $n,
357
+ navItems: er,
358
+ options: Kt ?? {}
331
359
  };
332
360
  }, [
333
- Wn,
334
- Kn,
335
- qn,
336
- Ht
361
+ Zn,
362
+ $n,
363
+ er,
364
+ Kt
337
365
  ]);
338
- let Yn = T((e, t, n) => {
339
- let { theme: r, navigate: i } = Jn.current, a, o;
366
+ let nr = E((e, t, n) => {
367
+ let { theme: r, navigate: i } = tr.current, a, o;
340
368
  if (e.kind === "theme") {
341
369
  if (!r) return !1;
342
- let t = xt(e.request, {
370
+ let t = wt(e.request, {
343
371
  mode: r.mode,
344
372
  resolvedTheme: r.resolvedTheme
345
373
  });
346
374
  if (!t.alreadyApplied) try {
347
375
  r.setMode(t.mode);
348
376
  } catch {}
349
- a = wt(A, t, e.request.kind === "family"), o = {
377
+ a = Dt(j, t, e.request.kind === "family"), o = {
350
378
  kind: "theme",
351
379
  mode: t.mode,
352
380
  alreadyApplied: t.alreadyApplied
@@ -354,21 +382,21 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
354
382
  } else {
355
383
  if (!i) return !1;
356
384
  if (e.kind === "navigate") {
357
- let { destination: t } = e, n = vt(t, window.location.pathname + window.location.search, bt(Jn.current.navItems));
358
- n || i(t.path), a = Ct(A, t.label, n), o = {
385
+ let { destination: t } = e, n = xt(t, window.location.pathname + window.location.search, Ct(tr.current.navItems));
386
+ n || i(t.path), a = Et(j, t.label, n), o = {
359
387
  kind: "navigate",
360
388
  destinationId: t.id,
361
389
  path: t.path,
362
390
  alreadyHere: n
363
391
  };
364
- } else a = St(A, e.candidates[0]?.label ?? e.query, e.candidates), o = {
392
+ } else a = Tt(j, e.candidates[0]?.label ?? e.query, e.candidates), o = {
365
393
  kind: "choose-destination",
366
394
  candidateIds: e.candidates.map((e) => e.id)
367
395
  };
368
396
  }
369
- let s = S.getState(), c = s.activeConversationId ?? B(void 0, s.autoRouting && wn.current ? "assistant" : s.mode, s.autoRouting ? { routedBy: "auto" } : void 0), l = (/* @__PURE__ */ new Date()).toISOString();
370
- V(c, {
371
- id: It(),
397
+ let s = S.getState(), c = s.activeConversationId ?? z(void 0, s.autoRouting && An.current ? "assistant" : s.mode, s.autoRouting ? { routedBy: "auto" } : void 0), l = (/* @__PURE__ */ new Date()).toISOString();
398
+ B(c, {
399
+ id: zt(),
372
400
  role: "user",
373
401
  content: t,
374
402
  timestamp: l,
@@ -377,30 +405,30 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
377
405
  ...v(n)
378
406
  }
379
407
  });
380
- let u = It();
381
- return V(c, {
408
+ let u = zt();
409
+ return B(c, {
382
410
  id: u,
383
411
  role: "assistant",
384
412
  content: a.text,
385
413
  timestamp: l,
386
414
  metadata: {
387
- lang: a.translated ? I : "en",
415
+ lang: a.translated ? Jt : "en",
388
416
  localAction: o,
389
417
  ...v(n)
390
418
  }
391
- }), Gn(c, u), !0;
419
+ }), Qn(c, u), !0;
392
420
  }, [
393
- V,
394
421
  B,
395
- I,
396
- Gn,
397
- A
398
- ]), X = T(async (e, t = [], n = {}) => {
399
- let r = n.voiceSessionId !== void 0, i = S.getState(), a = i.activeConversationId ?? L;
422
+ z,
423
+ Jt,
424
+ Qn,
425
+ j
426
+ ]), X = E(async (e, t = [], n = {}) => {
427
+ let r = n.voiceSessionId !== void 0, i = S.getState(), a = i.activeConversationId ?? I;
400
428
  if (a) {
401
429
  if (Pe(i.processingByConversationId[a]?.status)) {
402
430
  let r = i.processingByConversationId[a]?.messageId ?? null;
403
- r && Bn.current.has(r) && (Vn.current = {
431
+ r && qn.current.has(r) && (Jn.current = {
404
432
  conversationId: a,
405
433
  content: e,
406
434
  attachments: t,
@@ -408,14 +436,14 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
408
436
  });
409
437
  return;
410
438
  }
411
- if (Mn.current.has(a)) return;
439
+ if (Rn.current.has(a)) return;
412
440
  }
413
- if (Tn.current) return;
441
+ if (jn.current) return;
414
442
  if (n.fromPerson && t.length === 0) {
415
- let t = yt(e, bt(Jn.current.navItems), Jn.current.options);
416
- if (t && Yn(t, e, n.voiceSessionId)) return;
443
+ let t = St(e, Ct(tr.current.navItems), tr.current.options);
444
+ if (t && nr(t, e, n.voiceSessionId)) return;
417
445
  }
418
- let o = i.activeConversationId ? i.conversations.find((e) => e.id === i.activeConversationId) : void 0, s = i.autoRouting && wn.current ? Me({
446
+ let o = i.activeConversationId ? i.conversations.find((e) => e.id === i.activeConversationId) : void 0, s = i.autoRouting && An.current ? Me({
419
447
  intent: n.autoIntent ?? ke(e),
420
448
  dictated: r,
421
449
  conversation: o ? {
@@ -424,32 +452,32 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
424
452
  hasHistory: o.messages.length > 0 || !!o.backendSessionId
425
453
  } : null
426
454
  }) : null;
427
- if (s && bn.current.find((e) => e.id === s.mode)?.writeCapable && !we(i.acknowledgedWriteModes, s.mode)) {
428
- Tn.current = {
455
+ if (s && wn.current.find((e) => e.id === s.mode)?.writeCapable && !we(i.acknowledgedWriteModes, s.mode)) {
456
+ jn.current = {
429
457
  content: e,
430
458
  attachments: t,
431
459
  options: n
432
- }, On(s.mode);
460
+ }, Pn(s.mode);
433
461
  return;
434
462
  }
435
- let c = s ? s.mode : i.mode, l, u, f = L, m = f ? S.getState().conversations.find((e) => e.id === f) : void 0, h = s?.action === "escalate" && o ? {
463
+ let c = s ? s.mode : i.mode, l, u, d = I, m = d ? S.getState().conversations.find((e) => e.id === d) : void 0, re = s?.action === "escalate" && o ? {
436
464
  mode: o.mode,
437
465
  backendSessionId: o.backendSessionId ?? null
438
466
  } : null;
439
- if (s) s.action === "new" || !o ? f = B(void 0, c, { routedBy: "auto" }) : (f = o.id, dn(f, c));
467
+ if (s) s.action === "new" || !o ? d = z(void 0, c, { routedBy: "auto" }) : (d = o.id, U(d, c));
440
468
  else {
441
469
  let e = i.autoRouting ? { routedBy: "auto" } : void 0;
442
- f ? m && m.mode !== c && (m.messages.length > 0 || m.backendSessionId) ? f = B(void 0, c, e) : m && m.mode !== c && (e ? dn(f, c) : Zt(f, c)) : f = B(void 0, c, e);
470
+ d ? m && m.mode !== c && (m.messages.length > 0 || m.backendSessionId) ? d = z(void 0, c, e) : m && m.mode !== c && (e ? U(d, c) : rn(d, c)) : d = z(void 0, c, e);
443
471
  }
444
- if (!f) return;
445
- jn.current[f] = t;
446
- let g = Qe(), _ = {
447
- accessToken: N(),
448
- workspaceToken: P(),
472
+ if (!d) return;
473
+ Ln.current[d] = t;
474
+ let g = T(), _ = {
475
+ accessToken: P(),
476
+ workspaceToken: qt(),
449
477
  userId: F,
450
- organizationId: Ze()
478
+ organizationId: $e()
451
479
  }, oe = {
452
- id: It(),
480
+ id: zt(),
453
481
  role: "user",
454
482
  content: e,
455
483
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -458,27 +486,27 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
458
486
  ...v(n.voiceSessionId)
459
487
  }
460
488
  };
461
- V(f, oe);
462
- let y = It();
463
- V(f, {
489
+ B(d, oe);
490
+ let y = zt();
491
+ B(d, {
464
492
  id: y,
465
493
  role: "assistant",
466
494
  content: "",
467
495
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
468
496
  metadata: {
469
- lang: Jt,
497
+ lang: en,
470
498
  ...v(n.voiceSessionId)
471
499
  }
472
- }), Ge(y, {
500
+ }), qe(y, {
473
501
  channel: r ? "voice" : "chat",
474
502
  mode: c,
475
- product: j,
476
- language: Jt,
477
- device: Ke(),
503
+ product: M,
504
+ language: en,
505
+ device: Je(),
478
506
  routedByAuto: !!s
479
- }, n.voiceTiming), w(y, "accepted"), nn(f, "provisioning", y, null);
480
- let se = (e, t, r, i, a = Jt) => {
481
- en(f, y, { content: ie(e) }), tn(f, y, {
507
+ }, n.voiceTiming), w(y, "accepted"), ln(d, "provisioning", y, null);
508
+ let se = (e, t, r, i, a = en) => {
509
+ sn(d, y, { content: ie(e) }), cn(d, y, {
482
510
  lang: a,
483
511
  ...t?.length ? { artifacts: t } : {},
484
512
  ...t?.length || r || i ? { mode: c } : {},
@@ -490,22 +518,22 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
490
518
  w(y, "attemptStarted");
491
519
  let i = null, a = !1;
492
520
  try {
493
- let { sandboxId: n, sessionId: o, sessionIsNew: s, sandboxIsNew: m, sandboxProbed: te, sandboxAdopted: h, deadSandboxProbe: oe } = await Fn(f, y, c, g, _, { isAbandoned: () => Fe({
521
+ let { sandboxId: n, sessionId: o, sessionIsNew: s, readAhead: m, sandboxIsNew: te, sandboxProbed: re, sandboxAdopted: oe, deadSandboxProbe: v } = await Hn(d, y, c, g, _, { isAbandoned: () => Fe({
494
522
  turnId: y,
495
- abortRequested: Bn.current.has(y),
496
- activeTurnId: S.getState().processingByConversationId[f]?.messageId ?? null
523
+ abortRequested: qn.current.has(y),
524
+ activeTurnId: S.getState().processingByConversationId[d]?.messageId ?? null
497
525
  }).abandon });
498
526
  i = n, w(y, "runtimeReady"), C(y, {
499
- runtime: m ? "cold" : h ? "adopted" : te ? "probed" : s ? "new-session" : "warm",
500
- deadSandboxProbe: oe
527
+ runtime: te ? "cold" : oe ? "adopted" : re ? "probed" : s ? "new-session" : "warm",
528
+ deadSandboxProbe: v
501
529
  });
502
- let v = De(S.getState().conversations.find((e) => e.id === f), e, s), ce = await Be(() => ee(n, g, o, c, _, { limit: 50 }), s);
503
- Y(f, y, "streaming", "thinking");
504
- let b = zt?.(), { prompt: ue, parts: de } = Ce({
505
- content: v ? `${v}${e}` : e,
530
+ let ce = De(S.getState().conversations.find((e) => e.id === d), e, s), b = await Ve(() => p(n, g, o, c, _, { limit: 50 }), s, Be(m, n, o));
531
+ Bn(d, y, "streaming", "thinking");
532
+ let ue = Ht?.(), { prompt: de, parts: fe } = Ce({
533
+ content: ce ? `${ce}${e}` : e,
506
534
  attachments: t,
507
535
  limits: _e(l),
508
- wrapPrompt: (e) => Bt?.(c, e, Kt, qt, r) ?? e,
536
+ wrapPrompt: (e) => Ut?.(c, e, Qt, $t, r) ?? e,
509
537
  requestBytes: (e, t) => ne({
510
538
  sandboxId: n,
511
539
  workspaceId: g,
@@ -513,93 +541,93 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
513
541
  mode: c,
514
542
  prompt: e,
515
543
  parts: t,
516
- pageContext: b,
544
+ pageContext: ue,
517
545
  authContext: _
518
546
  })
519
- }), fe = me(de), he = fe > 0;
520
- a = pe(t) > fe;
547
+ }), he = me(fe), ge = he > 0;
548
+ a = pe(t) > he;
521
549
  try {
522
- await re(n, g, o, ue, c, b, _, de?.length ? { parts: de } : void 0);
550
+ await h(n, g, o, de, c, ue, _, fe?.length ? { parts: fe } : void 0);
523
551
  } catch (e) {
524
- if (!de || !$e(e)) throw e;
525
- await re(n, g, o, ue, c, b, _, void 0), a ||= he;
552
+ if (!fe || !et(e)) throw e;
553
+ await h(n, g, o, de, c, ue, _, void 0), a ||= ge;
526
554
  }
527
555
  w(y, "promptSent");
528
- let ge = null, ve = !1, ye = Re, x = ze([], ce), be = Date.now() + u.streamBudgetMs, xe = Date.now(), Se = Date.now(), we = () => Fe({
556
+ let ve = null, ye = !1, be = Re, x = ze([], b), xe = Date.now() + u.streamBudgetMs, Se = Date.now(), we = Date.now(), Te = () => Fe({
529
557
  turnId: y,
530
- abortRequested: Bn.current.has(y),
531
- activeTurnId: S.getState().processingByConversationId[f]?.messageId ?? null
558
+ abortRequested: qn.current.has(y),
559
+ activeTurnId: S.getState().processingByConversationId[d]?.messageId ?? null
532
560
  });
533
- for (; Date.now() < be;) {
534
- let e = we();
561
+ for (; Date.now() < xe;) {
562
+ let e = Te();
535
563
  if (e.abandon) {
536
- e.clearProcessing && rn(f);
564
+ e.clearProcessing && un(d);
537
565
  return;
538
566
  }
539
- if (x = ze(await ee(n, g, o, c, _, {
567
+ if (x = ze(await p(n, g, o, c, _, {
540
568
  limit: 50,
541
- sinceMs: ce
542
- }), ce, { accumulateNarration: u.accumulatesNarration }), en(f, y, { content: ie(x.content) }), x.hasRenderableOutput ? ve || (ve = !0, ge !== null && w(y, "lastQuietPoll", ge), w(y, "firstOutput")) : ge = Je(), u.accumulatesNarration) x.hasText && w(y, "firstText");
569
+ sinceMs: b
570
+ }), b, { accumulateNarration: u.accumulatesNarration }), sn(d, y, { content: ie(x.content) }), x.hasRenderableOutput ? ye || (ye = !0, ve !== null && w(y, "lastQuietPoll", ve), w(y, "firstOutput")) : ve = Xe(), u.accumulatesNarration) x.hasText && w(y, "firstText");
543
571
  else {
544
- let e = Ve(ye, x, Je());
545
- ye = e.tracker, e.confirmedAt !== null && w(y, "firstText", e.confirmedAt);
572
+ let e = Ue(be, x, Xe());
573
+ be = e.tracker, e.confirmedAt !== null && w(y, "firstText", e.confirmedAt);
546
574
  }
547
- if (x.pendingWrite && tn(f, y, { pendingWrite: x.pendingWrite }), x.done) {
548
- w(y, "answerDone"), K.current.markVerified(n);
575
+ if (x.pendingWrite && cn(d, y, { pendingWrite: x.pendingWrite }), x.done) {
576
+ w(y, "answerDone"), q.current.markVerified(n);
549
577
  break;
550
578
  }
551
- Date.now() - xe > 3e4 && (await d(n, g, 600, _).catch(() => void 0), xe = Date.now()), await new Promise((e) => setTimeout(e, le(Date.now() - Se)));
579
+ Date.now() - Se > 3e4 && (await ee(n, g, 600, _).catch(() => void 0), Se = Date.now()), await new Promise((e) => setTimeout(e, le(Date.now() - we)));
552
580
  }
553
- let Te = u.producesArtifacts ? await p(n, g, o, c, _).then((e) => e).catch(() => []) : void 0;
581
+ let Ee = u.producesArtifacts ? await f(n, g, o, c, _).then((e) => e).catch(() => []) : void 0;
554
582
  if (x.usedTools !== void 0 && C(y, { usedTools: x.usedTools }), x.done || (C(y, { outcome: "timedOut" }), x = {
555
583
  ...x,
556
- content: ae(x.content, c, A, l)
584
+ content: ae(x.content, c, j, l)
557
585
  }), a && (x = {
558
586
  ...x,
559
- content: `${x.content}\n\n${A("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._")}`
560
- }), se(x.content, Te, o, n), x.tokens) {
561
- en(f, y, { tokens: x.tokens });
587
+ content: `${x.content}\n\n${j("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._")}`
588
+ }), se(x.content, Ee, o, n), x.tokens) {
589
+ sn(d, y, { tokens: x.tokens });
562
590
  try {
563
- await Vt?.({
591
+ await Gt?.({
564
592
  workspaceId: g,
565
593
  sessionId: o,
566
594
  messageId: x.messageId,
567
595
  model: x.model,
568
596
  tokens: x.tokens
569
- }), Et(j);
597
+ }), kt(M);
570
598
  } catch {}
571
599
  }
572
- let Ee = we();
573
- if (Ee.abandon) {
574
- Ee.clearProcessing && rn(f);
600
+ let Oe = Te();
601
+ if (Oe.abandon) {
602
+ Oe.clearProcessing && un(d);
575
603
  return;
576
604
  }
577
- w(y, "complete"), C(y, { outcome: "answered" }), nn(f, "complete", y, null);
605
+ w(y, "complete"), C(y, { outcome: "answered" }), ln(d, "complete", y, null);
578
606
  } catch (e) {
579
- K.current.invalidate(i ?? S.getState().sandboxesByMode[c]?.sandboxId ?? null);
607
+ q.current.invalidate(i ?? S.getState().sandboxesByMode[c]?.sandboxId ?? null);
580
608
  let t = Fe({
581
609
  turnId: y,
582
- abortRequested: Bn.current.has(y),
583
- activeTurnId: S.getState().processingByConversationId[f]?.messageId ?? null
610
+ abortRequested: qn.current.has(y),
611
+ activeTurnId: S.getState().processingByConversationId[d]?.messageId ?? null
584
612
  });
585
613
  if (t.abandon) {
586
- t.clearProcessing && rn(f);
614
+ t.clearProcessing && un(d);
587
615
  return;
588
616
  }
589
- if (n === 1 && et(e)) {
617
+ if (n === 1 && tt(e)) {
590
618
  let e = i ?? S.getState().sandboxesByMode[c]?.sandboxId ?? null;
591
- return e && (q.current.add(e), K.current.invalidate(e)), on(f), U(c), $t(f, y, ""), tn(f, y, { pendingWrite: void 0 }), qe(y), ce(2);
619
+ return e && (J.current.add(e), q.current.invalidate(e)), fn(d), H(c), on(d, y, ""), cn(d, y, { pendingWrite: void 0 }), Ye(y), ce(2);
592
620
  }
593
621
  throw e;
594
622
  }
595
- }, b = f;
596
- Mn.current.add(b);
623
+ }, b = d;
624
+ Rn.current.add(b);
597
625
  try {
598
626
  if (!g) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
599
627
  code: "UNAUTHENTICATED",
600
628
  authFailure: "WORKSPACE_CONTEXT_MISSING"
601
629
  } });
602
- let e = await Se(c, () => bn.current.find((e) => e.id === c), G);
630
+ let e = await Se(c, () => wn.current.find((e) => e.id === c), K);
603
631
  l = e.config, u = e.capabilities;
604
632
  let t = Te(c, l, S.getState().acknowledgedWriteModes, {
605
633
  dictated: r,
@@ -608,72 +636,72 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
608
636
  if (t) throw new ye(t, t === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
609
637
  w(y, "cleared"), await ce();
610
638
  } catch (e) {
611
- K.current.invalidate(S.getState().sandboxesByMode[c]?.sandboxId ?? null);
612
- let t = x(e);
613
- C(y, { outcome: t.kind === "temporary" ? "failed" : "refused" }), t.offersUpgrade && Tt(j, "sandbox");
614
- let r = be(t, A);
615
- nn(f, "error", y, r.headline), en(f, y, { content: r.text }), tn(f, y, {
616
- lang: r.translated ? I : "en",
639
+ q.current.invalidate(S.getState().sandboxesByMode[c]?.sandboxId ?? null);
640
+ let t = be(e);
641
+ C(y, { outcome: t.kind === "temporary" ? "failed" : "refused" }), t.offersUpgrade && Ot(M, "sandbox");
642
+ let r = x(t, j);
643
+ ln(d, "error", y, r.headline), sn(d, y, { content: r.text }), cn(d, y, {
644
+ lang: r.translated ? Jt : "en",
617
645
  ...v(n.voiceSessionId)
618
646
  });
619
647
  } finally {
620
- Mn.current.delete(b), C(y, { outcome: "stopped" }), w(y, "complete");
621
- let e = S.getState(), t = Ae(h, c, e.conversations.find((e) => e.id === b), (t) => !!e.sandboxesByMode[t]?.sandboxId);
622
- t && (dn(b, t.mode), t.backendSessionId && an(b, t.backendSessionId));
623
- let n = Vn.current;
624
- Vn.current = null, n && n.conversationId === b && Qn.current(n.content, n.attachments, n.options);
648
+ Rn.current.delete(b), C(y, { outcome: "stopped" }), w(y, "complete");
649
+ let e = S.getState(), t = Ae(re, c, e.conversations.find((e) => e.id === b), (t) => !!e.sandboxesByMode[t]?.sandboxId);
650
+ t && (U(b, t.mode), t.backendSessionId && dn(b, t.backendSessionId));
651
+ let n = Jn.current;
652
+ Jn.current = null, n && n.conversationId === b && ar.current(n.content, n.attachments, n.options);
625
653
  }
626
654
  }, [
627
- L,
628
- V,
629
- Bt,
630
- on,
631
- U,
632
- Yt,
655
+ I,
633
656
  B,
634
- Fn,
635
- zt,
636
- N,
657
+ Ut,
658
+ fn,
659
+ H,
660
+ tn,
661
+ z,
662
+ Hn,
663
+ Ht,
637
664
  P,
638
- en,
639
- j,
640
- G,
641
- Vt,
642
665
  qt,
643
- I,
666
+ sn,
667
+ M,
668
+ K,
669
+ Gt,
670
+ $t,
644
671
  Jt,
645
- Kt,
672
+ en,
673
+ Qt,
674
+ U,
675
+ nr,
646
676
  dn,
647
- Yn,
648
- an,
649
- Zt,
650
- nn,
651
677
  rn,
652
- A,
653
- Y,
654
- $t,
678
+ ln,
679
+ un,
680
+ j,
681
+ Bn,
682
+ on,
655
683
  F
656
- ]), Xn = T((e, t) => {
684
+ ]), rr = E((e, t) => {
657
685
  X(e, [], t ? { autoIntent: t } : {});
658
- }, [X]), Zn = T(() => {
659
- let e = [...pn.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction), t = L ? jn.current[L] ?? [] : [];
686
+ }, [X]), ir = E(() => {
687
+ let e = [...vn.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction), t = I ? Ln.current[I] ?? [] : [];
660
688
  e && X(e.content, t);
661
689
  }, [
662
- mn,
690
+ yn,
663
691
  X,
664
- L
665
- ]), Qn = O(X);
666
- E(() => {
667
- Qn.current = X;
692
+ I
693
+ ]), ar = k(X);
694
+ D(() => {
695
+ ar.current = X;
668
696
  }, [X]);
669
- let $n = D(() => {
670
- if (hn) return null;
671
- for (let e = mn.length - 1; e >= 0; --e) {
672
- let t = mn[e];
673
- if (t?.role !== "assistant" || !oe(t) || Bn.current.has(t.id)) continue;
674
- let n = Le(t, W, A);
697
+ let or = O(() => {
698
+ if (bn) return null;
699
+ for (let e = yn.length - 1; e >= 0; --e) {
700
+ let t = yn[e];
701
+ if (t?.role !== "assistant" || !oe(t) || qn.current.has(t.id)) continue;
702
+ let n = Le(t, W, j);
675
703
  if (n.kind !== "output") return null;
676
- let r = He(n.text).text.trim();
704
+ let r = We(n.text).text.trim();
677
705
  return r ? {
678
706
  id: t.id,
679
707
  text: r
@@ -681,228 +709,228 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
681
709
  }
682
710
  return null;
683
711
  }, [
684
- mn,
685
- hn,
712
+ yn,
713
+ bn,
686
714
  W,
687
- A
688
- ]), er = D(() => $n ? ue($n.text) : null, [$n]), tr = pn.chat, Z = D(() => pn.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
715
+ j
716
+ ]), sr = O(() => or ? ue(or.text) : null, [or]), cr = vn.chat, Z = O(() => vn.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
689
717
  id: e.id,
690
718
  role: e.role,
691
- text: We(e, W, A),
719
+ text: Ke(e, W, j),
692
720
  sessionId: y(e),
693
721
  timestamp: e.timestamp
694
722
  })).filter((e) => e.text.length > 0), [
695
- pn.voice,
723
+ vn.voice,
696
724
  W,
697
- A
698
- ]), nr = T(() => {
725
+ j
726
+ ]), lr = E(() => {
699
727
  if (Z.length === 0) return;
700
728
  let e = /* @__PURE__ */ new Date();
701
- ot(ce(Z, {
702
- title: A("voiceSession.transcript", "Voice conversation"),
703
- savedAt: A("voiceSession.savedAt", "Saved"),
704
- session: A("voiceSession.sessionLabel", "Session"),
705
- earlier: A("voiceSession.earlierLabel", "Earlier"),
706
- you: A("voiceSession.speakerYou", "You"),
707
- assistant: A("voiceSession.speakerAssistant", "Assistant")
708
- }, e), b(j, e), "text/markdown");
729
+ st(ce(Z, {
730
+ title: j("voiceSession.transcript", "Voice conversation"),
731
+ savedAt: j("voiceSession.savedAt", "Saved"),
732
+ session: j("voiceSession.sessionLabel", "Session"),
733
+ earlier: j("voiceSession.earlierLabel", "Earlier"),
734
+ you: j("voiceSession.speakerYou", "You"),
735
+ assistant: j("voiceSession.speakerAssistant", "Assistant")
736
+ }, e), b(M, e), "text/markdown");
709
737
  }, [
710
- j,
738
+ M,
711
739
  Z,
712
- A
713
- ]), Q = Dt({ perFileChars: En }), rr = O(Q);
714
- rr.current = Q;
715
- let $ = Xe({
716
- onSubmit: T((e, t, n) => {
740
+ j
741
+ ]), Q = At({ perFileChars: Mn }), ur = k(Q);
742
+ ur.current = Q;
743
+ let $ = Qe({
744
+ onSubmit: E((e, t, n) => {
717
745
  let r = () => {
718
- let r = rr.current, i = he(r.attachments), a = {
746
+ let r = ur.current, i = he(r.attachments), a = {
719
747
  ...n,
720
- handedOver: Je()
748
+ handedOver: Xe()
721
749
  };
722
- Qn.current(e, i, {
750
+ ar.current(e, i, {
723
751
  fromPerson: !0,
724
752
  voiceSessionId: t,
725
753
  voiceTiming: a
726
754
  }), r.clear();
727
755
  };
728
- if (!rr.current.isBusy) {
756
+ if (!ur.current.isBusy) {
729
757
  r();
730
758
  return;
731
759
  }
732
760
  let i = Date.now(), a = window.setInterval(() => {
733
- rr.current.isBusy && Date.now() - i < Ft || (window.clearInterval(a), r());
761
+ ur.current.isBusy && Date.now() - i < Rt || (window.clearInterval(a), r());
734
762
  }, 200);
735
763
  }, []),
736
- latestReply: $n,
737
- language: de(Ut, I).tag
738
- }), ir = $.start, ar = T(() => {
739
- In(!0), ir();
740
- }, [In, ir]), or = D(() => (fn?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [fn?.messages]), sr = Ue(pn.voice, W, A), cr = sr > or, lr = T(() => {
764
+ latestReply: or,
765
+ language: de(Yt, Jt).tag
766
+ }), dr = $.start, fr = E(() => {
767
+ Un(!0), dr();
768
+ }, [Un, dr]), pr = O(() => (_n?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [_n?.messages]), mr = Ge(vn.voice, W, j), hr = mr > pr, gr = E(() => {
741
769
  let e = S.getState().activeConversationId;
742
- !e || Z.length === 0 || (V(e, {
743
- id: It(),
770
+ !e || Z.length === 0 || (B(e, {
771
+ id: zt(),
744
772
  role: "system",
745
- content: se(Z.slice(or), {
746
- intro: A("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
747
- nothing: A("voiceSession.continuedNothing", "Continued from a voice conversation."),
748
- more: (e) => A("voiceSession.continuedMore", "…and {{count}} more", { count: e })
773
+ content: se(Z.slice(pr), {
774
+ intro: j("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
775
+ nothing: j("voiceSession.continuedNothing", "Continued from a voice conversation."),
776
+ more: (e) => j("voiceSession.continuedMore", "…and {{count}} more", { count: e })
749
777
  }),
750
778
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
751
- metadata: { continuedVoiceTurns: sr }
752
- }), An(!1), $.end());
779
+ metadata: { continuedVoiceTurns: mr }
780
+ }), In(!1), $.end());
753
781
  }, [
754
782
  Z,
755
- sr,
756
- or,
757
- V,
758
- A,
783
+ mr,
784
+ pr,
785
+ B,
786
+ j,
759
787
  $
760
- ]), ur = O(0);
761
- E(() => {
762
- $.active && (ur.current = sr);
788
+ ]), _r = k(0);
789
+ D(() => {
790
+ $.active && (_r.current = mr);
763
791
  }, [$.active]);
764
- let dr = T(() => {
765
- let e = sr > ur.current;
766
- $.end(), e && An(!0);
767
- }, [sr, $]);
768
- E(() => {
769
- (!Lt || !Nn) && $.active && $.end();
792
+ let vr = E(() => {
793
+ let e = mr > _r.current;
794
+ $.end(), e && In(!0);
795
+ }, [mr, $]);
796
+ D(() => {
797
+ (!Bt || !zn) && $.active && $.end();
770
798
  }, [
771
- Lt,
772
- Nn,
799
+ Bt,
800
+ zn,
773
801
  $
774
- ]), E(() => {
775
- $.active || (rr.current.clear(), Vn.current = null);
776
- }, [$.active]), E(() => {
802
+ ]), D(() => {
803
+ $.active || (ur.current.clear(), Jn.current = null);
804
+ }, [$.active]), D(() => {
777
805
  let e = S.getState().consumePendingPrompt();
778
- return e && Qn.current(e), S.subscribe((e, t) => {
806
+ return e && ar.current(e), S.subscribe((e, t) => {
779
807
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
780
808
  let e = S.getState().consumePendingPrompt();
781
- e && Qn.current(e);
809
+ e && ar.current(e);
782
810
  }
783
811
  });
784
812
  }, []);
785
- let fr = T((e) => {
786
- let t = L ? S.getState().conversations.find((e) => e.id === L) : void 0;
813
+ let yr = E((e) => {
814
+ let t = I ? S.getState().conversations.find((e) => e.id === I) : void 0;
787
815
  if (t && (t.messages.length > 0 || t.backendSessionId)) {
788
816
  if (t.mode !== e) {
789
817
  let t = S.getState().conversations.find((t) => t.mode === e && t.messages.length === 0 && !t.backendSessionId && !S.getState().processingByConversationId[t.id]);
790
- t ? Qt(t.id) : B(void 0, e);
818
+ t ? an(t.id) : z(void 0, e);
791
819
  }
792
- } else L && Zt(L, e);
820
+ } else I && rn(I, e);
793
821
  let n = S.getState().activeConversationId;
794
- n ? Zt(n, e) : un(!1), z(e);
822
+ n ? rn(n, e) : gn(!1), R(e);
795
823
  }, [
796
- L,
797
- B,
798
- Qt,
799
- un,
800
- Zt,
801
- z
802
- ]), pr = T(() => {
824
+ I,
825
+ z,
826
+ an,
827
+ gn,
828
+ rn,
829
+ R
830
+ ]), br = E(() => {
803
831
  let e = S.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
804
832
  if (!t) {
805
- un(!0), z(Ee);
833
+ gn(!0), R(Ee);
806
834
  return;
807
835
  }
808
836
  if (t.routedBy === "auto") {
809
- un(!0);
837
+ gn(!0);
810
838
  return;
811
839
  }
812
840
  if (t.messages.length === 0 && !t.backendSessionId) {
813
- dn(t.id, Ee);
841
+ U(t.id, Ee);
814
842
  return;
815
843
  }
816
844
  let n = e.conversations.find((t) => t.routedBy === "auto" && t.messages.length === 0 && !t.backendSessionId && !e.processingByConversationId[t.id]);
817
- n ? (Qt(n.id), dn(n.id, Ee)) : B(void 0, Ee, { routedBy: "auto" });
845
+ n ? (an(n.id), U(n.id, Ee)) : z(void 0, Ee, { routedBy: "auto" });
818
846
  }, [
819
- B,
820
- dn,
821
- Qt,
822
- un,
823
- z
824
- ]), mr = T((e) => {
825
- if (M.find((t) => t.id === e)?.writeCapable && !we(S.getState().acknowledgedWriteModes, e)) {
826
- On(e);
847
+ z,
848
+ U,
849
+ an,
850
+ gn,
851
+ R
852
+ ]), xr = E((e) => {
853
+ if (N.find((t) => t.id === e)?.writeCapable && !we(S.getState().acknowledgedWriteModes, e)) {
854
+ Pn(e);
827
855
  return;
828
856
  }
829
- fr(e);
830
- }, [fr, M]), hr = T(() => {
831
- let e = Dn;
832
- if (On(null), !e) return;
833
- let t = Tn.current;
834
- if (Tn.current = null, t) {
835
- cn(e), X(t.content, t.attachments, t.options);
857
+ yr(e);
858
+ }, [yr, N]), Sr = E(() => {
859
+ let e = Nn;
860
+ if (Pn(null), !e) return;
861
+ let t = jn.current;
862
+ if (jn.current = null, t) {
863
+ mn(e), X(t.content, t.attachments, t.options);
836
864
  return;
837
865
  }
838
- cn(e), fr(e);
866
+ mn(e), yr(e);
839
867
  }, [
840
- Dn,
841
- cn,
842
- fr,
868
+ Nn,
869
+ mn,
870
+ yr,
843
871
  X
844
- ]), gr = Dn === null ? void 0 : M.find((e) => e.id === Dn) ?? { id: Dn }, _r = T(() => {
845
- On(null);
846
- let e = Tn.current;
847
- Tn.current = null, e && X(e.content, e.attachments, {
872
+ ]), Cr = Nn === null ? void 0 : N.find((e) => e.id === Nn) ?? { id: Nn }, wr = E(() => {
873
+ Pn(null);
874
+ let e = jn.current;
875
+ jn.current = null, e && X(e.content, e.attachments, {
848
876
  ...e.options,
849
877
  autoIntent: "read"
850
878
  });
851
879
  }, [X]);
852
- return /* @__PURE__ */ Nt("div", {
880
+ return /* @__PURE__ */ It("div", {
853
881
  className: "relative flex flex-1 flex-col overflow-hidden",
854
882
  children: [
855
- /* @__PURE__ */ Nt("div", {
883
+ /* @__PURE__ */ It("div", {
856
884
  className: "contents",
857
885
  inert: $.active || void 0,
858
886
  children: [
859
- Z.length > 0 && !$.active ? /* @__PURE__ */ k(it, {
887
+ Z.length > 0 && !$.active ? /* @__PURE__ */ A(at, {
860
888
  count: Z.length,
861
- onOpenTranscript: () => An(!0)
889
+ onOpenTranscript: () => In(!0)
862
890
  }) : null,
863
- tr.length === 0 ? /* @__PURE__ */ k(st, {
864
- mode: R,
865
- onSuggestionClick: Xn,
866
- explainsAuto: Cn,
867
- suggestions: Cn && R === "assistant" ? Oe(M.find((e) => e.id === "assistant")?.suggestions ?? [], M.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
868
- }) : /* @__PURE__ */ k("div", {
891
+ cr.length === 0 ? /* @__PURE__ */ A(ct, {
892
+ mode: L,
893
+ onSuggestionClick: rr,
894
+ explainsAuto: kn,
895
+ suggestions: kn && L === "assistant" ? Oe(N.find((e) => e.id === "assistant")?.suggestions ?? [], N.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
896
+ }) : /* @__PURE__ */ A("div", {
869
897
  className: "flex min-h-0 flex-1 flex-col",
870
- children: /* @__PURE__ */ k(ct, {
871
- onApprovePendingWrite: Un,
872
- approvingWriteRef: Rn,
873
- messages: tr,
898
+ children: /* @__PURE__ */ A(lt, {
899
+ onApprovePendingWrite: Xn,
900
+ approvingWriteRef: Gn,
901
+ messages: cr,
874
902
  processing: W ?? null,
875
- streamingMessageId: gn,
876
- failedMessageId: _n,
877
- onRetry: Zn
903
+ streamingMessageId: xn,
904
+ failedMessageId: Sn,
905
+ onRetry: ir
878
906
  })
879
907
  }),
880
- /* @__PURE__ */ k(Ot, {
881
- onStartVoiceSession: $.available && Nn ? ar : void 0,
908
+ /* @__PURE__ */ A(jt, {
909
+ onStartVoiceSession: $.available && zn ? fr : void 0,
882
910
  onSend: (e, t) => void X(e, t, { fromPerson: !0 }),
883
- onDraftStart: Ln,
884
- disabled: hn,
885
- placeholder: R === "api-calls" ? A("chatArea.placeholderActions", "What would you like me to do?") : A("chatArea.placeholderGeneral", "Ask me anything…"),
886
- mode: R,
887
- writeAccessDenied: Rt === "denied" && !!J?.writeCapable,
888
- availableModes: xn,
889
- attachmentCharsPerFile: En,
890
- onModeChange: mr,
891
- auto: Sn ? {
892
- active: Cn,
893
- onSelect: pr
911
+ onDraftStart: Wn,
912
+ disabled: bn,
913
+ placeholder: L === "api-calls" ? j("chatArea.placeholderActions", "What would you like me to do?") : j("chatArea.placeholderGeneral", "Ask me anything…"),
914
+ mode: L,
915
+ writeAccessDenied: Vt === "denied" && !!Y?.writeCapable,
916
+ availableModes: Dn,
917
+ attachmentCharsPerFile: Mn,
918
+ onModeChange: xr,
919
+ auto: On ? {
920
+ active: kn,
921
+ onSelect: br
894
922
  } : void 0
895
923
  })
896
924
  ]
897
925
  }),
898
- kn && !$.active ? /* @__PURE__ */ k(at, {
926
+ Fn && !$.active ? /* @__PURE__ */ A(ot, {
899
927
  turns: Z,
900
- onClose: () => An(!1),
901
- onSave: nr,
902
- onContinueInChat: cr ? lr : void 0,
928
+ onClose: () => In(!1),
929
+ onSave: lr,
930
+ onContinueInChat: hr ? gr : void 0,
903
931
  closeOnEscape: !0
904
932
  }) : null,
905
- $.active && /* @__PURE__ */ k(lt, {
933
+ $.active && /* @__PURE__ */ A(ut, {
906
934
  session: $.session,
907
935
  notice: $.notice,
908
936
  capturing: $.capturing,
@@ -916,24 +944,24 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
916
944
  onRetryAttachment: Q.retry,
917
945
  canAttachMore: Q.canAddMore,
918
946
  preparingAttachments: Q.preparingCount,
919
- onSaveTranscript: nr,
920
- onContinueInChat: lr,
947
+ onSaveTranscript: lr,
948
+ onContinueInChat: gr,
921
949
  onInterrupt: () => {
922
- $.interrupt(), Hn();
950
+ $.interrupt(), Yn();
923
951
  },
924
- spoken: er,
952
+ spoken: sr,
925
953
  onToggleMute: $.toggleMute,
926
- onEnd: dr
954
+ onEnd: vr
927
955
  }),
928
- /* @__PURE__ */ k(At, {
929
- open: Dn !== null,
930
- mode: gr,
931
- currentMode: J ?? { id: R },
932
- onConfirm: hr,
933
- onCancel: _r
956
+ /* @__PURE__ */ A(Nt, {
957
+ open: Nn !== null,
958
+ mode: Cr,
959
+ currentMode: Y ?? { id: L },
960
+ onConfirm: Sr,
961
+ onCancel: wr
934
962
  })
935
963
  ]
936
964
  });
937
965
  };
938
966
  //#endregion
939
- export { Lt as AssistantChatArea };
967
+ export { Bt as AssistantChatArea };