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