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