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