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