@burdenoff/fe-libs 2026.1029.3 → 2026.1029.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/conversation.d.ts +10 -0
- package/dist/shared/assistant/i18nManifest.d.ts +15 -2
- package/dist/shared/assistant/i18nManifest.js +12 -0
- package/dist/shared/assistant/index.d.ts +4 -0
- package/dist/shared/assistant/productCopy.d.ts +8 -0
- package/dist/shared/assistant/productCopy.js +8 -5
- package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +9 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.js +70 -69
- package/dist/shared/assistant/ui/AssistantApiCallsConsentDialog.d.ts +23 -0
- package/dist/shared/assistant/ui/AssistantApiCallsConsentDialog.js +72 -18
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts +6 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1176 -1065
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +27 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +350 -206
- package/dist/shared/assistant/ui/composer/AssistantModeMenu.d.ts +51 -0
- package/dist/shared/assistant/ui/composer/AssistantModeMenu.js +188 -0
- package/dist/shared/assistant/ui/composer/imeEnter.d.ts +44 -0
- package/dist/shared/assistant/ui/composer/imeEnter.js +11 -0
- package/dist/shared/assistant/ui/composer/modeMenuKeys.d.ts +76 -0
- package/dist/shared/assistant/ui/composer/modeMenuKeys.js +61 -0
- package/dist/shared/assistant/ui/composer/modeSwitchPlan.d.ts +73 -0
- package/dist/shared/assistant/ui/composer/modeSwitchPlan.js +25 -0
- package/dist/shared-assistant.js +241 -237
- package/package.json +1 -1
|
@@ -68,200 +68,202 @@ import { readWriteProposalRefs as zn, writeProposalsEnabledFor as Bn } from "../
|
|
|
68
68
|
import { planWriteReply as Vn, promptWriteApproval as Hn } from "../writeReplySend.js";
|
|
69
69
|
import { useWriteProposals as Un } from "./useWriteProposals.js";
|
|
70
70
|
import { AssistantSpokenTurnsNotice as Wn } from "./AssistantSpokenTurnsNotice.js";
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
109
|
-
import {
|
|
110
|
-
import {
|
|
111
|
-
import {
|
|
112
|
-
import {
|
|
113
|
-
import {
|
|
114
|
-
import {
|
|
115
|
-
import {
|
|
116
|
-
import {
|
|
117
|
-
import {
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
import {
|
|
121
|
-
import {
|
|
122
|
-
import {
|
|
123
|
-
import {
|
|
124
|
-
import {
|
|
71
|
+
import { assistantModeOptionName as Gn } from "./composer/AssistantModeMenu.js";
|
|
72
|
+
import { planModeSwitch as Kn } from "./composer/modeSwitchPlan.js";
|
|
73
|
+
import { AssistantHistoryArchivedNotice as qn, AssistantHistoryDeletedNotice as Jn, AssistantHistoryLoadState as Yn, AssistantHistoryReadOnlyBanner as Xn, AssistantHistoryShowEarlier as Zn } from "./AssistantHistoryNotices.js";
|
|
74
|
+
import { VoiceTranscriptDrawer as Qn } from "./voice/VoiceTranscriptDrawer.js";
|
|
75
|
+
import { downloadFile as $n } from "../exportConversation.js";
|
|
76
|
+
import { conversationHasHistory as er, isOtherScopeHistoryConversation as tr, isReadOnlyHistoryConversation as nr, isReusableHistoryDraft as rr } from "../history/historyList.js";
|
|
77
|
+
import { useAssistantHistoryStatus as ir } from "../history/historyStatus.js";
|
|
78
|
+
import { assistantHistory as ar } from "../history/historyEngine.js";
|
|
79
|
+
import { AssistantEmptyState as or } from "./AssistantEmptyState.js";
|
|
80
|
+
import { AssistantNothingToDeleteNotice as sr } from "./AssistantDeleteConversationDialog.js";
|
|
81
|
+
import { assistantHistoryIsOn as cr } from "./conversationDelete.js";
|
|
82
|
+
import { useConversationDeleteDialog as lr } from "./conversationDeleteDialog.js";
|
|
83
|
+
import { useControlConfirmDialog as ur } from "./controlConfirmDialog.js";
|
|
84
|
+
import { useLeaveConfirmAsking as dr } from "./leaveConfirm.js";
|
|
85
|
+
import { startFocusReturnAfterKeep as fr } from "./leaveConfirmFocus.js";
|
|
86
|
+
import { resolveConversationDeleteTarget as pr } from "../conversationDeleteCommand.js";
|
|
87
|
+
import { resumeContextFor as mr } from "../history/historyResume.js";
|
|
88
|
+
import { useHistoryRowControlsFor as hr } from "../history/useHistoryRowControls.js";
|
|
89
|
+
import { liveCoverage as gr } from "../liveDeltas.js";
|
|
90
|
+
import { createLiveRender as _r } from "../liveOverlay.js";
|
|
91
|
+
import { AssistantMessageList as vr } from "./AssistantMessageList.js";
|
|
92
|
+
import { AssistantUiOfferLinks as yr } from "./AssistantUiOfferLink.js";
|
|
93
|
+
import { AssistantVoiceSession as br } from "./voice/AssistantVoiceSession.js";
|
|
94
|
+
import { voiceStartBlocker as xr, voiceStartBlockerLasts as Sr } from "./voice/voiceStartGate.js";
|
|
95
|
+
import { avatarAskBlocker as Cr, avatarAskWrites as wr, avatarTabAskLine as Tr } from "./avatar/avatarAskGate.js";
|
|
96
|
+
import { createAvatarTabDraft as Er } from "./avatar/avatarTabDraft.js";
|
|
97
|
+
import { AssistantAvatarTab as Dr } from "./avatar/AssistantAvatarTab.js";
|
|
98
|
+
import { useAssistantApiAccess as Or } from "../useAssistantApiAccess.js";
|
|
99
|
+
import { useConversationTurns as kr } from "../useConversationTurns.js";
|
|
100
|
+
import { openTurnStream as Ar, turnStreamAvailable as jr } from "../turnStream.js";
|
|
101
|
+
import { createSnapshotPoller as Mr } from "../snapshotPoller.js";
|
|
102
|
+
import { QuarantineSet as Nr, WarmCancelled as Pr, claimPreopenedSession as Fr, consumeWarm as Ir, preopenKey as Lr, preopenWanted as Rr, prewarmTarget as zr, settleWarmBeforeSend as Br, startPreopen as Vr, startWarm as Hr, warmState as Ur } from "../prewarm.js";
|
|
103
|
+
import { navEntryIds as Wr } from "../uiActions/resolveTarget.js";
|
|
104
|
+
import { lookupNamedRecords as Gr } from "../uiActions/recordNames.js";
|
|
105
|
+
import { couldBeLocalUiCommand as Kr, isAlreadyThere as qr, matchLocalUiCommand as Jr, mayBeNavigationFollowUp as Yr, navDestinations as Xr, planThemeChange as Zr } from "../localUiCommands.js";
|
|
106
|
+
import { offerAssentFor as Qr } from "../localeCommands/assent.js";
|
|
107
|
+
import { readControlSnapshot as $r } from "../appControls/snapshot.js";
|
|
108
|
+
import { runNavigation as ei } from "../uiActions/navigationOutcome.js";
|
|
109
|
+
import { assistantBackStack as ti, isBackRunnable as ni } from "../uiActions/backStack.js";
|
|
110
|
+
import { subscribeDraftPathname as ri } from "../uiActions/draftPathname.js";
|
|
111
|
+
import { buildNavigateAction as ii, destinationForPath as ai, labelForPath as oi, newestAssistantOnSurface as si } from "../uiActions/navigateAction.js";
|
|
112
|
+
import { buildNavigationContext as ci, latestReplyOnSurface as li, rememberPresentedList as ui } from "../uiActions/linkContext.js";
|
|
113
|
+
import { buildUiCatalogue as di, markUiCatalogueSent as fi, uiCatalogueSent as pi, uiCatalogueSessionKey as mi } from "../uiActions/uiCatalogue.js";
|
|
114
|
+
import { offerYesOnSurface as hi } from "../uiActions/offerYesOnSurface.js";
|
|
115
|
+
import { parseNavIntent as gi } from "../uiActions/navIntent.js";
|
|
116
|
+
import { decideActOnResolve as _i, n4LeaveGuard as vi } from "../uiActions/actOnResolve.js";
|
|
117
|
+
import { planAppControl as yi } from "../appControls/plan.js";
|
|
118
|
+
import { useAssistantAttachments as bi } from "../useAssistantAttachments.js";
|
|
119
|
+
import { AssistantComposer as xi } from "./composer/AssistantComposer.js";
|
|
120
|
+
import { isProdRuntime as Si } from "../env.js";
|
|
121
|
+
import { AssistantApiCallsConsentDialog as Ci } from "./AssistantApiCallsConsentDialog.js";
|
|
122
|
+
import { createDraftCommandCheck as wi } from "./draftCommandCheck.js";
|
|
123
|
+
import { createClientToolRunner as Ti, offerClientTools as Ei } from "../../agent-tools/adapters/assistant.js";
|
|
124
|
+
import { useVisibleNavItems as Di } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
|
|
125
|
+
import { useCallback as E, useEffect as D, useLayoutEffect as Oi, useMemo as O, useRef as k, useState as A, useSyncExternalStore as ki } from "react";
|
|
126
|
+
import { jsx as j, jsxs as Ai } from "react/jsx-runtime";
|
|
125
127
|
//#region src/shared/assistant/ui/AssistantChatArea.tsx
|
|
126
|
-
var
|
|
128
|
+
var ji = 2500, Mi = 600, Ni = 2e4, Pi = 1e4, Fi = 1e4, Ii = !1, Li = {
|
|
127
129
|
committing: !1,
|
|
128
130
|
dictating: !1
|
|
129
|
-
},
|
|
131
|
+
}, Ri = 6e3;
|
|
130
132
|
function M() {
|
|
131
133
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
132
134
|
}
|
|
133
|
-
var
|
|
134
|
-
let N = s(), { product: P, modes: F, gatherPageContext:
|
|
135
|
+
var zi = () => () => {}, Bi = () => "off", Vi = ({ visible: Vi = !0, writeAccess: Hi = "unknown", presentation: Ui = "classic" }) => {
|
|
136
|
+
let N = s(), Wi = Ui === "compact", { product: P, modes: F, gatherPageContext: Gi, buildPrompt: Ki, reportTurnTimings: qi, reportTokenUsage: Ji, localUiCommands: Yi } = o(), I = b(o().writeApproval), Xi = E((e, t) => {
|
|
135
137
|
let n = v.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
|
|
136
138
|
return bt({
|
|
137
139
|
mode: e,
|
|
138
140
|
productWriteApproval: I,
|
|
139
141
|
capabilities: r ? n.sandboxWriteCapabilities[r] : null
|
|
140
142
|
});
|
|
141
|
-
}, [I]), { getAccessToken:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
]),
|
|
143
|
+
}, [I]), { getAccessToken: Zi, getWorkspaceToken: Qi, userId: L } = r(), { locale: R, isLocaleLoading: $i } = e(), ea = v((e) => e.voiceGraceMs), ta = v((e) => e.handsFreeInterrupt), na = v((e) => e.handsFreeStreamNoticeAccepted), ra = v((e) => e.acceptHandsFreeStreamNotice), ia = v((e) => e.assistantLanguage), aa = v((e) => e.replyLanguage), oa = O(() => it(ia, aa, R), [
|
|
144
|
+
ia,
|
|
145
|
+
aa,
|
|
146
|
+
R
|
|
147
|
+
]), sa = oa.reply.english, ca = oa.replyIsExplicit, la = oa.reply.code, { conversations: ua, activeConversationId: z, mode: B, processingByConversationId: da, setMode: fa, setConversationMode: pa, setActiveConversation: ma, createConversation: ha, addMessage: V, updateMessage: ga, patchMessage: _a, mergeMessageMetadata: va, setConversationProcessing: ya, clearConversationProcessing: ba, setBackendSessionId: xa, clearBackendSessionId: Sa, setSandbox: Ca, clearSandbox: wa, acknowledgedWriteModes: Ta, acknowledgeWriteMode: Ea, autoRouting: Da, setAutoRouting: Oa, routeConversation: ka } = v(), H = ua.find((e) => e.id === z), Aa = kr(H), ja = Aa.all, U = z ? da[z] : void 0, W = It(U?.status), Ma = W ? U?.messageId ?? null : null, Na = U?.status === "error" ? U.messageId : null, Pa = v((e) => e.sandboxWriteCapabilities), { panel: G, entries: Fa, retiredSandboxes: Ia } = Un({
|
|
146
148
|
tr: N,
|
|
147
149
|
productWriteApproval: I
|
|
148
|
-
}),
|
|
150
|
+
}), La = Ln({
|
|
149
151
|
approve: (e, t) => G.approve(e, t),
|
|
150
152
|
decline: (e, t, n) => G.decline(e, t, n),
|
|
151
153
|
presented: (e, t) => G.presented(e, t)
|
|
152
|
-
}),
|
|
154
|
+
}), Ra = La.dismiss, za = k(null);
|
|
153
155
|
D(() => {
|
|
154
|
-
|
|
155
|
-
let e =
|
|
156
|
-
|
|
156
|
+
Ra();
|
|
157
|
+
let e = za.current;
|
|
158
|
+
za.current = z, e && e !== z && G.withdraw(e, "conversation_closed"), z && G.openConversation(z);
|
|
157
159
|
}, [
|
|
158
|
-
|
|
160
|
+
z,
|
|
159
161
|
G,
|
|
160
|
-
|
|
162
|
+
Ra
|
|
161
163
|
]);
|
|
162
|
-
let
|
|
164
|
+
let Ba = nr(H), Va = hr(H)?.archivedAt != null, Ha = ir((e) => z !== null && z in e.loadingIds), Ua = ir((e) => z !== null && z in e.loadErrorIds), Wa = ir((e) => e.remoteDelete), [Ga, Ka] = A(() => ir.getState().remoteDelete?.at ?? null), qa = Wa?.wasActive === !0 && Wa.at !== Ga ? Wa.at : null;
|
|
163
165
|
D(() => {
|
|
164
|
-
if (
|
|
165
|
-
let e = window.setTimeout(() =>
|
|
166
|
+
if (qa === null) return;
|
|
167
|
+
let e = window.setTimeout(() => Ka(qa), Fi);
|
|
166
168
|
return () => window.clearTimeout(e);
|
|
167
|
-
}, [
|
|
168
|
-
let { canUseApiCalls:
|
|
169
|
-
loading:
|
|
170
|
-
canUseAdminModes:
|
|
171
|
-
})).current,
|
|
169
|
+
}, [qa]);
|
|
170
|
+
let { canUseApiCalls: Ja, loading: Ya } = Or(C(), L), Xa = k(Dt({
|
|
171
|
+
loading: Ya,
|
|
172
|
+
canUseAdminModes: Ja
|
|
173
|
+
})).current, Za = k(F);
|
|
172
174
|
D(() => {
|
|
173
|
-
|
|
175
|
+
Za.current = F;
|
|
174
176
|
}, [F]);
|
|
175
|
-
let
|
|
177
|
+
let Qa = () => {
|
|
176
178
|
let e = v.getState().activeConversationId;
|
|
177
|
-
e &&
|
|
178
|
-
},
|
|
179
|
+
e && ar.openConversation(e, { modes: Za.current });
|
|
180
|
+
}, $a = () => {
|
|
179
181
|
let e = v.getState().activeConversationId;
|
|
180
|
-
e &&
|
|
181
|
-
},
|
|
182
|
+
e && ar.loadEarlier(e);
|
|
183
|
+
}, eo = k(Zi);
|
|
182
184
|
D(() => {
|
|
183
|
-
|
|
184
|
-
}, [
|
|
185
|
-
let
|
|
185
|
+
eo.current = Zi;
|
|
186
|
+
}, [Zi]);
|
|
187
|
+
let to = !!P && qi !== !1;
|
|
186
188
|
D(() => {
|
|
187
|
-
if (
|
|
189
|
+
if (to) return bn({ send: (e) => yn(e, {
|
|
188
190
|
workspaceId: C(),
|
|
189
191
|
authContext: {
|
|
190
|
-
accessToken:
|
|
192
|
+
accessToken: eo.current(),
|
|
191
193
|
organizationId: Pt()
|
|
192
194
|
}
|
|
193
195
|
}) });
|
|
194
|
-
}, [
|
|
195
|
-
|
|
196
|
-
loading:
|
|
197
|
-
canUseAdminModes:
|
|
196
|
+
}, [to]), D(() => {
|
|
197
|
+
Xa.update({
|
|
198
|
+
loading: Ya,
|
|
199
|
+
canUseAdminModes: Ja
|
|
198
200
|
});
|
|
199
201
|
}, [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
Xa,
|
|
203
|
+
Ya,
|
|
204
|
+
Ja
|
|
203
205
|
]), D(() => () => {
|
|
204
|
-
|
|
205
|
-
}, [
|
|
206
|
-
let
|
|
206
|
+
Xa.abandon();
|
|
207
|
+
}, [Xa]);
|
|
208
|
+
let no = O(() => F.filter((e) => !e.requiresAdmin || Ja), [F, Ja]), ro = ne(no), io = Da && ro, ao = k(ro);
|
|
207
209
|
D(() => {
|
|
208
|
-
|
|
209
|
-
}, [
|
|
210
|
-
let
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}, [
|
|
214
|
-
let
|
|
215
|
-
e &&
|
|
210
|
+
ao.current = ro;
|
|
211
|
+
}, [ro]);
|
|
212
|
+
let oo = k(null), so = k(!1), [co, lo] = A(!1), uo = ht(F), [fo, po] = A(null), [mo, ho] = A(null), go = mo !== null && mo === z, K = Sn(), _o = Cn(), q = K.open && _o !== null, vo = K.close, yo = k(q);
|
|
213
|
+
Oi(() => {
|
|
214
|
+
yo.current = q;
|
|
215
|
+
}, [q]);
|
|
216
|
+
let bo = E((e) => {
|
|
217
|
+
e && yo.current || ho(e ? v.getState().activeConversationId : null);
|
|
216
218
|
}, []);
|
|
217
219
|
D(() => {
|
|
218
|
-
|
|
219
|
-
}, [
|
|
220
|
-
let
|
|
221
|
-
|
|
222
|
-
}, []),
|
|
220
|
+
ho((e) => e !== null && e !== z ? null : e);
|
|
221
|
+
}, [z]);
|
|
222
|
+
let xo = k(void 0), [So, Co] = A(!1), wo = E((e) => {
|
|
223
|
+
xo.current = e, Co(ot(e));
|
|
224
|
+
}, []), To = E(() => {
|
|
223
225
|
let e = v.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
|
|
224
226
|
return !t || !n ? null : {
|
|
225
227
|
id: t,
|
|
226
|
-
reusableDraft:
|
|
228
|
+
reusableDraft: rr(n, ie()),
|
|
227
229
|
liveProposals: G.liveFor(t).count,
|
|
228
230
|
turnInFlight: It(e.processingByConversationId[t]?.status)
|
|
229
231
|
};
|
|
230
|
-
}, [G]),
|
|
231
|
-
let t = e.sandboxesByMode[
|
|
232
|
+
}, [G]), Eo = k({}), J = k(Dn()), Do = k(new Nr()), Oo = k(/* @__PURE__ */ new Set()), ko = O(() => F.find((e) => e.id === B), [F, B]), Ao = v((e) => {
|
|
233
|
+
let t = e.sandboxesByMode[B]?.sandboxId;
|
|
232
234
|
return t ? e.sandboxWriteCapabilities[t] : void 0;
|
|
233
|
-
}),
|
|
234
|
-
mode:
|
|
235
|
+
}), jo = ko !== void 0 && bt({
|
|
236
|
+
mode: B,
|
|
235
237
|
productWriteApproval: I,
|
|
236
|
-
capabilities:
|
|
237
|
-
}),
|
|
238
|
+
capabilities: Ao
|
|
239
|
+
}), Mo = B === "assistant" || ko !== void 0 && !ko.writeCapable && !Ce(B) || jo;
|
|
238
240
|
D(() => {
|
|
239
|
-
if (
|
|
240
|
-
|
|
241
|
+
if (B !== "assistant" && ko?.writeCapable && !de(Ta, B)) {
|
|
242
|
+
fa("assistant");
|
|
241
243
|
return;
|
|
242
244
|
}
|
|
243
|
-
|
|
245
|
+
Ya || (!ko || ko.requiresAdmin && !Ja) && B !== "assistant" && fa("assistant");
|
|
244
246
|
}, [
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
247
|
+
B,
|
|
248
|
+
ko,
|
|
249
|
+
Ja,
|
|
250
|
+
Ya,
|
|
251
|
+
fa,
|
|
252
|
+
Ta
|
|
251
253
|
]);
|
|
252
|
-
let
|
|
253
|
-
|
|
254
|
-
}, [
|
|
254
|
+
let No = E((e, t, n, r) => {
|
|
255
|
+
ya(e, n, t, null, r);
|
|
256
|
+
}, [ya]), Po = E(async (e, t, n, r, i, a = null) => {
|
|
255
257
|
let o = (e, t) => {
|
|
256
|
-
r &&
|
|
258
|
+
r && No(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
|
|
257
259
|
}, s = (e) => {
|
|
258
260
|
r && T(r.assistantMessageId, e);
|
|
259
261
|
}, c = () => {
|
|
260
262
|
s("bootAdopted"), a?.beginBoot();
|
|
261
263
|
}, l = () => a !== null && (a.signal.aborted || C() !== t), u = () => {
|
|
262
|
-
if (l()) throw new
|
|
264
|
+
if (l()) throw new Pr("cancelled");
|
|
263
265
|
}, d = v.getState().sandboxesByMode[e]?.sandboxId ?? null, p = !1, ee = !1, m = !1, te = !1, ne = !1, re = async (r) => {
|
|
264
|
-
if (i && !
|
|
266
|
+
if (i && !Do.current.has(r) && J.current.isFresh(r)) return p = !0, !0;
|
|
265
267
|
m = !0;
|
|
266
268
|
let o = !1;
|
|
267
269
|
try {
|
|
@@ -269,43 +271,43 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
269
271
|
o = !0, c();
|
|
270
272
|
});
|
|
271
273
|
} catch {
|
|
272
|
-
if (l()) throw new
|
|
273
|
-
return
|
|
274
|
+
if (l()) throw new Pr("cancelled");
|
|
275
|
+
return J.current.invalidate(r), Do.current.add(r), a?.dead.push(r), ne = !0, !1;
|
|
274
276
|
}
|
|
275
|
-
return u(),
|
|
277
|
+
return u(), J.current.markVerified(r), o && (te = !0), !0;
|
|
276
278
|
};
|
|
277
|
-
if (d && (
|
|
279
|
+
if (d && (Ca(e, d, "provisioning"), o("provisioning", "reusingEnvironment"), await re(d) || (Ca(e, null, "provisioning"), d = null)), !d) {
|
|
278
280
|
o("provisioning", "lookingForEnvironment");
|
|
279
|
-
let r = await ve(t, P, e,
|
|
281
|
+
let r = await ve(t, P, e, Si(), n, Do.current, I);
|
|
280
282
|
u();
|
|
281
283
|
let i = r?.id ?? null;
|
|
282
284
|
if (i) {
|
|
283
|
-
|
|
285
|
+
Ca(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
|
|
284
286
|
let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
|
|
285
|
-
t && c(), await re(i) ? (d = i, t && (te = !0)) :
|
|
287
|
+
t && c(), await re(i) ? (d = i, t && (te = !0)) : Ca(e, null, "provisioning");
|
|
286
288
|
}
|
|
287
289
|
}
|
|
288
290
|
if (!d) {
|
|
289
|
-
if (a && !a.mayCreate) throw new
|
|
290
|
-
if (s("provisionStarted"), e === "api-calls" && !
|
|
291
|
-
o("provisioning", "startingEnvironment"),
|
|
292
|
-
let r = a ? [] : await Ee(t, P, e,
|
|
291
|
+
if (a && !a.mayCreate) throw new Pr("no-create");
|
|
292
|
+
if (s("provisionStarted"), e === "api-calls" && !Zi()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
293
|
+
o("provisioning", "startingEnvironment"), Ca(e, null, "provisioning");
|
|
294
|
+
let r = a ? [] : await Ee(t, P, e, Si(), n, Do.current, I);
|
|
293
295
|
if (r.length > 0) {
|
|
294
296
|
let e = new Set(r);
|
|
295
|
-
for (let e of r)
|
|
297
|
+
for (let e of r) J.current.invalidate(e), Do.current.add(e);
|
|
296
298
|
let t = v.getState().sandboxesByMode;
|
|
297
|
-
for (let [n, r] of Object.entries(t)) f(n) && r?.sandboxId && e.has(r.sandboxId) &&
|
|
299
|
+
for (let [n, r] of Object.entries(t)) f(n) && r?.sandboxId && e.has(r.sandboxId) && wa(n);
|
|
298
300
|
}
|
|
299
301
|
s("createRequested");
|
|
300
302
|
let i = a?.beginCreate();
|
|
301
303
|
try {
|
|
302
|
-
d = await ge(P, e, t,
|
|
304
|
+
d = await ge(P, e, t, Si(), Mi, n, { writeApproval: I });
|
|
303
305
|
} finally {
|
|
304
306
|
i?.();
|
|
305
307
|
}
|
|
306
|
-
ee = !0, u(),
|
|
308
|
+
ee = !0, u(), Ca(e, d, "provisioning"), await ke(d, t, n, 3e5), u(), s("sandboxRunning"), await Oe(d, t, e, n, 9e4), u(), s("serviceReady"), J.current.markVerified(d);
|
|
307
309
|
}
|
|
308
|
-
return
|
|
310
|
+
return Ca(e, d, "running"), {
|
|
309
311
|
sandboxId: d,
|
|
310
312
|
sandboxIsNew: ee,
|
|
311
313
|
sandboxProbed: m,
|
|
@@ -314,20 +316,20 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
314
316
|
trustedFromCache: p
|
|
315
317
|
};
|
|
316
318
|
}, [
|
|
317
|
-
|
|
318
|
-
|
|
319
|
+
wa,
|
|
320
|
+
Zi,
|
|
319
321
|
P,
|
|
320
322
|
I,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
]),
|
|
324
|
-
let s = await
|
|
325
|
-
for (let e of s.dead)
|
|
326
|
-
s.verified && !
|
|
327
|
-
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await
|
|
323
|
+
Ca,
|
|
324
|
+
No
|
|
325
|
+
]), Fo = E(async function e(t, n, r, i, a, o = {}) {
|
|
326
|
+
let s = await Br(i, r, (e) => No(t, n, "provisioning", e), () => T(n, "prewarmJoined"));
|
|
327
|
+
for (let e of s.dead) J.current.invalidate(e), Do.current.add(e);
|
|
328
|
+
s.verified && !Do.current.has(s.verified) && J.current.markVerified(s.verified), s.joined && w(n, { prewarm: s.joined });
|
|
329
|
+
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await Po(r, i, a, {
|
|
328
330
|
conversationId: t,
|
|
329
331
|
assistantMessageId: n
|
|
330
|
-
}, o.trustCache !== !1), ee =
|
|
332
|
+
}, o.trustCache !== !1), ee = Ir(i, r, c);
|
|
331
333
|
!s.waited && ee && w(n, { prewarm: "hit" });
|
|
332
334
|
let m = v.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, te = !1, ne = null;
|
|
333
335
|
if (m) {
|
|
@@ -337,36 +339,36 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
337
339
|
if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
|
|
338
340
|
ne = e;
|
|
339
341
|
} catch {
|
|
340
|
-
|
|
342
|
+
Sa(t), m = null;
|
|
341
343
|
}
|
|
342
344
|
}
|
|
343
345
|
let re = !1;
|
|
344
346
|
if (!m) {
|
|
345
|
-
let e =
|
|
347
|
+
let e = Fr(Lr({
|
|
346
348
|
workspaceId: i,
|
|
347
349
|
mode: r,
|
|
348
350
|
sandboxId: c,
|
|
349
|
-
userId:
|
|
351
|
+
userId: L
|
|
350
352
|
}), Date.now());
|
|
351
353
|
if (e) {
|
|
352
|
-
"pending" in e &&
|
|
354
|
+
"pending" in e && No(t, n, "connecting", "preparingSession");
|
|
353
355
|
let o = "sessionId" in e ? e.sessionId : await e.pending;
|
|
354
|
-
if (o && !
|
|
355
|
-
(await xe(c, i, o, r, a)).mode === r && (m = o, re = !0,
|
|
356
|
+
if (o && !Do.current.has(c)) try {
|
|
357
|
+
(await xe(c, i, o, r, a)).mode === r && (m = o, re = !0, xa(t, m), te = !0);
|
|
356
358
|
} catch {}
|
|
357
359
|
}
|
|
358
360
|
}
|
|
359
361
|
if (!m) {
|
|
360
|
-
|
|
362
|
+
No(t, n, "connecting", "preparingSession");
|
|
361
363
|
let s;
|
|
362
364
|
try {
|
|
363
365
|
s = await y(c, i, r, a);
|
|
364
366
|
} catch (s) {
|
|
365
367
|
if (p) {
|
|
366
|
-
|
|
368
|
+
J.current.invalidate(c);
|
|
367
369
|
let l = kn(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
|
|
368
|
-
if (l === "check-network" && (l = await On(() => ve(i, P, r,
|
|
369
|
-
p || w(n, { cacheProofFailed: !0 }), l === "replace" && (
|
|
370
|
+
if (l === "check-network" && (l = await On(() => ve(i, P, r, Si(), a, Do.current, I))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
|
|
371
|
+
p || w(n, { cacheProofFailed: !0 }), l === "replace" && (Do.current.add(c), Sa(t), wa(r), G.retireSandbox(c));
|
|
370
372
|
let s = await e(t, n, r, i, a, {
|
|
371
373
|
...o,
|
|
372
374
|
trustCache: !1
|
|
@@ -381,7 +383,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
381
383
|
}
|
|
382
384
|
throw s;
|
|
383
385
|
}
|
|
384
|
-
m = s.sessionId,
|
|
386
|
+
m = s.sessionId, xa(t, m), te = !0;
|
|
385
387
|
}
|
|
386
388
|
return {
|
|
387
389
|
sandboxId: c,
|
|
@@ -395,67 +397,67 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
395
397
|
sessionPreopened: re
|
|
396
398
|
};
|
|
397
399
|
}, [
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
400
|
+
Po,
|
|
401
|
+
Sa,
|
|
402
|
+
wa,
|
|
401
403
|
P,
|
|
402
404
|
I,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
405
|
+
xa,
|
|
406
|
+
No,
|
|
407
|
+
L,
|
|
406
408
|
G
|
|
407
|
-
]),
|
|
409
|
+
]), Io = E((e, t = !1) => {
|
|
408
410
|
let n = C();
|
|
409
411
|
if (!n) return;
|
|
410
|
-
let r = v.getState(), i = Date.now(), a =
|
|
412
|
+
let r = v.getState(), i = Date.now(), a = zr({
|
|
411
413
|
autoRouting: r.autoRouting,
|
|
412
|
-
autoOffered:
|
|
414
|
+
autoOffered: ao.current,
|
|
413
415
|
active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
|
|
414
416
|
selectedMode: r.mode,
|
|
415
417
|
autoReadMode: p,
|
|
416
|
-
modes:
|
|
418
|
+
modes: Za.current,
|
|
417
419
|
acknowledgedWriteModes: r.acknowledgedWriteModes,
|
|
418
|
-
adminAccess:
|
|
420
|
+
adminAccess: Xa.read(),
|
|
419
421
|
dictated: e,
|
|
420
|
-
voiceProposalBound: (e) =>
|
|
422
|
+
voiceProposalBound: (e) => Xi(e),
|
|
421
423
|
turnInFlight: Object.values(r.processingByConversationId).some((e) => It(e?.status)),
|
|
422
|
-
...
|
|
424
|
+
...Ur(n),
|
|
423
425
|
now: i
|
|
424
426
|
});
|
|
425
427
|
if (!a) return;
|
|
426
|
-
let o =
|
|
427
|
-
accessToken:
|
|
428
|
-
workspaceToken:
|
|
429
|
-
userId:
|
|
428
|
+
let o = Hr(n, a, i), s = {
|
|
429
|
+
accessToken: Zi(),
|
|
430
|
+
workspaceToken: Qi(),
|
|
431
|
+
userId: L,
|
|
430
432
|
organizationId: Pt()
|
|
431
433
|
};
|
|
432
|
-
|
|
434
|
+
Po(a.mode, n, s, null, !0, o).then((e) => {
|
|
433
435
|
if (o.finish({
|
|
434
436
|
ok: !0,
|
|
435
437
|
sandboxId: e.sandboxId,
|
|
436
438
|
didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
|
|
437
439
|
booted: e.sandboxIsNew || e.sandboxAdopted,
|
|
438
440
|
dead: o.dead
|
|
439
|
-
}), o.signal.aborted || C() !== n ||
|
|
441
|
+
}), o.signal.aborted || C() !== n || Do.current.has(e.sandboxId)) return;
|
|
440
442
|
let r = v.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = ie();
|
|
441
|
-
|
|
443
|
+
Rr({
|
|
442
444
|
active: i ? {
|
|
443
445
|
mode: i.mode,
|
|
444
446
|
backendSessionId: i.backendSessionId,
|
|
445
|
-
continuable: !
|
|
446
|
-
hasHistory:
|
|
447
|
+
continuable: !nr(i) && !tr(i, c),
|
|
448
|
+
hasHistory: er(i)
|
|
447
449
|
} : void 0,
|
|
448
450
|
mode: a.mode
|
|
449
|
-
}) &&
|
|
451
|
+
}) && Vr(Lr({
|
|
450
452
|
workspaceId: n,
|
|
451
453
|
mode: a.mode,
|
|
452
454
|
sandboxId: e.sandboxId,
|
|
453
|
-
userId:
|
|
455
|
+
userId: L
|
|
454
456
|
}), () => y(e.sandboxId, n, a.mode, s).then((e) => e.sessionId), Date.now());
|
|
455
457
|
}, (e) => {
|
|
456
|
-
if (!(e instanceof
|
|
458
|
+
if (!(e instanceof Pr) && !o.signal.aborted && C() === n) {
|
|
457
459
|
let e = v.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
|
|
458
|
-
e && (
|
|
460
|
+
e && (J.current.invalidate(e), Do.current.add(e), o.dead.push(e), wa(a.mode));
|
|
459
461
|
}
|
|
460
462
|
o.finish({
|
|
461
463
|
ok: !1,
|
|
@@ -465,43 +467,43 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
465
467
|
});
|
|
466
468
|
});
|
|
467
469
|
}, [
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
470
|
+
Po,
|
|
471
|
+
Xa,
|
|
472
|
+
wa,
|
|
473
|
+
Zi,
|
|
474
|
+
Qi,
|
|
471
475
|
L,
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
]),
|
|
476
|
-
D(() => () => Fo.cancel(), [Fo]);
|
|
477
|
-
let Io = Di(_, se, se)?.reference ?? null, [Lo, Ro] = A(0), zo = k(/* @__PURE__ */ new Set()), Bo = k(null), Vo = E(() => {
|
|
476
|
+
Xi
|
|
477
|
+
]), Lo = k(!1), Ro = k(null), zo = O(() => wi(), []);
|
|
478
|
+
D(() => () => zo.cancel(), [zo]);
|
|
479
|
+
let Bo = ki(_, se, se)?.reference ?? null, [Vo, Ho] = A(0), Uo = k(/* @__PURE__ */ new Set()), Wo = k(null), Go = E(() => {
|
|
478
480
|
let e = v.getState(), t = e.activeConversationId;
|
|
479
481
|
if (!t) return null;
|
|
480
482
|
let n = e.processingByConversationId[t], r = It(n?.status) ? n?.messageId ?? null : null;
|
|
481
483
|
if (!Rt({
|
|
482
484
|
interruptedTurnId: r,
|
|
483
485
|
activeTurnId: r,
|
|
484
|
-
alreadyRequested: r ?
|
|
486
|
+
alreadyRequested: r ? Uo.current.has(r) : !1
|
|
485
487
|
}).send || !r) return null;
|
|
486
|
-
|
|
488
|
+
Uo.current.add(r);
|
|
487
489
|
let i = pe(e), a = C(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
|
|
488
490
|
return !i || !a || !o || me(i.sandboxId, a, o, i.mode, {
|
|
489
|
-
accessToken:
|
|
490
|
-
workspaceToken:
|
|
491
|
-
userId:
|
|
491
|
+
accessToken: Zi(),
|
|
492
|
+
workspaceToken: Qi(),
|
|
493
|
+
userId: L,
|
|
492
494
|
organizationId: Pt()
|
|
493
495
|
}), r;
|
|
494
496
|
}, [
|
|
495
|
-
R,
|
|
496
497
|
L,
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
Zi,
|
|
499
|
+
Qi
|
|
500
|
+
]), Ko = E(() => {
|
|
501
|
+
let e = Go();
|
|
500
502
|
return e && (Ze(e), qe.abort(e)), e;
|
|
501
|
-
}, [
|
|
503
|
+
}, [Go]), qo = E(() => {
|
|
502
504
|
let e = v.getState().activeConversationId;
|
|
503
|
-
|
|
504
|
-
}, [
|
|
505
|
+
Ko(), e && G.declineForReply(e, "corrected", "spoken");
|
|
506
|
+
}, [Ko, G]), Jo = E(async (e) => {
|
|
505
507
|
let t = v.getState(), n = pe(t), r = C(), i = t.activeConversationId;
|
|
506
508
|
if (!n || !r || !i || Bn(t.sandboxWriteCapabilities[n.sandboxId])) return;
|
|
507
509
|
let a = t.conversations.find((e) => e.id === i), o = a ? le(x(a.messages), {
|
|
@@ -510,7 +512,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
510
512
|
nowMs: Date.now()
|
|
511
513
|
}) : null;
|
|
512
514
|
if (o?.reference !== e) {
|
|
513
|
-
|
|
515
|
+
Ho((e) => e + 1);
|
|
514
516
|
return;
|
|
515
517
|
}
|
|
516
518
|
let s = {
|
|
@@ -520,13 +522,13 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
520
522
|
if (!oe(s)) return;
|
|
521
523
|
try {
|
|
522
524
|
await he(n.sandboxId, r, e, n.mode, {
|
|
523
|
-
accessToken:
|
|
524
|
-
workspaceToken:
|
|
525
|
-
userId:
|
|
525
|
+
accessToken: Zi(),
|
|
526
|
+
workspaceToken: Qi(),
|
|
527
|
+
userId: L,
|
|
526
528
|
organizationId: Pt()
|
|
527
529
|
});
|
|
528
530
|
} catch (e) {
|
|
529
|
-
h(s),
|
|
531
|
+
h(s), V(i, {
|
|
530
532
|
id: M(),
|
|
531
533
|
role: "system",
|
|
532
534
|
content: e instanceof Error ? e.message : "The change could not be approved.",
|
|
@@ -534,67 +536,67 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
534
536
|
});
|
|
535
537
|
return;
|
|
536
538
|
}
|
|
537
|
-
h(s),
|
|
539
|
+
h(s), va(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
538
540
|
let c = v.getState(), l = c.conversations.find((e) => e.id === i);
|
|
539
|
-
c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || pe(c)?.sandboxId !== n.sandboxId || It(c.processingByConversationId[i]?.status) || g(x(l.messages)) !== o.messageId ||
|
|
541
|
+
c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || pe(c)?.sandboxId !== n.sandboxId || It(c.processingByConversationId[i]?.status) || g(x(l.messages)) !== o.messageId || $s.current(N("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
|
|
540
542
|
approvalFollowUp: { approvedReplyId: o.messageId },
|
|
541
543
|
targetConversationId: i
|
|
542
544
|
});
|
|
543
545
|
}, [
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
546
|
+
L,
|
|
547
|
+
V,
|
|
548
|
+
va,
|
|
547
549
|
N
|
|
548
|
-
]),
|
|
549
|
-
let n =
|
|
550
|
+
]), Yo = n(), { speakFinishedReply: Xo, speakingMessageId: Zo, stop: Qo } = xn(), $o = k(null), es = E((e, t) => {
|
|
551
|
+
let n = $o.current;
|
|
550
552
|
n?.token === e && n.exchange === null && (n.exchange = t);
|
|
551
|
-
}, []),
|
|
552
|
-
let t =
|
|
553
|
+
}, []), ts = E((e) => {
|
|
554
|
+
let t = $o.current;
|
|
553
555
|
e !== void 0 && t?.token === e && (t.handled = !0);
|
|
554
|
-
}, []),
|
|
555
|
-
|
|
556
|
-
}, [
|
|
557
|
-
theme:
|
|
558
|
-
navigate:
|
|
559
|
-
navItems:
|
|
560
|
-
options:
|
|
561
|
-
navPermissionsSettled:
|
|
562
|
-
navSimulating:
|
|
556
|
+
}, []), ns = E((e, t) => {
|
|
557
|
+
es(e, t), yo.current && Je(t);
|
|
558
|
+
}, [es]), rs = c(), { items: is, permissionsSettled: as, simulating: os } = Di(), Y = k({
|
|
559
|
+
theme: Yo,
|
|
560
|
+
navigate: rs,
|
|
561
|
+
navItems: is,
|
|
562
|
+
options: Yi ?? {},
|
|
563
|
+
navPermissionsSettled: as,
|
|
564
|
+
navSimulating: os
|
|
563
565
|
});
|
|
564
566
|
D(() => {
|
|
565
567
|
Y.current = {
|
|
566
|
-
theme:
|
|
567
|
-
navigate:
|
|
568
|
-
navItems:
|
|
569
|
-
options:
|
|
570
|
-
navPermissionsSettled:
|
|
571
|
-
navSimulating:
|
|
568
|
+
theme: Yo,
|
|
569
|
+
navigate: rs,
|
|
570
|
+
navItems: is,
|
|
571
|
+
options: Yi ?? {},
|
|
572
|
+
navPermissionsSettled: as,
|
|
573
|
+
navSimulating: os
|
|
572
574
|
};
|
|
573
575
|
}, [
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
576
|
+
Yo,
|
|
577
|
+
rs,
|
|
578
|
+
is,
|
|
579
|
+
Yi,
|
|
580
|
+
as,
|
|
581
|
+
os
|
|
580
582
|
]);
|
|
581
583
|
let X = k(!0);
|
|
582
584
|
D(() => (X.current = !0, () => {
|
|
583
585
|
X.current = !1;
|
|
584
586
|
}), []);
|
|
585
|
-
let
|
|
587
|
+
let ss = k({
|
|
586
588
|
tr: N,
|
|
587
|
-
locale:
|
|
588
|
-
}),
|
|
589
|
-
|
|
590
|
-
let t =
|
|
591
|
-
t && (
|
|
592
|
-
if (
|
|
589
|
+
locale: R
|
|
590
|
+
}), cs = k(null), [ls, us] = A(null), ds = k(null), fs = E((e) => {
|
|
591
|
+
ds.current !== null && (window.clearTimeout(ds.current), ds.current = null);
|
|
592
|
+
let t = cs.current;
|
|
593
|
+
t && (cs.current = null, window.clearTimeout(t.deadline), X.current && us(null), !(!e || !X.current) && (ds.current = window.setTimeout(() => {
|
|
594
|
+
if (ds.current = null, !X.current) return;
|
|
593
595
|
let e = v.getState();
|
|
594
596
|
if (e.activeConversationId !== t.conversationId) return;
|
|
595
597
|
let n = e.conversations.find((e) => e.id === t.conversationId)?.messages.find((e) => e.id === t.messageId);
|
|
596
598
|
if (!n) return;
|
|
597
|
-
let r =
|
|
599
|
+
let r = ss.current, i = rn(n, null, r.tr);
|
|
598
600
|
if (i.kind !== "output") return;
|
|
599
601
|
let a = tn(n, r.tr);
|
|
600
602
|
qe.publish(n.id, {
|
|
@@ -606,47 +608,47 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
606
608
|
final: !0
|
|
607
609
|
});
|
|
608
610
|
}, 0)));
|
|
609
|
-
}, []),
|
|
611
|
+
}, []), ps = E(() => fs(!0), [fs]);
|
|
610
612
|
D(() => {
|
|
611
|
-
|
|
613
|
+
ss.current = {
|
|
612
614
|
tr: N,
|
|
613
|
-
locale:
|
|
615
|
+
locale: R
|
|
614
616
|
};
|
|
615
|
-
let e =
|
|
617
|
+
let e = cs.current;
|
|
616
618
|
if (!e) return;
|
|
617
619
|
let t = nn({
|
|
618
620
|
wanted: e.wanted,
|
|
619
|
-
locale:
|
|
620
|
-
isLoading:
|
|
621
|
+
locale: R,
|
|
622
|
+
isLoading: $i(e.wanted),
|
|
621
623
|
translatedNow: $t(N, e.reply).translated
|
|
622
624
|
});
|
|
623
625
|
if (t === "write") {
|
|
624
|
-
|
|
626
|
+
ps();
|
|
625
627
|
return;
|
|
626
628
|
}
|
|
627
629
|
if (t === "grace") {
|
|
628
|
-
let e = window.setTimeout(
|
|
630
|
+
let e = window.setTimeout(ps, 400);
|
|
629
631
|
return () => window.clearTimeout(e);
|
|
630
632
|
}
|
|
631
633
|
}, [
|
|
632
634
|
N,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
]), D(() => () =>
|
|
638
|
-
let
|
|
635
|
+
R,
|
|
636
|
+
$i,
|
|
637
|
+
ls,
|
|
638
|
+
ps
|
|
639
|
+
]), D(() => () => fs(!1), [fs]);
|
|
640
|
+
let ms = k(null), [hs, gs] = A(!1), [_s, vs] = A(null), [Z] = A(() => new Ae()), [ys, bs] = A(0), xs = E(() => bs((e) => e + 1), []), Ss = E(() => {
|
|
639
641
|
let e = Y.current;
|
|
640
642
|
return {
|
|
641
|
-
destinations:
|
|
643
|
+
destinations: Xr(e.navItems),
|
|
642
644
|
permissionsSettled: e.navPermissionsSettled,
|
|
643
645
|
simulating: e.navSimulating
|
|
644
646
|
};
|
|
645
|
-
}, []),
|
|
647
|
+
}, []), Cs = k(L);
|
|
646
648
|
D(() => {
|
|
647
|
-
|
|
648
|
-
}, [
|
|
649
|
-
let
|
|
649
|
+
Cs.current = L;
|
|
650
|
+
}, [L]);
|
|
651
|
+
let ws = E((e, t) => {
|
|
650
652
|
let n = Z.replyIdOf(e), r = n ? Z.turnFor(n) : void 0, i = Z.offer(e), a = {
|
|
651
653
|
ok: !1,
|
|
652
654
|
reason: "gone",
|
|
@@ -658,8 +660,8 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
658
660
|
let o = r.conversationId, s = v.getState().conversations.find((e) => e.id === o);
|
|
659
661
|
if (!s) return a;
|
|
660
662
|
let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = Z.liveOffersFor(n, {
|
|
661
|
-
registry:
|
|
662
|
-
actorId:
|
|
663
|
+
registry: Ss(),
|
|
664
|
+
actorId: Cs.current,
|
|
663
665
|
conversationId: o,
|
|
664
666
|
perfNow: performance.now()
|
|
665
667
|
}).find((t) => t.offer.offerId === e);
|
|
@@ -673,7 +675,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
673
675
|
voiceSessionId: l
|
|
674
676
|
};
|
|
675
677
|
}
|
|
676
|
-
return Z.markUsed(e) ? (
|
|
678
|
+
return Z.markUsed(e) ? (xs(), {
|
|
677
679
|
ok: !0,
|
|
678
680
|
target: u.target,
|
|
679
681
|
conversationId: o,
|
|
@@ -681,33 +683,33 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
681
683
|
}) : a;
|
|
682
684
|
}, [
|
|
683
685
|
Z,
|
|
684
|
-
|
|
686
|
+
Ss,
|
|
685
687
|
N,
|
|
686
|
-
|
|
687
|
-
]),
|
|
688
|
+
xs
|
|
689
|
+
]), Ts = E((e, t, n, r, i) => {
|
|
688
690
|
let a = M();
|
|
689
|
-
|
|
691
|
+
V(e, {
|
|
690
692
|
id: a,
|
|
691
693
|
role: "system",
|
|
692
694
|
content: n.text,
|
|
693
695
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
694
696
|
metadata: {
|
|
695
|
-
lang: n.translated ?
|
|
697
|
+
lang: n.translated ? R : "en",
|
|
696
698
|
...i ? { localAction: i } : {},
|
|
697
699
|
...Ge(t)
|
|
698
700
|
}
|
|
699
|
-
}), i &&
|
|
700
|
-
}, [
|
|
701
|
+
}), i && ar.recordCommittedEntries(e, [a], "NOTE", r);
|
|
702
|
+
}, [V, R]), Es = E((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && Z.release(e), [Z]), Ds = k(null);
|
|
701
703
|
D(() => () => {
|
|
702
|
-
|
|
704
|
+
Ds.current?.(), Ds.current = null;
|
|
703
705
|
}, []);
|
|
704
|
-
let
|
|
705
|
-
|
|
706
|
-
}, []),
|
|
707
|
-
if (
|
|
708
|
-
let i =
|
|
706
|
+
let Os = E((e) => {
|
|
707
|
+
Ds.current?.(), Ds.current = X.current ? fr(document, e) : null;
|
|
708
|
+
}, []), ks = E((e, t, n, r = !1) => {
|
|
709
|
+
if (ms.current !== null) return;
|
|
710
|
+
let i = ws(e, n), a = C(), o = (e, t, n, r) => Ts(e, t, n, a, r);
|
|
709
711
|
if (!i.ok) {
|
|
710
|
-
i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy),
|
|
712
|
+
i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), xs();
|
|
711
713
|
return;
|
|
712
714
|
}
|
|
713
715
|
let { target: s, conversationId: c, voiceSessionId: l } = i, u = {
|
|
@@ -715,7 +717,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
715
717
|
offerId: e
|
|
716
718
|
};
|
|
717
719
|
if (r) {
|
|
718
|
-
o(c, l, Wt(N, s.label, !0),
|
|
720
|
+
o(c, l, Wt(N, s.label, !0), ii({
|
|
719
721
|
destinationId: s.id,
|
|
720
722
|
path: s.path,
|
|
721
723
|
alreadyHere: !0,
|
|
@@ -725,16 +727,16 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
725
727
|
return;
|
|
726
728
|
}
|
|
727
729
|
let d = M();
|
|
728
|
-
|
|
730
|
+
ms.current = d, gs(!0);
|
|
729
731
|
let f = (t) => {
|
|
730
732
|
try {
|
|
731
|
-
if (
|
|
733
|
+
if (Es(e, t) && (xs(), t.status === "kept" && Os(e)), t.status === "kept" || !v.getState().conversations.some((e) => e.id === c)) return;
|
|
732
734
|
let n = t.status === "arrived" || t.status === "redirected" ? t.landedPath : null;
|
|
733
735
|
o(c, l, Gt(N, t, {
|
|
734
736
|
page: s.label,
|
|
735
|
-
landed: n === null ? null :
|
|
737
|
+
landed: n === null ? null : oi(Xr(Y.current.navItems), n),
|
|
736
738
|
path: s.path
|
|
737
|
-
}),
|
|
739
|
+
}), ii({
|
|
738
740
|
destinationId: s.id,
|
|
739
741
|
path: s.path,
|
|
740
742
|
alreadyHere: !1,
|
|
@@ -743,10 +745,10 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
743
745
|
offer: u
|
|
744
746
|
}));
|
|
745
747
|
} finally {
|
|
746
|
-
|
|
748
|
+
ms.current === d && (ms.current = null, X.current && gs(!1));
|
|
747
749
|
}
|
|
748
750
|
};
|
|
749
|
-
|
|
751
|
+
ei(Y.current.navigate, s.path, {
|
|
750
752
|
readPath: () => window.location.pathname + window.location.search,
|
|
751
753
|
now: () => Date.now(),
|
|
752
754
|
schedule: (e, t) => {
|
|
@@ -757,20 +759,20 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
757
759
|
surface: "offer"
|
|
758
760
|
}).then(f, () => f({ status: "unconfirmed" }));
|
|
759
761
|
}, [
|
|
760
|
-
|
|
761
|
-
|
|
762
|
+
ws,
|
|
763
|
+
Ts,
|
|
762
764
|
N,
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
]),
|
|
765
|
+
xs,
|
|
766
|
+
Es,
|
|
767
|
+
Os
|
|
768
|
+
]), As = E((e, t) => ks(e, "tap", t || null), [ks]), js = E((e) => {
|
|
767
769
|
let { replyId: t, conversationId: n } = e, r = Z.turnFor(t);
|
|
768
770
|
if (!r) return;
|
|
769
|
-
let i = window.location.pathname + window.location.search, a =
|
|
771
|
+
let i = window.location.pathname + window.location.search, a = Xr(Y.current.navItems), o = _i({
|
|
770
772
|
intent: e.intent,
|
|
771
773
|
live: Z.liveOffersFor(t, {
|
|
772
|
-
registry:
|
|
773
|
-
actorId:
|
|
774
|
+
registry: Ss(),
|
|
775
|
+
actorId: Cs.current,
|
|
774
776
|
conversationId: n,
|
|
775
777
|
perfNow: performance.now()
|
|
776
778
|
}),
|
|
@@ -782,50 +784,50 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
782
784
|
location: i,
|
|
783
785
|
conversationId: v.getState().activeConversationId,
|
|
784
786
|
workspaceId: C(),
|
|
785
|
-
actorId:
|
|
787
|
+
actorId: Cs.current ?? null
|
|
786
788
|
},
|
|
787
789
|
mounted: X.current,
|
|
788
790
|
visible: document.visibilityState === "visible",
|
|
789
|
-
unsavedChanges:
|
|
791
|
+
unsavedChanges: vi(Y.current.options),
|
|
790
792
|
alreadyThere: ({ target: e }) => {
|
|
791
793
|
let t = a.find((t) => t.id === e.id);
|
|
792
|
-
return t ?
|
|
794
|
+
return t ? qr(t, i, a) : !1;
|
|
793
795
|
}
|
|
794
796
|
});
|
|
795
797
|
if (o.act === "navigate" || o.act === "already-here") {
|
|
796
|
-
|
|
798
|
+
ks(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
|
|
797
799
|
return;
|
|
798
800
|
}
|
|
799
801
|
let [s] = o.unsaved ?? [], [c] = Z.liveOffersFor(t, {
|
|
800
|
-
registry:
|
|
801
|
-
actorId:
|
|
802
|
+
registry: Ss(),
|
|
803
|
+
actorId: Cs.current,
|
|
802
804
|
conversationId: n,
|
|
803
805
|
perfNow: performance.now()
|
|
804
806
|
});
|
|
805
|
-
o.hold === "R5-unsaved" && s && c &&
|
|
807
|
+
o.hold === "R5-unsaved" && s && c && Ts(n, e.voiceSessionId, qt(N, s.label, c.target.label), C());
|
|
806
808
|
}, [
|
|
807
809
|
Z,
|
|
808
|
-
|
|
810
|
+
Ss,
|
|
809
811
|
G,
|
|
812
|
+
ks,
|
|
810
813
|
Ts,
|
|
811
|
-
xs,
|
|
812
814
|
N
|
|
813
|
-
]),
|
|
815
|
+
]), Ms = E((e) => {
|
|
814
816
|
let t = v.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
|
|
815
|
-
return n ?
|
|
816
|
-
}, []),
|
|
817
|
-
let { navItems: i, options: a, theme: o, navigate: s } = Y.current, c =
|
|
817
|
+
return n ? ni(ti, window.location.pathname, si(n.messages, e)) : !1;
|
|
818
|
+
}, []), Ns = lr(), Ps = ur(), Fs = Ns?.request ?? null, Is = E((e, t, n = !1, r = !1) => {
|
|
819
|
+
let { navItems: i, options: a, theme: o, navigate: s } = Y.current, c = Xr(i), l = null, u = {
|
|
818
820
|
...a,
|
|
819
|
-
locale: t === void 0 ?
|
|
820
|
-
uiLocale:
|
|
821
|
-
inputLocale:
|
|
821
|
+
locale: t === void 0 ? R : oa.input.code,
|
|
822
|
+
uiLocale: R,
|
|
823
|
+
inputLocale: oa.input.code
|
|
822
824
|
};
|
|
823
|
-
if (r ||
|
|
824
|
-
let e = v.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), r = n ?
|
|
825
|
+
if (r || Yr(e, u)) {
|
|
826
|
+
let e = v.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), r = n ? li(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => Z.offersFor(e.id).some((e) => e.offerId === t) } }) : null, o = n ? e.processingByConversationId[n.id] ?? null : null, s = o !== null && o.messageId === r?.id && It(o.status);
|
|
825
827
|
if (n && r && !s) {
|
|
826
828
|
let e = Z.liveOffersFor(r.id, {
|
|
827
|
-
registry:
|
|
828
|
-
actorId:
|
|
829
|
+
registry: Ss(),
|
|
830
|
+
actorId: Cs.current,
|
|
829
831
|
conversationId: n.id,
|
|
830
832
|
perfNow: performance.now()
|
|
831
833
|
}).flatMap(({ offer: e, target: t }) => {
|
|
@@ -835,13 +837,13 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
835
837
|
target: n
|
|
836
838
|
}] : [];
|
|
837
839
|
});
|
|
838
|
-
l =
|
|
840
|
+
l = ci({
|
|
839
841
|
reply: r,
|
|
840
842
|
text: mn(r, o, N),
|
|
841
843
|
resolve: {
|
|
842
844
|
destinations: c,
|
|
843
845
|
entityRoutes: a.entityRoutes,
|
|
844
|
-
visibleNavIds:
|
|
846
|
+
visibleNavIds: Wr(i),
|
|
845
847
|
nounLabel: (e) => Ht(N, e)
|
|
846
848
|
},
|
|
847
849
|
offers: e
|
|
@@ -852,18 +854,18 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
852
854
|
destinations: c,
|
|
853
855
|
sentenceOptions: u,
|
|
854
856
|
context: {
|
|
855
|
-
backRunnable:
|
|
857
|
+
backRunnable: Ms(t),
|
|
856
858
|
navigation: l,
|
|
857
859
|
skipRecords: n,
|
|
858
|
-
controls:
|
|
860
|
+
controls: $r(),
|
|
859
861
|
executors: {
|
|
860
862
|
theme: o !== null,
|
|
861
863
|
navigation: s !== null,
|
|
862
|
-
conversationDelete:
|
|
864
|
+
conversationDelete: Fs !== null,
|
|
863
865
|
appControl: (e) => {
|
|
864
866
|
try {
|
|
865
|
-
let n =
|
|
866
|
-
return n !== null && (n.kind !== "confirm" ||
|
|
867
|
+
let n = yi(e, { voiceLive: t !== void 0 || zc.current });
|
|
868
|
+
return n !== null && (n.kind !== "confirm" || Ps !== null);
|
|
867
869
|
} catch {
|
|
868
870
|
return !1;
|
|
869
871
|
}
|
|
@@ -872,38 +874,38 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
872
874
|
}
|
|
873
875
|
};
|
|
874
876
|
}, [
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
877
|
+
Ms,
|
|
878
|
+
oa,
|
|
879
|
+
R,
|
|
878
880
|
N,
|
|
879
881
|
Z,
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
]),
|
|
884
|
-
let { destinations: r, sentenceOptions: i, context: a } =
|
|
885
|
-
return
|
|
886
|
-
}, [
|
|
887
|
-
if (
|
|
888
|
-
|
|
882
|
+
Ss,
|
|
883
|
+
Fs,
|
|
884
|
+
Ps
|
|
885
|
+
]), Ls = E((e, t, n = !1) => {
|
|
886
|
+
let { destinations: r, sentenceOptions: i, context: a } = Is(e, t, n);
|
|
887
|
+
return Jr(e, r, i, a);
|
|
888
|
+
}, [Is]), Rs = E((e) => {
|
|
889
|
+
if (Ro.current = e, zo.cancel(), !e.text.trim() && !e.hasAttachments) {
|
|
890
|
+
Lo.current = !1;
|
|
889
891
|
return;
|
|
890
892
|
}
|
|
891
|
-
if (
|
|
893
|
+
if (Lo.current) return;
|
|
892
894
|
let n = () => {
|
|
893
|
-
|
|
895
|
+
Lo.current = !0, Io(!1);
|
|
894
896
|
};
|
|
895
897
|
if (e.hasAttachments || e.dictated) {
|
|
896
898
|
n();
|
|
897
899
|
return;
|
|
898
900
|
}
|
|
899
|
-
|
|
900
|
-
if (!
|
|
901
|
+
zo.schedule(() => {
|
|
902
|
+
if (!Lo.current) {
|
|
901
903
|
try {
|
|
902
|
-
let { destinations: t, sentenceOptions: n, context: r } =
|
|
903
|
-
if (
|
|
904
|
+
let { destinations: t, sentenceOptions: n, context: r } = Is(e.text, void 0, !1, !0);
|
|
905
|
+
if (Kr(e.text, t, n, r)) return;
|
|
904
906
|
} catch {
|
|
905
|
-
if (!
|
|
906
|
-
|
|
907
|
+
if (!Ii) {
|
|
908
|
+
Ii = !0;
|
|
907
909
|
try {
|
|
908
910
|
t.getLogger("assistant").warn("Draft command classification failed; using standard warm-up.");
|
|
909
911
|
} catch {}
|
|
@@ -913,35 +915,35 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
913
915
|
}
|
|
914
916
|
});
|
|
915
917
|
}, [
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
918
|
+
zo,
|
|
919
|
+
Io,
|
|
920
|
+
Is
|
|
919
921
|
]);
|
|
920
922
|
D(() => {
|
|
921
923
|
let e = () => {
|
|
922
|
-
|
|
923
|
-
}, t = i(e), n =
|
|
924
|
+
Ro.current && Rs(Ro.current);
|
|
925
|
+
}, t = i(e), n = ri(window, e), r = ti.subscribe(e);
|
|
924
926
|
return () => {
|
|
925
|
-
t(), n(), r(),
|
|
927
|
+
t(), n(), r(), zo.cancel();
|
|
926
928
|
};
|
|
927
|
-
}, [
|
|
928
|
-
|
|
929
|
+
}, [zo, Rs]), D(() => {
|
|
930
|
+
Ro.current && Rs(Ro.current);
|
|
929
931
|
}, [
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
V,
|
|
938
|
-
hs,
|
|
932
|
+
Rs,
|
|
933
|
+
is,
|
|
934
|
+
Yi,
|
|
935
|
+
as,
|
|
936
|
+
os,
|
|
937
|
+
Yo,
|
|
938
|
+
rs,
|
|
939
939
|
B,
|
|
940
|
-
|
|
941
|
-
|
|
940
|
+
ys,
|
|
941
|
+
z,
|
|
942
|
+
H?.messages,
|
|
943
|
+
U
|
|
942
944
|
]);
|
|
943
|
-
let
|
|
944
|
-
let n =
|
|
945
|
+
let zs = E((e, t) => {
|
|
946
|
+
let n = Ls(e, t);
|
|
945
947
|
if (!n) return !1;
|
|
946
948
|
let { theme: r, navigate: i } = Y.current;
|
|
947
949
|
switch (n.kind) {
|
|
@@ -953,14 +955,14 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
953
955
|
case "link-not-openable":
|
|
954
956
|
case "back": return i !== null;
|
|
955
957
|
case "conversation-delete": return !1;
|
|
956
|
-
case "app-control": return
|
|
958
|
+
case "app-control": return yi(n.request, { voiceLive: t !== void 0 || zc.current }) !== null;
|
|
957
959
|
case "open-record": return !1;
|
|
958
960
|
}
|
|
959
|
-
}, [
|
|
961
|
+
}, [Ls]), Bs = k(zs);
|
|
960
962
|
D(() => {
|
|
961
|
-
|
|
962
|
-
}, [
|
|
963
|
-
let
|
|
963
|
+
Bs.current = zs;
|
|
964
|
+
}, [zs]);
|
|
965
|
+
let Vs = E((e, t) => {
|
|
964
966
|
let n = {
|
|
965
967
|
state: "none",
|
|
966
968
|
accept: null
|
|
@@ -969,11 +971,11 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
969
971
|
let o = v.getState(), s = o.conversations.find((t) => t.id === e);
|
|
970
972
|
if (!s) return n;
|
|
971
973
|
let c = o.processingByConversationId[s.id] ?? null, l = {
|
|
972
|
-
registry:
|
|
973
|
-
actorId:
|
|
974
|
+
registry: Ss(),
|
|
975
|
+
actorId: Cs.current,
|
|
974
976
|
conversationId: s.id,
|
|
975
977
|
perfNow: performance.now()
|
|
976
|
-
}, { state: u, reply: d } =
|
|
978
|
+
}, { state: u, reply: d } = hi(Z, {
|
|
977
979
|
...l,
|
|
978
980
|
messages: s.messages,
|
|
979
981
|
voiceSessionId: t,
|
|
@@ -986,7 +988,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
986
988
|
state: u,
|
|
987
989
|
accept: null
|
|
988
990
|
};
|
|
989
|
-
let [f] = Z.liveOffersFor(d.id, l), p = f ?
|
|
991
|
+
let [f] = Z.liveOffersFor(d.id, l), p = f ? Xr(a).find((e) => e.id === f.target.id) : void 0;
|
|
990
992
|
return !f || !p ? n : {
|
|
991
993
|
state: u,
|
|
992
994
|
accept: {
|
|
@@ -996,15 +998,15 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
996
998
|
};
|
|
997
999
|
}, [
|
|
998
1000
|
Z,
|
|
999
|
-
|
|
1001
|
+
Ss,
|
|
1000
1002
|
I,
|
|
1001
1003
|
N
|
|
1002
|
-
]),
|
|
1004
|
+
]), Hs = E((e, t, n, r, i, a) => {
|
|
1003
1005
|
let o = N(n.key, n.fallback, r), s = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), c = {
|
|
1004
1006
|
kind: "write-reply",
|
|
1005
1007
|
line: n.key
|
|
1006
1008
|
}, l = (/* @__PURE__ */ new Date()).toISOString(), u = M();
|
|
1007
|
-
|
|
1009
|
+
V(e, {
|
|
1008
1010
|
id: u,
|
|
1009
1011
|
role: "user",
|
|
1010
1012
|
content: t,
|
|
@@ -1015,66 +1017,66 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1015
1017
|
}
|
|
1016
1018
|
});
|
|
1017
1019
|
let d = M();
|
|
1018
|
-
|
|
1020
|
+
V(e, {
|
|
1019
1021
|
id: d,
|
|
1020
1022
|
role: "assistant",
|
|
1021
1023
|
content: o,
|
|
1022
1024
|
timestamp: l,
|
|
1023
1025
|
metadata: {
|
|
1024
|
-
lang: o === s ? "en" :
|
|
1026
|
+
lang: o === s ? "en" : R,
|
|
1025
1027
|
localAction: c,
|
|
1026
1028
|
...Ge(i)
|
|
1027
1029
|
}
|
|
1028
|
-
}),
|
|
1030
|
+
}), ar.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", C()), a !== void 0 && ns(a, {
|
|
1029
1031
|
conversationId: e,
|
|
1030
1032
|
questionId: u,
|
|
1031
1033
|
replyId: d
|
|
1032
|
-
}),
|
|
1034
|
+
}), Xo(e, d);
|
|
1033
1035
|
}, [
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1036
|
+
V,
|
|
1037
|
+
R,
|
|
1038
|
+
ns,
|
|
1039
|
+
Xo,
|
|
1038
1040
|
N
|
|
1039
|
-
]),
|
|
1041
|
+
]), Us = k(() => void 0), [Ws, Gs] = A(null);
|
|
1040
1042
|
D(() => {
|
|
1041
|
-
if (
|
|
1042
|
-
let e = window.setTimeout(() =>
|
|
1043
|
+
if (Ws === null) return;
|
|
1044
|
+
let e = window.setTimeout(() => Gs(null), Ri);
|
|
1043
1045
|
return () => window.clearTimeout(e);
|
|
1044
|
-
}, [
|
|
1045
|
-
let
|
|
1046
|
+
}, [Ws]);
|
|
1047
|
+
let Ks = E(() => {
|
|
1046
1048
|
let e = v.getState();
|
|
1047
|
-
return
|
|
1048
|
-
}, [
|
|
1049
|
-
if (!
|
|
1050
|
-
let t = e !== void 0, n = v.getState(), r =
|
|
1049
|
+
return ha(void 0, e.autoRouting && ao.current ? p : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
|
|
1050
|
+
}, [ha]), qs = E((e) => {
|
|
1051
|
+
if (!Fs) return !1;
|
|
1052
|
+
let t = e !== void 0, n = v.getState(), r = pr({
|
|
1051
1053
|
spoken: t,
|
|
1052
|
-
bound:
|
|
1054
|
+
bound: xo.current,
|
|
1053
1055
|
activeConversationId: n.activeConversationId,
|
|
1054
1056
|
conversations: n.conversations,
|
|
1055
|
-
historyOn:
|
|
1057
|
+
historyOn: cr()
|
|
1056
1058
|
});
|
|
1057
|
-
if (r &&
|
|
1059
|
+
if (r && Fs(r), t) {
|
|
1058
1060
|
let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? N("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : N("deleteConversation.nothing", "There is no conversation to delete.");
|
|
1059
|
-
|
|
1061
|
+
Us.current({
|
|
1060
1062
|
id: `conversation-delete:${M()}`,
|
|
1061
1063
|
text: t,
|
|
1062
|
-
lang: t === e ? "en" :
|
|
1064
|
+
lang: t === e ? "en" : R
|
|
1063
1065
|
});
|
|
1064
|
-
} else r ||
|
|
1066
|
+
} else r || Gs(Date.now());
|
|
1065
1067
|
return !0;
|
|
1066
1068
|
}, [
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
+
Fs,
|
|
1070
|
+
R,
|
|
1069
1071
|
N
|
|
1070
|
-
]),
|
|
1071
|
-
if (e.kind === "conversation-delete") return
|
|
1072
|
+
]), Js = E((e, t, n, r = !1, i) => {
|
|
1073
|
+
if (e.kind === "conversation-delete") return qs(n);
|
|
1072
1074
|
let { theme: a, navigate: o } = Y.current, s = null, c = () => {
|
|
1073
|
-
let e = (r ? null : s ?? v.getState().activeConversationId) ??
|
|
1074
|
-
return r &&
|
|
1075
|
+
let e = (r ? null : s ?? v.getState().activeConversationId) ?? Ks();
|
|
1076
|
+
return r && wo(e), e;
|
|
1075
1077
|
}, l = (e, r) => {
|
|
1076
1078
|
let i = M();
|
|
1077
|
-
return
|
|
1079
|
+
return V(e, {
|
|
1078
1080
|
id: i,
|
|
1079
1081
|
role: "user",
|
|
1080
1082
|
content: t,
|
|
@@ -1086,43 +1088,43 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1086
1088
|
}), i;
|
|
1087
1089
|
}, u = (e, t, r, a, o, s, c) => {
|
|
1088
1090
|
let l = c ?? M();
|
|
1089
|
-
return
|
|
1091
|
+
return V(e, {
|
|
1090
1092
|
id: l,
|
|
1091
1093
|
role: "assistant",
|
|
1092
1094
|
content: r.text,
|
|
1093
1095
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1094
1096
|
metadata: {
|
|
1095
|
-
lang: r.translated ?
|
|
1097
|
+
lang: r.translated ? R : "en",
|
|
1096
1098
|
localAction: a,
|
|
1097
1099
|
...Ge(n)
|
|
1098
1100
|
}
|
|
1099
|
-
}),
|
|
1101
|
+
}), ar.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && ns(i, {
|
|
1100
1102
|
conversationId: e,
|
|
1101
1103
|
questionId: t,
|
|
1102
1104
|
replyId: l
|
|
1103
|
-
}), s &&
|
|
1105
|
+
}), s && Xo(e, l), l;
|
|
1104
1106
|
}, d = (e, t, n) => {
|
|
1105
1107
|
let r = c(), i = u(r, l(r, t), e, t, C(), !0);
|
|
1106
1108
|
return n?.(i), !0;
|
|
1107
1109
|
}, f = (e) => {
|
|
1108
|
-
let t = c(), n = C(), r = window.location.pathname, a = l(t,
|
|
1110
|
+
let t = c(), n = C(), r = window.location.pathname, a = l(t, ii({
|
|
1109
1111
|
destinationId: e.destinationId,
|
|
1110
1112
|
path: e.registryPath,
|
|
1111
1113
|
alreadyHere: !1,
|
|
1112
1114
|
via: e.via,
|
|
1113
1115
|
offer: e.offer
|
|
1114
1116
|
})), s = i === void 0 ? void 0 : M();
|
|
1115
|
-
i !== void 0 && s !== void 0 && (
|
|
1117
|
+
i !== void 0 && s !== void 0 && (es(i, {
|
|
1116
1118
|
conversationId: t,
|
|
1117
1119
|
questionId: a,
|
|
1118
1120
|
replyId: s
|
|
1119
|
-
}),
|
|
1121
|
+
}), vs(s));
|
|
1120
1122
|
let d = M();
|
|
1121
|
-
|
|
1123
|
+
ms.current = d, gs(!0);
|
|
1122
1124
|
let f = (i) => {
|
|
1123
1125
|
try {
|
|
1124
|
-
if (e.offer &&
|
|
1125
|
-
let o =
|
|
1126
|
+
if (e.offer && Es(e.offer.offerId, i) && xs(), i.status === "kept" || !v.getState().conversations.some((e) => e.id === t)) return;
|
|
1127
|
+
let o = Xr(Y.current.navItems), c = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, l = ii({
|
|
1126
1128
|
destinationId: e.destinationId,
|
|
1127
1129
|
path: e.registryPath,
|
|
1128
1130
|
alreadyHere: !1,
|
|
@@ -1130,10 +1132,10 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1130
1132
|
outcome: i,
|
|
1131
1133
|
offer: e.offer
|
|
1132
1134
|
});
|
|
1133
|
-
|
|
1135
|
+
va(t, a, { localAction: l });
|
|
1134
1136
|
let d = u(t, a, e.via === "back" && i.status === "arrived" ? zt(N, e.pageLabel()) : Gt(N, i, {
|
|
1135
1137
|
page: e.pageLabel(),
|
|
1136
|
-
landed: c === null ? null :
|
|
1138
|
+
landed: c === null ? null : oi(o, c),
|
|
1137
1139
|
path: e.target
|
|
1138
1140
|
}), l, n, X.current, s);
|
|
1139
1141
|
i.status === "arrived" && e.onArrived?.({
|
|
@@ -1142,10 +1144,10 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1142
1144
|
landedPath: i.landedPath
|
|
1143
1145
|
});
|
|
1144
1146
|
} finally {
|
|
1145
|
-
|
|
1147
|
+
ms.current === d && (ms.current = null, X.current && gs(!1)), s !== void 0 && X.current && vs((e) => e === s ? null : e);
|
|
1146
1148
|
}
|
|
1147
1149
|
};
|
|
1148
|
-
return
|
|
1150
|
+
return ei(o, e.target, {
|
|
1149
1151
|
readPath: () => window.location.pathname + window.location.search,
|
|
1150
1152
|
now: () => Date.now(),
|
|
1151
1153
|
schedule: (e, t) => {
|
|
@@ -1153,7 +1155,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1153
1155
|
},
|
|
1154
1156
|
isShellLess: () => !X.current
|
|
1155
1157
|
}).then(f, () => f({ status: "unconfirmed" })), !0;
|
|
1156
|
-
}, p = ({ replyId: e, fromPath: t, landedPath: n }) =>
|
|
1158
|
+
}, p = ({ replyId: e, fromPath: t, landedPath: n }) => ti.push({
|
|
1157
1159
|
fromPath: t,
|
|
1158
1160
|
toPath: n,
|
|
1159
1161
|
replyMessageId: e,
|
|
@@ -1161,7 +1163,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1161
1163
|
});
|
|
1162
1164
|
if (e.kind === "theme") {
|
|
1163
1165
|
if (!a) return !1;
|
|
1164
|
-
let t =
|
|
1166
|
+
let t = Zr(e.request, {
|
|
1165
1167
|
mode: a.mode,
|
|
1166
1168
|
resolvedTheme: a.resolvedTheme
|
|
1167
1169
|
});
|
|
@@ -1175,7 +1177,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1175
1177
|
});
|
|
1176
1178
|
}
|
|
1177
1179
|
if (e.kind === "app-control") {
|
|
1178
|
-
let t =
|
|
1180
|
+
let t = yi(e.request, { voiceLive: n !== void 0 || zc.current });
|
|
1179
1181
|
if (!t) return !1;
|
|
1180
1182
|
let r = (e) => ({
|
|
1181
1183
|
kind: "app-control",
|
|
@@ -1183,15 +1185,15 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1183
1185
|
outcome: e.outcome,
|
|
1184
1186
|
...e.reply.code === "language" ? { languageLabel: e.reply.label } : {}
|
|
1185
1187
|
}), i = (t) => {
|
|
1186
|
-
if (e.request.control === "language" &&
|
|
1188
|
+
if (e.request.control === "language" && fs(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
|
|
1187
1189
|
let n = c(), i = r(t), a = u(n, l(n, i), $t((e, t) => t, t.reply), i, C(), !1);
|
|
1188
|
-
return
|
|
1190
|
+
return cs.current = {
|
|
1189
1191
|
wanted: e.request.code,
|
|
1190
1192
|
reply: t.reply,
|
|
1191
1193
|
conversationId: n,
|
|
1192
1194
|
messageId: a,
|
|
1193
|
-
deadline: window.setTimeout(
|
|
1194
|
-
},
|
|
1195
|
+
deadline: window.setTimeout(ps, en)
|
|
1196
|
+
}, us(a), !0;
|
|
1195
1197
|
}
|
|
1196
1198
|
return d($t(N, t.reply), r(t));
|
|
1197
1199
|
};
|
|
@@ -1200,7 +1202,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1200
1202
|
let e = t.run();
|
|
1201
1203
|
return t.silent && (e.outcome === "done" || e.outcome === "already") ? !0 : i(e);
|
|
1202
1204
|
}
|
|
1203
|
-
let a =
|
|
1205
|
+
let a = Ps;
|
|
1204
1206
|
if (!a) return !1;
|
|
1205
1207
|
let o = null;
|
|
1206
1208
|
return d($t(N, t.ask.reply), r(t.ask), (e) => {
|
|
@@ -1211,13 +1213,13 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1211
1213
|
let e = t.confirmed(), i = o, a = i !== null && v.getState().conversations.some((e) => e.id === i);
|
|
1212
1214
|
if (!i || !a) return;
|
|
1213
1215
|
let s = $t(N, e.reply);
|
|
1214
|
-
|
|
1216
|
+
V(i, {
|
|
1215
1217
|
id: M(),
|
|
1216
1218
|
role: "assistant",
|
|
1217
1219
|
content: s.text,
|
|
1218
1220
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1219
1221
|
metadata: {
|
|
1220
|
-
lang: s.translated ?
|
|
1222
|
+
lang: s.translated ? R : "en",
|
|
1221
1223
|
localAction: r(e),
|
|
1222
1224
|
...Ge(n)
|
|
1223
1225
|
}
|
|
@@ -1229,11 +1231,11 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1229
1231
|
if (e.kind === "choose-destination") return d(Bt(N, e.candidates[0]?.label ?? e.query, e.candidates), {
|
|
1230
1232
|
kind: "choose-destination",
|
|
1231
1233
|
candidateIds: e.candidates.map((e) => e.id)
|
|
1232
|
-
}, (t) =>
|
|
1234
|
+
}, (t) => ui(t, e.candidates));
|
|
1233
1235
|
if (e.kind === "choose-linked") return d(Vt(N, e.candidates), {
|
|
1234
1236
|
kind: "choose-destination",
|
|
1235
1237
|
candidateIds: e.candidates.map((e) => e.id)
|
|
1236
|
-
}, (t) =>
|
|
1238
|
+
}, (t) => ui(t, e.candidates));
|
|
1237
1239
|
if (e.kind === "pick-from-list") {
|
|
1238
1240
|
let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
|
|
1239
1241
|
return d(Yt(N), t ? {
|
|
@@ -1242,7 +1244,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1242
1244
|
} : e.candidateIds.length > 0 ? {
|
|
1243
1245
|
kind: "choose-destination",
|
|
1244
1246
|
candidateIds: [...e.candidateIds]
|
|
1245
|
-
} :
|
|
1247
|
+
} : ii({
|
|
1246
1248
|
destinationId: "",
|
|
1247
1249
|
path: "",
|
|
1248
1250
|
alreadyHere: !1,
|
|
@@ -1251,9 +1253,9 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1251
1253
|
status: "refused",
|
|
1252
1254
|
reason: "not-routable"
|
|
1253
1255
|
}
|
|
1254
|
-
}), t ? (e) =>
|
|
1256
|
+
}), t ? (e) => ui(e, t) : void 0);
|
|
1255
1257
|
}
|
|
1256
|
-
if (e.kind === "link-not-openable") return d(Ut(N),
|
|
1258
|
+
if (e.kind === "link-not-openable") return d(Ut(N), ii({
|
|
1257
1259
|
destinationId: "",
|
|
1258
1260
|
path: "",
|
|
1259
1261
|
alreadyHere: !1,
|
|
@@ -1266,7 +1268,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1266
1268
|
if (e.kind === "open-record") {
|
|
1267
1269
|
let r;
|
|
1268
1270
|
try {
|
|
1269
|
-
let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a =
|
|
1271
|
+
let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a = Wr(n);
|
|
1270
1272
|
r = (t.records ?? []).flatMap((t) => {
|
|
1271
1273
|
let n = i.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
|
|
1272
1274
|
return n && r && (n.visibleWith === void 0 || a.has(n.visibleWith)) ? [{
|
|
@@ -1279,18 +1281,18 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1279
1281
|
}
|
|
1280
1282
|
if (r.length === 0) return !1;
|
|
1281
1283
|
let i = v.getState().activeConversationId, a = M();
|
|
1282
|
-
|
|
1284
|
+
ms.current = a, gs(!0);
|
|
1283
1285
|
let o = () => {
|
|
1284
|
-
|
|
1286
|
+
ms.current === a && (ms.current = null, X.current && gs(!1));
|
|
1285
1287
|
};
|
|
1286
1288
|
return (async () => {
|
|
1287
1289
|
let a = { kind: "none" }, c = !0;
|
|
1288
1290
|
try {
|
|
1289
|
-
a = await
|
|
1291
|
+
a = await Gr({
|
|
1290
1292
|
name: e.request.name,
|
|
1291
1293
|
usable: r,
|
|
1292
1294
|
nounOf: (e) => Ht(N, e.noun),
|
|
1293
|
-
timeoutMs:
|
|
1295
|
+
timeoutMs: ji
|
|
1294
1296
|
}), c = v.getState().conversations.some((e) => e.id === i);
|
|
1295
1297
|
} catch {
|
|
1296
1298
|
a = { kind: "none" };
|
|
@@ -1299,7 +1301,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1299
1301
|
}
|
|
1300
1302
|
if (!X.current) return;
|
|
1301
1303
|
if (a.kind === "none") {
|
|
1302
|
-
|
|
1304
|
+
$s.current(t, [], {
|
|
1303
1305
|
fromPerson: !0,
|
|
1304
1306
|
...n === void 0 ? {} : { voiceSessionId: n },
|
|
1305
1307
|
localRecordsChecked: !0
|
|
@@ -1323,13 +1325,13 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1323
1325
|
d(a.why === "kinds" ? Zt(N, a.nouns, a.candidates) : Xt(N, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
|
|
1324
1326
|
kind: "choose-destination",
|
|
1325
1327
|
candidateIds: a.candidates.map((e) => e.id)
|
|
1326
|
-
}, (e) =>
|
|
1328
|
+
}, (e) => ui(e, a.candidates));
|
|
1327
1329
|
})().catch(() => void 0), !0;
|
|
1328
1330
|
}
|
|
1329
1331
|
if (e.kind === "back") {
|
|
1330
|
-
let e =
|
|
1332
|
+
let e = ti.top();
|
|
1331
1333
|
if (!e) return !1;
|
|
1332
|
-
let t =
|
|
1334
|
+
let t = ai(Xr(Y.current.navItems), e.fromPath);
|
|
1333
1335
|
return f({
|
|
1334
1336
|
target: e.fromPath,
|
|
1335
1337
|
destinationId: t?.id ?? "",
|
|
@@ -1337,13 +1339,13 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1337
1339
|
via: "back",
|
|
1338
1340
|
pageLabel: () => t?.label ?? null,
|
|
1339
1341
|
onArrived: () => {
|
|
1340
|
-
|
|
1342
|
+
ti.top() === e && ti.pop();
|
|
1341
1343
|
}
|
|
1342
1344
|
});
|
|
1343
1345
|
}
|
|
1344
1346
|
let ee, m = e.destination;
|
|
1345
1347
|
if (e.via === "offer") {
|
|
1346
|
-
let t =
|
|
1348
|
+
let t = ws(e.offerId, e.destination.label);
|
|
1347
1349
|
if (!t.ok) return d(t.copy ?? Kt(N), {
|
|
1348
1350
|
kind: "write-reply",
|
|
1349
1351
|
line: t.reason === "unavailable" ? "offer.notAvailable" : "offer.expired"
|
|
@@ -1351,13 +1353,13 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1351
1353
|
ee = {
|
|
1352
1354
|
trigger: e.trigger,
|
|
1353
1355
|
offerId: e.offerId
|
|
1354
|
-
}, m =
|
|
1356
|
+
}, m = Xr(Y.current.navItems).find((e) => e.id === t.target.id) ?? {
|
|
1355
1357
|
id: t.target.id,
|
|
1356
1358
|
label: t.target.label,
|
|
1357
1359
|
path: t.target.path
|
|
1358
1360
|
};
|
|
1359
1361
|
}
|
|
1360
|
-
return
|
|
1362
|
+
return qr(m, window.location.pathname + window.location.search, Xr(Y.current.navItems)) ? d(Wt(N, m.label, !0), ii({
|
|
1361
1363
|
destinationId: m.id,
|
|
1362
1364
|
path: m.path,
|
|
1363
1365
|
alreadyHere: !0,
|
|
@@ -1373,55 +1375,55 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1373
1375
|
onArrived: p
|
|
1374
1376
|
});
|
|
1375
1377
|
}, [
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1378
|
+
V,
|
|
1379
|
+
wo,
|
|
1380
|
+
Ps,
|
|
1381
|
+
Ks,
|
|
1382
|
+
ps,
|
|
1383
|
+
R,
|
|
1384
|
+
va,
|
|
1385
|
+
es,
|
|
1386
|
+
qs,
|
|
1387
|
+
ns,
|
|
1388
|
+
fs,
|
|
1383
1389
|
Xo,
|
|
1384
|
-
Us,
|
|
1385
|
-
Qo,
|
|
1386
|
-
cs,
|
|
1387
|
-
Ko,
|
|
1388
1390
|
N,
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
]),
|
|
1393
|
-
|
|
1391
|
+
ws,
|
|
1392
|
+
Es,
|
|
1393
|
+
xs
|
|
1394
|
+
]), Ys = E(async (e) => {
|
|
1395
|
+
so.current = !0, lo(!0);
|
|
1394
1396
|
try {
|
|
1395
1397
|
await G.declineForReply(e.conversationId, e.reason, e.origin);
|
|
1396
1398
|
} finally {
|
|
1397
|
-
|
|
1399
|
+
so.current = !1, X.current && lo(!1);
|
|
1398
1400
|
}
|
|
1399
1401
|
if (e.commandText !== null) {
|
|
1400
|
-
let t =
|
|
1401
|
-
if (t &&
|
|
1402
|
+
let t = Ls(e.commandText, e.options.voiceSessionId);
|
|
1403
|
+
if (t && Js(t, e.content, e.options.voiceSessionId)) return;
|
|
1402
1404
|
}
|
|
1403
|
-
await
|
|
1405
|
+
await $s.current(e.content, e.attachments, e.options);
|
|
1404
1406
|
}, [
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
+
Ls,
|
|
1408
|
+
Js,
|
|
1407
1409
|
G
|
|
1408
1410
|
]), Q = E(async (e, t = [], n = {}) => {
|
|
1409
|
-
let r = n.voiceSessionId !== void 0, i = v.getState(), a = !1, o =
|
|
1411
|
+
let r = n.voiceSessionId !== void 0, i = v.getState(), a = !1, o = xo.current;
|
|
1410
1412
|
if (r && ot(o)) {
|
|
1411
|
-
let e = ut(o, i.activeConversationId,
|
|
1413
|
+
let e = ut(o, i.activeConversationId, To());
|
|
1412
1414
|
if (e.kind === "gone") return;
|
|
1413
1415
|
let t = n.voiceEntry ?? e;
|
|
1414
|
-
t.kind === "adopt" &&
|
|
1416
|
+
t.kind === "adopt" && wo(t.conversationId), a = t.kind === "own", n = {
|
|
1415
1417
|
...n,
|
|
1416
1418
|
voiceEntry: t
|
|
1417
1419
|
};
|
|
1418
1420
|
}
|
|
1419
|
-
let s = a ? null : i.activeConversationId, c = a ? null : i.activeConversationId ??
|
|
1421
|
+
let s = a ? null : i.activeConversationId, c = a ? null : i.activeConversationId ?? z;
|
|
1420
1422
|
if (c) {
|
|
1421
1423
|
if (It(i.processingByConversationId[c]?.status)) {
|
|
1422
1424
|
if (n.avatarTabAsk !== void 0) return;
|
|
1423
1425
|
let r = i.processingByConversationId[c]?.messageId ?? null;
|
|
1424
|
-
r && n.correctsInFlightTurn === !0 && !
|
|
1426
|
+
r && n.correctsInFlightTurn === !0 && !Uo.current.has(r) && Ko(), r && Uo.current.has(r) && (Wo.current = {
|
|
1425
1427
|
conversationId: c,
|
|
1426
1428
|
content: e,
|
|
1427
1429
|
attachments: t,
|
|
@@ -1429,40 +1431,40 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1429
1431
|
});
|
|
1430
1432
|
return;
|
|
1431
1433
|
}
|
|
1432
|
-
if (
|
|
1434
|
+
if (Oo.current.has(c)) return;
|
|
1433
1435
|
}
|
|
1434
|
-
if (
|
|
1435
|
-
let f = n.targetConversationId, p = ie(), ee = (e) =>
|
|
1436
|
+
if (oo.current || se() !== null || so.current || ms.current !== null) return;
|
|
1437
|
+
let f = n.targetConversationId, p = ie(), ee = (e) => nr(e) || tr(e, p);
|
|
1436
1438
|
if (f !== void 0) {
|
|
1437
1439
|
let e = i.conversations.find((e) => e.id === f);
|
|
1438
1440
|
if (i.activeConversationId !== f || !e || e.mode !== i.mode || ee(e)) return;
|
|
1439
1441
|
}
|
|
1440
1442
|
if (n.avatarTabAsk !== void 0) {
|
|
1441
1443
|
let e = s ? i.conversations.find((e) => e.id === s) : void 0, t = e && !ee(e) ? e : void 0;
|
|
1442
|
-
if (
|
|
1443
|
-
auto: i.autoRouting &&
|
|
1444
|
+
if (wr({
|
|
1445
|
+
auto: i.autoRouting && ao.current && f === void 0,
|
|
1444
1446
|
selectedMode: i.mode,
|
|
1445
1447
|
conversation: t ? {
|
|
1446
1448
|
mode: t.mode,
|
|
1447
1449
|
routedBy: t.routedBy,
|
|
1448
|
-
hasHistory:
|
|
1450
|
+
hasHistory: er(t)
|
|
1449
1451
|
} : null,
|
|
1450
|
-
modeWrites: (e) =>
|
|
1452
|
+
modeWrites: (e) => Za.current.find((t) => t.id === e)?.writeCapable === !0 || Ce(e)
|
|
1451
1453
|
}) !== null) return;
|
|
1452
1454
|
}
|
|
1453
1455
|
if (n.fromPerson && n.writeReplyBound === void 0) {
|
|
1454
|
-
let r = f ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", o =
|
|
1456
|
+
let r = f ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", o = Vs(r, n.voiceSessionId), c = Vn({
|
|
1455
1457
|
text: e,
|
|
1456
|
-
locale: i === "spoken" ?
|
|
1458
|
+
locale: i === "spoken" ? oa.input.code : R,
|
|
1457
1459
|
origin: i,
|
|
1458
1460
|
hasAttachments: t.length > 0,
|
|
1459
1461
|
live: G.liveFor(r),
|
|
1460
|
-
matchesLocalCommand: (e) =>
|
|
1462
|
+
matchesLocalCommand: (e) => Ls(e, n.voiceSessionId) !== null,
|
|
1461
1463
|
offer: o.state,
|
|
1462
|
-
offerAssent: o.state !== "none" &&
|
|
1464
|
+
offerAssent: o.state !== "none" && Qr({
|
|
1463
1465
|
text: e,
|
|
1464
|
-
uiLocale:
|
|
1465
|
-
inputLocale:
|
|
1466
|
+
uiLocale: R,
|
|
1467
|
+
inputLocale: oa.input.code,
|
|
1466
1468
|
commandLocales: Y.current.options.commandLocales,
|
|
1467
1469
|
manifest: Y.current.options.commandManifest,
|
|
1468
1470
|
leaveGuard: Y.current.options.leaveGuard
|
|
@@ -1470,14 +1472,14 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1470
1472
|
});
|
|
1471
1473
|
if (c.kind === "accept_offer") {
|
|
1472
1474
|
let t = o.accept;
|
|
1473
|
-
if (t &&
|
|
1475
|
+
if (t && Js({
|
|
1474
1476
|
kind: "navigate",
|
|
1475
1477
|
destination: t.destination,
|
|
1476
1478
|
via: "offer",
|
|
1477
1479
|
offerId: t.offerId,
|
|
1478
1480
|
trigger: "yes"
|
|
1479
1481
|
}, e, n.voiceSessionId, a, n.avatarTabAsk)) {
|
|
1480
|
-
|
|
1482
|
+
ts(n.avatarTabAsk);
|
|
1481
1483
|
return;
|
|
1482
1484
|
}
|
|
1483
1485
|
c = {
|
|
@@ -1494,11 +1496,11 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1494
1496
|
};
|
|
1495
1497
|
}
|
|
1496
1498
|
if (c.kind === "local_reply") {
|
|
1497
|
-
r &&
|
|
1499
|
+
r && Hs(r, e, c.line, c.values, n.voiceSessionId, n.avatarTabAsk);
|
|
1498
1500
|
return;
|
|
1499
1501
|
}
|
|
1500
1502
|
let l = c.kind === "local" ? c.fallback : c.bound, u = c.declineAll;
|
|
1501
|
-
if (u !== null && r) return n.avatarTabAsk === void 0 ?
|
|
1503
|
+
if (u !== null && r) return n.avatarTabAsk === void 0 ? Ys({
|
|
1502
1504
|
conversationId: r,
|
|
1503
1505
|
reason: u,
|
|
1504
1506
|
origin: i,
|
|
@@ -1517,51 +1519,51 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1517
1519
|
}
|
|
1518
1520
|
let ne = n.writeReplyBound?.promptText ?? e;
|
|
1519
1521
|
if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
|
|
1520
|
-
let t =
|
|
1521
|
-
if (t &&
|
|
1522
|
-
|
|
1522
|
+
let t = Ls(e, n.voiceSessionId, n.localRecordsChecked === !0);
|
|
1523
|
+
if (t && Js(t, e, n.voiceSessionId, a, n.avatarTabAsk)) {
|
|
1524
|
+
ts(n.avatarTabAsk);
|
|
1523
1525
|
return;
|
|
1524
1526
|
}
|
|
1525
1527
|
}
|
|
1526
|
-
let ae = s ? i.conversations.find((e) => e.id === s) : void 0, oe = ee(ae) ? void 0 : ae, h = i.autoRouting &&
|
|
1528
|
+
let ae = s ? i.conversations.find((e) => e.id === s) : void 0, oe = ee(ae) ? void 0 : ae, h = i.autoRouting && ao.current && f === void 0 ? re({
|
|
1527
1529
|
intent: n.avatarTabAsk === void 0 ? n.autoIntent ?? m(e) : "read",
|
|
1528
1530
|
dictated: r,
|
|
1529
|
-
voiceProposalBound: r &&
|
|
1531
|
+
voiceProposalBound: r && Xi("api-calls") && de(i.acknowledgedWriteModes, "api-calls"),
|
|
1530
1532
|
conversation: oe ? {
|
|
1531
1533
|
mode: oe.mode,
|
|
1532
1534
|
routedBy: oe.routedBy,
|
|
1533
|
-
hasHistory:
|
|
1535
|
+
hasHistory: er(oe)
|
|
1534
1536
|
} : null
|
|
1535
1537
|
}) : null;
|
|
1536
|
-
if (h &&
|
|
1537
|
-
|
|
1538
|
+
if (h && Za.current.find((e) => e.id === h.mode)?.writeCapable && !de(i.acknowledgedWriteModes, h.mode)) {
|
|
1539
|
+
oo.current = {
|
|
1538
1540
|
content: e,
|
|
1539
1541
|
attachments: t,
|
|
1540
1542
|
options: n
|
|
1541
|
-
},
|
|
1543
|
+
}, po(h.mode);
|
|
1542
1544
|
return;
|
|
1543
1545
|
}
|
|
1544
|
-
let g = h ? h.mode : i.mode, le, ue, _ = f ?? (a ? null :
|
|
1546
|
+
let g = h ? h.mode : i.mode, le, ue, _ = f ?? (a ? null : z), pe = _ ? v.getState().conversations.find((e) => e.id === _) : void 0, he = h?.action === "escalate" && oe ? {
|
|
1545
1547
|
mode: oe.mode,
|
|
1546
1548
|
backendSessionId: oe.backendSessionId ?? null
|
|
1547
1549
|
} : null;
|
|
1548
|
-
if (h) h.action === "new" || !oe ? _ =
|
|
1550
|
+
if (h) h.action === "new" || !oe ? _ = ha(void 0, g, { routedBy: "auto" }) : (_ = oe.id, ka(_, g));
|
|
1549
1551
|
else {
|
|
1550
1552
|
let e = i.autoRouting ? { routedBy: "auto" } : void 0;
|
|
1551
|
-
!_ || ee(pe) || pe && pe.mode !== g &&
|
|
1553
|
+
!_ || ee(pe) || pe && pe.mode !== g && er(pe) ? _ = ha(void 0, g, e) : pe && pe.mode !== g && (e ? ka(_, g) : pa(_, g));
|
|
1552
1554
|
}
|
|
1553
1555
|
if (!_) return;
|
|
1554
|
-
r &&
|
|
1556
|
+
r && xo.current !== void 0 && _ !== i.activeConversationId && wo(_), n.approvalFollowUp || (Eo.current[_] = t);
|
|
1555
1557
|
let ge = () => v.getState().conversations.some((e) => e.id === _), y = C(), ve = {
|
|
1556
|
-
accessToken:
|
|
1557
|
-
workspaceToken:
|
|
1558
|
-
userId:
|
|
1558
|
+
accessToken: Zi(),
|
|
1559
|
+
workspaceToken: Qi(),
|
|
1560
|
+
userId: L,
|
|
1559
1561
|
organizationId: Pt()
|
|
1560
1562
|
}, xe = (e, t) => {
|
|
1561
1563
|
ge() || !y || me(e, y, t, g, {
|
|
1562
|
-
accessToken:
|
|
1563
|
-
workspaceToken:
|
|
1564
|
-
userId:
|
|
1564
|
+
accessToken: Zi(),
|
|
1565
|
+
workspaceToken: Qi(),
|
|
1566
|
+
userId: L,
|
|
1565
1567
|
organizationId: Pt()
|
|
1566
1568
|
});
|
|
1567
1569
|
}, Ee = {
|
|
@@ -1578,30 +1580,30 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1578
1580
|
...Ge(n.voiceSessionId)
|
|
1579
1581
|
}
|
|
1580
1582
|
};
|
|
1581
|
-
|
|
1582
|
-
let Oe = n.fromPerson === !0 && t.length === 0 && n.approvalFollowUp === void 0 && ne === e ?
|
|
1583
|
+
V(_, Ee);
|
|
1584
|
+
let Oe = n.fromPerson === !0 && t.length === 0 && n.approvalFollowUp === void 0 && ne === e ? gi(e, r ? oa.input.code : R) : null, ke = {
|
|
1583
1585
|
location: window.location.pathname + window.location.search,
|
|
1584
1586
|
conversationId: v.getState().activeConversationId,
|
|
1585
1587
|
workspaceId: C(),
|
|
1586
|
-
actorId:
|
|
1588
|
+
actorId: L ?? null
|
|
1587
1589
|
}, b = M();
|
|
1588
|
-
|
|
1590
|
+
V(_, {
|
|
1589
1591
|
id: b,
|
|
1590
1592
|
role: "assistant",
|
|
1591
1593
|
content: "",
|
|
1592
1594
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1593
1595
|
metadata: {
|
|
1594
|
-
lang:
|
|
1596
|
+
lang: la,
|
|
1595
1597
|
...Ge(n.voiceSessionId)
|
|
1596
1598
|
}
|
|
1597
1599
|
}), hn(b, {
|
|
1598
1600
|
channel: r ? "voice" : "chat",
|
|
1599
1601
|
mode: g,
|
|
1600
1602
|
product: P,
|
|
1601
|
-
language:
|
|
1603
|
+
language: la,
|
|
1602
1604
|
device: gn(),
|
|
1603
1605
|
routedByAuto: !!h
|
|
1604
|
-
}, n.voiceTiming), T(b, "accepted"),
|
|
1606
|
+
}, n.voiceTiming), T(b, "accepted"), ya(_, "provisioning", b, null), ce(b), n.avatarTabAsk !== void 0 && ns(n.avatarTabAsk, {
|
|
1605
1607
|
conversationId: _,
|
|
1606
1608
|
questionId: Ee.id,
|
|
1607
1609
|
replyId: b
|
|
@@ -1609,13 +1611,13 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1609
1611
|
let Ae = () => {
|
|
1610
1612
|
let e = Lt({
|
|
1611
1613
|
turnId: b,
|
|
1612
|
-
abortRequested:
|
|
1614
|
+
abortRequested: Uo.current.has(b),
|
|
1613
1615
|
activeTurnId: v.getState().processingByConversationId[_]?.messageId ?? null,
|
|
1614
1616
|
conversationExists: ge()
|
|
1615
1617
|
});
|
|
1616
1618
|
return e.abandon && We(), e;
|
|
1617
|
-
}, Me = (e, t, r, i, a = !1, o =
|
|
1618
|
-
|
|
1619
|
+
}, Me = (e, t, r, i, a = !1, o = la) => {
|
|
1620
|
+
_a(_, b, { content: l(e) }), va(_, b, {
|
|
1619
1621
|
lang: o,
|
|
1620
1622
|
...t?.length ? { artifacts: t } : {},
|
|
1621
1623
|
...t?.length || r || i ? { mode: g } : {},
|
|
@@ -1637,14 +1639,14 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1637
1639
|
T(b, "attemptStarted");
|
|
1638
1640
|
let a = null, o = null, s = !1;
|
|
1639
1641
|
try {
|
|
1640
|
-
let { sandboxId: i, sessionId: c, sessionIsNew: u, readAhead: f, sandboxIsNew: p, sandboxProbed: ee, sandboxAdopted: m, deadSandboxProbe: te, sessionPreopened: re } = await
|
|
1642
|
+
let { sandboxId: i, sessionId: c, sessionIsNew: u, readAhead: f, sandboxIsNew: p, sandboxProbed: ee, sandboxAdopted: m, deadSandboxProbe: te, sessionPreopened: re } = await Fo(_, b, g, y, ve, { isAbandoned: () => Lt({
|
|
1641
1643
|
turnId: b,
|
|
1642
|
-
abortRequested:
|
|
1644
|
+
abortRequested: Uo.current.has(b),
|
|
1643
1645
|
activeTurnId: v.getState().processingByConversationId[_]?.messageId ?? null,
|
|
1644
1646
|
conversationExists: ge()
|
|
1645
1647
|
}).abandon });
|
|
1646
1648
|
if (a = i, Qe(), Qe = d(i, () => {
|
|
1647
|
-
|
|
1649
|
+
Uo.current.add(b), Ze(b), qe.abort(b);
|
|
1648
1650
|
}), T(b, "runtimeReady"), w(b, {
|
|
1649
1651
|
runtime: p ? "cold" : m ? "adopted" : ee ? "probed" : re ? "preopened" : u ? "new-session" : "warm",
|
|
1650
1652
|
deadSandboxProbe: te
|
|
@@ -1654,23 +1656,23 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1654
1656
|
}, fe(g, le, v.getState().acknowledgedWriteModes, {
|
|
1655
1657
|
dictated: r,
|
|
1656
1658
|
confirmsWrites: Ce(g),
|
|
1657
|
-
proposalBound:
|
|
1659
|
+
proposalBound: Xi(g, i)
|
|
1658
1660
|
}) === "voice-in-write-mode") throw new Pe("voice-in-write-mode", "Voice in a write mode");
|
|
1659
|
-
let ie =
|
|
1661
|
+
let ie = mr({
|
|
1660
1662
|
conversation: v.getState().conversations.find((e) => e.id === _),
|
|
1661
1663
|
content: e,
|
|
1662
1664
|
sessionIsNew: u,
|
|
1663
1665
|
sendingMode: g,
|
|
1664
1666
|
sendingModeConfig: le,
|
|
1665
|
-
modes:
|
|
1667
|
+
modes: Za.current,
|
|
1666
1668
|
answerText: (e) => dn(e).text
|
|
1667
1669
|
});
|
|
1668
|
-
if (Ke(),
|
|
1669
|
-
let e =
|
|
1670
|
+
if (Ke(), jr()) {
|
|
1671
|
+
let e = Ar({
|
|
1670
1672
|
mint: () => Se(i, y, c, g, ve),
|
|
1671
1673
|
mark: (e) => T(b, e)
|
|
1672
1674
|
});
|
|
1673
|
-
x.stream = e, x.render =
|
|
1675
|
+
x.stream = e, x.render = _r({
|
|
1674
1676
|
stream: e,
|
|
1675
1677
|
conversationId: _,
|
|
1676
1678
|
messageId: b,
|
|
@@ -1680,12 +1682,12 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1680
1682
|
});
|
|
1681
1683
|
}
|
|
1682
1684
|
let ae = await cn(() => be(i, y, c, g, ve, { limit: 50 }), u, sn(f, i, c));
|
|
1683
|
-
|
|
1684
|
-
let oe =
|
|
1685
|
+
No(_, b, "streaming", "thinking");
|
|
1686
|
+
let oe = Gi?.(), h = Hn(v.getState().sandboxWriteCapabilities[i]), se = Y.current, ce = mi(i, c), de = se.options.uiCatalogue ? di(Xr(se.navItems), {
|
|
1685
1687
|
permissionsSettled: se.navPermissionsSettled,
|
|
1686
1688
|
simulating: se.navSimulating,
|
|
1687
|
-
sentBefore:
|
|
1688
|
-
}) : null, pe = v.getState().sandboxWriteCapabilities[i]?.clientTools === !0 ?
|
|
1689
|
+
sentBefore: pi(ce)
|
|
1690
|
+
}) : null, pe = v.getState().sandboxWriteCapabilities[i]?.clientTools === !0 ? Ei({ writeCapable: le?.writeCapable === !0 || g === "api-calls" }) : null, me = pe?.manifest ?? [], he = {
|
|
1689
1691
|
conversationId: _,
|
|
1690
1692
|
writeReply: h === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null,
|
|
1691
1693
|
...de ? { uiCatalogue: de } : {},
|
|
@@ -1694,7 +1696,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1694
1696
|
content: ie ? `${ie}${ne}` : ne,
|
|
1695
1697
|
attachments: t,
|
|
1696
1698
|
limits: gt(le),
|
|
1697
|
-
wrapPrompt: (e) =>
|
|
1699
|
+
wrapPrompt: (e) => Ki?.(g, e, sa, ca, r, { writeApproval: h }) ?? e,
|
|
1698
1700
|
requestBytes: (e, t) => Te({
|
|
1699
1701
|
sandboxId: i,
|
|
1700
1702
|
workspaceId: y,
|
|
@@ -1710,7 +1712,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1710
1712
|
s = pt(t) > Le;
|
|
1711
1713
|
let Ve = Ae();
|
|
1712
1714
|
if (Ve.abandon) {
|
|
1713
|
-
Ve.clearProcessing &&
|
|
1715
|
+
Ve.clearProcessing && ba(_);
|
|
1714
1716
|
return;
|
|
1715
1717
|
}
|
|
1716
1718
|
let He = (e) => Xe.dispatch({
|
|
@@ -1728,8 +1730,8 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1728
1730
|
if (!Xe.canFailover() || !Ie || !Tn(e)) throw e;
|
|
1729
1731
|
await He(void 0), s ||= ze;
|
|
1730
1732
|
}
|
|
1731
|
-
de &&
|
|
1732
|
-
let Ge = v.getState().sandboxWriteCapabilities[i], Ye = se.options.uiOffers === !0 && je(Ge) ?
|
|
1733
|
+
de && fi(ce);
|
|
1734
|
+
let Ge = v.getState().sandboxWriteCapabilities[i], Ye = se.options.uiOffers === !0 && je(Ge) ? L : null, $e = !!Ye;
|
|
1733
1735
|
Ye && Z.recordTurn({
|
|
1734
1736
|
replyId: b,
|
|
1735
1737
|
conversationId: _,
|
|
@@ -1740,16 +1742,16 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1740
1742
|
actorId: Ye,
|
|
1741
1743
|
floorMs: ae
|
|
1742
1744
|
});
|
|
1743
|
-
let et = pe && me.length > 0 ?
|
|
1745
|
+
let et = pe && me.length > 0 ? Ti({
|
|
1744
1746
|
tools: pe.tools,
|
|
1745
1747
|
post: (e, t) => we(i, y, c, e, t, g, ve)
|
|
1746
1748
|
}) : null, nt = et ? (e) => et.receive(e) : void 0, rt = $e ? (e, t) => {
|
|
1747
|
-
Z.receive(b, e, t, performance.now()) &&
|
|
1748
|
-
} : void 0, it = (e) =>
|
|
1749
|
+
Z.receive(b, e, t, performance.now()) && xs();
|
|
1750
|
+
} : void 0, it = (e) => _a(_, b, { content: e }), at = (e) => s ? `${e}\n\n${N("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;
|
|
1749
1751
|
T(b, "promptSent");
|
|
1750
1752
|
let ot = null, st = !1, ct = an, S = on([], ae);
|
|
1751
1753
|
x.render?.arm(ae);
|
|
1752
|
-
let lt = Date.now() + ue.streamBudgetMs, ut = Date.now(), dt = Date.now(), ft =
|
|
1754
|
+
let lt = Date.now() + ue.streamBudgetMs, ut = Date.now(), dt = Date.now(), ft = Mr(() => be(i, y, c, g, ve, {
|
|
1753
1755
|
limit: 50,
|
|
1754
1756
|
sinceMs: ae,
|
|
1755
1757
|
surfaceTurnTerminal: !0,
|
|
@@ -1761,23 +1763,23 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1761
1763
|
xe(i, c);
|
|
1762
1764
|
let e = Ae();
|
|
1763
1765
|
if (e.abandon) {
|
|
1764
|
-
e.clearProcessing &&
|
|
1766
|
+
e.clearProcessing && ba(_);
|
|
1765
1767
|
return;
|
|
1766
1768
|
}
|
|
1767
1769
|
let t = await ft.next();
|
|
1768
|
-
if ($e && Z.observeMessages(b, t) &&
|
|
1770
|
+
if ($e && Z.observeMessages(b, t) && xs(), S = on(t, ae, { accumulateNarration: ue.accumulatesNarration }), _a(_, b, { content: l(S.content) }), S.hasRenderableOutput ? st || (st = !0, ot !== null && T(b, "lastQuietPoll", ot), T(b, "firstOutput")) : ot = vn(), ue.accumulatesNarration) S.hasText && T(b, "firstText");
|
|
1769
1771
|
else {
|
|
1770
1772
|
let e = un(ct, S, vn());
|
|
1771
1773
|
ct = e.tracker, e.confirmedAt !== null && T(b, "firstText", e.confirmedAt);
|
|
1772
1774
|
}
|
|
1773
|
-
if (S.pendingWrite && !Bn(v.getState().sandboxWriteCapabilities[i]) &&
|
|
1775
|
+
if (S.pendingWrite && !Bn(v.getState().sandboxWriteCapabilities[i]) && va(_, b, { pendingWrite: S.pendingWrite }), S.done && (x.stream ? w(b, {
|
|
1774
1776
|
transport: x.stream.reachedOpen ? "sse" : "poll",
|
|
1775
|
-
live:
|
|
1777
|
+
live: gr(x.stream.live)
|
|
1776
1778
|
}) : w(b, {
|
|
1777
1779
|
transport: "poll",
|
|
1778
1780
|
live: "none"
|
|
1779
1781
|
}), We()), S.done) {
|
|
1780
|
-
T(b, "answerDone"),
|
|
1782
|
+
T(b, "answerDone"), J.current.markVerified(i);
|
|
1781
1783
|
break;
|
|
1782
1784
|
}
|
|
1783
1785
|
if (x.render?.refresh(t), Date.now() - ut > 3e4 && (await _e(i, y, 600, ve).catch(() => void 0), ut = Date.now()), !ft.hasPending()) {
|
|
@@ -1795,7 +1797,7 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1795
1797
|
channel: "voice",
|
|
1796
1798
|
voiceSessionId: n.voiceSessionId,
|
|
1797
1799
|
text: e,
|
|
1798
|
-
lang:
|
|
1800
|
+
lang: la,
|
|
1799
1801
|
final: !0
|
|
1800
1802
|
}));
|
|
1801
1803
|
}
|
|
@@ -1808,19 +1810,19 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1808
1810
|
content: at(S.content)
|
|
1809
1811
|
});
|
|
1810
1812
|
let vt = !S.done;
|
|
1811
|
-
Me(S.content, _t, c, i, vt), S.tokens && (
|
|
1813
|
+
Me(S.content, _t, c, i, vt), S.tokens && (_a(_, b, { tokens: S.tokens }), (Ji ? await Be({
|
|
1812
1814
|
workspaceId: y,
|
|
1813
1815
|
sessionId: c,
|
|
1814
1816
|
messageId: S.messageId,
|
|
1815
1817
|
model: S.model,
|
|
1816
1818
|
tokens: S.tokens
|
|
1817
|
-
},
|
|
1819
|
+
}, Ji, { ledger: Re("panel", P) }) : { ok: !0 }).ok && Pn(P)), S.done || xe(i, c);
|
|
1818
1820
|
let yt = Ae();
|
|
1819
1821
|
if (yt.abandon) {
|
|
1820
|
-
yt.clearProcessing &&
|
|
1822
|
+
yt.clearProcessing && ba(_);
|
|
1821
1823
|
return;
|
|
1822
1824
|
}
|
|
1823
|
-
T(b, "complete"), w(b, { outcome: "answered" }),
|
|
1825
|
+
T(b, "complete"), w(b, { outcome: "answered" }), ya(_, "complete", b, null), ar.recordCommittedEntries(_, [Ee.id, b], "TURN", y), Je = !1, $e && Oe && S.done && js({
|
|
1824
1826
|
replyId: b,
|
|
1825
1827
|
conversationId: _,
|
|
1826
1828
|
voiceSessionId: n.voiceSessionId,
|
|
@@ -1828,58 +1830,58 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1828
1830
|
atSend: ke
|
|
1829
1831
|
});
|
|
1830
1832
|
} catch (e) {
|
|
1831
|
-
|
|
1833
|
+
J.current.invalidate(a ?? v.getState().sandboxesByMode[g]?.sandboxId ?? null);
|
|
1832
1834
|
let t = Lt({
|
|
1833
1835
|
turnId: b,
|
|
1834
|
-
abortRequested:
|
|
1836
|
+
abortRequested: Uo.current.has(b),
|
|
1835
1837
|
activeTurnId: v.getState().processingByConversationId[_]?.messageId ?? null,
|
|
1836
1838
|
conversationExists: ge()
|
|
1837
1839
|
});
|
|
1838
1840
|
if (We(), a && o && xe(a, o), t.abandon) {
|
|
1839
|
-
t.clearProcessing &&
|
|
1841
|
+
t.clearProcessing && ba(_);
|
|
1840
1842
|
return;
|
|
1841
1843
|
}
|
|
1842
1844
|
if (i === 1 && Xe.canFailover() && En(e)) {
|
|
1843
1845
|
Qe();
|
|
1844
1846
|
let e = a ?? v.getState().sandboxesByMode[g]?.sandboxId ?? null;
|
|
1845
|
-
return e && (
|
|
1847
|
+
return e && (Do.current.add(e), J.current.invalidate(e)), Sa(_), wa(g), ga(_, b, ""), va(_, b, { pendingWrite: void 0 }), e && G.retireSandbox(e), Ke(), Ye(), _n(b), $e(2);
|
|
1846
1848
|
}
|
|
1847
1849
|
throw e;
|
|
1848
1850
|
}
|
|
1849
1851
|
}, et = _;
|
|
1850
|
-
|
|
1852
|
+
Oo.current.add(et);
|
|
1851
1853
|
try {
|
|
1852
1854
|
if (!y) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
|
|
1853
1855
|
code: "UNAUTHENTICATED",
|
|
1854
1856
|
authFailure: "WORKSPACE_CONTEXT_MISSING"
|
|
1855
1857
|
} });
|
|
1856
|
-
let e = await Ot(g, () =>
|
|
1858
|
+
let e = await Ot(g, () => Za.current.find((e) => e.id === g), Xa);
|
|
1857
1859
|
le = e.config, ue = e.capabilities;
|
|
1858
1860
|
let t = le, n = Ae();
|
|
1859
1861
|
if (n.abandon) {
|
|
1860
|
-
n.clearProcessing &&
|
|
1862
|
+
n.clearProcessing && ba(_);
|
|
1861
1863
|
return;
|
|
1862
1864
|
}
|
|
1863
1865
|
let i = fe(g, t, v.getState().acknowledgedWriteModes, {
|
|
1864
1866
|
dictated: r,
|
|
1865
1867
|
confirmsWrites: Ce(g),
|
|
1866
|
-
proposalBound:
|
|
1868
|
+
proposalBound: Xi(g)
|
|
1867
1869
|
});
|
|
1868
1870
|
if (i) throw new Pe(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
|
|
1869
1871
|
let a = Re("panel", P);
|
|
1870
|
-
if (
|
|
1871
|
-
let e = await Ve(a, y,
|
|
1872
|
+
if (Ji && ze(a, y)) {
|
|
1873
|
+
let e = await Ve(a, y, Ji);
|
|
1872
1874
|
if (!e.ok) throw He(e.kind);
|
|
1873
1875
|
let t = Ae();
|
|
1874
1876
|
if (t.abandon) {
|
|
1875
|
-
t.clearProcessing &&
|
|
1877
|
+
t.clearProcessing && ba(_);
|
|
1876
1878
|
return;
|
|
1877
1879
|
}
|
|
1878
1880
|
}
|
|
1879
1881
|
T(b, "cleared"), await $e();
|
|
1880
1882
|
} catch (e) {
|
|
1881
|
-
if (
|
|
1882
|
-
|
|
1883
|
+
if (J.current.invalidate(v.getState().sandboxesByMode[g]?.sandboxId ?? null), !ge()) {
|
|
1884
|
+
ba(_);
|
|
1883
1885
|
return;
|
|
1884
1886
|
}
|
|
1885
1887
|
let t = Ne.session?.sandboxId ?? null, r = Fe(e, { confirmsNoAction: Ie({
|
|
@@ -1887,183 +1889,183 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
1887
1889
|
capabilities: t ? v.getState().sandboxWriteCapabilities[t] : null
|
|
1888
1890
|
}) });
|
|
1889
1891
|
w(b, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && Nn(P, "sandbox");
|
|
1890
|
-
let i = Le(r, N, { locale:
|
|
1891
|
-
|
|
1892
|
-
lang: i.translated ?
|
|
1892
|
+
let i = Le(r, N, { locale: R });
|
|
1893
|
+
ya(_, "error", b, i.headline), _a(_, b, { content: i.text }), va(_, b, {
|
|
1894
|
+
lang: i.translated ? R : "en",
|
|
1893
1895
|
...Ge(n.voiceSessionId)
|
|
1894
1896
|
});
|
|
1895
1897
|
} finally {
|
|
1896
|
-
Qe(),
|
|
1898
|
+
Qe(), Oo.current.delete(et), w(b, { outcome: "stopped" }), T(b, "complete"), Ye(), Ke();
|
|
1897
1899
|
let e = v.getState(), t = te(he, g, e.conversations.find((e) => e.id === et), (t) => !!e.sandboxesByMode[t]?.sandboxId);
|
|
1898
|
-
t && (
|
|
1900
|
+
t && (ka(et, t.mode), t.backendSessionId && xa(et, t.backendSessionId)), Ne.session && ge() && G.afterTurn({
|
|
1899
1901
|
...Ne.session,
|
|
1900
1902
|
conversationId: et
|
|
1901
1903
|
}, b);
|
|
1902
|
-
let n =
|
|
1903
|
-
|
|
1904
|
+
let n = Wo.current;
|
|
1905
|
+
Wo.current = null, n && n.conversationId === et && ge() && $s.current(n.content, n.attachments, n.options);
|
|
1904
1906
|
}
|
|
1905
1907
|
}, [
|
|
1906
|
-
B,
|
|
1907
|
-
H,
|
|
1908
|
-
Hi,
|
|
1909
|
-
_a,
|
|
1910
|
-
ya,
|
|
1911
|
-
aa,
|
|
1912
|
-
ua,
|
|
1913
|
-
jo,
|
|
1914
|
-
G,
|
|
1915
|
-
Ho,
|
|
1916
|
-
Rs,
|
|
1917
|
-
Gs,
|
|
1918
1908
|
z,
|
|
1919
|
-
|
|
1909
|
+
V,
|
|
1920
1910
|
Ki,
|
|
1921
|
-
|
|
1922
|
-
L,
|
|
1923
|
-
qi,
|
|
1924
|
-
fa,
|
|
1925
|
-
P,
|
|
1926
|
-
Ka,
|
|
1927
|
-
Wi,
|
|
1928
|
-
ra,
|
|
1929
|
-
z,
|
|
1930
|
-
ia,
|
|
1931
|
-
na,
|
|
1911
|
+
Sa,
|
|
1932
1912
|
wa,
|
|
1933
|
-
|
|
1934
|
-
Ns,
|
|
1935
|
-
xo,
|
|
1936
|
-
So,
|
|
1937
|
-
ga,
|
|
1938
|
-
ca,
|
|
1939
|
-
ma,
|
|
1913
|
+
ua,
|
|
1940
1914
|
ha,
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1915
|
+
Fo,
|
|
1916
|
+
G,
|
|
1917
|
+
Ko,
|
|
1918
|
+
Hs,
|
|
1919
|
+
Ys,
|
|
1944
1920
|
R,
|
|
1945
|
-
|
|
1946
|
-
|
|
1921
|
+
oa,
|
|
1922
|
+
Xi,
|
|
1923
|
+
Gi,
|
|
1924
|
+
Zi,
|
|
1925
|
+
Qi,
|
|
1926
|
+
_a,
|
|
1927
|
+
P,
|
|
1928
|
+
Xa,
|
|
1929
|
+
Ji,
|
|
1930
|
+
ca,
|
|
1931
|
+
R,
|
|
1932
|
+
la,
|
|
1933
|
+
sa,
|
|
1934
|
+
ka,
|
|
1935
|
+
Js,
|
|
1947
1936
|
Ls,
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1937
|
+
wo,
|
|
1938
|
+
To,
|
|
1939
|
+
xa,
|
|
1940
|
+
pa,
|
|
1941
|
+
ya,
|
|
1942
|
+
ba,
|
|
1943
|
+
N,
|
|
1944
|
+
No,
|
|
1945
|
+
ga,
|
|
1946
|
+
L,
|
|
1947
|
+
Z,
|
|
1948
|
+
xs,
|
|
1949
|
+
Vs,
|
|
1950
|
+
js,
|
|
1951
|
+
ns,
|
|
1952
|
+
ts
|
|
1953
|
+
]), Xs = E((e, t) => {
|
|
1952
1954
|
Q(e, [], t ? { autoIntent: t } : {});
|
|
1953
|
-
}, [Q]),
|
|
1954
|
-
let e = [...
|
|
1955
|
+
}, [Q]), Zs = Ft(), Qs = E(() => {
|
|
1956
|
+
let e = [...Aa.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
|
|
1955
1957
|
if (!e || e.metadata?.approvalFollowUp) return;
|
|
1956
|
-
let t =
|
|
1958
|
+
let t = z ? Eo.current[z] ?? [] : [];
|
|
1957
1959
|
if (t.some((e) => At(e, Date.now()))) {
|
|
1958
|
-
let n =
|
|
1959
|
-
jt(t,
|
|
1960
|
+
let n = z ?? void 0;
|
|
1961
|
+
jt(t, Zs).then((t) => {
|
|
1960
1962
|
Q(e.content, t, n === void 0 ? void 0 : { targetConversationId: n });
|
|
1961
1963
|
});
|
|
1962
1964
|
return;
|
|
1963
1965
|
}
|
|
1964
1966
|
Q(e.content, t);
|
|
1965
1967
|
}, [
|
|
1966
|
-
|
|
1968
|
+
ja,
|
|
1967
1969
|
Q,
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
]),
|
|
1970
|
+
z,
|
|
1971
|
+
Zs
|
|
1972
|
+
]), $s = k(Q);
|
|
1971
1973
|
D(() => {
|
|
1972
|
-
|
|
1974
|
+
$s.current = Q;
|
|
1973
1975
|
}, [Q]);
|
|
1974
|
-
let
|
|
1975
|
-
if (
|
|
1976
|
-
for (let e =
|
|
1977
|
-
let t =
|
|
1976
|
+
let ec = O(() => {
|
|
1977
|
+
if (W) return null;
|
|
1978
|
+
for (let e = ja.length - 1; e >= 0; --e) {
|
|
1979
|
+
let t = ja[e];
|
|
1978
1980
|
if (t?.role !== "assistant") continue;
|
|
1979
|
-
if (t.id ===
|
|
1980
|
-
if (!We(t) ||
|
|
1981
|
-
let n = rn(t,
|
|
1981
|
+
if (t.id === ls) return null;
|
|
1982
|
+
if (!We(t) || Uo.current.has(t.id) || Xe(t.id)) continue;
|
|
1983
|
+
let n = rn(t, U, N);
|
|
1982
1984
|
if (n.kind !== "output") return null;
|
|
1983
1985
|
let r = dn(n.text).text.trim();
|
|
1984
|
-
return r ? Ye(t, r,
|
|
1986
|
+
return r ? Ye(t, r, U) : null;
|
|
1985
1987
|
}
|
|
1986
1988
|
return null;
|
|
1987
1989
|
}, [
|
|
1988
|
-
|
|
1989
|
-
Da,
|
|
1990
|
+
ja,
|
|
1990
1991
|
W,
|
|
1991
|
-
|
|
1992
|
+
U,
|
|
1993
|
+
ls,
|
|
1992
1994
|
N
|
|
1993
|
-
]),
|
|
1994
|
-
sessionId:
|
|
1995
|
-
sandboxId:
|
|
1995
|
+
]), tc = O(() => ec ? nt(ec.text) : null, [ec]), nc = O(() => Aa.chat.filter((e) => e.id !== ls), [Aa.chat, ls]), rc = v((e) => pe(e)?.sandboxId ?? null), ic = le(nc, {
|
|
1996
|
+
sessionId: H?.backendSessionId,
|
|
1997
|
+
sandboxId: rc,
|
|
1996
1998
|
nowMs: Date.now()
|
|
1997
|
-
}),
|
|
1999
|
+
}), ac = ue(nc), oc = (e) => {
|
|
1998
2000
|
if (zn(e.metadata).length > 0) return !0;
|
|
1999
2001
|
let t = e.metadata?.sandboxId;
|
|
2000
|
-
return Bn(t ?
|
|
2001
|
-
},
|
|
2002
|
+
return Bn(t ? Pa[t] : null);
|
|
2003
|
+
}, sc = (e) => {
|
|
2002
2004
|
let t = zn(e.metadata);
|
|
2003
|
-
return t.length === 0 || !
|
|
2005
|
+
return t.length === 0 || !z ? null : /* @__PURE__ */ j(Rn, {
|
|
2004
2006
|
refs: t,
|
|
2005
|
-
conversationId:
|
|
2007
|
+
conversationId: z,
|
|
2006
2008
|
panel: G,
|
|
2007
|
-
entries:
|
|
2008
|
-
capabilitiesOf: (e) =>
|
|
2009
|
-
turnInFlight:
|
|
2009
|
+
entries: Fa,
|
|
2010
|
+
capabilitiesOf: (e) => Pa[e],
|
|
2011
|
+
turnInFlight: W,
|
|
2010
2012
|
tr: N,
|
|
2011
|
-
onReview:
|
|
2012
|
-
retiredSandboxes:
|
|
2013
|
+
onReview: La.review,
|
|
2014
|
+
retiredSandboxes: Ia
|
|
2013
2015
|
});
|
|
2014
|
-
},
|
|
2015
|
-
if (!
|
|
2016
|
+
}, cc = (e) => {
|
|
2017
|
+
if (!z) return null;
|
|
2016
2018
|
let t = Z.liveOffersFor(e, {
|
|
2017
2019
|
registry: {
|
|
2018
|
-
destinations:
|
|
2019
|
-
permissionsSettled:
|
|
2020
|
-
simulating:
|
|
2020
|
+
destinations: Xr(is),
|
|
2021
|
+
permissionsSettled: as,
|
|
2022
|
+
simulating: os
|
|
2021
2023
|
},
|
|
2022
|
-
actorId:
|
|
2023
|
-
conversationId:
|
|
2024
|
+
actorId: L,
|
|
2025
|
+
conversationId: z,
|
|
2024
2026
|
perfNow: performance.now()
|
|
2025
2027
|
}), n = t[0];
|
|
2026
|
-
return n ? /* @__PURE__ */ j(
|
|
2028
|
+
return n ? /* @__PURE__ */ j(yr, {
|
|
2027
2029
|
offers: t.map(({ offer: e, target: t }) => ({
|
|
2028
2030
|
offerId: e.offerId,
|
|
2029
2031
|
label: t.label,
|
|
2030
2032
|
path: t.path
|
|
2031
2033
|
})),
|
|
2032
2034
|
hint: t.length === 1 && I === "proposal-v1" ? Me(n.offer, Z.turnFor(e)) : "link",
|
|
2033
|
-
onOpen:
|
|
2035
|
+
onOpen: As
|
|
2034
2036
|
}, n.offer.offerId) : null;
|
|
2035
|
-
},
|
|
2037
|
+
}, lc = (e) => e.role === "assistant" ? cc(e.id) : null;
|
|
2036
2038
|
D(() => {
|
|
2037
2039
|
let e = Z.nextExpiryInMs(performance.now());
|
|
2038
2040
|
if (e === null) return;
|
|
2039
|
-
let t = window.setTimeout(
|
|
2041
|
+
let t = window.setTimeout(xs, e + 1);
|
|
2040
2042
|
return () => window.clearTimeout(t);
|
|
2041
2043
|
}, [
|
|
2042
2044
|
Z,
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
+
ys,
|
|
2046
|
+
xs
|
|
2045
2047
|
]);
|
|
2046
|
-
let
|
|
2048
|
+
let uc = La.dialog.view ? Fa[La.dialog.view.proposalId] : void 0, dc = ic?.expiresAtMs ?? null;
|
|
2047
2049
|
D(() => {
|
|
2048
|
-
if (
|
|
2049
|
-
let e = window.setTimeout(() =>
|
|
2050
|
+
if (dc === null) return;
|
|
2051
|
+
let e = window.setTimeout(() => Ho((e) => e + 1), Math.max(0, dc - Date.now()));
|
|
2050
2052
|
return () => window.clearTimeout(e);
|
|
2051
|
-
}, [
|
|
2052
|
-
let
|
|
2053
|
+
}, [dc, Vo]);
|
|
2054
|
+
let fc = O(() => Aa.voice.filter((e) => e.id !== ls && (e.role === "user" || e.role === "assistant")).map((e) => ({
|
|
2053
2055
|
id: e.id,
|
|
2054
2056
|
role: e.role,
|
|
2055
|
-
text: mn(e,
|
|
2057
|
+
text: mn(e, U, N),
|
|
2056
2058
|
sessionId: Ke(e),
|
|
2057
2059
|
timestamp: e.timestamp
|
|
2058
2060
|
})).filter((e) => e.text.length > 0), [
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2061
|
+
Aa.voice,
|
|
2062
|
+
U,
|
|
2063
|
+
ls,
|
|
2062
2064
|
N
|
|
2063
|
-
]),
|
|
2064
|
-
if (
|
|
2065
|
+
]), pc = E(() => {
|
|
2066
|
+
if (fc.length === 0) return;
|
|
2065
2067
|
let e = /* @__PURE__ */ new Date();
|
|
2066
|
-
|
|
2068
|
+
$n($e(fc, {
|
|
2067
2069
|
title: N("voiceSession.transcript", "Voice conversation"),
|
|
2068
2070
|
savedAt: N("voiceSession.savedAt", "Saved"),
|
|
2069
2071
|
session: N("voiceSession.sessionLabel", "Session"),
|
|
@@ -2073,28 +2075,28 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
2073
2075
|
}, e), et(P, e), "text/markdown");
|
|
2074
2076
|
}, [
|
|
2075
2077
|
P,
|
|
2076
|
-
|
|
2078
|
+
fc,
|
|
2077
2079
|
N
|
|
2078
|
-
]),
|
|
2079
|
-
|
|
2080
|
-
let [
|
|
2080
|
+
]), mc = bi({ perFileChars: uo }), hc = k(mc);
|
|
2081
|
+
hc.current = mc;
|
|
2082
|
+
let [gc, _c] = A(null), vc = gc === null ? null : N("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: gc });
|
|
2081
2083
|
D(() => {
|
|
2082
|
-
if (
|
|
2083
|
-
let e = window.setTimeout(() =>
|
|
2084
|
+
if (gc === null) return;
|
|
2085
|
+
let e = window.setTimeout(() => _c(null), Pi);
|
|
2084
2086
|
return () => window.clearTimeout(e);
|
|
2085
|
-
}, [
|
|
2086
|
-
let
|
|
2087
|
+
}, [gc]);
|
|
2088
|
+
let yc = k(/* @__PURE__ */ new Set()), bc = k(() => !1), $ = wn({
|
|
2087
2089
|
onSubmit: E((e, t, n, r) => {
|
|
2088
|
-
let i =
|
|
2090
|
+
let i = xo.current, a = ft(i), o = () => {
|
|
2089
2091
|
let e = v.getState();
|
|
2090
2092
|
return st({
|
|
2091
|
-
sessionLive:
|
|
2093
|
+
sessionLive: bc.current(t),
|
|
2092
2094
|
boundAtSubmit: i,
|
|
2093
2095
|
activeConversationId: e.activeConversationId,
|
|
2094
2096
|
boundConversationExists: e.conversations.some((e) => e.id === a)
|
|
2095
2097
|
});
|
|
2096
2098
|
}, s = () => {
|
|
2097
|
-
let i =
|
|
2099
|
+
let i = hc.current;
|
|
2098
2100
|
Nt({
|
|
2099
2101
|
draft: i,
|
|
2100
2102
|
maySend: o,
|
|
@@ -2104,18 +2106,18 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
2104
2106
|
...n,
|
|
2105
2107
|
handedOver: vn()
|
|
2106
2108
|
};
|
|
2107
|
-
|
|
2109
|
+
$s.current(e, i, {
|
|
2108
2110
|
fromPerson: !0,
|
|
2109
2111
|
voiceSessionId: t,
|
|
2110
2112
|
voiceTiming: a,
|
|
2111
2113
|
...r.correction ? { correctsInFlightTurn: !0 } : {}
|
|
2112
2114
|
});
|
|
2113
2115
|
},
|
|
2114
|
-
announceDropped: (e) =>
|
|
2116
|
+
announceDropped: (e) => _c(e)
|
|
2115
2117
|
});
|
|
2116
2118
|
};
|
|
2117
|
-
if (o() &&
|
|
2118
|
-
|
|
2119
|
+
if (o() && Bs.current(e, t)) {
|
|
2120
|
+
$s.current(e, [], {
|
|
2119
2121
|
fromPerson: !0,
|
|
2120
2122
|
voiceSessionId: t,
|
|
2121
2123
|
voiceTiming: {
|
|
@@ -2125,543 +2127,644 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
2125
2127
|
});
|
|
2126
2128
|
return;
|
|
2127
2129
|
}
|
|
2128
|
-
if (!
|
|
2130
|
+
if (!hc.current.isBusy) {
|
|
2129
2131
|
s();
|
|
2130
2132
|
return;
|
|
2131
2133
|
}
|
|
2132
|
-
let c = Date.now(), l =
|
|
2133
|
-
let e =
|
|
2134
|
-
|
|
2134
|
+
let c = Date.now(), l = yc.current, u = window.setInterval(() => {
|
|
2135
|
+
let e = hc.current.isBusy;
|
|
2136
|
+
hc.current.isCommitting || e && Date.now() - c < Ni || (window.clearInterval(u), l.delete(u), s());
|
|
2135
2137
|
}, 200);
|
|
2136
2138
|
l.add(u);
|
|
2137
2139
|
}, []),
|
|
2138
|
-
latestReply:
|
|
2139
|
-
language: rt(
|
|
2140
|
-
graceMs:
|
|
2141
|
-
onSupersede:
|
|
2142
|
-
handsFreeStreamNoticeAccepted:
|
|
2143
|
-
onAcceptHandsFreeStreamNotice:
|
|
2144
|
-
handsFreeInterrupt:
|
|
2145
|
-
onBargeIn:
|
|
2140
|
+
latestReply: ec,
|
|
2141
|
+
language: rt(ia, R).tag,
|
|
2142
|
+
graceMs: ea,
|
|
2143
|
+
onSupersede: qo,
|
|
2144
|
+
handsFreeStreamNoticeAccepted: na,
|
|
2145
|
+
onAcceptHandsFreeStreamNotice: ra,
|
|
2146
|
+
handsFreeInterrupt: ta,
|
|
2147
|
+
onBargeIn: Ko
|
|
2146
2148
|
});
|
|
2147
|
-
|
|
2148
|
-
let
|
|
2149
|
+
bc.current = $.isCurrentSession;
|
|
2150
|
+
let xc = So ? fc.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : fc, Sc = $.answerLocally;
|
|
2149
2151
|
D(() => {
|
|
2150
|
-
|
|
2151
|
-
}, [
|
|
2152
|
-
let
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
]), [
|
|
2152
|
+
Us.current = Sc;
|
|
2153
|
+
}, [Sc]);
|
|
2154
|
+
let Cc = $.active, wc = O(() => wt(Object.values(Fa), z, Ia), [
|
|
2155
|
+
Fa,
|
|
2156
|
+
z,
|
|
2157
|
+
Ia
|
|
2158
|
+
]), [Tc, Ec] = A(null);
|
|
2157
2159
|
D(() => {
|
|
2158
|
-
|
|
2159
|
-
}, [
|
|
2160
|
-
let
|
|
2161
|
-
let e =
|
|
2160
|
+
Cc || Ec(null);
|
|
2161
|
+
}, [Cc]);
|
|
2162
|
+
let Dc = La.review, Oc = E(() => {
|
|
2163
|
+
let e = wc[wc.length - 1];
|
|
2162
2164
|
if (!e) return;
|
|
2163
2165
|
let { view: t } = e;
|
|
2164
|
-
if (Mn(t) && jn(t,
|
|
2165
|
-
|
|
2166
|
+
if (Mn(t) && jn(t, Pa[e.session.sandboxId]).offerConfirm) {
|
|
2167
|
+
Dc(t);
|
|
2166
2168
|
return;
|
|
2167
2169
|
}
|
|
2168
|
-
|
|
2170
|
+
Ec(t.proposalId);
|
|
2169
2171
|
}, [
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
]),
|
|
2172
|
+
wc,
|
|
2173
|
+
Pa,
|
|
2174
|
+
Dc
|
|
2175
|
+
]), kc = Cc ? xt(wc) : null, Ac = Tc ? Fa[Tc] : void 0, jc = Cc && Ac && Ac.session.conversationId === z ? {
|
|
2174
2176
|
content: /* @__PURE__ */ j(Rn, {
|
|
2175
2177
|
refs: [{
|
|
2176
|
-
proposalId:
|
|
2177
|
-
sandboxId:
|
|
2178
|
-
sessionId:
|
|
2178
|
+
proposalId: Ac.view.proposalId,
|
|
2179
|
+
sandboxId: Ac.session.sandboxId,
|
|
2180
|
+
sessionId: Ac.session.sessionId
|
|
2179
2181
|
}],
|
|
2180
|
-
conversationId:
|
|
2182
|
+
conversationId: Ac.session.conversationId,
|
|
2181
2183
|
panel: G,
|
|
2182
|
-
entries:
|
|
2183
|
-
capabilitiesOf: (e) =>
|
|
2184
|
-
turnInFlight:
|
|
2184
|
+
entries: Fa,
|
|
2185
|
+
capabilitiesOf: (e) => Pa[e],
|
|
2186
|
+
turnInFlight: W,
|
|
2185
2187
|
tr: N,
|
|
2186
|
-
onReview:
|
|
2187
|
-
retiredSandboxes:
|
|
2188
|
+
onReview: Dc,
|
|
2189
|
+
retiredSandboxes: Ia
|
|
2188
2190
|
}),
|
|
2189
2191
|
closeLabel: Tt(N, yt.trayClose),
|
|
2190
|
-
onClose: () =>
|
|
2191
|
-
} : null,
|
|
2192
|
-
a("assistant.transcript", O(() =>
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
])), a("assistant.conversation.new", O(() =>
|
|
2192
|
+
onClose: () => Ec(null)
|
|
2193
|
+
} : null, Mc = La.asking, Nc = Ns?.asking === !0, Pc = Ps?.asking === !0, Fc = dr(), Ic = $.holdListening;
|
|
2194
|
+
a("assistant.transcript", O(() => Cc || q ? null : { run: () => go ? { status: "already" } : (bo(!0), { status: "done" }) }, [
|
|
2195
|
+
Cc,
|
|
2196
|
+
q,
|
|
2197
|
+
go,
|
|
2198
|
+
bo
|
|
2199
|
+
])), a("assistant.conversation.new", O(() => Cc ? null : { run: () => {
|
|
2198
2200
|
let e = v.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
|
|
2199
2201
|
return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
|
|
2200
|
-
} }, [
|
|
2201
|
-
|
|
2202
|
+
} }, [Cc])), D(() => {
|
|
2203
|
+
Ic(Cc && (Mc || Nc || Pc || Fc));
|
|
2202
2204
|
}, [
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2205
|
+
Cc,
|
|
2206
|
+
Mc,
|
|
2207
|
+
Nc,
|
|
2208
|
+
Pc,
|
|
2209
|
+
Fc,
|
|
2210
|
+
Ic
|
|
2209
2211
|
]);
|
|
2210
|
-
let
|
|
2212
|
+
let Lc = k(null), Rc = $.announce;
|
|
2211
2213
|
D(() => {
|
|
2212
|
-
if (!
|
|
2213
|
-
|
|
2214
|
+
if (!Cc) {
|
|
2215
|
+
Lc.current = null;
|
|
2214
2216
|
return;
|
|
2215
2217
|
}
|
|
2216
|
-
let e =
|
|
2218
|
+
let e = Lc.current;
|
|
2217
2219
|
if (e === null) {
|
|
2218
|
-
|
|
2220
|
+
Lc.current = new Set(Object.keys(Fa));
|
|
2219
2221
|
return;
|
|
2220
2222
|
}
|
|
2221
|
-
for (let { view: t, session: n } of Ct(
|
|
2223
|
+
for (let { view: t, session: n } of Ct(wc, e)) {
|
|
2222
2224
|
e.add(t.proposalId);
|
|
2223
|
-
let r =
|
|
2225
|
+
let r = Pa[n.sandboxId];
|
|
2224
2226
|
if (!bt({
|
|
2225
2227
|
mode: "api-calls",
|
|
2226
2228
|
productWriteApproval: I,
|
|
2227
2229
|
capabilities: r
|
|
2228
2230
|
})) continue;
|
|
2229
2231
|
let i = Et(t, jn(t, r).offerConfirm, N), a = t.proposalId;
|
|
2230
|
-
|
|
2232
|
+
Rc({
|
|
2231
2233
|
id: `write-readback:${a}`,
|
|
2232
2234
|
text: i.text,
|
|
2233
|
-
lang: i.translated ?
|
|
2235
|
+
lang: i.translated ? R : "en",
|
|
2234
2236
|
stillWanted: () => G.entry(a)?.view.status === "pending"
|
|
2235
2237
|
});
|
|
2236
2238
|
}
|
|
2237
2239
|
}, [
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2240
|
+
Cc,
|
|
2241
|
+
wc,
|
|
2242
|
+
Fa,
|
|
2243
|
+
Pa,
|
|
2242
2244
|
I,
|
|
2243
2245
|
N,
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
+
R,
|
|
2247
|
+
Rc,
|
|
2246
2248
|
G
|
|
2247
2249
|
]);
|
|
2248
|
-
let
|
|
2250
|
+
let zc = k(!1);
|
|
2249
2251
|
D(() => {
|
|
2250
|
-
|
|
2252
|
+
zc.current = $.active;
|
|
2251
2253
|
}, [$.active]), D(() => ae((e) => {
|
|
2252
|
-
if (!
|
|
2253
|
-
let t =
|
|
2254
|
+
if (!zc.current) return !1;
|
|
2255
|
+
let t = xo.current;
|
|
2254
2256
|
return typeof t == "string" ? t === e : v.getState().activeConversationId === e;
|
|
2255
2257
|
}), []);
|
|
2256
|
-
let
|
|
2257
|
-
let e = v.getState().activeConversationId, t = lt(
|
|
2258
|
-
|
|
2258
|
+
let Bc = $.start, Vc = E(() => {
|
|
2259
|
+
let e = v.getState().activeConversationId, t = lt(To());
|
|
2260
|
+
wo(dt(t, e)), Io(!0, t.kind === "own"), Bc();
|
|
2259
2261
|
}, [
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
]),
|
|
2262
|
+
wo,
|
|
2263
|
+
Io,
|
|
2264
|
+
To,
|
|
2265
|
+
Bc
|
|
2266
|
+
]), Hc = O(() => pn(H?.messages ?? []), [H?.messages]), Uc = fn(Aa.voice, U, N), Wc = fn(Hc, U, N) > 0, Gc = E(() => {
|
|
2265
2267
|
let e = v.getState().activeConversationId;
|
|
2266
|
-
if (!e ||
|
|
2267
|
-
let t = new Set(
|
|
2268
|
-
|
|
2268
|
+
if (!e || fc.length === 0) return;
|
|
2269
|
+
let t = new Set(Hc.map((e) => e.id)), n = M();
|
|
2270
|
+
V(e, {
|
|
2269
2271
|
id: n,
|
|
2270
2272
|
role: "system",
|
|
2271
|
-
content: Qe(
|
|
2273
|
+
content: Qe(fc.filter((e) => t.has(e.id)), {
|
|
2272
2274
|
intro: N("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
|
|
2273
2275
|
nothing: N("voiceSession.continuedNothing", "Continued from a voice conversation."),
|
|
2274
2276
|
more: (e) => N("voiceSession.continuedMore", "…and {{count}} more", { count: e })
|
|
2275
2277
|
}),
|
|
2276
2278
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2277
|
-
metadata: { continuedVoiceTurns:
|
|
2278
|
-
}),
|
|
2279
|
+
metadata: { continuedVoiceTurns: Uc }
|
|
2280
|
+
}), ar.recordCommittedEntries(e, [n], "NOTE", C()), bo(!1), $.end(), vo();
|
|
2279
2281
|
}, [
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2282
|
+
fc,
|
|
2283
|
+
Uc,
|
|
2284
|
+
Hc,
|
|
2285
|
+
V,
|
|
2284
2286
|
N,
|
|
2285
2287
|
$,
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
]),
|
|
2288
|
+
bo,
|
|
2289
|
+
vo
|
|
2290
|
+
]), Kc = k({
|
|
2289
2291
|
conversationId: null,
|
|
2290
2292
|
count: 0
|
|
2291
2293
|
});
|
|
2292
2294
|
D(() => {
|
|
2293
|
-
$.active && (
|
|
2294
|
-
conversationId:
|
|
2295
|
-
count:
|
|
2295
|
+
$.active && (Kc.current = {
|
|
2296
|
+
conversationId: z,
|
|
2297
|
+
count: Uc
|
|
2296
2298
|
});
|
|
2297
2299
|
}, [$.active]);
|
|
2298
|
-
let
|
|
2299
|
-
let e =
|
|
2300
|
-
$.end(), t &&
|
|
2300
|
+
let qc = E(() => {
|
|
2301
|
+
let e = Kc.current, t = Uc > (e.conversationId === z ? e.count : 0);
|
|
2302
|
+
$.end(), t && bo(!0);
|
|
2301
2303
|
}, [
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
+
z,
|
|
2305
|
+
Uc,
|
|
2304
2306
|
$,
|
|
2305
|
-
|
|
2307
|
+
bo
|
|
2306
2308
|
]);
|
|
2307
2309
|
D(() => {
|
|
2308
|
-
(!
|
|
2310
|
+
(!Vi || !Mo) && $.active && $.end();
|
|
2309
2311
|
}, [
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
+
Vi,
|
|
2313
|
+
Mo,
|
|
2312
2314
|
$
|
|
2313
2315
|
]);
|
|
2314
|
-
let [
|
|
2316
|
+
let [Jc, Yc] = A(Li), Xc = xr({
|
|
2315
2317
|
available: $.available,
|
|
2316
|
-
allowedInMode:
|
|
2317
|
-
readOnly:
|
|
2318
|
-
busy:
|
|
2319
|
-
committing:
|
|
2320
|
-
dictating:
|
|
2321
|
-
}),
|
|
2318
|
+
allowedInMode: Mo,
|
|
2319
|
+
readOnly: Ba,
|
|
2320
|
+
busy: W || Bo !== null || Ha || hs,
|
|
2321
|
+
committing: Jc.committing,
|
|
2322
|
+
dictating: Jc.dictating
|
|
2323
|
+
}), Zc = vt(), [Qc, $c] = A(null);
|
|
2322
2324
|
D(() => {
|
|
2323
|
-
|
|
2325
|
+
Qc !== null && (!q || Qc.conversationId !== z) && $c(null);
|
|
2324
2326
|
}, [
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2327
|
+
q,
|
|
2328
|
+
z,
|
|
2329
|
+
Qc
|
|
2328
2330
|
]);
|
|
2329
|
-
let
|
|
2330
|
-
|
|
2331
|
+
let el = Qc !== null && Zo === Qc.replyId, tl = k(!1), nl = E(() => {
|
|
2332
|
+
tl.current = !0, el && Qo(), Vc();
|
|
2331
2333
|
}, [
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2334
|
+
Vc,
|
|
2335
|
+
el,
|
|
2336
|
+
Qo
|
|
2335
2337
|
]);
|
|
2336
2338
|
D(() => {
|
|
2337
|
-
$.active || (
|
|
2339
|
+
$.active || (tl.current = !1);
|
|
2338
2340
|
}, [$.active]), D(() => {
|
|
2339
|
-
|
|
2341
|
+
q || !tl.current || (tl.current = !1, $.active && qc());
|
|
2340
2342
|
}, [
|
|
2341
|
-
|
|
2343
|
+
q,
|
|
2342
2344
|
$.active,
|
|
2343
|
-
|
|
2345
|
+
qc
|
|
2344
2346
|
]), D(() => {
|
|
2345
|
-
|
|
2346
|
-
}, [
|
|
2347
|
-
let
|
|
2347
|
+
q && bo(!1);
|
|
2348
|
+
}, [q, bo]);
|
|
2349
|
+
let rl = O(() => ({
|
|
2348
2350
|
live: $.active,
|
|
2349
|
-
blocked:
|
|
2350
|
-
impossible:
|
|
2351
|
-
start:
|
|
2351
|
+
blocked: Xc === null ? null : Zc.voiceStartBlocked(Xc),
|
|
2352
|
+
impossible: Sr(Xc),
|
|
2353
|
+
start: nl
|
|
2352
2354
|
}), [
|
|
2353
2355
|
$.active,
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
]), [
|
|
2356
|
+
Xc,
|
|
2357
|
+
Zc,
|
|
2358
|
+
nl
|
|
2359
|
+
]), [il, al] = A("mini"), ol = Vi && K.covered !== !0 && !($.active && il !== "mini") && !(go && !$.active) && !(Mc || Nc || Pc || Fc), sl = _o?.ask, cl = ki(sl?.subscribe ?? zi, sl?.getSnapshot ?? Bi, sl?.getSnapshot ?? Bi), ll = Cr({
|
|
2358
2360
|
voiceLive: $.active,
|
|
2359
|
-
readOnly:
|
|
2360
|
-
writes:
|
|
2361
|
-
auto:
|
|
2362
|
-
selectedMode:
|
|
2363
|
-
conversation:
|
|
2364
|
-
mode:
|
|
2365
|
-
routedBy:
|
|
2366
|
-
hasHistory:
|
|
2361
|
+
readOnly: Ba,
|
|
2362
|
+
writes: wr({
|
|
2363
|
+
auto: io,
|
|
2364
|
+
selectedMode: B,
|
|
2365
|
+
conversation: H && !Ba ? {
|
|
2366
|
+
mode: H.mode,
|
|
2367
|
+
routedBy: H.routedBy,
|
|
2368
|
+
hasHistory: er(H)
|
|
2367
2369
|
} : null,
|
|
2368
2370
|
modeWrites: (e) => F.find((t) => t.id === e)?.writeCapable === !0 || Ce(e)
|
|
2369
2371
|
}),
|
|
2370
|
-
avatar:
|
|
2371
|
-
busy:
|
|
2372
|
-
committing:
|
|
2373
|
-
}),
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
}, [
|
|
2377
|
-
let
|
|
2372
|
+
avatar: cl,
|
|
2373
|
+
busy: W || Bo !== null || Ha || hs || fo !== null || co,
|
|
2374
|
+
committing: Jc.committing
|
|
2375
|
+
}), ul = k(ll);
|
|
2376
|
+
Oi(() => {
|
|
2377
|
+
ul.current = ll;
|
|
2378
|
+
}, [ll]);
|
|
2379
|
+
let dl = E((e) => {
|
|
2378
2380
|
let t = e.trim();
|
|
2379
|
-
if (t === "" ||
|
|
2380
|
-
|
|
2381
|
+
if (t === "" || ul.current !== null) return { accepted: !1 };
|
|
2382
|
+
el && Qo();
|
|
2381
2383
|
let n = {
|
|
2382
2384
|
token: M(),
|
|
2383
2385
|
exchange: null,
|
|
2384
2386
|
handled: !1
|
|
2385
2387
|
};
|
|
2386
|
-
|
|
2388
|
+
$o.current = n;
|
|
2387
2389
|
try {
|
|
2388
2390
|
Q(t, [], {
|
|
2389
2391
|
fromPerson: !0,
|
|
2390
2392
|
avatarTabAsk: n.token,
|
|
2391
2393
|
localRecordsChecked: !0,
|
|
2392
|
-
...
|
|
2394
|
+
...io ? { autoIntent: "read" } : {}
|
|
2393
2395
|
});
|
|
2394
2396
|
} finally {
|
|
2395
|
-
|
|
2397
|
+
$o.current = null;
|
|
2396
2398
|
}
|
|
2397
2399
|
let r = n.exchange;
|
|
2398
2400
|
return r === null ? n.handled ? {
|
|
2399
2401
|
accepted: !0,
|
|
2400
2402
|
recorded: !1
|
|
2401
|
-
} : { accepted: !1 } : (
|
|
2403
|
+
} : { accepted: !1 } : ($c(r), {
|
|
2402
2404
|
accepted: !0,
|
|
2403
2405
|
recorded: !0,
|
|
2404
2406
|
...r
|
|
2405
2407
|
});
|
|
2406
2408
|
}, [
|
|
2407
|
-
|
|
2409
|
+
io,
|
|
2408
2410
|
Q,
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
]), [
|
|
2412
|
-
blocker:
|
|
2413
|
-
line:
|
|
2414
|
-
send:
|
|
2415
|
-
last:
|
|
2416
|
-
navigatingReplyId:
|
|
2417
|
-
draft:
|
|
2411
|
+
Qo,
|
|
2412
|
+
el
|
|
2413
|
+
]), [fl] = A(() => Er()), pl = O(() => ({
|
|
2414
|
+
blocker: ll,
|
|
2415
|
+
line: Tr(ll, Xc),
|
|
2416
|
+
send: dl,
|
|
2417
|
+
last: Qc,
|
|
2418
|
+
navigatingReplyId: _s,
|
|
2419
|
+
draft: fl
|
|
2418
2420
|
}), [
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
]),
|
|
2421
|
+
ll,
|
|
2422
|
+
Xc,
|
|
2423
|
+
dl,
|
|
2424
|
+
Qc,
|
|
2425
|
+
_s,
|
|
2426
|
+
fl
|
|
2427
|
+
]), ml = K.setReplyEscape, hl = q && ol && el;
|
|
2426
2428
|
D(() => {
|
|
2427
|
-
if (!(!
|
|
2429
|
+
if (!(!ml || !hl)) return ml(Qo), () => ml(null);
|
|
2428
2430
|
}, [
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2431
|
+
ml,
|
|
2432
|
+
hl,
|
|
2433
|
+
Qo
|
|
2432
2434
|
]), D(() => {
|
|
2433
|
-
let e =
|
|
2435
|
+
let e = xo.current, t = ft(e), n = v.getState(), r = S({
|
|
2434
2436
|
sessionLive: $.active,
|
|
2435
2437
|
bound: e,
|
|
2436
2438
|
activeConversationId: n.activeConversationId,
|
|
2437
2439
|
boundConversationExists: n.conversations.some((e) => e.id === t)
|
|
2438
2440
|
});
|
|
2439
|
-
|
|
2441
|
+
wo(r.bound), r.end && $.end();
|
|
2440
2442
|
}, [
|
|
2441
2443
|
$,
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2444
|
+
z,
|
|
2445
|
+
ua,
|
|
2446
|
+
wo
|
|
2445
2447
|
]);
|
|
2446
|
-
let
|
|
2448
|
+
let gl = k(at);
|
|
2447
2449
|
D(() => {
|
|
2448
|
-
let e = ct(
|
|
2449
|
-
activeConversationId:
|
|
2450
|
-
chatTurnCount:
|
|
2451
|
-
voiceTurnCount:
|
|
2450
|
+
let e = ct(gl.current, {
|
|
2451
|
+
activeConversationId: z,
|
|
2452
|
+
chatTurnCount: nc.length,
|
|
2453
|
+
voiceTurnCount: fc.length,
|
|
2452
2454
|
sessionLive: $.active,
|
|
2453
|
-
sessionBoundTo:
|
|
2454
|
-
turnInFlight:
|
|
2455
|
+
sessionBoundTo: xo.current,
|
|
2456
|
+
turnInFlight: W
|
|
2455
2457
|
});
|
|
2456
|
-
|
|
2458
|
+
gl.current = e.state, e.open && bo(!0);
|
|
2457
2459
|
}, [
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2460
|
+
z,
|
|
2461
|
+
nc.length,
|
|
2462
|
+
fc.length,
|
|
2461
2463
|
$.active,
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
+
W,
|
|
2465
|
+
bo
|
|
2464
2466
|
]), D(() => {
|
|
2465
2467
|
if (!$.active) {
|
|
2466
|
-
|
|
2467
|
-
for (let e of
|
|
2468
|
-
|
|
2468
|
+
hc.current.clear(), _c(null), Wo.current = null;
|
|
2469
|
+
for (let e of yc.current) window.clearInterval(e);
|
|
2470
|
+
yc.current.clear();
|
|
2469
2471
|
}
|
|
2470
2472
|
}, [$.active]), D(() => {
|
|
2471
|
-
let e =
|
|
2473
|
+
let e = yc.current;
|
|
2472
2474
|
return () => {
|
|
2473
2475
|
for (let t of e) window.clearInterval(t);
|
|
2474
2476
|
e.clear();
|
|
2475
2477
|
};
|
|
2476
2478
|
}, []), D(() => {
|
|
2477
2479
|
let e = v.getState().consumePendingPrompt();
|
|
2478
|
-
return e &&
|
|
2480
|
+
return e && $s.current(e), v.subscribe((e, t) => {
|
|
2479
2481
|
if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
|
|
2480
2482
|
let e = v.getState().consumePendingPrompt();
|
|
2481
|
-
e &&
|
|
2483
|
+
e && $s.current(e);
|
|
2482
2484
|
}
|
|
2483
2485
|
});
|
|
2484
2486
|
}, []);
|
|
2485
|
-
let
|
|
2486
|
-
let t =
|
|
2487
|
-
if (t && t.mode !== e && G.withdraw(t.id, "mode_switched"), t &&
|
|
2487
|
+
let _l = E((e) => {
|
|
2488
|
+
let t = z ? v.getState().conversations.find((e) => e.id === z) : void 0;
|
|
2489
|
+
if (t && t.mode !== e && G.withdraw(t.id, "mode_switched"), t && er(t)) {
|
|
2488
2490
|
if (t.mode !== e) {
|
|
2489
|
-
let t = ie(), n = v.getState().conversations.find((n) => n.mode === e &&
|
|
2490
|
-
n ?
|
|
2491
|
+
let t = ie(), n = v.getState().conversations.find((n) => n.mode === e && rr(n, t) && !v.getState().processingByConversationId[n.id]);
|
|
2492
|
+
n ? ma(n.id) : ha(void 0, e);
|
|
2491
2493
|
}
|
|
2492
|
-
} else
|
|
2494
|
+
} else z && pa(z, e);
|
|
2493
2495
|
let n = v.getState().activeConversationId;
|
|
2494
|
-
n ?
|
|
2496
|
+
n ? pa(n, e) : Oa(!1), fa(e);
|
|
2495
2497
|
}, [
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2498
|
+
z,
|
|
2499
|
+
ha,
|
|
2500
|
+
ma,
|
|
2501
|
+
Oa,
|
|
2502
|
+
pa,
|
|
2503
|
+
fa,
|
|
2502
2504
|
G
|
|
2503
|
-
]),
|
|
2505
|
+
]), vl = E(() => {
|
|
2504
2506
|
let e = v.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
|
|
2505
2507
|
if (!t) {
|
|
2506
|
-
|
|
2508
|
+
Oa(!0), fa(p);
|
|
2507
2509
|
return;
|
|
2508
2510
|
}
|
|
2509
2511
|
if (t.routedBy === "auto") {
|
|
2510
|
-
|
|
2512
|
+
Oa(!0);
|
|
2511
2513
|
return;
|
|
2512
2514
|
}
|
|
2513
|
-
if (!
|
|
2514
|
-
|
|
2515
|
+
if (!er(t)) {
|
|
2516
|
+
ka(t.id, p);
|
|
2515
2517
|
return;
|
|
2516
2518
|
}
|
|
2517
2519
|
G.withdraw(t.id, "mode_switched");
|
|
2518
|
-
let n = ie(), r = e.conversations.find((t) => t.routedBy === "auto" &&
|
|
2519
|
-
r ? (
|
|
2520
|
+
let n = ie(), r = e.conversations.find((t) => t.routedBy === "auto" && rr(t, n) && !e.processingByConversationId[t.id]);
|
|
2521
|
+
r ? (ma(r.id), ka(r.id, p)) : ha(void 0, p, { routedBy: "auto" });
|
|
2520
2522
|
}, [
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2523
|
+
ha,
|
|
2524
|
+
ka,
|
|
2525
|
+
ma,
|
|
2526
|
+
Oa,
|
|
2527
|
+
fa,
|
|
2526
2528
|
G
|
|
2527
|
-
]),
|
|
2529
|
+
]), yl = E((e) => {
|
|
2528
2530
|
if (F.find((t) => t.id === e)?.writeCapable && !de(v.getState().acknowledgedWriteModes, e)) {
|
|
2529
|
-
|
|
2531
|
+
po(e);
|
|
2530
2532
|
return;
|
|
2531
2533
|
}
|
|
2532
|
-
|
|
2533
|
-
}, [
|
|
2534
|
-
let e =
|
|
2535
|
-
if (
|
|
2536
|
-
let t =
|
|
2537
|
-
if (
|
|
2538
|
-
|
|
2534
|
+
_l(e);
|
|
2535
|
+
}, [_l, F]), bl = E(() => {
|
|
2536
|
+
let e = fo;
|
|
2537
|
+
if (po(null), !e) return;
|
|
2538
|
+
let t = oo.current;
|
|
2539
|
+
if (oo.current = null, t) {
|
|
2540
|
+
Ea(e), Q(t.content, t.attachments, t.options);
|
|
2539
2541
|
return;
|
|
2540
2542
|
}
|
|
2541
|
-
|
|
2543
|
+
Ea(e), _l(e);
|
|
2542
2544
|
}, [
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2545
|
+
fo,
|
|
2546
|
+
Ea,
|
|
2547
|
+
_l,
|
|
2546
2548
|
Q
|
|
2547
|
-
]),
|
|
2548
|
-
|
|
2549
|
-
let e =
|
|
2550
|
-
|
|
2549
|
+
]), xl = fo === null ? void 0 : F.find((e) => e.id === fo) ?? { id: fo }, Sl = E(() => {
|
|
2550
|
+
po(null);
|
|
2551
|
+
let e = oo.current;
|
|
2552
|
+
oo.current = null, e && Q(e.content, e.attachments, {
|
|
2551
2553
|
...e.options,
|
|
2552
2554
|
autoIntent: "read"
|
|
2553
2555
|
});
|
|
2554
|
-
}, [Q])
|
|
2555
|
-
|
|
2556
|
+
}, [Q]), Cl = E(() => Ko(), [Ko]), [wl, Tl] = A(null), El = E(() => {
|
|
2557
|
+
let e = v.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0, n = Ro.current;
|
|
2558
|
+
return {
|
|
2559
|
+
state: e,
|
|
2560
|
+
conversation: t ? {
|
|
2561
|
+
mode: t.mode,
|
|
2562
|
+
hasHistory: er(t),
|
|
2563
|
+
routedByAuto: t.routedBy === "auto"
|
|
2564
|
+
} : null,
|
|
2565
|
+
waitingCount: t ? G.liveFor(t.id).count : 0,
|
|
2566
|
+
hasDraft: n !== null && (n.text.trim() !== "" || n.hasAttachments)
|
|
2567
|
+
};
|
|
2568
|
+
}, [G]), Dl = io ? N("modeSelector.auto", "Auto") : void 0, Ol = E((e) => {
|
|
2569
|
+
if (fo !== null) return;
|
|
2570
|
+
let { state: t, conversation: n, waitingCount: r, hasDraft: i } = El(), a = F.find((t) => t.id === e), o = Kn({
|
|
2571
|
+
target: {
|
|
2572
|
+
kind: "mode",
|
|
2573
|
+
mode: e,
|
|
2574
|
+
consentRequired: !!a?.writeCapable && !de(t.acknowledgedWriteModes, e)
|
|
2575
|
+
},
|
|
2576
|
+
conversation: n,
|
|
2577
|
+
waitingCount: r,
|
|
2578
|
+
hasDraft: i
|
|
2579
|
+
});
|
|
2580
|
+
if (!o.needsDialog) {
|
|
2581
|
+
_l(e);
|
|
2582
|
+
return;
|
|
2583
|
+
}
|
|
2584
|
+
Tl({
|
|
2585
|
+
open: !0,
|
|
2586
|
+
target: {
|
|
2587
|
+
kind: "mode",
|
|
2588
|
+
mode: e
|
|
2589
|
+
},
|
|
2590
|
+
plan: o,
|
|
2591
|
+
targetName: Gn(N, a ?? { id: e }),
|
|
2592
|
+
currentName: Dl
|
|
2593
|
+
});
|
|
2594
|
+
}, [
|
|
2595
|
+
Dl,
|
|
2596
|
+
El,
|
|
2597
|
+
fo,
|
|
2598
|
+
_l,
|
|
2599
|
+
F,
|
|
2600
|
+
N
|
|
2601
|
+
]), kl = E(() => {
|
|
2602
|
+
if (fo !== null) return;
|
|
2603
|
+
let { conversation: e, waitingCount: t, hasDraft: n } = El(), r = Kn({
|
|
2604
|
+
target: { kind: "auto" },
|
|
2605
|
+
conversation: e,
|
|
2606
|
+
waitingCount: t,
|
|
2607
|
+
hasDraft: n
|
|
2608
|
+
});
|
|
2609
|
+
if (!r.needsDialog) {
|
|
2610
|
+
vl();
|
|
2611
|
+
return;
|
|
2612
|
+
}
|
|
2613
|
+
Tl({
|
|
2614
|
+
open: !0,
|
|
2615
|
+
target: { kind: "auto" },
|
|
2616
|
+
plan: r,
|
|
2617
|
+
targetName: N("modeSelector.auto", "Auto")
|
|
2618
|
+
});
|
|
2619
|
+
}, [
|
|
2620
|
+
vl,
|
|
2621
|
+
El,
|
|
2622
|
+
fo,
|
|
2623
|
+
N
|
|
2624
|
+
]), Al = E(() => {
|
|
2625
|
+
let e = wl;
|
|
2626
|
+
if (e?.open) {
|
|
2627
|
+
if (Tl({
|
|
2628
|
+
...e,
|
|
2629
|
+
open: !1
|
|
2630
|
+
}), e.target.kind === "auto") {
|
|
2631
|
+
vl();
|
|
2632
|
+
return;
|
|
2633
|
+
}
|
|
2634
|
+
e.plan.consent && Ea(e.target.mode), _l(e.target.mode);
|
|
2635
|
+
}
|
|
2636
|
+
}, [
|
|
2637
|
+
Ea,
|
|
2638
|
+
vl,
|
|
2639
|
+
wl,
|
|
2640
|
+
_l
|
|
2641
|
+
]), jl = E(() => {
|
|
2642
|
+
Tl((e) => e && {
|
|
2643
|
+
...e,
|
|
2644
|
+
open: !1
|
|
2645
|
+
});
|
|
2646
|
+
}, []), Ml = wl ? {
|
|
2647
|
+
consent: wl.plan.consent,
|
|
2648
|
+
withdrawnCount: wl.plan.withdrawnCount,
|
|
2649
|
+
movesToNewConversation: wl.plan.movesToNewConversation,
|
|
2650
|
+
draftKept: wl.plan.draftKept,
|
|
2651
|
+
targetName: wl.targetName,
|
|
2652
|
+
...wl.currentName === void 0 ? {} : { currentName: wl.currentName }
|
|
2653
|
+
} : void 0, Nl = wl?.target.kind === "mode" ? wl.target.mode : null, Pl = Nl === null ? void 0 : F.find((e) => e.id === Nl) ?? { id: Nl };
|
|
2654
|
+
return /* @__PURE__ */ Ai("div", {
|
|
2556
2655
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
2557
2656
|
children: [
|
|
2558
|
-
/* @__PURE__ */
|
|
2657
|
+
/* @__PURE__ */ Ai("div", {
|
|
2559
2658
|
className: "contents",
|
|
2560
|
-
inert: $.active ||
|
|
2561
|
-
...
|
|
2659
|
+
inert: $.active || q || void 0,
|
|
2660
|
+
...K.ids ? {
|
|
2562
2661
|
role: "tabpanel",
|
|
2563
|
-
id:
|
|
2564
|
-
"aria-labelledby":
|
|
2662
|
+
id: K.ids.chatPanel,
|
|
2663
|
+
"aria-labelledby": K.ids.chatTab
|
|
2565
2664
|
} : {},
|
|
2566
2665
|
children: [
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
count:
|
|
2570
|
-
onOpenTranscript: () =>
|
|
2666
|
+
qa === null ? null : /* @__PURE__ */ j(Jn, { onDismiss: () => Ka(qa) }),
|
|
2667
|
+
fc.length > 0 && !$.active ? /* @__PURE__ */ j(Wn, {
|
|
2668
|
+
count: fc.length,
|
|
2669
|
+
onOpenTranscript: () => bo(!0)
|
|
2571
2670
|
}) : null,
|
|
2572
|
-
|
|
2573
|
-
state:
|
|
2574
|
-
onRetry:
|
|
2575
|
-
}) :
|
|
2671
|
+
nc.length === 0 && (Ha || Ua) ? /* @__PURE__ */ j(Yn, {
|
|
2672
|
+
state: Ha ? "loading" : "failed",
|
|
2673
|
+
onRetry: Qa
|
|
2674
|
+
}) : nc.length === 0 && H?.sync?.hasOlder ? /* @__PURE__ */ j("div", {
|
|
2576
2675
|
className: "flex min-h-0 flex-1 flex-col",
|
|
2577
|
-
children: /* @__PURE__ */ j(
|
|
2578
|
-
onShowEarlier:
|
|
2579
|
-
disabled:
|
|
2676
|
+
children: /* @__PURE__ */ j(Zn, {
|
|
2677
|
+
onShowEarlier: $a,
|
|
2678
|
+
disabled: Ha
|
|
2580
2679
|
})
|
|
2581
|
-
}) :
|
|
2582
|
-
mode:
|
|
2583
|
-
onSuggestionClick:
|
|
2584
|
-
explainsAuto:
|
|
2585
|
-
suggestions:
|
|
2586
|
-
}) : /* @__PURE__ */
|
|
2680
|
+
}) : nc.length === 0 ? /* @__PURE__ */ j(or, {
|
|
2681
|
+
mode: B,
|
|
2682
|
+
onSuggestionClick: Xs,
|
|
2683
|
+
explainsAuto: io,
|
|
2684
|
+
suggestions: io && B === "assistant" ? ee(F.find((e) => e.id === "assistant")?.suggestions ?? [], F.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
|
|
2685
|
+
}) : /* @__PURE__ */ Ai("div", {
|
|
2587
2686
|
className: "flex min-h-0 flex-1 flex-col",
|
|
2588
|
-
children: [
|
|
2589
|
-
onShowEarlier:
|
|
2590
|
-
disabled:
|
|
2591
|
-
}) : null, /* @__PURE__ */ j(
|
|
2592
|
-
onApprovePendingWrite:
|
|
2593
|
-
approvingWriteRef:
|
|
2594
|
-
approvableMessageId:
|
|
2595
|
-
retryableMessageId:
|
|
2596
|
-
messages:
|
|
2597
|
-
processing:
|
|
2598
|
-
streamingMessageId:
|
|
2599
|
-
failedMessageId:
|
|
2600
|
-
onRetry:
|
|
2601
|
-
renderWriteProposals:
|
|
2602
|
-
hidesLegacyWriteCard:
|
|
2603
|
-
renderUiOffers:
|
|
2687
|
+
children: [H?.sync?.hasOlder ? /* @__PURE__ */ j(Zn, {
|
|
2688
|
+
onShowEarlier: $a,
|
|
2689
|
+
disabled: Ha
|
|
2690
|
+
}) : null, /* @__PURE__ */ j(vr, {
|
|
2691
|
+
onApprovePendingWrite: Jo,
|
|
2692
|
+
approvingWriteRef: Bo,
|
|
2693
|
+
approvableMessageId: ic?.messageId ?? null,
|
|
2694
|
+
retryableMessageId: ac,
|
|
2695
|
+
messages: nc,
|
|
2696
|
+
processing: U ?? null,
|
|
2697
|
+
streamingMessageId: Ma,
|
|
2698
|
+
failedMessageId: Na,
|
|
2699
|
+
onRetry: Bo === null ? Qs : void 0,
|
|
2700
|
+
renderWriteProposals: sc,
|
|
2701
|
+
hidesLegacyWriteCard: oc,
|
|
2702
|
+
renderUiOffers: lc
|
|
2604
2703
|
})]
|
|
2605
2704
|
}),
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2705
|
+
Ba ? /* @__PURE__ */ j(Xn, { onStartNew: () => ha() }) : null,
|
|
2706
|
+
Va && z ? /* @__PURE__ */ j(qn, { onUnarchive: () => ar.updateConversation(z, { archived: !1 }) }) : null,
|
|
2707
|
+
Ws === null ? null : /* @__PURE__ */ j(sr, {
|
|
2609
2708
|
tr: N,
|
|
2610
|
-
onDismiss: () =>
|
|
2709
|
+
onDismiss: () => Gs(null)
|
|
2611
2710
|
}),
|
|
2612
|
-
|
|
2613
|
-
state:
|
|
2614
|
-
onRetry:
|
|
2711
|
+
nc.length > 0 && (Ha || Ua) ? /* @__PURE__ */ j(Yn, {
|
|
2712
|
+
state: Ha ? "loading" : "failed",
|
|
2713
|
+
onRetry: Qa,
|
|
2615
2714
|
compact: !0
|
|
2616
2715
|
}) : null,
|
|
2617
|
-
/* @__PURE__ */ j(
|
|
2618
|
-
onStartVoiceSession: $.available &&
|
|
2716
|
+
/* @__PURE__ */ j(xi, {
|
|
2717
|
+
onStartVoiceSession: $.available && Mo ? Vc : void 0,
|
|
2619
2718
|
onSend: (e, t) => void Q(e, t, { fromPerson: !0 }),
|
|
2620
|
-
onDraftChange:
|
|
2621
|
-
disabled:
|
|
2622
|
-
readOnly:
|
|
2623
|
-
placeholder:
|
|
2624
|
-
mode:
|
|
2625
|
-
writeAccessDenied:
|
|
2626
|
-
availableModes:
|
|
2627
|
-
attachmentCharsPerFile:
|
|
2628
|
-
onModeChange:
|
|
2629
|
-
auto:
|
|
2630
|
-
active:
|
|
2631
|
-
onSelect:
|
|
2719
|
+
onDraftChange: Rs,
|
|
2720
|
+
disabled: W || Bo !== null || Ha || hs,
|
|
2721
|
+
readOnly: Ba,
|
|
2722
|
+
placeholder: B === "api-calls" ? N("chatArea.placeholderActions", "What would you like me to do?") : N("chatArea.placeholderGeneral", "Ask me anything…"),
|
|
2723
|
+
mode: B,
|
|
2724
|
+
writeAccessDenied: Hi === "denied" && !!ko?.writeCapable,
|
|
2725
|
+
availableModes: no,
|
|
2726
|
+
attachmentCharsPerFile: uo,
|
|
2727
|
+
onModeChange: Wi ? Ol : yl,
|
|
2728
|
+
auto: ro ? {
|
|
2729
|
+
active: io,
|
|
2730
|
+
onSelect: Wi ? kl : vl
|
|
2632
2731
|
} : void 0,
|
|
2633
|
-
suspendDictation:
|
|
2634
|
-
onVoiceStateChange:
|
|
2732
|
+
suspendDictation: q,
|
|
2733
|
+
onVoiceStateChange: K.ids ? Yc : void 0,
|
|
2734
|
+
presentation: Ui,
|
|
2735
|
+
turnInFlight: W,
|
|
2736
|
+
onStop: Wi ? Cl : void 0,
|
|
2737
|
+
modeDisabledReason: W ? "replying" : "busy"
|
|
2635
2738
|
}),
|
|
2636
2739
|
/* @__PURE__ */ j(Fn, {
|
|
2637
2740
|
productKey: P,
|
|
2638
|
-
enabled: !!
|
|
2741
|
+
enabled: !!Ji,
|
|
2639
2742
|
className: "px-3 pt-1 text-center",
|
|
2640
2743
|
testId: "assistant-ai-credit-balance"
|
|
2641
2744
|
}),
|
|
2642
2745
|
/* @__PURE__ */ j(An, { className: "px-3 pb-2 pt-1" })
|
|
2643
2746
|
]
|
|
2644
2747
|
}),
|
|
2645
|
-
|
|
2646
|
-
turns:
|
|
2647
|
-
onClose: () =>
|
|
2648
|
-
onSave:
|
|
2649
|
-
onContinueInChat:
|
|
2748
|
+
go && !$.active ? /* @__PURE__ */ j(Qn, {
|
|
2749
|
+
turns: fc,
|
|
2750
|
+
onClose: () => bo(!1),
|
|
2751
|
+
onSave: pc,
|
|
2752
|
+
onContinueInChat: Wc ? Gc : void 0,
|
|
2650
2753
|
closeOnEscape: !0,
|
|
2651
|
-
onShowEarlier:
|
|
2652
|
-
showEarlierDisabled:
|
|
2653
|
-
renderAfterTurn:
|
|
2754
|
+
onShowEarlier: H?.sync?.hasOlder ? $a : void 0,
|
|
2755
|
+
showEarlierDisabled: Ha,
|
|
2756
|
+
renderAfterTurn: cc
|
|
2654
2757
|
}) : null,
|
|
2655
|
-
|
|
2656
|
-
tab:
|
|
2657
|
-
id:
|
|
2658
|
-
labelledBy:
|
|
2659
|
-
leaveHintId:
|
|
2660
|
-
shown:
|
|
2661
|
-
voice:
|
|
2662
|
-
...
|
|
2758
|
+
q && _o && K.ids ? /* @__PURE__ */ j(Dr, {
|
|
2759
|
+
tab: _o,
|
|
2760
|
+
id: K.ids.avatarPanel,
|
|
2761
|
+
labelledBy: K.ids.avatarTab,
|
|
2762
|
+
leaveHintId: K.ids.leaveHint,
|
|
2763
|
+
shown: ol,
|
|
2764
|
+
voice: rl,
|
|
2765
|
+
...sl ? { ask: pl } : {}
|
|
2663
2766
|
}) : null,
|
|
2664
|
-
$.active && /* @__PURE__ */ j(
|
|
2767
|
+
$.active && /* @__PURE__ */ j(br, {
|
|
2665
2768
|
session: $.session,
|
|
2666
2769
|
notice: $.notice,
|
|
2667
2770
|
privacyNotice: $.handsFree.privacyNotice,
|
|
@@ -2672,50 +2775,58 @@ var Li = () => () => {}, Ri = () => "off", zi = ({ visible: zi = !0, writeAccess
|
|
|
2672
2775
|
correcting: $.correcting,
|
|
2673
2776
|
onLetMeFinish: $.letMeFinish,
|
|
2674
2777
|
onImDone: $.imDone,
|
|
2675
|
-
turns:
|
|
2778
|
+
turns: xc,
|
|
2676
2779
|
spokenChunks: $.spokenChunks,
|
|
2677
|
-
attachments:
|
|
2678
|
-
onAttachFiles:
|
|
2679
|
-
onRemoveAttachment:
|
|
2680
|
-
onRetryAttachment:
|
|
2681
|
-
canAttachMore:
|
|
2682
|
-
preparingAttachments:
|
|
2683
|
-
attachmentsLocked:
|
|
2684
|
-
attachmentNotice:
|
|
2685
|
-
onSaveTranscript:
|
|
2686
|
-
onContinueInChat:
|
|
2780
|
+
attachments: mc.attachments,
|
|
2781
|
+
onAttachFiles: mc.addFiles,
|
|
2782
|
+
onRemoveAttachment: mc.remove,
|
|
2783
|
+
onRetryAttachment: mc.retry,
|
|
2784
|
+
canAttachMore: mc.canAddMore,
|
|
2785
|
+
preparingAttachments: mc.preparingCount,
|
|
2786
|
+
attachmentsLocked: mc.isCommitting,
|
|
2787
|
+
attachmentNotice: vc,
|
|
2788
|
+
onSaveTranscript: pc,
|
|
2789
|
+
onContinueInChat: Gc,
|
|
2687
2790
|
onInterrupt: () => {
|
|
2688
|
-
$.interrupt(),
|
|
2791
|
+
$.interrupt(), Ko();
|
|
2689
2792
|
},
|
|
2690
|
-
spoken:
|
|
2793
|
+
spoken: tc,
|
|
2691
2794
|
onToggleMute: $.toggleMute,
|
|
2692
|
-
onEnd:
|
|
2693
|
-
proposalChip:
|
|
2694
|
-
label: St(
|
|
2695
|
-
onOpen:
|
|
2795
|
+
onEnd: qc,
|
|
2796
|
+
proposalChip: kc ? {
|
|
2797
|
+
label: St(kc, N),
|
|
2798
|
+
onOpen: Oc
|
|
2696
2799
|
} : null,
|
|
2697
|
-
proposalTray:
|
|
2698
|
-
renderAfterTurn:
|
|
2699
|
-
onViewChange:
|
|
2800
|
+
proposalTray: jc,
|
|
2801
|
+
renderAfterTurn: cc,
|
|
2802
|
+
onViewChange: K.ids ? al : void 0
|
|
2700
2803
|
}),
|
|
2701
|
-
/* @__PURE__ */ j(
|
|
2702
|
-
open:
|
|
2703
|
-
mode:
|
|
2704
|
-
currentMode:
|
|
2705
|
-
onConfirm:
|
|
2706
|
-
onCancel:
|
|
2804
|
+
/* @__PURE__ */ j(Ci, {
|
|
2805
|
+
open: fo !== null,
|
|
2806
|
+
mode: xl,
|
|
2807
|
+
currentMode: ko ?? { id: B },
|
|
2808
|
+
onConfirm: bl,
|
|
2809
|
+
onCancel: Sl
|
|
2707
2810
|
}),
|
|
2811
|
+
Wi ? /* @__PURE__ */ j(Ci, {
|
|
2812
|
+
open: wl?.open === !0,
|
|
2813
|
+
mode: Pl,
|
|
2814
|
+
currentMode: ko ?? { id: B },
|
|
2815
|
+
switchPlan: Ml,
|
|
2816
|
+
onConfirm: Al,
|
|
2817
|
+
onCancel: jl
|
|
2818
|
+
}) : null,
|
|
2708
2819
|
/* @__PURE__ */ j(In, {
|
|
2709
|
-
...
|
|
2710
|
-
view:
|
|
2711
|
-
serverNow:
|
|
2712
|
-
arrivedAt:
|
|
2713
|
-
capabilities:
|
|
2714
|
-
turnInFlight:
|
|
2820
|
+
...La.dialog,
|
|
2821
|
+
view: uc?.view ?? La.dialog.view,
|
|
2822
|
+
serverNow: uc?.serverNow ?? NaN,
|
|
2823
|
+
arrivedAt: uc?.arrivedAt ?? NaN,
|
|
2824
|
+
capabilities: uc ? Pa[uc.session.sandboxId] : null,
|
|
2825
|
+
turnInFlight: W,
|
|
2715
2826
|
tr: N
|
|
2716
2827
|
})
|
|
2717
2828
|
]
|
|
2718
2829
|
});
|
|
2719
2830
|
};
|
|
2720
2831
|
//#endregion
|
|
2721
|
-
export {
|
|
2832
|
+
export { Vi as AssistantChatArea };
|