@burdenoff/fe-libs 2026.1015.1 → 2026.1015.2
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/index.d.ts +1 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +939 -941
- package/dist/shared/assistant/ui/useVoiceSession.d.ts +20 -5
- package/dist/shared/assistant/ui/useVoiceSession.js +11 -4
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +2 -2
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +94 -88
- package/dist/shared/assistant/voice/voiceReply.d.ts +23 -0
- package/dist/shared/assistant/voice/voiceReply.js +13 -0
- package/dist/shared/assistant/voice/voiceSession.d.ts +10 -0
- package/dist/shared/assistant/voice/voiceSession.js +7 -0
- package/dist/shared-assistant.js +247 -246
- package/package.json +1 -1
|
@@ -20,234 +20,235 @@ import { assistantUsageLedger as Me, hasPendingUsageReports as Ne, reportUsageWi
|
|
|
20
20
|
import { withIncompleteTurnNotice as Le } from "../streamBudget.js";
|
|
21
21
|
import { chatTurns as Re, isVoiceTurn as ze, voiceMarker as S, voiceSessionIdOf as C } from "../voice/turnVisibility.js";
|
|
22
22
|
import { speechFeed as Be } from "../speech/speechFeed.js";
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
109
|
-
import {
|
|
110
|
-
import {
|
|
111
|
-
import {
|
|
112
|
-
import {
|
|
23
|
+
import { toVoiceReply as Ve } from "../voice/voiceReply.js";
|
|
24
|
+
import { isTurnSuperseded as He, markTurnSuperseded as Ue } from "../voice/supersededTurns.js";
|
|
25
|
+
import { buildContinuedFromVoiceNote as We, buildVoiceTranscriptMarkdown as Ge, voiceTranscriptFilename as Ke } from "../voice/voiceTranscript.js";
|
|
26
|
+
import { pollDelayMs as qe } from "../voice/assistantPollSchedule.js";
|
|
27
|
+
import { toCaptionText as Je } from "../voice/captionText.js";
|
|
28
|
+
import { resolveAssistantLanguage as Ye } from "../voice/languages.js";
|
|
29
|
+
import { resolveLanguagePair as Xe } from "../voice/languagePair.js";
|
|
30
|
+
import { INITIAL_TRANSCRIPT_AUTO_OPEN as w, isAwaitingOwnConversation as Ze, maySendSpokenTurn as Qe, planTranscriptAutoOpen as $e, planVoiceSessionBinding as et, planVoiceSessionStart as tt, planVoiceSpokenEntry as nt, voiceBindingAtStart as rt, voiceBindingConversationId as it } from "../voice/voiceReopen.js";
|
|
31
|
+
import { countInlineImageCandidates as at, countInlinedImageParts as ot, largestInlineCharsPerFile as st, resolveAssistantInlineLimits as ct, toMessageAttachment as lt } from "../attachments.js";
|
|
32
|
+
import { WRITE_PROPOSAL_VOICE_COPY as ut, isVoiceProposalBound as dt, voiceProposalChip as ft, voiceProposalChipText as pt, voiceReadbacksDue as mt, voiceWaitingProposals as ht, writeProposalVoiceLine as gt, writeProposalVoiceReadback as _t } from "../writeProposalVoice.js";
|
|
33
|
+
import { createAdminModeAccessGate as vt, resolveAssistantSendModeAfterAccess as yt } from "../adminModeSendGate.js";
|
|
34
|
+
import { buildBoundedAttachmentTurn as bt } from "../attachmentTurn.js";
|
|
35
|
+
import { useAvatarCopy as xt } from "../avatar/useAvatarCopy.js";
|
|
36
|
+
import { attachmentUrlIsStale as St, refreshStaleAttachmentUrls as Ct } from "../attachmentCommit.js";
|
|
37
|
+
import { VOICE_COMMIT_BUDGET_MS as wt, settleAndCommitSpokenTurn as Tt } from "../voiceCommit.js";
|
|
38
|
+
import { getOrganizationId as Et, getWorkspaceId as T } from "../context.js";
|
|
39
|
+
import { useAttachmentUrlResolver as Dt } from "../useAttachmentCommitter.js";
|
|
40
|
+
import { isTurnInFlight as Ot, planAbandonedTurn as kt, planTurnAbort as At } from "../turnState.js";
|
|
41
|
+
import { backDoneCopy as jt, chooseDestinationCopy as Mt, chooseLinkedCopy as Nt, entityNounText as Pt, linkNotOpenableCopy as Ft, navigationCommandCopy as It, navigationOutcomeCopy as Lt, offerExpiredCopy as Rt, offerKeptForUnsavedCopy as zt, offerNotAvailableCopy as Bt, pickFromListCopy as Vt, recordChoiceCopy as Ht, recordKindsCopy as Ut, themeCommandCopy as Wt } from "../localUiCommandCopy.js";
|
|
42
|
+
import { appControlCopy as Gt } from "../appControls/copy.js";
|
|
43
|
+
import { LANGUAGE_REPLY_DEADLINE_MS as Kt, languageConfirmationCopy as qt, languageReplyStep as Jt } from "../appControls/languageReply.js";
|
|
44
|
+
import { getAssistantDisplayContent as Yt } from "../displayContent.js";
|
|
45
|
+
import { NO_FIRST_TEXT as Xt, buildAssistantProgress as Zt, readAheadFor as Qt, snapshotReplyFloor as $t, startSessionReadAhead as en, trackFirstText as tn } from "../turnProgress.js";
|
|
46
|
+
import { parseToolActivity as nn } from "./AssistantToolActivity.js";
|
|
47
|
+
import { countSpokenTurns as rn, spokenMessagesSinceContinueNote as an, spokenTurnText as on } from "../spokenTurns.js";
|
|
48
|
+
import { beginTurn as sn, describeTurn as E, detectTurnDevice as cn, markTurn as D, restartAttempt as ln, turnClockMs as un } from "../turnTimeline.js";
|
|
49
|
+
import { useAssistantSpeech as dn } from "./AssistantSpeechProvider.js";
|
|
50
|
+
import { useLiveAvatarTab as fn, useLiveAvatarTabSeam as pn } from "./assistantLiveAvatarSeam.js";
|
|
51
|
+
import { useVoiceSession as mn } from "./useVoiceSession.js";
|
|
52
|
+
import { isMultimodalBodyRejection as hn, isRecoverableAssistantError as gn } from "../transportErrors.js";
|
|
53
|
+
import { createReadinessTracker as _n, planAfterTransportFailure as vn, planTrustedSandboxFailure as yn } from "../sandboxReadiness.js";
|
|
54
|
+
import { writeProposalConfirmState as bn } from "./writeProposalPresentation.js";
|
|
55
|
+
import { writeProposalUsesDialog as xn } from "./AssistantWriteProposalCard.js";
|
|
56
|
+
import { AssistantWriteConfirmDialog as Sn } from "./AssistantWriteConfirmDialog.js";
|
|
57
|
+
import { useWriteProposalConfirm as Cn } from "./useWriteProposalConfirm.js";
|
|
58
|
+
import { AssistantWriteProposalSlot as wn } from "./AssistantWriteProposalSlot.js";
|
|
59
|
+
import { readWriteProposalRefs as Tn, writeProposalsEnabledFor as En } from "../writeProposalDiscovery.js";
|
|
60
|
+
import { planWriteReply as Dn, promptWriteApproval as On } from "../writeReplySend.js";
|
|
61
|
+
import { useWriteProposals as kn } from "./useWriteProposals.js";
|
|
62
|
+
import { AssistantSpokenTurnsNotice as An } from "./AssistantSpokenTurnsNotice.js";
|
|
63
|
+
import { AssistantHistoryArchivedNotice as jn, AssistantHistoryDeletedNotice as Mn, AssistantHistoryLoadState as Nn, AssistantHistoryReadOnlyBanner as Pn, AssistantHistoryShowEarlier as Fn } from "./AssistantHistoryNotices.js";
|
|
64
|
+
import { VoiceTranscriptDrawer as In } from "./voice/VoiceTranscriptDrawer.js";
|
|
65
|
+
import { downloadFile as Ln } from "../exportConversation.js";
|
|
66
|
+
import { conversationHasHistory as Rn, isOtherScopeHistoryConversation as zn, isReadOnlyHistoryConversation as Bn, isReusableHistoryDraft as Vn } from "../history/historyList.js";
|
|
67
|
+
import { useAssistantHistoryStatus as Hn } from "../history/historyStatus.js";
|
|
68
|
+
import { assistantHistory as Un } from "../history/historyEngine.js";
|
|
69
|
+
import { AssistantEmptyState as Wn } from "./AssistantEmptyState.js";
|
|
70
|
+
import { AssistantNothingToDeleteNotice as Gn } from "./AssistantDeleteConversationDialog.js";
|
|
71
|
+
import { assistantHistoryIsOn as Kn } from "./conversationDelete.js";
|
|
72
|
+
import { useConversationDeleteDialog as qn } from "./conversationDeleteDialog.js";
|
|
73
|
+
import { useControlConfirmDialog as Jn } from "./controlConfirmDialog.js";
|
|
74
|
+
import { useLeaveConfirmAsking as Yn } from "./leaveConfirm.js";
|
|
75
|
+
import { startFocusReturnAfterKeep as Xn } from "./leaveConfirmFocus.js";
|
|
76
|
+
import { resolveConversationDeleteTarget as Zn } from "../conversationDeleteCommand.js";
|
|
77
|
+
import { resumeContextFor as Qn } from "../history/historyResume.js";
|
|
78
|
+
import { useHistoryRowControlsFor as $n } from "../history/useHistoryRowControls.js";
|
|
79
|
+
import { liveCoverage as er } from "../liveDeltas.js";
|
|
80
|
+
import { createLiveRender as tr } from "../liveOverlay.js";
|
|
81
|
+
import { AssistantMessageList as nr } from "./AssistantMessageList.js";
|
|
82
|
+
import { AssistantUiOfferLinks as rr } from "./AssistantUiOfferLink.js";
|
|
83
|
+
import { AssistantVoiceSession as ir } from "./voice/AssistantVoiceSession.js";
|
|
84
|
+
import { AssistantAvatarTab as ar } from "./avatar/AssistantAvatarTab.js";
|
|
85
|
+
import { voiceStartBlocker as or, voiceStartBlockerLasts as sr } from "./voice/voiceStartGate.js";
|
|
86
|
+
import { useAssistantApiAccess as cr } from "../useAssistantApiAccess.js";
|
|
87
|
+
import { useConversationTurns as lr } from "../useConversationTurns.js";
|
|
88
|
+
import { openTurnStream as ur, turnStreamAvailable as dr } from "../turnStream.js";
|
|
89
|
+
import { createSnapshotPoller as fr } from "../snapshotPoller.js";
|
|
90
|
+
import { sendAssistantTurnTimings as pr, startTurnTimingReporting as mr } from "../turnTimingReporter.js";
|
|
91
|
+
import { QuarantineSet as hr, WarmCancelled as gr, claimPreopenedSession as _r, consumeWarm as vr, preopenKey as yr, preopenWanted as br, prewarmTarget as xr, settleWarmBeforeSend as Sr, startPreopen as Cr, startWarm as wr, warmState as Tr } from "../prewarm.js";
|
|
92
|
+
import { navEntryIds as Er } from "../uiActions/resolveTarget.js";
|
|
93
|
+
import { lookupNamedRecords as Dr } from "../uiActions/recordNames.js";
|
|
94
|
+
import { isAlreadyThere as Or, matchLocalUiCommand as kr, mayBeNavigationFollowUp as Ar, navDestinations as jr, planThemeChange as Mr } from "../localUiCommands.js";
|
|
95
|
+
import { offerAssentFor as Nr } from "../localeCommands/assent.js";
|
|
96
|
+
import { readControlSnapshot as Pr } from "../appControls/snapshot.js";
|
|
97
|
+
import { runNavigation as Fr } from "../uiActions/navigationOutcome.js";
|
|
98
|
+
import { assistantBackStack as Ir, isBackRunnable as Lr } from "../uiActions/backStack.js";
|
|
99
|
+
import { buildNavigateAction as Rr, destinationForPath as zr, labelForPath as Br, newestAssistantOnSurface as Vr } from "../uiActions/navigateAction.js";
|
|
100
|
+
import { buildNavigationContext as Hr, latestReplyOnSurface as Ur, rememberPresentedList as Wr } from "../uiActions/linkContext.js";
|
|
101
|
+
import { buildUiCatalogue as Gr, markUiCatalogueSent as Kr, uiCatalogueSent as qr, uiCatalogueSessionKey as Jr } from "../uiActions/uiCatalogue.js";
|
|
102
|
+
import { offerYesOnSurface as Yr } from "../uiActions/offerYesOnSurface.js";
|
|
103
|
+
import { parseNavIntent as Xr } from "../uiActions/navIntent.js";
|
|
104
|
+
import { decideActOnResolve as Zr, n4LeaveGuard as Qr } from "../uiActions/actOnResolve.js";
|
|
105
|
+
import { planAppControl as $r } from "../appControls/plan.js";
|
|
106
|
+
import { dispatchAssistantQuotaExhausted as ei, notifyAiCreditsUpdated as ti } from "../aiCredits.js";
|
|
107
|
+
import { useAssistantAttachments as ni } from "../useAssistantAttachments.js";
|
|
108
|
+
import { AssistantComposer as ri } from "./composer/AssistantComposer.js";
|
|
109
|
+
import { isProdRuntime as ii } from "../env.js";
|
|
110
|
+
import { AssistantApiCallsConsentDialog as ai } from "./AssistantApiCallsConsentDialog.js";
|
|
111
|
+
import { useVisibleNavItems as oi } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
|
|
112
|
+
import { useCallback as O, useEffect as k, useLayoutEffect as si, useMemo as A, useRef as j, useState as M, useSyncExternalStore as ci } from "react";
|
|
113
|
+
import { jsx as N, jsxs as li } from "react/jsx-runtime";
|
|
113
114
|
//#region src/shared/assistant/ui/AssistantChatArea.tsx
|
|
114
|
-
var
|
|
115
|
+
var ui = 2500, di = 600, fi = 2e4, pi = 1e4, mi = 1e4, hi = {
|
|
115
116
|
committing: !1,
|
|
116
117
|
dictating: !1
|
|
117
|
-
},
|
|
118
|
+
}, gi = 6e3;
|
|
118
119
|
function P() {
|
|
119
120
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
120
121
|
}
|
|
121
|
-
var
|
|
122
|
-
let F = a(), { product: I, modes: L, gatherPageContext:
|
|
122
|
+
var _i = ({ visible: _i = !0, writeAccess: vi = "unknown" }) => {
|
|
123
|
+
let F = a(), { product: I, modes: L, gatherPageContext: yi, buildPrompt: bi, reportTurnTimings: xi, reportTokenUsage: Si, localUiCommands: Ci } = i(), R = Ce(i().writeApproval), wi = O((e, t) => {
|
|
123
124
|
let n = v.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
|
|
124
|
-
return
|
|
125
|
+
return dt({
|
|
125
126
|
mode: e,
|
|
126
127
|
productWriteApproval: R,
|
|
127
128
|
capabilities: r ? n.sandboxWriteCapabilities[r] : null
|
|
128
129
|
});
|
|
129
|
-
}, [R]), { getAccessToken: z, getWorkspaceToken:
|
|
130
|
-
Ai,
|
|
130
|
+
}, [R]), { getAccessToken: z, getWorkspaceToken: Ti, userId: B } = n(), { locale: V, isLocaleLoading: Ei } = t(), Di = v((e) => e.voiceGraceMs), Oi = v((e) => e.handsFreeInterrupt), ki = v((e) => e.handsFreeStreamNoticeAccepted), Ai = v((e) => e.acceptHandsFreeStreamNotice), ji = v((e) => e.assistantLanguage), Mi = v((e) => e.replyLanguage), Ni = A(() => Xe(ji, Mi, V), [
|
|
131
131
|
ji,
|
|
132
|
+
Mi,
|
|
132
133
|
V
|
|
133
|
-
]),
|
|
134
|
+
]), Pi = Ni.reply.english, Fi = Ni.replyIsExplicit, Ii = Ni.reply.code, { conversations: Li, activeConversationId: H, mode: U, processingByConversationId: Ri, setMode: zi, setConversationMode: Bi, setActiveConversation: Vi, createConversation: Hi, addMessage: W, updateMessage: Ui, patchMessage: Wi, mergeMessageMetadata: Gi, setConversationProcessing: Ki, clearConversationProcessing: qi, setBackendSessionId: Ji, clearBackendSessionId: Yi, setSandbox: Xi, clearSandbox: Zi, acknowledgedWriteModes: Qi, acknowledgeWriteMode: $i, autoRouting: ea, setAutoRouting: ta, routeConversation: na } = v(), ra = Li.find((e) => e.id === H), ia = lr(ra), aa = ia.all, oa = H ? Ri[H] : void 0, sa = Ot(oa?.status), ca = sa ? oa?.messageId ?? null : null, la = oa?.status === "error" ? oa.messageId : null, ua = v((e) => e.sandboxWriteCapabilities), { panel: G, entries: da, retiredSandboxes: fa } = kn({
|
|
134
135
|
tr: F,
|
|
135
136
|
productWriteApproval: R
|
|
136
|
-
}),
|
|
137
|
+
}), pa = Cn({
|
|
137
138
|
approve: (e, t) => G.approve(e, t),
|
|
138
139
|
decline: (e, t, n) => G.decline(e, t, n),
|
|
139
140
|
presented: (e, t) => G.presented(e, t)
|
|
140
|
-
}),
|
|
141
|
+
}), ma = pa.dismiss, ha = j(null);
|
|
141
142
|
k(() => {
|
|
142
|
-
|
|
143
|
-
let e =
|
|
144
|
-
|
|
143
|
+
ma();
|
|
144
|
+
let e = ha.current;
|
|
145
|
+
ha.current = H, e && e !== H && G.withdraw(e, "conversation_closed"), H && G.openConversation(H);
|
|
145
146
|
}, [
|
|
146
147
|
H,
|
|
147
148
|
G,
|
|
148
|
-
|
|
149
|
+
ma
|
|
149
150
|
]);
|
|
150
|
-
let
|
|
151
|
+
let ga = Bn(ra), _a = $n(ra)?.archivedAt != null, va = Hn((e) => H !== null && H in e.loadingIds), ya = Hn((e) => H !== null && H in e.loadErrorIds), ba = Hn((e) => e.remoteDelete), [xa, Sa] = M(() => Hn.getState().remoteDelete?.at ?? null), Ca = ba?.wasActive === !0 && ba.at !== xa ? ba.at : null;
|
|
151
152
|
k(() => {
|
|
152
|
-
if (
|
|
153
|
-
let e = window.setTimeout(() =>
|
|
153
|
+
if (Ca === null) return;
|
|
154
|
+
let e = window.setTimeout(() => Sa(Ca), mi);
|
|
154
155
|
return () => window.clearTimeout(e);
|
|
155
|
-
}, [
|
|
156
|
-
let { canUseApiCalls:
|
|
157
|
-
loading:
|
|
158
|
-
canUseAdminModes:
|
|
159
|
-
})).current,
|
|
156
|
+
}, [Ca]);
|
|
157
|
+
let { canUseApiCalls: wa, loading: Ta } = cr(T(), B), Ea = j(vt({
|
|
158
|
+
loading: Ta,
|
|
159
|
+
canUseAdminModes: wa
|
|
160
|
+
})).current, Da = j(L);
|
|
160
161
|
k(() => {
|
|
161
|
-
|
|
162
|
+
Da.current = L;
|
|
162
163
|
}, [L]);
|
|
163
|
-
let
|
|
164
|
+
let Oa = () => {
|
|
164
165
|
let e = v.getState().activeConversationId;
|
|
165
|
-
e &&
|
|
166
|
-
},
|
|
166
|
+
e && Un.openConversation(e, { modes: Da.current });
|
|
167
|
+
}, ka = () => {
|
|
167
168
|
let e = v.getState().activeConversationId;
|
|
168
|
-
e &&
|
|
169
|
-
},
|
|
169
|
+
e && Un.loadEarlier(e);
|
|
170
|
+
}, Aa = j(z);
|
|
170
171
|
k(() => {
|
|
171
|
-
|
|
172
|
+
Aa.current = z;
|
|
172
173
|
}, [z]);
|
|
173
|
-
let
|
|
174
|
+
let ja = !!I && xi !== !1;
|
|
174
175
|
k(() => {
|
|
175
|
-
if (
|
|
176
|
+
if (ja) return mr({ send: (e) => pr(e, {
|
|
176
177
|
workspaceId: T(),
|
|
177
178
|
authContext: {
|
|
178
|
-
accessToken:
|
|
179
|
-
organizationId:
|
|
179
|
+
accessToken: Aa.current(),
|
|
180
|
+
organizationId: Et()
|
|
180
181
|
}
|
|
181
182
|
}) });
|
|
182
|
-
}, [
|
|
183
|
-
|
|
184
|
-
loading:
|
|
185
|
-
canUseAdminModes:
|
|
183
|
+
}, [ja]), k(() => {
|
|
184
|
+
Ea.update({
|
|
185
|
+
loading: Ta,
|
|
186
|
+
canUseAdminModes: wa
|
|
186
187
|
});
|
|
187
188
|
}, [
|
|
189
|
+
Ea,
|
|
188
190
|
Ta,
|
|
189
|
-
wa
|
|
190
|
-
Ca
|
|
191
|
+
wa
|
|
191
192
|
]), k(() => () => {
|
|
192
|
-
|
|
193
|
-
}, [
|
|
194
|
-
let
|
|
193
|
+
Ea.abandon();
|
|
194
|
+
}, [Ea]);
|
|
195
|
+
let Ma = A(() => L.filter((e) => !e.requiresAdmin || wa), [L, wa]), Na = f(Ma), Pa = ea && Na, Fa = j(Na);
|
|
195
196
|
k(() => {
|
|
196
|
-
|
|
197
|
-
}, [
|
|
198
|
-
let
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}, [
|
|
202
|
-
let
|
|
203
|
-
e &&
|
|
197
|
+
Fa.current = Na;
|
|
198
|
+
}, [Na]);
|
|
199
|
+
let Ia = j(null), La = j(!1), Ra = st(L), [za, Ba] = M(null), [Va, Ha] = M(null), Ua = Va !== null && Va === H, Wa = fn(), Ga = pn(), Ka = Wa.open && Ga !== null, qa = Wa.close, Ja = j(Ka);
|
|
200
|
+
si(() => {
|
|
201
|
+
Ja.current = Ka;
|
|
202
|
+
}, [Ka]);
|
|
203
|
+
let Ya = O((e) => {
|
|
204
|
+
e && Ja.current || Ha(e ? v.getState().activeConversationId : null);
|
|
204
205
|
}, []);
|
|
205
206
|
k(() => {
|
|
206
|
-
|
|
207
|
+
Ha((e) => e !== null && e !== H ? null : e);
|
|
207
208
|
}, [H]);
|
|
208
|
-
let
|
|
209
|
-
|
|
210
|
-
}, []),
|
|
209
|
+
let Xa = j(void 0), [Za, Qa] = M(!1), $a = O((e) => {
|
|
210
|
+
Xa.current = e, Qa(Ze(e));
|
|
211
|
+
}, []), eo = O(() => {
|
|
211
212
|
let e = v.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
|
|
212
213
|
return !t || !n ? null : {
|
|
213
214
|
id: t,
|
|
214
|
-
reusableDraft:
|
|
215
|
+
reusableDraft: Vn(n, p()),
|
|
215
216
|
liveProposals: G.liveFor(t).count,
|
|
216
|
-
turnInFlight:
|
|
217
|
+
turnInFlight: Ot(e.processingByConversationId[t]?.status)
|
|
217
218
|
};
|
|
218
|
-
}, [G]),
|
|
219
|
+
}, [G]), to = j({}), K = j(_n()), q = j(new hr()), no = j(/* @__PURE__ */ new Set()), ro = A(() => L.find((e) => e.id === U), [L, U]), io = v((e) => {
|
|
219
220
|
let t = e.sandboxesByMode[U]?.sandboxId;
|
|
220
221
|
return t ? e.sandboxWriteCapabilities[t] : void 0;
|
|
221
|
-
}),
|
|
222
|
+
}), ao = ro !== void 0 && dt({
|
|
222
223
|
mode: U,
|
|
223
224
|
productWriteApproval: R,
|
|
224
|
-
capabilities:
|
|
225
|
-
}),
|
|
225
|
+
capabilities: io
|
|
226
|
+
}), oo = U === "assistant" || ro !== void 0 && !ro.writeCapable && !_e(U) || ao;
|
|
226
227
|
k(() => {
|
|
227
|
-
if (U !== "assistant" &&
|
|
228
|
-
|
|
228
|
+
if (U !== "assistant" && ro?.writeCapable && !oe(Qi, U)) {
|
|
229
|
+
zi("assistant");
|
|
229
230
|
return;
|
|
230
231
|
}
|
|
231
|
-
|
|
232
|
+
Ta || (!ro || ro.requiresAdmin && !wa) && U !== "assistant" && zi("assistant");
|
|
232
233
|
}, [
|
|
233
234
|
U,
|
|
234
|
-
|
|
235
|
-
Ca,
|
|
235
|
+
ro,
|
|
236
236
|
wa,
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
Ta,
|
|
238
|
+
zi,
|
|
239
|
+
Qi
|
|
239
240
|
]);
|
|
240
|
-
let
|
|
241
|
-
|
|
242
|
-
}, [
|
|
241
|
+
let so = O((e, t, n, r) => {
|
|
242
|
+
Ki(e, n, t, null, r);
|
|
243
|
+
}, [Ki]), co = O(async (e, t, n, r, i, a = null) => {
|
|
243
244
|
let o = (e, t) => {
|
|
244
|
-
r &&
|
|
245
|
+
r && so(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
|
|
245
246
|
}, c = (e) => {
|
|
246
247
|
r && D(r.assistantMessageId, e);
|
|
247
248
|
}, l = () => {
|
|
248
249
|
c("bootAdopted"), a?.beginBoot();
|
|
249
250
|
}, u = () => a !== null && (a.signal.aborted || T() !== t), d = () => {
|
|
250
|
-
if (u()) throw new
|
|
251
|
+
if (u()) throw new gr("cancelled");
|
|
251
252
|
}, f = v.getState().sandboxesByMode[e]?.sandboxId ?? null, ee = !1, p = !1, m = !1, te = !1, ne = !1, h = async (r) => {
|
|
252
253
|
if (i && !q.current.has(r) && K.current.isFresh(r)) return ee = !0, !0;
|
|
253
254
|
m = !0;
|
|
@@ -257,43 +258,43 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
257
258
|
o = !0, l();
|
|
258
259
|
});
|
|
259
260
|
} catch {
|
|
260
|
-
if (u()) throw new
|
|
261
|
+
if (u()) throw new gr("cancelled");
|
|
261
262
|
return K.current.invalidate(r), q.current.add(r), a?.dead.push(r), ne = !0, !1;
|
|
262
263
|
}
|
|
263
264
|
return d(), K.current.markVerified(r), o && (te = !0), !0;
|
|
264
265
|
};
|
|
265
|
-
if (f && (
|
|
266
|
+
if (f && (Xi(e, f, "provisioning"), o("provisioning", "reusingEnvironment"), await h(f) || (Xi(e, null, "provisioning"), f = null)), !f) {
|
|
266
267
|
o("provisioning", "lookingForEnvironment");
|
|
267
|
-
let r = await pe(t, I, e,
|
|
268
|
+
let r = await pe(t, I, e, ii(), n, q.current, R);
|
|
268
269
|
d();
|
|
269
270
|
let i = r?.id ?? null;
|
|
270
271
|
if (i) {
|
|
271
|
-
|
|
272
|
+
Xi(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
|
|
272
273
|
let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
|
|
273
|
-
t && l(), await h(i) ? (f = i, t && (te = !0)) :
|
|
274
|
+
t && l(), await h(i) ? (f = i, t && (te = !0)) : Xi(e, null, "provisioning");
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
277
|
if (!f) {
|
|
277
|
-
if (a && !a.mayCreate) throw new
|
|
278
|
+
if (a && !a.mayCreate) throw new gr("no-create");
|
|
278
279
|
if (c("provisionStarted"), e === "api-calls" && !z()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
279
|
-
o("provisioning", "startingEnvironment"),
|
|
280
|
-
let r = a ? [] : await ye(t, I, e,
|
|
280
|
+
o("provisioning", "startingEnvironment"), Xi(e, null, "provisioning");
|
|
281
|
+
let r = a ? [] : await ye(t, I, e, ii(), n, q.current, R);
|
|
281
282
|
if (r.length > 0) {
|
|
282
283
|
let e = new Set(r);
|
|
283
284
|
for (let e of r) K.current.invalidate(e), q.current.add(e);
|
|
284
285
|
let t = v.getState().sandboxesByMode;
|
|
285
|
-
for (let [n, r] of Object.entries(t)) s(n) && r?.sandboxId && e.has(r.sandboxId) &&
|
|
286
|
+
for (let [n, r] of Object.entries(t)) s(n) && r?.sandboxId && e.has(r.sandboxId) && Zi(n);
|
|
286
287
|
}
|
|
287
288
|
c("createRequested");
|
|
288
289
|
let i = a?.beginCreate();
|
|
289
290
|
try {
|
|
290
|
-
f = await ue(I, e, t,
|
|
291
|
+
f = await ue(I, e, t, ii(), di, n, { writeApproval: R });
|
|
291
292
|
} finally {
|
|
292
293
|
i?.();
|
|
293
294
|
}
|
|
294
|
-
p = !0, d(),
|
|
295
|
+
p = !0, d(), Xi(e, f, "provisioning"), await Se(f, t, n, 3e5), d(), c("sandboxRunning"), await xe(f, t, e, n, 9e4), d(), c("serviceReady"), K.current.markVerified(f);
|
|
295
296
|
}
|
|
296
|
-
return
|
|
297
|
+
return Xi(e, f, "running"), {
|
|
297
298
|
sandboxId: f,
|
|
298
299
|
sandboxIsNew: p,
|
|
299
300
|
sandboxProbed: m,
|
|
@@ -302,59 +303,59 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
302
303
|
trustedFromCache: ee
|
|
303
304
|
};
|
|
304
305
|
}, [
|
|
305
|
-
|
|
306
|
+
Zi,
|
|
306
307
|
z,
|
|
307
308
|
I,
|
|
308
309
|
R,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
]),
|
|
312
|
-
let s = await
|
|
310
|
+
Xi,
|
|
311
|
+
so
|
|
312
|
+
]), lo = O(async function e(t, n, r, i, a, o = {}) {
|
|
313
|
+
let s = await Sr(i, r, (e) => so(t, n, "provisioning", e), () => D(n, "prewarmJoined"));
|
|
313
314
|
for (let e of s.dead) K.current.invalidate(e), q.current.add(e);
|
|
314
315
|
s.verified && !q.current.has(s.verified) && K.current.markVerified(s.verified), s.joined && E(n, { prewarm: s.joined });
|
|
315
|
-
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: ee } = await
|
|
316
|
+
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: ee } = await co(r, i, a, {
|
|
316
317
|
conversationId: t,
|
|
317
318
|
assistantMessageId: n
|
|
318
|
-
}, o.trustCache !== !1), p =
|
|
319
|
+
}, o.trustCache !== !1), p = vr(i, r, c);
|
|
319
320
|
!s.waited && p && E(n, { prewarm: "hit" });
|
|
320
321
|
let m = v.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, te = !1, ne = null;
|
|
321
322
|
if (m) {
|
|
322
|
-
let e =
|
|
323
|
+
let e = en(c, m, (e, t) => he(e, i, t, r, a, { limit: 50 }));
|
|
323
324
|
try {
|
|
324
325
|
let t = await b(c, i, m, r, a);
|
|
325
326
|
if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
|
|
326
327
|
ne = e;
|
|
327
328
|
} catch {
|
|
328
|
-
|
|
329
|
+
Yi(t), m = null;
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
332
|
let h = !1;
|
|
332
333
|
if (!m) {
|
|
333
|
-
let e =
|
|
334
|
+
let e = _r(yr({
|
|
334
335
|
workspaceId: i,
|
|
335
336
|
mode: r,
|
|
336
337
|
sandboxId: c,
|
|
337
338
|
userId: B
|
|
338
339
|
}), Date.now());
|
|
339
340
|
if (e) {
|
|
340
|
-
"pending" in e &&
|
|
341
|
+
"pending" in e && so(t, n, "connecting", "preparingSession");
|
|
341
342
|
let o = "sessionId" in e ? e.sessionId : await e.pending;
|
|
342
343
|
if (o && !q.current.has(c)) try {
|
|
343
|
-
(await b(c, i, o, r, a)).mode === r && (m = o, h = !0,
|
|
344
|
+
(await b(c, i, o, r, a)).mode === r && (m = o, h = !0, Ji(t, m), te = !0);
|
|
344
345
|
} catch {}
|
|
345
346
|
}
|
|
346
347
|
}
|
|
347
348
|
if (!m) {
|
|
348
|
-
|
|
349
|
+
so(t, n, "connecting", "preparingSession");
|
|
349
350
|
let s;
|
|
350
351
|
try {
|
|
351
352
|
s = await de(c, i, r, a);
|
|
352
353
|
} catch (s) {
|
|
353
354
|
if (ee) {
|
|
354
355
|
K.current.invalidate(c);
|
|
355
|
-
let l =
|
|
356
|
-
if (l === "check-network" && (l = await
|
|
357
|
-
ee || E(n, { cacheProofFailed: !0 }), l === "replace" && (q.current.add(c),
|
|
356
|
+
let l = yn(s, o.isAbandoned?.() ?? !1), ee = l === "check-network";
|
|
357
|
+
if (l === "check-network" && (l = await vn(() => pe(i, I, r, ii(), a, q.current, R))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
|
|
358
|
+
ee || E(n, { cacheProofFailed: !0 }), l === "replace" && (q.current.add(c), Yi(t), Zi(r), G.retireSandbox(c));
|
|
358
359
|
let s = await e(t, n, r, i, a, {
|
|
359
360
|
...o,
|
|
360
361
|
trustCache: !1
|
|
@@ -369,7 +370,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
369
370
|
}
|
|
370
371
|
throw s;
|
|
371
372
|
}
|
|
372
|
-
m = s.sessionId,
|
|
373
|
+
m = s.sessionId, Ji(t, m), te = !0;
|
|
373
374
|
}
|
|
374
375
|
return {
|
|
375
376
|
sandboxId: c,
|
|
@@ -383,41 +384,41 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
383
384
|
sessionPreopened: h
|
|
384
385
|
};
|
|
385
386
|
}, [
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
co,
|
|
388
|
+
Yi,
|
|
389
|
+
Zi,
|
|
389
390
|
I,
|
|
390
391
|
R,
|
|
391
|
-
|
|
392
|
-
|
|
392
|
+
Ji,
|
|
393
|
+
so,
|
|
393
394
|
B,
|
|
394
395
|
G
|
|
395
|
-
]),
|
|
396
|
+
]), uo = O((e, t = !1) => {
|
|
396
397
|
let n = T();
|
|
397
398
|
if (!n) return;
|
|
398
|
-
let r = v.getState(), i = Date.now(), a =
|
|
399
|
+
let r = v.getState(), i = Date.now(), a = xr({
|
|
399
400
|
autoRouting: r.autoRouting,
|
|
400
|
-
autoOffered:
|
|
401
|
+
autoOffered: Fa.current,
|
|
401
402
|
active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
|
|
402
403
|
selectedMode: r.mode,
|
|
403
404
|
autoReadMode: c,
|
|
404
|
-
modes:
|
|
405
|
+
modes: Da.current,
|
|
405
406
|
acknowledgedWriteModes: r.acknowledgedWriteModes,
|
|
406
|
-
adminAccess:
|
|
407
|
+
adminAccess: Ea.read(),
|
|
407
408
|
dictated: e,
|
|
408
|
-
voiceProposalBound: (e) =>
|
|
409
|
-
turnInFlight: Object.values(r.processingByConversationId).some((e) =>
|
|
410
|
-
...
|
|
409
|
+
voiceProposalBound: (e) => wi(e),
|
|
410
|
+
turnInFlight: Object.values(r.processingByConversationId).some((e) => Ot(e?.status)),
|
|
411
|
+
...Tr(n),
|
|
411
412
|
now: i
|
|
412
413
|
});
|
|
413
414
|
if (!a) return;
|
|
414
|
-
let o =
|
|
415
|
+
let o = wr(n, a, i), s = {
|
|
415
416
|
accessToken: z(),
|
|
416
|
-
workspaceToken:
|
|
417
|
+
workspaceToken: Ti(),
|
|
417
418
|
userId: B,
|
|
418
|
-
organizationId:
|
|
419
|
+
organizationId: Et()
|
|
419
420
|
};
|
|
420
|
-
|
|
421
|
+
co(a.mode, n, s, null, !0, o).then((e) => {
|
|
421
422
|
if (o.finish({
|
|
422
423
|
ok: !0,
|
|
423
424
|
sandboxId: e.sandboxId,
|
|
@@ -426,24 +427,24 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
426
427
|
dead: o.dead
|
|
427
428
|
}), o.signal.aborted || T() !== n || q.current.has(e.sandboxId)) return;
|
|
428
429
|
let r = v.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = p();
|
|
429
|
-
|
|
430
|
+
br({
|
|
430
431
|
active: i ? {
|
|
431
432
|
mode: i.mode,
|
|
432
433
|
backendSessionId: i.backendSessionId,
|
|
433
|
-
continuable: !
|
|
434
|
-
hasHistory:
|
|
434
|
+
continuable: !Bn(i) && !zn(i, c),
|
|
435
|
+
hasHistory: Rn(i)
|
|
435
436
|
} : void 0,
|
|
436
437
|
mode: a.mode
|
|
437
|
-
}) &&
|
|
438
|
+
}) && Cr(yr({
|
|
438
439
|
workspaceId: n,
|
|
439
440
|
mode: a.mode,
|
|
440
441
|
sandboxId: e.sandboxId,
|
|
441
442
|
userId: B
|
|
442
443
|
}), () => de(e.sandboxId, n, a.mode, s).then((e) => e.sessionId), Date.now());
|
|
443
444
|
}, (e) => {
|
|
444
|
-
if (!(e instanceof
|
|
445
|
+
if (!(e instanceof gr) && !o.signal.aborted && T() === n) {
|
|
445
446
|
let e = v.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
|
|
446
|
-
e && (K.current.invalidate(e), q.current.add(e), o.dead.push(e),
|
|
447
|
+
e && (K.current.invalidate(e), q.current.add(e), o.dead.push(e), Zi(a.mode));
|
|
447
448
|
}
|
|
448
449
|
o.finish({
|
|
449
450
|
ok: !1,
|
|
@@ -453,50 +454,50 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
453
454
|
});
|
|
454
455
|
});
|
|
455
456
|
}, [
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
co,
|
|
458
|
+
Ea,
|
|
459
|
+
Zi,
|
|
459
460
|
z,
|
|
460
|
-
|
|
461
|
+
Ti,
|
|
461
462
|
B,
|
|
462
|
-
|
|
463
|
-
]),
|
|
463
|
+
wi
|
|
464
|
+
]), fo = O(() => uo(!1), [uo]), po = ci(ae, h, h)?.reference ?? null, [mo, ho] = M(0), go = j(/* @__PURE__ */ new Set()), _o = j(null), vo = O(() => {
|
|
464
465
|
let e = v.getState(), t = e.activeConversationId;
|
|
465
466
|
if (!t) return null;
|
|
466
|
-
let n = e.processingByConversationId[t], r =
|
|
467
|
-
if (!
|
|
467
|
+
let n = e.processingByConversationId[t], r = Ot(n?.status) ? n?.messageId ?? null : null;
|
|
468
|
+
if (!At({
|
|
468
469
|
interruptedTurnId: r,
|
|
469
470
|
activeTurnId: r,
|
|
470
|
-
alreadyRequested: r ?
|
|
471
|
+
alreadyRequested: r ? go.current.has(r) : !1
|
|
471
472
|
}).send || !r) return null;
|
|
472
|
-
|
|
473
|
+
go.current.add(r);
|
|
473
474
|
let i = ce(e), a = T(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
|
|
474
475
|
return !i || !a || !o || le(i.sandboxId, a, o, i.mode, {
|
|
475
476
|
accessToken: z(),
|
|
476
|
-
workspaceToken:
|
|
477
|
+
workspaceToken: Ti(),
|
|
477
478
|
userId: B,
|
|
478
|
-
organizationId:
|
|
479
|
+
organizationId: Et()
|
|
479
480
|
}), r;
|
|
480
481
|
}, [
|
|
481
482
|
B,
|
|
482
483
|
z,
|
|
483
|
-
|
|
484
|
-
]),
|
|
485
|
-
let e =
|
|
486
|
-
return e && (
|
|
487
|
-
}, [
|
|
484
|
+
Ti
|
|
485
|
+
]), yo = O(() => {
|
|
486
|
+
let e = vo();
|
|
487
|
+
return e && (Ue(e), Be.abort(e)), e;
|
|
488
|
+
}, [vo]), bo = O(() => {
|
|
488
489
|
let e = v.getState().activeConversationId;
|
|
489
|
-
|
|
490
|
-
}, [
|
|
490
|
+
yo(), e && G.declineForReply(e, "corrected", "spoken");
|
|
491
|
+
}, [yo, G]), xo = O(async (e) => {
|
|
491
492
|
let t = v.getState(), n = ce(t), r = T(), i = t.activeConversationId;
|
|
492
|
-
if (!n || !r || !i ||
|
|
493
|
+
if (!n || !r || !i || En(t.sandboxWriteCapabilities[n.sandboxId])) return;
|
|
493
494
|
let a = t.conversations.find((e) => e.id === i), o = a ? g(Re(a.messages), {
|
|
494
495
|
sessionId: a.backendSessionId,
|
|
495
496
|
sandboxId: n.sandboxId,
|
|
496
497
|
nowMs: Date.now()
|
|
497
498
|
}) : null;
|
|
498
499
|
if (o?.reference !== e) {
|
|
499
|
-
|
|
500
|
+
ho((e) => e + 1);
|
|
500
501
|
return;
|
|
501
502
|
}
|
|
502
503
|
let s = {
|
|
@@ -507,9 +508,9 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
507
508
|
try {
|
|
508
509
|
await y(n.sandboxId, r, e, n.mode, {
|
|
509
510
|
accessToken: z(),
|
|
510
|
-
workspaceToken:
|
|
511
|
+
workspaceToken: Ti(),
|
|
511
512
|
userId: B,
|
|
512
|
-
organizationId:
|
|
513
|
+
organizationId: Et()
|
|
513
514
|
});
|
|
514
515
|
} catch (e) {
|
|
515
516
|
ne(s), W(i, {
|
|
@@ -520,61 +521,61 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
520
521
|
});
|
|
521
522
|
return;
|
|
522
523
|
}
|
|
523
|
-
ne(s),
|
|
524
|
+
ne(s), Gi(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
524
525
|
let c = v.getState(), l = c.conversations.find((e) => e.id === i);
|
|
525
|
-
c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || ce(c)?.sandboxId !== n.sandboxId ||
|
|
526
|
+
c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || ce(c)?.sandboxId !== n.sandboxId || Ot(c.processingByConversationId[i]?.status) || ie(Re(l.messages)) !== o.messageId || gs.current(F("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
|
|
526
527
|
approvalFollowUp: { approvedReplyId: o.messageId },
|
|
527
528
|
targetConversationId: i
|
|
528
529
|
});
|
|
529
530
|
}, [
|
|
530
531
|
B,
|
|
531
532
|
W,
|
|
532
|
-
|
|
533
|
+
Gi,
|
|
533
534
|
F
|
|
534
|
-
]),
|
|
535
|
-
theme:
|
|
536
|
-
navigate:
|
|
537
|
-
navItems:
|
|
538
|
-
options:
|
|
539
|
-
navPermissionsSettled:
|
|
540
|
-
navSimulating:
|
|
535
|
+
]), So = e(), { speakFinishedReply: Co } = dn(), wo = o(), { items: To, permissionsSettled: Eo, simulating: Do } = oi(), J = j({
|
|
536
|
+
theme: So,
|
|
537
|
+
navigate: wo,
|
|
538
|
+
navItems: To,
|
|
539
|
+
options: Ci ?? {},
|
|
540
|
+
navPermissionsSettled: Eo,
|
|
541
|
+
navSimulating: Do
|
|
541
542
|
});
|
|
542
543
|
k(() => {
|
|
543
544
|
J.current = {
|
|
544
|
-
theme:
|
|
545
|
-
navigate:
|
|
546
|
-
navItems:
|
|
547
|
-
options:
|
|
548
|
-
navPermissionsSettled:
|
|
549
|
-
navSimulating:
|
|
545
|
+
theme: So,
|
|
546
|
+
navigate: wo,
|
|
547
|
+
navItems: To,
|
|
548
|
+
options: Ci ?? {},
|
|
549
|
+
navPermissionsSettled: Eo,
|
|
550
|
+
navSimulating: Do
|
|
550
551
|
};
|
|
551
552
|
}, [
|
|
552
|
-
|
|
553
|
-
Co,
|
|
553
|
+
So,
|
|
554
554
|
wo,
|
|
555
|
-
Si,
|
|
556
555
|
To,
|
|
557
|
-
|
|
556
|
+
Ci,
|
|
557
|
+
Eo,
|
|
558
|
+
Do
|
|
558
559
|
]);
|
|
559
560
|
let Y = j(!0);
|
|
560
561
|
k(() => (Y.current = !0, () => {
|
|
561
562
|
Y.current = !1;
|
|
562
563
|
}), []);
|
|
563
|
-
let
|
|
564
|
+
let Oo = j({
|
|
564
565
|
tr: F,
|
|
565
566
|
locale: V
|
|
566
|
-
}),
|
|
567
|
-
|
|
568
|
-
let t =
|
|
569
|
-
t && (
|
|
570
|
-
if (
|
|
567
|
+
}), ko = j(null), [Ao, jo] = M(null), Mo = j(null), No = O((e) => {
|
|
568
|
+
Mo.current !== null && (window.clearTimeout(Mo.current), Mo.current = null);
|
|
569
|
+
let t = ko.current;
|
|
570
|
+
t && (ko.current = null, window.clearTimeout(t.deadline), Y.current && jo(null), !(!e || !Y.current) && (Mo.current = window.setTimeout(() => {
|
|
571
|
+
if (Mo.current = null, !Y.current) return;
|
|
571
572
|
let e = v.getState();
|
|
572
573
|
if (e.activeConversationId !== t.conversationId) return;
|
|
573
574
|
let n = e.conversations.find((e) => e.id === t.conversationId)?.messages.find((e) => e.id === t.messageId);
|
|
574
575
|
if (!n) return;
|
|
575
|
-
let r =
|
|
576
|
+
let r = Oo.current, i = Yt(n, null, r.tr);
|
|
576
577
|
if (i.kind !== "output") return;
|
|
577
|
-
let a =
|
|
578
|
+
let a = qt(n, r.tr);
|
|
578
579
|
Be.publish(n.id, {
|
|
579
580
|
conversationId: t.conversationId,
|
|
580
581
|
channel: n.metadata?.voice === !0 ? "voice" : "chat",
|
|
@@ -584,47 +585,47 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
584
585
|
final: !0
|
|
585
586
|
});
|
|
586
587
|
}, 0)));
|
|
587
|
-
}, []),
|
|
588
|
+
}, []), Po = O(() => No(!0), [No]);
|
|
588
589
|
k(() => {
|
|
589
|
-
|
|
590
|
+
Oo.current = {
|
|
590
591
|
tr: F,
|
|
591
592
|
locale: V
|
|
592
593
|
};
|
|
593
|
-
let e =
|
|
594
|
+
let e = ko.current;
|
|
594
595
|
if (!e) return;
|
|
595
|
-
let t =
|
|
596
|
+
let t = Jt({
|
|
596
597
|
wanted: e.wanted,
|
|
597
598
|
locale: V,
|
|
598
|
-
isLoading:
|
|
599
|
-
translatedNow:
|
|
599
|
+
isLoading: Ei(e.wanted),
|
|
600
|
+
translatedNow: Gt(F, e.reply).translated
|
|
600
601
|
});
|
|
601
602
|
if (t === "write") {
|
|
602
|
-
|
|
603
|
+
Po();
|
|
603
604
|
return;
|
|
604
605
|
}
|
|
605
606
|
if (t === "grace") {
|
|
606
|
-
let e = window.setTimeout(
|
|
607
|
+
let e = window.setTimeout(Po, 400);
|
|
607
608
|
return () => window.clearTimeout(e);
|
|
608
609
|
}
|
|
609
610
|
}, [
|
|
610
611
|
F,
|
|
611
612
|
V,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
]), k(() => () =>
|
|
616
|
-
let
|
|
613
|
+
Ei,
|
|
614
|
+
Ao,
|
|
615
|
+
Po
|
|
616
|
+
]), k(() => () => No(!1), [No]);
|
|
617
|
+
let Fo = j(null), [Io, Lo] = M(!1), [X] = M(() => new Te()), [Ro, zo] = M(0), Bo = O(() => zo((e) => e + 1), []), Vo = O(() => {
|
|
617
618
|
let e = J.current;
|
|
618
619
|
return {
|
|
619
|
-
destinations:
|
|
620
|
+
destinations: jr(e.navItems),
|
|
620
621
|
permissionsSettled: e.navPermissionsSettled,
|
|
621
622
|
simulating: e.navSimulating
|
|
622
623
|
};
|
|
623
|
-
}, []),
|
|
624
|
+
}, []), Ho = j(B);
|
|
624
625
|
k(() => {
|
|
625
|
-
|
|
626
|
+
Ho.current = B;
|
|
626
627
|
}, [B]);
|
|
627
|
-
let
|
|
628
|
+
let Uo = O((e, t) => {
|
|
628
629
|
let n = X.replyIdOf(e), r = n ? X.turnFor(n) : void 0, i = X.offer(e), a = {
|
|
629
630
|
ok: !1,
|
|
630
631
|
reason: "gone",
|
|
@@ -636,8 +637,8 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
636
637
|
let o = r.conversationId, s = v.getState().conversations.find((e) => e.id === o);
|
|
637
638
|
if (!s) return a;
|
|
638
639
|
let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = X.liveOffersFor(n, {
|
|
639
|
-
registry:
|
|
640
|
-
actorId:
|
|
640
|
+
registry: Vo(),
|
|
641
|
+
actorId: Ho.current,
|
|
641
642
|
conversationId: o,
|
|
642
643
|
perfNow: performance.now()
|
|
643
644
|
}).find((t) => t.offer.offerId === e);
|
|
@@ -646,12 +647,12 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
646
647
|
return {
|
|
647
648
|
ok: !1,
|
|
648
649
|
reason: e ? "unavailable" : "expired",
|
|
649
|
-
copy: e ?
|
|
650
|
+
copy: e ? Bt(F, t || null) : Rt(F),
|
|
650
651
|
conversationId: o,
|
|
651
652
|
voiceSessionId: l
|
|
652
653
|
};
|
|
653
654
|
}
|
|
654
|
-
return X.markUsed(e) ? (
|
|
655
|
+
return X.markUsed(e) ? (Bo(), {
|
|
655
656
|
ok: !0,
|
|
656
657
|
target: u.target,
|
|
657
658
|
conversationId: o,
|
|
@@ -659,10 +660,10 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
659
660
|
}) : a;
|
|
660
661
|
}, [
|
|
661
662
|
X,
|
|
662
|
-
|
|
663
|
+
Vo,
|
|
663
664
|
F,
|
|
664
|
-
|
|
665
|
-
]),
|
|
665
|
+
Bo
|
|
666
|
+
]), Wo = O((e, t, n, r, i) => {
|
|
666
667
|
let a = P();
|
|
667
668
|
W(e, {
|
|
668
669
|
id: a,
|
|
@@ -674,18 +675,18 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
674
675
|
...i ? { localAction: i } : {},
|
|
675
676
|
...S(t)
|
|
676
677
|
}
|
|
677
|
-
}), i &&
|
|
678
|
-
}, [W, V]),
|
|
678
|
+
}), i && Un.recordCommittedEntries(e, [a], "NOTE", r);
|
|
679
|
+
}, [W, V]), Go = O((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && X.release(e), [X]), Ko = j(null);
|
|
679
680
|
k(() => () => {
|
|
680
|
-
|
|
681
|
+
Ko.current?.(), Ko.current = null;
|
|
681
682
|
}, []);
|
|
682
|
-
let
|
|
683
|
-
|
|
684
|
-
}, []),
|
|
685
|
-
if (
|
|
686
|
-
let i =
|
|
683
|
+
let qo = O((e) => {
|
|
684
|
+
Ko.current?.(), Ko.current = Y.current ? Xn(document, e) : null;
|
|
685
|
+
}, []), Jo = O((e, t, n, r = !1) => {
|
|
686
|
+
if (Fo.current !== null) return;
|
|
687
|
+
let i = Uo(e, n), a = T(), o = (e, t, n, r) => Wo(e, t, n, a, r);
|
|
687
688
|
if (!i.ok) {
|
|
688
|
-
i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy),
|
|
689
|
+
i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), Bo();
|
|
689
690
|
return;
|
|
690
691
|
}
|
|
691
692
|
let { target: s, conversationId: c, voiceSessionId: l } = i, u = {
|
|
@@ -693,7 +694,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
693
694
|
offerId: e
|
|
694
695
|
};
|
|
695
696
|
if (r) {
|
|
696
|
-
o(c, l,
|
|
697
|
+
o(c, l, It(F, s.label, !0), Rr({
|
|
697
698
|
destinationId: s.id,
|
|
698
699
|
path: s.path,
|
|
699
700
|
alreadyHere: !0,
|
|
@@ -703,16 +704,16 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
703
704
|
return;
|
|
704
705
|
}
|
|
705
706
|
let d = P();
|
|
706
|
-
|
|
707
|
+
Fo.current = d, Lo(!0);
|
|
707
708
|
let f = (t) => {
|
|
708
709
|
try {
|
|
709
|
-
if (
|
|
710
|
+
if (Go(e, t) && (Bo(), t.status === "kept" && qo(e)), t.status === "kept" || !v.getState().conversations.some((e) => e.id === c)) return;
|
|
710
711
|
let n = t.status === "arrived" || t.status === "redirected" ? t.landedPath : null;
|
|
711
|
-
o(c, l,
|
|
712
|
+
o(c, l, Lt(F, t, {
|
|
712
713
|
page: s.label,
|
|
713
|
-
landed: n === null ? null :
|
|
714
|
+
landed: n === null ? null : Br(jr(J.current.navItems), n),
|
|
714
715
|
path: s.path
|
|
715
|
-
}),
|
|
716
|
+
}), Rr({
|
|
716
717
|
destinationId: s.id,
|
|
717
718
|
path: s.path,
|
|
718
719
|
alreadyHere: !1,
|
|
@@ -721,10 +722,10 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
721
722
|
offer: u
|
|
722
723
|
}));
|
|
723
724
|
} finally {
|
|
724
|
-
|
|
725
|
+
Fo.current === d && (Fo.current = null, Y.current && Lo(!1));
|
|
725
726
|
}
|
|
726
727
|
};
|
|
727
|
-
|
|
728
|
+
Fr(J.current.navigate, s.path, {
|
|
728
729
|
readPath: () => window.location.pathname + window.location.search,
|
|
729
730
|
now: () => Date.now(),
|
|
730
731
|
schedule: (e, t) => {
|
|
@@ -735,20 +736,20 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
735
736
|
surface: "offer"
|
|
736
737
|
}).then(f, () => f({ status: "unconfirmed" }));
|
|
737
738
|
}, [
|
|
738
|
-
Ho,
|
|
739
739
|
Uo,
|
|
740
|
-
F,
|
|
741
|
-
zo,
|
|
742
740
|
Wo,
|
|
743
|
-
|
|
744
|
-
|
|
741
|
+
F,
|
|
742
|
+
Bo,
|
|
743
|
+
Go,
|
|
744
|
+
qo
|
|
745
|
+
]), Yo = O((e, t) => Jo(e, "tap", t || null), [Jo]), Xo = O((e) => {
|
|
745
746
|
let { replyId: t, conversationId: n } = e, r = X.turnFor(t);
|
|
746
747
|
if (!r) return;
|
|
747
|
-
let i = window.location.pathname + window.location.search, a =
|
|
748
|
+
let i = window.location.pathname + window.location.search, a = jr(J.current.navItems), o = Zr({
|
|
748
749
|
intent: e.intent,
|
|
749
750
|
live: X.liveOffersFor(t, {
|
|
750
|
-
registry:
|
|
751
|
-
actorId:
|
|
751
|
+
registry: Vo(),
|
|
752
|
+
actorId: Ho.current,
|
|
752
753
|
conversationId: n,
|
|
753
754
|
perfNow: performance.now()
|
|
754
755
|
}),
|
|
@@ -760,50 +761,50 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
760
761
|
location: i,
|
|
761
762
|
conversationId: v.getState().activeConversationId,
|
|
762
763
|
workspaceId: T(),
|
|
763
|
-
actorId:
|
|
764
|
+
actorId: Ho.current ?? null
|
|
764
765
|
},
|
|
765
766
|
mounted: Y.current,
|
|
766
767
|
visible: document.visibilityState === "visible",
|
|
767
|
-
unsavedChanges:
|
|
768
|
+
unsavedChanges: Qr(J.current.options),
|
|
768
769
|
alreadyThere: ({ target: e }) => {
|
|
769
770
|
let t = a.find((t) => t.id === e.id);
|
|
770
|
-
return t ?
|
|
771
|
+
return t ? Or(t, i, a) : !1;
|
|
771
772
|
}
|
|
772
773
|
});
|
|
773
774
|
if (o.act === "navigate" || o.act === "already-here") {
|
|
774
|
-
|
|
775
|
+
Jo(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
|
|
775
776
|
return;
|
|
776
777
|
}
|
|
777
778
|
let [s] = o.unsaved ?? [], [c] = X.liveOffersFor(t, {
|
|
778
|
-
registry:
|
|
779
|
-
actorId:
|
|
779
|
+
registry: Vo(),
|
|
780
|
+
actorId: Ho.current,
|
|
780
781
|
conversationId: n,
|
|
781
782
|
perfNow: performance.now()
|
|
782
783
|
});
|
|
783
|
-
o.hold === "R5-unsaved" && s && c &&
|
|
784
|
+
o.hold === "R5-unsaved" && s && c && Wo(n, e.voiceSessionId, zt(F, s.label, c.target.label), T());
|
|
784
785
|
}, [
|
|
785
786
|
X,
|
|
786
|
-
|
|
787
|
+
Vo,
|
|
787
788
|
G,
|
|
788
|
-
|
|
789
|
-
|
|
789
|
+
Jo,
|
|
790
|
+
Wo,
|
|
790
791
|
F
|
|
791
|
-
]),
|
|
792
|
+
]), Zo = O((e) => {
|
|
792
793
|
let t = v.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
|
|
793
|
-
return n ? Ir
|
|
794
|
-
}, []),
|
|
795
|
-
let { navItems: r, options: i } = J.current, a =
|
|
794
|
+
return n ? Lr(Ir, window.location.pathname, Vr(n.messages, e)) : !1;
|
|
795
|
+
}, []), Qo = O((e, t, n = !1) => {
|
|
796
|
+
let { navItems: r, options: i } = J.current, a = jr(r), o = null, s = {
|
|
796
797
|
...i,
|
|
797
|
-
locale: t === void 0 ? V :
|
|
798
|
+
locale: t === void 0 ? V : Ni.input.code,
|
|
798
799
|
uiLocale: V,
|
|
799
|
-
inputLocale:
|
|
800
|
+
inputLocale: Ni.input.code
|
|
800
801
|
};
|
|
801
|
-
if (
|
|
802
|
-
let e = v.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ?
|
|
802
|
+
if (Ar(e, s)) {
|
|
803
|
+
let e = v.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? Ur(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => X.offersFor(e.id).some((e) => e.offerId === t) } }) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && Ot(c.status);
|
|
803
804
|
if (n && s && !l) {
|
|
804
805
|
let e = X.liveOffersFor(s.id, {
|
|
805
|
-
registry:
|
|
806
|
-
actorId:
|
|
806
|
+
registry: Vo(),
|
|
807
|
+
actorId: Ho.current,
|
|
807
808
|
conversationId: n.id,
|
|
808
809
|
perfNow: performance.now()
|
|
809
810
|
}).flatMap(({ offer: e, target: t }) => {
|
|
@@ -813,34 +814,34 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
813
814
|
target: n
|
|
814
815
|
}] : [];
|
|
815
816
|
});
|
|
816
|
-
o =
|
|
817
|
+
o = Hr({
|
|
817
818
|
reply: s,
|
|
818
|
-
text:
|
|
819
|
+
text: on(s, c, F),
|
|
819
820
|
resolve: {
|
|
820
821
|
destinations: a,
|
|
821
822
|
entityRoutes: i.entityRoutes,
|
|
822
|
-
visibleNavIds:
|
|
823
|
-
nounLabel: (e) =>
|
|
823
|
+
visibleNavIds: Er(r),
|
|
824
|
+
nounLabel: (e) => Pt(F, e)
|
|
824
825
|
},
|
|
825
826
|
offers: e
|
|
826
827
|
});
|
|
827
828
|
}
|
|
828
829
|
}
|
|
829
|
-
return
|
|
830
|
-
backRunnable:
|
|
830
|
+
return kr(e, a, s, {
|
|
831
|
+
backRunnable: Zo(t),
|
|
831
832
|
navigation: o,
|
|
832
833
|
skipRecords: n,
|
|
833
|
-
controls:
|
|
834
|
+
controls: Pr()
|
|
834
835
|
});
|
|
835
836
|
}, [
|
|
836
|
-
|
|
837
|
-
|
|
837
|
+
Zo,
|
|
838
|
+
Ni,
|
|
838
839
|
V,
|
|
839
840
|
F,
|
|
840
841
|
X,
|
|
841
|
-
|
|
842
|
-
]),
|
|
843
|
-
let n =
|
|
842
|
+
Vo
|
|
843
|
+
]), $o = O((e, t) => {
|
|
844
|
+
let n = Qo(e, t);
|
|
844
845
|
if (!n) return !1;
|
|
845
846
|
let { theme: r, navigate: i } = J.current;
|
|
846
847
|
switch (n.kind) {
|
|
@@ -852,14 +853,14 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
852
853
|
case "link-not-openable":
|
|
853
854
|
case "back": return i !== null;
|
|
854
855
|
case "conversation-delete": return !1;
|
|
855
|
-
case "app-control": return
|
|
856
|
+
case "app-control": return $r(n.request, { voiceLive: t !== void 0 || tc.current }) !== null;
|
|
856
857
|
case "open-record": return !1;
|
|
857
858
|
}
|
|
858
|
-
}, [
|
|
859
|
+
}, [Qo]), es = j($o);
|
|
859
860
|
k(() => {
|
|
860
|
-
|
|
861
|
-
}, [
|
|
862
|
-
let
|
|
861
|
+
es.current = $o;
|
|
862
|
+
}, [$o]);
|
|
863
|
+
let ts = O((e, t) => {
|
|
863
864
|
let n = {
|
|
864
865
|
state: "none",
|
|
865
866
|
accept: null
|
|
@@ -868,16 +869,16 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
868
869
|
let o = v.getState(), s = o.conversations.find((t) => t.id === e);
|
|
869
870
|
if (!s) return n;
|
|
870
871
|
let c = o.processingByConversationId[s.id] ?? null, l = {
|
|
871
|
-
registry:
|
|
872
|
-
actorId:
|
|
872
|
+
registry: Vo(),
|
|
873
|
+
actorId: Ho.current,
|
|
873
874
|
conversationId: s.id,
|
|
874
875
|
perfNow: performance.now()
|
|
875
|
-
}, { state: u, reply: d } =
|
|
876
|
+
}, { state: u, reply: d } = Yr(X, {
|
|
876
877
|
...l,
|
|
877
878
|
messages: s.messages,
|
|
878
879
|
voiceSessionId: t,
|
|
879
880
|
processing: c,
|
|
880
|
-
displayedText: (e) =>
|
|
881
|
+
displayedText: (e) => on(e, c, F),
|
|
881
882
|
productWriteApproval: R,
|
|
882
883
|
capabilitiesOf: (e) => v.getState().sandboxWriteCapabilities[e]
|
|
883
884
|
});
|
|
@@ -885,7 +886,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
885
886
|
state: u,
|
|
886
887
|
accept: null
|
|
887
888
|
};
|
|
888
|
-
let [f] = X.liveOffersFor(d.id, l), ee = f ?
|
|
889
|
+
let [f] = X.liveOffersFor(d.id, l), ee = f ? jr(a).find((e) => e.id === f.target.id) : void 0;
|
|
889
890
|
return !f || !ee ? n : {
|
|
890
891
|
state: u,
|
|
891
892
|
accept: {
|
|
@@ -895,10 +896,10 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
895
896
|
};
|
|
896
897
|
}, [
|
|
897
898
|
X,
|
|
898
|
-
|
|
899
|
+
Vo,
|
|
899
900
|
R,
|
|
900
901
|
F
|
|
901
|
-
]),
|
|
902
|
+
]), ns = O((e, t, n, r, i) => {
|
|
902
903
|
let a = F(n.key, n.fallback, r), o = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), s = {
|
|
903
904
|
kind: "write-reply",
|
|
904
905
|
line: n.key
|
|
@@ -924,48 +925,48 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
924
925
|
localAction: s,
|
|
925
926
|
...S(i)
|
|
926
927
|
}
|
|
927
|
-
}),
|
|
928
|
+
}), Un.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", T()), Co(e, u);
|
|
928
929
|
}, [
|
|
929
930
|
W,
|
|
930
931
|
V,
|
|
931
|
-
|
|
932
|
+
Co,
|
|
932
933
|
F
|
|
933
|
-
]),
|
|
934
|
+
]), rs = qn(), is = Jn(), as = rs?.request ?? null, os = j(() => void 0), [ss, cs] = M(null);
|
|
934
935
|
k(() => {
|
|
935
|
-
if (
|
|
936
|
-
let e = window.setTimeout(() =>
|
|
936
|
+
if (ss === null) return;
|
|
937
|
+
let e = window.setTimeout(() => cs(null), gi);
|
|
937
938
|
return () => window.clearTimeout(e);
|
|
938
|
-
}, [
|
|
939
|
-
let
|
|
939
|
+
}, [ss]);
|
|
940
|
+
let ls = O(() => {
|
|
940
941
|
let e = v.getState();
|
|
941
|
-
return
|
|
942
|
-
}, [
|
|
943
|
-
if (!
|
|
944
|
-
let t = e !== void 0, n = v.getState(), r =
|
|
942
|
+
return Hi(void 0, e.autoRouting && Fa.current ? c : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
|
|
943
|
+
}, [Hi]), us = O((e) => {
|
|
944
|
+
if (!as) return !1;
|
|
945
|
+
let t = e !== void 0, n = v.getState(), r = Zn({
|
|
945
946
|
spoken: t,
|
|
946
|
-
bound:
|
|
947
|
+
bound: Xa.current,
|
|
947
948
|
activeConversationId: n.activeConversationId,
|
|
948
949
|
conversations: n.conversations,
|
|
949
|
-
historyOn:
|
|
950
|
+
historyOn: Kn()
|
|
950
951
|
});
|
|
951
|
-
if (r &&
|
|
952
|
+
if (r && as(r), t) {
|
|
952
953
|
let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? F("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : F("deleteConversation.nothing", "There is no conversation to delete.");
|
|
953
|
-
|
|
954
|
+
os.current({
|
|
954
955
|
id: `conversation-delete:${P()}`,
|
|
955
956
|
text: t,
|
|
956
957
|
lang: t === e ? "en" : V
|
|
957
958
|
});
|
|
958
|
-
} else r ||
|
|
959
|
+
} else r || cs(Date.now());
|
|
959
960
|
return !0;
|
|
960
961
|
}, [
|
|
961
|
-
|
|
962
|
+
as,
|
|
962
963
|
V,
|
|
963
964
|
F
|
|
964
|
-
]),
|
|
965
|
-
if (e.kind === "conversation-delete") return
|
|
965
|
+
]), ds = O((e, t, n, r = !1) => {
|
|
966
|
+
if (e.kind === "conversation-delete") return us(n);
|
|
966
967
|
let { theme: i, navigate: a } = J.current, o = null, s = () => {
|
|
967
|
-
let e = (r ? null : o ?? v.getState().activeConversationId) ??
|
|
968
|
-
return r &&
|
|
968
|
+
let e = (r ? null : o ?? v.getState().activeConversationId) ?? ls();
|
|
969
|
+
return r && $a(e), e;
|
|
969
970
|
}, c = (e, r) => {
|
|
970
971
|
let i = P();
|
|
971
972
|
return W(e, {
|
|
@@ -990,23 +991,23 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
990
991
|
localAction: i,
|
|
991
992
|
...S(n)
|
|
992
993
|
}
|
|
993
|
-
}),
|
|
994
|
+
}), Un.recordCommittedEntries(e, [t, s], "LOCAL_COMMAND", a), o && Co(e, s), s;
|
|
994
995
|
}, u = (e, t, n) => {
|
|
995
996
|
let r = s(), i = l(r, c(r, t), e, t, T(), !0);
|
|
996
997
|
return n?.(i), !0;
|
|
997
998
|
}, d = (e) => {
|
|
998
|
-
let t = s(), n = T(), r = window.location.pathname, i = c(t,
|
|
999
|
+
let t = s(), n = T(), r = window.location.pathname, i = c(t, Rr({
|
|
999
1000
|
destinationId: e.destinationId,
|
|
1000
1001
|
path: e.registryPath,
|
|
1001
1002
|
alreadyHere: !1,
|
|
1002
1003
|
via: e.via,
|
|
1003
1004
|
offer: e.offer
|
|
1004
1005
|
})), o = P();
|
|
1005
|
-
|
|
1006
|
+
Fo.current = o, Lo(!0);
|
|
1006
1007
|
let u = (a) => {
|
|
1007
1008
|
try {
|
|
1008
|
-
if (e.offer &&
|
|
1009
|
-
let o =
|
|
1009
|
+
if (e.offer && Go(e.offer.offerId, a) && Bo(), a.status === "kept" || !v.getState().conversations.some((e) => e.id === t)) return;
|
|
1010
|
+
let o = jr(J.current.navItems), s = a.status === "arrived" || a.status === "redirected" ? a.landedPath : null, c = Rr({
|
|
1010
1011
|
destinationId: e.destinationId,
|
|
1011
1012
|
path: e.registryPath,
|
|
1012
1013
|
alreadyHere: !1,
|
|
@@ -1014,10 +1015,10 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1014
1015
|
outcome: a,
|
|
1015
1016
|
offer: e.offer
|
|
1016
1017
|
});
|
|
1017
|
-
|
|
1018
|
-
let u = l(t, i, e.via === "back" && a.status === "arrived" ?
|
|
1018
|
+
Gi(t, i, { localAction: c });
|
|
1019
|
+
let u = l(t, i, e.via === "back" && a.status === "arrived" ? jt(F, e.pageLabel()) : Lt(F, a, {
|
|
1019
1020
|
page: e.pageLabel(),
|
|
1020
|
-
landed: s === null ? null :
|
|
1021
|
+
landed: s === null ? null : Br(o, s),
|
|
1021
1022
|
path: e.target
|
|
1022
1023
|
}), c, n, Y.current);
|
|
1023
1024
|
a.status === "arrived" && e.onArrived?.({
|
|
@@ -1026,10 +1027,10 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1026
1027
|
landedPath: a.landedPath
|
|
1027
1028
|
});
|
|
1028
1029
|
} finally {
|
|
1029
|
-
|
|
1030
|
+
Fo.current === o && (Fo.current = null, Y.current && Lo(!1));
|
|
1030
1031
|
}
|
|
1031
1032
|
};
|
|
1032
|
-
return
|
|
1033
|
+
return Fr(a, e.target, {
|
|
1033
1034
|
readPath: () => window.location.pathname + window.location.search,
|
|
1034
1035
|
now: () => Date.now(),
|
|
1035
1036
|
schedule: (e, t) => {
|
|
@@ -1037,7 +1038,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1037
1038
|
},
|
|
1038
1039
|
isShellLess: () => !Y.current
|
|
1039
1040
|
}).then(u, () => u({ status: "unconfirmed" })), !0;
|
|
1040
|
-
}, f = ({ replyId: e, fromPath: t, landedPath: n }) =>
|
|
1041
|
+
}, f = ({ replyId: e, fromPath: t, landedPath: n }) => Ir.push({
|
|
1041
1042
|
fromPath: t,
|
|
1042
1043
|
toPath: n,
|
|
1043
1044
|
replyMessageId: e,
|
|
@@ -1045,21 +1046,21 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1045
1046
|
});
|
|
1046
1047
|
if (e.kind === "theme") {
|
|
1047
1048
|
if (!i) return !1;
|
|
1048
|
-
let t =
|
|
1049
|
+
let t = Mr(e.request, {
|
|
1049
1050
|
mode: i.mode,
|
|
1050
1051
|
resolvedTheme: i.resolvedTheme
|
|
1051
1052
|
});
|
|
1052
1053
|
if (!t.alreadyApplied) try {
|
|
1053
1054
|
i.setMode(t.mode);
|
|
1054
1055
|
} catch {}
|
|
1055
|
-
return u(
|
|
1056
|
+
return u(Wt(F, t, e.request.kind === "family"), {
|
|
1056
1057
|
kind: "theme",
|
|
1057
1058
|
mode: t.mode,
|
|
1058
1059
|
alreadyApplied: t.alreadyApplied
|
|
1059
1060
|
});
|
|
1060
1061
|
}
|
|
1061
1062
|
if (e.kind === "app-control") {
|
|
1062
|
-
let t =
|
|
1063
|
+
let t = $r(e.request, { voiceLive: n !== void 0 || tc.current });
|
|
1063
1064
|
if (!t) return !1;
|
|
1064
1065
|
let r = (e) => ({
|
|
1065
1066
|
kind: "app-control",
|
|
@@ -1067,34 +1068,34 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1067
1068
|
outcome: e.outcome,
|
|
1068
1069
|
...e.reply.code === "language" ? { languageLabel: e.reply.label } : {}
|
|
1069
1070
|
}), i = (t) => {
|
|
1070
|
-
if (e.request.control === "language" &&
|
|
1071
|
-
let n = s(), i = r(t), a = l(n, c(n, i),
|
|
1072
|
-
return
|
|
1071
|
+
if (e.request.control === "language" && No(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
|
|
1072
|
+
let n = s(), i = r(t), a = l(n, c(n, i), Gt((e, t) => t, t.reply), i, T(), !1);
|
|
1073
|
+
return ko.current = {
|
|
1073
1074
|
wanted: e.request.code,
|
|
1074
1075
|
reply: t.reply,
|
|
1075
1076
|
conversationId: n,
|
|
1076
1077
|
messageId: a,
|
|
1077
|
-
deadline: window.setTimeout(
|
|
1078
|
-
},
|
|
1078
|
+
deadline: window.setTimeout(Po, Kt)
|
|
1079
|
+
}, jo(a), !0;
|
|
1079
1080
|
}
|
|
1080
|
-
return u(
|
|
1081
|
+
return u(Gt(F, t.reply), r(t));
|
|
1081
1082
|
};
|
|
1082
1083
|
if (t.kind === "reply") return i(t.run);
|
|
1083
1084
|
if (t.kind === "run") {
|
|
1084
1085
|
let e = t.run();
|
|
1085
1086
|
return t.silent && (e.outcome === "done" || e.outcome === "already") ? !0 : i(e);
|
|
1086
1087
|
}
|
|
1087
|
-
let a =
|
|
1088
|
+
let a = is;
|
|
1088
1089
|
if (!a) return !1;
|
|
1089
1090
|
let o = null;
|
|
1090
|
-
return u(
|
|
1091
|
+
return u(Gt(F, t.ask.reply), r(t.ask), (e) => {
|
|
1091
1092
|
o = v.getState().conversations.find((t) => t.messages.some((t) => t.id === e))?.id ?? null;
|
|
1092
1093
|
}), a.request({
|
|
1093
1094
|
prompt: t.prompt,
|
|
1094
1095
|
onConfirm: () => {
|
|
1095
1096
|
let e = t.confirmed(), i = o, a = i !== null && v.getState().conversations.some((e) => e.id === i);
|
|
1096
1097
|
if (!i || !a) return;
|
|
1097
|
-
let s =
|
|
1098
|
+
let s = Gt(F, e.reply);
|
|
1098
1099
|
W(i, {
|
|
1099
1100
|
id: P(),
|
|
1100
1101
|
role: "assistant",
|
|
@@ -1110,23 +1111,23 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1110
1111
|
}), !0;
|
|
1111
1112
|
}
|
|
1112
1113
|
if (!a) return !1;
|
|
1113
|
-
if (e.kind === "choose-destination") return u(
|
|
1114
|
+
if (e.kind === "choose-destination") return u(Mt(F, e.candidates[0]?.label ?? e.query, e.candidates), {
|
|
1114
1115
|
kind: "choose-destination",
|
|
1115
1116
|
candidateIds: e.candidates.map((e) => e.id)
|
|
1116
|
-
}, (t) =>
|
|
1117
|
-
if (e.kind === "choose-linked") return u(
|
|
1117
|
+
}, (t) => Wr(t, e.candidates));
|
|
1118
|
+
if (e.kind === "choose-linked") return u(Nt(F, e.candidates), {
|
|
1118
1119
|
kind: "choose-destination",
|
|
1119
1120
|
candidateIds: e.candidates.map((e) => e.id)
|
|
1120
|
-
}, (t) =>
|
|
1121
|
+
}, (t) => Wr(t, e.candidates));
|
|
1121
1122
|
if (e.kind === "pick-from-list") {
|
|
1122
1123
|
let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
|
|
1123
|
-
return u(
|
|
1124
|
+
return u(Vt(F), t ? {
|
|
1124
1125
|
kind: "choose-destination",
|
|
1125
1126
|
candidateIds: t.map((e) => e.id)
|
|
1126
1127
|
} : e.candidateIds.length > 0 ? {
|
|
1127
1128
|
kind: "choose-destination",
|
|
1128
1129
|
candidateIds: [...e.candidateIds]
|
|
1129
|
-
} :
|
|
1130
|
+
} : Rr({
|
|
1130
1131
|
destinationId: "",
|
|
1131
1132
|
path: "",
|
|
1132
1133
|
alreadyHere: !1,
|
|
@@ -1135,9 +1136,9 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1135
1136
|
status: "refused",
|
|
1136
1137
|
reason: "not-routable"
|
|
1137
1138
|
}
|
|
1138
|
-
}), t ? (e) =>
|
|
1139
|
+
}), t ? (e) => Wr(e, t) : void 0);
|
|
1139
1140
|
}
|
|
1140
|
-
if (e.kind === "link-not-openable") return u(
|
|
1141
|
+
if (e.kind === "link-not-openable") return u(Ft(F), Rr({
|
|
1141
1142
|
destinationId: "",
|
|
1142
1143
|
path: "",
|
|
1143
1144
|
alreadyHere: !1,
|
|
@@ -1150,7 +1151,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1150
1151
|
if (e.kind === "open-record") {
|
|
1151
1152
|
let r;
|
|
1152
1153
|
try {
|
|
1153
|
-
let { options: t, navItems: n } = J.current, i = t.entityRoutes ?? [], a =
|
|
1154
|
+
let { options: t, navItems: n } = J.current, i = t.entityRoutes ?? [], a = Er(n);
|
|
1154
1155
|
r = (t.records ?? []).flatMap((t) => {
|
|
1155
1156
|
let n = i.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
|
|
1156
1157
|
return n && r && (n.visibleWith === void 0 || a.has(n.visibleWith)) ? [{
|
|
@@ -1163,18 +1164,18 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1163
1164
|
}
|
|
1164
1165
|
if (r.length === 0) return !1;
|
|
1165
1166
|
let i = v.getState().activeConversationId, a = P();
|
|
1166
|
-
|
|
1167
|
+
Fo.current = a, Lo(!0);
|
|
1167
1168
|
let s = () => {
|
|
1168
|
-
|
|
1169
|
+
Fo.current === a && (Fo.current = null, Y.current && Lo(!1));
|
|
1169
1170
|
};
|
|
1170
1171
|
return (async () => {
|
|
1171
1172
|
let a = { kind: "none" }, c = !0;
|
|
1172
1173
|
try {
|
|
1173
|
-
a = await
|
|
1174
|
+
a = await Dr({
|
|
1174
1175
|
name: e.request.name,
|
|
1175
1176
|
usable: r,
|
|
1176
|
-
nounOf: (e) =>
|
|
1177
|
-
timeoutMs:
|
|
1177
|
+
nounOf: (e) => Pt(F, e.noun),
|
|
1178
|
+
timeoutMs: ui
|
|
1178
1179
|
}), c = v.getState().conversations.some((e) => e.id === i);
|
|
1179
1180
|
} catch {
|
|
1180
1181
|
a = { kind: "none" };
|
|
@@ -1183,7 +1184,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1183
1184
|
}
|
|
1184
1185
|
if (!Y.current) return;
|
|
1185
1186
|
if (a.kind === "none") {
|
|
1186
|
-
|
|
1187
|
+
gs.current(t, [], {
|
|
1187
1188
|
fromPerson: !0,
|
|
1188
1189
|
...n === void 0 ? {} : { voiceSessionId: n },
|
|
1189
1190
|
localRecordsChecked: !0
|
|
@@ -1204,16 +1205,16 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1204
1205
|
return;
|
|
1205
1206
|
}
|
|
1206
1207
|
let l = a.candidates[0];
|
|
1207
|
-
u(a.why === "kinds" ?
|
|
1208
|
+
u(a.why === "kinds" ? Ut(F, a.nouns, a.candidates) : Ht(F, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
|
|
1208
1209
|
kind: "choose-destination",
|
|
1209
1210
|
candidateIds: a.candidates.map((e) => e.id)
|
|
1210
|
-
}, (e) =>
|
|
1211
|
+
}, (e) => Wr(e, a.candidates));
|
|
1211
1212
|
})().catch(() => void 0), !0;
|
|
1212
1213
|
}
|
|
1213
1214
|
if (e.kind === "back") {
|
|
1214
|
-
let e =
|
|
1215
|
+
let e = Ir.top();
|
|
1215
1216
|
if (!e) return !1;
|
|
1216
|
-
let t =
|
|
1217
|
+
let t = zr(jr(J.current.navItems), e.fromPath);
|
|
1217
1218
|
return d({
|
|
1218
1219
|
target: e.fromPath,
|
|
1219
1220
|
destinationId: t?.id ?? "",
|
|
@@ -1221,27 +1222,27 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1221
1222
|
via: "back",
|
|
1222
1223
|
pageLabel: () => t?.label ?? null,
|
|
1223
1224
|
onArrived: () => {
|
|
1224
|
-
|
|
1225
|
+
Ir.top() === e && Ir.pop();
|
|
1225
1226
|
}
|
|
1226
1227
|
});
|
|
1227
1228
|
}
|
|
1228
1229
|
let ee, p = e.destination;
|
|
1229
1230
|
if (e.via === "offer") {
|
|
1230
|
-
let t =
|
|
1231
|
-
if (!t.ok) return u(t.copy ??
|
|
1231
|
+
let t = Uo(e.offerId, e.destination.label);
|
|
1232
|
+
if (!t.ok) return u(t.copy ?? Rt(F), {
|
|
1232
1233
|
kind: "write-reply",
|
|
1233
1234
|
line: t.reason === "unavailable" ? "offer.notAvailable" : "offer.expired"
|
|
1234
1235
|
});
|
|
1235
1236
|
ee = {
|
|
1236
1237
|
trigger: e.trigger,
|
|
1237
1238
|
offerId: e.offerId
|
|
1238
|
-
}, p =
|
|
1239
|
+
}, p = jr(J.current.navItems).find((e) => e.id === t.target.id) ?? {
|
|
1239
1240
|
id: t.target.id,
|
|
1240
1241
|
label: t.target.label,
|
|
1241
1242
|
path: t.target.path
|
|
1242
1243
|
};
|
|
1243
1244
|
}
|
|
1244
|
-
return
|
|
1245
|
+
return Or(p, window.location.pathname + window.location.search, jr(J.current.navItems)) ? u(It(F, p.label, !0), Rr({
|
|
1245
1246
|
destinationId: p.id,
|
|
1246
1247
|
path: p.path,
|
|
1247
1248
|
alreadyHere: !0,
|
|
@@ -1258,51 +1259,51 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1258
1259
|
});
|
|
1259
1260
|
}, [
|
|
1260
1261
|
W,
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
cs,
|
|
1264
|
-
No,
|
|
1265
|
-
V,
|
|
1266
|
-
Wi,
|
|
1262
|
+
$a,
|
|
1263
|
+
is,
|
|
1267
1264
|
ls,
|
|
1268
|
-
|
|
1269
|
-
|
|
1265
|
+
Po,
|
|
1266
|
+
V,
|
|
1267
|
+
Gi,
|
|
1268
|
+
us,
|
|
1269
|
+
No,
|
|
1270
|
+
Co,
|
|
1270
1271
|
F,
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
]),
|
|
1275
|
-
|
|
1272
|
+
Uo,
|
|
1273
|
+
Go,
|
|
1274
|
+
Bo
|
|
1275
|
+
]), fs = O(async (e) => {
|
|
1276
|
+
La.current = !0;
|
|
1276
1277
|
try {
|
|
1277
1278
|
await G.declineForReply(e.conversationId, e.reason, e.origin);
|
|
1278
1279
|
} finally {
|
|
1279
|
-
|
|
1280
|
+
La.current = !1;
|
|
1280
1281
|
}
|
|
1281
1282
|
if (e.commandText !== null) {
|
|
1282
|
-
let t =
|
|
1283
|
-
if (t &&
|
|
1283
|
+
let t = Qo(e.commandText, e.options.voiceSessionId);
|
|
1284
|
+
if (t && ds(t, e.content, e.options.voiceSessionId)) return;
|
|
1284
1285
|
}
|
|
1285
|
-
await
|
|
1286
|
+
await gs.current(e.content, e.attachments, e.options);
|
|
1286
1287
|
}, [
|
|
1287
|
-
|
|
1288
|
-
|
|
1288
|
+
Qo,
|
|
1289
|
+
ds,
|
|
1289
1290
|
G
|
|
1290
1291
|
]), Z = O(async (e, t = [], n = {}) => {
|
|
1291
|
-
let r = n.voiceSessionId !== void 0, i = v.getState(), a = !1, o =
|
|
1292
|
-
if (r &&
|
|
1293
|
-
let e =
|
|
1292
|
+
let r = n.voiceSessionId !== void 0, i = v.getState(), a = !1, o = Xa.current;
|
|
1293
|
+
if (r && Ze(o)) {
|
|
1294
|
+
let e = nt(o, i.activeConversationId, eo());
|
|
1294
1295
|
if (e.kind === "gone") return;
|
|
1295
1296
|
let t = n.voiceEntry ?? e;
|
|
1296
|
-
t.kind === "adopt" &&
|
|
1297
|
+
t.kind === "adopt" && $a(t.conversationId), a = t.kind === "own", n = {
|
|
1297
1298
|
...n,
|
|
1298
1299
|
voiceEntry: t
|
|
1299
1300
|
};
|
|
1300
1301
|
}
|
|
1301
1302
|
let s = a ? null : i.activeConversationId, c = a ? null : i.activeConversationId ?? H;
|
|
1302
1303
|
if (c) {
|
|
1303
|
-
if (
|
|
1304
|
+
if (Ot(i.processingByConversationId[c]?.status)) {
|
|
1304
1305
|
let r = i.processingByConversationId[c]?.messageId ?? null;
|
|
1305
|
-
r && n.correctsInFlightTurn === !0 && !
|
|
1306
|
+
r && n.correctsInFlightTurn === !0 && !go.current.has(r) && yo(), r && go.current.has(r) && (_o.current = {
|
|
1306
1307
|
conversationId: c,
|
|
1307
1308
|
content: e,
|
|
1308
1309
|
attachments: t,
|
|
@@ -1310,27 +1311,27 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1310
1311
|
});
|
|
1311
1312
|
return;
|
|
1312
1313
|
}
|
|
1313
|
-
if (
|
|
1314
|
+
if (no.current.has(c)) return;
|
|
1314
1315
|
}
|
|
1315
|
-
if (
|
|
1316
|
-
let l = n.targetConversationId, f = p(), m = (e) =>
|
|
1316
|
+
if (Ia.current || h() !== null || La.current || Fo.current !== null) return;
|
|
1317
|
+
let l = n.targetConversationId, f = p(), m = (e) => Bn(e) || zn(e, f);
|
|
1317
1318
|
if (l !== void 0) {
|
|
1318
1319
|
let e = i.conversations.find((e) => e.id === l);
|
|
1319
1320
|
if (i.activeConversationId !== l || !e || e.mode !== i.mode || m(e)) return;
|
|
1320
1321
|
}
|
|
1321
1322
|
if (n.fromPerson && n.writeReplyBound === void 0) {
|
|
1322
|
-
let r = l ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", o =
|
|
1323
|
+
let r = l ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", o = ts(r, n.voiceSessionId), c = Dn({
|
|
1323
1324
|
text: e,
|
|
1324
|
-
locale: i === "spoken" ?
|
|
1325
|
+
locale: i === "spoken" ? Ni.input.code : V,
|
|
1325
1326
|
origin: i,
|
|
1326
1327
|
hasAttachments: t.length > 0,
|
|
1327
1328
|
live: G.liveFor(r),
|
|
1328
|
-
matchesLocalCommand: (e) =>
|
|
1329
|
+
matchesLocalCommand: (e) => Qo(e, n.voiceSessionId) !== null,
|
|
1329
1330
|
offer: o.state,
|
|
1330
|
-
offerAssent: o.state !== "none" &&
|
|
1331
|
+
offerAssent: o.state !== "none" && Nr({
|
|
1331
1332
|
text: e,
|
|
1332
1333
|
uiLocale: V,
|
|
1333
|
-
inputLocale:
|
|
1334
|
+
inputLocale: Ni.input.code,
|
|
1334
1335
|
commandLocales: J.current.options.commandLocales,
|
|
1335
1336
|
manifest: J.current.options.commandManifest,
|
|
1336
1337
|
leaveGuard: J.current.options.leaveGuard
|
|
@@ -1338,7 +1339,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1338
1339
|
});
|
|
1339
1340
|
if (c.kind === "accept_offer") {
|
|
1340
1341
|
let t = o.accept;
|
|
1341
|
-
if (t &&
|
|
1342
|
+
if (t && ds({
|
|
1342
1343
|
kind: "navigate",
|
|
1343
1344
|
destination: t.destination,
|
|
1344
1345
|
via: "offer",
|
|
@@ -1359,11 +1360,11 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1359
1360
|
};
|
|
1360
1361
|
}
|
|
1361
1362
|
if (c.kind === "local_reply") {
|
|
1362
|
-
r &&
|
|
1363
|
+
r && ns(r, e, c.line, c.values, n.voiceSessionId);
|
|
1363
1364
|
return;
|
|
1364
1365
|
}
|
|
1365
1366
|
let u = c.kind === "local" ? c.fallback : c.bound, d = c.declineAll;
|
|
1366
|
-
if (d !== null && r) return
|
|
1367
|
+
if (d !== null && r) return fs({
|
|
1367
1368
|
conversationId: r,
|
|
1368
1369
|
reason: d,
|
|
1369
1370
|
origin: i,
|
|
@@ -1382,49 +1383,49 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1382
1383
|
}
|
|
1383
1384
|
let te = n.writeReplyBound?.promptText ?? e;
|
|
1384
1385
|
if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
|
|
1385
|
-
let t =
|
|
1386
|
-
if (t &&
|
|
1386
|
+
let t = Qo(e, n.voiceSessionId, n.localRecordsChecked === !0);
|
|
1387
|
+
if (t && ds(t, e, n.voiceSessionId, a)) return;
|
|
1387
1388
|
}
|
|
1388
|
-
let ne = s ? i.conversations.find((e) => e.id === s) : void 0, ie = m(ne) ? void 0 : ne, g = i.autoRouting &&
|
|
1389
|
+
let ne = s ? i.conversations.find((e) => e.id === s) : void 0, ie = m(ne) ? void 0 : ne, g = i.autoRouting && Fa.current && l === void 0 ? ee({
|
|
1389
1390
|
intent: n.autoIntent ?? u(e),
|
|
1390
1391
|
dictated: r,
|
|
1391
|
-
voiceProposalBound: r &&
|
|
1392
|
+
voiceProposalBound: r && wi("api-calls") && oe(i.acknowledgedWriteModes, "api-calls"),
|
|
1392
1393
|
conversation: ie ? {
|
|
1393
1394
|
mode: ie.mode,
|
|
1394
1395
|
routedBy: ie.routedBy,
|
|
1395
|
-
hasHistory:
|
|
1396
|
+
hasHistory: Rn(ie)
|
|
1396
1397
|
} : null
|
|
1397
1398
|
}) : null;
|
|
1398
|
-
if (g &&
|
|
1399
|
-
|
|
1399
|
+
if (g && Da.current.find((e) => e.id === g.mode)?.writeCapable && !oe(i.acknowledgedWriteModes, g.mode)) {
|
|
1400
|
+
Ia.current = {
|
|
1400
1401
|
content: e,
|
|
1401
1402
|
attachments: t,
|
|
1402
1403
|
options: n
|
|
1403
|
-
},
|
|
1404
|
+
}, Ba(g.mode);
|
|
1404
1405
|
return;
|
|
1405
1406
|
}
|
|
1406
1407
|
let _ = g ? g.mode : i.mode, ae, ce, y = l ?? (a ? null : H), ue = y ? v.getState().conversations.find((e) => e.id === y) : void 0, de = g?.action === "escalate" && ie ? {
|
|
1407
1408
|
mode: ie.mode,
|
|
1408
1409
|
backendSessionId: ie.backendSessionId ?? null
|
|
1409
1410
|
} : null;
|
|
1410
|
-
if (g) g.action === "new" || !ie ? y =
|
|
1411
|
+
if (g) g.action === "new" || !ie ? y = Hi(void 0, _, { routedBy: "auto" }) : (y = ie.id, na(y, _));
|
|
1411
1412
|
else {
|
|
1412
1413
|
let e = i.autoRouting ? { routedBy: "auto" } : void 0;
|
|
1413
|
-
!y || m(ue) || ue && ue.mode !== _ &&
|
|
1414
|
+
!y || m(ue) || ue && ue.mode !== _ && Rn(ue) ? y = Hi(void 0, _, e) : ue && ue.mode !== _ && (e ? na(y, _) : Bi(y, _));
|
|
1414
1415
|
}
|
|
1415
1416
|
if (!y) return;
|
|
1416
|
-
r &&
|
|
1417
|
+
r && Xa.current !== void 0 && y !== i.activeConversationId && $a(y), n.approvalFollowUp || (to.current[y] = t);
|
|
1417
1418
|
let pe = () => v.getState().conversations.some((e) => e.id === y), b = T(), ye = {
|
|
1418
1419
|
accessToken: z(),
|
|
1419
|
-
workspaceToken:
|
|
1420
|
+
workspaceToken: Ti(),
|
|
1420
1421
|
userId: B,
|
|
1421
|
-
organizationId:
|
|
1422
|
+
organizationId: Et()
|
|
1422
1423
|
}, xe = (e, t) => {
|
|
1423
1424
|
pe() || !b || le(e, b, t, _, {
|
|
1424
1425
|
accessToken: z(),
|
|
1425
|
-
workspaceToken:
|
|
1426
|
+
workspaceToken: Ti(),
|
|
1426
1427
|
userId: B,
|
|
1427
|
-
organizationId:
|
|
1428
|
+
organizationId: Et()
|
|
1428
1429
|
});
|
|
1429
1430
|
}, Se = {
|
|
1430
1431
|
id: P(),
|
|
@@ -1432,7 +1433,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1432
1433
|
content: e,
|
|
1433
1434
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1434
1435
|
metadata: {
|
|
1435
|
-
...t.length ? { attachments: t.map(
|
|
1436
|
+
...t.length ? { attachments: t.map(lt) } : {},
|
|
1436
1437
|
...n.approvalFollowUp ? {
|
|
1437
1438
|
approvalFollowUp: !0,
|
|
1438
1439
|
approvedReplyId: n.approvalFollowUp.approvedReplyId
|
|
@@ -1441,7 +1442,7 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1441
1442
|
}
|
|
1442
1443
|
};
|
|
1443
1444
|
W(y, Se);
|
|
1444
|
-
let Ce = n.fromPerson === !0 && t.length === 0 && n.approvalFollowUp === void 0 && te === e ?
|
|
1445
|
+
let Ce = n.fromPerson === !0 && t.length === 0 && n.approvalFollowUp === void 0 && te === e ? Xr(e, r ? Ni.input.code : V) : null, Te = {
|
|
1445
1446
|
location: window.location.pathname + window.location.search,
|
|
1446
1447
|
conversationId: v.getState().activeConversationId,
|
|
1447
1448
|
workspaceId: T(),
|
|
@@ -1453,27 +1454,27 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1453
1454
|
content: "",
|
|
1454
1455
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1455
1456
|
metadata: {
|
|
1456
|
-
lang:
|
|
1457
|
+
lang: Ii,
|
|
1457
1458
|
...S(n.voiceSessionId)
|
|
1458
1459
|
}
|
|
1459
|
-
}),
|
|
1460
|
+
}), sn(x, {
|
|
1460
1461
|
channel: r ? "voice" : "chat",
|
|
1461
1462
|
mode: _,
|
|
1462
1463
|
product: I,
|
|
1463
|
-
language:
|
|
1464
|
-
device:
|
|
1464
|
+
language: Ii,
|
|
1465
|
+
device: cn(),
|
|
1465
1466
|
routedByAuto: !!g
|
|
1466
|
-
}, n.voiceTiming), D(x, "accepted"),
|
|
1467
|
+
}, n.voiceTiming), D(x, "accepted"), Ki(y, "provisioning", x, null), re(x);
|
|
1467
1468
|
let De = () => {
|
|
1468
|
-
let e =
|
|
1469
|
+
let e = kt({
|
|
1469
1470
|
turnId: x,
|
|
1470
|
-
abortRequested:
|
|
1471
|
+
abortRequested: go.current.has(x),
|
|
1471
1472
|
activeTurnId: v.getState().processingByConversationId[y]?.messageId ?? null,
|
|
1472
1473
|
conversationExists: pe()
|
|
1473
1474
|
});
|
|
1474
1475
|
return e.abandon && Ve(), e;
|
|
1475
|
-
}, Re = (e, t, r, i, a = !1, o =
|
|
1476
|
-
|
|
1476
|
+
}, Re = (e, t, r, i, a = !1, o = Ii) => {
|
|
1477
|
+
Wi(y, x, { content: we(e) }), Gi(y, x, {
|
|
1477
1478
|
lang: o,
|
|
1478
1479
|
...t?.length ? { artifacts: t } : {},
|
|
1479
1480
|
...t?.length || r || i ? { mode: _ } : {},
|
|
@@ -1495,9 +1496,9 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1495
1496
|
D(x, "attemptStarted");
|
|
1496
1497
|
let a = null, o = null, s = !1;
|
|
1497
1498
|
try {
|
|
1498
|
-
let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: ee, deadSandboxProbe: p, sessionPreopened: m } = await
|
|
1499
|
+
let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: ee, deadSandboxProbe: p, sessionPreopened: m } = await lo(y, x, _, b, ye, { isAbandoned: () => kt({
|
|
1499
1500
|
turnId: x,
|
|
1500
|
-
abortRequested:
|
|
1501
|
+
abortRequested: go.current.has(x),
|
|
1501
1502
|
activeTurnId: v.getState().processingByConversationId[y]?.messageId ?? null,
|
|
1502
1503
|
conversationExists: pe()
|
|
1503
1504
|
}).abandon });
|
|
@@ -1510,46 +1511,46 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1510
1511
|
}, se(_, ae, v.getState().acknowledgedWriteModes, {
|
|
1511
1512
|
dictated: r,
|
|
1512
1513
|
confirmsWrites: _e(_),
|
|
1513
|
-
proposalBound:
|
|
1514
|
+
proposalBound: wi(_, i)
|
|
1514
1515
|
}) === "voice-in-write-mode") throw new Oe("voice-in-write-mode", "Voice in a write mode");
|
|
1515
|
-
let ne =
|
|
1516
|
+
let ne = Qn({
|
|
1516
1517
|
conversation: v.getState().conversations.find((e) => e.id === y),
|
|
1517
1518
|
content: e,
|
|
1518
1519
|
sessionIsNew: l,
|
|
1519
1520
|
sendingMode: _,
|
|
1520
1521
|
sendingModeConfig: ae,
|
|
1521
|
-
modes:
|
|
1522
|
-
answerText: (e) =>
|
|
1522
|
+
modes: Da.current,
|
|
1523
|
+
answerText: (e) => nn(e).text
|
|
1523
1524
|
});
|
|
1524
|
-
if (He(),
|
|
1525
|
-
let e =
|
|
1525
|
+
if (He(), dr()) {
|
|
1526
|
+
let e = ur({
|
|
1526
1527
|
mint: () => ge(i, b, c, _, ye),
|
|
1527
1528
|
mark: (e) => D(x, e)
|
|
1528
1529
|
});
|
|
1529
|
-
C.stream = e, C.render =
|
|
1530
|
+
C.stream = e, C.render = tr({
|
|
1530
1531
|
stream: e,
|
|
1531
1532
|
conversationId: y,
|
|
1532
1533
|
messageId: x,
|
|
1533
|
-
build: (e, t) => we(
|
|
1534
|
+
build: (e, t) => we(Zt(e, t, { accumulateNarration: ce.accumulatesNarration }).content),
|
|
1534
1535
|
onFirstDelta: () => D(x, "firstDelta"),
|
|
1535
1536
|
onFirstVisible: () => D(x, "firstOutput")
|
|
1536
1537
|
});
|
|
1537
1538
|
}
|
|
1538
|
-
let h = await
|
|
1539
|
-
|
|
1540
|
-
let re =
|
|
1539
|
+
let h = await $t(() => he(i, b, c, _, ye, { limit: 50 }), l, Qt(u, i, c));
|
|
1540
|
+
so(y, x, "streaming", "thinking");
|
|
1541
|
+
let re = yi?.(), ie = On(v.getState().sandboxWriteCapabilities[i]), g = J.current, oe = Jr(i, c), le = g.options.uiCatalogue ? Gr(jr(g.navItems), {
|
|
1541
1542
|
permissionsSettled: g.navPermissionsSettled,
|
|
1542
1543
|
simulating: g.navSimulating,
|
|
1543
|
-
sentBefore:
|
|
1544
|
+
sentBefore: qr(oe)
|
|
1544
1545
|
}) : null, ue = {
|
|
1545
1546
|
conversationId: y,
|
|
1546
1547
|
writeReply: ie === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null,
|
|
1547
1548
|
...le ? { uiCatalogue: le } : {}
|
|
1548
|
-
}, { prompt: de, parts: ke } =
|
|
1549
|
+
}, { prompt: de, parts: ke } = bt({
|
|
1549
1550
|
content: ne ? `${ne}${te}` : te,
|
|
1550
1551
|
attachments: t,
|
|
1551
|
-
limits:
|
|
1552
|
-
wrapPrompt: (e) =>
|
|
1552
|
+
limits: ct(ae),
|
|
1553
|
+
wrapPrompt: (e) => bi?.(_, e, Pi, Fi, r, { writeApproval: ie }) ?? e,
|
|
1553
1554
|
requestBytes: (e, t) => ve({
|
|
1554
1555
|
sandboxId: i,
|
|
1555
1556
|
workspaceId: b,
|
|
@@ -1561,11 +1562,11 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1561
1562
|
authContext: ye,
|
|
1562
1563
|
...ue
|
|
1563
1564
|
})
|
|
1564
|
-
}), Ae =
|
|
1565
|
-
s =
|
|
1565
|
+
}), Ae = ot(ke), je = Ae > 0;
|
|
1566
|
+
s = at(t) > Ae;
|
|
1566
1567
|
let Ne = De();
|
|
1567
1568
|
if (Ne.abandon) {
|
|
1568
|
-
Ne.clearProcessing &&
|
|
1569
|
+
Ne.clearProcessing && qi(y);
|
|
1569
1570
|
return;
|
|
1570
1571
|
}
|
|
1571
1572
|
try {
|
|
@@ -1574,10 +1575,10 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1574
1575
|
...ue
|
|
1575
1576
|
} : ue);
|
|
1576
1577
|
} catch (e) {
|
|
1577
|
-
if (!ke || !
|
|
1578
|
+
if (!ke || !hn(e)) throw e;
|
|
1578
1579
|
await be(i, b, c, de, _, re, ye, ue), s ||= je;
|
|
1579
1580
|
}
|
|
1580
|
-
le &&
|
|
1581
|
+
le && Kr(oe);
|
|
1581
1582
|
let Fe = v.getState().sandboxWriteCapabilities[i], Ie = g.options.uiOffers === !0 && Ee(Fe) ? B : null, S = !!Ie;
|
|
1582
1583
|
Ie && X.recordTurn({
|
|
1583
1584
|
replyId: x,
|
|
@@ -1590,12 +1591,12 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1590
1591
|
floorMs: h
|
|
1591
1592
|
});
|
|
1592
1593
|
let We = S ? (e, t) => {
|
|
1593
|
-
X.receive(x, e, t, performance.now()) &&
|
|
1594
|
-
} : void 0, Ge = (e) =>
|
|
1594
|
+
X.receive(x, e, t, performance.now()) && Bo();
|
|
1595
|
+
} : void 0, Ge = (e) => Wi(y, x, { content: e }), Ke = (e) => s ? `${e}\n\n${F("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;
|
|
1595
1596
|
D(x, "promptSent");
|
|
1596
|
-
let Je = null, Ye = !1, Xe =
|
|
1597
|
+
let Je = null, Ye = !1, Xe = Xt, w = Zt([], h);
|
|
1597
1598
|
C.render?.arm(h);
|
|
1598
|
-
let Ze = Date.now() + ce.streamBudgetMs, Qe = Date.now(), $e = Date.now(), et =
|
|
1599
|
+
let Ze = Date.now() + ce.streamBudgetMs, Qe = Date.now(), $e = Date.now(), et = fr(() => he(i, b, c, _, ye, {
|
|
1599
1600
|
limit: 50,
|
|
1600
1601
|
sinceMs: h,
|
|
1601
1602
|
surfaceTurnTerminal: !0,
|
|
@@ -1605,18 +1606,18 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1605
1606
|
xe(i, c);
|
|
1606
1607
|
let e = De();
|
|
1607
1608
|
if (e.abandon) {
|
|
1608
|
-
e.clearProcessing &&
|
|
1609
|
+
e.clearProcessing && qi(y);
|
|
1609
1610
|
return;
|
|
1610
1611
|
}
|
|
1611
1612
|
let t = await et.next();
|
|
1612
|
-
if (S && X.observeMessages(x, t) &&
|
|
1613
|
+
if (S && X.observeMessages(x, t) && Bo(), w = Zt(t, h, { accumulateNarration: ce.accumulatesNarration }), Wi(y, x, { content: we(w.content) }), w.hasRenderableOutput ? Ye || (Ye = !0, Je !== null && D(x, "lastQuietPoll", Je), D(x, "firstOutput")) : Je = un(), ce.accumulatesNarration) w.hasText && D(x, "firstText");
|
|
1613
1614
|
else {
|
|
1614
|
-
let e =
|
|
1615
|
+
let e = tn(Xe, w, un());
|
|
1615
1616
|
Xe = e.tracker, e.confirmedAt !== null && D(x, "firstText", e.confirmedAt);
|
|
1616
1617
|
}
|
|
1617
|
-
if (w.pendingWrite && !
|
|
1618
|
+
if (w.pendingWrite && !En(v.getState().sandboxWriteCapabilities[i]) && Gi(y, x, { pendingWrite: w.pendingWrite }), w.done && (C.stream ? E(x, {
|
|
1618
1619
|
transport: C.stream.reachedOpen ? "sse" : "poll",
|
|
1619
|
-
live:
|
|
1620
|
+
live: er(C.stream.live)
|
|
1620
1621
|
}) : E(x, {
|
|
1621
1622
|
transport: "poll",
|
|
1622
1623
|
live: "none"
|
|
@@ -1625,18 +1626,18 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1625
1626
|
break;
|
|
1626
1627
|
}
|
|
1627
1628
|
if (C.render?.refresh(t), Date.now() - Qe > 3e4 && (await fe(i, b, 600, ye).catch(() => void 0), Qe = Date.now()), !et.hasPending()) {
|
|
1628
|
-
let e =
|
|
1629
|
+
let e = qe(Date.now() - $e);
|
|
1629
1630
|
C.stream ? await C.stream.waitWake(e) : await new Promise((t) => setTimeout(t, e));
|
|
1630
1631
|
}
|
|
1631
1632
|
}
|
|
1632
1633
|
if (tt?.(), He(), w.done && n.voiceSessionId !== void 0 && !De().abandon) {
|
|
1633
|
-
let e = we(
|
|
1634
|
+
let e = we(Ke(w.content));
|
|
1634
1635
|
e.trim() && (s && Ge(e), D(x, "speechQueued"), Ue = !0, Be.publish(x, {
|
|
1635
1636
|
conversationId: y,
|
|
1636
1637
|
channel: "voice",
|
|
1637
1638
|
voiceSessionId: n.voiceSessionId,
|
|
1638
1639
|
text: e,
|
|
1639
|
-
lang:
|
|
1640
|
+
lang: Ii,
|
|
1640
1641
|
final: !0
|
|
1641
1642
|
}));
|
|
1642
1643
|
}
|
|
@@ -1646,22 +1647,22 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1646
1647
|
content: Le(w.content, _, F, ae)
|
|
1647
1648
|
}), s && (w = {
|
|
1648
1649
|
...w,
|
|
1649
|
-
content:
|
|
1650
|
+
content: Ke(w.content)
|
|
1650
1651
|
});
|
|
1651
1652
|
let rt = !w.done;
|
|
1652
|
-
Re(w.content, nt, c, i, rt), w.tokens && (
|
|
1653
|
+
Re(w.content, nt, c, i, rt), w.tokens && (Wi(y, x, { tokens: w.tokens }), (Si ? await Pe({
|
|
1653
1654
|
workspaceId: b,
|
|
1654
1655
|
sessionId: c,
|
|
1655
1656
|
messageId: w.messageId,
|
|
1656
1657
|
model: w.model,
|
|
1657
1658
|
tokens: w.tokens
|
|
1658
|
-
},
|
|
1659
|
-
let
|
|
1660
|
-
if (
|
|
1661
|
-
|
|
1659
|
+
}, Si, { ledger: Me("panel", I) }) : { ok: !0 }).ok && ti(I)), w.done || xe(i, c);
|
|
1660
|
+
let it = De();
|
|
1661
|
+
if (it.abandon) {
|
|
1662
|
+
it.clearProcessing && qi(y);
|
|
1662
1663
|
return;
|
|
1663
1664
|
}
|
|
1664
|
-
D(x, "complete"), E(x, { outcome: "answered" }),
|
|
1665
|
+
D(x, "complete"), E(x, { outcome: "answered" }), Ki(y, "complete", x, null), Un.recordCommittedEntries(y, [Se.id, x], "TURN", b), Ue = !1, S && Ce && w.done && Xo({
|
|
1665
1666
|
replyId: x,
|
|
1666
1667
|
conversationId: y,
|
|
1667
1668
|
voiceSessionId: n.voiceSessionId,
|
|
@@ -1670,404 +1671,401 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
1670
1671
|
});
|
|
1671
1672
|
} catch (e) {
|
|
1672
1673
|
K.current.invalidate(a ?? v.getState().sandboxesByMode[_]?.sandboxId ?? null);
|
|
1673
|
-
let t =
|
|
1674
|
+
let t = kt({
|
|
1674
1675
|
turnId: x,
|
|
1675
|
-
abortRequested:
|
|
1676
|
+
abortRequested: go.current.has(x),
|
|
1676
1677
|
activeTurnId: v.getState().processingByConversationId[y]?.messageId ?? null,
|
|
1677
1678
|
conversationExists: pe()
|
|
1678
1679
|
});
|
|
1679
1680
|
if (Ve(), a && o && xe(a, o), t.abandon) {
|
|
1680
|
-
t.clearProcessing &&
|
|
1681
|
+
t.clearProcessing && qi(y);
|
|
1681
1682
|
return;
|
|
1682
1683
|
}
|
|
1683
|
-
if (i === 1 &&
|
|
1684
|
+
if (i === 1 && gn(e)) {
|
|
1684
1685
|
let e = a ?? v.getState().sandboxesByMode[_]?.sandboxId ?? null;
|
|
1685
|
-
return e && (q.current.add(e), K.current.invalidate(e)),
|
|
1686
|
+
return e && (q.current.add(e), K.current.invalidate(e)), Yi(y), Zi(_), Ui(y, x, ""), Gi(y, x, { pendingWrite: void 0 }), e && G.retireSandbox(e), He(), We(), ln(x), Ge(2);
|
|
1686
1687
|
}
|
|
1687
1688
|
throw e;
|
|
1688
1689
|
}
|
|
1689
|
-
},
|
|
1690
|
-
|
|
1690
|
+
}, Ke = y;
|
|
1691
|
+
no.current.add(Ke);
|
|
1691
1692
|
try {
|
|
1692
1693
|
if (!b) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
|
|
1693
1694
|
code: "UNAUTHENTICATED",
|
|
1694
1695
|
authFailure: "WORKSPACE_CONTEXT_MISSING"
|
|
1695
1696
|
} });
|
|
1696
|
-
let e = await
|
|
1697
|
+
let e = await yt(_, () => Da.current.find((e) => e.id === _), Ea);
|
|
1697
1698
|
ae = e.config, ce = e.capabilities;
|
|
1698
1699
|
let t = ae, n = De();
|
|
1699
1700
|
if (n.abandon) {
|
|
1700
|
-
n.clearProcessing &&
|
|
1701
|
+
n.clearProcessing && qi(y);
|
|
1701
1702
|
return;
|
|
1702
1703
|
}
|
|
1703
1704
|
let i = se(_, t, v.getState().acknowledgedWriteModes, {
|
|
1704
1705
|
dictated: r,
|
|
1705
1706
|
confirmsWrites: _e(_),
|
|
1706
|
-
proposalBound:
|
|
1707
|
+
proposalBound: wi(_)
|
|
1707
1708
|
});
|
|
1708
1709
|
if (i) throw new Oe(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
|
|
1709
1710
|
let a = Me("panel", I);
|
|
1710
|
-
if (
|
|
1711
|
-
let e = await Fe(a, b,
|
|
1711
|
+
if (Si && Ne(a, b)) {
|
|
1712
|
+
let e = await Fe(a, b, Si);
|
|
1712
1713
|
if (!e.ok) throw Ie(e.kind);
|
|
1713
1714
|
let t = De();
|
|
1714
1715
|
if (t.abandon) {
|
|
1715
|
-
t.clearProcessing &&
|
|
1716
|
+
t.clearProcessing && qi(y);
|
|
1716
1717
|
return;
|
|
1717
1718
|
}
|
|
1718
1719
|
}
|
|
1719
1720
|
D(x, "cleared"), await Ge();
|
|
1720
1721
|
} catch (e) {
|
|
1721
1722
|
if (K.current.invalidate(v.getState().sandboxesByMode[_]?.sandboxId ?? null), !pe()) {
|
|
1722
|
-
|
|
1723
|
+
qi(y);
|
|
1723
1724
|
return;
|
|
1724
1725
|
}
|
|
1725
1726
|
let t = ze.session?.sandboxId ?? null, r = ke(e, { confirmsNoAction: Ae({
|
|
1726
1727
|
mode: _,
|
|
1727
1728
|
capabilities: t ? v.getState().sandboxWriteCapabilities[t] : null
|
|
1728
1729
|
}) });
|
|
1729
|
-
E(x, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade &&
|
|
1730
|
+
E(x, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && ei(I, "sandbox");
|
|
1730
1731
|
let i = je(r, F, { locale: V });
|
|
1731
|
-
|
|
1732
|
+
Ki(y, "error", x, i.headline), Wi(y, x, { content: i.text }), Gi(y, x, {
|
|
1732
1733
|
lang: i.translated ? V : "en",
|
|
1733
1734
|
...S(n.voiceSessionId)
|
|
1734
1735
|
});
|
|
1735
1736
|
} finally {
|
|
1736
|
-
|
|
1737
|
-
let e = v.getState(), t = d(de, _, e.conversations.find((e) => e.id ===
|
|
1738
|
-
t && (
|
|
1737
|
+
no.current.delete(Ke), E(x, { outcome: "stopped" }), D(x, "complete"), We(), He();
|
|
1738
|
+
let e = v.getState(), t = d(de, _, e.conversations.find((e) => e.id === Ke), (t) => !!e.sandboxesByMode[t]?.sandboxId);
|
|
1739
|
+
t && (na(Ke, t.mode), t.backendSessionId && Ji(Ke, t.backendSessionId)), ze.session && pe() && G.afterTurn({
|
|
1739
1740
|
...ze.session,
|
|
1740
|
-
conversationId:
|
|
1741
|
+
conversationId: Ke
|
|
1741
1742
|
}, x);
|
|
1742
|
-
let n =
|
|
1743
|
-
|
|
1743
|
+
let n = _o.current;
|
|
1744
|
+
_o.current = null, n && n.conversationId === Ke && pe() && gs.current(n.content, n.attachments, n.options);
|
|
1744
1745
|
}
|
|
1745
1746
|
}, [
|
|
1746
1747
|
H,
|
|
1747
1748
|
W,
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1749
|
+
bi,
|
|
1750
|
+
Yi,
|
|
1751
|
+
Zi,
|
|
1752
|
+
Li,
|
|
1753
|
+
Hi,
|
|
1754
|
+
lo,
|
|
1754
1755
|
G,
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1756
|
+
yo,
|
|
1757
|
+
ns,
|
|
1758
|
+
fs,
|
|
1758
1759
|
V,
|
|
1759
|
-
|
|
1760
|
-
Ci,
|
|
1761
|
-
vi,
|
|
1762
|
-
z,
|
|
1760
|
+
Ni,
|
|
1763
1761
|
wi,
|
|
1764
|
-
|
|
1762
|
+
yi,
|
|
1763
|
+
z,
|
|
1764
|
+
Ti,
|
|
1765
|
+
Wi,
|
|
1765
1766
|
I,
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
Pi,
|
|
1769
|
-
V,
|
|
1767
|
+
Ea,
|
|
1768
|
+
Si,
|
|
1770
1769
|
Fi,
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1770
|
+
V,
|
|
1771
|
+
Ii,
|
|
1772
|
+
Pi,
|
|
1773
|
+
na,
|
|
1774
|
+
ds,
|
|
1775
|
+
Qo,
|
|
1776
1776
|
$a,
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1777
|
+
eo,
|
|
1778
|
+
Ji,
|
|
1779
|
+
Bi,
|
|
1780
1780
|
Ki,
|
|
1781
|
+
qi,
|
|
1781
1782
|
F,
|
|
1782
|
-
|
|
1783
|
-
|
|
1783
|
+
so,
|
|
1784
|
+
Ui,
|
|
1784
1785
|
B,
|
|
1785
1786
|
X,
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
]),
|
|
1787
|
+
Bo,
|
|
1788
|
+
ts,
|
|
1789
|
+
Xo
|
|
1790
|
+
]), ps = O((e, t) => {
|
|
1790
1791
|
Z(e, [], t ? { autoIntent: t } : {});
|
|
1791
|
-
}, [Z]),
|
|
1792
|
-
let e = [...
|
|
1792
|
+
}, [Z]), ms = Dt(), hs = O(() => {
|
|
1793
|
+
let e = [...ia.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
|
|
1793
1794
|
if (!e || e.metadata?.approvalFollowUp) return;
|
|
1794
|
-
let t = H ?
|
|
1795
|
-
if (t.some((e) =>
|
|
1795
|
+
let t = H ? to.current[H] ?? [] : [];
|
|
1796
|
+
if (t.some((e) => St(e, Date.now()))) {
|
|
1796
1797
|
let n = H ?? void 0;
|
|
1797
|
-
|
|
1798
|
+
Ct(t, ms).then((t) => {
|
|
1798
1799
|
Z(e.content, t, n === void 0 ? void 0 : { targetConversationId: n });
|
|
1799
1800
|
});
|
|
1800
1801
|
return;
|
|
1801
1802
|
}
|
|
1802
1803
|
Z(e.content, t);
|
|
1803
1804
|
}, [
|
|
1804
|
-
|
|
1805
|
+
aa,
|
|
1805
1806
|
Z,
|
|
1806
1807
|
H,
|
|
1807
|
-
|
|
1808
|
-
]),
|
|
1808
|
+
ms
|
|
1809
|
+
]), gs = j(Z);
|
|
1809
1810
|
k(() => {
|
|
1810
|
-
|
|
1811
|
+
gs.current = Z;
|
|
1811
1812
|
}, [Z]);
|
|
1812
|
-
let
|
|
1813
|
-
if (
|
|
1814
|
-
for (let e =
|
|
1815
|
-
let t =
|
|
1813
|
+
let _s = A(() => {
|
|
1814
|
+
if (sa) return null;
|
|
1815
|
+
for (let e = aa.length - 1; e >= 0; --e) {
|
|
1816
|
+
let t = aa[e];
|
|
1816
1817
|
if (t?.role !== "assistant") continue;
|
|
1817
|
-
if (t.id ===
|
|
1818
|
-
if (!ze(t) ||
|
|
1819
|
-
let n =
|
|
1818
|
+
if (t.id === Ao) return null;
|
|
1819
|
+
if (!ze(t) || go.current.has(t.id) || He(t.id)) continue;
|
|
1820
|
+
let n = Yt(t, oa, F);
|
|
1820
1821
|
if (n.kind !== "output") return null;
|
|
1821
|
-
let r =
|
|
1822
|
-
return r ?
|
|
1823
|
-
id: t.id,
|
|
1824
|
-
text: r
|
|
1825
|
-
} : null;
|
|
1822
|
+
let r = nn(n.text).text.trim();
|
|
1823
|
+
return r ? Ve(t, r, oa) : null;
|
|
1826
1824
|
}
|
|
1827
1825
|
return null;
|
|
1828
1826
|
}, [
|
|
1829
|
-
ia,
|
|
1830
|
-
oa,
|
|
1831
1827
|
aa,
|
|
1832
|
-
|
|
1828
|
+
sa,
|
|
1829
|
+
oa,
|
|
1830
|
+
Ao,
|
|
1833
1831
|
F
|
|
1834
|
-
]),
|
|
1835
|
-
sessionId:
|
|
1836
|
-
sandboxId:
|
|
1832
|
+
]), vs = A(() => _s ? Je(_s.text) : null, [_s]), ys = A(() => ia.chat.filter((e) => e.id !== Ao), [ia.chat, Ao]), bs = v((e) => ce(e)?.sandboxId ?? null), xs = g(ys, {
|
|
1833
|
+
sessionId: ra?.backendSessionId,
|
|
1834
|
+
sandboxId: bs,
|
|
1837
1835
|
nowMs: Date.now()
|
|
1838
|
-
}),
|
|
1839
|
-
if (
|
|
1836
|
+
}), Ss = _(ys), Cs = (e) => {
|
|
1837
|
+
if (Tn(e.metadata).length > 0) return !0;
|
|
1840
1838
|
let t = e.metadata?.sandboxId;
|
|
1841
|
-
return
|
|
1842
|
-
},
|
|
1843
|
-
let t =
|
|
1844
|
-
return t.length === 0 || !H ? null : /* @__PURE__ */ N(
|
|
1839
|
+
return En(t ? ua[t] : null);
|
|
1840
|
+
}, ws = (e) => {
|
|
1841
|
+
let t = Tn(e.metadata);
|
|
1842
|
+
return t.length === 0 || !H ? null : /* @__PURE__ */ N(wn, {
|
|
1845
1843
|
refs: t,
|
|
1846
1844
|
conversationId: H,
|
|
1847
1845
|
panel: G,
|
|
1848
|
-
entries:
|
|
1849
|
-
capabilitiesOf: (e) =>
|
|
1850
|
-
turnInFlight:
|
|
1846
|
+
entries: da,
|
|
1847
|
+
capabilitiesOf: (e) => ua[e],
|
|
1848
|
+
turnInFlight: sa,
|
|
1851
1849
|
tr: F,
|
|
1852
|
-
onReview:
|
|
1853
|
-
retiredSandboxes:
|
|
1850
|
+
onReview: pa.review,
|
|
1851
|
+
retiredSandboxes: fa
|
|
1854
1852
|
});
|
|
1855
|
-
},
|
|
1853
|
+
}, Ts = (e) => {
|
|
1856
1854
|
if (!H) return null;
|
|
1857
1855
|
let t = X.liveOffersFor(e, {
|
|
1858
1856
|
registry: {
|
|
1859
|
-
destinations:
|
|
1860
|
-
permissionsSettled:
|
|
1861
|
-
simulating:
|
|
1857
|
+
destinations: jr(To),
|
|
1858
|
+
permissionsSettled: Eo,
|
|
1859
|
+
simulating: Do
|
|
1862
1860
|
},
|
|
1863
1861
|
actorId: B,
|
|
1864
1862
|
conversationId: H,
|
|
1865
1863
|
perfNow: performance.now()
|
|
1866
1864
|
}), n = t[0];
|
|
1867
|
-
return n ? /* @__PURE__ */ N(
|
|
1865
|
+
return n ? /* @__PURE__ */ N(rr, {
|
|
1868
1866
|
offers: t.map(({ offer: e, target: t }) => ({
|
|
1869
1867
|
offerId: e.offerId,
|
|
1870
1868
|
label: t.label,
|
|
1871
1869
|
path: t.path
|
|
1872
1870
|
})),
|
|
1873
1871
|
hint: t.length === 1 && R === "proposal-v1" ? x(n.offer, X.turnFor(e)) : "link",
|
|
1874
|
-
onOpen:
|
|
1872
|
+
onOpen: Yo
|
|
1875
1873
|
}, n.offer.offerId) : null;
|
|
1876
|
-
},
|
|
1874
|
+
}, Es = (e) => e.role === "assistant" ? Ts(e.id) : null;
|
|
1877
1875
|
k(() => {
|
|
1878
1876
|
let e = X.nextExpiryInMs(performance.now());
|
|
1879
1877
|
if (e === null) return;
|
|
1880
|
-
let t = window.setTimeout(
|
|
1878
|
+
let t = window.setTimeout(Bo, e + 1);
|
|
1881
1879
|
return () => window.clearTimeout(t);
|
|
1882
1880
|
}, [
|
|
1883
1881
|
X,
|
|
1884
|
-
|
|
1885
|
-
|
|
1882
|
+
Ro,
|
|
1883
|
+
Bo
|
|
1886
1884
|
]);
|
|
1887
|
-
let
|
|
1885
|
+
let Ds = pa.dialog.view ? da[pa.dialog.view.proposalId] : void 0, Os = xs?.expiresAtMs ?? null;
|
|
1888
1886
|
k(() => {
|
|
1889
|
-
if (
|
|
1890
|
-
let e = window.setTimeout(() =>
|
|
1887
|
+
if (Os === null) return;
|
|
1888
|
+
let e = window.setTimeout(() => ho((e) => e + 1), Math.max(0, Os - Date.now()));
|
|
1891
1889
|
return () => window.clearTimeout(e);
|
|
1892
|
-
}, [
|
|
1893
|
-
let Q = A(() =>
|
|
1890
|
+
}, [Os, mo]);
|
|
1891
|
+
let Q = A(() => ia.voice.filter((e) => e.id !== Ao && (e.role === "user" || e.role === "assistant")).map((e) => ({
|
|
1894
1892
|
id: e.id,
|
|
1895
1893
|
role: e.role,
|
|
1896
|
-
text:
|
|
1894
|
+
text: on(e, oa, F),
|
|
1897
1895
|
sessionId: C(e),
|
|
1898
1896
|
timestamp: e.timestamp
|
|
1899
1897
|
})).filter((e) => e.text.length > 0), [
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1898
|
+
ia.voice,
|
|
1899
|
+
oa,
|
|
1900
|
+
Ao,
|
|
1903
1901
|
F
|
|
1904
|
-
]),
|
|
1902
|
+
]), ks = O(() => {
|
|
1905
1903
|
if (Q.length === 0) return;
|
|
1906
1904
|
let e = /* @__PURE__ */ new Date();
|
|
1907
|
-
|
|
1905
|
+
Ln(Ge(Q, {
|
|
1908
1906
|
title: F("voiceSession.transcript", "Voice conversation"),
|
|
1909
1907
|
savedAt: F("voiceSession.savedAt", "Saved"),
|
|
1910
1908
|
session: F("voiceSession.sessionLabel", "Session"),
|
|
1911
1909
|
earlier: F("voiceSession.earlierLabel", "Earlier"),
|
|
1912
1910
|
you: F("voiceSession.speakerYou", "You"),
|
|
1913
1911
|
assistant: F("voiceSession.speakerAssistant", "Assistant")
|
|
1914
|
-
}, e),
|
|
1912
|
+
}, e), Ke(I, e), "text/markdown");
|
|
1915
1913
|
}, [
|
|
1916
1914
|
I,
|
|
1917
1915
|
Q,
|
|
1918
1916
|
F
|
|
1919
|
-
]),
|
|
1920
|
-
|
|
1921
|
-
let [
|
|
1917
|
+
]), As = ni({ perFileChars: Ra }), js = j(As);
|
|
1918
|
+
js.current = As;
|
|
1919
|
+
let [Ms, Ns] = M(null), Ps = Ms === null ? null : F("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: Ms });
|
|
1922
1920
|
k(() => {
|
|
1923
|
-
if (
|
|
1924
|
-
let e = window.setTimeout(() =>
|
|
1921
|
+
if (Ms === null) return;
|
|
1922
|
+
let e = window.setTimeout(() => Ns(null), pi);
|
|
1925
1923
|
return () => window.clearTimeout(e);
|
|
1926
|
-
}, [
|
|
1927
|
-
let
|
|
1924
|
+
}, [Ms]);
|
|
1925
|
+
let Fs = j(/* @__PURE__ */ new Set()), Is = j(() => !1), $ = mn({
|
|
1928
1926
|
onSubmit: O((e, t, n, r) => {
|
|
1929
|
-
let i =
|
|
1927
|
+
let i = Xa.current, a = it(i), o = () => {
|
|
1930
1928
|
let e = v.getState();
|
|
1931
|
-
return
|
|
1932
|
-
sessionLive:
|
|
1929
|
+
return Qe({
|
|
1930
|
+
sessionLive: Is.current(t),
|
|
1933
1931
|
boundAtSubmit: i,
|
|
1934
1932
|
activeConversationId: e.activeConversationId,
|
|
1935
1933
|
boundConversationExists: e.conversations.some((e) => e.id === a)
|
|
1936
1934
|
});
|
|
1937
1935
|
}, s = () => {
|
|
1938
|
-
let i =
|
|
1939
|
-
|
|
1936
|
+
let i = js.current;
|
|
1937
|
+
Tt({
|
|
1940
1938
|
draft: i,
|
|
1941
1939
|
maySend: o,
|
|
1942
|
-
budgetMs:
|
|
1940
|
+
budgetMs: wt,
|
|
1943
1941
|
sendTurn: (i) => {
|
|
1944
1942
|
let a = {
|
|
1945
1943
|
...n,
|
|
1946
|
-
handedOver:
|
|
1944
|
+
handedOver: un()
|
|
1947
1945
|
};
|
|
1948
|
-
|
|
1946
|
+
gs.current(e, i, {
|
|
1949
1947
|
fromPerson: !0,
|
|
1950
1948
|
voiceSessionId: t,
|
|
1951
1949
|
voiceTiming: a,
|
|
1952
1950
|
...r.correction ? { correctsInFlightTurn: !0 } : {}
|
|
1953
1951
|
});
|
|
1954
1952
|
},
|
|
1955
|
-
announceDropped: (e) =>
|
|
1953
|
+
announceDropped: (e) => Ns(e)
|
|
1956
1954
|
});
|
|
1957
1955
|
};
|
|
1958
|
-
if (o() &&
|
|
1959
|
-
|
|
1956
|
+
if (o() && es.current(e, t)) {
|
|
1957
|
+
gs.current(e, [], {
|
|
1960
1958
|
fromPerson: !0,
|
|
1961
1959
|
voiceSessionId: t,
|
|
1962
1960
|
voiceTiming: {
|
|
1963
1961
|
...n,
|
|
1964
|
-
handedOver:
|
|
1962
|
+
handedOver: un()
|
|
1965
1963
|
}
|
|
1966
1964
|
});
|
|
1967
1965
|
return;
|
|
1968
1966
|
}
|
|
1969
|
-
if (!
|
|
1967
|
+
if (!js.current.isBusy) {
|
|
1970
1968
|
s();
|
|
1971
1969
|
return;
|
|
1972
1970
|
}
|
|
1973
|
-
let c = Date.now(), l =
|
|
1974
|
-
let e =
|
|
1975
|
-
|
|
1971
|
+
let c = Date.now(), l = Fs.current, u = window.setInterval(() => {
|
|
1972
|
+
let e = js.current.isBusy;
|
|
1973
|
+
js.current.isCommitting || e && Date.now() - c < fi || (window.clearInterval(u), l.delete(u), s());
|
|
1976
1974
|
}, 200);
|
|
1977
1975
|
l.add(u);
|
|
1978
1976
|
}, []),
|
|
1979
|
-
latestReply:
|
|
1980
|
-
language:
|
|
1981
|
-
graceMs:
|
|
1982
|
-
onSupersede:
|
|
1983
|
-
handsFreeStreamNoticeAccepted:
|
|
1984
|
-
onAcceptHandsFreeStreamNotice:
|
|
1985
|
-
handsFreeInterrupt:
|
|
1986
|
-
onBargeIn:
|
|
1977
|
+
latestReply: _s,
|
|
1978
|
+
language: Ye(ji, V).tag,
|
|
1979
|
+
graceMs: Di,
|
|
1980
|
+
onSupersede: bo,
|
|
1981
|
+
handsFreeStreamNoticeAccepted: ki,
|
|
1982
|
+
onAcceptHandsFreeStreamNotice: Ai,
|
|
1983
|
+
handsFreeInterrupt: Oi,
|
|
1984
|
+
onBargeIn: yo
|
|
1987
1985
|
});
|
|
1988
|
-
|
|
1989
|
-
let
|
|
1986
|
+
Is.current = $.isCurrentSession;
|
|
1987
|
+
let Ls = Za ? Q.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Q, Rs = $.answerLocally;
|
|
1990
1988
|
k(() => {
|
|
1991
|
-
|
|
1992
|
-
}, [
|
|
1993
|
-
let
|
|
1994
|
-
|
|
1989
|
+
os.current = Rs;
|
|
1990
|
+
}, [Rs]);
|
|
1991
|
+
let zs = $.active, Bs = A(() => ht(Object.values(da), H, fa), [
|
|
1992
|
+
da,
|
|
1995
1993
|
H,
|
|
1996
|
-
|
|
1997
|
-
]), [
|
|
1994
|
+
fa
|
|
1995
|
+
]), [Vs, Hs] = M(null);
|
|
1998
1996
|
k(() => {
|
|
1999
|
-
|
|
2000
|
-
}, [
|
|
2001
|
-
let
|
|
2002
|
-
let e =
|
|
1997
|
+
zs || Hs(null);
|
|
1998
|
+
}, [zs]);
|
|
1999
|
+
let Us = pa.review, Ws = O(() => {
|
|
2000
|
+
let e = Bs[Bs.length - 1];
|
|
2003
2001
|
if (!e) return;
|
|
2004
2002
|
let { view: t } = e;
|
|
2005
|
-
if (
|
|
2006
|
-
|
|
2003
|
+
if (xn(t) && bn(t, ua[e.session.sandboxId]).offerConfirm) {
|
|
2004
|
+
Us(t);
|
|
2007
2005
|
return;
|
|
2008
2006
|
}
|
|
2009
|
-
|
|
2007
|
+
Hs(t.proposalId);
|
|
2010
2008
|
}, [
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
]),
|
|
2015
|
-
content: /* @__PURE__ */ N(
|
|
2009
|
+
Bs,
|
|
2010
|
+
ua,
|
|
2011
|
+
Us
|
|
2012
|
+
]), Gs = zs ? ft(Bs) : null, Ks = Vs ? da[Vs] : void 0, qs = zs && Ks && Ks.session.conversationId === H ? {
|
|
2013
|
+
content: /* @__PURE__ */ N(wn, {
|
|
2016
2014
|
refs: [{
|
|
2017
|
-
proposalId:
|
|
2018
|
-
sandboxId:
|
|
2019
|
-
sessionId:
|
|
2015
|
+
proposalId: Ks.view.proposalId,
|
|
2016
|
+
sandboxId: Ks.session.sandboxId,
|
|
2017
|
+
sessionId: Ks.session.sessionId
|
|
2020
2018
|
}],
|
|
2021
|
-
conversationId:
|
|
2019
|
+
conversationId: Ks.session.conversationId,
|
|
2022
2020
|
panel: G,
|
|
2023
|
-
entries:
|
|
2024
|
-
capabilitiesOf: (e) =>
|
|
2025
|
-
turnInFlight:
|
|
2021
|
+
entries: da,
|
|
2022
|
+
capabilitiesOf: (e) => ua[e],
|
|
2023
|
+
turnInFlight: sa,
|
|
2026
2024
|
tr: F,
|
|
2027
|
-
onReview:
|
|
2028
|
-
retiredSandboxes:
|
|
2025
|
+
onReview: Us,
|
|
2026
|
+
retiredSandboxes: fa
|
|
2029
2027
|
}),
|
|
2030
|
-
closeLabel:
|
|
2031
|
-
onClose: () =>
|
|
2032
|
-
} : null,
|
|
2033
|
-
r("assistant.transcript", A(() =>
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
])), r("assistant.conversation.new", A(() =>
|
|
2028
|
+
closeLabel: gt(F, ut.trayClose),
|
|
2029
|
+
onClose: () => Hs(null)
|
|
2030
|
+
} : null, Js = pa.asking, Ys = rs?.asking === !0, Xs = is?.asking === !0, Zs = Yn(), Qs = $.holdListening;
|
|
2031
|
+
r("assistant.transcript", A(() => zs ? null : { run: () => Ua ? { status: "already" } : (Ya(!0), { status: "done" }) }, [
|
|
2032
|
+
zs,
|
|
2033
|
+
Ua,
|
|
2034
|
+
Ya
|
|
2035
|
+
])), r("assistant.conversation.new", A(() => zs ? null : { run: () => {
|
|
2038
2036
|
let e = v.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
|
|
2039
2037
|
return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
|
|
2040
|
-
} }, [
|
|
2041
|
-
|
|
2038
|
+
} }, [zs])), k(() => {
|
|
2039
|
+
Qs(zs && (Js || Ys || Xs || Zs));
|
|
2042
2040
|
}, [
|
|
2043
|
-
|
|
2044
|
-
qs,
|
|
2041
|
+
zs,
|
|
2045
2042
|
Js,
|
|
2046
2043
|
Ys,
|
|
2047
2044
|
Xs,
|
|
2048
|
-
Zs
|
|
2045
|
+
Zs,
|
|
2046
|
+
Qs
|
|
2049
2047
|
]);
|
|
2050
|
-
let
|
|
2048
|
+
let $s = j(null), ec = $.announce;
|
|
2051
2049
|
k(() => {
|
|
2052
|
-
if (!
|
|
2053
|
-
|
|
2050
|
+
if (!zs) {
|
|
2051
|
+
$s.current = null;
|
|
2054
2052
|
return;
|
|
2055
2053
|
}
|
|
2056
|
-
let e =
|
|
2054
|
+
let e = $s.current;
|
|
2057
2055
|
if (e === null) {
|
|
2058
|
-
|
|
2056
|
+
$s.current = new Set(Object.keys(da));
|
|
2059
2057
|
return;
|
|
2060
2058
|
}
|
|
2061
|
-
for (let { view: t, session: n } of
|
|
2059
|
+
for (let { view: t, session: n } of mt(Bs, e)) {
|
|
2062
2060
|
e.add(t.proposalId);
|
|
2063
|
-
let r =
|
|
2064
|
-
if (!
|
|
2061
|
+
let r = ua[n.sandboxId];
|
|
2062
|
+
if (!dt({
|
|
2065
2063
|
mode: "api-calls",
|
|
2066
2064
|
productWriteApproval: R,
|
|
2067
2065
|
capabilities: r
|
|
2068
2066
|
})) continue;
|
|
2069
|
-
let i =
|
|
2070
|
-
|
|
2067
|
+
let i = _t(t, bn(t, r).offerConfirm, F), a = t.proposalId;
|
|
2068
|
+
ec({
|
|
2071
2069
|
id: `write-readback:${a}`,
|
|
2072
2070
|
text: i.text,
|
|
2073
2071
|
lang: i.translated ? V : "en",
|
|
@@ -2075,339 +2073,339 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
2075
2073
|
});
|
|
2076
2074
|
}
|
|
2077
2075
|
}, [
|
|
2078
|
-
Rs,
|
|
2079
2076
|
zs,
|
|
2077
|
+
Bs,
|
|
2078
|
+
da,
|
|
2080
2079
|
ua,
|
|
2081
|
-
la,
|
|
2082
2080
|
R,
|
|
2083
2081
|
F,
|
|
2084
2082
|
V,
|
|
2085
|
-
|
|
2083
|
+
ec,
|
|
2086
2084
|
G
|
|
2087
2085
|
]);
|
|
2088
|
-
let
|
|
2086
|
+
let tc = j(!1);
|
|
2089
2087
|
k(() => {
|
|
2090
|
-
|
|
2088
|
+
tc.current = $.active;
|
|
2091
2089
|
}, [$.active]), k(() => m((e) => {
|
|
2092
|
-
if (!
|
|
2093
|
-
let t =
|
|
2090
|
+
if (!tc.current) return !1;
|
|
2091
|
+
let t = Xa.current;
|
|
2094
2092
|
return typeof t == "string" ? t === e : v.getState().activeConversationId === e;
|
|
2095
2093
|
}), []);
|
|
2096
|
-
let
|
|
2097
|
-
let e = v.getState().activeConversationId, t =
|
|
2098
|
-
|
|
2094
|
+
let nc = $.start, rc = O(() => {
|
|
2095
|
+
let e = v.getState().activeConversationId, t = tt(eo());
|
|
2096
|
+
$a(rt(t, e)), uo(!0, t.kind === "own"), nc();
|
|
2099
2097
|
}, [
|
|
2100
|
-
Qa,
|
|
2101
|
-
lo,
|
|
2102
2098
|
$a,
|
|
2103
|
-
|
|
2104
|
-
|
|
2099
|
+
uo,
|
|
2100
|
+
eo,
|
|
2101
|
+
nc
|
|
2102
|
+
]), ic = A(() => an(ra?.messages ?? []), [ra?.messages]), ac = rn(ia.voice, oa, F), oc = rn(ic, oa, F) > 0, sc = O(() => {
|
|
2105
2103
|
let e = v.getState().activeConversationId;
|
|
2106
2104
|
if (!e || Q.length === 0) return;
|
|
2107
|
-
let t = new Set(
|
|
2105
|
+
let t = new Set(ic.map((e) => e.id)), n = P();
|
|
2108
2106
|
W(e, {
|
|
2109
2107
|
id: n,
|
|
2110
2108
|
role: "system",
|
|
2111
|
-
content:
|
|
2109
|
+
content: We(Q.filter((e) => t.has(e.id)), {
|
|
2112
2110
|
intro: F("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
|
|
2113
2111
|
nothing: F("voiceSession.continuedNothing", "Continued from a voice conversation."),
|
|
2114
2112
|
more: (e) => F("voiceSession.continuedMore", "…and {{count}} more", { count: e })
|
|
2115
2113
|
}),
|
|
2116
2114
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2117
|
-
metadata: { continuedVoiceTurns:
|
|
2118
|
-
}),
|
|
2115
|
+
metadata: { continuedVoiceTurns: ac }
|
|
2116
|
+
}), Un.recordCommittedEntries(e, [n], "NOTE", T()), Ya(!1), $.end(), qa();
|
|
2119
2117
|
}, [
|
|
2120
2118
|
Q,
|
|
2119
|
+
ac,
|
|
2121
2120
|
ic,
|
|
2122
|
-
rc,
|
|
2123
2121
|
W,
|
|
2124
2122
|
F,
|
|
2125
2123
|
$,
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
]),
|
|
2124
|
+
Ya,
|
|
2125
|
+
qa
|
|
2126
|
+
]), cc = j({
|
|
2129
2127
|
conversationId: null,
|
|
2130
2128
|
count: 0
|
|
2131
2129
|
});
|
|
2132
2130
|
k(() => {
|
|
2133
|
-
$.active && (
|
|
2131
|
+
$.active && (cc.current = {
|
|
2134
2132
|
conversationId: H,
|
|
2135
|
-
count:
|
|
2133
|
+
count: ac
|
|
2136
2134
|
});
|
|
2137
2135
|
}, [$.active]);
|
|
2138
|
-
let
|
|
2139
|
-
let e =
|
|
2140
|
-
$.end(), t &&
|
|
2136
|
+
let lc = O(() => {
|
|
2137
|
+
let e = cc.current, t = ac > (e.conversationId === H ? e.count : 0);
|
|
2138
|
+
$.end(), t && Ya(!0);
|
|
2141
2139
|
}, [
|
|
2142
2140
|
H,
|
|
2143
|
-
|
|
2141
|
+
ac,
|
|
2144
2142
|
$,
|
|
2145
|
-
|
|
2143
|
+
Ya
|
|
2146
2144
|
]);
|
|
2147
2145
|
k(() => {
|
|
2148
|
-
(!
|
|
2146
|
+
(!_i || !oo) && $.active && $.end();
|
|
2149
2147
|
}, [
|
|
2150
|
-
|
|
2151
|
-
|
|
2148
|
+
_i,
|
|
2149
|
+
oo,
|
|
2152
2150
|
$
|
|
2153
2151
|
]);
|
|
2154
|
-
let [
|
|
2152
|
+
let [uc, dc] = M(hi), fc = or({
|
|
2155
2153
|
available: $.available,
|
|
2156
|
-
allowedInMode:
|
|
2157
|
-
readOnly:
|
|
2158
|
-
busy:
|
|
2159
|
-
committing:
|
|
2160
|
-
dictating:
|
|
2161
|
-
}),
|
|
2162
|
-
|
|
2163
|
-
}, [
|
|
2154
|
+
allowedInMode: oo,
|
|
2155
|
+
readOnly: ga,
|
|
2156
|
+
busy: sa || po !== null || va || Io,
|
|
2157
|
+
committing: uc.committing,
|
|
2158
|
+
dictating: uc.dictating
|
|
2159
|
+
}), pc = xt(), mc = j(!1), hc = O(() => {
|
|
2160
|
+
mc.current = !0, rc();
|
|
2161
|
+
}, [rc]);
|
|
2164
2162
|
k(() => {
|
|
2165
|
-
$.active || (
|
|
2163
|
+
$.active || (mc.current = !1);
|
|
2166
2164
|
}, [$.active]), k(() => {
|
|
2167
|
-
|
|
2165
|
+
Ka || !mc.current || (mc.current = !1, $.active && lc());
|
|
2168
2166
|
}, [
|
|
2169
|
-
|
|
2167
|
+
Ka,
|
|
2170
2168
|
$.active,
|
|
2171
|
-
|
|
2169
|
+
lc
|
|
2172
2170
|
]), k(() => {
|
|
2173
|
-
|
|
2174
|
-
}, [
|
|
2175
|
-
let
|
|
2171
|
+
Ka && Ya(!1);
|
|
2172
|
+
}, [Ka, Ya]);
|
|
2173
|
+
let gc = A(() => ({
|
|
2176
2174
|
live: $.active,
|
|
2177
|
-
blocked:
|
|
2178
|
-
impossible:
|
|
2179
|
-
start:
|
|
2175
|
+
blocked: fc === null ? null : pc.voiceStartBlocked(fc),
|
|
2176
|
+
impossible: sr(fc),
|
|
2177
|
+
start: hc
|
|
2180
2178
|
}), [
|
|
2181
2179
|
$.active,
|
|
2182
|
-
dc,
|
|
2183
2180
|
fc,
|
|
2184
|
-
|
|
2185
|
-
|
|
2181
|
+
pc,
|
|
2182
|
+
hc
|
|
2183
|
+
]), [_c, vc] = M("mini"), yc = _i && Wa.covered !== !0 && !($.active && _c !== "mini") && !(Ua && !$.active);
|
|
2186
2184
|
k(() => {
|
|
2187
|
-
let e =
|
|
2185
|
+
let e = Xa.current, t = it(e), n = v.getState(), r = et({
|
|
2188
2186
|
sessionLive: $.active,
|
|
2189
2187
|
bound: e,
|
|
2190
2188
|
activeConversationId: n.activeConversationId,
|
|
2191
2189
|
boundConversationExists: n.conversations.some((e) => e.id === t)
|
|
2192
2190
|
});
|
|
2193
|
-
|
|
2191
|
+
$a(r.bound), r.end && $.end();
|
|
2194
2192
|
}, [
|
|
2195
2193
|
$,
|
|
2196
2194
|
H,
|
|
2197
|
-
|
|
2198
|
-
|
|
2195
|
+
Li,
|
|
2196
|
+
$a
|
|
2199
2197
|
]);
|
|
2200
|
-
let
|
|
2198
|
+
let bc = j(w);
|
|
2201
2199
|
k(() => {
|
|
2202
|
-
let e =
|
|
2200
|
+
let e = $e(bc.current, {
|
|
2203
2201
|
activeConversationId: H,
|
|
2204
|
-
chatTurnCount:
|
|
2202
|
+
chatTurnCount: ys.length,
|
|
2205
2203
|
voiceTurnCount: Q.length,
|
|
2206
2204
|
sessionLive: $.active,
|
|
2207
|
-
sessionBoundTo:
|
|
2208
|
-
turnInFlight:
|
|
2205
|
+
sessionBoundTo: Xa.current,
|
|
2206
|
+
turnInFlight: sa
|
|
2209
2207
|
});
|
|
2210
|
-
|
|
2208
|
+
bc.current = e.state, e.open && Ya(!0);
|
|
2211
2209
|
}, [
|
|
2212
2210
|
H,
|
|
2213
|
-
|
|
2211
|
+
ys.length,
|
|
2214
2212
|
Q.length,
|
|
2215
2213
|
$.active,
|
|
2216
|
-
|
|
2217
|
-
|
|
2214
|
+
sa,
|
|
2215
|
+
Ya
|
|
2218
2216
|
]), k(() => {
|
|
2219
2217
|
if (!$.active) {
|
|
2220
|
-
|
|
2221
|
-
for (let e of
|
|
2222
|
-
|
|
2218
|
+
js.current.clear(), Ns(null), _o.current = null;
|
|
2219
|
+
for (let e of Fs.current) window.clearInterval(e);
|
|
2220
|
+
Fs.current.clear();
|
|
2223
2221
|
}
|
|
2224
2222
|
}, [$.active]), k(() => {
|
|
2225
|
-
let e =
|
|
2223
|
+
let e = Fs.current;
|
|
2226
2224
|
return () => {
|
|
2227
2225
|
for (let t of e) window.clearInterval(t);
|
|
2228
2226
|
e.clear();
|
|
2229
2227
|
};
|
|
2230
2228
|
}, []), k(() => {
|
|
2231
2229
|
let e = v.getState().consumePendingPrompt();
|
|
2232
|
-
return e &&
|
|
2230
|
+
return e && gs.current(e), v.subscribe((e, t) => {
|
|
2233
2231
|
if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
|
|
2234
2232
|
let e = v.getState().consumePendingPrompt();
|
|
2235
|
-
e &&
|
|
2233
|
+
e && gs.current(e);
|
|
2236
2234
|
}
|
|
2237
2235
|
});
|
|
2238
2236
|
}, []);
|
|
2239
|
-
let
|
|
2237
|
+
let xc = O((e) => {
|
|
2240
2238
|
let t = H ? v.getState().conversations.find((e) => e.id === H) : void 0;
|
|
2241
|
-
if (t && t.mode !== e && G.withdraw(t.id, "mode_switched"), t &&
|
|
2239
|
+
if (t && t.mode !== e && G.withdraw(t.id, "mode_switched"), t && Rn(t)) {
|
|
2242
2240
|
if (t.mode !== e) {
|
|
2243
|
-
let t = p(), n = v.getState().conversations.find((n) => n.mode === e &&
|
|
2244
|
-
n ?
|
|
2241
|
+
let t = p(), n = v.getState().conversations.find((n) => n.mode === e && Vn(n, t) && !v.getState().processingByConversationId[n.id]);
|
|
2242
|
+
n ? Vi(n.id) : Hi(void 0, e);
|
|
2245
2243
|
}
|
|
2246
|
-
} else H &&
|
|
2244
|
+
} else H && Bi(H, e);
|
|
2247
2245
|
let n = v.getState().activeConversationId;
|
|
2248
|
-
n ?
|
|
2246
|
+
n ? Bi(n, e) : ta(!1), zi(e);
|
|
2249
2247
|
}, [
|
|
2250
2248
|
H,
|
|
2249
|
+
Hi,
|
|
2251
2250
|
Vi,
|
|
2251
|
+
ta,
|
|
2252
2252
|
Bi,
|
|
2253
|
-
ea,
|
|
2254
2253
|
zi,
|
|
2255
|
-
Ri,
|
|
2256
2254
|
G
|
|
2257
|
-
]),
|
|
2255
|
+
]), Sc = O(() => {
|
|
2258
2256
|
let e = v.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
|
|
2259
2257
|
if (!t) {
|
|
2260
|
-
|
|
2258
|
+
ta(!0), zi(c);
|
|
2261
2259
|
return;
|
|
2262
2260
|
}
|
|
2263
2261
|
if (t.routedBy === "auto") {
|
|
2264
|
-
|
|
2262
|
+
ta(!0);
|
|
2265
2263
|
return;
|
|
2266
2264
|
}
|
|
2267
|
-
if (!
|
|
2268
|
-
|
|
2265
|
+
if (!Rn(t)) {
|
|
2266
|
+
na(t.id, c);
|
|
2269
2267
|
return;
|
|
2270
2268
|
}
|
|
2271
2269
|
G.withdraw(t.id, "mode_switched");
|
|
2272
|
-
let n = p(), r = e.conversations.find((t) => t.routedBy === "auto" &&
|
|
2273
|
-
r ? (
|
|
2270
|
+
let n = p(), r = e.conversations.find((t) => t.routedBy === "auto" && Vn(t, n) && !e.processingByConversationId[t.id]);
|
|
2271
|
+
r ? (Vi(r.id), na(r.id, c)) : Hi(void 0, c, { routedBy: "auto" });
|
|
2274
2272
|
}, [
|
|
2273
|
+
Hi,
|
|
2274
|
+
na,
|
|
2275
2275
|
Vi,
|
|
2276
2276
|
ta,
|
|
2277
|
-
|
|
2278
|
-
ea,
|
|
2279
|
-
Ri,
|
|
2277
|
+
zi,
|
|
2280
2278
|
G
|
|
2281
|
-
]),
|
|
2279
|
+
]), Cc = O((e) => {
|
|
2282
2280
|
if (L.find((t) => t.id === e)?.writeCapable && !oe(v.getState().acknowledgedWriteModes, e)) {
|
|
2283
|
-
|
|
2281
|
+
Ba(e);
|
|
2284
2282
|
return;
|
|
2285
2283
|
}
|
|
2286
|
-
|
|
2287
|
-
}, [
|
|
2288
|
-
let e =
|
|
2289
|
-
if (
|
|
2290
|
-
let t =
|
|
2291
|
-
if (
|
|
2292
|
-
|
|
2284
|
+
xc(e);
|
|
2285
|
+
}, [xc, L]), wc = O(() => {
|
|
2286
|
+
let e = za;
|
|
2287
|
+
if (Ba(null), !e) return;
|
|
2288
|
+
let t = Ia.current;
|
|
2289
|
+
if (Ia.current = null, t) {
|
|
2290
|
+
$i(e), Z(t.content, t.attachments, t.options);
|
|
2293
2291
|
return;
|
|
2294
2292
|
}
|
|
2295
|
-
|
|
2293
|
+
$i(e), xc(e);
|
|
2296
2294
|
}, [
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2295
|
+
za,
|
|
2296
|
+
$i,
|
|
2297
|
+
xc,
|
|
2300
2298
|
Z
|
|
2301
|
-
]),
|
|
2302
|
-
|
|
2303
|
-
let e =
|
|
2304
|
-
|
|
2299
|
+
]), Tc = za === null ? void 0 : L.find((e) => e.id === za) ?? { id: za }, Ec = O(() => {
|
|
2300
|
+
Ba(null);
|
|
2301
|
+
let e = Ia.current;
|
|
2302
|
+
Ia.current = null, e && Z(e.content, e.attachments, {
|
|
2305
2303
|
...e.options,
|
|
2306
2304
|
autoIntent: "read"
|
|
2307
2305
|
});
|
|
2308
2306
|
}, [Z]);
|
|
2309
|
-
return /* @__PURE__ */
|
|
2307
|
+
return /* @__PURE__ */ li("div", {
|
|
2310
2308
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
2311
2309
|
children: [
|
|
2312
|
-
/* @__PURE__ */
|
|
2310
|
+
/* @__PURE__ */ li("div", {
|
|
2313
2311
|
className: "contents",
|
|
2314
|
-
inert: $.active ||
|
|
2315
|
-
...
|
|
2312
|
+
inert: $.active || Ka || void 0,
|
|
2313
|
+
...Wa.ids ? {
|
|
2316
2314
|
role: "tabpanel",
|
|
2317
|
-
id:
|
|
2318
|
-
"aria-labelledby":
|
|
2315
|
+
id: Wa.ids.chatPanel,
|
|
2316
|
+
"aria-labelledby": Wa.ids.chatTab
|
|
2319
2317
|
} : {},
|
|
2320
2318
|
children: [
|
|
2321
|
-
|
|
2322
|
-
Q.length > 0 && !$.active ? /* @__PURE__ */ N(
|
|
2319
|
+
Ca === null ? null : /* @__PURE__ */ N(Mn, { onDismiss: () => Sa(Ca) }),
|
|
2320
|
+
Q.length > 0 && !$.active ? /* @__PURE__ */ N(An, {
|
|
2323
2321
|
count: Q.length,
|
|
2324
|
-
onOpenTranscript: () =>
|
|
2322
|
+
onOpenTranscript: () => Ya(!0)
|
|
2325
2323
|
}) : null,
|
|
2326
|
-
|
|
2327
|
-
state:
|
|
2328
|
-
onRetry:
|
|
2329
|
-
}) :
|
|
2324
|
+
ys.length === 0 && (va || ya) ? /* @__PURE__ */ N(Nn, {
|
|
2325
|
+
state: va ? "loading" : "failed",
|
|
2326
|
+
onRetry: Oa
|
|
2327
|
+
}) : ys.length === 0 && ra?.sync?.hasOlder ? /* @__PURE__ */ N("div", {
|
|
2330
2328
|
className: "flex min-h-0 flex-1 flex-col",
|
|
2331
|
-
children: /* @__PURE__ */ N(
|
|
2332
|
-
onShowEarlier:
|
|
2333
|
-
disabled:
|
|
2329
|
+
children: /* @__PURE__ */ N(Fn, {
|
|
2330
|
+
onShowEarlier: ka,
|
|
2331
|
+
disabled: va
|
|
2334
2332
|
})
|
|
2335
|
-
}) :
|
|
2333
|
+
}) : ys.length === 0 ? /* @__PURE__ */ N(Wn, {
|
|
2336
2334
|
mode: U,
|
|
2337
|
-
onSuggestionClick:
|
|
2338
|
-
explainsAuto:
|
|
2339
|
-
suggestions:
|
|
2340
|
-
}) : /* @__PURE__ */
|
|
2335
|
+
onSuggestionClick: ps,
|
|
2336
|
+
explainsAuto: Pa,
|
|
2337
|
+
suggestions: Pa && U === "assistant" ? l(L.find((e) => e.id === "assistant")?.suggestions ?? [], L.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
|
|
2338
|
+
}) : /* @__PURE__ */ li("div", {
|
|
2341
2339
|
className: "flex min-h-0 flex-1 flex-col",
|
|
2342
|
-
children: [
|
|
2343
|
-
onShowEarlier:
|
|
2344
|
-
disabled:
|
|
2345
|
-
}) : null, /* @__PURE__ */ N(
|
|
2346
|
-
onApprovePendingWrite:
|
|
2347
|
-
approvingWriteRef:
|
|
2348
|
-
approvableMessageId:
|
|
2349
|
-
retryableMessageId:
|
|
2350
|
-
messages:
|
|
2351
|
-
processing:
|
|
2352
|
-
streamingMessageId:
|
|
2353
|
-
failedMessageId:
|
|
2354
|
-
onRetry:
|
|
2355
|
-
renderWriteProposals:
|
|
2356
|
-
hidesLegacyWriteCard:
|
|
2357
|
-
renderUiOffers:
|
|
2340
|
+
children: [ra?.sync?.hasOlder ? /* @__PURE__ */ N(Fn, {
|
|
2341
|
+
onShowEarlier: ka,
|
|
2342
|
+
disabled: va
|
|
2343
|
+
}) : null, /* @__PURE__ */ N(nr, {
|
|
2344
|
+
onApprovePendingWrite: xo,
|
|
2345
|
+
approvingWriteRef: po,
|
|
2346
|
+
approvableMessageId: xs?.messageId ?? null,
|
|
2347
|
+
retryableMessageId: Ss,
|
|
2348
|
+
messages: ys,
|
|
2349
|
+
processing: oa ?? null,
|
|
2350
|
+
streamingMessageId: ca,
|
|
2351
|
+
failedMessageId: la,
|
|
2352
|
+
onRetry: po === null ? hs : void 0,
|
|
2353
|
+
renderWriteProposals: ws,
|
|
2354
|
+
hidesLegacyWriteCard: Cs,
|
|
2355
|
+
renderUiOffers: Es
|
|
2358
2356
|
})]
|
|
2359
2357
|
}),
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2358
|
+
ga ? /* @__PURE__ */ N(Pn, { onStartNew: () => Hi() }) : null,
|
|
2359
|
+
_a && H ? /* @__PURE__ */ N(jn, { onUnarchive: () => Un.updateConversation(H, { archived: !1 }) }) : null,
|
|
2360
|
+
ss === null ? null : /* @__PURE__ */ N(Gn, {
|
|
2363
2361
|
tr: F,
|
|
2364
|
-
onDismiss: () =>
|
|
2362
|
+
onDismiss: () => cs(null)
|
|
2365
2363
|
}),
|
|
2366
|
-
|
|
2367
|
-
state:
|
|
2368
|
-
onRetry:
|
|
2364
|
+
ys.length > 0 && (va || ya) ? /* @__PURE__ */ N(Nn, {
|
|
2365
|
+
state: va ? "loading" : "failed",
|
|
2366
|
+
onRetry: Oa,
|
|
2369
2367
|
compact: !0
|
|
2370
2368
|
}) : null,
|
|
2371
|
-
/* @__PURE__ */ N(
|
|
2372
|
-
onStartVoiceSession: $.available &&
|
|
2369
|
+
/* @__PURE__ */ N(ri, {
|
|
2370
|
+
onStartVoiceSession: $.available && oo ? rc : void 0,
|
|
2373
2371
|
onSend: (e, t) => void Z(e, t, { fromPerson: !0 }),
|
|
2374
|
-
onDraftStart:
|
|
2375
|
-
disabled:
|
|
2376
|
-
readOnly:
|
|
2372
|
+
onDraftStart: fo,
|
|
2373
|
+
disabled: sa || po !== null || va || Io,
|
|
2374
|
+
readOnly: ga,
|
|
2377
2375
|
placeholder: U === "api-calls" ? F("chatArea.placeholderActions", "What would you like me to do?") : F("chatArea.placeholderGeneral", "Ask me anything…"),
|
|
2378
2376
|
mode: U,
|
|
2379
|
-
writeAccessDenied:
|
|
2380
|
-
availableModes:
|
|
2381
|
-
attachmentCharsPerFile:
|
|
2382
|
-
onModeChange:
|
|
2383
|
-
auto:
|
|
2384
|
-
active:
|
|
2385
|
-
onSelect:
|
|
2377
|
+
writeAccessDenied: vi === "denied" && !!ro?.writeCapable,
|
|
2378
|
+
availableModes: Ma,
|
|
2379
|
+
attachmentCharsPerFile: Ra,
|
|
2380
|
+
onModeChange: Cc,
|
|
2381
|
+
auto: Na ? {
|
|
2382
|
+
active: Pa,
|
|
2383
|
+
onSelect: Sc
|
|
2386
2384
|
} : void 0,
|
|
2387
|
-
suspendDictation:
|
|
2388
|
-
onVoiceStateChange:
|
|
2385
|
+
suspendDictation: Ka,
|
|
2386
|
+
onVoiceStateChange: Wa.ids ? dc : void 0
|
|
2389
2387
|
})
|
|
2390
2388
|
]
|
|
2391
2389
|
}),
|
|
2392
|
-
|
|
2390
|
+
Ua && !$.active ? /* @__PURE__ */ N(In, {
|
|
2393
2391
|
turns: Q,
|
|
2394
|
-
onClose: () =>
|
|
2395
|
-
onSave:
|
|
2396
|
-
onContinueInChat:
|
|
2392
|
+
onClose: () => Ya(!1),
|
|
2393
|
+
onSave: ks,
|
|
2394
|
+
onContinueInChat: oc ? sc : void 0,
|
|
2397
2395
|
closeOnEscape: !0,
|
|
2398
|
-
onShowEarlier:
|
|
2399
|
-
showEarlierDisabled:
|
|
2400
|
-
renderAfterTurn:
|
|
2396
|
+
onShowEarlier: ra?.sync?.hasOlder ? ka : void 0,
|
|
2397
|
+
showEarlierDisabled: va,
|
|
2398
|
+
renderAfterTurn: Ts
|
|
2401
2399
|
}) : null,
|
|
2402
|
-
|
|
2403
|
-
tab:
|
|
2404
|
-
id:
|
|
2405
|
-
labelledBy:
|
|
2406
|
-
leaveHintId:
|
|
2407
|
-
shown:
|
|
2408
|
-
voice:
|
|
2400
|
+
Ka && Ga && Wa.ids ? /* @__PURE__ */ N(ar, {
|
|
2401
|
+
tab: Ga,
|
|
2402
|
+
id: Wa.ids.avatarPanel,
|
|
2403
|
+
labelledBy: Wa.ids.avatarTab,
|
|
2404
|
+
leaveHintId: Wa.ids.leaveHint,
|
|
2405
|
+
shown: yc,
|
|
2406
|
+
voice: gc
|
|
2409
2407
|
}) : null,
|
|
2410
|
-
$.active && /* @__PURE__ */ N(
|
|
2408
|
+
$.active && /* @__PURE__ */ N(ir, {
|
|
2411
2409
|
session: $.session,
|
|
2412
2410
|
notice: $.notice,
|
|
2413
2411
|
privacyNotice: $.handsFree.privacyNotice,
|
|
@@ -2418,50 +2416,50 @@ var gi = ({ visible: gi = !0, writeAccess: _i = "unknown" }) => {
|
|
|
2418
2416
|
correcting: $.correcting,
|
|
2419
2417
|
onLetMeFinish: $.letMeFinish,
|
|
2420
2418
|
onImDone: $.imDone,
|
|
2421
|
-
turns:
|
|
2419
|
+
turns: Ls,
|
|
2422
2420
|
spokenChunks: $.spokenChunks,
|
|
2423
|
-
attachments:
|
|
2424
|
-
onAttachFiles:
|
|
2425
|
-
onRemoveAttachment:
|
|
2426
|
-
onRetryAttachment:
|
|
2427
|
-
canAttachMore:
|
|
2428
|
-
preparingAttachments:
|
|
2429
|
-
attachmentsLocked:
|
|
2430
|
-
attachmentNotice:
|
|
2431
|
-
onSaveTranscript:
|
|
2432
|
-
onContinueInChat:
|
|
2421
|
+
attachments: As.attachments,
|
|
2422
|
+
onAttachFiles: As.addFiles,
|
|
2423
|
+
onRemoveAttachment: As.remove,
|
|
2424
|
+
onRetryAttachment: As.retry,
|
|
2425
|
+
canAttachMore: As.canAddMore,
|
|
2426
|
+
preparingAttachments: As.preparingCount,
|
|
2427
|
+
attachmentsLocked: As.isCommitting,
|
|
2428
|
+
attachmentNotice: Ps,
|
|
2429
|
+
onSaveTranscript: ks,
|
|
2430
|
+
onContinueInChat: sc,
|
|
2433
2431
|
onInterrupt: () => {
|
|
2434
|
-
$.interrupt(),
|
|
2432
|
+
$.interrupt(), yo();
|
|
2435
2433
|
},
|
|
2436
|
-
spoken:
|
|
2434
|
+
spoken: vs,
|
|
2437
2435
|
onToggleMute: $.toggleMute,
|
|
2438
|
-
onEnd:
|
|
2439
|
-
proposalChip:
|
|
2440
|
-
label:
|
|
2441
|
-
onOpen:
|
|
2436
|
+
onEnd: lc,
|
|
2437
|
+
proposalChip: Gs ? {
|
|
2438
|
+
label: pt(Gs, F),
|
|
2439
|
+
onOpen: Ws
|
|
2442
2440
|
} : null,
|
|
2443
|
-
proposalTray:
|
|
2444
|
-
renderAfterTurn:
|
|
2445
|
-
onViewChange:
|
|
2441
|
+
proposalTray: qs,
|
|
2442
|
+
renderAfterTurn: Ts,
|
|
2443
|
+
onViewChange: Wa.ids ? vc : void 0
|
|
2446
2444
|
}),
|
|
2447
|
-
/* @__PURE__ */ N(
|
|
2448
|
-
open:
|
|
2449
|
-
mode:
|
|
2450
|
-
currentMode:
|
|
2451
|
-
onConfirm:
|
|
2452
|
-
onCancel:
|
|
2445
|
+
/* @__PURE__ */ N(ai, {
|
|
2446
|
+
open: za !== null,
|
|
2447
|
+
mode: Tc,
|
|
2448
|
+
currentMode: ro ?? { id: U },
|
|
2449
|
+
onConfirm: wc,
|
|
2450
|
+
onCancel: Ec
|
|
2453
2451
|
}),
|
|
2454
|
-
/* @__PURE__ */ N(
|
|
2455
|
-
...
|
|
2456
|
-
view:
|
|
2457
|
-
serverNow:
|
|
2458
|
-
arrivedAt:
|
|
2459
|
-
capabilities:
|
|
2460
|
-
turnInFlight:
|
|
2452
|
+
/* @__PURE__ */ N(Sn, {
|
|
2453
|
+
...pa.dialog,
|
|
2454
|
+
view: Ds?.view ?? pa.dialog.view,
|
|
2455
|
+
serverNow: Ds?.serverNow ?? NaN,
|
|
2456
|
+
arrivedAt: Ds?.arrivedAt ?? NaN,
|
|
2457
|
+
capabilities: Ds ? ua[Ds.session.sandboxId] : null,
|
|
2458
|
+
turnInFlight: sa,
|
|
2461
2459
|
tr: F
|
|
2462
2460
|
})
|
|
2463
2461
|
]
|
|
2464
2462
|
});
|
|
2465
2463
|
};
|
|
2466
2464
|
//#endregion
|
|
2467
|
-
export {
|
|
2465
|
+
export { _i as AssistantChatArea };
|