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