@burdenoff/fe-libs 2026.1004.2 → 2026.1004.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/chrome/mobileTabBar/useVisibleNavItems.d.ts +9 -0
  2. package/dist/chrome/mobileTabBar/useVisibleNavItems.d.ts.map +1 -1
  3. package/dist/chrome/mobileTabBar/useVisibleNavItems.js +3 -1
  4. package/dist/shared/assistant/api.d.ts +6 -0
  5. package/dist/shared/assistant/api.d.ts.map +1 -1
  6. package/dist/shared/assistant/api.js +5 -3
  7. package/dist/shared/assistant/i18nManifest.d.ts +3 -0
  8. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  9. package/dist/shared/assistant/i18nManifest.js +3 -0
  10. package/dist/shared/assistant/index.d.ts +8 -0
  11. package/dist/shared/assistant/index.d.ts.map +1 -1
  12. package/dist/shared/assistant/localUiCommandCopy.d.ts +18 -0
  13. package/dist/shared/assistant/localUiCommandCopy.d.ts.map +1 -1
  14. package/dist/shared/assistant/localUiCommandCopy.js +22 -2
  15. package/dist/shared/assistant/localUiCommands.d.ts +63 -26
  16. package/dist/shared/assistant/localUiCommands.d.ts.map +1 -1
  17. package/dist/shared/assistant/localUiCommands.js +128 -59
  18. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  19. package/dist/shared/assistant/ui/AssistantChatArea.js +884 -750
  20. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +3 -34
  21. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts.map +1 -1
  22. package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +83 -119
  23. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +2 -1
  24. package/dist/shared/assistant/ui/composer/connectSource.js +2 -1
  25. package/dist/shared/assistant/uiActions/assistantHref.d.ts +36 -0
  26. package/dist/shared/assistant/uiActions/assistantHref.d.ts.map +1 -0
  27. package/dist/shared/assistant/uiActions/assistantHref.js +46 -0
  28. package/dist/shared/assistant/uiActions/deixis.d.ts +29 -0
  29. package/dist/shared/assistant/uiActions/deixis.d.ts.map +1 -0
  30. package/dist/shared/assistant/uiActions/deixis.js +54 -0
  31. package/dist/shared/assistant/uiActions/entityRoutes.d.ts +49 -0
  32. package/dist/shared/assistant/uiActions/entityRoutes.d.ts.map +1 -0
  33. package/dist/shared/assistant/uiActions/entityRoutes.js +53 -0
  34. package/dist/shared/assistant/uiActions/inAppLinks.d.ts +28 -0
  35. package/dist/shared/assistant/uiActions/inAppLinks.d.ts.map +1 -0
  36. package/dist/shared/assistant/uiActions/inAppLinks.js +51 -0
  37. package/dist/shared/assistant/uiActions/linkContext.d.ts +52 -0
  38. package/dist/shared/assistant/uiActions/linkContext.d.ts.map +1 -0
  39. package/dist/shared/assistant/uiActions/linkContext.js +60 -0
  40. package/dist/shared/assistant/uiActions/recordNames.d.ts +73 -0
  41. package/dist/shared/assistant/uiActions/recordNames.d.ts.map +1 -0
  42. package/dist/shared/assistant/uiActions/recordNames.js +75 -0
  43. package/dist/shared/assistant/uiActions/resolveTarget.d.ts +43 -0
  44. package/dist/shared/assistant/uiActions/resolveTarget.d.ts.map +1 -0
  45. package/dist/shared/assistant/uiActions/resolveTarget.js +49 -0
  46. package/dist/shared/assistant/uiActions/uiCatalogue.d.ts +30 -0
  47. package/dist/shared/assistant/uiActions/uiCatalogue.d.ts.map +1 -0
  48. package/dist/shared/assistant/uiActions/uiCatalogue.js +22 -0
  49. package/dist/shared/components/assistantWidget/MessageContent.js +4 -3
  50. package/dist/shared/tours/TourPlayerProvider.d.ts +12 -0
  51. package/dist/shared/tours/TourPlayerProvider.d.ts.map +1 -1
  52. package/dist/shared/tours/TourPlayerProvider.js +1 -1
  53. package/dist/shared/tours/tourTrigger/MobileTourSheet.d.ts.map +1 -1
  54. package/dist/shared/tours/tourTrigger/MobileTourSheet.js +16 -15
  55. package/dist/shared-assistant.js +198 -190
  56. package/package.json +3 -1
@@ -7,20 +7,20 @@ 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
9
  import { AUTO_READ_MODE as s, autoSuggestions as c, classifyAssistantIntent as l, escalationToUndo as u, isAutoRoutingOffered as d, resolveAutoRoute as f } from "../autoRouting.js";
10
- import { getHistoryStamp as p, setHistoryBusyProbe as ee } from "../history/stampRegistry.js";
11
- import { beginApprovalInFlight as m, endApprovalInFlight as h, getApprovalInFlight as te, markLiveTurn as ne, newestModelReplyId as re, resolveApprovablePendingWrite as g, resolveRetryableMessageId as _, subscribeApprovalInFlight as v } from "../liveTurns.js";
12
- import { isWriteModeAcknowledged as ie, writeModeSendRefusalReason as ae } from "../writeModeConsent.js";
13
- import { resolveActiveModeSandbox as y, useAssistantStore as b } from "../store.js";
14
- import { abortAssistantTurn as oe, approvePendingWrite as se, createAssistantSandbox as x, createAssistantSession as S, extendAssistantSandboxTTL as ce, findExistingSandboxWithStatus as le, getAssistantArtifacts as ue, getAssistantMessages as de, getAssistantSession as C, modeRequiresConfirmWrites as fe, promptGatewayRequestBytes as pe, releaseSupersededAssistantSandboxes as w, sendAssistantPromptAsync as me, waitForAssistantServiceReady as T, waitForSandboxRunning as he, writeApprovalModeOf as ge } from "../api.js";
15
- import { sanitize as _e } from "../progress.js";
16
- import { AssistantSendRefusal as ve, classifyTurnFailure as ye, turnConfirmsNoAction as be, turnOutcomeCopy as xe } from "../turnOutcome.js";
17
- import { assistantUsageLedger as Se, hasPendingUsageReports as Ce, reportUsageWithRetry as we, retryPendingUsageReports as Te, usageSendRefusal as Ee } from "../usageReporting.js";
18
- import { withIncompleteTurnNotice as De } from "../streamBudget.js";
19
- import { chatTurns as E, isVoiceTurn as Oe, voiceMarker as D, voiceSessionIdOf as ke } from "../voice/turnVisibility.js";
20
- import { speechFeed as Ae } from "../speech/speechFeed.js";
21
- import { buildContinuedFromVoiceNote as je, buildVoiceTranscriptMarkdown as Me, voiceTranscriptFilename as Ne } from "../voice/voiceTranscript.js";
22
- import { pollDelayMs as Pe } from "../voice/assistantPollSchedule.js";
23
- import { toCaptionText as Fe } from "../voice/captionText.js";
10
+ import { getHistoryStamp as p, setHistoryBusyProbe as m } from "../history/stampRegistry.js";
11
+ import { beginApprovalInFlight as h, endApprovalInFlight as g, getApprovalInFlight as ee, markLiveTurn as te, newestModelReplyId as ne, resolveApprovablePendingWrite as _, resolveRetryableMessageId as v, subscribeApprovalInFlight as y } from "../liveTurns.js";
12
+ import { isWriteModeAcknowledged as re, writeModeSendRefusalReason as ie } from "../writeModeConsent.js";
13
+ import { resolveActiveModeSandbox as ae, useAssistantStore as b } from "../store.js";
14
+ import { abortAssistantTurn as oe, approvePendingWrite as se, createAssistantSandbox as x, createAssistantSession as S, extendAssistantSandboxTTL as ce, findExistingSandboxWithStatus as le, getAssistantArtifacts as ue, getAssistantMessages as de, getAssistantSession as fe, modeRequiresConfirmWrites as pe, promptGatewayRequestBytes as me, releaseSupersededAssistantSandboxes as C, sendAssistantPromptAsync as he, waitForAssistantServiceReady as w, waitForSandboxRunning as ge, writeApprovalModeOf as _e } from "../api.js";
15
+ import { sanitize as ve } from "../progress.js";
16
+ import { AssistantSendRefusal as ye, classifyTurnFailure as be, turnConfirmsNoAction as xe, turnOutcomeCopy as Se } from "../turnOutcome.js";
17
+ import { assistantUsageLedger as Ce, hasPendingUsageReports as we, reportUsageWithRetry as Te, retryPendingUsageReports as Ee, usageSendRefusal as De } from "../usageReporting.js";
18
+ import { withIncompleteTurnNotice as Oe } from "../streamBudget.js";
19
+ import { chatTurns as T, isVoiceTurn as ke, voiceMarker as E, voiceSessionIdOf as Ae } from "../voice/turnVisibility.js";
20
+ import { speechFeed as je } from "../speech/speechFeed.js";
21
+ import { buildContinuedFromVoiceNote as Me, buildVoiceTranscriptMarkdown as Ne, voiceTranscriptFilename as Pe } from "../voice/voiceTranscript.js";
22
+ import { pollDelayMs as Fe } from "../voice/assistantPollSchedule.js";
23
+ import { toCaptionText as D } from "../voice/captionText.js";
24
24
  import { resolveAssistantLanguage as Ie } from "../voice/languages.js";
25
25
  import { resolveLanguagePair as Le } from "../voice/languagePair.js";
26
26
  import { INITIAL_TRANSCRIPT_AUTO_OPEN as Re, isAwaitingOwnConversation as ze, maySendSpokenTurn as Be, planTranscriptAutoOpen as Ve, planVoiceSessionBinding as He, planVoiceSessionStart as Ue, planVoiceSpokenEntry as We, voiceBindingAtStart as Ge, voiceBindingConversationId as Ke } from "../voice/voiceReopen.js";
@@ -67,110 +67,115 @@ import { useAssistantApiAccess as gn } from "../useAssistantApiAccess.js";
67
67
  import { useConversationTurns as _n } from "../useConversationTurns.js";
68
68
  import { sendAssistantTurnTimings as vn, startTurnTimingReporting as yn } from "../turnTimingReporter.js";
69
69
  import { QuarantineSet as bn, WarmCancelled as xn, claimPreopenedSession as Sn, consumeWarm as Cn, preopenKey as wn, preopenWanted as Tn, prewarmTarget as En, settleWarmBeforeSend as Dn, startPreopen as On, startWarm as kn, warmState as An } from "../prewarm.js";
70
- import { isAlreadyThere as jn, matchLocalUiCommand as Mn, navDestinations as Nn, planThemeChange as Pn } from "../localUiCommands.js";
71
- import { backDoneCopy as Fn, chooseDestinationCopy as In, navigationCommandCopy as Ln, navigationOutcomeCopy as Rn, themeCommandCopy as zn } from "../localUiCommandCopy.js";
72
- import { runNavigation as Bn } from "../uiActions/navigationOutcome.js";
73
- import { assistantBackStack as Vn, isBackRunnable as Hn } from "../uiActions/backStack.js";
74
- import { buildNavigateAction as Un, destinationForPath as Wn, labelForPath as Gn, newestAssistantOnSurface as Kn } from "../uiActions/navigateAction.js";
75
- import { dispatchAssistantQuotaExhausted as qn, notifyAiCreditsUpdated as Jn } from "../aiCredits.js";
76
- import { useAssistantAttachments as Yn } from "../useAssistantAttachments.js";
77
- import { AssistantComposer as Xn } from "./composer/AssistantComposer.js";
78
- import { isProdRuntime as Zn } from "../env.js";
79
- import { AssistantApiCallsConsentDialog as Qn } from "./AssistantApiCallsConsentDialog.js";
80
- import { useVisibleNavItems as $n } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
81
- import { useCallback as j, useEffect as M, useMemo as er, useRef as N, useState as tr, useSyncExternalStore as nr } from "react";
82
- import { jsx as P, jsxs as rr } from "react/jsx-runtime";
70
+ import { isThereRequest as jn, parseChoice as Mn } from "../uiActions/deixis.js";
71
+ import { navEntryIds as Nn } from "../uiActions/resolveTarget.js";
72
+ import { planRecordResolution as Pn } from "../uiActions/recordNames.js";
73
+ import { isAlreadyThere as Fn, matchLocalUiCommand as In, navDestinations as Ln, normaliseUtterance as Rn, planThemeChange as zn } from "../localUiCommands.js";
74
+ import { backDoneCopy as Bn, chooseDestinationCopy as Vn, chooseLinkedCopy as Hn, entityNounText as Un, linkNotOpenableCopy as Wn, navigationCommandCopy as Gn, navigationOutcomeCopy as Kn, pickFromListCopy as qn, recordChoiceCopy as Jn, recordKindsCopy as Yn, themeCommandCopy as Xn } from "../localUiCommandCopy.js";
75
+ import { runNavigation as Zn } from "../uiActions/navigationOutcome.js";
76
+ import { assistantBackStack as Qn, isBackRunnable as $n } from "../uiActions/backStack.js";
77
+ import { buildNavigateAction as er, destinationForPath as tr, labelForPath as nr, newestAssistantOnSurface as rr } from "../uiActions/navigateAction.js";
78
+ import { buildNavigationContext as ir, latestReplyOnSurface as ar, rememberPresentedList as or } from "../uiActions/linkContext.js";
79
+ import { buildUiCatalogue as sr } from "../uiActions/uiCatalogue.js";
80
+ import { dispatchAssistantQuotaExhausted as cr, notifyAiCreditsUpdated as lr } from "../aiCredits.js";
81
+ import { useAssistantAttachments as ur } from "../useAssistantAttachments.js";
82
+ import { AssistantComposer as dr } from "./composer/AssistantComposer.js";
83
+ import { isProdRuntime as fr } from "../env.js";
84
+ import { AssistantApiCallsConsentDialog as pr } from "./AssistantApiCallsConsentDialog.js";
85
+ import { useVisibleNavItems as mr } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
86
+ import { useCallback as j, useEffect as M, useMemo as hr, useRef as N, useState as gr, useSyncExternalStore as _r } from "react";
87
+ import { jsx as P, jsxs as vr } from "react/jsx-runtime";
83
88
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
84
- var ir = 600, ar = 2e4, or = 1e4, sr = 6e3;
89
+ var yr = 2500, br = 600, xr = 2e4, Sr = 1e4, Cr = 6e3;
85
90
  function F() {
86
91
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
87
92
  }
