@burdenoff/fe-libs 2026.1115.7 → 2026.1115.9
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.
- package/dist/shared/assistant/i18nManifest.d.ts +6 -4
- package/dist/shared/assistant/i18nManifest.js +6 -4
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1108 -1107
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +16 -6
- package/dist/shared/assistant/voice/phraseGate.js +2 -0
- package/dist/shared/assistant/voice/revealSpoken.d.ts +14 -0
- package/dist/shared/assistant/voice/revealSpoken.js +28 -0
- package/dist/shared/assistant/voice/speakableText.d.ts +27 -3
- package/dist/shared/assistant/voice/speakableText.js +149 -120
- package/dist/shared/assistant/voice/speechLabels.js +28 -16
- package/dist/shared/providers/shell/I18nProvider.d.ts +2 -1
- package/dist/shared/providers/shell/I18nProvider.js +42 -42
- package/dist/shared-assistant.js +396 -395
- package/package.json +1 -1
|
@@ -100,186 +100,187 @@ import { buildContinuedFromVoiceNote as rr, buildVoiceTranscriptMarkdown as ir,
|
|
|
100
100
|
import { downloadFile as or } from "../exportConversation.js";
|
|
101
101
|
import { chatTurns as sr, isVoiceTurn as cr, voiceMarker as lr, voiceSessionIdOf as ur } from "../voice/turnVisibility.js";
|
|
102
102
|
import { VoiceChatEnded as dr, VoiceTurnTag as fr } from "./voice/VoiceTurnMarks.js";
|
|
103
|
-
import {
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
109
|
-
import {
|
|
110
|
-
import {
|
|
111
|
-
import {
|
|
112
|
-
import {
|
|
113
|
-
import {
|
|
114
|
-
import {
|
|
115
|
-
import {
|
|
116
|
-
import {
|
|
117
|
-
import {
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
import {
|
|
121
|
-
import {
|
|
122
|
-
import {
|
|
123
|
-
import {
|
|
124
|
-
import {
|
|
125
|
-
import {
|
|
126
|
-
import {
|
|
127
|
-
import {
|
|
128
|
-
import {
|
|
129
|
-
import {
|
|
130
|
-
import {
|
|
131
|
-
import {
|
|
132
|
-
import {
|
|
133
|
-
import {
|
|
134
|
-
import {
|
|
135
|
-
import {
|
|
136
|
-
import {
|
|
137
|
-
import {
|
|
138
|
-
import {
|
|
139
|
-
import {
|
|
140
|
-
import {
|
|
141
|
-
import {
|
|
142
|
-
import {
|
|
143
|
-
import {
|
|
144
|
-
import {
|
|
145
|
-
import {
|
|
146
|
-
import {
|
|
147
|
-
import {
|
|
148
|
-
import {
|
|
103
|
+
import { revealSpokenMarkdown as pr } from "../voice/revealSpoken.js";
|
|
104
|
+
import { isAwaitingOwnConversation as mr, maySendSpokenTurn as hr, planTranscriptAutoOpen as gr, planVoiceSessionBinding as _r, planVoiceSessionStart as vr, planVoiceSpokenEntry as yr, voiceBindingAtStart as br, voiceBindingConversationId as xr } from "../voice/voiceReopen.js";
|
|
105
|
+
import { transcriptAutoOpenSlot as Sr } from "./transcriptAutoOpenSlot.js";
|
|
106
|
+
import { toVoiceReply as Cr } from "../voice/voiceReply.js";
|
|
107
|
+
import { beginApprovalInFlight as wr, endApprovalInFlight as Tr, getApprovalInFlight as Er, markLiveTurn as Dr, newestModelReplyId as Or, resolveApprovablePendingWrite as kr, resolveRetryableMessageId as Ar, subscribeApprovalInFlight as jr } from "../liveTurns.js";
|
|
108
|
+
import { createReadinessTracker as Mr, planAfterTransportFailure as Nr, planTrustedSandboxFailure as Pr } from "../sandboxReadiness.js";
|
|
109
|
+
import { couldBeLocalUiCommand as Fr, isAlreadyThere as Ir, matchLocalUiCommand as Lr, mayBeNavigationFollowUp as Rr, navDestinations as zr, planThemeChange as Br } from "../localUiCommands.js";
|
|
110
|
+
import { backDoneCopy as Vr, chooseDestinationCopy as Hr, chooseLinkedCopy as Ur, entityNounText as Wr, linkNotOpenableCopy as Gr, navigationCommandCopy as Kr, navigationOutcomeCopy as qr, offerExpiredCopy as Jr, offerKeptForUnsavedCopy as Yr, offerNotAvailableCopy as Xr, pickFromListCopy as Zr, recordChoiceCopy as Qr, recordKindsCopy as $r, themeCommandCopy as ei } from "../localUiCommandCopy.js";
|
|
111
|
+
import { offerAssentFor as ti } from "../localeCommands/assent.js";
|
|
112
|
+
import { appControlCopy as ni } from "../appControls/copy.js";
|
|
113
|
+
import { LANGUAGE_REPLY_DEADLINE_MS as ri, languageConfirmationCopy as ii, languageReplyStep as ai } from "../appControls/languageReply.js";
|
|
114
|
+
import { planAppControl as oi } from "../appControls/plan.js";
|
|
115
|
+
import { readControlSnapshot as si } from "../appControls/snapshot.js";
|
|
116
|
+
import { subscribeAssistantControls as ci } from "../appControls/registry.js";
|
|
117
|
+
import { useAssistantControl as li } from "../appControls/useAssistantControl.js";
|
|
118
|
+
import { useControlConfirmDialog as ui } from "./controlConfirmDialog.js";
|
|
119
|
+
import { useLeaveConfirmAsking as di } from "./leaveConfirm.js";
|
|
120
|
+
import { startFocusReturnAfterKeep as fi } from "./leaveConfirmFocus.js";
|
|
121
|
+
import { buildNavigationContext as pi, latestReplyOnSurface as mi, rememberPresentedList as hi } from "../uiActions/linkContext.js";
|
|
122
|
+
import { lookupNamedRecords as gi } from "../uiActions/recordNames.js";
|
|
123
|
+
import { navEntryIds as _i } from "../uiActions/resolveTarget.js";
|
|
124
|
+
import { buildUiCatalogue as vi, markUiCatalogueSent as yi, uiCatalogueSent as bi, uiCatalogueSessionKey as xi } from "../uiActions/uiCatalogue.js";
|
|
125
|
+
import { offerYesOnSurface as Si } from "../uiActions/offerYesOnSurface.js";
|
|
126
|
+
import { UiOfferSession as Ci, sandboxServesUiOffers as wi, uiOfferHintKind as Ti, uiOfferInTime as Ei } from "../uiActions/uiOffers.js";
|
|
127
|
+
import { parseNavIntent as Di } from "../uiActions/navIntent.js";
|
|
128
|
+
import { decideActOnResolve as Oi, n4LeaveGuard as ki } from "../uiActions/actOnResolve.js";
|
|
129
|
+
import { AssistantUiOfferLinks as Ai } from "./AssistantUiOfferLink.js";
|
|
130
|
+
import { assistantBackStack as ji, isBackRunnable as Mi } from "../uiActions/backStack.js";
|
|
131
|
+
import { subscribeDraftPathname as Ni } from "../uiActions/draftPathname.js";
|
|
132
|
+
import { buildNavigateAction as Pi, destinationForPath as Fi, labelForPath as Ii, newestAssistantOnSurface as Li } from "../uiActions/navigateAction.js";
|
|
133
|
+
import { runNavigation as Ri } from "../uiActions/navigationOutcome.js";
|
|
134
|
+
import { assistantHistory as zi } from "../history/historyEngine.js";
|
|
135
|
+
import { conversationHasHistory as Bi, isOtherScopeHistoryConversation as Vi, isReadOnlyHistoryConversation as Hi, isReusableHistoryDraft as Ui } from "../history/historyList.js";
|
|
136
|
+
import { resumeContextFor as Wi } from "../history/historyResume.js";
|
|
137
|
+
import { useAssistantHistoryStatus as Gi } from "../history/historyStatus.js";
|
|
138
|
+
import { useHistoryRowControlsFor as Ki } from "../history/useHistoryRowControls.js";
|
|
139
|
+
import { getHistoryStamp as qi, setHistoryBusyProbe as Ji } from "../history/stampRegistry.js";
|
|
140
|
+
import { resolveConversationDeleteTarget as Yi } from "../conversationDeleteCommand.js";
|
|
141
|
+
import { useAssistantNavigate as Xi } from "./AssistantMarkdownRenderer.js";
|
|
142
|
+
import { useAssistantSpeech as Zi } from "./AssistantSpeechProvider.js";
|
|
143
|
+
import { useAssistantStopTurnLabel as Qi } from "../../providers/shell/useAssistantShellLabels.js";
|
|
144
|
+
import { useThemeOrNull as $i } from "../../providers/shell/ThemeProvider.js";
|
|
145
|
+
import { useVisibleNavItems as ea } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
|
|
146
|
+
import { useAskAboutStore as ta } from "../askAbout/askAboutStore.js";
|
|
147
|
+
import { readMessageFocus as na, withFocusNote as ra } from "../askAbout/focus.js";
|
|
148
|
+
import { useCallback as D, useEffect as O, useLayoutEffect as ia, useMemo as k, useRef as A, useState as j, useSyncExternalStore as aa } from "react";
|
|
149
|
+
import { Fragment as oa, jsx as M, jsxs as sa } from "react/jsx-runtime";
|
|
149
150
|
// src/shared/assistant/ui/AssistantChatArea.tsx
|
|
150
|
-
var
|
|
151
|
+
var ca = 2500, la = 300, ua = 2e4, da = 1e4, fa = 1e4, pa = !1, ma = {
|
|
151
152
|
committing: !1,
|
|
152
153
|
dictating: !1
|
|
153
|
-
},
|
|
154
|
+
}, ha = 6e3;
|
|
154
155
|
function N() {
|
|
155
156
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
156
157
|
}
|
|
157
|
-
var
|
|
158
|
-
let P = jn(),
|
|
158
|
+
var ga = () => () => {}, _a = () => "off", va = { overflowY: "auto" }, ya = ({ visible: ya = !0, writeAccess: ba = "unknown", presentation: xa = "classic", inputRef: Sa, onDraftDirtyChange: Ca, surface: wa, onWindowVoiceChange: Ta, onOpenFull: Ea, onContinuedInChat: Da }) => {
|
|
159
|
+
let P = jn(), Oa = Qi(), F = xa === "compact", I = ze(), ka = Ve(), Aa = D((e) => Be("above", e), []), ja = D((e) => Be("below", e), []), Ma = F && wa === "window", { product: L, modes: R, gatherPageContext: Na, buildPrompt: Pa, reportTurnTimings: Fa, reportTokenUsage: Ia, localUiCommands: La } = Nn(), z = Ct(Nn().writeApproval), Ra = D((e, t) => {
|
|
159
160
|
let n = w.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
|
|
160
161
|
return g({
|
|
161
162
|
mode: e,
|
|
162
163
|
productWriteApproval: z,
|
|
163
164
|
capabilities: r ? n.sandboxWriteCapabilities[r] : null
|
|
164
165
|
});
|
|
165
|
-
}, [z]), { getAccessToken:
|
|
166
|
-
Ga,
|
|
166
|
+
}, [z]), { getAccessToken: za, getWorkspaceToken: Ba, userId: B } = r(), { locale: V, isLocaleLoading: Va } = n(), Ha = w((e) => e.voiceGraceMs), Ua = w((e) => e.handsFreeInterrupt), Wa = w((e) => e.handsFreeStreamNoticeAccepted), Ga = w((e) => e.acceptHandsFreeStreamNotice), Ka = w((e) => e.assistantLanguage), qa = w((e) => e.replyLanguage), Ja = k(() => s(Ka, qa, V), [
|
|
167
167
|
Ka,
|
|
168
|
+
qa,
|
|
168
169
|
V
|
|
169
|
-
]),
|
|
170
|
+
]), Ya = Ja.reply.english, Xa = Ja.replyIsExplicit, Za = Ja.reply.code, { conversations: Qa, activeConversationId: H, mode: U, processingByConversationId: $a, setMode: eo, setConversationMode: to, setActiveConversation: no, createConversation: ro, addMessage: W, updateMessage: io, patchMessage: ao, mergeMessageMetadata: oo, setConversationProcessing: so, clearConversationProcessing: co, setBackendSessionId: lo, clearBackendSessionId: uo, setSandbox: fo, clearSandbox: po, acknowledgedWriteModes: mo, acknowledgeWriteMode: ho, autoRouting: go, setAutoRouting: _o, routeConversation: vo } = w(), G = Qa.find((e) => e.id === H), yo = at(G), bo = yo.all, xo = H ? $a[H] : void 0, So = On(xo?.status), Co = So ? xo?.messageId ?? null : null, wo = xo?.status === "error" ? xo.messageId : null, To = w((e) => e.sandboxWriteCapabilities), { panel: K, entries: Eo, retiredSandboxes: Do } = ee({
|
|
170
171
|
tr: P,
|
|
171
172
|
productWriteApproval: z
|
|
172
|
-
}),
|
|
173
|
+
}), Oo = p({
|
|
173
174
|
approve: (e, t) => K.approve(e, t),
|
|
174
175
|
decline: (e, t, n) => K.decline(e, t, n),
|
|
175
176
|
presented: (e, t) => K.presented(e, t)
|
|
176
|
-
}),
|
|
177
|
+
}), ko = Oo.dismiss, Ao = A(null);
|
|
177
178
|
O(() => {
|
|
178
|
-
|
|
179
|
-
let e =
|
|
180
|
-
|
|
179
|
+
ko();
|
|
180
|
+
let e = Ao.current;
|
|
181
|
+
Ao.current = H, e && e !== H && K.withdraw(e, "conversation_closed"), H && K.openConversation(H);
|
|
181
182
|
}, [
|
|
182
183
|
H,
|
|
183
184
|
K,
|
|
184
|
-
|
|
185
|
+
ko
|
|
185
186
|
]);
|
|
186
|
-
let
|
|
187
|
+
let jo = Hi(G), Mo = Ki(G)?.archivedAt != null, No = Gi((e) => H !== null && H in e.loadingIds), Po = Gi((e) => H !== null && H in e.loadErrorIds), Fo = Gi((e) => e.remoteDelete), [Io, Lo] = j(() => Gi.getState().remoteDelete?.at ?? null), Ro = Fo?.wasActive === !0 && Fo.at !== Io ? Fo.at : null;
|
|
187
188
|
O(() => {
|
|
188
|
-
if (
|
|
189
|
-
let e = window.setTimeout(() =>
|
|
189
|
+
if (Ro === null) return;
|
|
190
|
+
let e = window.setTimeout(() => Lo(Ro), fa);
|
|
190
191
|
return () => window.clearTimeout(e);
|
|
191
|
-
}, [
|
|
192
|
-
let
|
|
193
|
-
loading:
|
|
194
|
-
canUseAdminModes:
|
|
195
|
-
})).current,
|
|
192
|
+
}, [Ro]);
|
|
193
|
+
let zo = T(), { canUseApiCalls: Bo, loading: Vo } = Qe(zo, B), Ho = A(Xn({
|
|
194
|
+
loading: Vo,
|
|
195
|
+
canUseAdminModes: Bo
|
|
196
|
+
})).current, Uo = A(R);
|
|
196
197
|
O(() => {
|
|
197
|
-
|
|
198
|
+
Uo.current = R;
|
|
198
199
|
}, [R]);
|
|
199
|
-
let
|
|
200
|
+
let Wo = () => {
|
|
200
201
|
let e = w.getState().activeConversationId;
|
|
201
|
-
e &&
|
|
202
|
-
},
|
|
202
|
+
e && zi.openConversation(e, { modes: Uo.current });
|
|
203
|
+
}, Go = () => {
|
|
203
204
|
let e = w.getState().activeConversationId;
|
|
204
|
-
e &&
|
|
205
|
-
},
|
|
205
|
+
e && zi.loadEarlier(e);
|
|
206
|
+
}, Ko = A(za);
|
|
206
207
|
O(() => {
|
|
207
|
-
|
|
208
|
-
}, [
|
|
209
|
-
let
|
|
208
|
+
Ko.current = za;
|
|
209
|
+
}, [za]);
|
|
210
|
+
let qo = !!L && Fa !== !1;
|
|
210
211
|
O(() => {
|
|
211
|
-
if (
|
|
212
|
+
if (qo) return pn({ send: (e) => fn(e, {
|
|
212
213
|
workspaceId: T(),
|
|
213
214
|
authContext: {
|
|
214
|
-
accessToken:
|
|
215
|
+
accessToken: Ko.current(),
|
|
215
216
|
organizationId: Vt()
|
|
216
217
|
}
|
|
217
218
|
}) });
|
|
218
|
-
}, [
|
|
219
|
-
|
|
220
|
-
loading:
|
|
221
|
-
canUseAdminModes:
|
|
219
|
+
}, [qo]), O(() => {
|
|
220
|
+
Ho.update({
|
|
221
|
+
loading: Vo,
|
|
222
|
+
canUseAdminModes: Bo
|
|
222
223
|
});
|
|
223
224
|
}, [
|
|
225
|
+
Ho,
|
|
224
226
|
Vo,
|
|
225
|
-
Bo
|
|
226
|
-
zo
|
|
227
|
+
Bo
|
|
227
228
|
]), O(() => () => {
|
|
228
|
-
|
|
229
|
-
}, [
|
|
230
|
-
let
|
|
229
|
+
Ho.abandon();
|
|
230
|
+
}, [Ho]);
|
|
231
|
+
let Jo = k(() => R.filter((e) => !e.requiresAdmin || Bo), [R, Bo]), Yo = fe(Jo), Xo = go && Yo, Zo = A(Yo);
|
|
231
232
|
O(() => {
|
|
232
|
-
|
|
233
|
-
}, [
|
|
234
|
-
let
|
|
233
|
+
Zo.current = Yo;
|
|
234
|
+
}, [Yo]);
|
|
235
|
+
let Qo = A(null), $o = A(!1), [es, ts] = j(!1), ns = gn(R), [rs, is] = j(null), [as, os] = j(() => Sr.openFor());
|
|
235
236
|
O(() => {
|
|
236
|
-
|
|
237
|
-
}, [
|
|
238
|
-
let
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
Sr.setOpenFor(as);
|
|
238
|
+
}, [as]);
|
|
239
|
+
let ss = as !== null && as === H, q = He(), cs = Ue(), J = q.open && cs !== null, ls = q.close, us = A(J);
|
|
240
|
+
ia(() => {
|
|
241
|
+
us.current = J;
|
|
241
242
|
}, [J]);
|
|
242
|
-
let
|
|
243
|
-
e &&
|
|
243
|
+
let ds = D((e) => {
|
|
244
|
+
e && us.current || e && I || os(e ? w.getState().activeConversationId : null);
|
|
244
245
|
}, [I]);
|
|
245
246
|
O(() => {
|
|
246
|
-
|
|
247
|
+
os((e) => e !== null && e !== H ? null : e);
|
|
247
248
|
}, [H]);
|
|
248
|
-
let
|
|
249
|
-
|
|
250
|
-
}, []),
|
|
249
|
+
let fs = A(void 0), [ps, ms] = j(!1), [hs, gs] = j(!1), _s = D((e) => {
|
|
250
|
+
fs.current = e, ms(mr(e));
|
|
251
|
+
}, []), vs = A(null), ys = A(!1), bs = D(() => {
|
|
251
252
|
let e = w.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
|
|
252
253
|
return !t || !n ? null : {
|
|
253
254
|
id: t,
|
|
254
|
-
reusableDraft:
|
|
255
|
+
reusableDraft: Ui(n, qi()),
|
|
255
256
|
liveProposals: K.liveFor(t).count,
|
|
256
257
|
turnInFlight: On(e.processingByConversationId[t]?.status)
|
|
257
258
|
};
|
|
258
|
-
}, [K]),
|
|
259
|
+
}, [K]), xs = A({}), Ss = A(on(Mr())), Cs = A(new Jt()), ws = A(/* @__PURE__ */ new Set()), Ts = k(() => R.find((e) => e.id === U), [R, U]), Es = w((e) => {
|
|
259
260
|
let t = e.sandboxesByMode[U]?.sandboxId;
|
|
260
261
|
return t ? e.sandboxWriteCapabilities[t] : void 0;
|
|
261
|
-
}),
|
|
262
|
+
}), Ds = Ts !== void 0 && g({
|
|
262
263
|
mode: U,
|
|
263
264
|
productWriteApproval: z,
|
|
264
|
-
capabilities:
|
|
265
|
-
}),
|
|
265
|
+
capabilities: Es
|
|
266
|
+
}), Os = U === "assistant" || Ts !== void 0 && !Ts.writeCapable && !gt(U) || Ds;
|
|
266
267
|
O(() => {
|
|
267
|
-
let e = R.find((e) => e.id === "assistant" || !e.requiresAdmin ||
|
|
268
|
-
U !== "assistant" &&
|
|
268
|
+
let e = R.find((e) => e.id === "assistant" || !e.requiresAdmin || Bo)?.id ?? R[0]?.id ?? "assistant";
|
|
269
|
+
U !== "assistant" && Ts?.writeCapable && !Jn(mo, U) ? eo(e) : Vo || (!Ts || Ts.requiresAdmin && !Bo) && U !== e && eo(e);
|
|
269
270
|
}, [
|
|
270
271
|
U,
|
|
271
|
-
|
|
272
|
-
zo,
|
|
272
|
+
Ts,
|
|
273
273
|
Bo,
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
Vo,
|
|
275
|
+
eo,
|
|
276
|
+
mo,
|
|
276
277
|
R
|
|
277
278
|
]);
|
|
278
|
-
let
|
|
279
|
-
|
|
280
|
-
}, [
|
|
279
|
+
let ks = D((e, t, n, r) => {
|
|
280
|
+
so(e, n, t, null, r);
|
|
281
|
+
}, [so]), As = D(async (e, t, n, r, i, a = null) => {
|
|
281
282
|
let o = (e, t) => {
|
|
282
|
-
r &&
|
|
283
|
+
r && ks(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
|
|
283
284
|
}, s = (e) => {
|
|
284
285
|
r && E(r.assistantMessageId, e);
|
|
285
286
|
}, c = () => {
|
|
@@ -287,7 +288,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
287
288
|
}, l = () => a !== null && (a.signal.aborted || T() !== t), u = () => {
|
|
288
289
|
if (l()) throw new Yt("cancelled");
|
|
289
290
|
}, d = w.getState().sandboxesByMode[e]?.sandboxId ?? null, f = !1, p = !1, ee = !1, m = !1, h = !1, g = async (r) => {
|
|
290
|
-
if (i && !
|
|
291
|
+
if (i && !Cs.current.has(r) && Ss.current.isFresh(r)) return f = !0, !0;
|
|
291
292
|
ee = !0;
|
|
292
293
|
let o = !1;
|
|
293
294
|
try {
|
|
@@ -296,42 +297,42 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
296
297
|
});
|
|
297
298
|
} catch {
|
|
298
299
|
if (l()) throw new Yt("cancelled");
|
|
299
|
-
return
|
|
300
|
+
return Ss.current.invalidate(r), Cs.current.add(r), a?.dead.push(r), h = !0, !1;
|
|
300
301
|
}
|
|
301
|
-
return u(),
|
|
302
|
+
return u(), Ss.current.markVerified(r), o && (m = !0), !0;
|
|
302
303
|
};
|
|
303
|
-
if (d && (
|
|
304
|
+
if (d && (fo(e, d, "provisioning"), o("provisioning", "reusingEnvironment"), await g(d) || (fo(e, null, "provisioning"), d = null)), !d) {
|
|
304
305
|
o("provisioning", "lookingForEnvironment");
|
|
305
|
-
let r = await dt(t, L, e, Mn(), n,
|
|
306
|
+
let r = await dt(t, L, e, Mn(), n, Cs.current, z);
|
|
306
307
|
u();
|
|
307
308
|
let i = r?.id ?? null;
|
|
308
309
|
if (i) {
|
|
309
|
-
|
|
310
|
+
fo(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
|
|
310
311
|
let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
|
|
311
|
-
t && c(), await g(i) ? (d = i, t && (m = !0)) :
|
|
312
|
+
t && c(), await g(i) ? (d = i, t && (m = !0)) : fo(e, null, "provisioning");
|
|
312
313
|
}
|
|
313
314
|
}
|
|
314
315
|
if (!d) {
|
|
315
316
|
if (a && !a.mayCreate) throw new Yt("no-create");
|
|
316
|
-
if (s("provisionStarted"), e === "api-calls" && !
|
|
317
|
-
o("provisioning", "startingEnvironment"),
|
|
318
|
-
let r = a ? [] : await yt(t, L, e, Mn(), n,
|
|
317
|
+
if (s("provisionStarted"), e === "api-calls" && !za()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
318
|
+
o("provisioning", "startingEnvironment"), fo(e, null, "provisioning");
|
|
319
|
+
let r = a ? [] : await yt(t, L, e, Mn(), n, Cs.current, z);
|
|
319
320
|
if (r.length > 0) {
|
|
320
321
|
let e = new Set(r);
|
|
321
|
-
for (let e of r)
|
|
322
|
+
for (let e of r) Ss.current.invalidate(e), Cs.current.add(e);
|
|
322
323
|
let t = w.getState().sandboxesByMode;
|
|
323
|
-
for (let [n, r] of Object.entries(t)) y(n) && r?.sandboxId && e.has(r.sandboxId) &&
|
|
324
|
+
for (let [n, r] of Object.entries(t)) y(n) && r?.sandboxId && e.has(r.sandboxId) && po(n);
|
|
324
325
|
}
|
|
325
326
|
s("createRequested");
|
|
326
327
|
let i = a?.beginCreate();
|
|
327
328
|
try {
|
|
328
|
-
d = await lt(L, e, t, Mn(),
|
|
329
|
+
d = await lt(L, e, t, Mn(), la, n, { writeApproval: z });
|
|
329
330
|
} finally {
|
|
330
331
|
i?.();
|
|
331
332
|
}
|
|
332
|
-
p = !0, u(),
|
|
333
|
+
p = !0, u(), fo(e, d, "provisioning"), await St(d, t, n, 3e5), u(), s("sandboxRunning"), await xt(d, t, e, n, 9e4), u(), s("serviceReady"), Ss.current.markVerified(d);
|
|
333
334
|
}
|
|
334
|
-
return
|
|
335
|
+
return fo(e, d, "running"), {
|
|
335
336
|
sandboxId: d,
|
|
336
337
|
sandboxIsNew: p,
|
|
337
338
|
sandboxProbed: ee,
|
|
@@ -340,17 +341,17 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
340
341
|
trustedFromCache: f
|
|
341
342
|
};
|
|
342
343
|
}, [
|
|
343
|
-
|
|
344
|
-
|
|
344
|
+
po,
|
|
345
|
+
za,
|
|
345
346
|
L,
|
|
346
347
|
z,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
]),
|
|
350
|
-
let s = await tn(i, r, (e) =>
|
|
351
|
-
for (let e of s.dead)
|
|
352
|
-
s.verified && !
|
|
353
|
-
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await
|
|
348
|
+
fo,
|
|
349
|
+
ks
|
|
350
|
+
]), js = D(async function e(t, n, r, i, a, o = {}) {
|
|
351
|
+
let s = await tn(i, r, (e) => ks(t, n, "provisioning", e), () => E(n, "prewarmJoined"));
|
|
352
|
+
for (let e of s.dead) Ss.current.invalidate(e), Cs.current.add(e);
|
|
353
|
+
s.verified && !Cs.current.has(s.verified) && Ss.current.markVerified(s.verified), s.joined && cn(n, { prewarm: s.joined });
|
|
354
|
+
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await As(r, i, a, {
|
|
354
355
|
conversationId: t,
|
|
355
356
|
assistantMessageId: n
|
|
356
357
|
}, o.trustCache !== !1), ee = Zt(i, r, c);
|
|
@@ -363,7 +364,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
363
364
|
if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
|
|
364
365
|
g = e;
|
|
365
366
|
} catch {
|
|
366
|
-
|
|
367
|
+
uo(t), m = null;
|
|
367
368
|
}
|
|
368
369
|
}
|
|
369
370
|
let te = !1;
|
|
@@ -375,24 +376,24 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
375
376
|
userId: B
|
|
376
377
|
}), Date.now());
|
|
377
378
|
if (e) {
|
|
378
|
-
"pending" in e &&
|
|
379
|
+
"pending" in e && ks(t, n, "connecting", "preparingSession");
|
|
379
380
|
let o = "sessionId" in e ? e.sessionId : await e.pending;
|
|
380
|
-
if (o && !
|
|
381
|
-
(await mt(c, i, o, r, a)).mode === r && (m = o, te = !0,
|
|
381
|
+
if (o && !Cs.current.has(c)) try {
|
|
382
|
+
(await mt(c, i, o, r, a)).mode === r && (m = o, te = !0, lo(t, m), h = !0);
|
|
382
383
|
} catch {}
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
386
|
if (!m) {
|
|
386
|
-
|
|
387
|
+
ks(t, n, "connecting", "preparingSession");
|
|
387
388
|
let s;
|
|
388
389
|
try {
|
|
389
390
|
s = await ut(c, i, r, a);
|
|
390
391
|
} catch (s) {
|
|
391
392
|
if (p) {
|
|
392
|
-
|
|
393
|
-
let l =
|
|
394
|
-
if (l === "check-network" && (l = await
|
|
395
|
-
p || cn(n, { cacheProofFailed: !0 }), l === "replace" && (
|
|
393
|
+
Ss.current.invalidate(c);
|
|
394
|
+
let l = Pr(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
|
|
395
|
+
if (l === "check-network" && (l = await Nr(() => dt(i, L, r, Mn(), a, Cs.current, z))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
|
|
396
|
+
p || cn(n, { cacheProofFailed: !0 }), l === "replace" && (Cs.current.add(c), uo(t), po(r), K.retireSandbox(c));
|
|
396
397
|
let s = await e(t, n, r, i, a, {
|
|
397
398
|
...o,
|
|
398
399
|
trustCache: !1
|
|
@@ -407,7 +408,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
407
408
|
}
|
|
408
409
|
throw s;
|
|
409
410
|
}
|
|
410
|
-
m = s.sessionId,
|
|
411
|
+
m = s.sessionId, lo(t, m), h = !0;
|
|
411
412
|
}
|
|
412
413
|
return {
|
|
413
414
|
sandboxId: c,
|
|
@@ -422,55 +423,55 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
422
423
|
knownFloor: _
|
|
423
424
|
};
|
|
424
425
|
}, [
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
426
|
+
As,
|
|
427
|
+
uo,
|
|
428
|
+
po,
|
|
428
429
|
L,
|
|
429
430
|
z,
|
|
430
|
-
|
|
431
|
-
|
|
431
|
+
lo,
|
|
432
|
+
ks,
|
|
432
433
|
B,
|
|
433
434
|
K
|
|
434
|
-
]),
|
|
435
|
+
]), Ms = D((e, t = !1) => {
|
|
435
436
|
let n = T();
|
|
436
437
|
if (!n) return;
|
|
437
438
|
let r = w.getState(), i = Date.now(), a = en({
|
|
438
439
|
autoRouting: r.autoRouting,
|
|
439
|
-
autoOffered:
|
|
440
|
+
autoOffered: Zo.current,
|
|
440
441
|
active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
|
|
441
442
|
selectedMode: r.mode,
|
|
442
443
|
autoReadMode: b,
|
|
443
|
-
modes:
|
|
444
|
+
modes: Uo.current,
|
|
444
445
|
acknowledgedWriteModes: r.acknowledgedWriteModes,
|
|
445
|
-
adminAccess:
|
|
446
|
+
adminAccess: Ho.read(),
|
|
446
447
|
dictated: e,
|
|
447
|
-
voiceProposalBound: (e) =>
|
|
448
|
+
voiceProposalBound: (e) => Ra(e),
|
|
448
449
|
turnInFlight: Object.values(r.processingByConversationId).some((e) => On(e?.status)),
|
|
449
450
|
...an(n),
|
|
450
451
|
now: i
|
|
451
452
|
});
|
|
452
453
|
if (!a) return;
|
|
453
454
|
let o = rn(n, a, i), s = {
|
|
454
|
-
accessToken:
|
|
455
|
-
workspaceToken:
|
|
455
|
+
accessToken: za(),
|
|
456
|
+
workspaceToken: Ba(),
|
|
456
457
|
userId: B,
|
|
457
458
|
organizationId: Vt()
|
|
458
459
|
};
|
|
459
|
-
|
|
460
|
+
As(a.mode, n, s, null, !0, o).then((e) => {
|
|
460
461
|
if (o.finish({
|
|
461
462
|
ok: !0,
|
|
462
463
|
sandboxId: e.sandboxId,
|
|
463
464
|
didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
|
|
464
465
|
booted: e.sandboxIsNew || e.sandboxAdopted,
|
|
465
466
|
dead: o.dead
|
|
466
|
-
}), o.signal.aborted || T() !== n ||
|
|
467
|
-
let r = w.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c =
|
|
467
|
+
}), o.signal.aborted || T() !== n || Cs.current.has(e.sandboxId)) return;
|
|
468
|
+
let r = w.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = qi();
|
|
468
469
|
$t({
|
|
469
470
|
active: i ? {
|
|
470
471
|
mode: i.mode,
|
|
471
472
|
backendSessionId: i.backendSessionId,
|
|
472
|
-
continuable: !
|
|
473
|
-
hasHistory:
|
|
473
|
+
continuable: !Hi(i) && !Vi(i, c),
|
|
474
|
+
hasHistory: Bi(i)
|
|
474
475
|
} : void 0,
|
|
475
476
|
mode: a.mode
|
|
476
477
|
}) && nn(Qt({
|
|
@@ -482,7 +483,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
482
483
|
}, (e) => {
|
|
483
484
|
if (!(e instanceof Yt) && !o.signal.aborted && T() === n) {
|
|
484
485
|
let e = w.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
|
|
485
|
-
e && (
|
|
486
|
+
e && (Ss.current.invalidate(e), Cs.current.add(e), o.dead.push(e), po(a.mode));
|
|
486
487
|
}
|
|
487
488
|
o.finish({
|
|
488
489
|
ok: !1,
|
|
@@ -492,68 +493,68 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
492
493
|
});
|
|
493
494
|
});
|
|
494
495
|
}, [
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
Ra,
|
|
496
|
+
As,
|
|
497
|
+
Ho,
|
|
498
|
+
po,
|
|
499
499
|
za,
|
|
500
|
+
Ba,
|
|
500
501
|
B,
|
|
501
|
-
|
|
502
|
-
]),
|
|
503
|
-
O(() => () =>
|
|
504
|
-
let
|
|
502
|
+
Ra
|
|
503
|
+
]), Ns = A(!1), Ps = A(null), Fs = k(() => a(), []);
|
|
504
|
+
O(() => () => Fs.cancel(), [Fs]);
|
|
505
|
+
let Is = aa(jr, Er, Er)?.reference ?? null, [Ls, Rs] = j(0), zs = A(/* @__PURE__ */ new Set()), Bs = A(null), Vs = D(() => {
|
|
505
506
|
let e = w.getState(), t = e.activeConversationId;
|
|
506
507
|
if (!t) return null;
|
|
507
508
|
let n = e.processingByConversationId[t], r = On(n?.status) ? n?.messageId ?? null : null;
|
|
508
509
|
if (!An({
|
|
509
510
|
interruptedTurnId: r,
|
|
510
511
|
activeTurnId: r,
|
|
511
|
-
alreadyRequested: r ?
|
|
512
|
+
alreadyRequested: r ? zs.current.has(r) : !1
|
|
512
513
|
}).send || !r) return null;
|
|
513
|
-
|
|
514
|
+
zs.current.add(r);
|
|
514
515
|
let i = ot(e), a = T(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
|
|
515
516
|
return i && a && o && st(i.sandboxId, a, o, i.mode, {
|
|
516
|
-
accessToken:
|
|
517
|
-
workspaceToken:
|
|
517
|
+
accessToken: za(),
|
|
518
|
+
workspaceToken: Ba(),
|
|
518
519
|
userId: B,
|
|
519
520
|
organizationId: Vt()
|
|
520
521
|
}), r;
|
|
521
522
|
}, [
|
|
522
523
|
B,
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
]),
|
|
526
|
-
let e =
|
|
524
|
+
za,
|
|
525
|
+
Ba
|
|
526
|
+
]), Hs = D(() => {
|
|
527
|
+
let e = Vs();
|
|
527
528
|
return e && (Mt(e), kt.abort(e)), e;
|
|
528
|
-
}, [
|
|
529
|
+
}, [Vs]), Us = D(() => {
|
|
529
530
|
let e = w.getState().activeConversationId;
|
|
530
|
-
|
|
531
|
-
}, [
|
|
531
|
+
Hs(), e && K.declineForReply(e, "corrected", "spoken");
|
|
532
|
+
}, [Hs, K]), Ws = D(async (e) => {
|
|
532
533
|
let t = w.getState(), n = ot(t), r = T(), i = t.activeConversationId;
|
|
533
534
|
if (!n || !r || !i || oe(t.sandboxWriteCapabilities[n.sandboxId])) return;
|
|
534
|
-
let a = t.conversations.find((e) => e.id === i), o = a ?
|
|
535
|
+
let a = t.conversations.find((e) => e.id === i), o = a ? kr(sr(a.messages), {
|
|
535
536
|
sessionId: a.backendSessionId,
|
|
536
537
|
sandboxId: n.sandboxId,
|
|
537
538
|
nowMs: Date.now()
|
|
538
539
|
}) : null;
|
|
539
540
|
if (o?.reference !== e) {
|
|
540
|
-
|
|
541
|
+
Rs((e) => e + 1);
|
|
541
542
|
return;
|
|
542
543
|
}
|
|
543
544
|
let s = {
|
|
544
545
|
conversationId: i,
|
|
545
546
|
reference: e
|
|
546
547
|
};
|
|
547
|
-
if (!
|
|
548
|
+
if (!wr(s)) return;
|
|
548
549
|
try {
|
|
549
550
|
await ct(n.sandboxId, r, e, n.mode, {
|
|
550
|
-
accessToken:
|
|
551
|
-
workspaceToken:
|
|
551
|
+
accessToken: za(),
|
|
552
|
+
workspaceToken: Ba(),
|
|
552
553
|
userId: B,
|
|
553
554
|
organizationId: Vt()
|
|
554
555
|
});
|
|
555
556
|
} catch (e) {
|
|
556
|
-
|
|
557
|
+
Tr(s), W(i, {
|
|
557
558
|
id: N(),
|
|
558
559
|
role: "system",
|
|
559
560
|
content: e instanceof Error ? e.message : "The change could not be approved.",
|
|
@@ -561,69 +562,69 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
561
562
|
});
|
|
562
563
|
return;
|
|
563
564
|
}
|
|
564
|
-
|
|
565
|
+
Tr(s), oo(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
565
566
|
let c = w.getState(), l = c.conversations.find((e) => e.id === i);
|
|
566
|
-
c.activeConversationId === i && l && c.mode === n.mode && l.backendSessionId === a?.backendSessionId && ot(c)?.sandboxId === n.sandboxId && !On(c.processingByConversationId[i]?.status) &&
|
|
567
|
+
c.activeConversationId === i && l && c.mode === n.mode && l.backendSessionId === a?.backendSessionId && ot(c)?.sandboxId === n.sandboxId && !On(c.processingByConversationId[i]?.status) && Or(sr(l.messages)) === o.messageId && Yc.current(P("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
|
|
567
568
|
approvalFollowUp: { approvedReplyId: o.messageId },
|
|
568
569
|
targetConversationId: i
|
|
569
570
|
});
|
|
570
571
|
}, [
|
|
571
572
|
B,
|
|
572
573
|
W,
|
|
573
|
-
|
|
574
|
+
oo,
|
|
574
575
|
P
|
|
575
|
-
]),
|
|
576
|
-
let n =
|
|
576
|
+
]), Gs = $i(), { speakFinishedReply: Ks, speakingMessageId: qs, stop: Js } = Zi(), Ys = A(null), Xs = D((e, t) => {
|
|
577
|
+
let n = Ys.current;
|
|
577
578
|
n?.token === e && n.exchange === null && (n.exchange = t);
|
|
578
|
-
}, []),
|
|
579
|
-
let t =
|
|
579
|
+
}, []), Zs = D((e) => {
|
|
580
|
+
let t = Ys.current;
|
|
580
581
|
e !== void 0 && t?.token === e && (t.handled = !0);
|
|
581
|
-
}, []),
|
|
582
|
-
|
|
583
|
-
}, [
|
|
584
|
-
theme:
|
|
585
|
-
navigate:
|
|
586
|
-
navItems:
|
|
587
|
-
options:
|
|
588
|
-
navPermissionsSettled:
|
|
589
|
-
navSimulating:
|
|
582
|
+
}, []), Qs = D((e, t) => {
|
|
583
|
+
Xs(e, t), us.current && At(t);
|
|
584
|
+
}, [Xs]), $s = Xi(), { items: ec, permissionsSettled: tc, simulating: nc } = ea(), Y = A({
|
|
585
|
+
theme: Gs,
|
|
586
|
+
navigate: $s,
|
|
587
|
+
navItems: ec,
|
|
588
|
+
options: La ?? {},
|
|
589
|
+
navPermissionsSettled: tc,
|
|
590
|
+
navSimulating: nc
|
|
590
591
|
});
|
|
591
592
|
O(() => {
|
|
592
593
|
Y.current = {
|
|
593
|
-
theme:
|
|
594
|
-
navigate:
|
|
595
|
-
navItems:
|
|
596
|
-
options:
|
|
597
|
-
navPermissionsSettled:
|
|
598
|
-
navSimulating:
|
|
594
|
+
theme: Gs,
|
|
595
|
+
navigate: $s,
|
|
596
|
+
navItems: ec,
|
|
597
|
+
options: La ?? {},
|
|
598
|
+
navPermissionsSettled: tc,
|
|
599
|
+
navSimulating: nc
|
|
599
600
|
};
|
|
600
601
|
}, [
|
|
601
|
-
|
|
602
|
-
Qs,
|
|
602
|
+
Gs,
|
|
603
603
|
$s,
|
|
604
|
-
Ia,
|
|
605
604
|
ec,
|
|
606
|
-
|
|
605
|
+
La,
|
|
606
|
+
tc,
|
|
607
|
+
nc
|
|
607
608
|
]);
|
|
608
609
|
let X = A(!0);
|
|
609
610
|
O(() => (X.current = !0, () => {
|
|
610
611
|
X.current = !1;
|
|
611
612
|
}), []);
|
|
612
|
-
let
|
|
613
|
+
let rc = A({
|
|
613
614
|
tr: P,
|
|
614
615
|
locale: V
|
|
615
|
-
}),
|
|
616
|
-
|
|
617
|
-
let t =
|
|
618
|
-
t && (
|
|
619
|
-
if (
|
|
616
|
+
}), ic = A(null), [ac, oc] = j(null), sc = A(null), cc = D((e) => {
|
|
617
|
+
sc.current !== null && (window.clearTimeout(sc.current), sc.current = null);
|
|
618
|
+
let t = ic.current;
|
|
619
|
+
t && (ic.current = null, window.clearTimeout(t.deadline), X.current && oc(null), e && X.current && (sc.current = window.setTimeout(() => {
|
|
620
|
+
if (sc.current = null, !X.current) return;
|
|
620
621
|
let e = w.getState();
|
|
621
622
|
if (e.activeConversationId !== t.conversationId) return;
|
|
622
623
|
let n = e.conversations.find((e) => e.id === t.conversationId)?.messages.find((e) => e.id === t.messageId);
|
|
623
624
|
if (!n) return;
|
|
624
|
-
let r =
|
|
625
|
+
let r = rc.current, i = Qn(n, null, r.tr);
|
|
625
626
|
if (i.kind !== "output") return;
|
|
626
|
-
let a =
|
|
627
|
+
let a = ii(n, r.tr);
|
|
627
628
|
kt.publish(n.id, {
|
|
628
629
|
conversationId: t.conversationId,
|
|
629
630
|
channel: n.metadata?.voice === !0 ? "voice" : "chat",
|
|
@@ -633,44 +634,44 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
633
634
|
final: !0
|
|
634
635
|
});
|
|
635
636
|
}, 0)));
|
|
636
|
-
}, []),
|
|
637
|
+
}, []), lc = D(() => cc(!0), [cc]);
|
|
637
638
|
O(() => {
|
|
638
|
-
|
|
639
|
+
rc.current = {
|
|
639
640
|
tr: P,
|
|
640
641
|
locale: V
|
|
641
642
|
};
|
|
642
|
-
let e =
|
|
643
|
+
let e = ic.current;
|
|
643
644
|
if (!e) return;
|
|
644
|
-
let t =
|
|
645
|
+
let t = ai({
|
|
645
646
|
wanted: e.wanted,
|
|
646
647
|
locale: V,
|
|
647
|
-
isLoading:
|
|
648
|
-
translatedNow:
|
|
648
|
+
isLoading: Va(e.wanted),
|
|
649
|
+
translatedNow: ni(P, e.reply).translated
|
|
649
650
|
});
|
|
650
|
-
if (t === "write")
|
|
651
|
+
if (t === "write") lc();
|
|
651
652
|
else if (t === "grace") {
|
|
652
|
-
let e = window.setTimeout(
|
|
653
|
+
let e = window.setTimeout(lc, 400);
|
|
653
654
|
return () => window.clearTimeout(e);
|
|
654
655
|
}
|
|
655
656
|
}, [
|
|
656
657
|
P,
|
|
657
658
|
V,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
]), O(() => () =>
|
|
662
|
-
let
|
|
659
|
+
Va,
|
|
660
|
+
ac,
|
|
661
|
+
lc
|
|
662
|
+
]), O(() => () => cc(!1), [cc]);
|
|
663
|
+
let uc = A(null), [dc, fc] = j(!1), [pc, mc] = j(null), [Z] = j(() => new Ci()), [hc, gc] = j(0), _c = D(() => gc((e) => e + 1), []), vc = D(() => {
|
|
663
664
|
let e = Y.current;
|
|
664
665
|
return {
|
|
665
|
-
destinations:
|
|
666
|
+
destinations: zr(e.navItems),
|
|
666
667
|
permissionsSettled: e.navPermissionsSettled,
|
|
667
668
|
simulating: e.navSimulating
|
|
668
669
|
};
|
|
669
|
-
}, []),
|
|
670
|
+
}, []), yc = A(B);
|
|
670
671
|
O(() => {
|
|
671
|
-
|
|
672
|
+
yc.current = B;
|
|
672
673
|
}, [B]);
|
|
673
|
-
let
|
|
674
|
+
let bc = D((e, t) => {
|
|
674
675
|
let n = Z.replyIdOf(e), r = n ? Z.turnFor(n) : void 0, i = Z.offer(e), a = {
|
|
675
676
|
ok: !1,
|
|
676
677
|
reason: "gone",
|
|
@@ -682,22 +683,22 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
682
683
|
let o = r.conversationId, s = w.getState().conversations.find((e) => e.id === o);
|
|
683
684
|
if (!s) return a;
|
|
684
685
|
let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = Z.liveOffersFor(n, {
|
|
685
|
-
registry:
|
|
686
|
-
actorId:
|
|
686
|
+
registry: vc(),
|
|
687
|
+
actorId: yc.current,
|
|
687
688
|
conversationId: o,
|
|
688
689
|
perfNow: performance.now()
|
|
689
690
|
}).find((t) => t.offer.offerId === e);
|
|
690
691
|
if (!u) {
|
|
691
|
-
let e =
|
|
692
|
+
let e = Ei(i, performance.now());
|
|
692
693
|
return {
|
|
693
694
|
ok: !1,
|
|
694
695
|
reason: e ? "unavailable" : "expired",
|
|
695
|
-
copy: e ?
|
|
696
|
+
copy: e ? Xr(P, t || null) : Jr(P),
|
|
696
697
|
conversationId: o,
|
|
697
698
|
voiceSessionId: l
|
|
698
699
|
};
|
|
699
700
|
}
|
|
700
|
-
return Z.markUsed(e) ? (
|
|
701
|
+
return Z.markUsed(e) ? (_c(), {
|
|
701
702
|
ok: !0,
|
|
702
703
|
target: u.target,
|
|
703
704
|
conversationId: o,
|
|
@@ -705,10 +706,10 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
705
706
|
}) : a;
|
|
706
707
|
}, [
|
|
707
708
|
Z,
|
|
708
|
-
|
|
709
|
+
vc,
|
|
709
710
|
P,
|
|
710
|
-
|
|
711
|
-
]),
|
|
711
|
+
_c
|
|
712
|
+
]), xc = D((e, t, n, r, i) => {
|
|
712
713
|
let a = N();
|
|
713
714
|
W(e, {
|
|
714
715
|
id: a,
|
|
@@ -720,18 +721,18 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
720
721
|
...i ? { localAction: i } : {},
|
|
721
722
|
...lr(t)
|
|
722
723
|
}
|
|
723
|
-
}), i &&
|
|
724
|
-
}, [W, V]),
|
|
724
|
+
}), i && zi.recordCommittedEntries(e, [a], "NOTE", r);
|
|
725
|
+
}, [W, V]), Sc = D((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && Z.release(e), [Z]), Cc = A(null);
|
|
725
726
|
O(() => () => {
|
|
726
|
-
|
|
727
|
+
Cc.current?.(), Cc.current = null;
|
|
727
728
|
}, []);
|
|
728
|
-
let
|
|
729
|
-
|
|
730
|
-
}, []),
|
|
731
|
-
if (
|
|
732
|
-
let i =
|
|
729
|
+
let wc = D((e) => {
|
|
730
|
+
Cc.current?.(), Cc.current = X.current ? fi(document, e) : null;
|
|
731
|
+
}, []), Tc = D((e, t, n, r = !1) => {
|
|
732
|
+
if (uc.current !== null) return;
|
|
733
|
+
let i = bc(e, n), a = T(), o = (e, t, n, r) => xc(e, t, n, a, r);
|
|
733
734
|
if (!i.ok) {
|
|
734
|
-
i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy),
|
|
735
|
+
i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), _c();
|
|
735
736
|
return;
|
|
736
737
|
}
|
|
737
738
|
let { target: s, conversationId: c, voiceSessionId: l } = i, u = {
|
|
@@ -739,7 +740,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
739
740
|
offerId: e
|
|
740
741
|
};
|
|
741
742
|
if (r) {
|
|
742
|
-
o(c, l,
|
|
743
|
+
o(c, l, Kr(P, s.label, !0), Pi({
|
|
743
744
|
destinationId: s.id,
|
|
744
745
|
path: s.path,
|
|
745
746
|
alreadyHere: !0,
|
|
@@ -749,16 +750,16 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
749
750
|
return;
|
|
750
751
|
}
|
|
751
752
|
let d = N();
|
|
752
|
-
|
|
753
|
+
uc.current = d, fc(!0);
|
|
753
754
|
let f = (t) => {
|
|
754
755
|
try {
|
|
755
|
-
if (
|
|
756
|
+
if (Sc(e, t) && (_c(), t.status === "kept" && wc(e)), t.status === "kept" || !w.getState().conversations.some((e) => e.id === c)) return;
|
|
756
757
|
let n = t.status === "arrived" || t.status === "redirected" ? t.landedPath : null;
|
|
757
|
-
o(c, l,
|
|
758
|
+
o(c, l, qr(P, t, {
|
|
758
759
|
page: s.label,
|
|
759
|
-
landed: n === null ? null :
|
|
760
|
+
landed: n === null ? null : Ii(zr(Y.current.navItems), n),
|
|
760
761
|
path: s.path
|
|
761
|
-
}),
|
|
762
|
+
}), Pi({
|
|
762
763
|
destinationId: s.id,
|
|
763
764
|
path: s.path,
|
|
764
765
|
alreadyHere: !1,
|
|
@@ -767,10 +768,10 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
767
768
|
offer: u
|
|
768
769
|
}));
|
|
769
770
|
} finally {
|
|
770
|
-
|
|
771
|
+
uc.current === d && (uc.current = null, X.current && fc(!1));
|
|
771
772
|
}
|
|
772
773
|
};
|
|
773
|
-
|
|
774
|
+
Ri(Y.current.navigate, s.path, {
|
|
774
775
|
readPath: () => window.location.pathname + window.location.search,
|
|
775
776
|
now: () => Date.now(),
|
|
776
777
|
schedule: (e, t) => {
|
|
@@ -781,20 +782,20 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
781
782
|
surface: "offer"
|
|
782
783
|
}).then(f, () => f({ status: "unconfirmed" }));
|
|
783
784
|
}, [
|
|
784
|
-
yc,
|
|
785
785
|
bc,
|
|
786
|
-
P,
|
|
787
|
-
gc,
|
|
788
786
|
xc,
|
|
789
|
-
|
|
790
|
-
|
|
787
|
+
P,
|
|
788
|
+
_c,
|
|
789
|
+
Sc,
|
|
790
|
+
wc
|
|
791
|
+
]), Ec = D((e, t) => Tc(e, "tap", t || null), [Tc]), Dc = D((e) => {
|
|
791
792
|
let { replyId: t, conversationId: n } = e, r = Z.turnFor(t);
|
|
792
793
|
if (!r) return;
|
|
793
|
-
let i = window.location.pathname + window.location.search, a =
|
|
794
|
+
let i = window.location.pathname + window.location.search, a = zr(Y.current.navItems), o = Oi({
|
|
794
795
|
intent: e.intent,
|
|
795
796
|
live: Z.liveOffersFor(t, {
|
|
796
|
-
registry:
|
|
797
|
-
actorId:
|
|
797
|
+
registry: vc(),
|
|
798
|
+
actorId: yc.current,
|
|
798
799
|
conversationId: n,
|
|
799
800
|
perfNow: performance.now()
|
|
800
801
|
}),
|
|
@@ -806,50 +807,50 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
806
807
|
location: i,
|
|
807
808
|
conversationId: w.getState().activeConversationId,
|
|
808
809
|
workspaceId: T(),
|
|
809
|
-
actorId:
|
|
810
|
+
actorId: yc.current ?? null
|
|
810
811
|
},
|
|
811
812
|
mounted: X.current,
|
|
812
813
|
visible: document.visibilityState === "visible",
|
|
813
|
-
unsavedChanges:
|
|
814
|
+
unsavedChanges: ki(Y.current.options),
|
|
814
815
|
alreadyThere: ({ target: e }) => {
|
|
815
816
|
let t = a.find((t) => t.id === e.id);
|
|
816
|
-
return t ?
|
|
817
|
+
return t ? Ir(t, i, a) : !1;
|
|
817
818
|
}
|
|
818
819
|
});
|
|
819
820
|
if (o.act === "navigate" || o.act === "already-here") {
|
|
820
|
-
|
|
821
|
+
Tc(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
|
|
821
822
|
return;
|
|
822
823
|
}
|
|
823
824
|
let [s] = o.unsaved ?? [], [c] = Z.liveOffersFor(t, {
|
|
824
|
-
registry:
|
|
825
|
-
actorId:
|
|
825
|
+
registry: vc(),
|
|
826
|
+
actorId: yc.current,
|
|
826
827
|
conversationId: n,
|
|
827
828
|
perfNow: performance.now()
|
|
828
829
|
});
|
|
829
|
-
o.hold === "R5-unsaved" && s && c &&
|
|
830
|
+
o.hold === "R5-unsaved" && s && c && xc(n, e.voiceSessionId, Yr(P, s.label, c.target.label), T());
|
|
830
831
|
}, [
|
|
831
832
|
Z,
|
|
832
|
-
|
|
833
|
+
vc,
|
|
833
834
|
K,
|
|
834
|
-
|
|
835
|
-
|
|
835
|
+
Tc,
|
|
836
|
+
xc,
|
|
836
837
|
P
|
|
837
|
-
]),
|
|
838
|
+
]), Oc = D((e) => {
|
|
838
839
|
let t = w.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
|
|
839
|
-
return n ? ji
|
|
840
|
-
}, []),
|
|
841
|
-
let { navItems: i, options: a, theme: o, navigate: s } = Y.current, c =
|
|
840
|
+
return n ? Mi(ji, window.location.pathname, Li(n.messages, e)) : !1;
|
|
841
|
+
}, []), kc = be(), Ac = ui(), jc = kc?.request ?? null, Mc = D((e, t, n = !1, r = !1) => {
|
|
842
|
+
let { navItems: i, options: a, theme: o, navigate: s } = Y.current, c = zr(i), l = null, u = {
|
|
842
843
|
...a,
|
|
843
|
-
locale: t === void 0 ? V :
|
|
844
|
+
locale: t === void 0 ? V : Ja.input.code,
|
|
844
845
|
uiLocale: V,
|
|
845
|
-
inputLocale:
|
|
846
|
+
inputLocale: Ja.input.code
|
|
846
847
|
};
|
|
847
|
-
if (r ||
|
|
848
|
-
let e = w.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), r = n ?
|
|
848
|
+
if (r || Rr(e, u)) {
|
|
849
|
+
let e = w.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), r = n ? mi(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => Z.offersFor(e.id).some((e) => e.offerId === t) } }) : null, o = n ? e.processingByConversationId[n.id] ?? null : null, s = o !== null && o.messageId === r?.id && On(o.status);
|
|
849
850
|
if (n && r && !s) {
|
|
850
851
|
let e = Z.liveOffersFor(r.id, {
|
|
851
|
-
registry:
|
|
852
|
-
actorId:
|
|
852
|
+
registry: vc(),
|
|
853
|
+
actorId: yc.current,
|
|
853
854
|
conversationId: n.id,
|
|
854
855
|
perfNow: performance.now()
|
|
855
856
|
}).flatMap(({ offer: e, target: t }) => {
|
|
@@ -859,14 +860,14 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
859
860
|
target: n
|
|
860
861
|
}] : [];
|
|
861
862
|
});
|
|
862
|
-
l =
|
|
863
|
+
l = pi({
|
|
863
864
|
reply: r,
|
|
864
865
|
text: tr(r, o, P),
|
|
865
866
|
resolve: {
|
|
866
867
|
destinations: c,
|
|
867
868
|
entityRoutes: a.entityRoutes,
|
|
868
|
-
visibleNavIds:
|
|
869
|
-
nounLabel: (e) =>
|
|
869
|
+
visibleNavIds: _i(i),
|
|
870
|
+
nounLabel: (e) => Wr(P, e)
|
|
870
871
|
},
|
|
871
872
|
offers: e
|
|
872
873
|
});
|
|
@@ -876,18 +877,18 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
876
877
|
destinations: c,
|
|
877
878
|
sentenceOptions: u,
|
|
878
879
|
context: {
|
|
879
|
-
backRunnable:
|
|
880
|
+
backRunnable: Oc(t),
|
|
880
881
|
navigation: l,
|
|
881
882
|
skipRecords: n,
|
|
882
|
-
controls:
|
|
883
|
+
controls: si(),
|
|
883
884
|
executors: {
|
|
884
885
|
theme: o !== null,
|
|
885
886
|
navigation: s !== null,
|
|
886
|
-
conversationDelete:
|
|
887
|
+
conversationDelete: jc !== null,
|
|
887
888
|
appControl: (e) => {
|
|
888
889
|
try {
|
|
889
|
-
let n =
|
|
890
|
-
return n !== null && (n.kind !== "confirm" ||
|
|
890
|
+
let n = oi(e, { voiceLive: t !== void 0 || Hl.current });
|
|
891
|
+
return n !== null && (n.kind !== "confirm" || Ac !== null);
|
|
891
892
|
} catch {
|
|
892
893
|
return !1;
|
|
893
894
|
}
|
|
@@ -896,34 +897,34 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
896
897
|
}
|
|
897
898
|
};
|
|
898
899
|
}, [
|
|
899
|
-
|
|
900
|
-
|
|
900
|
+
Oc,
|
|
901
|
+
Ja,
|
|
901
902
|
V,
|
|
902
903
|
P,
|
|
903
904
|
Z,
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
]),
|
|
908
|
-
let { destinations: r, sentenceOptions: i, context: a } =
|
|
909
|
-
return
|
|
910
|
-
}, [
|
|
911
|
-
if (
|
|
912
|
-
|
|
905
|
+
vc,
|
|
906
|
+
jc,
|
|
907
|
+
Ac
|
|
908
|
+
]), Nc = D((e, t, n = !1) => {
|
|
909
|
+
let { destinations: r, sentenceOptions: i, context: a } = Mc(e, t, n);
|
|
910
|
+
return Lr(e, r, i, a);
|
|
911
|
+
}, [Mc]), Pc = D((e) => {
|
|
912
|
+
if (Ps.current = e, Ca?.(Te(e)), Fs.cancel(), !e.text.trim() && !e.hasAttachments) {
|
|
913
|
+
Ns.current = !1;
|
|
913
914
|
return;
|
|
914
915
|
}
|
|
915
|
-
if (
|
|
916
|
+
if (Ns.current) return;
|
|
916
917
|
let t = () => {
|
|
917
|
-
|
|
918
|
+
Ns.current = !0, Ms(!1);
|
|
918
919
|
};
|
|
919
|
-
e.hasAttachments || e.dictated ? t() :
|
|
920
|
-
if (!
|
|
920
|
+
e.hasAttachments || e.dictated ? t() : Fs.schedule(() => {
|
|
921
|
+
if (!Ns.current) {
|
|
921
922
|
try {
|
|
922
|
-
let { destinations: t, sentenceOptions: n, context: r } =
|
|
923
|
-
if (
|
|
923
|
+
let { destinations: t, sentenceOptions: n, context: r } = Mc(e.text, void 0, !1, !0);
|
|
924
|
+
if (Fr(e.text, t, n, r)) return;
|
|
924
925
|
} catch {
|
|
925
|
-
if (!
|
|
926
|
-
|
|
926
|
+
if (!pa) {
|
|
927
|
+
pa = !0;
|
|
927
928
|
try {
|
|
928
929
|
i.getLogger("assistant").warn("Draft command classification failed; using standard warm-up.");
|
|
929
930
|
} catch {}
|
|
@@ -933,36 +934,36 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
933
934
|
}
|
|
934
935
|
});
|
|
935
936
|
}, [
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
937
|
+
Fs,
|
|
938
|
+
Ca,
|
|
939
|
+
Ms,
|
|
940
|
+
Mc
|
|
940
941
|
]);
|
|
941
942
|
O(() => {
|
|
942
943
|
let e = () => {
|
|
943
|
-
|
|
944
|
-
}, t =
|
|
944
|
+
Ps.current && Pc(Ps.current);
|
|
945
|
+
}, t = ci(e), n = Ni(window, e), r = ji.subscribe(e);
|
|
945
946
|
return () => {
|
|
946
|
-
t(), n(), r(),
|
|
947
|
+
t(), n(), r(), Fs.cancel();
|
|
947
948
|
};
|
|
948
|
-
}, [
|
|
949
|
-
|
|
949
|
+
}, [Fs, Pc]), O(() => {
|
|
950
|
+
Ps.current && Pc(Ps.current);
|
|
950
951
|
}, [
|
|
951
|
-
|
|
952
|
-
$s,
|
|
953
|
-
Ia,
|
|
952
|
+
Pc,
|
|
954
953
|
ec,
|
|
954
|
+
La,
|
|
955
955
|
tc,
|
|
956
|
-
|
|
957
|
-
|
|
956
|
+
nc,
|
|
957
|
+
Gs,
|
|
958
|
+
$s,
|
|
958
959
|
U,
|
|
959
|
-
|
|
960
|
+
hc,
|
|
960
961
|
H,
|
|
961
962
|
G?.messages,
|
|
962
|
-
|
|
963
|
+
xo
|
|
963
964
|
]);
|
|
964
|
-
let
|
|
965
|
-
let n =
|
|
965
|
+
let Fc = D((e, t) => {
|
|
966
|
+
let n = Nc(e, t);
|
|
966
967
|
if (!n) return !1;
|
|
967
968
|
let { theme: r, navigate: i } = Y.current;
|
|
968
969
|
switch (n.kind) {
|
|
@@ -974,14 +975,14 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
974
975
|
case "link-not-openable":
|
|
975
976
|
case "back": return i !== null;
|
|
976
977
|
case "conversation-delete": return !1;
|
|
977
|
-
case "app-control": return
|
|
978
|
+
case "app-control": return oi(n.request, { voiceLive: t !== void 0 || Hl.current }) !== null;
|
|
978
979
|
case "open-record": return !1;
|
|
979
980
|
}
|
|
980
|
-
}, [
|
|
981
|
+
}, [Nc]), Ic = A(Fc);
|
|
981
982
|
O(() => {
|
|
982
|
-
|
|
983
|
-
}, [
|
|
984
|
-
let
|
|
983
|
+
Ic.current = Fc;
|
|
984
|
+
}, [Fc]);
|
|
985
|
+
let Lc = D((e, t) => {
|
|
985
986
|
let n = {
|
|
986
987
|
state: "none",
|
|
987
988
|
accept: null
|
|
@@ -990,11 +991,11 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
990
991
|
let o = w.getState(), s = o.conversations.find((t) => t.id === e);
|
|
991
992
|
if (!s) return n;
|
|
992
993
|
let c = o.processingByConversationId[s.id] ?? null, l = {
|
|
993
|
-
registry:
|
|
994
|
-
actorId:
|
|
994
|
+
registry: vc(),
|
|
995
|
+
actorId: yc.current,
|
|
995
996
|
conversationId: s.id,
|
|
996
997
|
perfNow: performance.now()
|
|
997
|
-
}, { state: u, reply: d } =
|
|
998
|
+
}, { state: u, reply: d } = Si(Z, {
|
|
998
999
|
...l,
|
|
999
1000
|
messages: s.messages,
|
|
1000
1001
|
voiceSessionId: t,
|
|
@@ -1007,7 +1008,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1007
1008
|
state: u,
|
|
1008
1009
|
accept: null
|
|
1009
1010
|
};
|
|
1010
|
-
let [f] = Z.liveOffersFor(d.id, l), p = f ?
|
|
1011
|
+
let [f] = Z.liveOffersFor(d.id, l), p = f ? zr(a).find((e) => e.id === f.target.id) : void 0;
|
|
1011
1012
|
return !f || !p ? n : {
|
|
1012
1013
|
state: u,
|
|
1013
1014
|
accept: {
|
|
@@ -1017,10 +1018,10 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1017
1018
|
};
|
|
1018
1019
|
}, [
|
|
1019
1020
|
Z,
|
|
1020
|
-
|
|
1021
|
+
vc,
|
|
1021
1022
|
z,
|
|
1022
1023
|
P
|
|
1023
|
-
]),
|
|
1024
|
+
]), Rc = D((e, t, n, r, i, a) => {
|
|
1024
1025
|
let o = P(n.key, n.fallback, r), s = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), c = {
|
|
1025
1026
|
kind: "write-reply",
|
|
1026
1027
|
line: n.key
|
|
@@ -1046,53 +1047,53 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1046
1047
|
localAction: c,
|
|
1047
1048
|
...lr(i)
|
|
1048
1049
|
}
|
|
1049
|
-
}),
|
|
1050
|
+
}), zi.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", T()), a !== void 0 && Qs(a, {
|
|
1050
1051
|
conversationId: e,
|
|
1051
1052
|
questionId: u,
|
|
1052
1053
|
replyId: d
|
|
1053
|
-
}),
|
|
1054
|
+
}), Ks(e, d);
|
|
1054
1055
|
}, [
|
|
1055
1056
|
W,
|
|
1056
1057
|
V,
|
|
1057
|
-
|
|
1058
|
-
|
|
1058
|
+
Qs,
|
|
1059
|
+
Ks,
|
|
1059
1060
|
P
|
|
1060
|
-
]),
|
|
1061
|
+
]), zc = A(() => void 0), [Bc, Vc] = j(null);
|
|
1061
1062
|
O(() => {
|
|
1062
|
-
if (
|
|
1063
|
-
let e = window.setTimeout(() =>
|
|
1063
|
+
if (Bc === null) return;
|
|
1064
|
+
let e = window.setTimeout(() => Vc(null), ha);
|
|
1064
1065
|
return () => window.clearTimeout(e);
|
|
1065
|
-
}, [
|
|
1066
|
-
let
|
|
1066
|
+
}, [Bc]);
|
|
1067
|
+
let Hc = D(() => {
|
|
1067
1068
|
let e = w.getState();
|
|
1068
|
-
return
|
|
1069
|
-
}, [
|
|
1070
|
-
if (!
|
|
1071
|
-
let t = e !== void 0, n = w.getState(), r =
|
|
1069
|
+
return ro(void 0, e.autoRouting && Zo.current ? b : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
|
|
1070
|
+
}, [ro]), Uc = D((e) => {
|
|
1071
|
+
if (!jc) return !1;
|
|
1072
|
+
let t = e !== void 0, n = w.getState(), r = Yi({
|
|
1072
1073
|
spoken: t,
|
|
1073
|
-
bound:
|
|
1074
|
+
bound: fs.current,
|
|
1074
1075
|
activeConversationId: n.activeConversationId,
|
|
1075
1076
|
conversations: n.conversations,
|
|
1076
1077
|
historyOn: xe()
|
|
1077
1078
|
});
|
|
1078
|
-
if (r &&
|
|
1079
|
+
if (r && jc(r), t) {
|
|
1079
1080
|
let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? P("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : P("deleteConversation.nothing", "There is no conversation to delete.");
|
|
1080
|
-
|
|
1081
|
+
zc.current({
|
|
1081
1082
|
id: `conversation-delete:${N()}`,
|
|
1082
1083
|
text: t,
|
|
1083
1084
|
lang: t === e ? "en" : V
|
|
1084
1085
|
});
|
|
1085
|
-
} else r ||
|
|
1086
|
+
} else r || Vc(Date.now());
|
|
1086
1087
|
return !0;
|
|
1087
1088
|
}, [
|
|
1088
|
-
|
|
1089
|
+
jc,
|
|
1089
1090
|
V,
|
|
1090
1091
|
P
|
|
1091
|
-
]),
|
|
1092
|
-
if (e.kind === "conversation-delete") return
|
|
1092
|
+
]), Wc = D((e, t, n, r = !1, i) => {
|
|
1093
|
+
if (e.kind === "conversation-delete") return Uc(n);
|
|
1093
1094
|
let { theme: a, navigate: o } = Y.current, s = null, c = () => {
|
|
1094
|
-
let e = (r ? null : s ?? w.getState().activeConversationId) ??
|
|
1095
|
-
return r &&
|
|
1095
|
+
let e = (r ? null : s ?? w.getState().activeConversationId) ?? Hc();
|
|
1096
|
+
return r && _s(e), e;
|
|
1096
1097
|
}, l = (e, r) => {
|
|
1097
1098
|
let i = N();
|
|
1098
1099
|
return W(e, {
|
|
@@ -1117,33 +1118,33 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1117
1118
|
localAction: a,
|
|
1118
1119
|
...lr(n)
|
|
1119
1120
|
}
|
|
1120
|
-
}),
|
|
1121
|
+
}), zi.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && Qs(i, {
|
|
1121
1122
|
conversationId: e,
|
|
1122
1123
|
questionId: t,
|
|
1123
1124
|
replyId: l
|
|
1124
|
-
}), s &&
|
|
1125
|
+
}), s && Ks(e, l), l;
|
|
1125
1126
|
}, d = (e, t, n) => {
|
|
1126
1127
|
let r = c(), i = l(r, t), a = u(r, i, e, t, T(), !0);
|
|
1127
1128
|
return n?.(a), !0;
|
|
1128
1129
|
}, f = (e) => {
|
|
1129
|
-
let t = c(), n = T(), r = window.location.pathname, a =
|
|
1130
|
+
let t = c(), n = T(), r = window.location.pathname, a = Pi({
|
|
1130
1131
|
destinationId: e.destinationId,
|
|
1131
1132
|
path: e.registryPath,
|
|
1132
1133
|
alreadyHere: !1,
|
|
1133
1134
|
via: e.via,
|
|
1134
1135
|
offer: e.offer
|
|
1135
1136
|
}), s = l(t, a), d = i === void 0 ? void 0 : N();
|
|
1136
|
-
i !== void 0 && d !== void 0 && (
|
|
1137
|
+
i !== void 0 && d !== void 0 && (Xs(i, {
|
|
1137
1138
|
conversationId: t,
|
|
1138
1139
|
questionId: s,
|
|
1139
1140
|
replyId: d
|
|
1140
|
-
}),
|
|
1141
|
+
}), mc(d));
|
|
1141
1142
|
let f = N();
|
|
1142
|
-
|
|
1143
|
+
uc.current = f, fc(!0);
|
|
1143
1144
|
let p = (i) => {
|
|
1144
1145
|
try {
|
|
1145
|
-
if (e.offer &&
|
|
1146
|
-
let a =
|
|
1146
|
+
if (e.offer && Sc(e.offer.offerId, i) && _c(), i.status === "kept" || !w.getState().conversations.some((e) => e.id === t)) return;
|
|
1147
|
+
let a = zr(Y.current.navItems), o = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, c = Pi({
|
|
1147
1148
|
destinationId: e.destinationId,
|
|
1148
1149
|
path: e.registryPath,
|
|
1149
1150
|
alreadyHere: !1,
|
|
@@ -1151,10 +1152,10 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1151
1152
|
outcome: i,
|
|
1152
1153
|
offer: e.offer
|
|
1153
1154
|
});
|
|
1154
|
-
|
|
1155
|
-
let l = e.via === "back" && i.status === "arrived" ?
|
|
1155
|
+
oo(t, s, { localAction: c });
|
|
1156
|
+
let l = e.via === "back" && i.status === "arrived" ? Vr(P, e.pageLabel()) : qr(P, i, {
|
|
1156
1157
|
page: e.pageLabel(),
|
|
1157
|
-
landed: o === null ? null :
|
|
1158
|
+
landed: o === null ? null : Ii(a, o),
|
|
1158
1159
|
path: e.target
|
|
1159
1160
|
}), f = u(t, s, l, c, n, X.current, d);
|
|
1160
1161
|
i.status === "arrived" && e.onArrived?.({
|
|
@@ -1163,10 +1164,10 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1163
1164
|
landedPath: i.landedPath
|
|
1164
1165
|
});
|
|
1165
1166
|
} finally {
|
|
1166
|
-
|
|
1167
|
+
uc.current === f && (uc.current = null, X.current && fc(!1)), d !== void 0 && X.current && mc((e) => e === d ? null : e);
|
|
1167
1168
|
}
|
|
1168
1169
|
};
|
|
1169
|
-
return
|
|
1170
|
+
return Ri(o, e.target, {
|
|
1170
1171
|
readPath: () => window.location.pathname + window.location.search,
|
|
1171
1172
|
now: () => Date.now(),
|
|
1172
1173
|
schedule: (e, t) => {
|
|
@@ -1174,7 +1175,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1174
1175
|
},
|
|
1175
1176
|
isShellLess: () => !X.current
|
|
1176
1177
|
}).then(p, () => p({ status: "unconfirmed" })), !0;
|
|
1177
|
-
}, p = ({ replyId: e, fromPath: t, landedPath: n }) =>
|
|
1178
|
+
}, p = ({ replyId: e, fromPath: t, landedPath: n }) => ji.push({
|
|
1178
1179
|
fromPath: t,
|
|
1179
1180
|
toPath: n,
|
|
1180
1181
|
replyMessageId: e,
|
|
@@ -1182,21 +1183,21 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1182
1183
|
});
|
|
1183
1184
|
if (e.kind === "theme") {
|
|
1184
1185
|
if (!a) return !1;
|
|
1185
|
-
let t =
|
|
1186
|
+
let t = Br(e.request, {
|
|
1186
1187
|
mode: a.mode,
|
|
1187
1188
|
resolvedTheme: a.resolvedTheme
|
|
1188
1189
|
});
|
|
1189
1190
|
if (!t.alreadyApplied) try {
|
|
1190
1191
|
a.setMode(t.mode);
|
|
1191
1192
|
} catch {}
|
|
1192
|
-
return d(
|
|
1193
|
+
return d(ei(P, t, e.request.kind === "family"), {
|
|
1193
1194
|
kind: "theme",
|
|
1194
1195
|
mode: t.mode,
|
|
1195
1196
|
alreadyApplied: t.alreadyApplied
|
|
1196
1197
|
});
|
|
1197
1198
|
}
|
|
1198
1199
|
if (e.kind === "app-control") {
|
|
1199
|
-
let t =
|
|
1200
|
+
let t = oi(e.request, { voiceLive: n !== void 0 || Hl.current });
|
|
1200
1201
|
if (!t) return !1;
|
|
1201
1202
|
let r = (e) => ({
|
|
1202
1203
|
kind: "app-control",
|
|
@@ -1204,34 +1205,34 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1204
1205
|
outcome: e.outcome,
|
|
1205
1206
|
...e.reply.code === "language" ? { languageLabel: e.reply.label } : {}
|
|
1206
1207
|
}), i = (t) => {
|
|
1207
|
-
if (e.request.control === "language" &&
|
|
1208
|
-
let n = c(), i = r(t), a = l(n, i), o = u(n, a,
|
|
1209
|
-
return
|
|
1208
|
+
if (e.request.control === "language" && cc(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
|
|
1209
|
+
let n = c(), i = r(t), a = l(n, i), o = u(n, a, ni((e, t) => t, t.reply), i, T(), !1);
|
|
1210
|
+
return ic.current = {
|
|
1210
1211
|
wanted: e.request.code,
|
|
1211
1212
|
reply: t.reply,
|
|
1212
1213
|
conversationId: n,
|
|
1213
1214
|
messageId: o,
|
|
1214
|
-
deadline: window.setTimeout(
|
|
1215
|
-
},
|
|
1215
|
+
deadline: window.setTimeout(lc, ri)
|
|
1216
|
+
}, oc(o), !0;
|
|
1216
1217
|
}
|
|
1217
|
-
return d(
|
|
1218
|
+
return d(ni(P, t.reply), r(t));
|
|
1218
1219
|
};
|
|
1219
1220
|
if (t.kind === "reply") return i(t.run);
|
|
1220
1221
|
if (t.kind === "run") {
|
|
1221
1222
|
let e = t.run();
|
|
1222
1223
|
return t.silent && (e.outcome === "done" || e.outcome === "already") ? !0 : i(e);
|
|
1223
1224
|
}
|
|
1224
|
-
let a =
|
|
1225
|
+
let a = Ac;
|
|
1225
1226
|
if (!a) return !1;
|
|
1226
1227
|
let o = null;
|
|
1227
|
-
return d(
|
|
1228
|
+
return d(ni(P, t.ask.reply), r(t.ask), (e) => {
|
|
1228
1229
|
o = w.getState().conversations.find((t) => t.messages.some((t) => t.id === e))?.id ?? null;
|
|
1229
1230
|
}), a.request({
|
|
1230
1231
|
prompt: t.prompt,
|
|
1231
1232
|
onConfirm: () => {
|
|
1232
1233
|
let e = t.confirmed(), i = o, a = i !== null && w.getState().conversations.some((e) => e.id === i);
|
|
1233
1234
|
if (!i || !a) return;
|
|
1234
|
-
let s =
|
|
1235
|
+
let s = ni(P, e.reply);
|
|
1235
1236
|
W(i, {
|
|
1236
1237
|
id: N(),
|
|
1237
1238
|
role: "assistant",
|
|
@@ -1247,23 +1248,23 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1247
1248
|
}), !0;
|
|
1248
1249
|
}
|
|
1249
1250
|
if (!o) return !1;
|
|
1250
|
-
if (e.kind === "choose-destination") return d(
|
|
1251
|
+
if (e.kind === "choose-destination") return d(Hr(P, e.candidates[0]?.label ?? e.query, e.candidates), {
|
|
1251
1252
|
kind: "choose-destination",
|
|
1252
1253
|
candidateIds: e.candidates.map((e) => e.id)
|
|
1253
|
-
}, (t) =>
|
|
1254
|
-
if (e.kind === "choose-linked") return d(
|
|
1254
|
+
}, (t) => hi(t, e.candidates));
|
|
1255
|
+
if (e.kind === "choose-linked") return d(Ur(P, e.candidates), {
|
|
1255
1256
|
kind: "choose-destination",
|
|
1256
1257
|
candidateIds: e.candidates.map((e) => e.id)
|
|
1257
|
-
}, (t) =>
|
|
1258
|
+
}, (t) => hi(t, e.candidates));
|
|
1258
1259
|
if (e.kind === "pick-from-list") {
|
|
1259
1260
|
let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
|
|
1260
|
-
return d(
|
|
1261
|
+
return d(Zr(P), t ? {
|
|
1261
1262
|
kind: "choose-destination",
|
|
1262
1263
|
candidateIds: t.map((e) => e.id)
|
|
1263
1264
|
} : e.candidateIds.length > 0 ? {
|
|
1264
1265
|
kind: "choose-destination",
|
|
1265
1266
|
candidateIds: [...e.candidateIds]
|
|
1266
|
-
} :
|
|
1267
|
+
} : Pi({
|
|
1267
1268
|
destinationId: "",
|
|
1268
1269
|
path: "",
|
|
1269
1270
|
alreadyHere: !1,
|
|
@@ -1272,9 +1273,9 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1272
1273
|
status: "refused",
|
|
1273
1274
|
reason: "not-routable"
|
|
1274
1275
|
}
|
|
1275
|
-
}), t ? (e) =>
|
|
1276
|
+
}), t ? (e) => hi(e, t) : void 0);
|
|
1276
1277
|
}
|
|
1277
|
-
if (e.kind === "link-not-openable") return d(
|
|
1278
|
+
if (e.kind === "link-not-openable") return d(Gr(P), Pi({
|
|
1278
1279
|
destinationId: "",
|
|
1279
1280
|
path: "",
|
|
1280
1281
|
alreadyHere: !1,
|
|
@@ -1287,7 +1288,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1287
1288
|
if (e.kind === "open-record") {
|
|
1288
1289
|
let r;
|
|
1289
1290
|
try {
|
|
1290
|
-
let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a =
|
|
1291
|
+
let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a = _i(n);
|
|
1291
1292
|
r = (t.records ?? []).flatMap((t) => {
|
|
1292
1293
|
let n = i.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
|
|
1293
1294
|
return n && r && (n.visibleWith === void 0 || a.has(n.visibleWith)) ? [{
|
|
@@ -1300,18 +1301,18 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1300
1301
|
}
|
|
1301
1302
|
if (r.length === 0) return !1;
|
|
1302
1303
|
let i = w.getState().activeConversationId, a = N();
|
|
1303
|
-
|
|
1304
|
+
uc.current = a, fc(!0);
|
|
1304
1305
|
let o = () => {
|
|
1305
|
-
|
|
1306
|
+
uc.current === a && (uc.current = null, X.current && fc(!1));
|
|
1306
1307
|
};
|
|
1307
1308
|
return (async () => {
|
|
1308
1309
|
let a = { kind: "none" }, c = !0;
|
|
1309
1310
|
try {
|
|
1310
|
-
a = await
|
|
1311
|
+
a = await gi({
|
|
1311
1312
|
name: e.request.name,
|
|
1312
1313
|
usable: r,
|
|
1313
|
-
nounOf: (e) =>
|
|
1314
|
-
timeoutMs:
|
|
1314
|
+
nounOf: (e) => Wr(P, e.noun),
|
|
1315
|
+
timeoutMs: ca
|
|
1315
1316
|
}), c = w.getState().conversations.some((e) => e.id === i);
|
|
1316
1317
|
} catch {
|
|
1317
1318
|
a = { kind: "none" };
|
|
@@ -1320,7 +1321,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1320
1321
|
}
|
|
1321
1322
|
if (!X.current) return;
|
|
1322
1323
|
if (a.kind === "none") {
|
|
1323
|
-
|
|
1324
|
+
Yc.current(t, [], {
|
|
1324
1325
|
fromPerson: !0,
|
|
1325
1326
|
...n === void 0 ? {} : { voiceSessionId: n },
|
|
1326
1327
|
localRecordsChecked: !0
|
|
@@ -1341,16 +1342,16 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1341
1342
|
return;
|
|
1342
1343
|
}
|
|
1343
1344
|
let l = a.candidates[0];
|
|
1344
|
-
d(a.why === "kinds" ?
|
|
1345
|
+
d(a.why === "kinds" ? $r(P, a.nouns, a.candidates) : Qr(P, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
|
|
1345
1346
|
kind: "choose-destination",
|
|
1346
1347
|
candidateIds: a.candidates.map((e) => e.id)
|
|
1347
|
-
}, (e) =>
|
|
1348
|
+
}, (e) => hi(e, a.candidates));
|
|
1348
1349
|
})().catch(() => void 0), !0;
|
|
1349
1350
|
}
|
|
1350
1351
|
if (e.kind === "back") {
|
|
1351
|
-
let e =
|
|
1352
|
+
let e = ji.top();
|
|
1352
1353
|
if (!e) return !1;
|
|
1353
|
-
let t =
|
|
1354
|
+
let t = zr(Y.current.navItems), n = Fi(t, e.fromPath);
|
|
1354
1355
|
return f({
|
|
1355
1356
|
target: e.fromPath,
|
|
1356
1357
|
destinationId: n?.id ?? "",
|
|
@@ -1358,27 +1359,27 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1358
1359
|
via: "back",
|
|
1359
1360
|
pageLabel: () => n?.label ?? null,
|
|
1360
1361
|
onArrived: () => {
|
|
1361
|
-
|
|
1362
|
+
ji.top() === e && ji.pop();
|
|
1362
1363
|
}
|
|
1363
1364
|
});
|
|
1364
1365
|
}
|
|
1365
1366
|
let ee, m = e.destination;
|
|
1366
1367
|
if (e.via === "offer") {
|
|
1367
|
-
let t =
|
|
1368
|
-
if (!t.ok) return d(t.copy ??
|
|
1368
|
+
let t = bc(e.offerId, e.destination.label);
|
|
1369
|
+
if (!t.ok) return d(t.copy ?? Jr(P), {
|
|
1369
1370
|
kind: "write-reply",
|
|
1370
1371
|
line: t.reason === "unavailable" ? "offer.notAvailable" : "offer.expired"
|
|
1371
1372
|
});
|
|
1372
1373
|
ee = {
|
|
1373
1374
|
trigger: e.trigger,
|
|
1374
1375
|
offerId: e.offerId
|
|
1375
|
-
}, m =
|
|
1376
|
+
}, m = zr(Y.current.navItems).find((e) => e.id === t.target.id) ?? {
|
|
1376
1377
|
id: t.target.id,
|
|
1377
1378
|
label: t.target.label,
|
|
1378
1379
|
path: t.target.path
|
|
1379
1380
|
};
|
|
1380
1381
|
}
|
|
1381
|
-
return
|
|
1382
|
+
return Ir(m, window.location.pathname + window.location.search, zr(Y.current.navItems)) ? d(Kr(P, m.label, !0), Pi({
|
|
1382
1383
|
destinationId: m.id,
|
|
1383
1384
|
path: m.path,
|
|
1384
1385
|
alreadyHere: !0,
|
|
@@ -1395,44 +1396,44 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1395
1396
|
});
|
|
1396
1397
|
}, [
|
|
1397
1398
|
W,
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
Vc,
|
|
1401
|
-
cc,
|
|
1402
|
-
V,
|
|
1403
|
-
ao,
|
|
1404
|
-
Ys,
|
|
1399
|
+
_s,
|
|
1400
|
+
Ac,
|
|
1405
1401
|
Hc,
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1402
|
+
lc,
|
|
1403
|
+
V,
|
|
1404
|
+
oo,
|
|
1405
|
+
Xs,
|
|
1406
|
+
Uc,
|
|
1407
|
+
Qs,
|
|
1408
|
+
cc,
|
|
1409
|
+
Ks,
|
|
1409
1410
|
P,
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
]),
|
|
1414
|
-
|
|
1411
|
+
bc,
|
|
1412
|
+
Sc,
|
|
1413
|
+
_c
|
|
1414
|
+
]), Gc = D(async (e) => {
|
|
1415
|
+
$o.current = !0, ts(!0);
|
|
1415
1416
|
try {
|
|
1416
1417
|
await K.declineForReply(e.conversationId, e.reason, e.origin);
|
|
1417
1418
|
} finally {
|
|
1418
|
-
|
|
1419
|
+
$o.current = !1, X.current && ts(!1);
|
|
1419
1420
|
}
|
|
1420
1421
|
if (e.commandText !== null) {
|
|
1421
|
-
let t =
|
|
1422
|
-
if (t &&
|
|
1422
|
+
let t = Nc(e.commandText, e.options.voiceSessionId);
|
|
1423
|
+
if (t && Wc(t, e.content, e.options.voiceSessionId)) return;
|
|
1423
1424
|
}
|
|
1424
|
-
await
|
|
1425
|
+
await Yc.current(e.content, e.attachments, e.options);
|
|
1425
1426
|
}, [
|
|
1426
|
-
|
|
1427
|
-
|
|
1427
|
+
Nc,
|
|
1428
|
+
Wc,
|
|
1428
1429
|
K
|
|
1429
1430
|
]), Q = D(async (n, r = [], i = {}) => {
|
|
1430
|
-
let a = i.voiceSessionId !== void 0, o = w.getState(), s = !1, c =
|
|
1431
|
-
if (a &&
|
|
1432
|
-
let e =
|
|
1431
|
+
let a = i.voiceSessionId !== void 0, o = w.getState(), s = !1, c = fs.current;
|
|
1432
|
+
if (a && mr(c)) {
|
|
1433
|
+
let e = yr(c, o.activeConversationId, bs());
|
|
1433
1434
|
if (e.kind === "gone") return;
|
|
1434
1435
|
let t = i.voiceEntry ?? e;
|
|
1435
|
-
t.kind === "adopt" &&
|
|
1436
|
+
t.kind === "adopt" && _s(t.conversationId), s = t.kind === "own", i = {
|
|
1436
1437
|
...i,
|
|
1437
1438
|
voiceEntry: t
|
|
1438
1439
|
};
|
|
@@ -1442,7 +1443,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1442
1443
|
if (On(o.processingByConversationId[u]?.status)) {
|
|
1443
1444
|
if (i.avatarTabAsk !== void 0) return;
|
|
1444
1445
|
let e = o.processingByConversationId[u]?.messageId ?? null;
|
|
1445
|
-
e && i.correctsInFlightTurn === !0 && !
|
|
1446
|
+
e && i.correctsInFlightTurn === !0 && !zs.current.has(e) && Hs(), e && zs.current.has(e) && (Bs.current = {
|
|
1446
1447
|
conversationId: u,
|
|
1447
1448
|
content: n,
|
|
1448
1449
|
attachments: r,
|
|
@@ -1450,10 +1451,10 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1450
1451
|
});
|
|
1451
1452
|
return;
|
|
1452
1453
|
}
|
|
1453
|
-
if (
|
|
1454
|
+
if (ws.current.has(u)) return;
|
|
1454
1455
|
}
|
|
1455
|
-
if (
|
|
1456
|
-
let d = i.targetConversationId, f =
|
|
1456
|
+
if (Qo.current || Er() !== null || $o.current || uc.current !== null) return;
|
|
1457
|
+
let d = i.targetConversationId, f = qi(), p = (e) => Hi(e) || Vi(e, f);
|
|
1457
1458
|
if (d !== void 0) {
|
|
1458
1459
|
let e = o.conversations.find((e) => e.id === d);
|
|
1459
1460
|
if (o.activeConversationId !== d || !e || e.mode !== o.mode || p(e)) return;
|
|
@@ -1461,29 +1462,29 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1461
1462
|
if (i.avatarTabAsk !== void 0) {
|
|
1462
1463
|
let e = l ? o.conversations.find((e) => e.id === l) : void 0, t = e && !p(e) ? e : void 0;
|
|
1463
1464
|
if (qe({
|
|
1464
|
-
auto: o.autoRouting &&
|
|
1465
|
+
auto: o.autoRouting && Zo.current && d === void 0,
|
|
1465
1466
|
selectedMode: o.mode,
|
|
1466
1467
|
conversation: t ? {
|
|
1467
1468
|
mode: t.mode,
|
|
1468
1469
|
routedBy: t.routedBy,
|
|
1469
|
-
hasHistory:
|
|
1470
|
+
hasHistory: Bi(t)
|
|
1470
1471
|
} : null,
|
|
1471
|
-
modeWrites: (e) =>
|
|
1472
|
+
modeWrites: (e) => Uo.current.find((t) => t.id === e)?.writeCapable === !0 || gt(e)
|
|
1472
1473
|
}) !== null) return;
|
|
1473
1474
|
}
|
|
1474
1475
|
if (i.fromPerson && i.writeReplyBound === void 0) {
|
|
1475
|
-
let e = d ?? l ?? null, t = i.voiceSessionId === void 0 ? "typed" : "spoken", a =
|
|
1476
|
+
let e = d ?? l ?? null, t = i.voiceSessionId === void 0 ? "typed" : "spoken", a = Lc(e, i.voiceSessionId), o = se({
|
|
1476
1477
|
text: n,
|
|
1477
|
-
locale: t === "spoken" ?
|
|
1478
|
+
locale: t === "spoken" ? Ja.input.code : V,
|
|
1478
1479
|
origin: t,
|
|
1479
1480
|
hasAttachments: r.length > 0 || i.focus !== void 0,
|
|
1480
1481
|
live: K.liveFor(e),
|
|
1481
|
-
matchesLocalCommand: (e) =>
|
|
1482
|
+
matchesLocalCommand: (e) => Nc(e, i.voiceSessionId) !== null,
|
|
1482
1483
|
offer: a.state,
|
|
1483
|
-
offerAssent: a.state !== "none" &&
|
|
1484
|
+
offerAssent: a.state !== "none" && ti({
|
|
1484
1485
|
text: n,
|
|
1485
1486
|
uiLocale: V,
|
|
1486
|
-
inputLocale:
|
|
1487
|
+
inputLocale: Ja.input.code,
|
|
1487
1488
|
commandLocales: Y.current.options.commandLocales,
|
|
1488
1489
|
manifest: Y.current.options.commandManifest,
|
|
1489
1490
|
leaveGuard: Y.current.options.leaveGuard
|
|
@@ -1491,14 +1492,14 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1491
1492
|
});
|
|
1492
1493
|
if (o.kind === "accept_offer") {
|
|
1493
1494
|
let e = a.accept;
|
|
1494
|
-
if (e &&
|
|
1495
|
+
if (e && Wc({
|
|
1495
1496
|
kind: "navigate",
|
|
1496
1497
|
destination: e.destination,
|
|
1497
1498
|
via: "offer",
|
|
1498
1499
|
offerId: e.offerId,
|
|
1499
1500
|
trigger: "yes"
|
|
1500
1501
|
}, n, i.voiceSessionId, s, i.avatarTabAsk)) {
|
|
1501
|
-
|
|
1502
|
+
Zs(i.avatarTabAsk);
|
|
1502
1503
|
return;
|
|
1503
1504
|
}
|
|
1504
1505
|
o = {
|
|
@@ -1515,11 +1516,11 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1515
1516
|
};
|
|
1516
1517
|
}
|
|
1517
1518
|
if (o.kind === "local_reply") {
|
|
1518
|
-
e &&
|
|
1519
|
+
e && Rc(e, n, o.line, o.values, i.voiceSessionId, i.avatarTabAsk);
|
|
1519
1520
|
return;
|
|
1520
1521
|
}
|
|
1521
1522
|
let c = o.kind === "local" ? o.fallback : o.bound, u = o.declineAll;
|
|
1522
|
-
if (u !== null && e) return i.avatarTabAsk === void 0 ?
|
|
1523
|
+
if (u !== null && e) return i.avatarTabAsk === void 0 ? Gc({
|
|
1523
1524
|
conversationId: e,
|
|
1524
1525
|
reason: u,
|
|
1525
1526
|
origin: t,
|
|
@@ -1538,50 +1539,50 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1538
1539
|
}
|
|
1539
1540
|
let ee = i.writeReplyBound?.promptText ?? n;
|
|
1540
1541
|
if (i.fromPerson && r.length === 0 && i.focus === void 0 && i.writeReplyBound?.localCommands !== !1) {
|
|
1541
|
-
let e =
|
|
1542
|
-
if (e &&
|
|
1543
|
-
|
|
1542
|
+
let e = Nc(n, i.voiceSessionId, i.localRecordsChecked === !0);
|
|
1543
|
+
if (e && Wc(e, n, i.voiceSessionId, s, i.avatarTabAsk)) {
|
|
1544
|
+
Zs(i.avatarTabAsk);
|
|
1544
1545
|
return;
|
|
1545
1546
|
}
|
|
1546
1547
|
}
|
|
1547
|
-
let m = l ? o.conversations.find((e) => e.id === l) : void 0, h = p(m) ? void 0 : m, g = o.autoRouting &&
|
|
1548
|
+
let m = l ? o.conversations.find((e) => e.id === l) : void 0, h = p(m) ? void 0 : m, g = o.autoRouting && Zo.current && d === void 0 ? pe({
|
|
1548
1549
|
intent: i.avatarTabAsk === void 0 ? i.autoIntent ?? ue(n) : "read",
|
|
1549
1550
|
dictated: a,
|
|
1550
|
-
voiceProposalBound: a &&
|
|
1551
|
+
voiceProposalBound: a && Ra("api-calls") && Jn(o.acknowledgedWriteModes, "api-calls"),
|
|
1551
1552
|
conversation: h ? {
|
|
1552
1553
|
mode: h.mode,
|
|
1553
1554
|
routedBy: h.routedBy,
|
|
1554
|
-
hasHistory:
|
|
1555
|
+
hasHistory: Bi(h)
|
|
1555
1556
|
} : null
|
|
1556
1557
|
}) : null;
|
|
1557
|
-
if (g &&
|
|
1558
|
-
|
|
1558
|
+
if (g && Uo.current.find((e) => e.id === g.mode)?.writeCapable && !Jn(o.acknowledgedWriteModes, g.mode)) {
|
|
1559
|
+
Qo.current = {
|
|
1559
1560
|
content: n,
|
|
1560
1561
|
attachments: r,
|
|
1561
1562
|
options: i
|
|
1562
|
-
},
|
|
1563
|
+
}, is(g.mode);
|
|
1563
1564
|
return;
|
|
1564
1565
|
}
|
|
1565
1566
|
let _ = g ? g.mode : o.mode, te, ne, v = d ?? (s ? null : H), re = v ? w.getState().conversations.find((e) => e.id === v) : void 0, ie = g?.action === "escalate" && h ? {
|
|
1566
1567
|
mode: h.mode,
|
|
1567
1568
|
backendSessionId: h.backendSessionId ?? null
|
|
1568
1569
|
} : null;
|
|
1569
|
-
if (g) g.action === "new" || !h ? v =
|
|
1570
|
+
if (g) g.action === "new" || !h ? v = ro(void 0, _, { routedBy: "auto" }) : (v = h.id, vo(v, _));
|
|
1570
1571
|
else {
|
|
1571
1572
|
let e = o.autoRouting ? { routedBy: "auto" } : void 0;
|
|
1572
|
-
!v || p(re) || re && re.mode !== _ &&
|
|
1573
|
+
!v || p(re) || re && re.mode !== _ && Bi(re) ? v = ro(void 0, _, e) : re && re.mode !== _ && (e ? vo(v, _) : to(v, _));
|
|
1573
1574
|
}
|
|
1574
1575
|
if (!v) return;
|
|
1575
|
-
a &&
|
|
1576
|
+
a && fs.current !== void 0 && v !== o.activeConversationId && _s(v), i.approvalFollowUp || (xs.current[v] = r);
|
|
1576
1577
|
let ae = () => w.getState().conversations.some((e) => e.id === v), y = T(), b = {
|
|
1577
|
-
accessToken:
|
|
1578
|
-
workspaceToken:
|
|
1578
|
+
accessToken: za(),
|
|
1579
|
+
workspaceToken: Ba(),
|
|
1579
1580
|
userId: B,
|
|
1580
1581
|
organizationId: Vt()
|
|
1581
1582
|
}, le = (e, t) => {
|
|
1582
1583
|
!ae() && y && st(e, y, t, _, {
|
|
1583
|
-
accessToken:
|
|
1584
|
-
workspaceToken:
|
|
1584
|
+
accessToken: za(),
|
|
1585
|
+
workspaceToken: Ba(),
|
|
1585
1586
|
userId: B,
|
|
1586
1587
|
organizationId: Vt()
|
|
1587
1588
|
});
|
|
@@ -1601,7 +1602,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1601
1602
|
}
|
|
1602
1603
|
};
|
|
1603
1604
|
W(v, fe);
|
|
1604
|
-
let me = i.fromPerson === !0 && r.length === 0 && i.focus === void 0 && i.approvalFollowUp === void 0 && ee === n ?
|
|
1605
|
+
let me = i.fromPerson === !0 && r.length === 0 && i.focus === void 0 && i.approvalFollowUp === void 0 && ee === n ? Di(n, a ? Ja.input.code : V) : null, he = {
|
|
1605
1606
|
location: window.location.pathname + window.location.search,
|
|
1606
1607
|
conversationId: w.getState().activeConversationId,
|
|
1607
1608
|
workspaceId: T(),
|
|
@@ -1613,17 +1614,17 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1613
1614
|
content: "",
|
|
1614
1615
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1615
1616
|
metadata: {
|
|
1616
|
-
lang:
|
|
1617
|
+
lang: Za,
|
|
1617
1618
|
...lr(i.voiceSessionId)
|
|
1618
1619
|
}
|
|
1619
1620
|
}), sn(x, {
|
|
1620
1621
|
channel: a ? "voice" : "chat",
|
|
1621
1622
|
mode: _,
|
|
1622
1623
|
product: L,
|
|
1623
|
-
language:
|
|
1624
|
+
language: Za,
|
|
1624
1625
|
device: ln(),
|
|
1625
1626
|
routedByAuto: !!g
|
|
1626
|
-
}, i.voiceTiming), E(x, "accepted"),
|
|
1627
|
+
}, i.voiceTiming), E(x, "accepted"), so(v, "provisioning", x, null), Dr(x), i.avatarTabAsk !== void 0 && Qs(i.avatarTabAsk, {
|
|
1627
1628
|
conversationId: v,
|
|
1628
1629
|
questionId: fe.id,
|
|
1629
1630
|
replyId: x
|
|
@@ -1631,13 +1632,13 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1631
1632
|
let ge = () => {
|
|
1632
1633
|
let e = kn({
|
|
1633
1634
|
turnId: x,
|
|
1634
|
-
abortRequested:
|
|
1635
|
+
abortRequested: zs.current.has(x),
|
|
1635
1636
|
activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
|
|
1636
1637
|
conversationExists: ae()
|
|
1637
1638
|
});
|
|
1638
1639
|
return e.abandon && ye(), e;
|
|
1639
|
-
}, _e = (e, t, n, r, a = !1, o =
|
|
1640
|
-
|
|
1640
|
+
}, _e = (e, t, n, r, a = !1, o = Za) => {
|
|
1641
|
+
ao(v, x, { content: Et(e) }), oo(v, x, {
|
|
1641
1642
|
lang: o,
|
|
1642
1643
|
...t?.length ? { artifacts: t } : {},
|
|
1643
1644
|
...t?.length || n || r ? { mode: _ } : {},
|
|
@@ -1660,17 +1661,17 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1660
1661
|
E(x, "attemptStarted");
|
|
1661
1662
|
let s = null, c = null, l = !1;
|
|
1662
1663
|
try {
|
|
1663
|
-
let { sandboxId: e, sessionId: u, sessionIsNew: d, readAhead: f, sandboxIsNew: p, sandboxProbed: m, sandboxAdopted: h, deadSandboxProbe: g, sessionPreopened: re, knownFloor: ie } = await
|
|
1664
|
+
let { sandboxId: e, sessionId: u, sessionIsNew: d, readAhead: f, sandboxIsNew: p, sandboxProbed: m, sandboxAdopted: h, deadSandboxProbe: g, sessionPreopened: re, knownFloor: ie } = await js(v, x, _, y, b, {
|
|
1664
1665
|
isAbandoned: () => kn({
|
|
1665
1666
|
turnId: x,
|
|
1666
|
-
abortRequested:
|
|
1667
|
+
abortRequested: zs.current.has(x),
|
|
1667
1668
|
activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
|
|
1668
1669
|
conversationExists: ae()
|
|
1669
1670
|
}).abandon,
|
|
1670
1671
|
...o ? { verifySession: !0 } : {}
|
|
1671
1672
|
});
|
|
1672
1673
|
if (s = e, we(), we = t(e, () => {
|
|
1673
|
-
|
|
1674
|
+
zs.current.add(x), Mt(x), kt.abort(x);
|
|
1674
1675
|
}), E(x, "runtimeReady"), cn(x, {
|
|
1675
1676
|
runtime: p ? "cold" : h ? "adopted" : m ? "probed" : re ? "preopened" : d ? "new-session" : "warm",
|
|
1676
1677
|
deadSandboxProbe: g
|
|
@@ -1680,22 +1681,22 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1680
1681
|
}, F) {
|
|
1681
1682
|
let e = ge();
|
|
1682
1683
|
if (e.abandon) {
|
|
1683
|
-
e.clearProcessing &&
|
|
1684
|
+
e.clearProcessing && co(v);
|
|
1684
1685
|
return;
|
|
1685
1686
|
}
|
|
1686
1687
|
}
|
|
1687
1688
|
if (Yn(_, te, w.getState().acknowledgedWriteModes, {
|
|
1688
1689
|
dictated: a,
|
|
1689
1690
|
confirmsWrites: gt(_),
|
|
1690
|
-
proposalBound:
|
|
1691
|
+
proposalBound: Ra(_, e)
|
|
1691
1692
|
}) === "voice-in-write-mode") throw new Wt("voice-in-write-mode", "Voice in a write mode");
|
|
1692
|
-
let se =
|
|
1693
|
+
let se = Wi({
|
|
1693
1694
|
conversation: w.getState().conversations.find((e) => e.id === v),
|
|
1694
1695
|
content: n,
|
|
1695
1696
|
sessionIsNew: d,
|
|
1696
1697
|
sendingMode: _,
|
|
1697
1698
|
sendingModeConfig: te,
|
|
1698
|
-
modes:
|
|
1699
|
+
modes: Uo.current,
|
|
1699
1700
|
answerText: (e) => Xe(e).text
|
|
1700
1701
|
});
|
|
1701
1702
|
if (be(), Kn()) {
|
|
@@ -1710,7 +1711,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1710
1711
|
channel: "voice",
|
|
1711
1712
|
voiceSessionId: i.voiceSessionId,
|
|
1712
1713
|
text: t,
|
|
1713
|
-
lang:
|
|
1714
|
+
lang: Za,
|
|
1714
1715
|
final: !1
|
|
1715
1716
|
}, e));
|
|
1716
1717
|
},
|
|
@@ -1727,21 +1728,21 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1727
1728
|
});
|
|
1728
1729
|
}
|
|
1729
1730
|
let ue = ie ?? await Lt(() => pt(e, y, u, _, b, { limit: 50 }), d, Ft(f, e, u));
|
|
1730
|
-
|
|
1731
|
-
let de =
|
|
1731
|
+
ks(v, x, "streaming", "thinking");
|
|
1732
|
+
let de = Na?.(), pe = ce(w.getState().sandboxWriteCapabilities[e]), Se = Y.current, Te = xi(e, u), Ee = Se.options.uiCatalogue ? vi(zr(Se.navItems), {
|
|
1732
1733
|
permissionsSettled: Se.navPermissionsSettled,
|
|
1733
1734
|
simulating: Se.navSimulating,
|
|
1734
|
-
sentBefore:
|
|
1735
|
+
sentBefore: bi(Te)
|
|
1735
1736
|
}) : null, De = w.getState().sandboxWriteCapabilities[e]?.clientTools === !0 ? Tt({ writeCapable: te?.writeCapable === !0 || _ === "api-calls" }) : null, Oe = De?.manifest ?? [], ke = {
|
|
1736
1737
|
conversationId: v,
|
|
1737
1738
|
writeReply: pe === "proposal-v1" ? i.writeReplyBound?.writeReply ?? null : null,
|
|
1738
1739
|
...Ee ? { uiCatalogue: Ee } : {},
|
|
1739
1740
|
...Oe.length > 0 ? { clientTools: Oe } : {}
|
|
1740
1741
|
}, { prompt: Ae, parts: je } = yn({
|
|
1741
|
-
content:
|
|
1742
|
+
content: ra(se ? `${se}${ee}` : ee, i.focus),
|
|
1742
1743
|
attachments: r,
|
|
1743
1744
|
limits: _n(te),
|
|
1744
|
-
wrapPrompt: (e) =>
|
|
1745
|
+
wrapPrompt: (e) => Pa?.(_, e, Ya, Xa, a, { writeApproval: pe }) ?? e,
|
|
1745
1746
|
requestBytes: (t, n) => vt({
|
|
1746
1747
|
sandboxId: e,
|
|
1747
1748
|
workspaceId: y,
|
|
@@ -1757,7 +1758,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1757
1758
|
l = mn(r) > Me;
|
|
1758
1759
|
let Pe = ge();
|
|
1759
1760
|
if (Pe.abandon) {
|
|
1760
|
-
Pe.clearProcessing &&
|
|
1761
|
+
Pe.clearProcessing && co(v);
|
|
1761
1762
|
return;
|
|
1762
1763
|
}
|
|
1763
1764
|
let Fe = (t) => Ce.dispatch({
|
|
@@ -1776,8 +1777,8 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1776
1777
|
if (!Ce.canFailover() || !je || !En(e)) throw e;
|
|
1777
1778
|
await Fe(void 0), l ||= Ne;
|
|
1778
1779
|
}
|
|
1779
|
-
Ee &&
|
|
1780
|
-
let Ie = w.getState().sandboxWriteCapabilities[e], Le = Se.options.uiOffers === !0 &&
|
|
1780
|
+
Ee && yi(Te);
|
|
1781
|
+
let Ie = w.getState().sandboxWriteCapabilities[e], Le = Se.options.uiOffers === !0 && wi(Ie) ? B : null, Re = !!Le;
|
|
1781
1782
|
Le && Z.recordTurn({
|
|
1782
1783
|
replyId: x,
|
|
1783
1784
|
conversationId: v,
|
|
@@ -1792,8 +1793,8 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1792
1793
|
tools: De.tools,
|
|
1793
1794
|
post: (t, n) => _t(e, y, u, t, n, _, b)
|
|
1794
1795
|
}) : null, Be = ze ? (e) => ze.receive(e) : void 0, Ve = Re ? (e, t) => {
|
|
1795
|
-
Z.receive(x, e, t, performance.now()) &&
|
|
1796
|
-
} : void 0, He = (e) =>
|
|
1796
|
+
Z.receive(x, e, t, performance.now()) && _c();
|
|
1797
|
+
} : void 0, He = (e) => ao(v, x, { content: e }), Ue = (e) => l ? `${e}\n\n${P("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;
|
|
1797
1798
|
E(x, "promptSent");
|
|
1798
1799
|
let We = null, Ge = !1, Ke = Nt, C = Pt([], ue);
|
|
1799
1800
|
S.render?.arm(ue);
|
|
@@ -1812,28 +1813,28 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1812
1813
|
le(e, u);
|
|
1813
1814
|
let t = ge();
|
|
1814
1815
|
if (t.abandon) {
|
|
1815
|
-
t.clearProcessing &&
|
|
1816
|
+
t.clearProcessing && co(v);
|
|
1816
1817
|
return;
|
|
1817
1818
|
}
|
|
1818
1819
|
let n = Date.now(), r = await et.next();
|
|
1819
|
-
Re && Z.observeMessages(x, r) &&
|
|
1820
|
+
Re && Z.observeMessages(x, r) && _c(), C = Pt(r, ue, { accumulateNarration: ne.accumulatesNarration });
|
|
1820
1821
|
let i = Ot(Qe, C.done, Ze, Date.now());
|
|
1821
1822
|
if (i !== C.done && (C = {
|
|
1822
1823
|
...C,
|
|
1823
1824
|
done: i
|
|
1824
|
-
}),
|
|
1825
|
+
}), ao(v, x, { content: Et(C.content) }), C.hasRenderableOutput ? Ge || (Ge = !0, We !== null && E(x, "lastQuietPoll", We), E(x, "firstOutput")) : We = dn(), ne.accumulatesNarration) C.hasText && E(x, "firstText");
|
|
1825
1826
|
else {
|
|
1826
1827
|
let e = Bt(Ke, C, dn());
|
|
1827
1828
|
Ke = e.tracker, e.confirmedAt !== null && E(x, "firstText", e.confirmedAt);
|
|
1828
1829
|
}
|
|
1829
|
-
if (C.pendingWrite && !oe(w.getState().sandboxWriteCapabilities[e]) &&
|
|
1830
|
+
if (C.pendingWrite && !oe(w.getState().sandboxWriteCapabilities[e]) && oo(v, x, { pendingWrite: C.pendingWrite }), C.done && (S.stream ? cn(x, {
|
|
1830
1831
|
transport: S.stream.reachedOpen ? "sse" : "poll",
|
|
1831
1832
|
live: Bn(S.stream.live)
|
|
1832
1833
|
}) : cn(x, {
|
|
1833
1834
|
transport: "poll",
|
|
1834
1835
|
live: "none"
|
|
1835
1836
|
}), ye()), C.done) {
|
|
1836
|
-
E(x, "answerDone"),
|
|
1837
|
+
E(x, "answerDone"), Ss.current.markVerified(e), ne.continuesInBackground || It(e, u, r);
|
|
1837
1838
|
break;
|
|
1838
1839
|
}
|
|
1839
1840
|
if (S.render?.refresh(r), Date.now() - Je > 3e4 && (zn(e, y, b), Je = Date.now()), !et.hasPending()) {
|
|
@@ -1854,7 +1855,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1854
1855
|
channel: "voice",
|
|
1855
1856
|
voiceSessionId: i.voiceSessionId,
|
|
1856
1857
|
text: e,
|
|
1857
|
-
lang:
|
|
1858
|
+
lang: Za,
|
|
1858
1859
|
final: !0
|
|
1859
1860
|
}));
|
|
1860
1861
|
}
|
|
@@ -1864,21 +1865,21 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1864
1865
|
content: Ue(C.content)
|
|
1865
1866
|
});
|
|
1866
1867
|
let rt = !C.done;
|
|
1867
|
-
_e(C.content, nt, u, e, rt), C.tokens && (
|
|
1868
|
+
_e(C.content, nt, u, e, rt), C.tokens && (ao(v, x, { tokens: C.tokens }), Ia && Sn({
|
|
1868
1869
|
workspaceId: y,
|
|
1869
1870
|
sessionId: u,
|
|
1870
1871
|
messageId: C.messageId,
|
|
1871
1872
|
model: C.model,
|
|
1872
1873
|
tokens: C.tokens
|
|
1873
|
-
},
|
|
1874
|
+
}, Ia, { ledger: bn("panel", L) }).then((e) => {
|
|
1874
1875
|
e.ok && Ut(L);
|
|
1875
1876
|
})), C.done || le(e, u);
|
|
1876
1877
|
let it = ge();
|
|
1877
1878
|
if (it.abandon) {
|
|
1878
|
-
it.clearProcessing &&
|
|
1879
|
+
it.clearProcessing && co(v);
|
|
1879
1880
|
return;
|
|
1880
1881
|
}
|
|
1881
|
-
E(x, "complete"), cn(x, { outcome: "answered" }),
|
|
1882
|
+
E(x, "complete"), cn(x, { outcome: "answered" }), so(v, "complete", x, null), zi.recordCommittedEntries(v, [fe.id, x], "TURN", y), xe = !1, Re && me && C.done && Dc({
|
|
1882
1883
|
replyId: x,
|
|
1883
1884
|
conversationId: v,
|
|
1884
1885
|
voiceSessionId: i.voiceSessionId,
|
|
@@ -1887,27 +1888,27 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1887
1888
|
});
|
|
1888
1889
|
} catch (t) {
|
|
1889
1890
|
let n = t instanceof In;
|
|
1890
|
-
n ||
|
|
1891
|
+
n || Ss.current.invalidate(s ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null);
|
|
1891
1892
|
let r = kn({
|
|
1892
1893
|
turnId: x,
|
|
1893
|
-
abortRequested:
|
|
1894
|
+
abortRequested: zs.current.has(x),
|
|
1894
1895
|
activeTurnId: w.getState().processingByConversationId[v]?.messageId ?? null,
|
|
1895
1896
|
conversationExists: ae()
|
|
1896
1897
|
});
|
|
1897
1898
|
if (ye(), s && c && le(s, c), r.abandon) {
|
|
1898
|
-
r.clearProcessing &&
|
|
1899
|
+
r.clearProcessing && co(v);
|
|
1899
1900
|
return;
|
|
1900
1901
|
}
|
|
1901
|
-
if (n) return we(),
|
|
1902
|
+
if (n) return we(), uo(v), be(), un(x), Te(e, !0);
|
|
1902
1903
|
if (e === 1 && Ce.canFailover() && Dn(t)) {
|
|
1903
1904
|
we();
|
|
1904
1905
|
let e = s ?? w.getState().sandboxesByMode[_]?.sandboxId ?? null;
|
|
1905
|
-
return e && (
|
|
1906
|
+
return e && (Cs.current.add(e), Ss.current.invalidate(e)), uo(v), po(_), io(v, x, ""), oo(v, x, { pendingWrite: void 0 }), e && K.retireSandbox(e), be(), Se(!0), un(x), Te(2);
|
|
1906
1907
|
}
|
|
1907
1908
|
throw t;
|
|
1908
1909
|
}
|
|
1909
1910
|
}, Ee = v;
|
|
1910
|
-
|
|
1911
|
+
ws.current.add(Ee);
|
|
1911
1912
|
let De = Fn();
|
|
1912
1913
|
Rn();
|
|
1913
1914
|
try {
|
|
@@ -1915,33 +1916,33 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1915
1916
|
code: "UNAUTHENTICATED",
|
|
1916
1917
|
authFailure: "WORKSPACE_CONTEXT_MISSING"
|
|
1917
1918
|
} });
|
|
1918
|
-
let e = await Zn(_, () =>
|
|
1919
|
+
let e = await Zn(_, () => Uo.current.find((e) => e.id === _), Ho);
|
|
1919
1920
|
te = e.config, ne = e.capabilities;
|
|
1920
1921
|
let t = te, n = ge();
|
|
1921
1922
|
if (n.abandon) {
|
|
1922
|
-
n.clearProcessing &&
|
|
1923
|
+
n.clearProcessing && co(v);
|
|
1923
1924
|
return;
|
|
1924
1925
|
}
|
|
1925
1926
|
let r = Yn(_, t, w.getState().acknowledgedWriteModes, {
|
|
1926
1927
|
dictated: a,
|
|
1927
1928
|
confirmsWrites: gt(_),
|
|
1928
|
-
proposalBound:
|
|
1929
|
+
proposalBound: Ra(_)
|
|
1929
1930
|
});
|
|
1930
1931
|
if (r) throw new Wt(r, r === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
|
|
1931
1932
|
let i = bn("panel", L);
|
|
1932
|
-
if (
|
|
1933
|
-
let e = await Cn(i, y,
|
|
1933
|
+
if (Ia && await wn(i, y), Ia && xn(i, y)) {
|
|
1934
|
+
let e = await Cn(i, y, Ia);
|
|
1934
1935
|
if (!e.ok) throw Tn(e.kind);
|
|
1935
1936
|
let t = ge();
|
|
1936
1937
|
if (t.abandon) {
|
|
1937
|
-
t.clearProcessing &&
|
|
1938
|
+
t.clearProcessing && co(v);
|
|
1938
1939
|
return;
|
|
1939
1940
|
}
|
|
1940
1941
|
}
|
|
1941
1942
|
E(x, "cleared"), await Te();
|
|
1942
1943
|
} catch (e) {
|
|
1943
|
-
if (
|
|
1944
|
-
|
|
1944
|
+
if (Ss.current.invalidate(w.getState().sandboxesByMode[_]?.sandboxId ?? null), !ae()) {
|
|
1945
|
+
co(v);
|
|
1945
1946
|
return;
|
|
1946
1947
|
}
|
|
1947
1948
|
let t = ve.session?.sandboxId ?? null, n = Gt(e, { confirmsNoAction: Kt({
|
|
@@ -1950,76 +1951,76 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
1950
1951
|
}) });
|
|
1951
1952
|
cn(x, { outcome: n.kind === "temporary" ? "failed" : "refused" }), n.offersUpgrade && Ht(L, "sandbox");
|
|
1952
1953
|
let r = qt(n, P, { locale: V });
|
|
1953
|
-
|
|
1954
|
+
so(v, "error", x, r.headline), ao(v, x, { content: r.text }), oo(v, x, {
|
|
1954
1955
|
lang: r.translated ? V : "en",
|
|
1955
1956
|
...lr(i.voiceSessionId)
|
|
1956
1957
|
});
|
|
1957
1958
|
} finally {
|
|
1958
|
-
we(),
|
|
1959
|
+
we(), ws.current.delete(Ee), cn(x, { outcome: "stopped" }), E(x, "complete"), Se(), be();
|
|
1959
1960
|
let e = w.getState(), t = de(ie, _, e.conversations.find((e) => e.id === Ee), (t) => !!e.sandboxesByMode[t]?.sandboxId);
|
|
1960
|
-
t && (
|
|
1961
|
+
t && (vo(Ee, t.mode), t.backendSessionId && lo(Ee, t.backendSessionId)), ve.session && ae() && K.afterTurn({
|
|
1961
1962
|
...ve.session,
|
|
1962
1963
|
conversationId: Ee
|
|
1963
1964
|
}, x);
|
|
1964
|
-
let n =
|
|
1965
|
-
|
|
1965
|
+
let n = Bs.current;
|
|
1966
|
+
Bs.current = null, n && n.conversationId === Ee && ae() && Yc.current(n.content, n.attachments, n.options), De();
|
|
1966
1967
|
}
|
|
1967
1968
|
}, [
|
|
1968
1969
|
H,
|
|
1969
1970
|
W,
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1971
|
+
Pa,
|
|
1972
|
+
uo,
|
|
1973
|
+
po,
|
|
1974
|
+
Qa,
|
|
1975
|
+
ro,
|
|
1976
|
+
js,
|
|
1976
1977
|
K,
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1978
|
+
Hs,
|
|
1979
|
+
Rc,
|
|
1980
|
+
Gc,
|
|
1980
1981
|
V,
|
|
1981
|
-
|
|
1982
|
-
La,
|
|
1983
|
-
Ma,
|
|
1982
|
+
Ja,
|
|
1984
1983
|
Ra,
|
|
1984
|
+
Na,
|
|
1985
1985
|
za,
|
|
1986
|
-
|
|
1986
|
+
Ba,
|
|
1987
|
+
ao,
|
|
1987
1988
|
L,
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
Ya,
|
|
1991
|
-
V,
|
|
1989
|
+
Ho,
|
|
1990
|
+
Ia,
|
|
1992
1991
|
Xa,
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
1992
|
+
V,
|
|
1993
|
+
Za,
|
|
1994
|
+
Ya,
|
|
1995
|
+
vo,
|
|
1996
|
+
Wc,
|
|
1997
|
+
Nc,
|
|
1998
|
+
_s,
|
|
1999
|
+
bs,
|
|
2000
|
+
lo,
|
|
2001
|
+
to,
|
|
2002
2002
|
so,
|
|
2003
|
+
co,
|
|
2003
2004
|
P,
|
|
2004
|
-
|
|
2005
|
-
|
|
2005
|
+
ks,
|
|
2006
|
+
io,
|
|
2006
2007
|
B,
|
|
2007
2008
|
Z,
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2009
|
+
_c,
|
|
2010
|
+
Lc,
|
|
2011
|
+
Dc,
|
|
2012
|
+
Qs,
|
|
2011
2013
|
Zs,
|
|
2012
|
-
Xs,
|
|
2013
2014
|
F
|
|
2014
|
-
]),
|
|
2015
|
+
]), Kc = D((e, t) => {
|
|
2015
2016
|
Q(e, [], t ? { autoIntent: t } : {});
|
|
2016
|
-
}, [Q]),
|
|
2017
|
-
let e = [...
|
|
2017
|
+
}, [Q]), qc = et(), Jc = D(() => {
|
|
2018
|
+
let e = [...yo.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
|
|
2018
2019
|
if (!e || e.metadata?.approvalFollowUp) return;
|
|
2019
|
-
let t = H ?
|
|
2020
|
+
let t = H ? xs.current[H] ?? [] : [], n = na(e.metadata?.askAbout) ?? void 0, r = n ? { focus: n } : {};
|
|
2020
2021
|
if (t.some((e) => rt(e, Date.now()))) {
|
|
2021
2022
|
let n = H ?? void 0;
|
|
2022
|
-
it(t,
|
|
2023
|
+
it(t, qc).then((t) => {
|
|
2023
2024
|
Q(e.content, t, {
|
|
2024
2025
|
...n === void 0 ? {} : { targetConversationId: n },
|
|
2025
2026
|
...r
|
|
@@ -2027,113 +2028,113 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
2027
2028
|
});
|
|
2028
2029
|
} else Q(e.content, t, r);
|
|
2029
2030
|
}, [
|
|
2030
|
-
|
|
2031
|
+
bo,
|
|
2031
2032
|
Q,
|
|
2032
2033
|
H,
|
|
2033
|
-
|
|
2034
|
-
]),
|
|
2034
|
+
qc
|
|
2035
|
+
]), Yc = A(Q);
|
|
2035
2036
|
O(() => {
|
|
2036
|
-
|
|
2037
|
+
Yc.current = Q;
|
|
2037
2038
|
}, [Q]);
|
|
2038
|
-
let
|
|
2039
|
-
if (
|
|
2040
|
-
for (let e =
|
|
2041
|
-
let t =
|
|
2039
|
+
let Xc = k(() => {
|
|
2040
|
+
if (So) return null;
|
|
2041
|
+
for (let e = bo.length - 1; e >= 0; --e) {
|
|
2042
|
+
let t = bo[e];
|
|
2042
2043
|
if (t?.role !== "assistant") continue;
|
|
2043
|
-
if (t.id ===
|
|
2044
|
-
if (!cr(t) ||
|
|
2045
|
-
let n = Qn(t,
|
|
2044
|
+
if (t.id === ac) return null;
|
|
2045
|
+
if (!cr(t) || zs.current.has(t.id) || jt(t.id)) continue;
|
|
2046
|
+
let n = Qn(t, xo, P);
|
|
2046
2047
|
if (n.kind !== "output") return null;
|
|
2047
2048
|
let r = Xe(n.text).text.trim();
|
|
2048
|
-
return r ?
|
|
2049
|
+
return r ? Cr(t, r, xo) : null;
|
|
2049
2050
|
}
|
|
2050
2051
|
return null;
|
|
2051
2052
|
}, [
|
|
2052
|
-
yo,
|
|
2053
|
-
xo,
|
|
2054
2053
|
bo,
|
|
2055
|
-
|
|
2054
|
+
So,
|
|
2055
|
+
xo,
|
|
2056
|
+
ac,
|
|
2056
2057
|
P
|
|
2057
|
-
]),
|
|
2058
|
+
]), Zc = k(() => Xc ? nr(Xc.text) : null, [Xc]), Qc = k(() => yo.chat.filter((e) => e.id !== ac), [yo.chat, ac]), $c = k(() => I ? yo.all.filter((e) => e.id !== ac) : Qc, [
|
|
2058
2059
|
I,
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
]), [
|
|
2060
|
+
yo.all,
|
|
2061
|
+
ac,
|
|
2062
|
+
Qc
|
|
2063
|
+
]), [el, tl] = j(null), nl = w((e) => ot(e)?.sandboxId ?? null), rl = kr(Qc, {
|
|
2063
2064
|
sessionId: G?.backendSessionId,
|
|
2064
|
-
sandboxId:
|
|
2065
|
+
sandboxId: nl,
|
|
2065
2066
|
nowMs: Date.now()
|
|
2066
|
-
}),
|
|
2067
|
+
}), il = Ar(Qc), al = (e) => {
|
|
2067
2068
|
if (ae(e.metadata).length > 0) return !0;
|
|
2068
2069
|
let t = e.metadata?.sandboxId;
|
|
2069
|
-
return oe(t ?
|
|
2070
|
-
},
|
|
2070
|
+
return oe(t ? To[t] : null);
|
|
2071
|
+
}, ol = (e) => {
|
|
2071
2072
|
let t = ae(e.metadata);
|
|
2072
2073
|
return t.length === 0 || !H ? null : /* @__PURE__ */ M(d, {
|
|
2073
2074
|
refs: t,
|
|
2074
2075
|
conversationId: H,
|
|
2075
2076
|
panel: K,
|
|
2076
|
-
entries:
|
|
2077
|
-
capabilitiesOf: (e) =>
|
|
2078
|
-
turnInFlight:
|
|
2077
|
+
entries: Eo,
|
|
2078
|
+
capabilitiesOf: (e) => To[e],
|
|
2079
|
+
turnInFlight: So,
|
|
2079
2080
|
tr: P,
|
|
2080
|
-
onReview:
|
|
2081
|
-
retiredSandboxes:
|
|
2081
|
+
onReview: Oo.review,
|
|
2082
|
+
retiredSandboxes: Do,
|
|
2082
2083
|
onReapply: () => void Q(P("writeProposal.reapplyPrompt", "That change wasn't saved because it changed after you read it. Fetch the latest version and reapply only your change on top of it."))
|
|
2083
2084
|
});
|
|
2084
|
-
},
|
|
2085
|
+
}, sl = (e) => {
|
|
2085
2086
|
if (!H) return null;
|
|
2086
2087
|
let t = Z.liveOffersFor(e, {
|
|
2087
2088
|
registry: {
|
|
2088
|
-
destinations:
|
|
2089
|
-
permissionsSettled:
|
|
2090
|
-
simulating:
|
|
2089
|
+
destinations: zr(ec),
|
|
2090
|
+
permissionsSettled: tc,
|
|
2091
|
+
simulating: nc
|
|
2091
2092
|
},
|
|
2092
2093
|
actorId: B,
|
|
2093
2094
|
conversationId: H,
|
|
2094
2095
|
perfNow: performance.now()
|
|
2095
2096
|
}), n = t[0];
|
|
2096
|
-
return n ? /* @__PURE__ */ M(
|
|
2097
|
+
return n ? /* @__PURE__ */ M(Ai, {
|
|
2097
2098
|
offers: t.map(({ offer: e, target: t }) => ({
|
|
2098
2099
|
offerId: e.offerId,
|
|
2099
2100
|
label: t.label,
|
|
2100
2101
|
path: t.path
|
|
2101
2102
|
})),
|
|
2102
|
-
hint: t.length === 1 && z === "proposal-v1" ?
|
|
2103
|
-
onOpen:
|
|
2103
|
+
hint: t.length === 1 && z === "proposal-v1" ? Ti(n.offer, Z.turnFor(e)) : "link",
|
|
2104
|
+
onOpen: Ec
|
|
2104
2105
|
}, n.offer.offerId) : null;
|
|
2105
|
-
},
|
|
2106
|
+
}, cl = (e) => e.role === "assistant" ? sl(e.id) : null;
|
|
2106
2107
|
O(() => {
|
|
2107
2108
|
let e = Z.nextExpiryInMs(performance.now());
|
|
2108
2109
|
if (e === null) return;
|
|
2109
|
-
let t = window.setTimeout(
|
|
2110
|
+
let t = window.setTimeout(_c, e + 1);
|
|
2110
2111
|
return () => window.clearTimeout(t);
|
|
2111
2112
|
}, [
|
|
2112
2113
|
Z,
|
|
2113
|
-
|
|
2114
|
-
|
|
2114
|
+
hc,
|
|
2115
|
+
_c
|
|
2115
2116
|
]);
|
|
2116
|
-
let
|
|
2117
|
+
let ll = Oo.dialog.view ? Eo[Oo.dialog.view.proposalId] : void 0, ul = rl?.expiresAtMs ?? null;
|
|
2117
2118
|
O(() => {
|
|
2118
|
-
if (
|
|
2119
|
-
let e = window.setTimeout(() =>
|
|
2119
|
+
if (ul === null) return;
|
|
2120
|
+
let e = window.setTimeout(() => Rs((e) => e + 1), Math.max(0, ul - Date.now()));
|
|
2120
2121
|
return () => window.clearTimeout(e);
|
|
2121
|
-
}, [
|
|
2122
|
-
let
|
|
2122
|
+
}, [ul, Ls]);
|
|
2123
|
+
let dl = k(() => yo.voice.filter((e) => e.id !== ac && (e.role === "user" || e.role === "assistant")).map((e) => ({
|
|
2123
2124
|
id: e.id,
|
|
2124
2125
|
role: e.role,
|
|
2125
|
-
text: tr(e,
|
|
2126
|
+
text: tr(e, xo, P),
|
|
2126
2127
|
sessionId: ur(e),
|
|
2127
2128
|
timestamp: e.timestamp
|
|
2128
2129
|
})).filter((e) => e.text.length > 0), [
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2130
|
+
yo.voice,
|
|
2131
|
+
xo,
|
|
2132
|
+
ac,
|
|
2132
2133
|
P
|
|
2133
|
-
]),
|
|
2134
|
-
if (
|
|
2134
|
+
]), fl = D(() => {
|
|
2135
|
+
if (dl.length === 0) return;
|
|
2135
2136
|
let e = /* @__PURE__ */ new Date();
|
|
2136
|
-
or(ir(
|
|
2137
|
+
or(ir(dl, {
|
|
2137
2138
|
title: P("voiceSession.transcript", "Voice conversation"),
|
|
2138
2139
|
savedAt: P("voiceSession.savedAt", "Saved"),
|
|
2139
2140
|
session: P("voiceSession.sessionLabel", "Session"),
|
|
@@ -2143,27 +2144,27 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
2143
2144
|
}, e), ar(L, e), "text/markdown");
|
|
2144
2145
|
}, [
|
|
2145
2146
|
L,
|
|
2146
|
-
|
|
2147
|
+
dl,
|
|
2147
2148
|
P
|
|
2148
|
-
]),
|
|
2149
|
-
|
|
2150
|
-
let [
|
|
2149
|
+
]), pl = $e({ perFileChars: ns }), ml = A(pl);
|
|
2150
|
+
ml.current = pl;
|
|
2151
|
+
let [hl, gl] = j(null), _l = hl === null ? null : P("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: hl });
|
|
2151
2152
|
O(() => {
|
|
2152
|
-
if (
|
|
2153
|
-
let e = window.setTimeout(() =>
|
|
2153
|
+
if (hl === null) return;
|
|
2154
|
+
let e = window.setTimeout(() => gl(null), da);
|
|
2154
2155
|
return () => window.clearTimeout(e);
|
|
2155
|
-
}, [
|
|
2156
|
-
let
|
|
2157
|
-
let i =
|
|
2156
|
+
}, [hl]);
|
|
2157
|
+
let vl = A(/* @__PURE__ */ new Set()), yl = A(() => !1), bl = D((e, t, n, r) => {
|
|
2158
|
+
let i = fs.current, a = xr(i), o = () => {
|
|
2158
2159
|
let e = w.getState();
|
|
2159
|
-
return
|
|
2160
|
-
sessionLive:
|
|
2160
|
+
return hr({
|
|
2161
|
+
sessionLive: yl.current(t),
|
|
2161
2162
|
boundAtSubmit: i,
|
|
2162
2163
|
activeConversationId: e.activeConversationId,
|
|
2163
2164
|
boundConversationExists: e.conversations.some((e) => e.id === a)
|
|
2164
2165
|
});
|
|
2165
2166
|
}, s = () => {
|
|
2166
|
-
let i =
|
|
2167
|
+
let i = ml.current;
|
|
2167
2168
|
nt({
|
|
2168
2169
|
draft: i,
|
|
2169
2170
|
maySend: o,
|
|
@@ -2173,18 +2174,18 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
2173
2174
|
...n,
|
|
2174
2175
|
handedOver: dn()
|
|
2175
2176
|
};
|
|
2176
|
-
|
|
2177
|
+
Yc.current(e, i, {
|
|
2177
2178
|
fromPerson: !0,
|
|
2178
2179
|
voiceSessionId: t,
|
|
2179
2180
|
voiceTiming: a,
|
|
2180
2181
|
...r.correction ? { correctsInFlightTurn: !0 } : {}
|
|
2181
2182
|
});
|
|
2182
2183
|
},
|
|
2183
|
-
announceDropped: (e) =>
|
|
2184
|
+
announceDropped: (e) => gl(e)
|
|
2184
2185
|
});
|
|
2185
2186
|
};
|
|
2186
|
-
if (o() &&
|
|
2187
|
-
|
|
2187
|
+
if (o() && Ic.current(e, t)) {
|
|
2188
|
+
Yc.current(e, [], {
|
|
2188
2189
|
fromPerson: !0,
|
|
2189
2190
|
voiceSessionId: t,
|
|
2190
2191
|
voiceTiming: {
|
|
@@ -2194,107 +2195,107 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
2194
2195
|
});
|
|
2195
2196
|
return;
|
|
2196
2197
|
}
|
|
2197
|
-
if (!
|
|
2198
|
+
if (!ml.current.isBusy) {
|
|
2198
2199
|
s();
|
|
2199
2200
|
return;
|
|
2200
2201
|
}
|
|
2201
|
-
let c = Date.now(), l =
|
|
2202
|
-
let e =
|
|
2203
|
-
|
|
2202
|
+
let c = Date.now(), l = vl.current, u = window.setInterval(() => {
|
|
2203
|
+
let e = ml.current.isBusy;
|
|
2204
|
+
ml.current.isCommitting || e && Date.now() - c < ua || (window.clearInterval(u), l.delete(u), s());
|
|
2204
2205
|
}, 200);
|
|
2205
2206
|
l.add(u);
|
|
2206
|
-
}, []),
|
|
2207
|
-
onSubmit:
|
|
2208
|
-
latestReply:
|
|
2209
|
-
language: o(
|
|
2210
|
-
graceMs:
|
|
2211
|
-
onSupersede:
|
|
2212
|
-
handsFreeStreamNoticeAccepted:
|
|
2213
|
-
onAcceptHandsFreeStreamNotice:
|
|
2214
|
-
handsFreeInterrupt:
|
|
2207
|
+
}, []), xl = A(() => void 0), $ = Ze({
|
|
2208
|
+
onSubmit: bl,
|
|
2209
|
+
latestReply: Xc,
|
|
2210
|
+
language: o(Ka, V).tag,
|
|
2211
|
+
graceMs: Ha,
|
|
2212
|
+
onSupersede: Us,
|
|
2213
|
+
handsFreeStreamNoticeAccepted: Wa,
|
|
2214
|
+
onAcceptHandsFreeStreamNotice: Ga,
|
|
2215
|
+
handsFreeInterrupt: Ua,
|
|
2215
2216
|
onBargeIn: () => {
|
|
2216
|
-
|
|
2217
|
+
xl.current(), Hs();
|
|
2217
2218
|
}
|
|
2218
2219
|
});
|
|
2219
|
-
|
|
2220
|
-
let
|
|
2220
|
+
yl.current = $.isCurrentSession;
|
|
2221
|
+
let Sl = ps ? dl.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : dl, Cl = $.answerLocally;
|
|
2221
2222
|
O(() => {
|
|
2222
|
-
|
|
2223
|
-
}, [
|
|
2224
|
-
let
|
|
2225
|
-
|
|
2223
|
+
zc.current = Cl;
|
|
2224
|
+
}, [Cl]);
|
|
2225
|
+
let wl = $.active, Tl = k(() => v(Object.values(Eo), H, Do), [
|
|
2226
|
+
Eo,
|
|
2226
2227
|
H,
|
|
2227
|
-
|
|
2228
|
-
]), [
|
|
2228
|
+
Do
|
|
2229
|
+
]), [El, Dl] = j(null);
|
|
2229
2230
|
O(() => {
|
|
2230
|
-
|
|
2231
|
-
}, [
|
|
2232
|
-
let
|
|
2233
|
-
let e =
|
|
2231
|
+
wl || Dl(null);
|
|
2232
|
+
}, [wl]);
|
|
2233
|
+
let Ol = Oo.review, kl = D(() => {
|
|
2234
|
+
let e = Tl[Tl.length - 1];
|
|
2234
2235
|
if (!e) return;
|
|
2235
2236
|
let { view: t } = e;
|
|
2236
|
-
f(t) && m(t,
|
|
2237
|
+
f(t) && m(t, To[e.session.sandboxId]).offerConfirm ? Ol(t) : Dl(t.proposalId);
|
|
2237
2238
|
}, [
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
]),
|
|
2239
|
+
Tl,
|
|
2240
|
+
To,
|
|
2241
|
+
Ol
|
|
2242
|
+
]), Al = wl ? _(Tl) : null, jl = El ? Eo[El] : void 0, Ml = wl && jl && jl.session.conversationId === H ? {
|
|
2242
2243
|
content: /* @__PURE__ */ M(d, {
|
|
2243
2244
|
refs: [{
|
|
2244
|
-
proposalId:
|
|
2245
|
-
sandboxId:
|
|
2246
|
-
sessionId:
|
|
2245
|
+
proposalId: jl.view.proposalId,
|
|
2246
|
+
sandboxId: jl.session.sandboxId,
|
|
2247
|
+
sessionId: jl.session.sessionId
|
|
2247
2248
|
}],
|
|
2248
|
-
conversationId:
|
|
2249
|
+
conversationId: jl.session.conversationId,
|
|
2249
2250
|
panel: K,
|
|
2250
|
-
entries:
|
|
2251
|
-
capabilitiesOf: (e) =>
|
|
2252
|
-
turnInFlight:
|
|
2251
|
+
entries: Eo,
|
|
2252
|
+
capabilitiesOf: (e) => To[e],
|
|
2253
|
+
turnInFlight: So,
|
|
2253
2254
|
tr: P,
|
|
2254
|
-
onReview:
|
|
2255
|
-
retiredSandboxes:
|
|
2255
|
+
onReview: Ol,
|
|
2256
|
+
retiredSandboxes: Do
|
|
2256
2257
|
}),
|
|
2257
2258
|
closeLabel: re(P, h.trayClose),
|
|
2258
|
-
onClose: () =>
|
|
2259
|
-
} : null,
|
|
2260
|
-
|
|
2259
|
+
onClose: () => Dl(null)
|
|
2260
|
+
} : null, Nl = Oo.asking, Pl = kc?.asking === !0, Fl = Ac?.asking === !0, Il = di(), Ll = $.holdListening, Rl = k(() => wl || J ? null : { run: () => ss ? { status: "already" } : (ds(!0), { status: "done" }) }, [
|
|
2261
|
+
wl,
|
|
2261
2262
|
J,
|
|
2262
|
-
|
|
2263
|
-
|
|
2263
|
+
ss,
|
|
2264
|
+
ds
|
|
2264
2265
|
]);
|
|
2265
|
-
|
|
2266
|
-
let
|
|
2266
|
+
li("assistant.transcript", Rl);
|
|
2267
|
+
let zl = k(() => wl ? null : { run: () => {
|
|
2267
2268
|
let e = w.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
|
|
2268
2269
|
return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
|
|
2269
|
-
} }, [
|
|
2270
|
-
|
|
2271
|
-
|
|
2270
|
+
} }, [wl]);
|
|
2271
|
+
li("assistant.conversation.new", zl), O(() => {
|
|
2272
|
+
Ll(wl && (Nl || Pl || Fl || Il));
|
|
2272
2273
|
}, [
|
|
2273
|
-
|
|
2274
|
-
Ml,
|
|
2274
|
+
wl,
|
|
2275
2275
|
Nl,
|
|
2276
2276
|
Pl,
|
|
2277
2277
|
Fl,
|
|
2278
|
-
Il
|
|
2278
|
+
Il,
|
|
2279
|
+
Ll
|
|
2279
2280
|
]);
|
|
2280
|
-
let
|
|
2281
|
+
let Bl = A(null), Vl = $.announce;
|
|
2281
2282
|
O(() => {
|
|
2282
|
-
if (!
|
|
2283
|
-
|
|
2283
|
+
if (!wl) {
|
|
2284
|
+
Bl.current = null;
|
|
2284
2285
|
return;
|
|
2285
2286
|
}
|
|
2286
|
-
let e =
|
|
2287
|
-
if (e === null)
|
|
2288
|
-
else for (let { view: t, session: n } of ne(
|
|
2287
|
+
let e = Bl.current;
|
|
2288
|
+
if (e === null) Bl.current = new Set(Object.keys(Eo));
|
|
2289
|
+
else for (let { view: t, session: n } of ne(Tl, e)) {
|
|
2289
2290
|
e.add(t.proposalId);
|
|
2290
|
-
let r =
|
|
2291
|
+
let r = To[n.sandboxId];
|
|
2291
2292
|
if (!g({
|
|
2292
2293
|
mode: "api-calls",
|
|
2293
2294
|
productWriteApproval: z,
|
|
2294
2295
|
capabilities: r
|
|
2295
2296
|
})) continue;
|
|
2296
2297
|
let i = ie(t, m(t, r).offerConfirm, P), a = t.proposalId;
|
|
2297
|
-
|
|
2298
|
+
Vl({
|
|
2298
2299
|
id: `write-readback:${a}`,
|
|
2299
2300
|
text: i.text,
|
|
2300
2301
|
lang: i.translated ? V : "en",
|
|
@@ -2302,439 +2303,439 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
2302
2303
|
});
|
|
2303
2304
|
}
|
|
2304
2305
|
}, [
|
|
2305
|
-
Cl,
|
|
2306
2306
|
wl,
|
|
2307
|
+
Tl,
|
|
2308
|
+
Eo,
|
|
2307
2309
|
To,
|
|
2308
|
-
wo,
|
|
2309
2310
|
z,
|
|
2310
2311
|
P,
|
|
2311
2312
|
V,
|
|
2312
|
-
|
|
2313
|
+
Vl,
|
|
2313
2314
|
K
|
|
2314
2315
|
]);
|
|
2315
|
-
let
|
|
2316
|
+
let Hl = A(!1);
|
|
2316
2317
|
O(() => {
|
|
2317
|
-
|
|
2318
|
-
}, [$.active]), O(() =>
|
|
2319
|
-
if (!
|
|
2320
|
-
let t =
|
|
2318
|
+
Hl.current = $.active;
|
|
2319
|
+
}, [$.active]), O(() => Ji((e) => {
|
|
2320
|
+
if (!Hl.current) return !1;
|
|
2321
|
+
let t = fs.current;
|
|
2321
2322
|
return typeof t == "string" ? t === e : w.getState().activeConversationId === e;
|
|
2322
2323
|
}), []);
|
|
2323
|
-
let
|
|
2324
|
-
let e = w.getState().activeConversationId, t =
|
|
2325
|
-
|
|
2324
|
+
let Ul = $.start, Wl = D(() => {
|
|
2325
|
+
let e = w.getState().activeConversationId, t = vr(bs());
|
|
2326
|
+
_s(br(t, e)), Ms(!0, t.kind === "own"), Ul();
|
|
2326
2327
|
}, [
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
]),
|
|
2328
|
+
_s,
|
|
2329
|
+
Ms,
|
|
2330
|
+
bs,
|
|
2331
|
+
Ul
|
|
2332
|
+
]), Gl = k(() => er(G?.messages ?? []), [G?.messages]), Kl = $n(yo.voice, xo, P), ql = $n(Gl, xo, P) > 0, Jl = D(() => {
|
|
2332
2333
|
let e = w.getState().activeConversationId;
|
|
2333
|
-
if (!e ||
|
|
2334
|
-
let t = new Set(
|
|
2334
|
+
if (!e || dl.length === 0) return;
|
|
2335
|
+
let t = new Set(Gl.map((e) => e.id)), n = N();
|
|
2335
2336
|
W(e, {
|
|
2336
2337
|
id: n,
|
|
2337
2338
|
role: "system",
|
|
2338
|
-
content: rr(
|
|
2339
|
+
content: rr(dl.filter((e) => t.has(e.id)), {
|
|
2339
2340
|
intro: P("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
|
|
2340
2341
|
nothing: P("voiceSession.continuedNothing", "Continued from a voice conversation."),
|
|
2341
2342
|
more: (e) => P("voiceSession.continuedMore", "…and {{count}} more", { count: e })
|
|
2342
2343
|
}),
|
|
2343
2344
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2344
|
-
metadata: { continuedVoiceTurns:
|
|
2345
|
-
}),
|
|
2345
|
+
metadata: { continuedVoiceTurns: Kl }
|
|
2346
|
+
}), zi.recordCommittedEntries(e, [n], "NOTE", T()), ds(!1), $.end(), ls(), Da?.();
|
|
2346
2347
|
}, [
|
|
2347
|
-
|
|
2348
|
+
dl,
|
|
2349
|
+
Kl,
|
|
2348
2350
|
Gl,
|
|
2349
|
-
Wl,
|
|
2350
2351
|
W,
|
|
2351
2352
|
P,
|
|
2352
2353
|
$,
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
]),
|
|
2354
|
+
ds,
|
|
2355
|
+
ls,
|
|
2356
|
+
Da
|
|
2357
|
+
]), Yl = A({
|
|
2357
2358
|
conversationId: null,
|
|
2358
2359
|
count: 0
|
|
2359
2360
|
});
|
|
2360
2361
|
O(() => {
|
|
2361
|
-
$.active && (
|
|
2362
|
+
$.active && (Yl.current = {
|
|
2362
2363
|
conversationId: H,
|
|
2363
|
-
count:
|
|
2364
|
+
count: Kl
|
|
2364
2365
|
});
|
|
2365
2366
|
}, [$.active]);
|
|
2366
|
-
let [
|
|
2367
|
+
let [Xl, Zl] = j({}), [Ql, $l] = j({}), eu = A(null), tu = $.active;
|
|
2367
2368
|
O(() => {
|
|
2368
2369
|
if (!I) return;
|
|
2369
|
-
if (
|
|
2370
|
-
|
|
2370
|
+
if (tu) {
|
|
2371
|
+
eu.current ??= {
|
|
2371
2372
|
startedAt: Date.now(),
|
|
2372
2373
|
sessionId: null
|
|
2373
2374
|
};
|
|
2374
2375
|
return;
|
|
2375
2376
|
}
|
|
2376
|
-
let e =
|
|
2377
|
-
|
|
2377
|
+
let e = eu.current;
|
|
2378
|
+
eu.current = null;
|
|
2378
2379
|
let t = e?.sessionId;
|
|
2379
2380
|
if (e && t) {
|
|
2380
2381
|
let n = Math.max(1, Math.round((Date.now() - e.startedAt) / 1e3));
|
|
2381
|
-
|
|
2382
|
+
$l((e) => ({
|
|
2382
2383
|
...e,
|
|
2383
2384
|
[t]: n
|
|
2384
2385
|
}));
|
|
2385
2386
|
}
|
|
2386
|
-
}, [I,
|
|
2387
|
-
let
|
|
2387
|
+
}, [I, tu]);
|
|
2388
|
+
let nu = $.isCurrentSession;
|
|
2388
2389
|
O(() => {
|
|
2389
|
-
let e =
|
|
2390
|
+
let e = eu.current;
|
|
2390
2391
|
if (!I || !e || e.sessionId) return;
|
|
2391
|
-
let t =
|
|
2392
|
+
let t = dl.find((e) => e.sessionId !== void 0 && nu(e.sessionId));
|
|
2392
2393
|
t?.sessionId && (e.sessionId = t.sessionId);
|
|
2393
2394
|
}, [
|
|
2394
2395
|
I,
|
|
2395
|
-
|
|
2396
|
-
|
|
2396
|
+
dl,
|
|
2397
|
+
nu
|
|
2397
2398
|
]);
|
|
2398
|
-
let
|
|
2399
|
-
|
|
2400
|
-
...
|
|
2401
|
-
[
|
|
2399
|
+
let ru = $.session.phase, iu = $c[$c.length - 1], au = I && $.active && (ru === "thinking" || ru === "speaking") && iu?.role === "assistant" && cr(iu) ? iu.id : null, ou = $.spokenChunks, su = au !== null && qs === au && ou ? pr(iu?.content ?? "", ou.chunks.slice(0, ou.index + 1).join(" ").length) : null, [cu, lu] = j({});
|
|
2400
|
+
au !== null && su !== null && su.length > (cu[au]?.length ?? 0) && lu({
|
|
2401
|
+
...cu,
|
|
2402
|
+
[au]: su
|
|
2402
2403
|
});
|
|
2403
|
-
let
|
|
2404
|
-
if (
|
|
2404
|
+
let uu = au === null ? null : cu[au] ?? "", du = D(() => {
|
|
2405
|
+
if (au === null || uu === null || !H) return;
|
|
2405
2406
|
let e = w.getState();
|
|
2406
|
-
if (
|
|
2407
|
-
e.mergeMessageMetadata(H,
|
|
2407
|
+
if (uu === "") {
|
|
2408
|
+
e.mergeMessageMetadata(H, au, { voiceNotSpoken: !0 });
|
|
2408
2409
|
return;
|
|
2409
2410
|
}
|
|
2410
|
-
if (
|
|
2411
|
-
let t =
|
|
2412
|
-
|
|
2411
|
+
if (qs !== au) return;
|
|
2412
|
+
let t = uu;
|
|
2413
|
+
Zl((e) => ({
|
|
2413
2414
|
...e,
|
|
2414
|
-
[
|
|
2415
|
-
})), e.mergeMessageMetadata(H,
|
|
2415
|
+
[au]: t
|
|
2416
|
+
})), e.mergeMessageMetadata(H, au, {
|
|
2416
2417
|
voiceInterrupted: !0,
|
|
2417
2418
|
voiceSpokenText: t
|
|
2418
2419
|
});
|
|
2419
2420
|
}, [
|
|
2420
|
-
|
|
2421
|
-
|
|
2421
|
+
au,
|
|
2422
|
+
uu,
|
|
2422
2423
|
H,
|
|
2423
|
-
|
|
2424
|
+
qs
|
|
2424
2425
|
]);
|
|
2425
2426
|
O(() => {
|
|
2426
|
-
|
|
2427
|
-
}, [
|
|
2428
|
-
let
|
|
2427
|
+
xl.current = du;
|
|
2428
|
+
}, [du]);
|
|
2429
|
+
let fu = (e, t, n) => {
|
|
2429
2430
|
if (!cr(e)) return;
|
|
2430
|
-
let r = ur(e), i = n[t + 1], a = $.active && r !== void 0 &&
|
|
2431
|
-
if (e.role === "user") return { below: /* @__PURE__ */ oa
|
|
2431
|
+
let r = ur(e), i = n[t + 1], a = $.active && r !== void 0 && nu(r), o = (!i || !cr(i) || ur(i) !== r) && !a ? /* @__PURE__ */ M(dr, { seconds: r ? Ql[r] : void 0 }) : null;
|
|
2432
|
+
if (e.role === "user") return { below: /* @__PURE__ */ sa(oa, { children: [/* @__PURE__ */ M(fr, { mark: "spoken" }), o] }) };
|
|
2432
2433
|
if (e.role !== "assistant") return o ? { below: o } : void 0;
|
|
2433
|
-
let s =
|
|
2434
|
+
let s = Xl[e.id] ?? (e.metadata?.voiceInterrupted ? e.metadata.voiceSpokenText : void 0);
|
|
2434
2435
|
if (s !== void 0) return {
|
|
2435
2436
|
content: s,
|
|
2436
|
-
below: /* @__PURE__ */ oa
|
|
2437
|
+
below: /* @__PURE__ */ sa(oa, { children: [/* @__PURE__ */ M(fr, { mark: "interrupted" }), o] })
|
|
2437
2438
|
};
|
|
2438
|
-
if (e.id ===
|
|
2439
|
-
let c = a || r !== void 0 &&
|
|
2440
|
-
return e.content.trim() !== "" && (c ?
|
|
2441
|
-
},
|
|
2442
|
-
let e =
|
|
2443
|
-
$.end(), n &&
|
|
2439
|
+
if (e.id === au && uu !== null) return { content: uu };
|
|
2440
|
+
let c = a || r !== void 0 && Ql[r] !== void 0;
|
|
2441
|
+
return e.content.trim() !== "" && (c ? cu[e.id] !== void 0 : !e.metadata?.voiceNotSpoken) ? { below: /* @__PURE__ */ sa(oa, { children: [/* @__PURE__ */ M(fr, { mark: "spokenAloud" }), o] }) } : o ? { below: o } : void 0;
|
|
2442
|
+
}, pu = D(() => {
|
|
2443
|
+
let e = Yl.current, t = e.conversationId === H ? e.count : 0, n = Kl > t;
|
|
2444
|
+
$.end(), n && ds(!0), du();
|
|
2444
2445
|
}, [
|
|
2445
2446
|
H,
|
|
2446
|
-
|
|
2447
|
+
Kl,
|
|
2447
2448
|
$,
|
|
2448
|
-
|
|
2449
|
-
|
|
2449
|
+
ds,
|
|
2450
|
+
du
|
|
2450
2451
|
]);
|
|
2451
2452
|
O(() => {
|
|
2452
|
-
|
|
2453
|
+
ya && Os || !$.active || $.end();
|
|
2453
2454
|
}, [
|
|
2454
|
-
|
|
2455
|
-
|
|
2455
|
+
ya,
|
|
2456
|
+
Os,
|
|
2456
2457
|
$
|
|
2457
2458
|
]);
|
|
2458
|
-
let [
|
|
2459
|
+
let [mu, hu] = j(ma), gu = Ge({
|
|
2459
2460
|
available: $.available,
|
|
2460
|
-
allowedInMode:
|
|
2461
|
-
readOnly:
|
|
2462
|
-
busy:
|
|
2463
|
-
committing:
|
|
2464
|
-
dictating:
|
|
2465
|
-
}),
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
}, [
|
|
2469
|
-
let
|
|
2470
|
-
|
|
2471
|
-
}, [
|
|
2461
|
+
allowedInMode: Os,
|
|
2462
|
+
readOnly: jo,
|
|
2463
|
+
busy: So || Is !== null || No || dc,
|
|
2464
|
+
committing: mu.committing,
|
|
2465
|
+
dictating: mu.dictating
|
|
2466
|
+
}), _u = We();
|
|
2467
|
+
ia(() => {
|
|
2468
|
+
Ta?.({ live: $.active });
|
|
2469
|
+
}, [Ta, $.active]);
|
|
2470
|
+
let vu = A(!1), yu = D(() => {
|
|
2471
|
+
vu.current = !0, Ea?.({ review: !0 });
|
|
2472
|
+
}, [Ea]);
|
|
2472
2473
|
O(() => {
|
|
2473
|
-
!
|
|
2474
|
-
}, [
|
|
2475
|
-
let
|
|
2474
|
+
!Ma && vu.current && (vu.current = !1, ke(cd.current));
|
|
2475
|
+
}, [Ma]);
|
|
2476
|
+
let bu = $.active;
|
|
2476
2477
|
O(() => {
|
|
2477
|
-
if (!
|
|
2478
|
-
else if (
|
|
2479
|
-
let e =
|
|
2480
|
-
|
|
2481
|
-
} else
|
|
2478
|
+
if (!bu) ys.current = !1, vs.current = null;
|
|
2479
|
+
else if (ps) {
|
|
2480
|
+
let e = fs.current;
|
|
2481
|
+
mr(e) && (vs.current = e.openAtStart), ys.current = !0;
|
|
2482
|
+
} else ys.current && (ys.current = !1, F && De({
|
|
2482
2483
|
pending: "own",
|
|
2483
|
-
openAtStart:
|
|
2484
|
-
},
|
|
2484
|
+
openAtStart: vs.current
|
|
2485
|
+
}, fs.current) && gs(!0));
|
|
2485
2486
|
}, [
|
|
2486
|
-
|
|
2487
|
-
|
|
2487
|
+
ps,
|
|
2488
|
+
bu,
|
|
2488
2489
|
F
|
|
2489
|
-
]),
|
|
2490
|
-
let [
|
|
2490
|
+
]), hs && !$.active && gs(!1);
|
|
2491
|
+
let [xu, Su] = j(null);
|
|
2491
2492
|
O(() => {
|
|
2492
|
-
|
|
2493
|
+
xu !== null && (J && xu.conversationId === H || Su(null));
|
|
2493
2494
|
}, [
|
|
2494
2495
|
J,
|
|
2495
2496
|
H,
|
|
2496
|
-
|
|
2497
|
+
xu
|
|
2497
2498
|
]);
|
|
2498
|
-
let
|
|
2499
|
-
|
|
2499
|
+
let Cu = xu !== null && qs === xu.replyId, wu = A(!1), Tu = D(() => {
|
|
2500
|
+
wu.current = !0, Cu && Js(), Wl();
|
|
2500
2501
|
}, [
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
]),
|
|
2505
|
-
|
|
2502
|
+
Wl,
|
|
2503
|
+
Cu,
|
|
2504
|
+
Js
|
|
2505
|
+
]), Eu = D(() => {
|
|
2506
|
+
Cu && Js(), Wl();
|
|
2506
2507
|
}, [
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2508
|
+
Wl,
|
|
2509
|
+
Cu,
|
|
2510
|
+
Js
|
|
2510
2511
|
]);
|
|
2511
2512
|
O(() => {
|
|
2512
|
-
$.active || (
|
|
2513
|
+
$.active || (wu.current = !1);
|
|
2513
2514
|
}, [$.active]), O(() => {
|
|
2514
|
-
!J &&
|
|
2515
|
+
!J && wu.current && (wu.current = !1, $.active && pu());
|
|
2515
2516
|
}, [
|
|
2516
2517
|
J,
|
|
2517
2518
|
$.active,
|
|
2518
|
-
|
|
2519
|
+
pu
|
|
2519
2520
|
]), O(() => {
|
|
2520
|
-
J &&
|
|
2521
|
-
}, [J,
|
|
2522
|
-
let
|
|
2521
|
+
J && ds(!1);
|
|
2522
|
+
}, [J, ds]);
|
|
2523
|
+
let Du = k(() => ({
|
|
2523
2524
|
live: $.active,
|
|
2524
|
-
blocked:
|
|
2525
|
-
impossible: Ke(
|
|
2526
|
-
start: F ?
|
|
2525
|
+
blocked: gu === null ? null : _u.voiceStartBlocked(gu),
|
|
2526
|
+
impossible: Ke(gu),
|
|
2527
|
+
start: F ? Eu : Tu
|
|
2527
2528
|
}), [
|
|
2528
2529
|
$.active,
|
|
2529
|
-
hu,
|
|
2530
2530
|
gu,
|
|
2531
|
+
_u,
|
|
2531
2532
|
F,
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
]), [
|
|
2535
|
-
|
|
2536
|
-
let
|
|
2533
|
+
Eu,
|
|
2534
|
+
Tu
|
|
2535
|
+
]), [Ou, ku] = j("mini"), [Au, ju] = j(!1), Mu = Ma && $.active && (Au || J);
|
|
2536
|
+
Mu !== Au && ju(Mu);
|
|
2537
|
+
let Nu = F && !I && $.active && !J && (!Ma || Au), Pu = ya && q.covered !== !0 && !($.active && Ou !== "mini") && !(ss && !$.active) && !(Nl || Pl || Fl || Il), Fu = cs?.ask, Iu = aa(Fu?.subscribe ?? ga, Fu?.getSnapshot ?? _a, Fu?.getSnapshot ?? _a), Lu = C({
|
|
2537
2538
|
voiceLive: $.active,
|
|
2538
|
-
readOnly:
|
|
2539
|
+
readOnly: jo,
|
|
2539
2540
|
writes: qe({
|
|
2540
|
-
auto:
|
|
2541
|
+
auto: Xo,
|
|
2541
2542
|
selectedMode: U,
|
|
2542
|
-
conversation: G && !
|
|
2543
|
+
conversation: G && !jo ? {
|
|
2543
2544
|
mode: G.mode,
|
|
2544
2545
|
routedBy: G.routedBy,
|
|
2545
|
-
hasHistory:
|
|
2546
|
+
hasHistory: Bi(G)
|
|
2546
2547
|
} : null,
|
|
2547
2548
|
modeWrites: (e) => R.find((t) => t.id === e)?.writeCapable === !0 || gt(e)
|
|
2548
2549
|
}),
|
|
2549
|
-
avatar:
|
|
2550
|
-
busy:
|
|
2551
|
-
committing:
|
|
2552
|
-
}),
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
}, [
|
|
2556
|
-
let
|
|
2550
|
+
avatar: Iu,
|
|
2551
|
+
busy: So || Is !== null || No || dc || rs !== null || es,
|
|
2552
|
+
committing: mu.committing
|
|
2553
|
+
}), Ru = A(Lu);
|
|
2554
|
+
ia(() => {
|
|
2555
|
+
Ru.current = Lu;
|
|
2556
|
+
}, [Lu]);
|
|
2557
|
+
let zu = D((e) => {
|
|
2557
2558
|
let t = e.trim();
|
|
2558
|
-
if (t === "" ||
|
|
2559
|
-
|
|
2559
|
+
if (t === "" || Ru.current !== null) return { accepted: !1 };
|
|
2560
|
+
Cu && Js();
|
|
2560
2561
|
let n = {
|
|
2561
2562
|
token: N(),
|
|
2562
2563
|
exchange: null,
|
|
2563
2564
|
handled: !1
|
|
2564
2565
|
};
|
|
2565
|
-
|
|
2566
|
+
Ys.current = n;
|
|
2566
2567
|
try {
|
|
2567
2568
|
Q(t, [], {
|
|
2568
2569
|
fromPerson: !0,
|
|
2569
2570
|
avatarTabAsk: n.token,
|
|
2570
2571
|
localRecordsChecked: !0,
|
|
2571
|
-
...
|
|
2572
|
+
...Xo ? { autoIntent: "read" } : {}
|
|
2572
2573
|
});
|
|
2573
2574
|
} finally {
|
|
2574
|
-
|
|
2575
|
+
Ys.current = null;
|
|
2575
2576
|
}
|
|
2576
2577
|
let r = n.exchange;
|
|
2577
2578
|
return r === null ? n.handled ? {
|
|
2578
2579
|
accepted: !0,
|
|
2579
2580
|
recorded: !1
|
|
2580
|
-
} : { accepted: !1 } : (
|
|
2581
|
+
} : { accepted: !1 } : (Su(r), {
|
|
2581
2582
|
accepted: !0,
|
|
2582
2583
|
recorded: !0,
|
|
2583
2584
|
...r
|
|
2584
2585
|
});
|
|
2585
2586
|
}, [
|
|
2586
|
-
|
|
2587
|
+
Xo,
|
|
2587
2588
|
Q,
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
]), [
|
|
2591
|
-
blocker:
|
|
2592
|
-
line: Je(
|
|
2593
|
-
send:
|
|
2594
|
-
last:
|
|
2595
|
-
navigatingReplyId:
|
|
2596
|
-
draft:
|
|
2589
|
+
Js,
|
|
2590
|
+
Cu
|
|
2591
|
+
]), [Bu] = j(() => Ye()), Vu = k(() => ({
|
|
2592
|
+
blocker: Lu,
|
|
2593
|
+
line: Je(Lu, gu),
|
|
2594
|
+
send: zu,
|
|
2595
|
+
last: xu,
|
|
2596
|
+
navigatingReplyId: pc,
|
|
2597
|
+
draft: Bu
|
|
2597
2598
|
}), [
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
]),
|
|
2599
|
+
Lu,
|
|
2600
|
+
gu,
|
|
2601
|
+
zu,
|
|
2602
|
+
xu,
|
|
2603
|
+
pc,
|
|
2604
|
+
Bu
|
|
2605
|
+
]), Hu = q.setReplyEscape, Uu = J && Pu && Cu;
|
|
2605
2606
|
O(() => {
|
|
2606
|
-
if (
|
|
2607
|
+
if (Hu && Uu) return Hu(Js), () => Hu(null);
|
|
2607
2608
|
}, [
|
|
2608
|
-
Vu,
|
|
2609
2609
|
Hu,
|
|
2610
|
-
|
|
2610
|
+
Uu,
|
|
2611
|
+
Js
|
|
2611
2612
|
]), O(() => {
|
|
2612
|
-
let e =
|
|
2613
|
+
let e = fs.current, t = xr(e), n = w.getState(), r = _r({
|
|
2613
2614
|
sessionLive: $.active,
|
|
2614
2615
|
bound: e,
|
|
2615
2616
|
activeConversationId: n.activeConversationId,
|
|
2616
2617
|
boundConversationExists: n.conversations.some((e) => e.id === t)
|
|
2617
2618
|
});
|
|
2618
|
-
|
|
2619
|
+
_s(r.bound), r.end && $.end();
|
|
2619
2620
|
}, [
|
|
2620
2621
|
$,
|
|
2621
2622
|
H,
|
|
2622
|
-
|
|
2623
|
-
|
|
2623
|
+
Qa,
|
|
2624
|
+
_s
|
|
2624
2625
|
]), O(() => {
|
|
2625
|
-
let e =
|
|
2626
|
+
let e = gr(Sr.read(), {
|
|
2626
2627
|
activeConversationId: H,
|
|
2627
|
-
chatTurnCount:
|
|
2628
|
-
voiceTurnCount:
|
|
2628
|
+
chatTurnCount: Qc.length,
|
|
2629
|
+
voiceTurnCount: dl.length,
|
|
2629
2630
|
sessionLive: $.active,
|
|
2630
|
-
sessionBoundTo:
|
|
2631
|
-
turnInFlight:
|
|
2631
|
+
sessionBoundTo: fs.current,
|
|
2632
|
+
turnInFlight: So
|
|
2632
2633
|
});
|
|
2633
|
-
|
|
2634
|
+
Sr.write(e.state), e.open && ds(!0);
|
|
2634
2635
|
}, [
|
|
2635
2636
|
H,
|
|
2636
|
-
|
|
2637
|
-
|
|
2637
|
+
Qc.length,
|
|
2638
|
+
dl.length,
|
|
2638
2639
|
$.active,
|
|
2639
|
-
|
|
2640
|
-
|
|
2640
|
+
So,
|
|
2641
|
+
ds
|
|
2641
2642
|
]), O(() => {
|
|
2642
2643
|
if (!$.active) {
|
|
2643
|
-
|
|
2644
|
-
for (let e of
|
|
2645
|
-
|
|
2644
|
+
ml.current.clear(), gl(null), Bs.current = null;
|
|
2645
|
+
for (let e of vl.current) window.clearInterval(e);
|
|
2646
|
+
vl.current.clear();
|
|
2646
2647
|
}
|
|
2647
2648
|
}, [$.active]), O(() => {
|
|
2648
|
-
let e =
|
|
2649
|
+
let e = vl.current;
|
|
2649
2650
|
return () => {
|
|
2650
2651
|
for (let t of e) window.clearInterval(t);
|
|
2651
2652
|
e.clear();
|
|
2652
2653
|
};
|
|
2653
2654
|
}, []), O(() => {
|
|
2654
2655
|
let e = w.getState().consumePendingPrompt();
|
|
2655
|
-
return e &&
|
|
2656
|
+
return e && Yc.current(e), w.subscribe((e, t) => {
|
|
2656
2657
|
if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
|
|
2657
2658
|
let e = w.getState().consumePendingPrompt();
|
|
2658
|
-
e &&
|
|
2659
|
+
e && Yc.current(e);
|
|
2659
2660
|
}
|
|
2660
2661
|
});
|
|
2661
2662
|
}, []);
|
|
2662
|
-
let
|
|
2663
|
+
let Wu = D((e) => {
|
|
2663
2664
|
let t = H ? w.getState().conversations.find((e) => e.id === H) : void 0;
|
|
2664
|
-
if (t && t.mode !== e && K.withdraw(t.id, "mode_switched"), t &&
|
|
2665
|
+
if (t && t.mode !== e && K.withdraw(t.id, "mode_switched"), t && Bi(t)) {
|
|
2665
2666
|
if (t.mode !== e) {
|
|
2666
|
-
let t =
|
|
2667
|
-
n ?
|
|
2667
|
+
let t = qi(), n = w.getState().conversations.find((n) => n.mode === e && Ui(n, t) && !w.getState().processingByConversationId[n.id]);
|
|
2668
|
+
n ? no(n.id) : ro(void 0, e);
|
|
2668
2669
|
}
|
|
2669
|
-
} else H &&
|
|
2670
|
+
} else H && to(H, e);
|
|
2670
2671
|
let n = w.getState().activeConversationId;
|
|
2671
|
-
n ?
|
|
2672
|
+
n ? to(n, e) : _o(!1), eo(e);
|
|
2672
2673
|
}, [
|
|
2673
2674
|
H,
|
|
2675
|
+
ro,
|
|
2674
2676
|
no,
|
|
2677
|
+
_o,
|
|
2675
2678
|
to,
|
|
2676
|
-
go,
|
|
2677
2679
|
eo,
|
|
2678
|
-
$a,
|
|
2679
2680
|
K
|
|
2680
|
-
]),
|
|
2681
|
+
]), Gu = D(() => {
|
|
2681
2682
|
let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
|
|
2682
2683
|
if (!t) {
|
|
2683
|
-
|
|
2684
|
+
_o(!0), eo(b);
|
|
2684
2685
|
return;
|
|
2685
2686
|
}
|
|
2686
2687
|
if (t.routedBy === "auto") {
|
|
2687
|
-
|
|
2688
|
+
_o(!0);
|
|
2688
2689
|
return;
|
|
2689
2690
|
}
|
|
2690
|
-
if (!
|
|
2691
|
-
|
|
2691
|
+
if (!Bi(t)) {
|
|
2692
|
+
vo(t.id, b);
|
|
2692
2693
|
return;
|
|
2693
2694
|
}
|
|
2694
2695
|
K.withdraw(t.id, "mode_switched");
|
|
2695
|
-
let n =
|
|
2696
|
-
r ? (
|
|
2696
|
+
let n = qi(), r = e.conversations.find((t) => t.routedBy === "auto" && Ui(t, n) && !e.processingByConversationId[t.id]);
|
|
2697
|
+
r ? (no(r.id), vo(r.id, b)) : ro(void 0, b, { routedBy: "auto" });
|
|
2697
2698
|
}, [
|
|
2699
|
+
ro,
|
|
2700
|
+
vo,
|
|
2698
2701
|
no,
|
|
2699
2702
|
_o,
|
|
2700
|
-
|
|
2701
|
-
go,
|
|
2702
|
-
$a,
|
|
2703
|
+
eo,
|
|
2703
2704
|
K
|
|
2704
|
-
]),
|
|
2705
|
-
R.find((t) => t.id === e)?.writeCapable && !Jn(w.getState().acknowledgedWriteModes, e) ?
|
|
2706
|
-
}, [
|
|
2707
|
-
let e =
|
|
2708
|
-
if (
|
|
2709
|
-
let t =
|
|
2710
|
-
|
|
2705
|
+
]), Ku = D((e) => {
|
|
2706
|
+
R.find((t) => t.id === e)?.writeCapable && !Jn(w.getState().acknowledgedWriteModes, e) ? is(e) : Wu(e);
|
|
2707
|
+
}, [Wu, R]), qu = D(() => {
|
|
2708
|
+
let e = rs;
|
|
2709
|
+
if (is(null), !e) return;
|
|
2710
|
+
let t = Qo.current;
|
|
2711
|
+
Qo.current = null, t ? (ho(e), Q(t.content, t.attachments, t.options)) : (ho(e), Wu(e));
|
|
2711
2712
|
}, [
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2713
|
+
rs,
|
|
2714
|
+
ho,
|
|
2715
|
+
Wu,
|
|
2715
2716
|
Q
|
|
2716
|
-
]),
|
|
2717
|
-
|
|
2718
|
-
let e =
|
|
2719
|
-
|
|
2717
|
+
]), Ju = rs === null ? void 0 : R.find((e) => e.id === rs) ?? { id: rs }, Yu = D(() => {
|
|
2718
|
+
is(null);
|
|
2719
|
+
let e = Qo.current;
|
|
2720
|
+
Qo.current = null, e && Q(e.content, e.attachments, {
|
|
2720
2721
|
...e.options,
|
|
2721
2722
|
autoIntent: "read"
|
|
2722
2723
|
});
|
|
2723
|
-
}, [Q]),
|
|
2724
|
-
let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0, n =
|
|
2724
|
+
}, [Q]), Xu = D(() => Hs(), [Hs]), [Zu, Qu] = j(null), $u = D(() => {
|
|
2725
|
+
let e = w.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0, n = Ps.current;
|
|
2725
2726
|
return {
|
|
2726
2727
|
state: e,
|
|
2727
2728
|
conversation: t ? {
|
|
2728
2729
|
mode: t.mode,
|
|
2729
|
-
hasHistory:
|
|
2730
|
+
hasHistory: Bi(t),
|
|
2730
2731
|
routedByAuto: t.routedBy === "auto"
|
|
2731
2732
|
} : null,
|
|
2732
2733
|
waitingCount: t ? K.liveFor(t.id).count : 0,
|
|
2733
2734
|
hasDraft: n !== null && (n.text.trim() !== "" || n.hasAttachments)
|
|
2734
2735
|
};
|
|
2735
|
-
}, [K]),
|
|
2736
|
-
if (
|
|
2737
|
-
let { state: t, conversation: n, waitingCount: r, hasDraft: i } =
|
|
2736
|
+
}, [K]), ed = Xo ? P("modeSelector.auto", "Auto") : void 0, td = D((e) => {
|
|
2737
|
+
if (rs !== null) return;
|
|
2738
|
+
let { state: t, conversation: n, waitingCount: r, hasDraft: i } = $u(), a = R.find((t) => t.id === e), o = Ae({
|
|
2738
2739
|
target: {
|
|
2739
2740
|
kind: "mode",
|
|
2740
2741
|
mode: e,
|
|
@@ -2744,7 +2745,7 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
2744
2745
|
waitingCount: r,
|
|
2745
2746
|
hasDraft: i
|
|
2746
2747
|
});
|
|
2747
|
-
o.needsDialog ?
|
|
2748
|
+
o.needsDialog ? Qu({
|
|
2748
2749
|
open: !0,
|
|
2749
2750
|
target: {
|
|
2750
2751
|
kind: "mode",
|
|
@@ -2752,116 +2753,116 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
2752
2753
|
},
|
|
2753
2754
|
plan: o,
|
|
2754
2755
|
targetName: we(P, a ?? { id: e }),
|
|
2755
|
-
currentName:
|
|
2756
|
-
}) :
|
|
2756
|
+
currentName: ed
|
|
2757
|
+
}) : Wu(e);
|
|
2757
2758
|
}, [
|
|
2759
|
+
ed,
|
|
2758
2760
|
$u,
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
Uu,
|
|
2761
|
+
rs,
|
|
2762
|
+
Wu,
|
|
2762
2763
|
R,
|
|
2763
2764
|
P
|
|
2764
|
-
]),
|
|
2765
|
-
if (
|
|
2766
|
-
let { conversation: e, waitingCount: t, hasDraft: n } =
|
|
2765
|
+
]), nd = D(() => {
|
|
2766
|
+
if (rs !== null) return;
|
|
2767
|
+
let { conversation: e, waitingCount: t, hasDraft: n } = $u(), r = Ae({
|
|
2767
2768
|
target: { kind: "auto" },
|
|
2768
2769
|
conversation: e,
|
|
2769
2770
|
waitingCount: t,
|
|
2770
2771
|
hasDraft: n
|
|
2771
2772
|
});
|
|
2772
|
-
r.needsDialog ?
|
|
2773
|
+
r.needsDialog ? Qu({
|
|
2773
2774
|
open: !0,
|
|
2774
2775
|
target: { kind: "auto" },
|
|
2775
2776
|
plan: r,
|
|
2776
2777
|
targetName: P("modeSelector.auto", "Auto")
|
|
2777
|
-
}) :
|
|
2778
|
+
}) : Gu();
|
|
2778
2779
|
}, [
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2780
|
+
Gu,
|
|
2781
|
+
$u,
|
|
2782
|
+
rs,
|
|
2782
2783
|
P
|
|
2783
|
-
]),
|
|
2784
|
-
let e =
|
|
2785
|
-
e?.open && (
|
|
2784
|
+
]), rd = D(() => {
|
|
2785
|
+
let e = Zu;
|
|
2786
|
+
e?.open && (Qu({
|
|
2786
2787
|
...e,
|
|
2787
2788
|
open: !1
|
|
2788
|
-
}), e.target.kind === "auto" ?
|
|
2789
|
+
}), e.target.kind === "auto" ? Gu() : (e.plan.consent && ho(e.target.mode), Wu(e.target.mode)));
|
|
2789
2790
|
}, [
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
]),
|
|
2795
|
-
|
|
2791
|
+
ho,
|
|
2792
|
+
Gu,
|
|
2793
|
+
Zu,
|
|
2794
|
+
Wu
|
|
2795
|
+
]), id = D(() => {
|
|
2796
|
+
Qu((e) => e && {
|
|
2796
2797
|
...e,
|
|
2797
2798
|
open: !1
|
|
2798
2799
|
});
|
|
2799
|
-
}, []),
|
|
2800
|
-
consent:
|
|
2801
|
-
withdrawnCount:
|
|
2802
|
-
movesToNewConversation:
|
|
2803
|
-
draftKept:
|
|
2804
|
-
targetName:
|
|
2805
|
-
...
|
|
2806
|
-
} : void 0,
|
|
2800
|
+
}, []), ad = Zu ? {
|
|
2801
|
+
consent: Zu.plan.consent,
|
|
2802
|
+
withdrawnCount: Zu.plan.withdrawnCount,
|
|
2803
|
+
movesToNewConversation: Zu.plan.movesToNewConversation,
|
|
2804
|
+
draftKept: Zu.plan.draftKept,
|
|
2805
|
+
targetName: Zu.targetName,
|
|
2806
|
+
...Zu.currentName === void 0 ? {} : { currentName: Zu.currentName }
|
|
2807
|
+
} : void 0, od = Zu?.target.kind === "mode" ? Zu.target.mode : null, sd = od === null ? void 0 : R.find((e) => e.id === od) ?? { id: od }, cd = A(null), ld = k(() => {
|
|
2807
2808
|
if (!F) return 0;
|
|
2808
|
-
let e = new Set(
|
|
2809
|
-
return Oe(
|
|
2809
|
+
let e = new Set($c.flatMap((e) => ae(e.metadata).map((e) => e.proposalId)));
|
|
2810
|
+
return Oe(Eo, H, Do, e);
|
|
2810
2811
|
}, [
|
|
2811
2812
|
F,
|
|
2812
|
-
|
|
2813
|
+
$c,
|
|
2813
2814
|
H,
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
]),
|
|
2817
|
-
ke(
|
|
2818
|
-
}, []),
|
|
2819
|
-
ref:
|
|
2815
|
+
Eo,
|
|
2816
|
+
Do
|
|
2817
|
+
]), ud = D(() => {
|
|
2818
|
+
ke(cd.current);
|
|
2819
|
+
}, []), dd = I && ka && $c.length === 0 && !No && !Po && !G?.sync?.hasOlder, fd = dd ? /* @__PURE__ */ M("div", {
|
|
2820
|
+
ref: Aa,
|
|
2820
2821
|
className: "w-full shrink-0",
|
|
2821
2822
|
"data-testid": "assistant-page-start-above"
|
|
2822
|
-
}) :
|
|
2823
|
-
state:
|
|
2824
|
-
onRetry:
|
|
2825
|
-
}) :
|
|
2823
|
+
}) : $c.length === 0 && (No || Po) ? /* @__PURE__ */ M(_e, {
|
|
2824
|
+
state: No ? "loading" : "failed",
|
|
2825
|
+
onRetry: Wo
|
|
2826
|
+
}) : $c.length === 0 && G?.sync?.hasOlder ? /* @__PURE__ */ M("div", {
|
|
2826
2827
|
className: "flex min-h-0 flex-1 flex-col",
|
|
2827
2828
|
children: /* @__PURE__ */ M(S, {
|
|
2828
|
-
onShowEarlier:
|
|
2829
|
-
disabled:
|
|
2829
|
+
onShowEarlier: Go,
|
|
2830
|
+
disabled: No
|
|
2830
2831
|
})
|
|
2831
|
-
}) :
|
|
2832
|
+
}) : $c.length === 0 ? /* @__PURE__ */ M(me, {
|
|
2832
2833
|
mode: U,
|
|
2833
|
-
onSuggestionClick:
|
|
2834
|
-
explainsAuto:
|
|
2835
|
-
suggestions:
|
|
2836
|
-
}) : /* @__PURE__ */
|
|
2834
|
+
onSuggestionClick: Kc,
|
|
2835
|
+
explainsAuto: Xo,
|
|
2836
|
+
suggestions: Xo && U === "assistant" ? le(R.find((e) => e.id === "assistant")?.suggestions ?? [], R.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
|
|
2837
|
+
}) : /* @__PURE__ */ sa("div", {
|
|
2837
2838
|
className: "flex min-h-0 flex-1 flex-col",
|
|
2838
2839
|
children: [G?.sync?.hasOlder ? /* @__PURE__ */ M(S, {
|
|
2839
|
-
onShowEarlier:
|
|
2840
|
-
disabled:
|
|
2840
|
+
onShowEarlier: Go,
|
|
2841
|
+
disabled: No
|
|
2841
2842
|
}) : null, /* @__PURE__ */ M(c, {
|
|
2842
|
-
onApprovePendingWrite:
|
|
2843
|
-
approvingWriteRef:
|
|
2844
|
-
approvableMessageId:
|
|
2845
|
-
retryableMessageId:
|
|
2846
|
-
messages:
|
|
2847
|
-
decorate: I ?
|
|
2848
|
-
processing:
|
|
2849
|
-
streamingMessageId:
|
|
2850
|
-
failedMessageId:
|
|
2851
|
-
onRetry:
|
|
2852
|
-
renderWriteProposals:
|
|
2853
|
-
hidesLegacyWriteCard:
|
|
2854
|
-
renderUiOffers:
|
|
2855
|
-
onStopTurn: F ? void 0 :
|
|
2856
|
-
stopTurnLabel: F ? void 0 :
|
|
2843
|
+
onApprovePendingWrite: Ws,
|
|
2844
|
+
approvingWriteRef: Is,
|
|
2845
|
+
approvableMessageId: rl?.messageId ?? null,
|
|
2846
|
+
retryableMessageId: il,
|
|
2847
|
+
messages: $c,
|
|
2848
|
+
decorate: I ? fu : void 0,
|
|
2849
|
+
processing: xo ?? null,
|
|
2850
|
+
streamingMessageId: Co,
|
|
2851
|
+
failedMessageId: wo,
|
|
2852
|
+
onRetry: Is === null ? Jc : void 0,
|
|
2853
|
+
renderWriteProposals: ol,
|
|
2854
|
+
hidesLegacyWriteCard: al,
|
|
2855
|
+
renderUiOffers: cl,
|
|
2856
|
+
onStopTurn: F ? void 0 : Xu,
|
|
2857
|
+
stopTurnLabel: F ? void 0 : Oa
|
|
2857
2858
|
})]
|
|
2858
2859
|
});
|
|
2859
|
-
return /* @__PURE__ */
|
|
2860
|
-
ref:
|
|
2860
|
+
return /* @__PURE__ */ sa("div", {
|
|
2861
|
+
ref: cd,
|
|
2861
2862
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
2862
|
-
style:
|
|
2863
|
+
style: dd ? va : void 0,
|
|
2863
2864
|
children: [
|
|
2864
|
-
/* @__PURE__ */
|
|
2865
|
+
/* @__PURE__ */ sa("div", {
|
|
2865
2866
|
className: "contents",
|
|
2866
2867
|
inert: $.active && !I || J || void 0,
|
|
2867
2868
|
...q.ids ? F ? { id: q.ids.chatPanel } : {
|
|
@@ -2870,123 +2871,123 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
2870
2871
|
"aria-labelledby": q.ids.chatTab
|
|
2871
2872
|
} : {},
|
|
2872
2873
|
children: [
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
count:
|
|
2876
|
-
onOpenTranscript: () =>
|
|
2874
|
+
Ro === null ? null : /* @__PURE__ */ M(ge, { onDismiss: () => Lo(Ro) }),
|
|
2875
|
+
dl.length > 0 && !$.active && !I ? /* @__PURE__ */ M(he, {
|
|
2876
|
+
count: dl.length,
|
|
2877
|
+
onOpenTranscript: () => ds(!0)
|
|
2877
2878
|
}) : null,
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2879
|
+
fd,
|
|
2880
|
+
jo ? /* @__PURE__ */ M(ve, { onStartNew: () => ro() }) : null,
|
|
2881
|
+
Mo && H ? /* @__PURE__ */ M(x, { onUnarchive: () => zi.updateConversation(H, { archived: !1 }) }) : null,
|
|
2882
|
+
Bc === null ? null : /* @__PURE__ */ M(ye, {
|
|
2882
2883
|
tr: P,
|
|
2883
|
-
onDismiss: () =>
|
|
2884
|
+
onDismiss: () => Vc(null)
|
|
2884
2885
|
}),
|
|
2885
|
-
|
|
2886
|
-
state:
|
|
2887
|
-
onRetry:
|
|
2886
|
+
$c.length > 0 && (No || Po) ? /* @__PURE__ */ M(_e, {
|
|
2887
|
+
state: No ? "loading" : "failed",
|
|
2888
|
+
onRetry: Wo,
|
|
2888
2889
|
compact: !0
|
|
2889
2890
|
}) : null,
|
|
2890
2891
|
/* @__PURE__ */ M(Ce, {
|
|
2891
|
-
onStartVoiceSession: $.available &&
|
|
2892
|
+
onStartVoiceSession: $.available && Os ? Wl : void 0,
|
|
2892
2893
|
onSend: (e, t) => {
|
|
2893
|
-
let n =
|
|
2894
|
+
let n = ta.getState().actions.take();
|
|
2894
2895
|
Q(e, t, {
|
|
2895
2896
|
fromPerson: !0,
|
|
2896
2897
|
...n ? { focus: n } : {}
|
|
2897
2898
|
});
|
|
2898
2899
|
},
|
|
2899
|
-
onDraftChange:
|
|
2900
|
-
inputRef: F ?
|
|
2901
|
-
viewSwitch: F && !I && q.ids && q.compact && !
|
|
2900
|
+
onDraftChange: Pc,
|
|
2901
|
+
inputRef: F ? Sa : void 0,
|
|
2902
|
+
viewSwitch: F && !I && q.ids && q.compact && !Nu ? /* @__PURE__ */ M(Le, {
|
|
2902
2903
|
selected: q.compact.view,
|
|
2903
2904
|
onSelect: q.compact.selectView,
|
|
2904
2905
|
ids: q.ids,
|
|
2905
2906
|
instance: "chat"
|
|
2906
2907
|
}) : void 0,
|
|
2907
|
-
aboveCard:
|
|
2908
|
-
count:
|
|
2909
|
-
onReview:
|
|
2910
|
-
opensFull:
|
|
2908
|
+
aboveCard: ld > 0 ? /* @__PURE__ */ M(Ee, {
|
|
2909
|
+
count: ld,
|
|
2910
|
+
onReview: Ma && Ea ? yu : ud,
|
|
2911
|
+
opensFull: Ma && Ea !== void 0
|
|
2911
2912
|
}) : void 0,
|
|
2912
|
-
disabled:
|
|
2913
|
-
readOnly:
|
|
2913
|
+
disabled: So || Is !== null || No || dc,
|
|
2914
|
+
readOnly: jo,
|
|
2914
2915
|
placeholder: U === "api-calls" ? P("chatArea.placeholderActions", "What would you like me to do?") : P("chatArea.placeholderGeneral", "Ask me anything…"),
|
|
2915
2916
|
mode: U,
|
|
2916
|
-
writeAccessDenied:
|
|
2917
|
-
availableModes:
|
|
2918
|
-
attachmentCharsPerFile:
|
|
2919
|
-
onModeChange: F ?
|
|
2920
|
-
auto:
|
|
2921
|
-
active:
|
|
2922
|
-
onSelect: F ?
|
|
2917
|
+
writeAccessDenied: ba === "denied" && !!Ts?.writeCapable,
|
|
2918
|
+
availableModes: Jo,
|
|
2919
|
+
attachmentCharsPerFile: ns,
|
|
2920
|
+
onModeChange: F ? td : Ku,
|
|
2921
|
+
auto: Yo ? {
|
|
2922
|
+
active: Xo,
|
|
2923
|
+
onSelect: F ? nd : Gu
|
|
2923
2924
|
} : void 0,
|
|
2924
|
-
suspendDictation: J || F && !
|
|
2925
|
-
onVoiceStateChange: q.ids ||
|
|
2926
|
-
modeReadOnly:
|
|
2925
|
+
suspendDictation: J || F && !ya,
|
|
2926
|
+
onVoiceStateChange: q.ids || Ma ? hu : void 0,
|
|
2927
|
+
modeReadOnly: Ma || void 0,
|
|
2927
2928
|
voiceSessionActive: F ? $.active : void 0,
|
|
2928
2929
|
concealed: I && $.active,
|
|
2929
|
-
presentation:
|
|
2930
|
-
turnInFlight:
|
|
2931
|
-
turnId:
|
|
2932
|
-
onStop: F ?
|
|
2933
|
-
modeDisabledReason:
|
|
2930
|
+
presentation: xa,
|
|
2931
|
+
turnInFlight: So,
|
|
2932
|
+
turnId: So ? xo?.messageId ?? null : null,
|
|
2933
|
+
onStop: F ? Xu : void 0,
|
|
2934
|
+
modeDisabledReason: So ? "replying" : "busy"
|
|
2934
2935
|
}),
|
|
2935
|
-
I ? /* @__PURE__ */ oa
|
|
2936
|
-
ref:
|
|
2936
|
+
I ? /* @__PURE__ */ sa(oa, { children: [dd && !$.active ? /* @__PURE__ */ M("div", {
|
|
2937
|
+
ref: ja,
|
|
2937
2938
|
className: "w-full shrink-0",
|
|
2938
2939
|
"data-testid": "assistant-page-start-below"
|
|
2939
2940
|
}) : null, /* @__PURE__ */ M("div", {
|
|
2940
|
-
ref:
|
|
2941
|
+
ref: tl,
|
|
2941
2942
|
className: "contents",
|
|
2942
2943
|
"data-testid": "assistant-page-voice-slot"
|
|
2943
2944
|
})] }) : null,
|
|
2944
2945
|
F ? /* @__PURE__ */ M(Me, { children: /* @__PURE__ */ M(Ne, {
|
|
2945
2946
|
productKey: L,
|
|
2946
|
-
enabled: !!
|
|
2947
|
+
enabled: !!Ia,
|
|
2947
2948
|
testId: "assistant-ai-credit-balance"
|
|
2948
|
-
}) }) : /* @__PURE__ */ oa
|
|
2949
|
+
}) }) : /* @__PURE__ */ sa(oa, { children: [/* @__PURE__ */ M(Ne, {
|
|
2949
2950
|
productKey: L,
|
|
2950
|
-
enabled: !!
|
|
2951
|
+
enabled: !!Ia,
|
|
2951
2952
|
className: "px-3 pt-1 text-center",
|
|
2952
2953
|
testId: "assistant-ai-credit-balance"
|
|
2953
2954
|
}), /* @__PURE__ */ M(je, { className: "px-3 pb-2 pt-1" })] })
|
|
2954
2955
|
]
|
|
2955
2956
|
}),
|
|
2956
|
-
|
|
2957
|
-
turns:
|
|
2958
|
-
onClose: () =>
|
|
2959
|
-
onSave:
|
|
2960
|
-
onContinueInChat:
|
|
2957
|
+
ss && !$.active ? /* @__PURE__ */ M(Se, {
|
|
2958
|
+
turns: dl,
|
|
2959
|
+
onClose: () => ds(!1),
|
|
2960
|
+
onSave: fl,
|
|
2961
|
+
onContinueInChat: ql ? Jl : void 0,
|
|
2961
2962
|
closeOnEscape: !0,
|
|
2962
|
-
onShowEarlier: G?.sync?.hasOlder ?
|
|
2963
|
-
showEarlierDisabled:
|
|
2964
|
-
renderAfterTurn:
|
|
2963
|
+
onShowEarlier: G?.sync?.hasOlder ? Go : void 0,
|
|
2964
|
+
showEarlierDisabled: No,
|
|
2965
|
+
renderAfterTurn: sl
|
|
2965
2966
|
}) : null,
|
|
2966
|
-
|
|
2967
|
+
Nu && q.ids && q.compact ? /* @__PURE__ */ M(Re, {
|
|
2967
2968
|
ids: q.ids,
|
|
2968
2969
|
compact: q.compact
|
|
2969
|
-
}) : J &&
|
|
2970
|
-
tab:
|
|
2971
|
-
CompactView:
|
|
2970
|
+
}) : J && cs && q.ids ? F && q.compact && cs.CompactView ? /* @__PURE__ */ M(Ie, {
|
|
2971
|
+
tab: cs,
|
|
2972
|
+
CompactView: cs.CompactView,
|
|
2972
2973
|
ids: q.ids,
|
|
2973
2974
|
compact: q.compact,
|
|
2974
|
-
shown:
|
|
2975
|
-
voice:
|
|
2975
|
+
shown: Pu,
|
|
2976
|
+
voice: Du,
|
|
2976
2977
|
...$.active ? { mute: {
|
|
2977
2978
|
muted: $.session.muted,
|
|
2978
2979
|
toggle: $.toggleMute
|
|
2979
2980
|
} } : {},
|
|
2980
|
-
...
|
|
2981
|
+
...Fu ? { ask: Vu } : {},
|
|
2981
2982
|
footer: /* @__PURE__ */ M(Me, {})
|
|
2982
2983
|
}) : /* @__PURE__ */ M(Fe, {
|
|
2983
|
-
tab:
|
|
2984
|
+
tab: cs,
|
|
2984
2985
|
id: q.ids.avatarPanel,
|
|
2985
2986
|
labelledBy: q.ids.avatarTab,
|
|
2986
2987
|
leaveHintId: q.ids.leaveHint,
|
|
2987
|
-
shown:
|
|
2988
|
-
voice:
|
|
2989
|
-
...
|
|
2988
|
+
shown: Pu,
|
|
2989
|
+
voice: Du,
|
|
2990
|
+
...Fu ? { ask: Vu } : {}
|
|
2990
2991
|
}) : null,
|
|
2991
2992
|
$.active && /* @__PURE__ */ M(Pe, {
|
|
2992
2993
|
session: $.session,
|
|
@@ -3000,66 +3001,66 @@ var ha = () => () => {}, ga = () => "off", _a = { overflowY: "auto" }, va = ({ v
|
|
|
3000
3001
|
correcting: $.correcting,
|
|
3001
3002
|
onLetMeFinish: $.letMeFinish,
|
|
3002
3003
|
onImDone: $.imDone,
|
|
3003
|
-
turns:
|
|
3004
|
+
turns: Sl,
|
|
3004
3005
|
spokenChunks: $.spokenChunks,
|
|
3005
|
-
attachments:
|
|
3006
|
-
onAttachFiles:
|
|
3007
|
-
onRemoveAttachment:
|
|
3008
|
-
onRetryAttachment:
|
|
3009
|
-
canAttachMore:
|
|
3010
|
-
preparingAttachments:
|
|
3011
|
-
attachmentsLocked:
|
|
3012
|
-
attachmentNotice:
|
|
3013
|
-
onSaveTranscript:
|
|
3014
|
-
onContinueInChat:
|
|
3006
|
+
attachments: pl.attachments,
|
|
3007
|
+
onAttachFiles: pl.addFiles,
|
|
3008
|
+
onRemoveAttachment: pl.remove,
|
|
3009
|
+
onRetryAttachment: pl.retry,
|
|
3010
|
+
canAttachMore: pl.canAddMore,
|
|
3011
|
+
preparingAttachments: pl.preparingCount,
|
|
3012
|
+
attachmentsLocked: pl.isCommitting,
|
|
3013
|
+
attachmentNotice: _l,
|
|
3014
|
+
onSaveTranscript: fl,
|
|
3015
|
+
onContinueInChat: Jl,
|
|
3015
3016
|
onInterrupt: () => {
|
|
3016
|
-
|
|
3017
|
+
du(), $.interrupt(), Hs();
|
|
3017
3018
|
},
|
|
3018
|
-
spoken:
|
|
3019
|
+
spoken: Zc,
|
|
3019
3020
|
onToggleMute: $.toggleMute,
|
|
3020
|
-
onEnd:
|
|
3021
|
-
proposalChip:
|
|
3021
|
+
onEnd: pu,
|
|
3022
|
+
proposalChip: Al ? Ma && Ea ? {
|
|
3022
3023
|
label: P("waitingChange.reviewInFull", "Review in full assistant"),
|
|
3023
|
-
status: te(
|
|
3024
|
-
onOpen:
|
|
3024
|
+
status: te(Al, P),
|
|
3025
|
+
onOpen: Ea
|
|
3025
3026
|
} : {
|
|
3026
|
-
label: te(
|
|
3027
|
-
onOpen:
|
|
3027
|
+
label: te(Al, P),
|
|
3028
|
+
onOpen: kl
|
|
3028
3029
|
} : null,
|
|
3029
|
-
proposalTray:
|
|
3030
|
-
renderAfterTurn:
|
|
3031
|
-
onViewChange: q.ids ?
|
|
3032
|
-
...
|
|
3030
|
+
proposalTray: Ma ? null : Ml,
|
|
3031
|
+
renderAfterTurn: sl,
|
|
3032
|
+
onViewChange: q.ids ? ku : void 0,
|
|
3033
|
+
...Ma ? { view: J || Au ? "mini" : "compact" } : I ? {
|
|
3033
3034
|
view: "page",
|
|
3034
|
-
pageSlot:
|
|
3035
|
+
pageSlot: el
|
|
3035
3036
|
} : {},
|
|
3036
|
-
startedCue: F ?
|
|
3037
|
+
startedCue: F ? hs ? P("window.voiceStartedCue", "Started a voice conversation. Your chat is in History.") : null : void 0
|
|
3037
3038
|
}),
|
|
3038
3039
|
/* @__PURE__ */ M(l, {
|
|
3039
|
-
open:
|
|
3040
|
-
mode:
|
|
3041
|
-
currentMode:
|
|
3042
|
-
onConfirm:
|
|
3043
|
-
onCancel:
|
|
3040
|
+
open: rs !== null,
|
|
3041
|
+
mode: Ju,
|
|
3042
|
+
currentMode: Ts ?? { id: U },
|
|
3043
|
+
onConfirm: qu,
|
|
3044
|
+
onCancel: Yu
|
|
3044
3045
|
}),
|
|
3045
3046
|
F ? /* @__PURE__ */ M(l, {
|
|
3046
|
-
open:
|
|
3047
|
-
mode:
|
|
3048
|
-
currentMode:
|
|
3049
|
-
switchPlan:
|
|
3050
|
-
onConfirm:
|
|
3051
|
-
onCancel:
|
|
3047
|
+
open: Zu?.open === !0,
|
|
3048
|
+
mode: sd,
|
|
3049
|
+
currentMode: Ts ?? { id: U },
|
|
3050
|
+
switchPlan: ad,
|
|
3051
|
+
onConfirm: rd,
|
|
3052
|
+
onCancel: id
|
|
3052
3053
|
}) : null,
|
|
3053
3054
|
/* @__PURE__ */ M(u, {
|
|
3054
|
-
...
|
|
3055
|
-
view:
|
|
3056
|
-
serverNow:
|
|
3057
|
-
arrivedAt:
|
|
3058
|
-
capabilities:
|
|
3059
|
-
turnInFlight:
|
|
3055
|
+
...Oo.dialog,
|
|
3056
|
+
view: ll?.view ?? Oo.dialog.view,
|
|
3057
|
+
serverNow: ll?.serverNow ?? NaN,
|
|
3058
|
+
arrivedAt: ll?.arrivedAt ?? NaN,
|
|
3059
|
+
capabilities: ll ? To[ll.session.sandboxId] : null,
|
|
3060
|
+
turnInFlight: So,
|
|
3060
3061
|
tr: P
|
|
3061
3062
|
})
|
|
3062
3063
|
]
|
|
3063
3064
|
});
|
|
3064
3065
|
};
|
|
3065
|
-
export {
|
|
3066
|
+
export { ya as AssistantChatArea };
|