@burdenoff/fe-libs 2026.926.1 → 2026.926.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/assistant/capabilities.d.ts +5 -0
- package/dist/shared/assistant/capabilities.d.ts.map +1 -1
- package/dist/shared/assistant/capabilities.js +2 -1
- package/dist/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/operations.d.ts +7 -0
- package/dist/shared/assistant/operations.d.ts.map +1 -1
- package/dist/shared/assistant/operations.js +2 -2
- package/dist/shared/assistant/prewarm.d.ts +32 -4
- package/dist/shared/assistant/prewarm.d.ts.map +1 -1
- package/dist/shared/assistant/prewarm.js +35 -15
- package/dist/shared/assistant/product.d.ts +11 -1
- package/dist/shared/assistant/product.d.ts.map +1 -1
- package/dist/shared/assistant/product.js +8 -6
- package/dist/shared/assistant/turnProgress.d.ts +56 -2
- package/dist/shared/assistant/turnProgress.d.ts.map +1 -1
- package/dist/shared/assistant/turnProgress.js +23 -12
- package/dist/shared/assistant/turnTimeline.d.ts +37 -3
- package/dist/shared/assistant/turnTimeline.d.ts.map +1 -1
- package/dist/shared/assistant/turnTimeline.js +45 -33
- package/dist/shared/assistant/turnTimingReport.d.ts +86 -0
- package/dist/shared/assistant/turnTimingReport.d.ts.map +1 -0
- package/dist/shared/assistant/turnTimingReport.js +123 -0
- package/dist/shared/assistant/turnTimingReporter.d.ts +146 -0
- package/dist/shared/assistant/turnTimingReporter.d.ts.map +1 -0
- package/dist/shared/assistant/turnTimingReporter.js +321 -0
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +510 -482
- package/dist/shared/graphql/fetch.d.ts +10 -0
- package/dist/shared/graphql/fetch.d.ts.map +1 -1
- package/dist/shared/graphql/fetch.js +64 -62
- package/dist/shared-assistant.js +133 -131
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import { useAssistantProduct as r } from "../product.js";
|
|
|
6
6
|
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
|
-
import { abortAssistantTurn as s, approvePendingWrite as c, createAssistantSandbox as l, createAssistantSession as u, extendAssistantSandboxTTL as
|
|
9
|
+
import { abortAssistantTurn as s, approvePendingWrite as c, createAssistantSandbox as l, createAssistantSession as u, extendAssistantSandboxTTL as ee, findExistingSandboxWithStatus as d, getAssistantArtifacts as f, getAssistantMessages as p, getAssistantSession as m, modeRequiresConfirmWrites as te, promptGatewayRequestBytes as ne, releaseSupersededAssistantSandboxes as re, sendAssistantPromptAsync as h, waitForAssistantServiceReady as g, waitForSandboxRunning as _ } from "../api.js";
|
|
10
10
|
import { sanitize as ie } from "../progress.js";
|
|
11
11
|
import { withIncompleteTurnNotice as ae } from "../streamBudget.js";
|
|
12
12
|
import { isVoiceTurn as oe, voiceMarker as v, voiceSessionIdOf as y } from "../voice/turnVisibility.js";
|
|
@@ -16,7 +16,7 @@ import { toCaptionText as ue } from "../voice/captionText.js";
|
|
|
16
16
|
import { resolveAssistantLanguage as de } from "../voice/languages.js";
|
|
17
17
|
import { resolveLanguagePair as fe } from "../voice/languagePair.js";
|
|
18
18
|
import { countInlineImageCandidates as pe, countInlinedImageParts as me, getSendableAttachments as he, largestInlineCharsPerFile as ge, resolveAssistantInlineLimits as _e, toMessageAttachment as ve } from "../attachments.js";
|
|
19
|
-
import { AssistantSendRefusal as ye, classifyTurnFailure as
|
|
19
|
+
import { AssistantSendRefusal as ye, classifyTurnFailure as be, turnOutcomeCopy as x } from "../turnOutcome.js";
|
|
20
20
|
import { createAdminModeAccessGate as xe, resolveAssistantSendModeAfterAccess as Se } from "../adminModeSendGate.js";
|
|
21
21
|
import { buildBoundedAttachmentTurn as Ce } from "../attachmentTurn.js";
|
|
22
22
|
import { isWriteModeAcknowledged as we, writeModeSendRefusalReason as Te } from "../writeModeConsent.js";
|
|
@@ -24,329 +24,357 @@ import { AUTO_READ_MODE as Ee, autoCarryOverFor as De, autoSuggestions as Oe, cl
|
|
|
24
24
|
import { resolveActiveModeSandbox as Ne, useAssistantStore as S } from "../store.js";
|
|
25
25
|
import { isTurnInFlight as Pe, planAbandonedTurn as Fe, planTurnAbort as Ie } from "../turnState.js";
|
|
26
26
|
import { getAssistantDisplayContent as Le } from "../displayContent.js";
|
|
27
|
-
import { NO_FIRST_TEXT as Re, buildAssistantProgress as ze,
|
|
28
|
-
import { parseToolActivity as
|
|
29
|
-
import { countSpokenTurns as
|
|
30
|
-
import { beginTurn as
|
|
31
|
-
import { useAssistantSpeech as
|
|
32
|
-
import { useVoiceSession as
|
|
33
|
-
import { getOrganizationId as
|
|
34
|
-
import { isMultimodalBodyRejection as
|
|
35
|
-
import { createReadinessTracker as
|
|
36
|
-
import { AssistantSpokenTurnsNotice as
|
|
37
|
-
import { VoiceTranscriptDrawer as
|
|
38
|
-
import { downloadFile as
|
|
39
|
-
import { AssistantEmptyState as
|
|
40
|
-
import { AssistantMessageList as
|
|
41
|
-
import { AssistantVoiceSession as
|
|
42
|
-
import { useAssistantApiAccess as
|
|
43
|
-
import { useConversationTurns as
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
27
|
+
import { NO_FIRST_TEXT as Re, buildAssistantProgress as ze, readAheadFor as Be, snapshotReplyFloor as Ve, startSessionReadAhead as He, trackFirstText as Ue } from "../turnProgress.js";
|
|
28
|
+
import { parseToolActivity as We } from "./AssistantToolActivity.js";
|
|
29
|
+
import { countSpokenTurns as Ge, spokenTurnText as Ke } from "../spokenTurns.js";
|
|
30
|
+
import { beginTurn as qe, describeTurn as C, detectTurnDevice as Je, markTurn as w, restartAttempt as Ye, turnClockMs as Xe } from "../turnTimeline.js";
|
|
31
|
+
import { useAssistantSpeech as Ze } from "./AssistantSpeechProvider.js";
|
|
32
|
+
import { useVoiceSession as Qe } from "./useVoiceSession.js";
|
|
33
|
+
import { getOrganizationId as $e, getWorkspaceId as T } from "../context.js";
|
|
34
|
+
import { isMultimodalBodyRejection as et, isRecoverableAssistantError as tt } from "../transportErrors.js";
|
|
35
|
+
import { createReadinessTracker as nt, planAfterTransportFailure as rt, planTrustedSandboxFailure as it } from "../sandboxReadiness.js";
|
|
36
|
+
import { AssistantSpokenTurnsNotice as at } from "./AssistantSpokenTurnsNotice.js";
|
|
37
|
+
import { VoiceTranscriptDrawer as ot } from "./voice/VoiceTranscriptDrawer.js";
|
|
38
|
+
import { downloadFile as st } from "../exportConversation.js";
|
|
39
|
+
import { AssistantEmptyState as ct } from "./AssistantEmptyState.js";
|
|
40
|
+
import { AssistantMessageList as lt } from "./AssistantMessageList.js";
|
|
41
|
+
import { AssistantVoiceSession as ut } from "./voice/AssistantVoiceSession.js";
|
|
42
|
+
import { useAssistantApiAccess as dt } from "../useAssistantApiAccess.js";
|
|
43
|
+
import { useConversationTurns as ft } from "../useConversationTurns.js";
|
|
44
|
+
import { sendAssistantTurnTimings as pt, startTurnTimingReporting as mt } from "../turnTimingReporter.js";
|
|
45
|
+
import { WarmCancelled as ht, consumeWarm as gt, prewarmTarget as _t, settleWarmBeforeSend as vt, startWarm as yt, warmState as bt } from "../prewarm.js";
|
|
46
|
+
import { isAlreadyThere as xt, matchLocalUiCommand as St, navDestinations as Ct, planThemeChange as wt } from "../localUiCommands.js";
|
|
47
|
+
import { chooseDestinationCopy as Tt, navigationCommandCopy as Et, themeCommandCopy as Dt } from "../localUiCommandCopy.js";
|
|
48
|
+
import { dispatchAssistantQuotaExhausted as Ot, notifyAiCreditsUpdated as kt } from "../aiCredits.js";
|
|
49
|
+
import { useAssistantAttachments as At } from "../useAssistantAttachments.js";
|
|
50
|
+
import { AssistantComposer as jt } from "./composer/AssistantComposer.js";
|
|
51
|
+
import { isProdRuntime as Mt } from "../env.js";
|
|
52
|
+
import { AssistantApiCallsConsentDialog as Nt } from "./AssistantApiCallsConsentDialog.js";
|
|
53
|
+
import { useVisibleNavItems as Pt } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
|
|
54
|
+
import { useCallback as E, useEffect as D, useMemo as O, useRef as k, useState as Ft } from "react";
|
|
55
|
+
import { jsx as A, jsxs as It } from "react/jsx-runtime";
|
|
55
56
|
//#region src/shared/assistant/ui/AssistantChatArea.tsx
|
|
56
|
-
var
|
|
57
|
-
function
|
|
57
|
+
var Lt = 600, Rt = 2e4;
|
|
58
|
+
function zt() {
|
|
58
59
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
59
60
|
}
|
|
60
|
-
var
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
]),
|
|
66
|
-
loading:
|
|
67
|
-
canUseAdminModes:
|
|
68
|
-
})).current,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}, [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
var Bt = ({ visible: Bt = !0, writeAccess: Vt = "unknown" }) => {
|
|
62
|
+
let j = i(), { product: M, modes: N, gatherPageContext: Ht, buildPrompt: Ut, reportTurnTimings: Wt, reportTokenUsage: Gt, localUiCommands: Kt } = r(), { getAccessToken: P, getWorkspaceToken: qt, userId: F } = n(), { locale: Jt } = t(), Yt = S((e) => e.assistantLanguage), Xt = S((e) => e.replyLanguage), Zt = O(() => fe(Yt, Xt, Jt), [
|
|
63
|
+
Yt,
|
|
64
|
+
Xt,
|
|
65
|
+
Jt
|
|
66
|
+
]), Qt = Zt.reply.english, $t = Zt.replyIsExplicit, en = Zt.reply.code, { conversations: tn, activeConversationId: I, mode: L, processingByConversationId: nn, setMode: R, setConversationMode: rn, setActiveConversation: an, createConversation: z, addMessage: B, updateMessage: on, patchMessage: sn, mergeMessageMetadata: cn, setConversationProcessing: ln, clearConversationProcessing: un, setBackendSessionId: dn, clearBackendSessionId: fn, setSandbox: V, clearSandbox: H, acknowledgedWriteModes: pn, acknowledgeWriteMode: mn, autoRouting: hn, setAutoRouting: gn, routeConversation: U } = S(), _n = tn.find((e) => e.id === I), vn = ft(_n), yn = vn.all, W = I ? nn[I] : void 0, bn = Pe(W?.status), xn = bn ? W?.messageId ?? null : null, Sn = W?.status === "error" ? W.messageId : null, { canUseApiCalls: G, loading: Cn } = dt($e()), K = k(xe({
|
|
67
|
+
loading: Cn,
|
|
68
|
+
canUseAdminModes: G
|
|
69
|
+
})).current, wn = k(N);
|
|
70
|
+
D(() => {
|
|
71
|
+
wn.current = N;
|
|
72
|
+
}, [N]);
|
|
73
|
+
let Tn = k(P);
|
|
74
|
+
D(() => {
|
|
75
|
+
Tn.current = P;
|
|
76
|
+
}, [P]);
|
|
77
|
+
let En = !!M && Wt !== !1;
|
|
78
|
+
D(() => {
|
|
79
|
+
if (En) return mt({ send: (e) => pt(e, {
|
|
80
|
+
workspaceId: T(),
|
|
81
|
+
authContext: {
|
|
82
|
+
accessToken: Tn.current(),
|
|
83
|
+
organizationId: $e()
|
|
84
|
+
}
|
|
85
|
+
}) });
|
|
86
|
+
}, [En]), D(() => {
|
|
87
|
+
K.update({
|
|
88
|
+
loading: Cn,
|
|
89
|
+
canUseAdminModes: G
|
|
75
90
|
});
|
|
76
91
|
}, [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
]),
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
let
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
92
|
+
K,
|
|
93
|
+
Cn,
|
|
94
|
+
G
|
|
95
|
+
]), D(() => () => {
|
|
96
|
+
K.abandon();
|
|
97
|
+
}, [K]);
|
|
98
|
+
let Dn = O(() => N.filter((e) => !e.requiresAdmin || G), [N, G]), On = je(Dn), kn = hn && On, An = k(On);
|
|
99
|
+
D(() => {
|
|
100
|
+
An.current = On;
|
|
101
|
+
}, [On]);
|
|
102
|
+
let jn = k(null), Mn = ge(N), [Nn, Pn] = Ft(null), [Fn, In] = Ft(!1), Ln = k({}), q = k(nt()), J = k(/* @__PURE__ */ new Set()), Rn = k(/* @__PURE__ */ new Set()), Y = O(() => N.find((e) => e.id === L), [N, L]), zn = L === "assistant" || Y !== void 0 && !Y.writeCapable && !te(L);
|
|
103
|
+
D(() => {
|
|
104
|
+
if (L !== "assistant" && Y?.writeCapable && !we(pn, L)) {
|
|
105
|
+
R("assistant");
|
|
91
106
|
return;
|
|
92
107
|
}
|
|
93
|
-
|
|
108
|
+
Cn || (!Y || Y.requiresAdmin && !G) && L !== "assistant" && R("assistant");
|
|
94
109
|
}, [
|
|
110
|
+
L,
|
|
111
|
+
Y,
|
|
112
|
+
G,
|
|
113
|
+
Cn,
|
|
95
114
|
R,
|
|
96
|
-
|
|
97
|
-
vn,
|
|
98
|
-
yn,
|
|
99
|
-
z,
|
|
100
|
-
sn
|
|
115
|
+
pn
|
|
101
116
|
]);
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
}, [
|
|
117
|
+
let Bn = E((e, t, n, r) => {
|
|
118
|
+
ln(e, n, t, null, r);
|
|
119
|
+
}, [ln]), Vn = E(async (e, t, n, r, i, a = null) => {
|
|
105
120
|
let s = (e, t) => {
|
|
106
|
-
r &&
|
|
121
|
+
r && Bn(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
|
|
107
122
|
}, c = (e) => {
|
|
108
123
|
r && w(r.assistantMessageId, e);
|
|
109
|
-
}, u = () =>
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
if (
|
|
113
|
-
|
|
124
|
+
}, u = () => {
|
|
125
|
+
c("bootAdopted"), a?.beginBoot();
|
|
126
|
+
}, ee = () => a !== null && (a.signal.aborted || T() !== t), f = () => {
|
|
127
|
+
if (ee()) throw new ht("cancelled");
|
|
128
|
+
}, p = S.getState().sandboxesByMode[e]?.sandboxId ?? null, m = !1, te = !1, ne = !1, h = !1, ie = !1, ae = async (r) => {
|
|
129
|
+
if (i && !J.current.has(r) && q.current.isFresh(r)) return m = !0, !0;
|
|
130
|
+
ne = !0;
|
|
114
131
|
let o = !1;
|
|
115
132
|
try {
|
|
116
133
|
await _(r, t, n, 3e5), await g(r, t, e, n, 9e4, () => {
|
|
117
|
-
o = !0;
|
|
134
|
+
o = !0, u();
|
|
118
135
|
});
|
|
119
136
|
} catch {
|
|
120
|
-
if (
|
|
121
|
-
return
|
|
137
|
+
if (ee()) throw new ht("cancelled");
|
|
138
|
+
return q.current.invalidate(r), J.current.add(r), a?.dead.push(r), ie = !0, !1;
|
|
122
139
|
}
|
|
123
|
-
return
|
|
140
|
+
return f(), q.current.markVerified(r), o && (h = !0), !0;
|
|
124
141
|
};
|
|
125
|
-
if (p && (
|
|
142
|
+
if (p && (V(e, p, "provisioning"), s("provisioning", "reusingEnvironment"), await ae(p) || (V(e, null, "provisioning"), p = null)), !p) {
|
|
126
143
|
s("provisioning", "lookingForEnvironment");
|
|
127
|
-
let r = await
|
|
128
|
-
|
|
144
|
+
let r = await d(t, M, e, Mt(), n, J.current);
|
|
145
|
+
f();
|
|
129
146
|
let i = r?.id ?? null;
|
|
130
|
-
|
|
147
|
+
if (i) {
|
|
148
|
+
V(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
|
|
149
|
+
let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
|
|
150
|
+
t && u(), await ae(i) ? (p = i, t && (h = !0)) : V(e, null, "provisioning");
|
|
151
|
+
}
|
|
131
152
|
}
|
|
132
153
|
if (!p) {
|
|
133
|
-
if (a && !a.mayCreate) throw new
|
|
134
|
-
if (c("provisionStarted"), e === "api-calls" && !
|
|
135
|
-
s("provisioning", "startingEnvironment"),
|
|
136
|
-
let r = a ? [] : await
|
|
154
|
+
if (a && !a.mayCreate) throw new ht("no-create");
|
|
155
|
+
if (c("provisionStarted"), e === "api-calls" && !P()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
156
|
+
s("provisioning", "startingEnvironment"), V(e, null, "provisioning");
|
|
157
|
+
let r = a ? [] : await re(t, M, e, Mt(), n, J.current);
|
|
137
158
|
if (r.length > 0) {
|
|
138
159
|
let e = new Set(r);
|
|
139
|
-
for (let e of r)
|
|
160
|
+
for (let e of r) q.current.invalidate(e), J.current.add(e);
|
|
140
161
|
let t = S.getState().sandboxesByMode;
|
|
141
|
-
for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) &&
|
|
162
|
+
for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && H(n);
|
|
142
163
|
}
|
|
143
164
|
c("createRequested");
|
|
144
165
|
let i = a?.beginCreate();
|
|
145
166
|
try {
|
|
146
|
-
p = await l(
|
|
167
|
+
p = await l(M, e, t, Mt(), Lt, n);
|
|
147
168
|
} finally {
|
|
148
169
|
i?.();
|
|
149
170
|
}
|
|
150
|
-
|
|
171
|
+
te = !0, f(), V(e, p, "provisioning"), await _(p, t, n, 3e5), f(), c("sandboxRunning"), await g(p, t, e, n, 9e4), f(), c("serviceReady"), q.current.markVerified(p);
|
|
151
172
|
}
|
|
152
|
-
return
|
|
173
|
+
return V(e, p, "running"), {
|
|
153
174
|
sandboxId: p,
|
|
154
|
-
sandboxIsNew:
|
|
155
|
-
sandboxProbed:
|
|
156
|
-
sandboxAdopted:
|
|
157
|
-
deadSandboxProbe:
|
|
158
|
-
trustedFromCache:
|
|
175
|
+
sandboxIsNew: te,
|
|
176
|
+
sandboxProbed: ne,
|
|
177
|
+
sandboxAdopted: h,
|
|
178
|
+
deadSandboxProbe: ie,
|
|
179
|
+
trustedFromCache: m
|
|
159
180
|
};
|
|
160
181
|
}, [
|
|
161
|
-
U,
|
|
162
|
-
N,
|
|
163
|
-
j,
|
|
164
182
|
H,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
let
|
|
183
|
+
P,
|
|
184
|
+
M,
|
|
185
|
+
V,
|
|
186
|
+
Bn
|
|
187
|
+
]), Hn = E(async function e(t, n, r, i, a, o = {}) {
|
|
188
|
+
let s = await vt(i, r, (e) => Bn(t, n, "provisioning", e), () => w(n, "prewarmJoined"));
|
|
189
|
+
for (let e of s.dead) q.current.invalidate(e), J.current.add(e);
|
|
190
|
+
s.verified && !J.current.has(s.verified) && q.current.markVerified(s.verified), s.joined && C(n, { prewarm: s.joined });
|
|
191
|
+
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: ee, sandboxAdopted: f, deadSandboxProbe: te, trustedFromCache: ne } = await Vn(r, i, a, {
|
|
171
192
|
conversationId: t,
|
|
172
193
|
assistantMessageId: n
|
|
173
|
-
}, o.trustCache !== !1),
|
|
174
|
-
!s.
|
|
175
|
-
let h = S.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null,
|
|
176
|
-
if (h)
|
|
177
|
-
let e =
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
194
|
+
}, o.trustCache !== !1), re = gt(i, r, c);
|
|
195
|
+
!s.waited && re && C(n, { prewarm: "hit" });
|
|
196
|
+
let h = S.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, g = !1, _ = null;
|
|
197
|
+
if (h) {
|
|
198
|
+
let e = He(c, h, (e, t) => p(e, i, t, r, a, { limit: 50 }));
|
|
199
|
+
try {
|
|
200
|
+
let t = await m(c, i, h, r, a);
|
|
201
|
+
if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
|
|
202
|
+
_ = e;
|
|
203
|
+
} catch {
|
|
204
|
+
fn(t), h = null;
|
|
205
|
+
}
|
|
181
206
|
}
|
|
182
207
|
if (!h) {
|
|
183
|
-
|
|
208
|
+
Bn(t, n, "connecting", "preparingSession");
|
|
184
209
|
let s;
|
|
185
210
|
try {
|
|
186
211
|
s = await u(c, i, r, a);
|
|
187
212
|
} catch (s) {
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
let l =
|
|
191
|
-
if (l === "check-network" && (l = await
|
|
192
|
-
u || C(n, { cacheProofFailed: !0 }), l === "replace" && (
|
|
213
|
+
if (ne) {
|
|
214
|
+
q.current.invalidate(c);
|
|
215
|
+
let l = it(s, o.isAbandoned?.() ?? !1), u = l === "check-network";
|
|
216
|
+
if (l === "check-network" && (l = await rt(() => d(i, M, r, Mt(), a, J.current))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
|
|
217
|
+
u || C(n, { cacheProofFailed: !0 }), l === "replace" && (J.current.add(c), fn(t), H(r));
|
|
193
218
|
let s = await e(t, n, r, i, a, {
|
|
194
219
|
...o,
|
|
195
220
|
trustCache: !1
|
|
196
221
|
});
|
|
197
222
|
return u && (s.deadSandboxProbe || s.sandboxId !== c) && C(n, { cacheProofFailed: !0 }), {
|
|
198
223
|
...s,
|
|
199
|
-
sandboxProbed: s.sandboxProbed ||
|
|
200
|
-
sandboxAdopted: s.sandboxAdopted ||
|
|
201
|
-
deadSandboxProbe: s.deadSandboxProbe ||
|
|
224
|
+
sandboxProbed: s.sandboxProbed || ee,
|
|
225
|
+
sandboxAdopted: s.sandboxAdopted || f,
|
|
226
|
+
deadSandboxProbe: s.deadSandboxProbe || te
|
|
202
227
|
};
|
|
203
228
|
}
|
|
204
229
|
}
|
|
205
230
|
throw s;
|
|
206
231
|
}
|
|
207
|
-
h = s.sessionId,
|
|
232
|
+
h = s.sessionId, dn(t, h), g = !0;
|
|
208
233
|
}
|
|
209
234
|
return {
|
|
210
235
|
sandboxId: c,
|
|
211
236
|
sessionId: h,
|
|
212
|
-
sessionIsNew:
|
|
237
|
+
sessionIsNew: g,
|
|
238
|
+
readAhead: _,
|
|
213
239
|
sandboxIsNew: l,
|
|
214
|
-
sandboxProbed:
|
|
215
|
-
sandboxAdopted:
|
|
216
|
-
deadSandboxProbe:
|
|
240
|
+
sandboxProbed: ee,
|
|
241
|
+
sandboxAdopted: f,
|
|
242
|
+
deadSandboxProbe: te
|
|
217
243
|
};
|
|
218
244
|
}, [
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
]),
|
|
226
|
-
let t =
|
|
245
|
+
Vn,
|
|
246
|
+
fn,
|
|
247
|
+
H,
|
|
248
|
+
M,
|
|
249
|
+
dn,
|
|
250
|
+
Bn
|
|
251
|
+
]), Un = E((e) => {
|
|
252
|
+
let t = T();
|
|
227
253
|
if (!t) return;
|
|
228
|
-
let n = S.getState(), r = Date.now(), i =
|
|
254
|
+
let n = S.getState(), r = Date.now(), i = _t({
|
|
229
255
|
autoRouting: n.autoRouting,
|
|
230
|
-
autoOffered:
|
|
256
|
+
autoOffered: An.current,
|
|
231
257
|
active: n.activeConversationId ? n.conversations.find((e) => e.id === n.activeConversationId) : void 0,
|
|
232
258
|
selectedMode: n.mode,
|
|
233
259
|
autoReadMode: Ee,
|
|
234
|
-
modes:
|
|
260
|
+
modes: wn.current,
|
|
235
261
|
acknowledgedWriteModes: n.acknowledgedWriteModes,
|
|
236
|
-
adminAccess:
|
|
262
|
+
adminAccess: K.read(),
|
|
237
263
|
dictated: e,
|
|
238
264
|
turnInFlight: Object.values(n.processingByConversationId).some((e) => Pe(e?.status)),
|
|
239
|
-
...
|
|
265
|
+
...bt(t),
|
|
240
266
|
now: r
|
|
241
267
|
});
|
|
242
268
|
if (!i) return;
|
|
243
|
-
let a =
|
|
244
|
-
accessToken:
|
|
245
|
-
workspaceToken:
|
|
269
|
+
let a = yt(t, i, r), o = {
|
|
270
|
+
accessToken: P(),
|
|
271
|
+
workspaceToken: qt(),
|
|
246
272
|
userId: F,
|
|
247
|
-
organizationId:
|
|
273
|
+
organizationId: $e()
|
|
248
274
|
};
|
|
249
|
-
|
|
275
|
+
Vn(i.mode, t, o, null, !0, a).then((e) => a.finish({
|
|
250
276
|
ok: !0,
|
|
251
277
|
sandboxId: e.sandboxId,
|
|
252
278
|
didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
|
|
279
|
+
booted: e.sandboxIsNew || e.sandboxAdopted,
|
|
253
280
|
dead: a.dead
|
|
254
281
|
}), (e) => {
|
|
255
|
-
if (!(e instanceof
|
|
282
|
+
if (!(e instanceof ht) && !a.signal.aborted && T() === t) {
|
|
256
283
|
let e = S.getState().sandboxesByMode[i.mode]?.sandboxId ?? null;
|
|
257
|
-
e && (
|
|
284
|
+
e && (q.current.invalidate(e), J.current.add(e), a.dead.push(e), H(i.mode));
|
|
258
285
|
}
|
|
259
286
|
a.finish({
|
|
260
287
|
ok: !1,
|
|
261
288
|
didWork: !1,
|
|
289
|
+
booted: !1,
|
|
262
290
|
dead: a.dead
|
|
263
291
|
});
|
|
264
292
|
});
|
|
265
293
|
}, [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
N,
|
|
294
|
+
Vn,
|
|
295
|
+
K,
|
|
296
|
+
H,
|
|
270
297
|
P,
|
|
298
|
+
qt,
|
|
271
299
|
F
|
|
272
|
-
]),
|
|
300
|
+
]), Wn = E(() => Un(!1), [Un]), [Gn, Kn] = Ft(null), qn = k(/* @__PURE__ */ new Set()), Jn = k(null), Yn = E(() => {
|
|
273
301
|
let e = S.getState(), t = e.activeConversationId;
|
|
274
302
|
if (!t) return;
|
|
275
303
|
let n = e.processingByConversationId[t], r = Pe(n?.status) ? n?.messageId ?? null : null;
|
|
276
304
|
if (!Ie({
|
|
277
305
|
interruptedTurnId: r,
|
|
278
306
|
activeTurnId: r,
|
|
279
|
-
alreadyRequested: r ?
|
|
307
|
+
alreadyRequested: r ? qn.current.has(r) : !1
|
|
280
308
|
}).send || !r) return;
|
|
281
|
-
|
|
282
|
-
let i = Ne(e), a =
|
|
309
|
+
qn.current.add(r);
|
|
310
|
+
let i = Ne(e), a = T(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
|
|
283
311
|
!i || !a || !o || s(i.sandboxId, a, o, i.mode, {
|
|
284
|
-
accessToken:
|
|
285
|
-
workspaceToken:
|
|
312
|
+
accessToken: P(),
|
|
313
|
+
workspaceToken: qt(),
|
|
286
314
|
userId: F,
|
|
287
|
-
organizationId:
|
|
315
|
+
organizationId: $e()
|
|
288
316
|
});
|
|
289
317
|
}, [
|
|
290
318
|
F,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
]),
|
|
294
|
-
let t = S.getState(), n = Ne(t), r =
|
|
319
|
+
P,
|
|
320
|
+
qt
|
|
321
|
+
]), Xn = E(async (e) => {
|
|
322
|
+
let t = S.getState(), n = Ne(t), r = T(), i = t.activeConversationId;
|
|
295
323
|
if (!(!n || !r || !i)) {
|
|
296
|
-
|
|
324
|
+
Kn(e);
|
|
297
325
|
try {
|
|
298
326
|
await c(n.sandboxId, r, e, n.mode, {
|
|
299
|
-
accessToken:
|
|
300
|
-
workspaceToken:
|
|
327
|
+
accessToken: P(),
|
|
328
|
+
workspaceToken: qt(),
|
|
301
329
|
userId: F,
|
|
302
|
-
organizationId:
|
|
330
|
+
organizationId: $e()
|
|
303
331
|
});
|
|
304
332
|
} catch (e) {
|
|
305
|
-
|
|
306
|
-
id:
|
|
333
|
+
Kn(null), B(i, {
|
|
334
|
+
id: zt(),
|
|
307
335
|
role: "system",
|
|
308
336
|
content: e instanceof Error ? e.message : "The change could not be approved.",
|
|
309
337
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
310
338
|
});
|
|
311
339
|
return;
|
|
312
340
|
}
|
|
313
|
-
|
|
341
|
+
Kn(null), ar.current(j("pendingWrite.approvedPrompt", "I approved that change — go ahead."));
|
|
314
342
|
}
|
|
315
343
|
}, [
|
|
316
344
|
F,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
]),
|
|
320
|
-
theme:
|
|
321
|
-
navigate:
|
|
322
|
-
navItems:
|
|
323
|
-
options:
|
|
345
|
+
B,
|
|
346
|
+
j
|
|
347
|
+
]), Zn = e(), { speakFinishedReply: Qn } = Ze(), $n = a(), { items: er } = Pt(), tr = k({
|
|
348
|
+
theme: Zn,
|
|
349
|
+
navigate: $n,
|
|
350
|
+
navItems: er,
|
|
351
|
+
options: Kt ?? {}
|
|
324
352
|
});
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
theme:
|
|
328
|
-
navigate:
|
|
329
|
-
navItems:
|
|
330
|
-
options:
|
|
353
|
+
D(() => {
|
|
354
|
+
tr.current = {
|
|
355
|
+
theme: Zn,
|
|
356
|
+
navigate: $n,
|
|
357
|
+
navItems: er,
|
|
358
|
+
options: Kt ?? {}
|
|
331
359
|
};
|
|
332
360
|
}, [
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
361
|
+
Zn,
|
|
362
|
+
$n,
|
|
363
|
+
er,
|
|
364
|
+
Kt
|
|
337
365
|
]);
|
|
338
|
-
let
|
|
339
|
-
let { theme: r, navigate: i } =
|
|
366
|
+
let nr = E((e, t, n) => {
|
|
367
|
+
let { theme: r, navigate: i } = tr.current, a, o;
|
|
340
368
|
if (e.kind === "theme") {
|
|
341
369
|
if (!r) return !1;
|
|
342
|
-
let t =
|
|
370
|
+
let t = wt(e.request, {
|
|
343
371
|
mode: r.mode,
|
|
344
372
|
resolvedTheme: r.resolvedTheme
|
|
345
373
|
});
|
|
346
374
|
if (!t.alreadyApplied) try {
|
|
347
375
|
r.setMode(t.mode);
|
|
348
376
|
} catch {}
|
|
349
|
-
a =
|
|
377
|
+
a = Dt(j, t, e.request.kind === "family"), o = {
|
|
350
378
|
kind: "theme",
|
|
351
379
|
mode: t.mode,
|
|
352
380
|
alreadyApplied: t.alreadyApplied
|
|
@@ -354,21 +382,21 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
354
382
|
} else {
|
|
355
383
|
if (!i) return !1;
|
|
356
384
|
if (e.kind === "navigate") {
|
|
357
|
-
let { destination: t } = e, n =
|
|
358
|
-
n || i(t.path), a =
|
|
385
|
+
let { destination: t } = e, n = xt(t, window.location.pathname + window.location.search, Ct(tr.current.navItems));
|
|
386
|
+
n || i(t.path), a = Et(j, t.label, n), o = {
|
|
359
387
|
kind: "navigate",
|
|
360
388
|
destinationId: t.id,
|
|
361
389
|
path: t.path,
|
|
362
390
|
alreadyHere: n
|
|
363
391
|
};
|
|
364
|
-
} else a =
|
|
392
|
+
} else a = Tt(j, e.candidates[0]?.label ?? e.query, e.candidates), o = {
|
|
365
393
|
kind: "choose-destination",
|
|
366
394
|
candidateIds: e.candidates.map((e) => e.id)
|
|
367
395
|
};
|
|
368
396
|
}
|
|
369
|
-
let s = S.getState(), c = s.activeConversationId ??
|
|
370
|
-
|
|
371
|
-
id:
|
|
397
|
+
let s = S.getState(), c = s.activeConversationId ?? z(void 0, s.autoRouting && An.current ? "assistant" : s.mode, s.autoRouting ? { routedBy: "auto" } : void 0), l = (/* @__PURE__ */ new Date()).toISOString();
|
|
398
|
+
B(c, {
|
|
399
|
+
id: zt(),
|
|
372
400
|
role: "user",
|
|
373
401
|
content: t,
|
|
374
402
|
timestamp: l,
|
|
@@ -377,30 +405,30 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
377
405
|
...v(n)
|
|
378
406
|
}
|
|
379
407
|
});
|
|
380
|
-
let u =
|
|
381
|
-
return
|
|
408
|
+
let u = zt();
|
|
409
|
+
return B(c, {
|
|
382
410
|
id: u,
|
|
383
411
|
role: "assistant",
|
|
384
412
|
content: a.text,
|
|
385
413
|
timestamp: l,
|
|
386
414
|
metadata: {
|
|
387
|
-
lang: a.translated ?
|
|
415
|
+
lang: a.translated ? Jt : "en",
|
|
388
416
|
localAction: o,
|
|
389
417
|
...v(n)
|
|
390
418
|
}
|
|
391
|
-
}),
|
|
419
|
+
}), Qn(c, u), !0;
|
|
392
420
|
}, [
|
|
393
|
-
V,
|
|
394
421
|
B,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
422
|
+
z,
|
|
423
|
+
Jt,
|
|
424
|
+
Qn,
|
|
425
|
+
j
|
|
426
|
+
]), X = E(async (e, t = [], n = {}) => {
|
|
427
|
+
let r = n.voiceSessionId !== void 0, i = S.getState(), a = i.activeConversationId ?? I;
|
|
400
428
|
if (a) {
|
|
401
429
|
if (Pe(i.processingByConversationId[a]?.status)) {
|
|
402
430
|
let r = i.processingByConversationId[a]?.messageId ?? null;
|
|
403
|
-
r &&
|
|
431
|
+
r && qn.current.has(r) && (Jn.current = {
|
|
404
432
|
conversationId: a,
|
|
405
433
|
content: e,
|
|
406
434
|
attachments: t,
|
|
@@ -408,14 +436,14 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
408
436
|
});
|
|
409
437
|
return;
|
|
410
438
|
}
|
|
411
|
-
if (
|
|
439
|
+
if (Rn.current.has(a)) return;
|
|
412
440
|
}
|
|
413
|
-
if (
|
|
441
|
+
if (jn.current) return;
|
|
414
442
|
if (n.fromPerson && t.length === 0) {
|
|
415
|
-
let t =
|
|
416
|
-
if (t &&
|
|
443
|
+
let t = St(e, Ct(tr.current.navItems), tr.current.options);
|
|
444
|
+
if (t && nr(t, e, n.voiceSessionId)) return;
|
|
417
445
|
}
|
|
418
|
-
let o = i.activeConversationId ? i.conversations.find((e) => e.id === i.activeConversationId) : void 0, s = i.autoRouting &&
|
|
446
|
+
let o = i.activeConversationId ? i.conversations.find((e) => e.id === i.activeConversationId) : void 0, s = i.autoRouting && An.current ? Me({
|
|
419
447
|
intent: n.autoIntent ?? ke(e),
|
|
420
448
|
dictated: r,
|
|
421
449
|
conversation: o ? {
|
|
@@ -424,32 +452,32 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
424
452
|
hasHistory: o.messages.length > 0 || !!o.backendSessionId
|
|
425
453
|
} : null
|
|
426
454
|
}) : null;
|
|
427
|
-
if (s &&
|
|
428
|
-
|
|
455
|
+
if (s && wn.current.find((e) => e.id === s.mode)?.writeCapable && !we(i.acknowledgedWriteModes, s.mode)) {
|
|
456
|
+
jn.current = {
|
|
429
457
|
content: e,
|
|
430
458
|
attachments: t,
|
|
431
459
|
options: n
|
|
432
|
-
},
|
|
460
|
+
}, Pn(s.mode);
|
|
433
461
|
return;
|
|
434
462
|
}
|
|
435
|
-
let c = s ? s.mode : i.mode, l, u,
|
|
463
|
+
let c = s ? s.mode : i.mode, l, u, d = I, m = d ? S.getState().conversations.find((e) => e.id === d) : void 0, re = s?.action === "escalate" && o ? {
|
|
436
464
|
mode: o.mode,
|
|
437
465
|
backendSessionId: o.backendSessionId ?? null
|
|
438
466
|
} : null;
|
|
439
|
-
if (s) s.action === "new" || !o ?
|
|
467
|
+
if (s) s.action === "new" || !o ? d = z(void 0, c, { routedBy: "auto" }) : (d = o.id, U(d, c));
|
|
440
468
|
else {
|
|
441
469
|
let e = i.autoRouting ? { routedBy: "auto" } : void 0;
|
|
442
|
-
|
|
470
|
+
d ? m && m.mode !== c && (m.messages.length > 0 || m.backendSessionId) ? d = z(void 0, c, e) : m && m.mode !== c && (e ? U(d, c) : rn(d, c)) : d = z(void 0, c, e);
|
|
443
471
|
}
|
|
444
|
-
if (!
|
|
445
|
-
|
|
446
|
-
let g =
|
|
447
|
-
accessToken:
|
|
448
|
-
workspaceToken:
|
|
472
|
+
if (!d) return;
|
|
473
|
+
Ln.current[d] = t;
|
|
474
|
+
let g = T(), _ = {
|
|
475
|
+
accessToken: P(),
|
|
476
|
+
workspaceToken: qt(),
|
|
449
477
|
userId: F,
|
|
450
|
-
organizationId:
|
|
478
|
+
organizationId: $e()
|
|
451
479
|
}, oe = {
|
|
452
|
-
id:
|
|
480
|
+
id: zt(),
|
|
453
481
|
role: "user",
|
|
454
482
|
content: e,
|
|
455
483
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -458,27 +486,27 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
458
486
|
...v(n.voiceSessionId)
|
|
459
487
|
}
|
|
460
488
|
};
|
|
461
|
-
|
|
462
|
-
let y =
|
|
463
|
-
|
|
489
|
+
B(d, oe);
|
|
490
|
+
let y = zt();
|
|
491
|
+
B(d, {
|
|
464
492
|
id: y,
|
|
465
493
|
role: "assistant",
|
|
466
494
|
content: "",
|
|
467
495
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
468
496
|
metadata: {
|
|
469
|
-
lang:
|
|
497
|
+
lang: en,
|
|
470
498
|
...v(n.voiceSessionId)
|
|
471
499
|
}
|
|
472
|
-
}),
|
|
500
|
+
}), qe(y, {
|
|
473
501
|
channel: r ? "voice" : "chat",
|
|
474
502
|
mode: c,
|
|
475
|
-
product:
|
|
476
|
-
language:
|
|
477
|
-
device:
|
|
503
|
+
product: M,
|
|
504
|
+
language: en,
|
|
505
|
+
device: Je(),
|
|
478
506
|
routedByAuto: !!s
|
|
479
|
-
}, n.voiceTiming), w(y, "accepted"),
|
|
480
|
-
let se = (e, t, r, i, a =
|
|
481
|
-
|
|
507
|
+
}, n.voiceTiming), w(y, "accepted"), ln(d, "provisioning", y, null);
|
|
508
|
+
let se = (e, t, r, i, a = en) => {
|
|
509
|
+
sn(d, y, { content: ie(e) }), cn(d, y, {
|
|
482
510
|
lang: a,
|
|
483
511
|
...t?.length ? { artifacts: t } : {},
|
|
484
512
|
...t?.length || r || i ? { mode: c } : {},
|
|
@@ -490,22 +518,22 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
490
518
|
w(y, "attemptStarted");
|
|
491
519
|
let i = null, a = !1;
|
|
492
520
|
try {
|
|
493
|
-
let { sandboxId: n, sessionId: o, sessionIsNew: s,
|
|
521
|
+
let { sandboxId: n, sessionId: o, sessionIsNew: s, readAhead: m, sandboxIsNew: te, sandboxProbed: re, sandboxAdopted: oe, deadSandboxProbe: v } = await Hn(d, y, c, g, _, { isAbandoned: () => Fe({
|
|
494
522
|
turnId: y,
|
|
495
|
-
abortRequested:
|
|
496
|
-
activeTurnId: S.getState().processingByConversationId[
|
|
523
|
+
abortRequested: qn.current.has(y),
|
|
524
|
+
activeTurnId: S.getState().processingByConversationId[d]?.messageId ?? null
|
|
497
525
|
}).abandon });
|
|
498
526
|
i = n, w(y, "runtimeReady"), C(y, {
|
|
499
|
-
runtime:
|
|
500
|
-
deadSandboxProbe:
|
|
527
|
+
runtime: te ? "cold" : oe ? "adopted" : re ? "probed" : s ? "new-session" : "warm",
|
|
528
|
+
deadSandboxProbe: v
|
|
501
529
|
});
|
|
502
|
-
let
|
|
503
|
-
|
|
504
|
-
let
|
|
505
|
-
content:
|
|
530
|
+
let ce = De(S.getState().conversations.find((e) => e.id === d), e, s), b = await Ve(() => p(n, g, o, c, _, { limit: 50 }), s, Be(m, n, o));
|
|
531
|
+
Bn(d, y, "streaming", "thinking");
|
|
532
|
+
let ue = Ht?.(), { prompt: de, parts: fe } = Ce({
|
|
533
|
+
content: ce ? `${ce}${e}` : e,
|
|
506
534
|
attachments: t,
|
|
507
535
|
limits: _e(l),
|
|
508
|
-
wrapPrompt: (e) =>
|
|
536
|
+
wrapPrompt: (e) => Ut?.(c, e, Qt, $t, r) ?? e,
|
|
509
537
|
requestBytes: (e, t) => ne({
|
|
510
538
|
sandboxId: n,
|
|
511
539
|
workspaceId: g,
|
|
@@ -513,93 +541,93 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
513
541
|
mode: c,
|
|
514
542
|
prompt: e,
|
|
515
543
|
parts: t,
|
|
516
|
-
pageContext:
|
|
544
|
+
pageContext: ue,
|
|
517
545
|
authContext: _
|
|
518
546
|
})
|
|
519
|
-
}),
|
|
520
|
-
a = pe(t) >
|
|
547
|
+
}), he = me(fe), ge = he > 0;
|
|
548
|
+
a = pe(t) > he;
|
|
521
549
|
try {
|
|
522
|
-
await
|
|
550
|
+
await h(n, g, o, de, c, ue, _, fe?.length ? { parts: fe } : void 0);
|
|
523
551
|
} catch (e) {
|
|
524
|
-
if (!
|
|
525
|
-
await
|
|
552
|
+
if (!fe || !et(e)) throw e;
|
|
553
|
+
await h(n, g, o, de, c, ue, _, void 0), a ||= ge;
|
|
526
554
|
}
|
|
527
555
|
w(y, "promptSent");
|
|
528
|
-
let
|
|
556
|
+
let ve = null, ye = !1, be = Re, x = ze([], b), xe = Date.now() + u.streamBudgetMs, Se = Date.now(), we = Date.now(), Te = () => Fe({
|
|
529
557
|
turnId: y,
|
|
530
|
-
abortRequested:
|
|
531
|
-
activeTurnId: S.getState().processingByConversationId[
|
|
558
|
+
abortRequested: qn.current.has(y),
|
|
559
|
+
activeTurnId: S.getState().processingByConversationId[d]?.messageId ?? null
|
|
532
560
|
});
|
|
533
|
-
for (; Date.now() <
|
|
534
|
-
let e =
|
|
561
|
+
for (; Date.now() < xe;) {
|
|
562
|
+
let e = Te();
|
|
535
563
|
if (e.abandon) {
|
|
536
|
-
e.clearProcessing &&
|
|
564
|
+
e.clearProcessing && un(d);
|
|
537
565
|
return;
|
|
538
566
|
}
|
|
539
|
-
if (x = ze(await
|
|
567
|
+
if (x = ze(await p(n, g, o, c, _, {
|
|
540
568
|
limit: 50,
|
|
541
|
-
sinceMs:
|
|
542
|
-
}),
|
|
569
|
+
sinceMs: b
|
|
570
|
+
}), b, { accumulateNarration: u.accumulatesNarration }), sn(d, y, { content: ie(x.content) }), x.hasRenderableOutput ? ye || (ye = !0, ve !== null && w(y, "lastQuietPoll", ve), w(y, "firstOutput")) : ve = Xe(), u.accumulatesNarration) x.hasText && w(y, "firstText");
|
|
543
571
|
else {
|
|
544
|
-
let e =
|
|
545
|
-
|
|
572
|
+
let e = Ue(be, x, Xe());
|
|
573
|
+
be = e.tracker, e.confirmedAt !== null && w(y, "firstText", e.confirmedAt);
|
|
546
574
|
}
|
|
547
|
-
if (x.pendingWrite &&
|
|
548
|
-
w(y, "answerDone"),
|
|
575
|
+
if (x.pendingWrite && cn(d, y, { pendingWrite: x.pendingWrite }), x.done) {
|
|
576
|
+
w(y, "answerDone"), q.current.markVerified(n);
|
|
549
577
|
break;
|
|
550
578
|
}
|
|
551
|
-
Date.now() -
|
|
579
|
+
Date.now() - Se > 3e4 && (await ee(n, g, 600, _).catch(() => void 0), Se = Date.now()), await new Promise((e) => setTimeout(e, le(Date.now() - we)));
|
|
552
580
|
}
|
|
553
|
-
let
|
|
581
|
+
let Ee = u.producesArtifacts ? await f(n, g, o, c, _).then((e) => e).catch(() => []) : void 0;
|
|
554
582
|
if (x.usedTools !== void 0 && C(y, { usedTools: x.usedTools }), x.done || (C(y, { outcome: "timedOut" }), x = {
|
|
555
583
|
...x,
|
|
556
|
-
content: ae(x.content, c,
|
|
584
|
+
content: ae(x.content, c, j, l)
|
|
557
585
|
}), a && (x = {
|
|
558
586
|
...x,
|
|
559
|
-
content: `${x.content}\n\n${
|
|
560
|
-
}), se(x.content,
|
|
561
|
-
|
|
587
|
+
content: `${x.content}\n\n${j("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._")}`
|
|
588
|
+
}), se(x.content, Ee, o, n), x.tokens) {
|
|
589
|
+
sn(d, y, { tokens: x.tokens });
|
|
562
590
|
try {
|
|
563
|
-
await
|
|
591
|
+
await Gt?.({
|
|
564
592
|
workspaceId: g,
|
|
565
593
|
sessionId: o,
|
|
566
594
|
messageId: x.messageId,
|
|
567
595
|
model: x.model,
|
|
568
596
|
tokens: x.tokens
|
|
569
|
-
}),
|
|
597
|
+
}), kt(M);
|
|
570
598
|
} catch {}
|
|
571
599
|
}
|
|
572
|
-
let
|
|
573
|
-
if (
|
|
574
|
-
|
|
600
|
+
let Oe = Te();
|
|
601
|
+
if (Oe.abandon) {
|
|
602
|
+
Oe.clearProcessing && un(d);
|
|
575
603
|
return;
|
|
576
604
|
}
|
|
577
|
-
w(y, "complete"), C(y, { outcome: "answered" }),
|
|
605
|
+
w(y, "complete"), C(y, { outcome: "answered" }), ln(d, "complete", y, null);
|
|
578
606
|
} catch (e) {
|
|
579
|
-
|
|
607
|
+
q.current.invalidate(i ?? S.getState().sandboxesByMode[c]?.sandboxId ?? null);
|
|
580
608
|
let t = Fe({
|
|
581
609
|
turnId: y,
|
|
582
|
-
abortRequested:
|
|
583
|
-
activeTurnId: S.getState().processingByConversationId[
|
|
610
|
+
abortRequested: qn.current.has(y),
|
|
611
|
+
activeTurnId: S.getState().processingByConversationId[d]?.messageId ?? null
|
|
584
612
|
});
|
|
585
613
|
if (t.abandon) {
|
|
586
|
-
t.clearProcessing &&
|
|
614
|
+
t.clearProcessing && un(d);
|
|
587
615
|
return;
|
|
588
616
|
}
|
|
589
|
-
if (n === 1 &&
|
|
617
|
+
if (n === 1 && tt(e)) {
|
|
590
618
|
let e = i ?? S.getState().sandboxesByMode[c]?.sandboxId ?? null;
|
|
591
|
-
return e && (
|
|
619
|
+
return e && (J.current.add(e), q.current.invalidate(e)), fn(d), H(c), on(d, y, ""), cn(d, y, { pendingWrite: void 0 }), Ye(y), ce(2);
|
|
592
620
|
}
|
|
593
621
|
throw e;
|
|
594
622
|
}
|
|
595
|
-
}, b =
|
|
596
|
-
|
|
623
|
+
}, b = d;
|
|
624
|
+
Rn.current.add(b);
|
|
597
625
|
try {
|
|
598
626
|
if (!g) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
|
|
599
627
|
code: "UNAUTHENTICATED",
|
|
600
628
|
authFailure: "WORKSPACE_CONTEXT_MISSING"
|
|
601
629
|
} });
|
|
602
|
-
let e = await Se(c, () =>
|
|
630
|
+
let e = await Se(c, () => wn.current.find((e) => e.id === c), K);
|
|
603
631
|
l = e.config, u = e.capabilities;
|
|
604
632
|
let t = Te(c, l, S.getState().acknowledgedWriteModes, {
|
|
605
633
|
dictated: r,
|
|
@@ -608,72 +636,72 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
608
636
|
if (t) throw new ye(t, t === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
|
|
609
637
|
w(y, "cleared"), await ce();
|
|
610
638
|
} catch (e) {
|
|
611
|
-
|
|
612
|
-
let t =
|
|
613
|
-
C(y, { outcome: t.kind === "temporary" ? "failed" : "refused" }), t.offersUpgrade &&
|
|
614
|
-
let r =
|
|
615
|
-
|
|
616
|
-
lang: r.translated ?
|
|
639
|
+
q.current.invalidate(S.getState().sandboxesByMode[c]?.sandboxId ?? null);
|
|
640
|
+
let t = be(e);
|
|
641
|
+
C(y, { outcome: t.kind === "temporary" ? "failed" : "refused" }), t.offersUpgrade && Ot(M, "sandbox");
|
|
642
|
+
let r = x(t, j);
|
|
643
|
+
ln(d, "error", y, r.headline), sn(d, y, { content: r.text }), cn(d, y, {
|
|
644
|
+
lang: r.translated ? Jt : "en",
|
|
617
645
|
...v(n.voiceSessionId)
|
|
618
646
|
});
|
|
619
647
|
} finally {
|
|
620
|
-
|
|
621
|
-
let e = S.getState(), t = Ae(
|
|
622
|
-
t && (
|
|
623
|
-
let n =
|
|
624
|
-
|
|
648
|
+
Rn.current.delete(b), C(y, { outcome: "stopped" }), w(y, "complete");
|
|
649
|
+
let e = S.getState(), t = Ae(re, c, e.conversations.find((e) => e.id === b), (t) => !!e.sandboxesByMode[t]?.sandboxId);
|
|
650
|
+
t && (U(b, t.mode), t.backendSessionId && dn(b, t.backendSessionId));
|
|
651
|
+
let n = Jn.current;
|
|
652
|
+
Jn.current = null, n && n.conversationId === b && ar.current(n.content, n.attachments, n.options);
|
|
625
653
|
}
|
|
626
654
|
}, [
|
|
627
|
-
|
|
628
|
-
V,
|
|
629
|
-
Bt,
|
|
630
|
-
on,
|
|
631
|
-
U,
|
|
632
|
-
Yt,
|
|
655
|
+
I,
|
|
633
656
|
B,
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
657
|
+
Ut,
|
|
658
|
+
fn,
|
|
659
|
+
H,
|
|
660
|
+
tn,
|
|
661
|
+
z,
|
|
662
|
+
Hn,
|
|
663
|
+
Ht,
|
|
637
664
|
P,
|
|
638
|
-
en,
|
|
639
|
-
j,
|
|
640
|
-
G,
|
|
641
|
-
Vt,
|
|
642
665
|
qt,
|
|
643
|
-
|
|
666
|
+
sn,
|
|
667
|
+
M,
|
|
668
|
+
K,
|
|
669
|
+
Gt,
|
|
670
|
+
$t,
|
|
644
671
|
Jt,
|
|
645
|
-
|
|
672
|
+
en,
|
|
673
|
+
Qt,
|
|
674
|
+
U,
|
|
675
|
+
nr,
|
|
646
676
|
dn,
|
|
647
|
-
Yn,
|
|
648
|
-
an,
|
|
649
|
-
Zt,
|
|
650
|
-
nn,
|
|
651
677
|
rn,
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
678
|
+
ln,
|
|
679
|
+
un,
|
|
680
|
+
j,
|
|
681
|
+
Bn,
|
|
682
|
+
on,
|
|
655
683
|
F
|
|
656
|
-
]),
|
|
684
|
+
]), rr = E((e, t) => {
|
|
657
685
|
X(e, [], t ? { autoIntent: t } : {});
|
|
658
|
-
}, [X]),
|
|
659
|
-
let e = [...
|
|
686
|
+
}, [X]), ir = E(() => {
|
|
687
|
+
let e = [...vn.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction), t = I ? Ln.current[I] ?? [] : [];
|
|
660
688
|
e && X(e.content, t);
|
|
661
689
|
}, [
|
|
662
|
-
|
|
690
|
+
yn,
|
|
663
691
|
X,
|
|
664
|
-
|
|
665
|
-
]),
|
|
666
|
-
|
|
667
|
-
|
|
692
|
+
I
|
|
693
|
+
]), ar = k(X);
|
|
694
|
+
D(() => {
|
|
695
|
+
ar.current = X;
|
|
668
696
|
}, [X]);
|
|
669
|
-
let
|
|
670
|
-
if (
|
|
671
|
-
for (let e =
|
|
672
|
-
let t =
|
|
673
|
-
if (t?.role !== "assistant" || !oe(t) ||
|
|
674
|
-
let n = Le(t, W,
|
|
697
|
+
let or = O(() => {
|
|
698
|
+
if (bn) return null;
|
|
699
|
+
for (let e = yn.length - 1; e >= 0; --e) {
|
|
700
|
+
let t = yn[e];
|
|
701
|
+
if (t?.role !== "assistant" || !oe(t) || qn.current.has(t.id)) continue;
|
|
702
|
+
let n = Le(t, W, j);
|
|
675
703
|
if (n.kind !== "output") return null;
|
|
676
|
-
let r =
|
|
704
|
+
let r = We(n.text).text.trim();
|
|
677
705
|
return r ? {
|
|
678
706
|
id: t.id,
|
|
679
707
|
text: r
|
|
@@ -681,228 +709,228 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
681
709
|
}
|
|
682
710
|
return null;
|
|
683
711
|
}, [
|
|
684
|
-
|
|
685
|
-
|
|
712
|
+
yn,
|
|
713
|
+
bn,
|
|
686
714
|
W,
|
|
687
|
-
|
|
688
|
-
]),
|
|
715
|
+
j
|
|
716
|
+
]), sr = O(() => or ? ue(or.text) : null, [or]), cr = vn.chat, Z = O(() => vn.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
689
717
|
id: e.id,
|
|
690
718
|
role: e.role,
|
|
691
|
-
text:
|
|
719
|
+
text: Ke(e, W, j),
|
|
692
720
|
sessionId: y(e),
|
|
693
721
|
timestamp: e.timestamp
|
|
694
722
|
})).filter((e) => e.text.length > 0), [
|
|
695
|
-
|
|
723
|
+
vn.voice,
|
|
696
724
|
W,
|
|
697
|
-
|
|
698
|
-
]),
|
|
725
|
+
j
|
|
726
|
+
]), lr = E(() => {
|
|
699
727
|
if (Z.length === 0) return;
|
|
700
728
|
let e = /* @__PURE__ */ new Date();
|
|
701
|
-
|
|
702
|
-
title:
|
|
703
|
-
savedAt:
|
|
704
|
-
session:
|
|
705
|
-
earlier:
|
|
706
|
-
you:
|
|
707
|
-
assistant:
|
|
708
|
-
}, e), b(
|
|
729
|
+
st(ce(Z, {
|
|
730
|
+
title: j("voiceSession.transcript", "Voice conversation"),
|
|
731
|
+
savedAt: j("voiceSession.savedAt", "Saved"),
|
|
732
|
+
session: j("voiceSession.sessionLabel", "Session"),
|
|
733
|
+
earlier: j("voiceSession.earlierLabel", "Earlier"),
|
|
734
|
+
you: j("voiceSession.speakerYou", "You"),
|
|
735
|
+
assistant: j("voiceSession.speakerAssistant", "Assistant")
|
|
736
|
+
}, e), b(M, e), "text/markdown");
|
|
709
737
|
}, [
|
|
710
|
-
|
|
738
|
+
M,
|
|
711
739
|
Z,
|
|
712
|
-
|
|
713
|
-
]), Q =
|
|
714
|
-
|
|
715
|
-
let $ =
|
|
716
|
-
onSubmit:
|
|
740
|
+
j
|
|
741
|
+
]), Q = At({ perFileChars: Mn }), ur = k(Q);
|
|
742
|
+
ur.current = Q;
|
|
743
|
+
let $ = Qe({
|
|
744
|
+
onSubmit: E((e, t, n) => {
|
|
717
745
|
let r = () => {
|
|
718
|
-
let r =
|
|
746
|
+
let r = ur.current, i = he(r.attachments), a = {
|
|
719
747
|
...n,
|
|
720
|
-
handedOver:
|
|
748
|
+
handedOver: Xe()
|
|
721
749
|
};
|
|
722
|
-
|
|
750
|
+
ar.current(e, i, {
|
|
723
751
|
fromPerson: !0,
|
|
724
752
|
voiceSessionId: t,
|
|
725
753
|
voiceTiming: a
|
|
726
754
|
}), r.clear();
|
|
727
755
|
};
|
|
728
|
-
if (!
|
|
756
|
+
if (!ur.current.isBusy) {
|
|
729
757
|
r();
|
|
730
758
|
return;
|
|
731
759
|
}
|
|
732
760
|
let i = Date.now(), a = window.setInterval(() => {
|
|
733
|
-
|
|
761
|
+
ur.current.isBusy && Date.now() - i < Rt || (window.clearInterval(a), r());
|
|
734
762
|
}, 200);
|
|
735
763
|
}, []),
|
|
736
|
-
latestReply:
|
|
737
|
-
language: de(
|
|
738
|
-
}),
|
|
739
|
-
|
|
740
|
-
}, [
|
|
764
|
+
latestReply: or,
|
|
765
|
+
language: de(Yt, Jt).tag
|
|
766
|
+
}), dr = $.start, fr = E(() => {
|
|
767
|
+
Un(!0), dr();
|
|
768
|
+
}, [Un, dr]), pr = O(() => (_n?.messages ?? []).reduce((e, t) => Math.max(e, t.metadata?.continuedVoiceTurns ?? 0), 0), [_n?.messages]), mr = Ge(vn.voice, W, j), hr = mr > pr, gr = E(() => {
|
|
741
769
|
let e = S.getState().activeConversationId;
|
|
742
|
-
!e || Z.length === 0 || (
|
|
743
|
-
id:
|
|
770
|
+
!e || Z.length === 0 || (B(e, {
|
|
771
|
+
id: zt(),
|
|
744
772
|
role: "system",
|
|
745
|
-
content: se(Z.slice(
|
|
746
|
-
intro:
|
|
747
|
-
nothing:
|
|
748
|
-
more: (e) =>
|
|
773
|
+
content: se(Z.slice(pr), {
|
|
774
|
+
intro: j("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
|
|
775
|
+
nothing: j("voiceSession.continuedNothing", "Continued from a voice conversation."),
|
|
776
|
+
more: (e) => j("voiceSession.continuedMore", "…and {{count}} more", { count: e })
|
|
749
777
|
}),
|
|
750
778
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
751
|
-
metadata: { continuedVoiceTurns:
|
|
752
|
-
}),
|
|
779
|
+
metadata: { continuedVoiceTurns: mr }
|
|
780
|
+
}), In(!1), $.end());
|
|
753
781
|
}, [
|
|
754
782
|
Z,
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
783
|
+
mr,
|
|
784
|
+
pr,
|
|
785
|
+
B,
|
|
786
|
+
j,
|
|
759
787
|
$
|
|
760
|
-
]),
|
|
761
|
-
|
|
762
|
-
$.active && (
|
|
788
|
+
]), _r = k(0);
|
|
789
|
+
D(() => {
|
|
790
|
+
$.active && (_r.current = mr);
|
|
763
791
|
}, [$.active]);
|
|
764
|
-
let
|
|
765
|
-
let e =
|
|
766
|
-
$.end(), e &&
|
|
767
|
-
}, [
|
|
768
|
-
|
|
769
|
-
(!
|
|
792
|
+
let vr = E(() => {
|
|
793
|
+
let e = mr > _r.current;
|
|
794
|
+
$.end(), e && In(!0);
|
|
795
|
+
}, [mr, $]);
|
|
796
|
+
D(() => {
|
|
797
|
+
(!Bt || !zn) && $.active && $.end();
|
|
770
798
|
}, [
|
|
771
|
-
|
|
772
|
-
|
|
799
|
+
Bt,
|
|
800
|
+
zn,
|
|
773
801
|
$
|
|
774
|
-
]),
|
|
775
|
-
$.active || (
|
|
776
|
-
}, [$.active]),
|
|
802
|
+
]), D(() => {
|
|
803
|
+
$.active || (ur.current.clear(), Jn.current = null);
|
|
804
|
+
}, [$.active]), D(() => {
|
|
777
805
|
let e = S.getState().consumePendingPrompt();
|
|
778
|
-
return e &&
|
|
806
|
+
return e && ar.current(e), S.subscribe((e, t) => {
|
|
779
807
|
if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
|
|
780
808
|
let e = S.getState().consumePendingPrompt();
|
|
781
|
-
e &&
|
|
809
|
+
e && ar.current(e);
|
|
782
810
|
}
|
|
783
811
|
});
|
|
784
812
|
}, []);
|
|
785
|
-
let
|
|
786
|
-
let t =
|
|
813
|
+
let yr = E((e) => {
|
|
814
|
+
let t = I ? S.getState().conversations.find((e) => e.id === I) : void 0;
|
|
787
815
|
if (t && (t.messages.length > 0 || t.backendSessionId)) {
|
|
788
816
|
if (t.mode !== e) {
|
|
789
817
|
let t = S.getState().conversations.find((t) => t.mode === e && t.messages.length === 0 && !t.backendSessionId && !S.getState().processingByConversationId[t.id]);
|
|
790
|
-
t ?
|
|
818
|
+
t ? an(t.id) : z(void 0, e);
|
|
791
819
|
}
|
|
792
|
-
} else
|
|
820
|
+
} else I && rn(I, e);
|
|
793
821
|
let n = S.getState().activeConversationId;
|
|
794
|
-
n ?
|
|
822
|
+
n ? rn(n, e) : gn(!1), R(e);
|
|
795
823
|
}, [
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
]),
|
|
824
|
+
I,
|
|
825
|
+
z,
|
|
826
|
+
an,
|
|
827
|
+
gn,
|
|
828
|
+
rn,
|
|
829
|
+
R
|
|
830
|
+
]), br = E(() => {
|
|
803
831
|
let e = S.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
|
|
804
832
|
if (!t) {
|
|
805
|
-
|
|
833
|
+
gn(!0), R(Ee);
|
|
806
834
|
return;
|
|
807
835
|
}
|
|
808
836
|
if (t.routedBy === "auto") {
|
|
809
|
-
|
|
837
|
+
gn(!0);
|
|
810
838
|
return;
|
|
811
839
|
}
|
|
812
840
|
if (t.messages.length === 0 && !t.backendSessionId) {
|
|
813
|
-
|
|
841
|
+
U(t.id, Ee);
|
|
814
842
|
return;
|
|
815
843
|
}
|
|
816
844
|
let n = e.conversations.find((t) => t.routedBy === "auto" && t.messages.length === 0 && !t.backendSessionId && !e.processingByConversationId[t.id]);
|
|
817
|
-
n ? (
|
|
845
|
+
n ? (an(n.id), U(n.id, Ee)) : z(void 0, Ee, { routedBy: "auto" });
|
|
818
846
|
}, [
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
]),
|
|
825
|
-
if (
|
|
826
|
-
|
|
847
|
+
z,
|
|
848
|
+
U,
|
|
849
|
+
an,
|
|
850
|
+
gn,
|
|
851
|
+
R
|
|
852
|
+
]), xr = E((e) => {
|
|
853
|
+
if (N.find((t) => t.id === e)?.writeCapable && !we(S.getState().acknowledgedWriteModes, e)) {
|
|
854
|
+
Pn(e);
|
|
827
855
|
return;
|
|
828
856
|
}
|
|
829
|
-
|
|
830
|
-
}, [
|
|
831
|
-
let e =
|
|
832
|
-
if (
|
|
833
|
-
let t =
|
|
834
|
-
if (
|
|
835
|
-
|
|
857
|
+
yr(e);
|
|
858
|
+
}, [yr, N]), Sr = E(() => {
|
|
859
|
+
let e = Nn;
|
|
860
|
+
if (Pn(null), !e) return;
|
|
861
|
+
let t = jn.current;
|
|
862
|
+
if (jn.current = null, t) {
|
|
863
|
+
mn(e), X(t.content, t.attachments, t.options);
|
|
836
864
|
return;
|
|
837
865
|
}
|
|
838
|
-
|
|
866
|
+
mn(e), yr(e);
|
|
839
867
|
}, [
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
868
|
+
Nn,
|
|
869
|
+
mn,
|
|
870
|
+
yr,
|
|
843
871
|
X
|
|
844
|
-
]),
|
|
845
|
-
|
|
846
|
-
let e =
|
|
847
|
-
|
|
872
|
+
]), Cr = Nn === null ? void 0 : N.find((e) => e.id === Nn) ?? { id: Nn }, wr = E(() => {
|
|
873
|
+
Pn(null);
|
|
874
|
+
let e = jn.current;
|
|
875
|
+
jn.current = null, e && X(e.content, e.attachments, {
|
|
848
876
|
...e.options,
|
|
849
877
|
autoIntent: "read"
|
|
850
878
|
});
|
|
851
879
|
}, [X]);
|
|
852
|
-
return /* @__PURE__ */
|
|
880
|
+
return /* @__PURE__ */ It("div", {
|
|
853
881
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
854
882
|
children: [
|
|
855
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ It("div", {
|
|
856
884
|
className: "contents",
|
|
857
885
|
inert: $.active || void 0,
|
|
858
886
|
children: [
|
|
859
|
-
Z.length > 0 && !$.active ? /* @__PURE__ */
|
|
887
|
+
Z.length > 0 && !$.active ? /* @__PURE__ */ A(at, {
|
|
860
888
|
count: Z.length,
|
|
861
|
-
onOpenTranscript: () =>
|
|
889
|
+
onOpenTranscript: () => In(!0)
|
|
862
890
|
}) : null,
|
|
863
|
-
|
|
864
|
-
mode:
|
|
865
|
-
onSuggestionClick:
|
|
866
|
-
explainsAuto:
|
|
867
|
-
suggestions:
|
|
868
|
-
}) : /* @__PURE__ */
|
|
891
|
+
cr.length === 0 ? /* @__PURE__ */ A(ct, {
|
|
892
|
+
mode: L,
|
|
893
|
+
onSuggestionClick: rr,
|
|
894
|
+
explainsAuto: kn,
|
|
895
|
+
suggestions: kn && L === "assistant" ? Oe(N.find((e) => e.id === "assistant")?.suggestions ?? [], N.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
|
|
896
|
+
}) : /* @__PURE__ */ A("div", {
|
|
869
897
|
className: "flex min-h-0 flex-1 flex-col",
|
|
870
|
-
children: /* @__PURE__ */
|
|
871
|
-
onApprovePendingWrite:
|
|
872
|
-
approvingWriteRef:
|
|
873
|
-
messages:
|
|
898
|
+
children: /* @__PURE__ */ A(lt, {
|
|
899
|
+
onApprovePendingWrite: Xn,
|
|
900
|
+
approvingWriteRef: Gn,
|
|
901
|
+
messages: cr,
|
|
874
902
|
processing: W ?? null,
|
|
875
|
-
streamingMessageId:
|
|
876
|
-
failedMessageId:
|
|
877
|
-
onRetry:
|
|
903
|
+
streamingMessageId: xn,
|
|
904
|
+
failedMessageId: Sn,
|
|
905
|
+
onRetry: ir
|
|
878
906
|
})
|
|
879
907
|
}),
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
onStartVoiceSession: $.available &&
|
|
908
|
+
/* @__PURE__ */ A(jt, {
|
|
909
|
+
onStartVoiceSession: $.available && zn ? fr : void 0,
|
|
882
910
|
onSend: (e, t) => void X(e, t, { fromPerson: !0 }),
|
|
883
|
-
onDraftStart:
|
|
884
|
-
disabled:
|
|
885
|
-
placeholder:
|
|
886
|
-
mode:
|
|
887
|
-
writeAccessDenied:
|
|
888
|
-
availableModes:
|
|
889
|
-
attachmentCharsPerFile:
|
|
890
|
-
onModeChange:
|
|
891
|
-
auto:
|
|
892
|
-
active:
|
|
893
|
-
onSelect:
|
|
911
|
+
onDraftStart: Wn,
|
|
912
|
+
disabled: bn,
|
|
913
|
+
placeholder: L === "api-calls" ? j("chatArea.placeholderActions", "What would you like me to do?") : j("chatArea.placeholderGeneral", "Ask me anything…"),
|
|
914
|
+
mode: L,
|
|
915
|
+
writeAccessDenied: Vt === "denied" && !!Y?.writeCapable,
|
|
916
|
+
availableModes: Dn,
|
|
917
|
+
attachmentCharsPerFile: Mn,
|
|
918
|
+
onModeChange: xr,
|
|
919
|
+
auto: On ? {
|
|
920
|
+
active: kn,
|
|
921
|
+
onSelect: br
|
|
894
922
|
} : void 0
|
|
895
923
|
})
|
|
896
924
|
]
|
|
897
925
|
}),
|
|
898
|
-
|
|
926
|
+
Fn && !$.active ? /* @__PURE__ */ A(ot, {
|
|
899
927
|
turns: Z,
|
|
900
|
-
onClose: () =>
|
|
901
|
-
onSave:
|
|
902
|
-
onContinueInChat:
|
|
928
|
+
onClose: () => In(!1),
|
|
929
|
+
onSave: lr,
|
|
930
|
+
onContinueInChat: hr ? gr : void 0,
|
|
903
931
|
closeOnEscape: !0
|
|
904
932
|
}) : null,
|
|
905
|
-
$.active && /* @__PURE__ */
|
|
933
|
+
$.active && /* @__PURE__ */ A(ut, {
|
|
906
934
|
session: $.session,
|
|
907
935
|
notice: $.notice,
|
|
908
936
|
capturing: $.capturing,
|
|
@@ -916,24 +944,24 @@ var Lt = ({ visible: Lt = !0, writeAccess: Rt = "unknown" }) => {
|
|
|
916
944
|
onRetryAttachment: Q.retry,
|
|
917
945
|
canAttachMore: Q.canAddMore,
|
|
918
946
|
preparingAttachments: Q.preparingCount,
|
|
919
|
-
onSaveTranscript:
|
|
920
|
-
onContinueInChat:
|
|
947
|
+
onSaveTranscript: lr,
|
|
948
|
+
onContinueInChat: gr,
|
|
921
949
|
onInterrupt: () => {
|
|
922
|
-
$.interrupt(),
|
|
950
|
+
$.interrupt(), Yn();
|
|
923
951
|
},
|
|
924
|
-
spoken:
|
|
952
|
+
spoken: sr,
|
|
925
953
|
onToggleMute: $.toggleMute,
|
|
926
|
-
onEnd:
|
|
954
|
+
onEnd: vr
|
|
927
955
|
}),
|
|
928
|
-
/* @__PURE__ */
|
|
929
|
-
open:
|
|
930
|
-
mode:
|
|
931
|
-
currentMode:
|
|
932
|
-
onConfirm:
|
|
933
|
-
onCancel:
|
|
956
|
+
/* @__PURE__ */ A(Nt, {
|
|
957
|
+
open: Nn !== null,
|
|
958
|
+
mode: Cr,
|
|
959
|
+
currentMode: Y ?? { id: L },
|
|
960
|
+
onConfirm: Sr,
|
|
961
|
+
onCancel: wr
|
|
934
962
|
})
|
|
935
963
|
]
|
|
936
964
|
});
|
|
937
965
|
};
|
|
938
966
|
//#endregion
|
|
939
|
-
export {
|
|
967
|
+
export { Bt as AssistantChatArea };
|