88
- var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
89
- let I = i(), { product: L, modes: R, gatherPageContext: ur, buildPrompt: dr, reportTurnTimings: fr, reportTokenUsage: pr, localUiCommands: mr } = r(), z = ge(r().writeApproval), hr = j((e, t) => {
93
+ var wr = ({ visible: wr = !0, writeAccess: Tr = "unknown" }) => {
94
+ let I = i(), { product: L, modes: R, gatherPageContext: Er, buildPrompt: Dr, reportTurnTimings: Or, reportTokenUsage: kr, localUiCommands: Ar } = r(), z = _e(r().writeApproval), jr = j((e, t) => {
90
95
  let n = b.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
91
96
  return et({
92
97
  mode: e,
93
98
  productWriteApproval: z,
94
99
  capabilities: r ? n.sandboxWriteCapabilities[r] : null
95
100
  });
96
- }, [z]), { getAccessToken: B, getWorkspaceToken: gr, userId: V } = n(), { locale: H } = t(), _r = b((e) => e.assistantLanguage), vr = b((e) => e.replyLanguage), yr = er(() => Le(_r, vr, H), [
97
- _r,
98
- vr,
101
+ }, [z]), { getAccessToken: B, getWorkspaceToken: Mr, userId: V } = n(), { locale: H } = t(), Nr = b((e) => e.assistantLanguage), Pr = b((e) => e.replyLanguage), Fr = hr(() => Le(Nr, Pr, H), [
102
+ Nr,
103
+ Pr,
99
104
  H
100
- ]), br = yr.reply.english, xr = yr.replyIsExplicit, Sr = yr.reply.code, { conversations: Cr, activeConversationId: U, mode: W, processingByConversationId: wr, setMode: Tr, setConversationMode: Er, setActiveConversation: Dr, createConversation: G, addMessage: K, updateMessage: Or, patchMessage: kr, mergeMessageMetadata: Ar, setConversationProcessing: jr, clearConversationProcessing: Mr, setBackendSessionId: Nr, clearBackendSessionId: Pr, setSandbox: Fr, clearSandbox: Ir, acknowledgedWriteModes: Lr, acknowledgeWriteMode: Rr, autoRouting: zr, setAutoRouting: Br, routeConversation: Vr } = b(), Hr = Cr.find((e) => e.id === U), Ur = _n(Hr), Wr = Ur.all, q = U ? wr[U] : void 0, Gr = ut(q?.status), Kr = Gr ? q?.messageId ?? null : null, qr = q?.status === "error" ? q.messageId : null, Jr = b((e) => e.sandboxWriteCapabilities), { panel: J, entries: Yr, retiredSandboxes: Xr } = Gt({
105
+ ]), Ir = Fr.reply.english, Lr = Fr.replyIsExplicit, Rr = Fr.reply.code, { conversations: zr, activeConversationId: U, mode: W, processingByConversationId: Br, setMode: Vr, setConversationMode: Hr, setActiveConversation: Ur, createConversation: G, addMessage: K, updateMessage: Wr, patchMessage: Gr, mergeMessageMetadata: Kr, setConversationProcessing: qr, clearConversationProcessing: Jr, setBackendSessionId: Yr, clearBackendSessionId: Xr, setSandbox: Zr, clearSandbox: Qr, acknowledgedWriteModes: $r, acknowledgeWriteMode: ei, autoRouting: ti, setAutoRouting: ni, routeConversation: ri } = b(), ii = zr.find((e) => e.id === U), ai = _n(ii), oi = ai.all, q = U ? Br[U] : void 0, si = ut(q?.status), ci = si ? q?.messageId ?? null : null, li = q?.status === "error" ? q.messageId : null, ui = b((e) => e.sandboxWriteCapabilities), { panel: J, entries: di, retiredSandboxes: fi } = Gt({
101
106
  tr: I,
102
107
  productWriteApproval: z
103
- }), Zr = zt({
108
+ }), pi = zt({
104
109
  approve: (e, t) => J.approve(e, t),
105
110
  decline: (e, t, n) => J.decline(e, t, n),
106
111
  presented: (e, t) => J.presented(e, t)
107
- }), Qr = Zr.dismiss, $r = N(null);
112
+ }), mi = pi.dismiss, hi = N(null);
108
113
  M(() => {
109
- Qr();
110
- let e = $r.current;
111
- $r.current = U, e && e !== U && J.withdraw(e, "conversation_closed"), U && J.openConversation(U);
114
+ mi();
115
+ let e = hi.current;
116
+ hi.current = U, e && e !== U && J.withdraw(e, "conversation_closed"), U && J.openConversation(U);
112
117
  }, [
113
118
  U,
114
119
  J,
115
- Qr
120
+ mi
116
121
  ]);
117
- let ei = nn(Hr), ti = pn(Hr)?.archivedAt != null, ni = an((e) => U !== null && U in e.loadingIds), ri = an((e) => U !== null && U in e.loadErrorIds), ii = an((e) => e.remoteDelete), [ai, oi] = tr(() => an.getState().remoteDelete?.at ?? null), si = ii?.wasActive === !0 && ii.at !== ai ? ii.at : null;
122
+ let gi = nn(ii), _i = pn(ii)?.archivedAt != null, vi = an((e) => U !== null && U in e.loadingIds), yi = an((e) => U !== null && U in e.loadErrorIds), bi = an((e) => e.remoteDelete), [xi, Si] = gr(() => an.getState().remoteDelete?.at ?? null), Ci = bi?.wasActive === !0 && bi.at !== xi ? bi.at : null;
118
123
  M(() => {
119
- if (si === null) return;
120
- let e = window.setTimeout(() => oi(si), or);
124
+ if (Ci === null) return;
125
+ let e = window.setTimeout(() => Si(Ci), Sr);
121
126
  return () => window.clearTimeout(e);
122
- }, [si]);
123
- let { canUseApiCalls: ci, loading: li } = gn(A(), V), ui = N(st({
124
- loading: li,
125
- canUseAdminModes: ci
126
- })).current, di = N(R);
127
+ }, [Ci]);
128
+ let { canUseApiCalls: wi, loading: Ti } = gn(A(), V), Ei = N(st({
129
+ loading: Ti,
130
+ canUseAdminModes: wi
131
+ })).current, Di = N(R);
127
132
  M(() => {
128
- di.current = R;
133
+ Di.current = R;
129
134
  }, [R]);
130
- let fi = () => {
135
+ let Oi = () => {
131
136
  let e = b.getState().activeConversationId;
132
- e && on.openConversation(e, { modes: di.current });
133
- }, pi = () => {
137
+ e && on.openConversation(e, { modes: Di.current });
138
+ }, ki = () => {
134
139
  let e = b.getState().activeConversationId;
135
140
  e && on.loadEarlier(e);
136
- }, mi = N(B);
141
+ }, Ai = N(B);
137
142
  M(() => {
138
- mi.current = B;
143
+ Ai.current = B;
139
144
  }, [B]);
140
- let hi = !!L && fr !== !1;
145
+ let ji = !!L && Or !== !1;
141
146
  M(() => {
142
- if (hi) return yn({ send: (e) => vn(e, {
147
+ if (ji) return yn({ send: (e) => vn(e, {
143
148
  workspaceId: A(),
144
149
  authContext: {
145
- accessToken: mi.current(),
150
+ accessToken: Ai.current(),
146
151
  organizationId: At()
147
152
  }
148
153
  }) });
149
- }, [hi]), M(() => {
150
- ui.update({
151
- loading: li,
152
- canUseAdminModes: ci
154
+ }, [ji]), M(() => {
155
+ Ei.update({
156
+ loading: Ti,
157
+ canUseAdminModes: wi
153
158
  });
154
159
  }, [
155
- ui,
156
- li,
157
- ci
160
+ Ei,
161
+ Ti,
162
+ wi
158
163
  ]), M(() => () => {
159
- ui.abandon();
160
- }, [ui]);
161
- let gi = er(() => R.filter((e) => !e.requiresAdmin || ci), [R, ci]), _i = d(gi), vi = zr && _i, yi = N(_i);
164
+ Ei.abandon();
165
+ }, [Ei]);
166
+ let Mi = hr(() => R.filter((e) => !e.requiresAdmin || wi), [R, wi]), Ni = d(Mi), Pi = ti && Ni, Fi = N(Ni);
162
167
  M(() => {
163
- yi.current = _i;
164
- }, [_i]);
165
- let bi = N(null), xi = N(!1), Si = Xe(R), [Ci, wi] = tr(null), [Ti, Ei] = tr(null), Di = Ti !== null && Ti === U, Oi = j((e) => {
166
- Ei(e ? b.getState().activeConversationId : null);
168
+ Fi.current = Ni;
169
+ }, [Ni]);
170
+ let Ii = N(null), Li = N(!1), Ri = Xe(R), [zi, Bi] = gr(null), [Vi, Hi] = gr(null), Ui = Vi !== null && Vi === U, Wi = j((e) => {
171
+ Hi(e ? b.getState().activeConversationId : null);
167
172
  }, []);
168
173
  M(() => {
169
- Ei((e) => e !== null && e !== U ? null : e);
174
+ Hi((e) => e !== null && e !== U ? null : e);
170
175
  }, [U]);
171
- let ki = N(void 0), [Ai, ji] = tr(!1), Mi = j((e) => {
172
- ki.current = e, ji(ze(e));
173
- }, []), Ni = j(() => {
176
+ let Gi = N(void 0), [Ki, qi] = gr(!1), Ji = j((e) => {
177
+ Gi.current = e, qi(ze(e));
178
+ }, []), Yi = j(() => {
174
179
  let e = b.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
175
180
  return !t || !n ? null : {
176
181
  id: t,
@@ -178,121 +183,121 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
178
183
  liveProposals: J.liveFor(t).count,
179
184
  turnInFlight: ut(e.processingByConversationId[t]?.status)
180
185
  };
181
- }, [J]), Pi = N({}), Y = N(Nt()), X = N(new bn()), Fi = N(/* @__PURE__ */ new Set()), Ii = er(() => R.find((e) => e.id === W), [R, W]), Li = b((e) => {
186
+ }, [J]), Xi = N({}), Y = N(Nt()), X = N(new bn()), Zi = N(/* @__PURE__ */ new Set()), Qi = hr(() => R.find((e) => e.id === W), [R, W]), $i = b((e) => {
182
187
  let t = e.sandboxesByMode[W]?.sandboxId;
183
188
  return t ? e.sandboxWriteCapabilities[t] : void 0;
184
- }), Ri = Ii !== void 0 && et({
189
+ }), ea = Qi !== void 0 && et({
185
190
  mode: W,
186
191
  productWriteApproval: z,
187
- capabilities: Li
188
- }), zi = W === "assistant" || Ii !== void 0 && !Ii.writeCapable && !fe(W) || Ri;
192
+ capabilities: $i
193
+ }), ta = W === "assistant" || Qi !== void 0 && !Qi.writeCapable && !pe(W) || ea;
189
194
  M(() => {
190
- if (W !== "assistant" && Ii?.writeCapable && !ie(Lr, W)) {
191
- Tr("assistant");
195
+ if (W !== "assistant" && Qi?.writeCapable && !re($r, W)) {
196
+ Vr("assistant");
192
197
  return;
193
198
  }
194
- li || (!Ii || Ii.requiresAdmin && !ci) && W !== "assistant" && Tr("assistant");
199
+ Ti || (!Qi || Qi.requiresAdmin && !wi) && W !== "assistant" && Vr("assistant");
195
200
  }, [
196
201
  W,
197
- Ii,
198
- ci,
199
- li,
200
- Tr,
201
- Lr
202
+ Qi,
203
+ wi,
204
+ Ti,
205
+ Vr,
206
+ $r
202
207
  ]);
203
- let Bi = j((e, t, n, r) => {
204
- jr(e, n, t, null, r);
205
- }, [jr]), Vi = j(async (e, t, n, r, i, a = null) => {
208
+ let na = j((e, t, n, r) => {
209
+ qr(e, n, t, null, r);
210
+ }, [qr]), ra = j(async (e, t, n, r, i, a = null) => {
206
211
  let s = (e, t) => {
207
- r && Bi(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
212
+ r && na(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
208
213
  }, c = (e) => {
209
214
  r && k(r.assistantMessageId, e);
210
215
  }, l = () => {
211
216
  c("bootAdopted"), a?.beginBoot();
212
217
  }, u = () => a !== null && (a.signal.aborted || A() !== t), d = () => {
213
218
  if (u()) throw new xn("cancelled");
214
- }, f = b.getState().sandboxesByMode[e]?.sandboxId ?? null, p = !1, ee = !1, m = !1, h = !1, te = !1, ne = async (r) => {
219
+ }, f = b.getState().sandboxesByMode[e]?.sandboxId ?? null, p = !1, m = !1, h = !1, g = !1, ee = !1, te = async (r) => {
215
220
  if (i && !X.current.has(r) && Y.current.isFresh(r)) return p = !0, !0;
216
- m = !0;
221
+ h = !0;
217
222
  let o = !1;
218
223
  try {
219
- await he(r, t, n, 3e5), await T(r, t, e, n, 9e4, () => {
224
+ await ge(r, t, n, 3e5), await w(r, t, e, n, 9e4, () => {
220
225
  o = !0, l();
221
226
  });
222
227
  } catch {
223
228
  if (u()) throw new xn("cancelled");
224
- return Y.current.invalidate(r), X.current.add(r), a?.dead.push(r), te = !0, !1;
229
+ return Y.current.invalidate(r), X.current.add(r), a?.dead.push(r), ee = !0, !1;
225
230
  }
226
- return d(), Y.current.markVerified(r), o && (h = !0), !0;
231
+ return d(), Y.current.markVerified(r), o && (g = !0), !0;
227
232
  };
228
- if (f && (Fr(e, f, "provisioning"), s("provisioning", "reusingEnvironment"), await ne(f) || (Fr(e, null, "provisioning"), f = null)), !f) {
233
+ if (f && (Zr(e, f, "provisioning"), s("provisioning", "reusingEnvironment"), await te(f) || (Zr(e, null, "provisioning"), f = null)), !f) {
229
234
  s("provisioning", "lookingForEnvironment");
230
- let r = await le(t, L, e, Zn(), n, X.current, z);
235
+ let r = await le(t, L, e, fr(), n, X.current, z);
231
236
  d();
232
237
  let i = r?.id ?? null;
233
238
  if (i) {
234
- Fr(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
239
+ Zr(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
235
240
  let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
236
- t && l(), await ne(i) ? (f = i, t && (h = !0)) : Fr(e, null, "provisioning");
241
+ t && l(), await te(i) ? (f = i, t && (g = !0)) : Zr(e, null, "provisioning");
237
242
  }
238
243
  }
239
244
  if (!f) {
240
245
  if (a && !a.mayCreate) throw new xn("no-create");
241
246
  if (c("provisionStarted"), e === "api-calls" && !B()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
242
- s("provisioning", "startingEnvironment"), Fr(e, null, "provisioning");
243
- let r = a ? [] : await w(t, L, e, Zn(), n, X.current, z);
247
+ s("provisioning", "startingEnvironment"), Zr(e, null, "provisioning");
248
+ let r = a ? [] : await C(t, L, e, fr(), n, X.current, z);
244
249
  if (r.length > 0) {
245
250
  let e = new Set(r);
246
251
  for (let e of r) Y.current.invalidate(e), X.current.add(e);
247
252
  let t = b.getState().sandboxesByMode;
248
- for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && Ir(n);
253
+ for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && Qr(n);
249
254
  }
250
255
  c("createRequested");
251
256
  let i = a?.beginCreate();
252
257
  try {
253
- f = await x(L, e, t, Zn(), ir, n, { writeApproval: z });
258
+ f = await x(L, e, t, fr(), br, n, { writeApproval: z });
254
259
  } finally {
255
260
  i?.();
256
261
  }
257
- ee = !0, d(), Fr(e, f, "provisioning"), await he(f, t, n, 3e5), d(), c("sandboxRunning"), await T(f, t, e, n, 9e4), d(), c("serviceReady"), Y.current.markVerified(f);
262
+ m = !0, d(), Zr(e, f, "provisioning"), await ge(f, t, n, 3e5), d(), c("sandboxRunning"), await w(f, t, e, n, 9e4), d(), c("serviceReady"), Y.current.markVerified(f);
258
263
  }
259
- return Fr(e, f, "running"), {
264
+ return Zr(e, f, "running"), {
260
265
  sandboxId: f,
261
- sandboxIsNew: ee,
262
- sandboxProbed: m,
263
- sandboxAdopted: h,
264
- deadSandboxProbe: te,
266
+ sandboxIsNew: m,
267
+ sandboxProbed: h,
268
+ sandboxAdopted: g,
269
+ deadSandboxProbe: ee,
265
270
  trustedFromCache: p
266
271
  };
267
272
  }, [
268
- Ir,
273
+ Qr,
269
274
  B,
270
275
  L,
271
276
  z,
272
- Fr,
273
- Bi
274
- ]), Hi = j(async function e(t, n, r, i, a, o = {}) {
275
- let s = await Dn(i, r, (e) => Bi(t, n, "provisioning", e), () => k(n, "prewarmJoined"));
277
+ Zr,
278
+ na
279
+ ]), ia = j(async function e(t, n, r, i, a, o = {}) {
280
+ let s = await Dn(i, r, (e) => na(t, n, "provisioning", e), () => k(n, "prewarmJoined"));
276
281
  for (let e of s.dead) Y.current.invalidate(e), X.current.add(e);
277
282
  s.verified && !X.current.has(s.verified) && Y.current.markVerified(s.verified), s.joined && O(n, { prewarm: s.joined });
278
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await Vi(r, i, a, {
283
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await ra(r, i, a, {
279
284
  conversationId: t,
280
285
  assistantMessageId: n
281
- }, o.trustCache !== !1), ee = Cn(i, r, c);
282
- !s.waited && ee && O(n, { prewarm: "hit" });
283
- let m = b.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, h = !1, te = null;
284
- if (m) {
285
- let e = vt(c, m, (e, t) => de(e, i, t, r, a, { limit: 50 }));
286
+ }, o.trustCache !== !1), m = Cn(i, r, c);
287
+ !s.waited && m && O(n, { prewarm: "hit" });
288
+ let h = b.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, g = !1, ee = null;
289
+ if (h) {
290
+ let e = vt(c, h, (e, t) => de(e, i, t, r, a, { limit: 50 }));
286
291
  try {
287
- let t = await C(c, i, m, r, a);
292
+ let t = await fe(c, i, h, r, a);
288
293
  if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
289
- te = e;
294
+ ee = e;
290
295
  } catch {
291
- Pr(t), m = null;
296
+ Xr(t), h = null;
292
297
  }
293
298
  }
294
- let ne = !1;
295
- if (!m) {
299
+ let te = !1;
300
+ if (!h) {
296
301
  let e = Sn(wn({
297
302
  workspaceId: i,
298
303
  mode: r,
@@ -300,15 +305,15 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
300
305
  userId: V
301
306
  }), Date.now());
302
307
  if (e) {
303
- "pending" in e && Bi(t, n, "connecting", "preparingSession");
308
+ "pending" in e && na(t, n, "connecting", "preparingSession");
304
309
  let o = "sessionId" in e ? e.sessionId : await e.pending;
305
310
  if (o && !X.current.has(c)) try {
306
- (await C(c, i, o, r, a)).mode === r && (m = o, ne = !0, Nr(t, m), h = !0);
311
+ (await fe(c, i, o, r, a)).mode === r && (h = o, te = !0, Yr(t, h), g = !0);
307
312
  } catch {}
308
313
  }
309
314
  }
310
- if (!m) {
311
- Bi(t, n, "connecting", "preparingSession");
315
+ if (!h) {
316
+ na(t, n, "connecting", "preparingSession");
312
317
  let s;
313
318
  try {
314
319
  s = await S(c, i, r, a);
@@ -316,8 +321,8 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
316
321
  if (p) {
317
322
  Y.current.invalidate(c);
318
323
  let l = Ft(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
319
- if (l === "check-network" && (l = await Pt(() => le(i, L, r, Zn(), a, X.current, z))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
320
- p || O(n, { cacheProofFailed: !0 }), l === "replace" && (X.current.add(c), Pr(t), Ir(r), J.retireSandbox(c));
324
+ if (l === "check-network" && (l = await Pt(() => le(i, L, r, fr(), a, X.current, z))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
325
+ p || O(n, { cacheProofFailed: !0 }), l === "replace" && (X.current.add(c), Xr(t), Qr(r), J.retireSandbox(c));
321
326
  let s = await e(t, n, r, i, a, {
322
327
  ...o,
323
328
  trustCache: !1
@@ -332,43 +337,43 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
332
337
  }
333
338
  throw s;
334
339
  }
335
- m = s.sessionId, Nr(t, m), h = !0;
340
+ h = s.sessionId, Yr(t, h), g = !0;
336
341
  }
337
342
  return {
338
343
  sandboxId: c,
339
- sessionId: m,
340
- sessionIsNew: h,
341
- readAhead: te,
344
+ sessionId: h,
345
+ sessionIsNew: g,
346
+ readAhead: ee,
342
347
  sandboxIsNew: l,
343
348
  sandboxProbed: u,
344
349
  sandboxAdopted: d,
345
350
  deadSandboxProbe: f,
346
- sessionPreopened: ne
351
+ sessionPreopened: te
347
352
  };
348
353
  }, [
349
- Vi,
350
- Pr,
351
- Ir,
354
+ ra,
355
+ Xr,
356
+ Qr,
352
357
  L,
353
358
  z,
354
- Nr,
355
- Bi,
359
+ Yr,
360
+ na,
356
361
  V,
357
362
  J
358
- ]), Ui = j((e, t = !1) => {
363
+ ]), aa = j((e, t = !1) => {
359
364
  let n = A();
360
365
  if (!n) return;
361
366
  let r = b.getState(), i = Date.now(), a = En({
362
367
  autoRouting: r.autoRouting,
363
- autoOffered: yi.current,
368
+ autoOffered: Fi.current,
364
369
  active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
365
370
  selectedMode: r.mode,
366
371
  autoReadMode: s,
367
- modes: di.current,
372
+ modes: Di.current,
368
373
  acknowledgedWriteModes: r.acknowledgedWriteModes,
369
- adminAccess: ui.read(),
374
+ adminAccess: Ei.read(),
370
375
  dictated: e,
371
- voiceProposalBound: (e) => hr(e),
376
+ voiceProposalBound: (e) => jr(e),
372
377
  turnInFlight: Object.values(r.processingByConversationId).some((e) => ut(e?.status)),
373
378
  ...An(n),
374
379
  now: i
@@ -376,11 +381,11 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
376
381
  if (!a) return;
377
382
  let o = kn(n, a, i), c = {
378
383
  accessToken: B(),
379
- workspaceToken: gr(),
384
+ workspaceToken: Mr(),
380
385
  userId: V,
381
386
  organizationId: At()
382
387
  };
383
- Vi(a.mode, n, c, null, !0, o).then((e) => {
388
+ ra(a.mode, n, c, null, !0, o).then((e) => {
384
389
  if (o.finish({
385
390
  ok: !0,
386
391
  sandboxId: e.sandboxId,
@@ -406,7 +411,7 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
406
411
  }, (e) => {
407
412
  if (!(e instanceof xn) && !o.signal.aborted && A() === n) {
408
413
  let e = b.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
409
- e && (Y.current.invalidate(e), X.current.add(e), o.dead.push(e), Ir(a.mode));
414
+ e && (Y.current.invalidate(e), X.current.add(e), o.dead.push(e), Qr(a.mode));
410
415
  }
411
416
  o.finish({
412
417
  ok: !1,
@@ -416,60 +421,60 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
416
421
  });
417
422
  });
418
423
  }, [
419
- Vi,
420
- ui,
421
- Ir,
424
+ ra,
425
+ Ei,
426
+ Qr,
422
427
  B,
423
- gr,
428
+ Mr,
424
429
  V,
425
- hr
426
- ]), Wi = j(() => Ui(!1), [Ui]), Gi = nr(v, te, te)?.reference ?? null, [Ki, qi] = tr(0), Ji = N(/* @__PURE__ */ new Set()), Yi = N(null), Xi = j(() => {
430
+ jr
431
+ ]), oa = j(() => aa(!1), [aa]), sa = _r(y, ee, ee)?.reference ?? null, [ca, la] = gr(0), ua = N(/* @__PURE__ */ new Set()), da = N(null), fa = j(() => {
427
432
  let e = b.getState(), t = e.activeConversationId;
428
433
  if (!t) return;
429
434
  let n = e.processingByConversationId[t], r = ut(n?.status) ? n?.messageId ?? null : null;
430
435
  if (!ft({
431
436
  interruptedTurnId: r,
432
437
  activeTurnId: r,
433
- alreadyRequested: r ? Ji.current.has(r) : !1
438
+ alreadyRequested: r ? ua.current.has(r) : !1
434
439
  }).send || !r) return;
435
- Ji.current.add(r);
436
- let i = y(e), a = A(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
440
+ ua.current.add(r);
441
+ let i = ae(e), a = A(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
437
442
  !i || !a || !o || oe(i.sandboxId, a, o, i.mode, {
438
443
  accessToken: B(),
439
- workspaceToken: gr(),
444
+ workspaceToken: Mr(),
440
445
  userId: V,
441
446
  organizationId: At()
442
447
  });
443
448
  }, [
444
449
  V,
445
450
  B,
446
- gr
447
- ]), Zi = j(async (e) => {
448
- let t = b.getState(), n = y(t), r = A(), i = t.activeConversationId;
451
+ Mr
452
+ ]), pa = j(async (e) => {
453
+ let t = b.getState(), n = ae(t), r = A(), i = t.activeConversationId;
449
454
  if (!n || !r || !i || Ht(t.sandboxWriteCapabilities[n.sandboxId])) return;
450
- let a = t.conversations.find((e) => e.id === i), o = a ? g(E(a.messages), {
455
+ let a = t.conversations.find((e) => e.id === i), o = a ? _(T(a.messages), {
451
456
  sessionId: a.backendSessionId,
452
457
  sandboxId: n.sandboxId,
453
458
  nowMs: Date.now()
454
459
  }) : null;
455
460
  if (o?.reference !== e) {
456
- qi((e) => e + 1);
461
+ la((e) => e + 1);
457
462
  return;
458
463
  }
459
464
  let s = {
460
465
  conversationId: i,
461
466
  reference: e
462
467
  };
463
- if (!m(s)) return;
468
+ if (!h(s)) return;
464
469
  try {
465
470
  await se(n.sandboxId, r, e, n.mode, {
466
471
  accessToken: B(),
467
- workspaceToken: gr(),
472
+ workspaceToken: Mr(),
468
473
  userId: V,
469
474
  organizationId: At()
470
475
  });
471
476
  } catch (e) {
472
- h(s), K(i, {
477
+ g(s), K(i, {
473
478
  id: F(),
474
479
  role: "system",
475
480
  content: e instanceof Error ? e.message : "The change could not be approved.",
@@ -477,69 +482,97 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
477
482
  });
478
483
  return;
479
484
  }
480
- h(s), Ar(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
485
+ g(s), Kr(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
481
486
  let c = b.getState(), l = c.conversations.find((e) => e.id === i);
482
- c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || y(c)?.sandboxId !== n.sandboxId || ut(c.processingByConversationId[i]?.status) || re(E(l.messages)) !== o.messageId || Ca.current(I("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
487
+ c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || ae(c)?.sandboxId !== n.sandboxId || ut(c.processingByConversationId[i]?.status) || ne(T(l.messages)) !== o.messageId || Va.current(I("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
483
488
  approvalFollowUp: { approvedReplyId: o.messageId },
484
489
  targetConversationId: i
485
490
  });
486
491
  }, [
487
492
  V,
488
493
  K,
489
- Ar,
494
+ Kr,
490
495
  I
491
- ]), Qi = e(), { speakFinishedReply: $i } = Ot(), ea = a(), { items: ta } = $n(), na = N({
492
- theme: Qi,
493
- navigate: ea,
494
- navItems: ta,
495
- options: mr ?? {}
496
+ ]), ma = e(), { speakFinishedReply: ha } = Ot(), ga = a(), { items: _a, permissionsSettled: va, simulating: ya } = mr(), ba = N({
497
+ theme: ma,
498
+ navigate: ga,
499
+ navItems: _a,
500
+ options: Ar ?? {},
501
+ navPermissionsSettled: va,
502
+ navSimulating: ya
496
503
  });
497
504
  M(() => {
498
- na.current = {
499
- theme: Qi,
500
- navigate: ea,
501
- navItems: ta,
502
- options: mr ?? {}
505
+ ba.current = {
506
+ theme: ma,
507
+ navigate: ga,
508
+ navItems: _a,
509
+ options: Ar ?? {},
510
+ navPermissionsSettled: va,
511
+ navSimulating: ya
503
512
  };
504
513
  }, [
505
- Qi,
506
- ea,
507
- ta,
508
- mr
514
+ ma,
515
+ ga,
516
+ _a,
517
+ Ar,
518
+ va,
519
+ ya
509
520
  ]);
510
- let ra = N(!0);
511
- M(() => (ra.current = !0, () => {
512
- ra.current = !1;
521
+ let xa = N(!0);
522
+ M(() => (xa.current = !0, () => {
523
+ xa.current = !1;
513
524
  }), []);
514
- let ia = N(null), [aa, oa] = tr(!1), sa = j((e) => {
525
+ let Sa = N(null), [Ca, wa] = gr(!1), Ta = j((e) => {
515
526
  let t = b.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
516
- return n ? Hn(Vn, window.location.pathname, Kn(n.messages, e)) : !1;
517
- }, []), ca = j((e, t) => {
518
- let { navItems: n, options: r } = na.current;
519
- return Mn(e, Nn(n), {
520
- ...r,
521
- locale: t === void 0 ? H : yr.input.code
522
- }, { backRunnable: sa(t) });
527
+ return n ? $n(Qn, window.location.pathname, rr(n.messages, e)) : !1;
528
+ }, []), Ea = j((e, t, n = !1) => {
529
+ let { navItems: r, options: i } = ba.current, a = Ln(r), o = null, s = Rn(e);
530
+ if (jn(s) || Mn(s) !== null) {
531
+ let e = b.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? ar(n.messages, t) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && ut(c.status);
532
+ n && s && !l && (o = ir({
533
+ reply: s,
534
+ text: Ct(s, c, I),
535
+ resolve: {
536
+ destinations: a,
537
+ entityRoutes: i.entityRoutes,
538
+ visibleNavIds: Nn(r),
539
+ nounLabel: (e) => Un(I, e)
540
+ }
541
+ }));
542
+ }
543
+ return In(e, a, {
544
+ ...i,
545
+ locale: t === void 0 ? H : Fr.input.code
546
+ }, {
547
+ backRunnable: Ta(t),
548
+ navigation: o,
549
+ skipRecords: n
550
+ });
523
551
  }, [
524
- sa,
525
- yr,
526
- H
527
- ]), la = j((e, t) => {
528
- let n = ca(e, t);
552
+ Ta,
553
+ Fr,
554
+ H,
555
+ I
556
+ ]), Da = j((e, t) => {
557
+ let n = Ea(e, t);
529
558
  if (!n) return !1;
530
- let { theme: r, navigate: i } = na.current;
559
+ let { theme: r, navigate: i } = ba.current;
531
560
  switch (n.kind) {
532
561
  case "theme": return r !== null;
533
562
  case "navigate":
534
563
  case "choose-destination":
564
+ case "choose-linked":
565
+ case "pick-from-list":
566
+ case "link-not-openable":
535
567
  case "back": return i !== null;
536
568
  case "conversation-delete": return !1;
569
+ case "open-record": return !1;
537
570
  }
538
- }, [ca]), ua = N(la);
571
+ }, [Ea]), Oa = N(Da);
539
572
  M(() => {
540
- ua.current = la;
541
- }, [la]);
542
- let da = j((e, t, n, r, i) => {
573
+ Oa.current = Da;
574
+ }, [Da]);
575
+ let ka = j((e, t, n, r, i) => {
543
576
  let a = I(n.key, n.fallback, r), o = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), s = {
544
577
  kind: "write-reply",
545
578
  line: n.key
@@ -551,7 +584,7 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
551
584
  timestamp: c,
552
585
  metadata: {
553
586
  localAction: s,
554
- ...D(i)
587
+ ...E(i)
555
588
  }
556
589
  });
557
590
  let u = F();
@@ -563,51 +596,51 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
563
596
  metadata: {
564
597
  lang: a === o ? "en" : H,
565
598
  localAction: s,
566
- ...D(i)
599
+ ...E(i)
567
600
  }
568
- }), on.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", A()), $i(e, u);
601
+ }), on.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", A()), ha(e, u);
569
602
  }, [
570
603
  K,
571
604
  H,
572
- $i,
605
+ ha,
573
606
  I
574
- ]), fa = un(), pa = fa?.request ?? null, ma = N(() => void 0), [ha, ga] = tr(null);
607
+ ]), Aa = un(), ja = Aa?.request ?? null, Ma = N(() => void 0), [Na, Pa] = gr(null);
575
608
  M(() => {
576
- if (ha === null) return;
577
- let e = window.setTimeout(() => ga(null), sr);
609
+ if (Na === null) return;
610
+ let e = window.setTimeout(() => Pa(null), Cr);
578
611
  return () => window.clearTimeout(e);
579
- }, [ha]);
580
- let _a = j(() => {
612
+ }, [Na]);
613
+ let Fa = j(() => {
581
614
  let e = b.getState();
582
- return G(void 0, e.autoRouting && yi.current ? s : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
583
- }, [G]), va = j((e) => {
584
- if (!pa) return !1;
615
+ return G(void 0, e.autoRouting && Fi.current ? s : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
616
+ }, [G]), Ia = j((e) => {
617
+ if (!ja) return !1;
585
618
  let t = e !== void 0, n = b.getState(), r = dn({
586
619
  spoken: t,
587
- bound: ki.current,
620
+ bound: Gi.current,
588
621
  activeConversationId: n.activeConversationId,
589
622
  conversations: n.conversations,
590
623
  historyOn: ln()
591
624
  });
592
- if (r && pa(r), t) {
625
+ if (r && ja(r), t) {
593
626
  let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? I("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : I("deleteConversation.nothing", "There is no conversation to delete.");
594
- ma.current({
627
+ Ma.current({
595
628
  id: `conversation-delete:${F()}`,
596
629
  text: t,
597
630
  lang: t === e ? "en" : H
598
631
  });
599
- } else r || ga(Date.now());
632
+ } else r || Pa(Date.now());
600
633
  return !0;
601
634
  }, [
602
- pa,
635
+ ja,
603
636
  H,
604
637
  I
605
- ]), ya = j((e, t, n, r = !1) => {
606
- if (e.kind === "conversation-delete") return va(n);
607
- let { theme: i, navigate: a } = na.current, o = () => {
608
- let e = (r ? null : b.getState().activeConversationId) ?? _a();
609
- return r && Mi(e), e;
610
- }, s = (e, r) => {
638
+ ]), La = j((e, t, n, r = !1) => {
639
+ if (e.kind === "conversation-delete") return Ia(n);
640
+ let { theme: i, navigate: a } = ba.current, o = null, s = () => {
641
+ let e = (r ? null : o ?? b.getState().activeConversationId) ?? Fa();
642
+ return r && Ji(e), e;
643
+ }, c = (e, r) => {
611
644
  let i = F();
612
645
  return K(e, {
613
646
  id: i,
@@ -616,10 +649,10 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
616
649
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
617
650
  metadata: {
618
651
  localAction: r,
619
- ...D(n)
652
+ ...E(n)
620
653
  }
621
654
  }), i;
622
- }, c = (e, t, r, i, a, o) => {
655
+ }, l = (e, t, r, i, a, o) => {
623
656
  let s = F();
624
657
  return K(e, {
625
658
  id: s,
@@ -629,140 +662,237 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
629
662
  metadata: {
630
663
  lang: r.translated ? H : "en",
631
664
  localAction: i,
632
- ...D(n)
665
+ ...E(n)
633
666
  }
634
- }), on.recordCommittedEntries(e, [t, s], "LOCAL_COMMAND", a), o && $i(e, s), s;
635
- }, l = (e, t) => {
636
- let n = o();
637
- return c(n, s(n, t), e, t, A(), !0), !0;
638
- }, u = (e) => {
639
- let t = o(), n = A(), r = window.location.pathname, i = s(t, Un({
667
+ }), on.recordCommittedEntries(e, [t, s], "LOCAL_COMMAND", a), o && ha(e, s), s;
668
+ }, u = (e, t, n) => {
669
+ let r = s(), i = l(r, c(r, t), e, t, A(), !0);
670
+ return n?.(i), !0;
671
+ }, d = (e) => {
672
+ let t = s(), n = A(), r = window.location.pathname, i = c(t, er({
640
673
  destinationId: e.destinationId,
641
674
  path: e.registryPath,
642
675
  alreadyHere: !1,
643
676
  via: e.via
644
- })), l = F();
645
- ia.current = l, oa(!0);
677
+ })), o = F();
678
+ Sa.current = o, wa(!0);
646
679
  let u = (a) => {
647
680
  try {
648
681
  if (!b.getState().conversations.some((e) => e.id === t)) return;
649
- let o = Nn(na.current.navItems), s = a.status === "arrived" || a.status === "redirected" ? a.landedPath : null, l = Un({
682
+ let o = Ln(ba.current.navItems), s = a.status === "arrived" || a.status === "redirected" ? a.landedPath : null, c = er({
650
683
  destinationId: e.destinationId,
651
684
  path: e.registryPath,
652
685
  alreadyHere: !1,
653
686
  via: e.via,
654
687
  outcome: a
655
688
  });
656
- Ar(t, i, { localAction: l });
657
- let u = c(t, i, e.via === "back" && a.status === "arrived" ? Fn(I, e.pageLabel()) : Rn(I, a, {
689
+ Kr(t, i, { localAction: c });
690
+ let u = l(t, i, e.via === "back" && a.status === "arrived" ? Bn(I, e.pageLabel()) : Kn(I, a, {
658
691
  page: e.pageLabel(),
659
- landed: s === null ? null : Gn(o, s),
692
+ landed: s === null ? null : nr(o, s),
660
693
  path: e.target
661
- }), l, n, ra.current);
694
+ }), c, n, xa.current);
662
695
  a.status === "arrived" && e.onArrived?.({
663
696
  replyId: u,
664
697
  fromPath: r,
665
698
  landedPath: a.landedPath
666
699
  });
667
700
  } finally {
668
- ia.current === l && (ia.current = null, ra.current && oa(!1));
701
+ Sa.current === o && (Sa.current = null, xa.current && wa(!1));
669
702
  }
670
703
  };
671
- return Bn(a, e.target, {
704
+ return Zn(a, e.target, {
672
705
  readPath: () => window.location.pathname + window.location.search,
673
706
  now: () => Date.now(),
674
707
  schedule: (e, t) => {
675
708
  window.setTimeout(e, t);
676
709
  },
677
- isShellLess: () => !ra.current
710
+ isShellLess: () => !xa.current
678
711
  }).then(u, () => u({ status: "unconfirmed" })), !0;
679
- };
712
+ }, f = ({ replyId: e, fromPath: t, landedPath: n }) => Qn.push({
713
+ fromPath: t,
714
+ toPath: n,
715
+ replyMessageId: e,
716
+ at: Date.now()
717
+ });
680
718
  if (e.kind === "theme") {
681
719
  if (!i) return !1;
682
- let t = Pn(e.request, {
720
+ let t = zn(e.request, {
683
721
  mode: i.mode,
684
722
  resolvedTheme: i.resolvedTheme
685
723
  });
686
724
  if (!t.alreadyApplied) try {
687
725
  i.setMode(t.mode);
688
726
  } catch {}
689
- return l(zn(I, t, e.request.kind === "family"), {
727
+ return u(Xn(I, t, e.request.kind === "family"), {
690
728
  kind: "theme",
691
729
  mode: t.mode,
692
730
  alreadyApplied: t.alreadyApplied
693
731
  });
694
732
  }
695
733
  if (!a) return !1;
696
- if (e.kind === "choose-destination") return l(In(I, e.candidates[0]?.label ?? e.query, e.candidates), {
734
+ if (e.kind === "choose-destination") return u(Vn(I, e.candidates[0]?.label ?? e.query, e.candidates), {
697
735
  kind: "choose-destination",
698
736
  candidateIds: e.candidates.map((e) => e.id)
699
- });
737
+ }, (t) => or(t, e.candidates));
738
+ if (e.kind === "choose-linked") return u(Hn(I, e.candidates), {
739
+ kind: "choose-destination",
740
+ candidateIds: e.candidates.map((e) => e.id)
741
+ }, (t) => or(t, e.candidates));
742
+ if (e.kind === "pick-from-list") {
743
+ let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
744
+ return u(qn(I), t ? {
745
+ kind: "choose-destination",
746
+ candidateIds: t.map((e) => e.id)
747
+ } : e.candidateIds.length > 0 ? {
748
+ kind: "choose-destination",
749
+ candidateIds: [...e.candidateIds]
750
+ } : er({
751
+ destinationId: "",
752
+ path: "",
753
+ alreadyHere: !1,
754
+ via: "choice",
755
+ outcome: {
756
+ status: "refused",
757
+ reason: "not-routable"
758
+ }
759
+ }), t ? (e) => or(e, t) : void 0);
760
+ }
761
+ if (e.kind === "link-not-openable") return u(Wn(I), er({
762
+ destinationId: "",
763
+ path: "",
764
+ alreadyHere: !1,
765
+ via: "link",
766
+ outcome: {
767
+ status: "refused",
768
+ reason: "not-routable"
769
+ }
770
+ }));
771
+ if (e.kind === "open-record") {
772
+ let { options: r, navItems: i } = ba.current, a = r.entityRoutes ?? [], s = Nn(i), c = (r.records ?? []).flatMap((t) => {
773
+ let n = a.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
774
+ return n && r && (n.visibleWith === void 0 || s.has(n.visibleWith)) ? [{
775
+ adapter: t,
776
+ route: n
777
+ }] : [];
778
+ });
779
+ if (c.length === 0) return !1;
780
+ let l = b.getState().activeConversationId, p = F();
781
+ Sa.current = p, wa(!0);
782
+ let m = () => {
783
+ Sa.current === p && (Sa.current = null, xa.current && wa(!1));
784
+ };
785
+ return (async () => {
786
+ let t = new AbortController(), n, r = new Promise((e) => {
787
+ n = setTimeout(() => {
788
+ t.abort(), e(null);
789
+ }, yr);
790
+ });
791
+ try {
792
+ return await Promise.all(c.map(async ({ adapter: n, route: i }) => {
793
+ let a = await Promise.race([n.find(e.request.name, t.signal).catch(() => null), r]);
794
+ return {
795
+ adapter: n,
796
+ route: i,
797
+ noun: Un(I, n.noun),
798
+ matches: a ?? []
799
+ };
800
+ }));
801
+ } finally {
802
+ clearTimeout(n);
803
+ }
804
+ })().then((r) => {
805
+ if (!xa.current) return m();
806
+ let i = Pn(e.request.name, r), a = b.getState().conversations.some((e) => e.id === l);
807
+ if (i.kind === "none") {
808
+ m(), Va.current(t, [], {
809
+ fromPerson: !0,
810
+ ...n === void 0 ? {} : { voiceSessionId: n },
811
+ localRecordsChecked: !0
812
+ });
813
+ return;
814
+ }
815
+ if (l !== null && !a) return m();
816
+ if (o = l, m(), i.kind === "open") {
817
+ let { destination: e } = i;
818
+ d({
819
+ target: e.path,
820
+ destinationId: e.id,
821
+ registryPath: e.path,
822
+ via: "named",
823
+ pageLabel: () => e.label,
824
+ onArrived: f
825
+ });
826
+ return;
827
+ }
828
+ let s = i.candidates[0];
829
+ u(i.why === "kinds" ? Yn(I, i.nouns, i.candidates) : Jn(I, i.nouns[0] ?? "", s?.label ?? e.request.name, i.candidates), {
830
+ kind: "choose-destination",
831
+ candidateIds: i.candidates.map((e) => e.id)
832
+ }, (e) => or(e, i.candidates));
833
+ }, () => m()), !0;
834
+ }
700
835
  if (e.kind === "back") {
701
- let e = Vn.top();
836
+ let e = Qn.top();
702
837
  if (!e) return !1;
703
- let t = Wn(Nn(na.current.navItems), e.fromPath);
704
- return u({
838
+ let t = tr(Ln(ba.current.navItems), e.fromPath);
839
+ return d({
705
840
  target: e.fromPath,
706
841
  destinationId: t?.id ?? "",
707
842
  registryPath: t?.path ?? e.fromPath,
708
843
  via: "back",
709
844
  pageLabel: () => t?.label ?? null,
710
845
  onArrived: () => {
711
- Vn.top() === e && Vn.pop();
846
+ Qn.top() === e && Qn.pop();
712
847
  }
713
848
  });
714
849
  }
715
- let { destination: d } = e;
716
- return jn(d, window.location.pathname + window.location.search, Nn(na.current.navItems)) ? l(Ln(I, d.label, !0), Un({
717
- destinationId: d.id,
718
- path: d.path,
850
+ let { destination: p } = e;
851
+ return Fn(p, window.location.pathname + window.location.search, Ln(ba.current.navItems)) ? u(Gn(I, p.label, !0), er({
852
+ destinationId: p.id,
853
+ path: p.path,
719
854
  alreadyHere: !0,
720
- via: "named"
721
- })) : u({
722
- target: d.path,
723
- destinationId: d.id,
724
- registryPath: d.path,
725
- via: "named",
726
- pageLabel: () => d.label,
727
- onArrived: ({ replyId: e, fromPath: t, landedPath: n }) => Vn.push({
728
- fromPath: t,
729
- toPath: n,
730
- replyMessageId: e,
731
- at: Date.now()
732
- })
855
+ via: e.via ?? "named"
856
+ })) : d({
857
+ target: p.path,
858
+ destinationId: p.id,
859
+ registryPath: p.path,
860
+ via: e.via ?? "named",
861
+ pageLabel: () => p.label,
862
+ onArrived: f
733
863
  });
734
864
  }, [
735
865
  K,
736
- Mi,
737
- _a,
866
+ Ji,
867
+ Fa,
738
868
  H,
739
- Ar,
740
- va,
741
- $i,
869
+ Kr,
870
+ Ia,
871
+ ha,
742
872
  I
743
- ]), ba = j(async (e) => {
744
- xi.current = !0;
873
+ ]), Ra = j(async (e) => {
874
+ Li.current = !0;
745
875
  try {
746
876
  await J.declineForReply(e.conversationId, e.reason, e.origin);
747
877
  } finally {
748
- xi.current = !1;
878
+ Li.current = !1;
749
879
  }
750
880
  if (e.commandText !== null) {
751
- let t = ca(e.commandText, e.options.voiceSessionId);
752
- if (t && ya(t, e.content, e.options.voiceSessionId)) return;
881
+ let t = Ea(e.commandText, e.options.voiceSessionId);
882
+ if (t && La(t, e.content, e.options.voiceSessionId)) return;
753
883
  }
754
- await Ca.current(e.content, e.attachments, e.options);
884
+ await Va.current(e.content, e.attachments, e.options);
755
885
  }, [
756
- ca,
757
- ya,
886
+ Ea,
887
+ La,
758
888
  J
759
889
  ]), Z = j(async (e, t = [], n = {}) => {
760
- let r = n.voiceSessionId !== void 0, i = b.getState(), a = !1, o = ki.current;
890
+ let r = n.voiceSessionId !== void 0, i = b.getState(), a = !1, o = Gi.current;
761
891
  if (r && ze(o)) {
762
- let e = We(o, i.activeConversationId, Ni());
892
+ let e = We(o, i.activeConversationId, Yi());
763
893
  if (e.kind === "gone") return;
764
894
  let t = n.voiceEntry ?? e;
765
- t.kind === "adopt" && Mi(t.conversationId), a = t.kind === "own", n = {
895
+ t.kind === "adopt" && Ji(t.conversationId), a = t.kind === "own", n = {
766
896
  ...n,
767
897
  voiceEntry: t
768
898
  };
@@ -771,7 +901,7 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
771
901
  if (c) {
772
902
  if (ut(i.processingByConversationId[c]?.status)) {
773
903
  let r = i.processingByConversationId[c]?.messageId ?? null;
774
- r && Ji.current.has(r) && (Yi.current = {
904
+ r && ua.current.has(r) && (da.current = {
775
905
  conversationId: c,
776
906
  content: e,
777
907
  attachments: t,
@@ -779,29 +909,29 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
779
909
  });
780
910
  return;
781
911
  }
782
- if (Fi.current.has(c)) return;
912
+ if (Zi.current.has(c)) return;
783
913
  }
784
- if (bi.current || te() !== null || xi.current || ia.current !== null) return;
785
- let d = n.targetConversationId, ee = p(), m = (e) => nn(e) || tn(e, ee);
914
+ if (Ii.current || ee() !== null || Li.current || Sa.current !== null) return;
915
+ let d = n.targetConversationId, m = p(), h = (e) => nn(e) || tn(e, m);
786
916
  if (d !== void 0) {
787
917
  let e = i.conversations.find((e) => e.id === d);
788
- if (i.activeConversationId !== d || !e || e.mode !== i.mode || m(e)) return;
918
+ if (i.activeConversationId !== d || !e || e.mode !== i.mode || h(e)) return;
789
919
  }
790
920
  if (n.fromPerson && n.writeReplyBound === void 0) {
791
921
  let r = d ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", a = Ut({
792
922
  text: e,
793
- locale: i === "spoken" ? yr.input.code : H,
923
+ locale: i === "spoken" ? Fr.input.code : H,
794
924
  origin: i,
795
925
  hasAttachments: t.length > 0,
796
926
  live: J.liveFor(r),
797
- matchesLocalCommand: (e) => ca(e, n.voiceSessionId) !== null
927
+ matchesLocalCommand: (e) => Ea(e, n.voiceSessionId) !== null
798
928
  });
799
929
  if (a.kind === "local_reply") {
800
- r && da(r, e, a.line, a.values, n.voiceSessionId);
930
+ r && ka(r, e, a.line, a.values, n.voiceSessionId);
801
931
  return;
802
932
  }
803
933
  let o = a.kind === "local" ? a.fallback : a.bound, c = a.declineAll;
804
- if (c !== null && r) return ba({
934
+ if (c !== null && r) return Ra({
805
935
  conversationId: r,
806
936
  reason: c,
807
937
  origin: i,
@@ -818,53 +948,53 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
818
948
  writeReplyBound: o
819
949
  };
820
950
  }
821
- let h = n.writeReplyBound?.promptText ?? e;
951
+ let g = n.writeReplyBound?.promptText ?? e;
822
952
  if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
823
- let t = ca(e, n.voiceSessionId);
824
- if (t && ya(t, e, n.voiceSessionId, a)) return;
953
+ let t = Ea(e, n.voiceSessionId, n.localRecordsChecked === !0);
954
+ if (t && La(t, e, n.voiceSessionId, a)) return;
825
955
  }
826
- let re = s ? i.conversations.find((e) => e.id === s) : void 0, g = m(re) ? void 0 : re, _ = i.autoRouting && yi.current && d === void 0 ? f({
956
+ let ne = s ? i.conversations.find((e) => e.id === s) : void 0, _ = h(ne) ? void 0 : ne, v = i.autoRouting && Fi.current && d === void 0 ? f({
827
957
  intent: n.autoIntent ?? l(e),
828
958
  dictated: r,
829
- voiceProposalBound: r && hr("api-calls") && ie(i.acknowledgedWriteModes, "api-calls"),
830
- conversation: g ? {
831
- mode: g.mode,
832
- routedBy: g.routedBy,
833
- hasHistory: en(g)
959
+ voiceProposalBound: r && jr("api-calls") && re(i.acknowledgedWriteModes, "api-calls"),
960
+ conversation: _ ? {
961
+ mode: _.mode,
962
+ routedBy: _.routedBy,
963
+ hasHistory: en(_)
834
964
  } : null
835
965
  }) : null;
836
- if (_ && di.current.find((e) => e.id === _.mode)?.writeCapable && !ie(i.acknowledgedWriteModes, _.mode)) {
837
- bi.current = {
966
+ if (v && Di.current.find((e) => e.id === v.mode)?.writeCapable && !re(i.acknowledgedWriteModes, v.mode)) {
967
+ Ii.current = {
838
968
  content: e,
839
969
  attachments: t,
840
970
  options: n
841
- }, wi(_.mode);
971
+ }, Bi(v.mode);
842
972
  return;
843
973
  }
844
- let v = _ ? _.mode : i.mode, y, se, x = d ?? (a ? null : U), S = x ? b.getState().conversations.find((e) => e.id === x) : void 0, le = _?.action === "escalate" && g ? {
845
- mode: g.mode,
846
- backendSessionId: g.backendSessionId ?? null
974
+ let y = v ? v.mode : i.mode, ae, se, x = d ?? (a ? null : U), S = x ? b.getState().conversations.find((e) => e.id === x) : void 0, le = v?.action === "escalate" && _ ? {
975
+ mode: _.mode,
976
+ backendSessionId: _.backendSessionId ?? null
847
977
  } : null;
848
- if (_) _.action === "new" || !g ? x = G(void 0, v, { routedBy: "auto" }) : (x = g.id, Vr(x, v));
978
+ if (v) v.action === "new" || !_ ? x = G(void 0, y, { routedBy: "auto" }) : (x = _.id, ri(x, y));
849
979
  else {
850
980
  let e = i.autoRouting ? { routedBy: "auto" } : void 0;
851
- !x || m(S) || S && S.mode !== v && en(S) ? x = G(void 0, v, e) : S && S.mode !== v && (e ? Vr(x, v) : Er(x, v));
981
+ !x || h(S) || S && S.mode !== y && en(S) ? x = G(void 0, y, e) : S && S.mode !== y && (e ? ri(x, y) : Hr(x, y));
852
982
  }
853
983
  if (!x) return;
854
- r && ki.current !== void 0 && x !== i.activeConversationId && Mi(x), n.approvalFollowUp || (Pi.current[x] = t);
855
- let C = () => b.getState().conversations.some((e) => e.id === x), w = A(), T = {
984
+ r && Gi.current !== void 0 && x !== i.activeConversationId && Ji(x), n.approvalFollowUp || (Xi.current[x] = t);
985
+ let fe = () => b.getState().conversations.some((e) => e.id === x), C = A(), w = {
856
986
  accessToken: B(),
857
- workspaceToken: gr(),
987
+ workspaceToken: Mr(),
858
988
  userId: V,
859
989
  organizationId: At()
860
- }, he = (e, t) => {
861
- C() || !w || oe(e, w, t, v, {
990
+ }, ge = (e, t) => {
991
+ fe() || !C || oe(e, C, t, y, {
862
992
  accessToken: B(),
863
- workspaceToken: gr(),
993
+ workspaceToken: Mr(),
864
994
  userId: V,
865
995
  organizationId: At()
866
996
  });
867
- }, ge = {
997
+ }, _e = {
868
998
  id: F(),
869
999
  role: "user",
870
1000
  content: e,
@@ -875,302 +1005,306 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
875
1005
  approvalFollowUp: !0,
876
1006
  approvedReplyId: n.approvalFollowUp.approvedReplyId
877
1007
  } : {},
878
- ...D(n.voiceSessionId)
1008
+ ...E(n.voiceSessionId)
879
1009
  }
880
1010
  };
881
- K(x, ge);
882
- let E = F();
1011
+ K(x, _e);
1012
+ let T = F();
883
1013
  K(x, {
884
- id: E,
1014
+ id: T,
885
1015
  role: "assistant",
886
1016
  content: "",
887
1017
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
888
1018
  metadata: {
889
- lang: Sr,
890
- ...D(n.voiceSessionId)
1019
+ lang: Rr,
1020
+ ...E(n.voiceSessionId)
891
1021
  }
892
- }), wt(E, {
1022
+ }), wt(T, {
893
1023
  channel: r ? "voice" : "chat",
894
- mode: v,
1024
+ mode: y,
895
1025
  product: L,
896
- language: Sr,
1026
+ language: Rr,
897
1027
  device: Tt(),
898
- routedByAuto: !!_
899
- }, n.voiceTiming), k(E, "accepted"), jr(x, "provisioning", E, null), ne(E);
900
- let Oe = () => dt({
901
- turnId: E,
902
- abortRequested: Ji.current.has(E),
1028
+ routedByAuto: !!v
1029
+ }, n.voiceTiming), k(T, "accepted"), qr(x, "provisioning", T, null), te(T);
1030
+ let ke = () => dt({
1031
+ turnId: T,
1032
+ abortRequested: ua.current.has(T),
903
1033
  activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
904
- conversationExists: C()
905
- }), ke = (e, t, r, i, a = !1, o = Sr) => {
906
- kr(x, E, { content: _e(e) }), Ar(x, E, {
1034
+ conversationExists: fe()
1035
+ }), Ae = (e, t, r, i, a = !1, o = Rr) => {
1036
+ Gr(x, T, { content: ve(e) }), Kr(x, T, {
907
1037
  lang: o,
908
1038
  ...t?.length ? { artifacts: t } : {},
909
- ...t?.length || r || i ? { mode: v } : {},
1039
+ ...t?.length || r || i ? { mode: y } : {},
910
1040
  ...r ? { sessionId: r } : {},
911
1041
  ...i ? { sandboxId: i } : {},
912
1042
  ...a ? { incomplete: !0 } : {},
913
- ...D(n.voiceSessionId)
1043
+ ...E(n.voiceSessionId)
914
1044
  });
915
- }, je = { session: null }, Me = !1, Ne = () => {
916
- Me && (Me = !1, Ae.abort(E));
917
- }, Fe = async (i = 1) => {
918
- k(E, "attemptStarted");
1045
+ }, Me = { session: null }, Ne = !1, Pe = () => {
1046
+ Ne && (Ne = !1, je.abort(T));
1047
+ }, D = async (i = 1) => {
1048
+ k(T, "attemptStarted");
919
1049
  let a = null, o = null, s = !1;
920
1050
  try {
921
- let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: p, deadSandboxProbe: ee, sessionPreopened: m } = await Hi(x, E, v, w, T, { isAbandoned: () => dt({
922
- turnId: E,
923
- abortRequested: Ji.current.has(E),
1051
+ let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: p, deadSandboxProbe: m, sessionPreopened: h } = await ia(x, T, y, C, w, { isAbandoned: () => dt({
1052
+ turnId: T,
1053
+ abortRequested: ua.current.has(T),
924
1054
  activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
925
- conversationExists: C()
1055
+ conversationExists: fe()
926
1056
  }).abandon });
927
- if (a = i, k(E, "runtimeReady"), O(E, {
928
- runtime: d ? "cold" : p ? "adopted" : f ? "probed" : m ? "preopened" : l ? "new-session" : "warm",
929
- deadSandboxProbe: ee
930
- }), o = c, je.session = {
1057
+ if (a = i, k(T, "runtimeReady"), O(T, {
1058
+ runtime: d ? "cold" : p ? "adopted" : f ? "probed" : h ? "preopened" : l ? "new-session" : "warm",
1059
+ deadSandboxProbe: m
1060
+ }), o = c, Me.session = {
931
1061
  sandboxId: i,
932
1062
  sessionId: c
933
- }, ae(v, y, b.getState().acknowledgedWriteModes, {
1063
+ }, ie(y, ae, b.getState().acknowledgedWriteModes, {
934
1064
  dictated: r,
935
- confirmsWrites: fe(v),
936
- proposalBound: hr(v, i)
937
- }) === "voice-in-write-mode") throw new ve("voice-in-write-mode", "Voice in a write mode");
938
- let te = fn({
1065
+ confirmsWrites: pe(y),
1066
+ proposalBound: jr(y, i)
1067
+ }) === "voice-in-write-mode") throw new ye("voice-in-write-mode", "Voice in a write mode");
1068
+ let ee = fn({
939
1069
  conversation: b.getState().conversations.find((e) => e.id === x),
940
1070
  content: e,
941
1071
  sessionIsNew: l,
942
- sendingMode: v,
943
- sendingModeConfig: y,
944
- modes: di.current,
1072
+ sendingMode: y,
1073
+ sendingModeConfig: ae,
1074
+ modes: Di.current,
945
1075
  answerText: (e) => bt(e).text
946
- }), ne = await _t(() => de(i, w, c, v, T, { limit: 50 }), l, gt(u, i, c));
947
- Bi(x, E, "streaming", "thinking");
948
- let re = ur?.(), g = Wt(b.getState().sandboxWriteCapabilities[i]), _ = {
1076
+ }), te = await _t(() => de(i, C, c, y, w, { limit: 50 }), l, gt(u, i, c));
1077
+ na(x, T, "streaming", "thinking");
1078
+ let ne = Er?.(), _ = Wt(b.getState().sandboxWriteCapabilities[i]), v = ba.current, re = v.options.uiCatalogue ? sr(Ln(v.navItems), {
1079
+ permissionsSettled: v.navPermissionsSettled,
1080
+ simulating: v.navSimulating
1081
+ }) : null, oe = {
949
1082
  conversationId: x,
950
- writeReply: g === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null
951
- }, { prompt: ie, parts: oe } = lt({
952
- content: te ? `${te}${h}` : h,
1083
+ writeReply: _ === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null,
1084
+ ...re ? { uiCatalogue: re } : {}
1085
+ }, { prompt: S, parts: le } = lt({
1086
+ content: ee ? `${ee}${g}` : g,
953
1087
  attachments: t,
954
- limits: Ze(y),
955
- wrapPrompt: (e) => dr?.(v, e, br, xr, r, { writeApproval: g }) ?? e,
956
- requestBytes: (e, t) => pe({
1088
+ limits: Ze(ae),
1089
+ wrapPrompt: (e) => Dr?.(y, e, Ir, Lr, r, { writeApproval: _ }) ?? e,
1090
+ requestBytes: (e, t) => me({
957
1091
  sandboxId: i,
958
- workspaceId: w,
1092
+ workspaceId: C,
959
1093
  sessionId: c,
960
- mode: v,
1094
+ mode: y,
961
1095
  prompt: e,
962
1096
  parts: t,
963
- pageContext: re,
964
- authContext: T,
965
- ..._
1097
+ pageContext: ne,
1098
+ authContext: w,
1099
+ ...oe
966
1100
  })
967
- }), S = Je(oe), le = S > 0;
968
- s = qe(t) > S;
969
- let ye = Oe();
970
- if (ye.abandon) {
971
- ye.clearProcessing && Mr(x);
1101
+ }), be = Je(le), xe = be > 0;
1102
+ s = qe(t) > be;
1103
+ let Se = ke();
1104
+ if (Se.abandon) {
1105
+ Se.clearProcessing && Jr(x);
972
1106
  return;
973
1107
  }
974
1108
  try {
975
- await me(i, w, c, ie, v, re, T, oe?.length ? {
976
- parts: oe,
977
- ..._
978
- } : _);
1109
+ await he(i, C, c, S, y, ne, w, le?.length ? {
1110
+ parts: le,
1111
+ ...oe
1112
+ } : oe);
979
1113
  } catch (e) {
980
- if (!oe || !jt(e)) throw e;
981
- await me(i, w, c, ie, v, re, T, _), s ||= le;
1114
+ if (!le || !jt(e)) throw e;
1115
+ await he(i, C, c, S, y, ne, w, oe), s ||= xe;
982
1116
  }
983
- let be = (e) => kr(x, E, { content: e }), xe = (e) => s ? `${e}\n\n${I("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._")}` : e;
984
- k(E, "promptSent");
985
- let Ce = null, Te = !1, Ee = mt, D = ht([], ne), Ne = Date.now() + se.streamBudgetMs, Fe = Date.now(), Ie = Date.now();
986
- for (; Date.now() < Ne;) {
987
- he(i, c);
988
- let e = Oe();
1117
+ let we = (e) => Gr(x, T, { content: e }), Ee = (e) => s ? `${e}\n\n${I("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._")}` : e;
1118
+ k(T, "promptSent");
1119
+ let De = null, E = !1, Pe = mt, D = ht([], te), Ie = Date.now() + se.streamBudgetMs, Le = Date.now(), Re = Date.now();
1120
+ for (; Date.now() < Ie;) {
1121
+ ge(i, c);
1122
+ let e = ke();
989
1123
  if (e.abandon) {
990
- e.clearProcessing && Mr(x);
1124
+ e.clearProcessing && Jr(x);
991
1125
  return;
992
1126
  }
993
- if (D = ht(await de(i, w, c, v, T, {
1127
+ if (D = ht(await de(i, C, c, y, w, {
994
1128
  limit: 50,
995
- sinceMs: ne,
1129
+ sinceMs: te,
996
1130
  surfaceTurnTerminal: !0
997
- }), ne, { accumulateNarration: se.accumulatesNarration }), kr(x, E, { content: _e(D.content) }), D.hasRenderableOutput ? Te || (Te = !0, Ce !== null && k(E, "lastQuietPoll", Ce), k(E, "firstOutput")) : Ce = Dt(), se.accumulatesNarration) D.hasText && k(E, "firstText");
1131
+ }), te, { accumulateNarration: se.accumulatesNarration }), Gr(x, T, { content: ve(D.content) }), D.hasRenderableOutput ? E || (E = !0, De !== null && k(T, "lastQuietPoll", De), k(T, "firstOutput")) : De = Dt(), se.accumulatesNarration) D.hasText && k(T, "firstText");
998
1132
  else {
999
- let e = yt(Ee, D, Dt());
1000
- Ee = e.tracker, e.confirmedAt !== null && k(E, "firstText", e.confirmedAt);
1133
+ let e = yt(Pe, D, Dt());
1134
+ Pe = e.tracker, e.confirmedAt !== null && k(T, "firstText", e.confirmedAt);
1001
1135
  }
1002
- if (D.pendingWrite && !Ht(b.getState().sandboxWriteCapabilities[i]) && Ar(x, E, { pendingWrite: D.pendingWrite }), D.done) {
1003
- k(E, "answerDone"), Y.current.markVerified(i);
1136
+ if (D.pendingWrite && !Ht(b.getState().sandboxWriteCapabilities[i]) && Kr(x, T, { pendingWrite: D.pendingWrite }), D.done) {
1137
+ k(T, "answerDone"), Y.current.markVerified(i);
1004
1138
  break;
1005
1139
  }
1006
- Date.now() - Fe > 3e4 && (await ce(i, w, 600, T).catch(() => void 0), Fe = Date.now()), await new Promise((e) => setTimeout(e, Pe(Date.now() - Ie)));
1140
+ Date.now() - Le > 3e4 && (await ce(i, C, 600, w).catch(() => void 0), Le = Date.now()), await new Promise((e) => setTimeout(e, Fe(Date.now() - Re)));
1007
1141
  }
1008
- if (D.done && n.voiceSessionId !== void 0 && !Oe().abandon) {
1009
- let e = _e(xe(D.content));
1010
- e.trim() && (s && be(e), k(E, "speechQueued"), Me = !0, Ae.publish(E, {
1142
+ if (D.done && n.voiceSessionId !== void 0 && !ke().abandon) {
1143
+ let e = ve(Ee(D.content));
1144
+ e.trim() && (s && we(e), k(T, "speechQueued"), Ne = !0, je.publish(T, {
1011
1145
  conversationId: x,
1012
1146
  channel: "voice",
1013
1147
  voiceSessionId: n.voiceSessionId,
1014
1148
  text: e,
1015
- lang: Sr,
1149
+ lang: Rr,
1016
1150
  final: !0
1017
1151
  }));
1018
1152
  }
1019
- let Le = se.producesArtifacts ? await ue(i, w, c, v, T).then((e) => e).catch(() => []) : void 0;
1020
- D.usedTools !== void 0 && O(E, { usedTools: D.usedTools }), D.done || (O(E, { outcome: "timedOut" }), D = {
1153
+ let ze = se.producesArtifacts ? await ue(i, C, c, y, w).then((e) => e).catch(() => []) : void 0;
1154
+ D.usedTools !== void 0 && O(T, { usedTools: D.usedTools }), D.done || (O(T, { outcome: "timedOut" }), D = {
1021
1155
  ...D,
1022
- content: De(D.content, v, I, y)
1156
+ content: Oe(D.content, y, I, ae)
1023
1157
  }), s && (D = {
1024
1158
  ...D,
1025
- content: xe(D.content)
1159
+ content: Ee(D.content)
1026
1160
  });
1027
- let Re = !D.done;
1028
- ke(D.content, Le, c, i, Re), D.tokens && (kr(x, E, { tokens: D.tokens }), (pr ? await we({
1029
- workspaceId: w,
1161
+ let Be = !D.done;
1162
+ Ae(D.content, ze, c, i, Be), D.tokens && (Gr(x, T, { tokens: D.tokens }), (kr ? await Te({
1163
+ workspaceId: C,
1030
1164
  sessionId: c,
1031
1165
  messageId: D.messageId,
1032
1166
  model: D.model,
1033
1167
  tokens: D.tokens
1034
- }, pr, { ledger: Se("panel", L) }) : { ok: !0 }).ok && Jn(L)), D.done || he(i, c);
1035
- let ze = Oe();
1036
- if (ze.abandon) {
1037
- ze.clearProcessing && Mr(x);
1168
+ }, kr, { ledger: Ce("panel", L) }) : { ok: !0 }).ok && lr(L)), D.done || ge(i, c);
1169
+ let Ve = ke();
1170
+ if (Ve.abandon) {
1171
+ Ve.clearProcessing && Jr(x);
1038
1172
  return;
1039
1173
  }
1040
- k(E, "complete"), O(E, { outcome: "answered" }), jr(x, "complete", E, null), on.recordCommittedEntries(x, [ge.id, E], "TURN", w), Me = !1;
1174
+ k(T, "complete"), O(T, { outcome: "answered" }), qr(x, "complete", T, null), on.recordCommittedEntries(x, [_e.id, T], "TURN", C), Ne = !1;
1041
1175
  } catch (e) {
1042
- Y.current.invalidate(a ?? b.getState().sandboxesByMode[v]?.sandboxId ?? null);
1176
+ Y.current.invalidate(a ?? b.getState().sandboxesByMode[y]?.sandboxId ?? null);
1043
1177
  let t = dt({
1044
- turnId: E,
1045
- abortRequested: Ji.current.has(E),
1178
+ turnId: T,
1179
+ abortRequested: ua.current.has(T),
1046
1180
  activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
1047
- conversationExists: C()
1181
+ conversationExists: fe()
1048
1182
  });
1049
- if (a && o && he(a, o), t.abandon) {
1050
- t.clearProcessing && Mr(x);
1183
+ if (a && o && ge(a, o), t.abandon) {
1184
+ t.clearProcessing && Jr(x);
1051
1185
  return;
1052
1186
  }
1053
1187
  if (i === 1 && Mt(e)) {
1054
- let e = a ?? b.getState().sandboxesByMode[v]?.sandboxId ?? null;
1055
- return e && (X.current.add(e), Y.current.invalidate(e)), Pr(x), Ir(v), Or(x, E, ""), Ar(x, E, { pendingWrite: void 0 }), e && J.retireSandbox(e), Ne(), Et(E), Fe(2);
1188
+ let e = a ?? b.getState().sandboxesByMode[y]?.sandboxId ?? null;
1189
+ return e && (X.current.add(e), Y.current.invalidate(e)), Xr(x), Qr(y), Wr(x, T, ""), Kr(x, T, { pendingWrite: void 0 }), e && J.retireSandbox(e), Pe(), Et(T), D(2);
1056
1190
  }
1057
1191
  throw e;
1058
1192
  }
1059
1193
  }, Ie = x;
1060
- Fi.current.add(Ie);
1194
+ Zi.current.add(Ie);
1061
1195
  try {
1062
- if (!w) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
1196
+ if (!C) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
1063
1197
  code: "UNAUTHENTICATED",
1064
1198
  authFailure: "WORKSPACE_CONTEXT_MISSING"
1065
1199
  } });
1066
- let e = await ct(v, () => di.current.find((e) => e.id === v), ui);
1067
- y = e.config, se = e.capabilities;
1068
- let t = y, n = Oe();
1200
+ let e = await ct(y, () => Di.current.find((e) => e.id === y), Ei);
1201
+ ae = e.config, se = e.capabilities;
1202
+ let t = ae, n = ke();
1069
1203
  if (n.abandon) {
1070
- n.clearProcessing && Mr(x);
1204
+ n.clearProcessing && Jr(x);
1071
1205
  return;
1072
1206
  }
1073
- let i = ae(v, t, b.getState().acknowledgedWriteModes, {
1207
+ let i = ie(y, t, b.getState().acknowledgedWriteModes, {
1074
1208
  dictated: r,
1075
- confirmsWrites: fe(v),
1076
- proposalBound: hr(v)
1209
+ confirmsWrites: pe(y),
1210
+ proposalBound: jr(y)
1077
1211
  });
1078
- if (i) throw new ve(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1079
- let a = Se("panel", L);
1080
- if (pr && Ce(a, w)) {
1081
- let e = await Te(a, w, pr);
1082
- if (!e.ok) throw Ee(e.kind);
1083
- let t = Oe();
1212
+ if (i) throw new ye(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1213
+ let a = Ce("panel", L);
1214
+ if (kr && we(a, C)) {
1215
+ let e = await Ee(a, C, kr);
1216
+ if (!e.ok) throw De(e.kind);
1217
+ let t = ke();
1084
1218
  if (t.abandon) {
1085
- t.clearProcessing && Mr(x);
1219
+ t.clearProcessing && Jr(x);
1086
1220
  return;
1087
1221
  }
1088
1222
  }
1089
- k(E, "cleared"), await Fe();
1223
+ k(T, "cleared"), await D();
1090
1224
  } catch (e) {
1091
- if (Y.current.invalidate(b.getState().sandboxesByMode[v]?.sandboxId ?? null), !C()) {
1092
- Mr(x);
1225
+ if (Y.current.invalidate(b.getState().sandboxesByMode[y]?.sandboxId ?? null), !fe()) {
1226
+ Jr(x);
1093
1227
  return;
1094
1228
  }
1095
- let t = je.session?.sandboxId ?? null, r = ye(e, { confirmsNoAction: be({
1096
- mode: v,
1229
+ let t = Me.session?.sandboxId ?? null, r = be(e, { confirmsNoAction: xe({
1230
+ mode: y,
1097
1231
  capabilities: t ? b.getState().sandboxWriteCapabilities[t] : null
1098
1232
  }) });
1099
- O(E, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && qn(L, "sandbox");
1100
- let i = xe(r, I, { locale: H });
1101
- jr(x, "error", E, i.headline), kr(x, E, { content: i.text }), Ar(x, E, {
1233
+ O(T, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && cr(L, "sandbox");
1234
+ let i = Se(r, I, { locale: H });
1235
+ qr(x, "error", T, i.headline), Gr(x, T, { content: i.text }), Kr(x, T, {
1102
1236
  lang: i.translated ? H : "en",
1103
- ...D(n.voiceSessionId)
1237
+ ...E(n.voiceSessionId)
1104
1238
  });
1105
1239
  } finally {
1106
- Fi.current.delete(Ie), O(E, { outcome: "stopped" }), k(E, "complete"), Ne();
1107
- let e = b.getState(), t = u(le, v, e.conversations.find((e) => e.id === Ie), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1108
- t && (Vr(Ie, t.mode), t.backendSessionId && Nr(Ie, t.backendSessionId)), je.session && C() && J.afterTurn({
1109
- ...je.session,
1240
+ Zi.current.delete(Ie), O(T, { outcome: "stopped" }), k(T, "complete"), Pe();
1241
+ let e = b.getState(), t = u(le, y, e.conversations.find((e) => e.id === Ie), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1242
+ t && (ri(Ie, t.mode), t.backendSessionId && Yr(Ie, t.backendSessionId)), Me.session && fe() && J.afterTurn({
1243
+ ...Me.session,
1110
1244
  conversationId: Ie
1111
- }, E);
1112
- let n = Yi.current;
1113
- Yi.current = null, n && n.conversationId === Ie && C() && Ca.current(n.content, n.attachments, n.options);
1245
+ }, T);
1246
+ let n = da.current;
1247
+ da.current = null, n && n.conversationId === Ie && fe() && Va.current(n.content, n.attachments, n.options);
1114
1248
  }
1115
1249
  }, [
1116
1250
  U,
1117
1251
  K,
1118
- dr,
1119
- Pr,
1120
- Ir,
1121
- Cr,
1252
+ Dr,
1253
+ Xr,
1254
+ Qr,
1255
+ zr,
1122
1256
  G,
1123
- Hi,
1257
+ ia,
1124
1258
  J,
1125
- da,
1126
- ba,
1259
+ ka,
1260
+ Ra,
1127
1261
  H,
1128
- yr,
1129
- hr,
1130
- ur,
1262
+ Fr,
1263
+ jr,
1264
+ Er,
1131
1265
  B,
1132
- gr,
1133
- kr,
1266
+ Mr,
1267
+ Gr,
1134
1268
  L,
1135
- ui,
1136
- pr,
1137
- xr,
1269
+ Ei,
1270
+ kr,
1271
+ Lr,
1138
1272
  H,
1139
- Sr,
1140
- br,
1141
- Vr,
1142
- ya,
1143
- ca,
1144
- Mi,
1145
- Ni,
1146
- Nr,
1147
- Er,
1148
- jr,
1149
- Mr,
1273
+ Rr,
1274
+ Ir,
1275
+ ri,
1276
+ La,
1277
+ Ea,
1278
+ Ji,
1279
+ Yi,
1280
+ Yr,
1281
+ Hr,
1282
+ qr,
1283
+ Jr,
1150
1284
  I,
1151
- Bi,
1152
- Or,
1285
+ na,
1286
+ Wr,
1153
1287
  V
1154
- ]), xa = j((e, t) => {
1288
+ ]), za = j((e, t) => {
1155
1289
  Z(e, [], t ? { autoIntent: t } : {});
1156
- }, [Z]), Sa = j(() => {
1157
- let e = [...Ur.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1290
+ }, [Z]), Ba = j(() => {
1291
+ let e = [...ai.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1158
1292
  if (!e || e.metadata?.approvalFollowUp) return;
1159
- let t = U ? Pi.current[U] ?? [] : [];
1293
+ let t = U ? Xi.current[U] ?? [] : [];
1160
1294
  Z(e.content, t);
1161
1295
  }, [
1162
- Wr,
1296
+ oi,
1163
1297
  Z,
1164
1298
  U
1165
- ]), Ca = N(Z);
1299
+ ]), Va = N(Z);
1166
1300
  M(() => {
1167
- Ca.current = Z;
1301
+ Va.current = Z;
1168
1302
  }, [Z]);
1169
- let wa = er(() => {
1170
- if (Gr) return null;
1171
- for (let e = Wr.length - 1; e >= 0; --e) {
1172
- let t = Wr[e];
1173
- if (t?.role !== "assistant" || !Oe(t) || Ji.current.has(t.id)) continue;
1303
+ let Ha = hr(() => {
1304
+ if (si) return null;
1305
+ for (let e = oi.length - 1; e >= 0; --e) {
1306
+ let t = oi[e];
1307
+ if (t?.role !== "assistant" || !ke(t) || ua.current.has(t.id)) continue;
1174
1308
  let n = pt(t, q, I);
1175
1309
  if (n.kind !== "output") return null;
1176
1310
  let r = bt(n.text).text.trim();
@@ -1181,70 +1315,70 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
1181
1315
  }
1182
1316
  return null;
1183
1317
  }, [
1184
- Wr,
1185
- Gr,
1318
+ oi,
1319
+ si,
1186
1320
  q,
1187
1321
  I
1188
- ]), Ta = er(() => wa ? Fe(wa.text) : null, [wa]), Ea = Ur.chat, Da = b((e) => y(e)?.sandboxId ?? null), Oa = g(Ea, {
1189
- sessionId: Hr?.backendSessionId,
1190
- sandboxId: Da,
1322
+ ]), Ua = hr(() => Ha ? D(Ha.text) : null, [Ha]), Wa = ai.chat, Ga = b((e) => ae(e)?.sandboxId ?? null), Ka = _(Wa, {
1323
+ sessionId: ii?.backendSessionId,
1324
+ sandboxId: Ga,
1191
1325
  nowMs: Date.now()
1192
- }), ka = _(Ea), Aa = (e) => {
1326
+ }), qa = v(Wa), Ja = (e) => {
1193
1327
  if (Vt(e.metadata).length > 0) return !0;
1194
1328
  let t = e.metadata?.sandboxId;
1195
- return Ht(t ? Jr[t] : null);
1196
- }, ja = (e) => {
1329
+ return Ht(t ? ui[t] : null);
1330
+ }, Ya = (e) => {
1197
1331
  let t = Vt(e.metadata);
1198
1332
  return t.length === 0 || !U ? null : /* @__PURE__ */ P(Bt, {
1199
1333
  refs: t,
1200
1334
  conversationId: U,
1201
1335
  panel: J,
1202
- entries: Yr,
1203
- capabilitiesOf: (e) => Jr[e],
1204
- turnInFlight: Gr,
1336
+ entries: di,
1337
+ capabilitiesOf: (e) => ui[e],
1338
+ turnInFlight: si,
1205
1339
  tr: I,
1206
- onReview: Zr.review,
1207
- retiredSandboxes: Xr
1340
+ onReview: pi.review,
1341
+ retiredSandboxes: fi
1208
1342
  });
1209
- }, Ma = Zr.dialog.view ? Yr[Zr.dialog.view.proposalId] : void 0, Na = Oa?.expiresAtMs ?? null;
1343
+ }, Xa = pi.dialog.view ? di[pi.dialog.view.proposalId] : void 0, Za = Ka?.expiresAtMs ?? null;
1210
1344
  M(() => {
1211
- if (Na === null) return;
1212
- let e = window.setTimeout(() => qi((e) => e + 1), Math.max(0, Na - Date.now()));
1345
+ if (Za === null) return;
1346
+ let e = window.setTimeout(() => la((e) => e + 1), Math.max(0, Za - Date.now()));
1213
1347
  return () => window.clearTimeout(e);
1214
- }, [Na, Ki]);
1215
- let Q = er(() => Ur.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
1348
+ }, [Za, ca]);
1349
+ let Q = hr(() => ai.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
1216
1350
  id: e.id,
1217
1351
  role: e.role,
1218
1352
  text: Ct(e, q, I),
1219
- sessionId: ke(e),
1353
+ sessionId: Ae(e),
1220
1354
  timestamp: e.timestamp
1221
1355
  })).filter((e) => e.text.length > 0), [
1222
- Ur.voice,
1356
+ ai.voice,
1223
1357
  q,
1224
1358
  I
1225
- ]), Pa = j(() => {
1359
+ ]), Qa = j(() => {
1226
1360
  if (Q.length === 0) return;
1227
1361
  let e = /* @__PURE__ */ new Date();
1228
- $t(Me(Q, {
1362
+ $t(Ne(Q, {
1229
1363
  title: I("voiceSession.transcript", "Voice conversation"),
1230
1364
  savedAt: I("voiceSession.savedAt", "Saved"),
1231
1365
  session: I("voiceSession.sessionLabel", "Session"),
1232
1366
  earlier: I("voiceSession.earlierLabel", "Earlier"),
1233
1367
  you: I("voiceSession.speakerYou", "You"),
1234
1368
  assistant: I("voiceSession.speakerAssistant", "Assistant")
1235
- }, e), Ne(L, e), "text/markdown");
1369
+ }, e), Pe(L, e), "text/markdown");
1236
1370
  }, [
1237
1371
  L,
1238
1372
  Q,
1239
1373
  I
1240
- ]), Fa = Yn({ perFileChars: Si }), Ia = N(Fa);
1241
- Ia.current = Fa;
1242
- let La = N(/* @__PURE__ */ new Set()), Ra = N(() => !1), $ = kt({
1374
+ ]), $a = ur({ perFileChars: Ri }), eo = N($a);
1375
+ eo.current = $a;
1376
+ let to = N(/* @__PURE__ */ new Set()), no = N(() => !1), $ = kt({
1243
1377
  onSubmit: j((e, t, n) => {
1244
- let r = ki.current, i = Ke(r), a = () => {
1245
- let a = Ia.current, o = b.getState();
1378
+ let r = Gi.current, i = Ke(r), a = () => {
1379
+ let a = eo.current, o = b.getState();
1246
1380
  if (!Be({
1247
- sessionLive: Ra.current(t),
1381
+ sessionLive: no.current(t),
1248
1382
  boundAtSubmit: r,
1249
1383
  activeConversationId: o.activeConversationId,
1250
1384
  boundConversationExists: o.conversations.some((e) => e.id === i)
@@ -1256,7 +1390,7 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
1256
1390
  ...n,
1257
1391
  handedOver: Dt()
1258
1392
  };
1259
- Ca.current(e, s, {
1393
+ Va.current(e, s, {
1260
1394
  fromPerson: !0,
1261
1395
  voiceSessionId: t,
1262
1396
  voiceTiming: c
@@ -1265,13 +1399,13 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
1265
1399
  if ((() => {
1266
1400
  let e = b.getState();
1267
1401
  return Be({
1268
- sessionLive: Ra.current(t),
1402
+ sessionLive: no.current(t),
1269
1403
  boundAtSubmit: r,
1270
1404
  activeConversationId: e.activeConversationId,
1271
1405
  boundConversationExists: e.conversations.some((e) => e.id === i)
1272
1406
  });
1273
- })() && ua.current(e, t)) {
1274
- Ca.current(e, [], {
1407
+ })() && Oa.current(e, t)) {
1408
+ Va.current(e, [], {
1275
1409
  fromPerson: !0,
1276
1410
  voiceSessionId: t,
1277
1411
  voiceTiming: {
@@ -1281,92 +1415,92 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
1281
1415
  });
1282
1416
  return;
1283
1417
  }
1284
- if (!Ia.current.isBusy) {
1418
+ if (!eo.current.isBusy) {
1285
1419
  a();
1286
1420
  return;
1287
1421
  }
1288
- let o = Date.now(), s = La.current, c = window.setInterval(() => {
1289
- Ia.current.isBusy && Date.now() - o < ar || (window.clearInterval(c), s.delete(c), a());
1422
+ let o = Date.now(), s = to.current, c = window.setInterval(() => {
1423
+ eo.current.isBusy && Date.now() - o < xr || (window.clearInterval(c), s.delete(c), a());
1290
1424
  }, 200);
1291
1425
  s.add(c);
1292
1426
  }, []),
1293
- latestReply: wa,
1294
- language: Ie(_r, H).tag
1427
+ latestReply: Ha,
1428
+ language: Ie(Nr, H).tag
1295
1429
  });
1296
- Ra.current = $.isCurrentSession;
1297
- let za = Ai ? Q.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Q, Ba = $.answerLocally;
1430
+ no.current = $.isCurrentSession;
1431
+ let ro = Ki ? Q.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Q, io = $.answerLocally;
1298
1432
  M(() => {
1299
- ma.current = Ba;
1300
- }, [Ba]);
1301
- let Va = $.active, Ha = er(() => it(Object.values(Yr), U, Xr), [
1302
- Yr,
1433
+ Ma.current = io;
1434
+ }, [io]);
1435
+ let ao = $.active, oo = hr(() => it(Object.values(di), U, fi), [
1436
+ di,
1303
1437
  U,
1304
- Xr
1305
- ]), [Ua, Wa] = tr(null);
1438
+ fi
1439
+ ]), [so, co] = gr(null);
1306
1440
  M(() => {
1307
- Va || Wa(null);
1308
- }, [Va]);
1309
- let Ga = Zr.review, Ka = j(() => {
1310
- let e = Ha[Ha.length - 1];
1441
+ ao || co(null);
1442
+ }, [ao]);
1443
+ let lo = pi.review, uo = j(() => {
1444
+ let e = oo[oo.length - 1];
1311
1445
  if (!e) return;
1312
1446
  let { view: t } = e;
1313
- if (Lt(t) && It(t, Jr[e.session.sandboxId]).offerConfirm) {
1314
- Ga(t);
1447
+ if (Lt(t) && It(t, ui[e.session.sandboxId]).offerConfirm) {
1448
+ lo(t);
1315
1449
  return;
1316
1450
  }
1317
- Wa(t.proposalId);
1451
+ co(t.proposalId);
1318
1452
  }, [
1319
- Ha,
1320
- Jr,
1321
- Ga
1322
- ]), qa = Va ? tt(Ha) : null, Ja = Ua ? Yr[Ua] : void 0, Ya = Va && Ja && Ja.session.conversationId === U ? {
1453
+ oo,
1454
+ ui,
1455
+ lo
1456
+ ]), fo = ao ? tt(oo) : null, po = so ? di[so] : void 0, mo = ao && po && po.session.conversationId === U ? {
1323
1457
  content: /* @__PURE__ */ P(Bt, {
1324
1458
  refs: [{
1325
- proposalId: Ja.view.proposalId,
1326
- sandboxId: Ja.session.sandboxId,
1327
- sessionId: Ja.session.sessionId
1459
+ proposalId: po.view.proposalId,
1460
+ sandboxId: po.session.sandboxId,
1461
+ sessionId: po.session.sessionId
1328
1462
  }],
1329
- conversationId: Ja.session.conversationId,
1463
+ conversationId: po.session.conversationId,
1330
1464
  panel: J,
1331
- entries: Yr,
1332
- capabilitiesOf: (e) => Jr[e],
1333
- turnInFlight: Gr,
1465
+ entries: di,
1466
+ capabilitiesOf: (e) => ui[e],
1467
+ turnInFlight: si,
1334
1468
  tr: I,
1335
- onReview: Ga,
1336
- retiredSandboxes: Xr
1469
+ onReview: lo,
1470
+ retiredSandboxes: fi
1337
1471
  }),
1338
1472
  closeLabel: at(I, $e.trayClose),
1339
- onClose: () => Wa(null)
1340
- } : null, Xa = Zr.asking, Za = fa?.asking === !0, Qa = $.holdListening;
1473
+ onClose: () => co(null)
1474
+ } : null, ho = pi.asking, go = Aa?.asking === !0, _o = $.holdListening;
1341
1475
  M(() => {
1342
- Qa(Va && (Xa || Za));
1476
+ _o(ao && (ho || go));
1343
1477
  }, [
1344
- Va,
1345
- Xa,
1346
- Za,
1347
- Qa
1478
+ ao,
1479
+ ho,
1480
+ go,
1481
+ _o
1348
1482
  ]);
1349
- let $a = N(null), eo = $.announce;
1483
+ let vo = N(null), yo = $.announce;
1350
1484
  M(() => {
1351
- if (!Va) {
1352
- $a.current = null;
1485
+ if (!ao) {
1486
+ vo.current = null;
1353
1487
  return;
1354
1488
  }
1355
- let e = $a.current;
1489
+ let e = vo.current;
1356
1490
  if (e === null) {
1357
- $a.current = new Set(Object.keys(Yr));
1491
+ vo.current = new Set(Object.keys(di));
1358
1492
  return;
1359
1493
  }
1360
- for (let { view: t, session: n } of rt(Ha, e)) {
1494
+ for (let { view: t, session: n } of rt(oo, e)) {
1361
1495
  e.add(t.proposalId);
1362
- let r = Jr[n.sandboxId];
1496
+ let r = ui[n.sandboxId];
1363
1497
  if (!et({
1364
1498
  mode: "api-calls",
1365
1499
  productWriteApproval: z,
1366
1500
  capabilities: r
1367
1501
  })) continue;
1368
1502
  let i = ot(t, It(t, r).offerConfirm, I), a = t.proposalId;
1369
- eo({
1503
+ yo({
1370
1504
  id: `write-readback:${a}`,
1371
1505
  text: i.text,
1372
1506
  lang: i.translated ? H : "en",
@@ -1374,286 +1508,286 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
1374
1508
  });
1375
1509
  }
1376
1510
  }, [
1377
- Va,
1378
- Ha,
1379
- Yr,
1380
- Jr,
1511
+ ao,
1512
+ oo,
1513
+ di,
1514
+ ui,
1381
1515
  z,
1382
1516
  I,
1383
1517
  H,
1384
- eo,
1518
+ yo,
1385
1519
  J
1386
1520
  ]);
1387
- let to = N(!1);
1521
+ let bo = N(!1);
1388
1522
  M(() => {
1389
- to.current = $.active;
1390
- }, [$.active]), M(() => ee((e) => {
1391
- if (!to.current) return !1;
1392
- let t = ki.current;
1523
+ bo.current = $.active;
1524
+ }, [$.active]), M(() => m((e) => {
1525
+ if (!bo.current) return !1;
1526
+ let t = Gi.current;
1393
1527
  return typeof t == "string" ? t === e : b.getState().activeConversationId === e;
1394
1528
  }), []);
1395
- let no = $.start, ro = j(() => {
1396
- let e = b.getState().activeConversationId, t = Ue(Ni());
1397
- Mi(Ge(t, e)), Ui(!0, t.kind === "own"), no();
1529
+ let xo = $.start, So = j(() => {
1530
+ let e = b.getState().activeConversationId, t = Ue(Yi());
1531
+ Ji(Ge(t, e)), aa(!0, t.kind === "own"), xo();
1398
1532
  }, [
1399
- Mi,
1400
- Ui,
1401
- Ni,
1402
- no
1403
- ]), io = er(() => St(Hr?.messages ?? []), [Hr?.messages]), ao = xt(Ur.voice, q, I), oo = xt(io, q, I) > 0, so = j(() => {
1533
+ Ji,
1534
+ aa,
1535
+ Yi,
1536
+ xo
1537
+ ]), Co = hr(() => St(ii?.messages ?? []), [ii?.messages]), wo = xt(ai.voice, q, I), To = xt(Co, q, I) > 0, Eo = j(() => {
1404
1538
  let e = b.getState().activeConversationId;
1405
1539
  if (!e || Q.length === 0) return;
1406
- let t = new Set(io.map((e) => e.id)), n = F();
1540
+ let t = new Set(Co.map((e) => e.id)), n = F();
1407
1541
  K(e, {
1408
1542
  id: n,
1409
1543
  role: "system",
1410
- content: je(Q.filter((e) => t.has(e.id)), {
1544
+ content: Me(Q.filter((e) => t.has(e.id)), {
1411
1545
  intro: I("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
1412
1546
  nothing: I("voiceSession.continuedNothing", "Continued from a voice conversation."),
1413
1547
  more: (e) => I("voiceSession.continuedMore", "…and {{count}} more", { count: e })
1414
1548
  }),
1415
1549
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1416
- metadata: { continuedVoiceTurns: ao }
1417
- }), on.recordCommittedEntries(e, [n], "NOTE", A()), Oi(!1), $.end();
1550
+ metadata: { continuedVoiceTurns: wo }
1551
+ }), on.recordCommittedEntries(e, [n], "NOTE", A()), Wi(!1), $.end();
1418
1552
  }, [
1419
1553
  Q,
1420
- ao,
1421
- io,
1554
+ wo,
1555
+ Co,
1422
1556
  K,
1423
1557
  I,
1424
1558
  $,
1425
- Oi
1426
- ]), co = N({
1559
+ Wi
1560
+ ]), Do = N({
1427
1561
  conversationId: null,
1428
1562
  count: 0
1429
1563
  });
1430
1564
  M(() => {
1431
- $.active && (co.current = {
1565
+ $.active && (Do.current = {
1432
1566
  conversationId: U,
1433
- count: ao
1567
+ count: wo
1434
1568
  });
1435
1569
  }, [$.active]);
1436
- let lo = j(() => {
1437
- let e = co.current, t = ao > (e.conversationId === U ? e.count : 0);
1438
- $.end(), t && Oi(!0);
1570
+ let Oo = j(() => {
1571
+ let e = Do.current, t = wo > (e.conversationId === U ? e.count : 0);
1572
+ $.end(), t && Wi(!0);
1439
1573
  }, [
1440
1574
  U,
1441
- ao,
1575
+ wo,
1442
1576
  $,
1443
- Oi
1577
+ Wi
1444
1578
  ]);
1445
1579
  M(() => {
1446
- (!cr || !zi) && $.active && $.end();
1580
+ (!wr || !ta) && $.active && $.end();
1447
1581
  }, [
1448
- cr,
1449
- zi,
1582
+ wr,
1583
+ ta,
1450
1584
  $
1451
1585
  ]), M(() => {
1452
- let e = ki.current, t = Ke(e), n = b.getState(), r = He({
1586
+ let e = Gi.current, t = Ke(e), n = b.getState(), r = He({
1453
1587
  sessionLive: $.active,
1454
1588
  bound: e,
1455
1589
  activeConversationId: n.activeConversationId,
1456
1590
  boundConversationExists: n.conversations.some((e) => e.id === t)
1457
1591
  });
1458
- Mi(r.bound), r.end && $.end();
1592
+ Ji(r.bound), r.end && $.end();
1459
1593
  }, [
1460
1594
  $,
1461
1595
  U,
1462
- Cr,
1463
- Mi
1596
+ zr,
1597
+ Ji
1464
1598
  ]);
1465
- let uo = N(Re);
1599
+ let ko = N(Re);
1466
1600
  M(() => {
1467
- let e = Ve(uo.current, {
1601
+ let e = Ve(ko.current, {
1468
1602
  activeConversationId: U,
1469
- chatTurnCount: Ea.length,
1603
+ chatTurnCount: Wa.length,
1470
1604
  voiceTurnCount: Q.length,
1471
1605
  sessionLive: $.active,
1472
- sessionBoundTo: ki.current,
1473
- turnInFlight: Gr
1606
+ sessionBoundTo: Gi.current,
1607
+ turnInFlight: si
1474
1608
  });
1475
- uo.current = e.state, e.open && Oi(!0);
1609
+ ko.current = e.state, e.open && Wi(!0);
1476
1610
  }, [
1477
1611
  U,
1478
- Ea.length,
1612
+ Wa.length,
1479
1613
  Q.length,
1480
1614
  $.active,
1481
- Gr,
1482
- Oi
1615
+ si,
1616
+ Wi
1483
1617
  ]), M(() => {
1484
1618
  if (!$.active) {
1485
- Ia.current.clear(), Yi.current = null;
1486
- for (let e of La.current) window.clearInterval(e);
1487
- La.current.clear();
1619
+ eo.current.clear(), da.current = null;
1620
+ for (let e of to.current) window.clearInterval(e);
1621
+ to.current.clear();
1488
1622
  }
1489
1623
  }, [$.active]), M(() => {
1490
- let e = La.current;
1624
+ let e = to.current;
1491
1625
  return () => {
1492
1626
  for (let t of e) window.clearInterval(t);
1493
1627
  e.clear();
1494
1628
  };
1495
1629
  }, []), M(() => {
1496
1630
  let e = b.getState().consumePendingPrompt();
1497
- return e && Ca.current(e), b.subscribe((e, t) => {
1631
+ return e && Va.current(e), b.subscribe((e, t) => {
1498
1632
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
1499
1633
  let e = b.getState().consumePendingPrompt();
1500
- e && Ca.current(e);
1634
+ e && Va.current(e);
1501
1635
  }
1502
1636
  });
1503
1637
  }, []);
1504
- let fo = j((e) => {
1638
+ let Ao = j((e) => {
1505
1639
  let t = U ? b.getState().conversations.find((e) => e.id === U) : void 0;
1506
1640
  if (t && t.mode !== e && J.withdraw(t.id, "mode_switched"), t && en(t)) {
1507
1641
  if (t.mode !== e) {
1508
1642
  let t = p(), n = b.getState().conversations.find((n) => n.mode === e && rn(n, t) && !b.getState().processingByConversationId[n.id]);
1509
- n ? Dr(n.id) : G(void 0, e);
1643
+ n ? Ur(n.id) : G(void 0, e);
1510
1644
  }
1511
- } else U && Er(U, e);
1645
+ } else U && Hr(U, e);
1512
1646
  let n = b.getState().activeConversationId;
1513
- n ? Er(n, e) : Br(!1), Tr(e);
1647
+ n ? Hr(n, e) : ni(!1), Vr(e);
1514
1648
  }, [
1515
1649
  U,
1516
1650
  G,
1517
- Dr,
1518
- Br,
1519
- Er,
1520
- Tr,
1651
+ Ur,
1652
+ ni,
1653
+ Hr,
1654
+ Vr,
1521
1655
  J
1522
- ]), po = j(() => {
1656
+ ]), jo = j(() => {
1523
1657
  let e = b.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
1524
1658
  if (!t) {
1525
- Br(!0), Tr(s);
1659
+ ni(!0), Vr(s);
1526
1660
  return;
1527
1661
  }
1528
1662
  if (t.routedBy === "auto") {
1529
- Br(!0);
1663
+ ni(!0);
1530
1664
  return;
1531
1665
  }
1532
1666
  if (!en(t)) {
1533
- Vr(t.id, s);
1667
+ ri(t.id, s);
1534
1668
  return;
1535
1669
  }
1536
1670
  J.withdraw(t.id, "mode_switched");
1537
1671
  let n = p(), r = e.conversations.find((t) => t.routedBy === "auto" && rn(t, n) && !e.processingByConversationId[t.id]);
1538
- r ? (Dr(r.id), Vr(r.id, s)) : G(void 0, s, { routedBy: "auto" });
1672
+ r ? (Ur(r.id), ri(r.id, s)) : G(void 0, s, { routedBy: "auto" });
1539
1673
  }, [
1540
1674
  G,
1675
+ ri,
1676
+ Ur,
1677
+ ni,
1541
1678
  Vr,
1542
- Dr,
1543
- Br,
1544
- Tr,
1545
1679
  J
1546
- ]), mo = j((e) => {
1547
- if (R.find((t) => t.id === e)?.writeCapable && !ie(b.getState().acknowledgedWriteModes, e)) {
1548
- wi(e);
1680
+ ]), Mo = j((e) => {
1681
+ if (R.find((t) => t.id === e)?.writeCapable && !re(b.getState().acknowledgedWriteModes, e)) {
1682
+ Bi(e);
1549
1683
  return;
1550
1684
  }
1551
- fo(e);
1552
- }, [fo, R]), ho = j(() => {
1553
- let e = Ci;
1554
- if (wi(null), !e) return;
1555
- let t = bi.current;
1556
- if (bi.current = null, t) {
1557
- Rr(e), Z(t.content, t.attachments, t.options);
1685
+ Ao(e);
1686
+ }, [Ao, R]), No = j(() => {
1687
+ let e = zi;
1688
+ if (Bi(null), !e) return;
1689
+ let t = Ii.current;
1690
+ if (Ii.current = null, t) {
1691
+ ei(e), Z(t.content, t.attachments, t.options);
1558
1692
  return;
1559
1693
  }
1560
- Rr(e), fo(e);
1694
+ ei(e), Ao(e);
1561
1695
  }, [
1562
- Ci,
1563
- Rr,
1564
- fo,
1696
+ zi,
1697
+ ei,
1698
+ Ao,
1565
1699
  Z
1566
- ]), go = Ci === null ? void 0 : R.find((e) => e.id === Ci) ?? { id: Ci }, _o = j(() => {
1567
- wi(null);
1568
- let e = bi.current;
1569
- bi.current = null, e && Z(e.content, e.attachments, {
1700
+ ]), Po = zi === null ? void 0 : R.find((e) => e.id === zi) ?? { id: zi }, Fo = j(() => {
1701
+ Bi(null);
1702
+ let e = Ii.current;
1703
+ Ii.current = null, e && Z(e.content, e.attachments, {
1570
1704
  ...e.options,
1571
1705
  autoIntent: "read"
1572
1706
  });
1573
1707
  }, [Z]);
1574
- return /* @__PURE__ */ rr("div", {
1708
+ return /* @__PURE__ */ vr("div", {
1575
1709
  className: "relative flex flex-1 flex-col overflow-hidden",
1576
1710
  children: [
1577
- /* @__PURE__ */ rr("div", {
1711
+ /* @__PURE__ */ vr("div", {
1578
1712
  className: "contents",
1579
1713
  inert: $.active || void 0,
1580
1714
  children: [
1581
- si === null ? null : /* @__PURE__ */ P(Jt, { onDismiss: () => oi(si) }),
1715
+ Ci === null ? null : /* @__PURE__ */ P(Jt, { onDismiss: () => Si(Ci) }),
1582
1716
  Q.length > 0 && !$.active ? /* @__PURE__ */ P(Kt, {
1583
1717
  count: Q.length,
1584
- onOpenTranscript: () => Oi(!0)
1718
+ onOpenTranscript: () => Wi(!0)
1585
1719
  }) : null,
1586
- Ea.length === 0 && (ni || ri) ? /* @__PURE__ */ P(Yt, {
1587
- state: ni ? "loading" : "failed",
1588
- onRetry: fi
1589
- }) : Ea.length === 0 && Hr?.sync?.hasOlder ? /* @__PURE__ */ P("div", {
1720
+ Wa.length === 0 && (vi || yi) ? /* @__PURE__ */ P(Yt, {
1721
+ state: vi ? "loading" : "failed",
1722
+ onRetry: Oi
1723
+ }) : Wa.length === 0 && ii?.sync?.hasOlder ? /* @__PURE__ */ P("div", {
1590
1724
  className: "flex min-h-0 flex-1 flex-col",
1591
1725
  children: /* @__PURE__ */ P(Zt, {
1592
- onShowEarlier: pi,
1593
- disabled: ni
1726
+ onShowEarlier: ki,
1727
+ disabled: vi
1594
1728
  })
1595
- }) : Ea.length === 0 ? /* @__PURE__ */ P(sn, {
1729
+ }) : Wa.length === 0 ? /* @__PURE__ */ P(sn, {
1596
1730
  mode: W,
1597
- onSuggestionClick: xa,
1598
- explainsAuto: vi,
1599
- suggestions: vi && W === "assistant" ? c(R.find((e) => e.id === "assistant")?.suggestions ?? [], R.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
1600
- }) : /* @__PURE__ */ rr("div", {
1731
+ onSuggestionClick: za,
1732
+ explainsAuto: Pi,
1733
+ suggestions: Pi && W === "assistant" ? c(R.find((e) => e.id === "assistant")?.suggestions ?? [], R.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
1734
+ }) : /* @__PURE__ */ vr("div", {
1601
1735
  className: "flex min-h-0 flex-1 flex-col",
1602
- children: [Hr?.sync?.hasOlder ? /* @__PURE__ */ P(Zt, {
1603
- onShowEarlier: pi,
1604
- disabled: ni
1736
+ children: [ii?.sync?.hasOlder ? /* @__PURE__ */ P(Zt, {
1737
+ onShowEarlier: ki,
1738
+ disabled: vi
1605
1739
  }) : null, /* @__PURE__ */ P(mn, {
1606
- onApprovePendingWrite: Zi,
1607
- approvingWriteRef: Gi,
1608
- approvableMessageId: Oa?.messageId ?? null,
1609
- retryableMessageId: ka,
1610
- messages: Ea,
1740
+ onApprovePendingWrite: pa,
1741
+ approvingWriteRef: sa,
1742
+ approvableMessageId: Ka?.messageId ?? null,
1743
+ retryableMessageId: qa,
1744
+ messages: Wa,
1611
1745
  processing: q ?? null,
1612
- streamingMessageId: Kr,
1613
- failedMessageId: qr,
1614
- onRetry: Gi === null ? Sa : void 0,
1615
- renderWriteProposals: ja,
1616
- hidesLegacyWriteCard: Aa
1746
+ streamingMessageId: ci,
1747
+ failedMessageId: li,
1748
+ onRetry: sa === null ? Ba : void 0,
1749
+ renderWriteProposals: Ya,
1750
+ hidesLegacyWriteCard: Ja
1617
1751
  })]
1618
1752
  }),
1619
- ei ? /* @__PURE__ */ P(Xt, { onStartNew: () => G() }) : null,
1620
- ti && U ? /* @__PURE__ */ P(qt, { onUnarchive: () => on.updateConversation(U, { archived: !1 }) }) : null,
1621
- ha === null ? null : /* @__PURE__ */ P(cn, {
1753
+ gi ? /* @__PURE__ */ P(Xt, { onStartNew: () => G() }) : null,
1754
+ _i && U ? /* @__PURE__ */ P(qt, { onUnarchive: () => on.updateConversation(U, { archived: !1 }) }) : null,
1755
+ Na === null ? null : /* @__PURE__ */ P(cn, {
1622
1756
  tr: I,
1623
- onDismiss: () => ga(null)
1757
+ onDismiss: () => Pa(null)
1624
1758
  }),
1625
- Ea.length > 0 && (ni || ri) ? /* @__PURE__ */ P(Yt, {
1626
- state: ni ? "loading" : "failed",
1627
- onRetry: fi,
1759
+ Wa.length > 0 && (vi || yi) ? /* @__PURE__ */ P(Yt, {
1760
+ state: vi ? "loading" : "failed",
1761
+ onRetry: Oi,
1628
1762
  compact: !0
1629
1763
  }) : null,
1630
- /* @__PURE__ */ P(Xn, {
1631
- onStartVoiceSession: $.available && zi ? ro : void 0,
1764
+ /* @__PURE__ */ P(dr, {
1765
+ onStartVoiceSession: $.available && ta ? So : void 0,
1632
1766
  onSend: (e, t) => void Z(e, t, { fromPerson: !0 }),
1633
- onDraftStart: Wi,
1634
- disabled: Gr || Gi !== null || ni || aa,
1635
- readOnly: ei,
1767
+ onDraftStart: oa,
1768
+ disabled: si || sa !== null || vi || Ca,
1769
+ readOnly: gi,
1636
1770
  placeholder: W === "api-calls" ? I("chatArea.placeholderActions", "What would you like me to do?") : I("chatArea.placeholderGeneral", "Ask me anything…"),
1637
1771
  mode: W,
1638
- writeAccessDenied: lr === "denied" && !!Ii?.writeCapable,
1639
- availableModes: gi,
1640
- attachmentCharsPerFile: Si,
1641
- onModeChange: mo,
1642
- auto: _i ? {
1643
- active: vi,
1644
- onSelect: po
1772
+ writeAccessDenied: Tr === "denied" && !!Qi?.writeCapable,
1773
+ availableModes: Mi,
1774
+ attachmentCharsPerFile: Ri,
1775
+ onModeChange: Mo,
1776
+ auto: Ni ? {
1777
+ active: Pi,
1778
+ onSelect: jo
1645
1779
  } : void 0
1646
1780
  })
1647
1781
  ]
1648
1782
  }),
1649
- Di && !$.active ? /* @__PURE__ */ P(Qt, {
1783
+ Ui && !$.active ? /* @__PURE__ */ P(Qt, {
1650
1784
  turns: Q,
1651
- onClose: () => Oi(!1),
1652
- onSave: Pa,
1653
- onContinueInChat: oo ? so : void 0,
1785
+ onClose: () => Wi(!1),
1786
+ onSave: Qa,
1787
+ onContinueInChat: To ? Eo : void 0,
1654
1788
  closeOnEscape: !0,
1655
- onShowEarlier: Hr?.sync?.hasOlder ? pi : void 0,
1656
- showEarlierDisabled: ni
1789
+ onShowEarlier: ii?.sync?.hasOlder ? ki : void 0,
1790
+ showEarlierDisabled: vi
1657
1791
  }) : null,
1658
1792
  $.active && /* @__PURE__ */ P(hn, {
1659
1793
  session: $.session,
@@ -1661,46 +1795,46 @@ var cr = ({ visible: cr = !0, writeAccess: lr = "unknown" }) => {
1661
1795
  capturing: $.capturing,
1662
1796
  interrupting: $.interrupting,
1663
1797
  awaitingEndpoint: $.awaitingEndpoint,
1664
- turns: za,
1798
+ turns: ro,
1665
1799
  spokenChunks: $.spokenChunks,
1666
- attachments: Fa.attachments,
1667
- onAttachFiles: Fa.addFiles,
1668
- onRemoveAttachment: Fa.remove,
1669
- onRetryAttachment: Fa.retry,
1670
- canAttachMore: Fa.canAddMore,
1671
- preparingAttachments: Fa.preparingCount,
1672
- onSaveTranscript: Pa,
1673
- onContinueInChat: so,
1800
+ attachments: $a.attachments,
1801
+ onAttachFiles: $a.addFiles,
1802
+ onRemoveAttachment: $a.remove,
1803
+ onRetryAttachment: $a.retry,
1804
+ canAttachMore: $a.canAddMore,
1805
+ preparingAttachments: $a.preparingCount,
1806
+ onSaveTranscript: Qa,
1807
+ onContinueInChat: Eo,
1674
1808
  onInterrupt: () => {
1675
- $.interrupt(), Xi();
1809
+ $.interrupt(), fa();
1676
1810
  },
1677
- spoken: Ta,
1811
+ spoken: Ua,
1678
1812
  onToggleMute: $.toggleMute,
1679
- onEnd: lo,
1680
- proposalChip: qa ? {
1681
- label: nt(qa, I),
1682
- onOpen: Ka
1813
+ onEnd: Oo,
1814
+ proposalChip: fo ? {
1815
+ label: nt(fo, I),
1816
+ onOpen: uo
1683
1817
  } : null,
1684
- proposalTray: Ya
1818
+ proposalTray: mo
1685
1819
  }),
1686
- /* @__PURE__ */ P(Qn, {
1687
- open: Ci !== null,
1688
- mode: go,
1689
- currentMode: Ii ?? { id: W },
1690
- onConfirm: ho,
1691
- onCancel: _o
1820
+ /* @__PURE__ */ P(pr, {
1821
+ open: zi !== null,
1822
+ mode: Po,
1823
+ currentMode: Qi ?? { id: W },
1824
+ onConfirm: No,
1825
+ onCancel: Fo
1692
1826
  }),
1693
1827
  /* @__PURE__ */ P(Rt, {
1694
- ...Zr.dialog,
1695
- view: Ma?.view ?? Zr.dialog.view,
1696
- serverNow: Ma?.serverNow ?? NaN,
1697
- arrivedAt: Ma?.arrivedAt ?? NaN,
1698
- capabilities: Ma ? Jr[Ma.session.sandboxId] : null,
1699
- turnInFlight: Gr,
1828
+ ...pi.dialog,
1829
+ view: Xa?.view ?? pi.dialog.view,
1830
+ serverNow: Xa?.serverNow ?? NaN,
1831
+ arrivedAt: Xa?.arrivedAt ?? NaN,
1832
+ capabilities: Xa ? ui[Xa.session.sandboxId] : null,
1833
+ turnInFlight: si,
1700
1834
  tr: I
1701
1835
  })
1702
1836
  ]
1703
1837
  });
1704
1838
  };
1705
1839
  //#endregion
1706
- export { cr as AssistantChatArea };
1840
+ export { wr as AssistantChatArea };