@burdenoff/fe-libs 2026.1001.3 → 2026.1001.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +1013 -971
- package/dist/shared/assistant/voice/turnVisibility.d.ts +9 -0
- package/dist/shared/assistant/voice/turnVisibility.d.ts.map +1 -1
- package/dist/shared/assistant/voice/voiceReopen.d.ts +134 -11
- package/dist/shared/assistant/voice/voiceReopen.d.ts.map +1 -1
- package/dist/shared/assistant/voice/voiceReopen.js +83 -25
- package/dist/shared-assistant.js +132 -132
- package/package.json +1 -1
|
@@ -7,292 +7,302 @@ import { useAssistantTr as i } from "../i18n.js";
|
|
|
7
7
|
import { useAssistantNavigate as a } from "./AssistantMarkdownRenderer.js";
|
|
8
8
|
import { isAssistantModeId as o } from "../modeIds.js";
|
|
9
9
|
import { AUTO_READ_MODE as s, autoSuggestions as c, classifyAssistantIntent as l, escalationToUndo as u, isAutoRoutingOffered as d, resolveAutoRoute as f } from "../autoRouting.js";
|
|
10
|
-
import { getHistoryStamp as
|
|
11
|
-
import { beginApprovalInFlight as
|
|
12
|
-
import { isWriteModeAcknowledged as
|
|
13
|
-
import { resolveActiveModeSandbox as
|
|
14
|
-
import { abortAssistantTurn as
|
|
15
|
-
import { sanitize as
|
|
16
|
-
import { AssistantSendRefusal as
|
|
17
|
-
import { assistantUsageLedger as
|
|
18
|
-
import { withIncompleteTurnNotice as
|
|
19
|
-
import { chatTurns as
|
|
20
|
-
import { buildContinuedFromVoiceNote as
|
|
21
|
-
import { pollDelayMs as
|
|
22
|
-
import { toCaptionText as
|
|
23
|
-
import { resolveAssistantLanguage as
|
|
24
|
-
import { resolveLanguagePair as
|
|
25
|
-
import { INITIAL_TRANSCRIPT_AUTO_OPEN as
|
|
26
|
-
import { countInlineImageCandidates as
|
|
27
|
-
import { WRITE_PROPOSAL_VOICE_COPY as
|
|
28
|
-
import { createAdminModeAccessGate as
|
|
29
|
-
import { buildBoundedAttachmentTurn as
|
|
30
|
-
import { isTurnInFlight as
|
|
31
|
-
import { getAssistantDisplayContent as
|
|
32
|
-
import { NO_FIRST_TEXT as
|
|
33
|
-
import { parseToolActivity as
|
|
34
|
-
import { countSpokenTurns as
|
|
35
|
-
import { beginTurn as
|
|
36
|
-
import { useAssistantSpeech as
|
|
37
|
-
import { useVoiceSession as
|
|
38
|
-
import { getOrganizationId as
|
|
39
|
-
import { isMultimodalBodyRejection as
|
|
40
|
-
import { createReadinessTracker as
|
|
41
|
-
import { writeProposalConfirmState as
|
|
42
|
-
import { writeProposalUsesDialog as
|
|
43
|
-
import { AssistantWriteConfirmDialog as
|
|
44
|
-
import { useWriteProposalConfirm as
|
|
45
|
-
import { AssistantWriteProposalSlot as
|
|
46
|
-
import { readWriteProposalRefs as
|
|
47
|
-
import { planWriteReply as
|
|
48
|
-
import { useWriteProposals as
|
|
49
|
-
import { AssistantSpokenTurnsNotice as
|
|
50
|
-
import { AssistantHistoryArchivedNotice as
|
|
51
|
-
import { VoiceTranscriptDrawer as
|
|
52
|
-
import { downloadFile as
|
|
53
|
-
import { conversationHasHistory as
|
|
54
|
-
import { useAssistantHistoryStatus as
|
|
55
|
-
import { assistantHistory as
|
|
56
|
-
import { AssistantEmptyState as
|
|
57
|
-
import { AssistantNothingToDeleteNotice as
|
|
58
|
-
import { assistantHistoryIsOn as
|
|
59
|
-
import { useConversationDeleteDialog as
|
|
60
|
-
import { resolveConversationDeleteTarget as
|
|
61
|
-
import { resumeContextFor as
|
|
62
|
-
import { useHistoryRowControlsFor as
|
|
63
|
-
import { AssistantMessageList as
|
|
64
|
-
import { AssistantVoiceSession as
|
|
65
|
-
import { useAssistantApiAccess as
|
|
66
|
-
import { useConversationTurns as
|
|
67
|
-
import { sendAssistantTurnTimings as
|
|
68
|
-
import { WarmCancelled as
|
|
69
|
-
import { isAlreadyThere as
|
|
70
|
-
import { chooseDestinationCopy as
|
|
71
|
-
import { dispatchAssistantQuotaExhausted as
|
|
72
|
-
import { useAssistantAttachments as
|
|
73
|
-
import { AssistantComposer as
|
|
74
|
-
import { isProdRuntime as
|
|
75
|
-
import { AssistantApiCallsConsentDialog as
|
|
76
|
-
import { useVisibleNavItems as
|
|
77
|
-
import { useCallback as
|
|
78
|
-
import { jsx as
|
|
10
|
+
import { getHistoryStamp as p, setHistoryBusyProbe as ee } from "../history/stampRegistry.js";
|
|
11
|
+
import { beginApprovalInFlight as m, endApprovalInFlight as te, getApprovalInFlight as h, markLiveTurn as ne, newestModelReplyId as re, resolveApprovablePendingWrite as g, resolveRetryableMessageId as _, subscribeApprovalInFlight as v } from "../liveTurns.js";
|
|
12
|
+
import { isWriteModeAcknowledged as ie, writeModeSendRefusalReason as ae } from "../writeModeConsent.js";
|
|
13
|
+
import { resolveActiveModeSandbox as y, useAssistantStore as b } from "../store.js";
|
|
14
|
+
import { abortAssistantTurn as oe, approvePendingWrite as se, createAssistantSandbox as x, createAssistantSession as ce, extendAssistantSandboxTTL as le, findExistingSandboxWithStatus as ue, getAssistantArtifacts as de, getAssistantMessages as fe, getAssistantSession as pe, modeRequiresConfirmWrites as me, promptGatewayRequestBytes as he, releaseSupersededAssistantSandboxes as S, sendAssistantPromptAsync as ge, waitForAssistantServiceReady as C, waitForSandboxRunning as _e, writeApprovalModeOf as ve } from "../api.js";
|
|
15
|
+
import { sanitize as ye } from "../progress.js";
|
|
16
|
+
import { AssistantSendRefusal as be, classifyTurnFailure as xe, turnConfirmsNoAction as Se, turnOutcomeCopy as Ce } from "../turnOutcome.js";
|
|
17
|
+
import { assistantUsageLedger as we, hasPendingUsageReports as w, reportUsageWithRetry as Te, retryPendingUsageReports as Ee, usageSendRefusal as De } from "../usageReporting.js";
|
|
18
|
+
import { withIncompleteTurnNotice as Oe } from "../streamBudget.js";
|
|
19
|
+
import { chatTurns as T, isVoiceTurn as ke, voiceMarker as E, voiceSessionIdOf as Ae } from "../voice/turnVisibility.js";
|
|
20
|
+
import { buildContinuedFromVoiceNote as je, buildVoiceTranscriptMarkdown as Me, voiceTranscriptFilename as D } from "../voice/voiceTranscript.js";
|
|
21
|
+
import { pollDelayMs as Ne } from "../voice/assistantPollSchedule.js";
|
|
22
|
+
import { toCaptionText as Pe } from "../voice/captionText.js";
|
|
23
|
+
import { resolveAssistantLanguage as Fe } from "../voice/languages.js";
|
|
24
|
+
import { resolveLanguagePair as Ie } from "../voice/languagePair.js";
|
|
25
|
+
import { INITIAL_TRANSCRIPT_AUTO_OPEN as Le, isAwaitingOwnConversation as Re, maySendSpokenTurn as ze, planTranscriptAutoOpen as Be, planVoiceSessionBinding as Ve, planVoiceSessionStart as He, planVoiceSpokenEntry as Ue, voiceBindingAtStart as We, voiceBindingConversationId as Ge } from "../voice/voiceReopen.js";
|
|
26
|
+
import { countInlineImageCandidates as Ke, countInlinedImageParts as qe, getSendableAttachments as Je, largestInlineCharsPerFile as Ye, resolveAssistantInlineLimits as Xe, toMessageAttachment as Ze } from "../attachments.js";
|
|
27
|
+
import { WRITE_PROPOSAL_VOICE_COPY as Qe, isVoiceProposalBound as $e, voiceProposalChip as et, voiceProposalChipText as tt, voiceReadbacksDue as nt, voiceWaitingProposals as rt, writeProposalVoiceLine as it, writeProposalVoiceReadback as at } from "../writeProposalVoice.js";
|
|
28
|
+
import { createAdminModeAccessGate as ot, resolveAssistantSendModeAfterAccess as st } from "../adminModeSendGate.js";
|
|
29
|
+
import { buildBoundedAttachmentTurn as ct } from "../attachmentTurn.js";
|
|
30
|
+
import { isTurnInFlight as lt, planAbandonedTurn as ut, planTurnAbort as dt } from "../turnState.js";
|
|
31
|
+
import { getAssistantDisplayContent as ft } from "../displayContent.js";
|
|
32
|
+
import { NO_FIRST_TEXT as pt, buildAssistantProgress as mt, readAheadFor as ht, snapshotReplyFloor as gt, startSessionReadAhead as _t, trackFirstText as vt } from "../turnProgress.js";
|
|
33
|
+
import { parseToolActivity as yt } from "./AssistantToolActivity.js";
|
|
34
|
+
import { countSpokenTurns as bt, spokenMessagesSinceContinueNote as xt, spokenTurnText as St } from "../spokenTurns.js";
|
|
35
|
+
import { beginTurn as Ct, describeTurn as O, detectTurnDevice as wt, markTurn as k, restartAttempt as Tt, turnClockMs as Et } from "../turnTimeline.js";
|
|
36
|
+
import { useAssistantSpeech as Dt } from "./AssistantSpeechProvider.js";
|
|
37
|
+
import { useVoiceSession as Ot } from "./useVoiceSession.js";
|
|
38
|
+
import { getOrganizationId as kt, getWorkspaceId as A } from "../context.js";
|
|
39
|
+
import { isMultimodalBodyRejection as At, isRecoverableAssistantError as jt } from "../transportErrors.js";
|
|
40
|
+
import { createReadinessTracker as Mt, planAfterTransportFailure as Nt, planTrustedSandboxFailure as Pt } from "../sandboxReadiness.js";
|
|
41
|
+
import { writeProposalConfirmState as Ft } from "./writeProposalPresentation.js";
|
|
42
|
+
import { writeProposalUsesDialog as It } from "./AssistantWriteProposalCard.js";
|
|
43
|
+
import { AssistantWriteConfirmDialog as Lt } from "./AssistantWriteConfirmDialog.js";
|
|
44
|
+
import { useWriteProposalConfirm as Rt } from "./useWriteProposalConfirm.js";
|
|
45
|
+
import { AssistantWriteProposalSlot as zt } from "./AssistantWriteProposalSlot.js";
|
|
46
|
+
import { readWriteProposalRefs as Bt, writeProposalsEnabledFor as Vt } from "../writeProposalDiscovery.js";
|
|
47
|
+
import { planWriteReply as Ht, promptWriteApproval as Ut } from "../writeReplySend.js";
|
|
48
|
+
import { useWriteProposals as Wt } from "./useWriteProposals.js";
|
|
49
|
+
import { AssistantSpokenTurnsNotice as Gt } from "./AssistantSpokenTurnsNotice.js";
|
|
50
|
+
import { AssistantHistoryArchivedNotice as Kt, AssistantHistoryDeletedNotice as qt, AssistantHistoryLoadState as Jt, AssistantHistoryReadOnlyBanner as Yt, AssistantHistoryShowEarlier as Xt } from "./AssistantHistoryNotices.js";
|
|
51
|
+
import { VoiceTranscriptDrawer as Zt } from "./voice/VoiceTranscriptDrawer.js";
|
|
52
|
+
import { downloadFile as Qt } from "../exportConversation.js";
|
|
53
|
+
import { conversationHasHistory as $t, isOtherScopeHistoryConversation as en, isReadOnlyHistoryConversation as tn, isReusableHistoryDraft as nn } from "../history/historyList.js";
|
|
54
|
+
import { useAssistantHistoryStatus as rn } from "../history/historyStatus.js";
|
|
55
|
+
import { assistantHistory as an } from "../history/historyEngine.js";
|
|
56
|
+
import { AssistantEmptyState as on } from "./AssistantEmptyState.js";
|
|
57
|
+
import { AssistantNothingToDeleteNotice as sn } from "./AssistantDeleteConversationDialog.js";
|
|
58
|
+
import { assistantHistoryIsOn as cn } from "./conversationDelete.js";
|
|
59
|
+
import { useConversationDeleteDialog as ln } from "./conversationDeleteDialog.js";
|
|
60
|
+
import { resolveConversationDeleteTarget as un } from "../conversationDeleteCommand.js";
|
|
61
|
+
import { resumeContextFor as dn } from "../history/historyResume.js";
|
|
62
|
+
import { useHistoryRowControlsFor as fn } from "../history/useHistoryRowControls.js";
|
|
63
|
+
import { AssistantMessageList as pn } from "./AssistantMessageList.js";
|
|
64
|
+
import { AssistantVoiceSession as mn } from "./voice/AssistantVoiceSession.js";
|
|
65
|
+
import { useAssistantApiAccess as hn } from "../useAssistantApiAccess.js";
|
|
66
|
+
import { useConversationTurns as gn } from "../useConversationTurns.js";
|
|
67
|
+
import { sendAssistantTurnTimings as _n, startTurnTimingReporting as vn } from "../turnTimingReporter.js";
|
|
68
|
+
import { WarmCancelled as yn, consumeWarm as bn, prewarmTarget as xn, settleWarmBeforeSend as Sn, startWarm as Cn, warmState as wn } from "../prewarm.js";
|
|
69
|
+
import { isAlreadyThere as Tn, matchLocalUiCommand as En, navDestinations as Dn, planThemeChange as On } from "../localUiCommands.js";
|
|
70
|
+
import { chooseDestinationCopy as kn, navigationCommandCopy as An, themeCommandCopy as jn } from "../localUiCommandCopy.js";
|
|
71
|
+
import { dispatchAssistantQuotaExhausted as Mn, notifyAiCreditsUpdated as Nn } from "../aiCredits.js";
|
|
72
|
+
import { useAssistantAttachments as Pn } from "../useAssistantAttachments.js";
|
|
73
|
+
import { AssistantComposer as Fn } from "./composer/AssistantComposer.js";
|
|
74
|
+
import { isProdRuntime as In } from "../env.js";
|
|
75
|
+
import { AssistantApiCallsConsentDialog as Ln } from "./AssistantApiCallsConsentDialog.js";
|
|
76
|
+
import { useVisibleNavItems as Rn } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
|
|
77
|
+
import { useCallback as j, useEffect as M, useMemo as zn, useRef as N, useState as Bn, useSyncExternalStore as Vn } from "react";
|
|
78
|
+
import { jsx as P, jsxs as Hn } from "react/jsx-runtime";
|
|
79
79
|
//#region src/shared/assistant/ui/AssistantChatArea.tsx
|
|
80
|
-
var
|
|
81
|
-
function
|
|
80
|
+
var Un = 600, Wn = 2e4, Gn = 1e4, Kn = 6e3;
|
|
81
|
+
function qn() {
|
|
82
82
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
83
83
|
}
|
|
84
|
-
var
|
|
85
|
-
let
|
|
86
|
-
let n =
|
|
87
|
-
return
|
|
84
|
+
var Jn = ({ visible: Jn = !0, writeAccess: Yn = "unknown" }) => {
|
|
85
|
+
let F = i(), { product: I, modes: L, gatherPageContext: Xn, buildPrompt: Zn, reportTurnTimings: Qn, reportTokenUsage: $n, localUiCommands: er } = r(), R = ve(r().writeApproval), tr = j((e, t) => {
|
|
86
|
+
let n = b.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
|
|
87
|
+
return $e({
|
|
88
88
|
mode: e,
|
|
89
|
-
productWriteApproval:
|
|
89
|
+
productWriteApproval: R,
|
|
90
90
|
capabilities: r ? n.sandboxWriteCapabilities[r] : null
|
|
91
91
|
});
|
|
92
|
-
}, [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
]),
|
|
97
|
-
tr:
|
|
98
|
-
productWriteApproval:
|
|
99
|
-
}),
|
|
100
|
-
approve: (e, t) =>
|
|
101
|
-
decline: (e, t, n) =>
|
|
102
|
-
presented: (e, t) =>
|
|
103
|
-
}),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
let e =
|
|
107
|
-
|
|
92
|
+
}, [R]), { getAccessToken: z, getWorkspaceToken: nr, userId: B } = n(), { locale: V } = t(), rr = b((e) => e.assistantLanguage), ir = b((e) => e.replyLanguage), ar = zn(() => Ie(rr, ir, V), [
|
|
93
|
+
rr,
|
|
94
|
+
ir,
|
|
95
|
+
V
|
|
96
|
+
]), or = ar.reply.english, sr = ar.replyIsExplicit, cr = ar.reply.code, { conversations: lr, activeConversationId: H, mode: U, processingByConversationId: ur, setMode: dr, setConversationMode: fr, setActiveConversation: pr, createConversation: W, addMessage: G, updateMessage: mr, patchMessage: hr, mergeMessageMetadata: gr, setConversationProcessing: _r, clearConversationProcessing: vr, setBackendSessionId: yr, clearBackendSessionId: br, setSandbox: xr, clearSandbox: Sr, acknowledgedWriteModes: Cr, acknowledgeWriteMode: wr, autoRouting: Tr, setAutoRouting: Er, routeConversation: Dr } = b(), Or = lr.find((e) => e.id === H), kr = gn(Or), Ar = kr.all, K = H ? ur[H] : void 0, jr = lt(K?.status), Mr = jr ? K?.messageId ?? null : null, Nr = K?.status === "error" ? K.messageId : null, Pr = b((e) => e.sandboxWriteCapabilities), { panel: q, entries: Fr, retiredSandboxes: Ir } = Wt({
|
|
97
|
+
tr: F,
|
|
98
|
+
productWriteApproval: R
|
|
99
|
+
}), Lr = Rt({
|
|
100
|
+
approve: (e, t) => q.approve(e, t),
|
|
101
|
+
decline: (e, t, n) => q.decline(e, t, n),
|
|
102
|
+
presented: (e, t) => q.presented(e, t)
|
|
103
|
+
}), Rr = Lr.dismiss, zr = N(null);
|
|
104
|
+
M(() => {
|
|
105
|
+
Rr();
|
|
106
|
+
let e = zr.current;
|
|
107
|
+
zr.current = H, e && e !== H && q.withdraw(e, "conversation_closed"), H && q.openConversation(H);
|
|
108
108
|
}, [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
H,
|
|
110
|
+
q,
|
|
111
|
+
Rr
|
|
112
112
|
]);
|
|
113
|
-
let
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
let e = window.setTimeout(() =>
|
|
113
|
+
let Br = tn(Or), Vr = fn(Or)?.archivedAt != null, Hr = rn((e) => H !== null && H in e.loadingIds), Ur = rn((e) => H !== null && H in e.loadErrorIds), Wr = rn((e) => e.remoteDelete), [Gr, Kr] = Bn(() => rn.getState().remoteDelete?.at ?? null), qr = Wr?.wasActive === !0 && Wr.at !== Gr ? Wr.at : null;
|
|
114
|
+
M(() => {
|
|
115
|
+
if (qr === null) return;
|
|
116
|
+
let e = window.setTimeout(() => Kr(qr), Gn);
|
|
117
117
|
return () => window.clearTimeout(e);
|
|
118
|
-
}, [
|
|
119
|
-
let { canUseApiCalls:
|
|
120
|
-
loading:
|
|
121
|
-
canUseAdminModes:
|
|
122
|
-
})).current,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}, [
|
|
126
|
-
let
|
|
127
|
-
let e =
|
|
128
|
-
e &&
|
|
129
|
-
},
|
|
130
|
-
let e =
|
|
131
|
-
e &&
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}, [
|
|
136
|
-
let
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
workspaceId:
|
|
118
|
+
}, [qr]);
|
|
119
|
+
let { canUseApiCalls: Jr, loading: Yr } = hn(A(), B), Xr = N(ot({
|
|
120
|
+
loading: Yr,
|
|
121
|
+
canUseAdminModes: Jr
|
|
122
|
+
})).current, Zr = N(L);
|
|
123
|
+
M(() => {
|
|
124
|
+
Zr.current = L;
|
|
125
|
+
}, [L]);
|
|
126
|
+
let Qr = () => {
|
|
127
|
+
let e = b.getState().activeConversationId;
|
|
128
|
+
e && an.openConversation(e, { modes: Zr.current });
|
|
129
|
+
}, $r = () => {
|
|
130
|
+
let e = b.getState().activeConversationId;
|
|
131
|
+
e && an.loadEarlier(e);
|
|
132
|
+
}, ei = N(z);
|
|
133
|
+
M(() => {
|
|
134
|
+
ei.current = z;
|
|
135
|
+
}, [z]);
|
|
136
|
+
let ti = !!I && Qn !== !1;
|
|
137
|
+
M(() => {
|
|
138
|
+
if (ti) return vn({ send: (e) => _n(e, {
|
|
139
|
+
workspaceId: A(),
|
|
140
140
|
authContext: {
|
|
141
|
-
accessToken:
|
|
142
|
-
organizationId:
|
|
141
|
+
accessToken: ei.current(),
|
|
142
|
+
organizationId: kt()
|
|
143
143
|
}
|
|
144
144
|
}) });
|
|
145
|
-
}, [
|
|
146
|
-
|
|
147
|
-
loading:
|
|
148
|
-
canUseAdminModes:
|
|
145
|
+
}, [ti]), M(() => {
|
|
146
|
+
Xr.update({
|
|
147
|
+
loading: Yr,
|
|
148
|
+
canUseAdminModes: Jr
|
|
149
149
|
});
|
|
150
150
|
}, [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
]),
|
|
155
|
-
|
|
156
|
-
}, [
|
|
157
|
-
let
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}, [
|
|
161
|
-
let
|
|
162
|
-
|
|
151
|
+
Xr,
|
|
152
|
+
Yr,
|
|
153
|
+
Jr
|
|
154
|
+
]), M(() => () => {
|
|
155
|
+
Xr.abandon();
|
|
156
|
+
}, [Xr]);
|
|
157
|
+
let ni = zn(() => L.filter((e) => !e.requiresAdmin || Jr), [L, Jr]), ri = d(ni), ii = Tr && ri, ai = N(ri);
|
|
158
|
+
M(() => {
|
|
159
|
+
ai.current = ri;
|
|
160
|
+
}, [ri]);
|
|
161
|
+
let oi = N(null), si = N(!1), ci = Ye(L), [li, ui] = Bn(null), [di, fi] = Bn(null), pi = di !== null && di === H, mi = j((e) => {
|
|
162
|
+
fi(e ? b.getState().activeConversationId : null);
|
|
163
163
|
}, []);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}, [
|
|
167
|
-
let
|
|
168
|
-
|
|
164
|
+
M(() => {
|
|
165
|
+
fi((e) => e !== null && e !== H ? null : e);
|
|
166
|
+
}, [H]);
|
|
167
|
+
let hi = N(void 0), [gi, _i] = Bn(!1), vi = j((e) => {
|
|
168
|
+
hi.current = e, _i(Re(e));
|
|
169
|
+
}, []), yi = j(() => {
|
|
170
|
+
let e = b.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
|
|
171
|
+
return !t || !n ? null : {
|
|
172
|
+
id: t,
|
|
173
|
+
reusableDraft: nn(n, p()),
|
|
174
|
+
liveProposals: q.liveFor(t).count,
|
|
175
|
+
turnInFlight: lt(e.processingByConversationId[t]?.status)
|
|
176
|
+
};
|
|
177
|
+
}, [q]), bi = N({}), J = N(Mt()), Y = N(/* @__PURE__ */ new Set()), xi = N(/* @__PURE__ */ new Set()), Si = zn(() => L.find((e) => e.id === U), [L, U]), Ci = b((e) => {
|
|
178
|
+
let t = e.sandboxesByMode[U]?.sandboxId;
|
|
169
179
|
return t ? e.sandboxWriteCapabilities[t] : void 0;
|
|
170
|
-
}),
|
|
171
|
-
mode:
|
|
172
|
-
productWriteApproval:
|
|
173
|
-
capabilities:
|
|
174
|
-
}),
|
|
175
|
-
|
|
176
|
-
if (
|
|
177
|
-
|
|
180
|
+
}), wi = Si !== void 0 && $e({
|
|
181
|
+
mode: U,
|
|
182
|
+
productWriteApproval: R,
|
|
183
|
+
capabilities: Ci
|
|
184
|
+
}), Ti = U === "assistant" || Si !== void 0 && !Si.writeCapable && !me(U) || wi;
|
|
185
|
+
M(() => {
|
|
186
|
+
if (U !== "assistant" && Si?.writeCapable && !ie(Cr, U)) {
|
|
187
|
+
dr("assistant");
|
|
178
188
|
return;
|
|
179
189
|
}
|
|
180
|
-
|
|
190
|
+
Yr || (!Si || Si.requiresAdmin && !Jr) && U !== "assistant" && dr("assistant");
|
|
181
191
|
}, [
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
U,
|
|
193
|
+
Si,
|
|
194
|
+
Jr,
|
|
195
|
+
Yr,
|
|
196
|
+
dr,
|
|
197
|
+
Cr
|
|
188
198
|
]);
|
|
189
|
-
let
|
|
190
|
-
|
|
191
|
-
}, [
|
|
199
|
+
let Ei = j((e, t, n, r) => {
|
|
200
|
+
_r(e, n, t, null, r);
|
|
201
|
+
}, [_r]), Di = j(async (e, t, n, r, i, a = null) => {
|
|
192
202
|
let s = (e, t) => {
|
|
193
|
-
r &&
|
|
203
|
+
r && Ei(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
|
|
194
204
|
}, c = (e) => {
|
|
195
|
-
r &&
|
|
205
|
+
r && k(r.assistantMessageId, e);
|
|
196
206
|
}, l = () => {
|
|
197
207
|
c("bootAdopted"), a?.beginBoot();
|
|
198
|
-
}, u = () => a !== null && (a.signal.aborted ||
|
|
199
|
-
if (u()) throw new
|
|
200
|
-
}, f =
|
|
201
|
-
if (i && !
|
|
202
|
-
|
|
208
|
+
}, u = () => a !== null && (a.signal.aborted || A() !== t), d = () => {
|
|
209
|
+
if (u()) throw new yn("cancelled");
|
|
210
|
+
}, f = b.getState().sandboxesByMode[e]?.sandboxId ?? null, p = !1, ee = !1, m = !1, te = !1, h = !1, ne = async (r) => {
|
|
211
|
+
if (i && !Y.current.has(r) && J.current.isFresh(r)) return p = !0, !0;
|
|
212
|
+
m = !0;
|
|
203
213
|
let o = !1;
|
|
204
214
|
try {
|
|
205
|
-
await
|
|
215
|
+
await _e(r, t, n, 3e5), await C(r, t, e, n, 9e4, () => {
|
|
206
216
|
o = !0, l();
|
|
207
217
|
});
|
|
208
218
|
} catch {
|
|
209
|
-
if (u()) throw new
|
|
210
|
-
return
|
|
219
|
+
if (u()) throw new yn("cancelled");
|
|
220
|
+
return J.current.invalidate(r), Y.current.add(r), a?.dead.push(r), h = !0, !1;
|
|
211
221
|
}
|
|
212
|
-
return d(),
|
|
222
|
+
return d(), J.current.markVerified(r), o && (te = !0), !0;
|
|
213
223
|
};
|
|
214
|
-
if (f && (
|
|
224
|
+
if (f && (xr(e, f, "provisioning"), s("provisioning", "reusingEnvironment"), await ne(f) || (xr(e, null, "provisioning"), f = null)), !f) {
|
|
215
225
|
s("provisioning", "lookingForEnvironment");
|
|
216
|
-
let r = await
|
|
226
|
+
let r = await ue(t, I, e, In(), n, Y.current, R);
|
|
217
227
|
d();
|
|
218
228
|
let i = r?.id ?? null;
|
|
219
229
|
if (i) {
|
|
220
|
-
|
|
230
|
+
xr(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
|
|
221
231
|
let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
|
|
222
|
-
t && l(), await ne(i) ? (f = i, t && (
|
|
232
|
+
t && l(), await ne(i) ? (f = i, t && (te = !0)) : xr(e, null, "provisioning");
|
|
223
233
|
}
|
|
224
234
|
}
|
|
225
235
|
if (!f) {
|
|
226
|
-
if (a && !a.mayCreate) throw new
|
|
227
|
-
if (c("provisionStarted"), e === "api-calls" && !
|
|
228
|
-
s("provisioning", "startingEnvironment"),
|
|
229
|
-
let r = a ? [] : await
|
|
236
|
+
if (a && !a.mayCreate) throw new yn("no-create");
|
|
237
|
+
if (c("provisionStarted"), e === "api-calls" && !z()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
238
|
+
s("provisioning", "startingEnvironment"), xr(e, null, "provisioning");
|
|
239
|
+
let r = a ? [] : await S(t, I, e, In(), n, Y.current, R);
|
|
230
240
|
if (r.length > 0) {
|
|
231
241
|
let e = new Set(r);
|
|
232
|
-
for (let e of r)
|
|
233
|
-
let t =
|
|
234
|
-
for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) &&
|
|
242
|
+
for (let e of r) J.current.invalidate(e), Y.current.add(e);
|
|
243
|
+
let t = b.getState().sandboxesByMode;
|
|
244
|
+
for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && Sr(n);
|
|
235
245
|
}
|
|
236
246
|
c("createRequested");
|
|
237
247
|
let i = a?.beginCreate();
|
|
238
248
|
try {
|
|
239
|
-
f = await
|
|
249
|
+
f = await x(I, e, t, In(), Un, n, { writeApproval: R });
|
|
240
250
|
} finally {
|
|
241
251
|
i?.();
|
|
242
252
|
}
|
|
243
|
-
|
|
253
|
+
ee = !0, d(), xr(e, f, "provisioning"), await _e(f, t, n, 3e5), d(), c("sandboxRunning"), await C(f, t, e, n, 9e4), d(), c("serviceReady"), J.current.markVerified(f);
|
|
244
254
|
}
|
|
245
|
-
return
|
|
255
|
+
return xr(e, f, "running"), {
|
|
246
256
|
sandboxId: f,
|
|
247
|
-
sandboxIsNew:
|
|
248
|
-
sandboxProbed:
|
|
249
|
-
sandboxAdopted:
|
|
257
|
+
sandboxIsNew: ee,
|
|
258
|
+
sandboxProbed: m,
|
|
259
|
+
sandboxAdopted: te,
|
|
250
260
|
deadSandboxProbe: h,
|
|
251
|
-
trustedFromCache:
|
|
261
|
+
trustedFromCache: p
|
|
252
262
|
};
|
|
253
263
|
}, [
|
|
254
|
-
|
|
264
|
+
Sr,
|
|
265
|
+
z,
|
|
266
|
+
I,
|
|
255
267
|
R,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
s.verified && !X.current.has(s.verified) && Y.current.markVerified(s.verified), s.joined && E(n, { prewarm: s.joined });
|
|
264
|
-
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: ee } = await _i(r, i, a, {
|
|
268
|
+
xr,
|
|
269
|
+
Ei
|
|
270
|
+
]), Oi = j(async function e(t, n, r, i, a, o = {}) {
|
|
271
|
+
let s = await Sn(i, r, (e) => Ei(t, n, "provisioning", e), () => k(n, "prewarmJoined"));
|
|
272
|
+
for (let e of s.dead) J.current.invalidate(e), Y.current.add(e);
|
|
273
|
+
s.verified && !Y.current.has(s.verified) && J.current.markVerified(s.verified), s.joined && O(n, { prewarm: s.joined });
|
|
274
|
+
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await Di(r, i, a, {
|
|
265
275
|
conversationId: t,
|
|
266
276
|
assistantMessageId: n
|
|
267
|
-
}, o.trustCache !== !1),
|
|
268
|
-
!s.waited &&
|
|
269
|
-
let
|
|
270
|
-
if (
|
|
271
|
-
let e =
|
|
277
|
+
}, o.trustCache !== !1), ee = bn(i, r, c);
|
|
278
|
+
!s.waited && ee && O(n, { prewarm: "hit" });
|
|
279
|
+
let m = b.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, te = !1, h = null;
|
|
280
|
+
if (m) {
|
|
281
|
+
let e = _t(c, m, (e, t) => fe(e, i, t, r, a, { limit: 50 }));
|
|
272
282
|
try {
|
|
273
|
-
let t = await pe(c, i,
|
|
283
|
+
let t = await pe(c, i, m, r, a);
|
|
274
284
|
if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
|
|
275
285
|
h = e;
|
|
276
286
|
} catch {
|
|
277
|
-
|
|
287
|
+
br(t), m = null;
|
|
278
288
|
}
|
|
279
289
|
}
|
|
280
|
-
if (!
|
|
281
|
-
|
|
290
|
+
if (!m) {
|
|
291
|
+
Ei(t, n, "connecting", "preparingSession");
|
|
282
292
|
let s;
|
|
283
293
|
try {
|
|
284
|
-
s = await
|
|
294
|
+
s = await ce(c, i, r, a);
|
|
285
295
|
} catch (s) {
|
|
286
|
-
if (
|
|
287
|
-
|
|
288
|
-
let l =
|
|
289
|
-
if (l === "check-network" && (l = await
|
|
290
|
-
|
|
296
|
+
if (p) {
|
|
297
|
+
J.current.invalidate(c);
|
|
298
|
+
let l = Pt(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
|
|
299
|
+
if (l === "check-network" && (l = await Nt(() => ue(i, I, r, In(), a, Y.current, R))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
|
|
300
|
+
p || O(n, { cacheProofFailed: !0 }), l === "replace" && (Y.current.add(c), br(t), Sr(r), q.retireSandbox(c));
|
|
291
301
|
let s = await e(t, n, r, i, a, {
|
|
292
302
|
...o,
|
|
293
303
|
trustCache: !1
|
|
294
304
|
});
|
|
295
|
-
return
|
|
305
|
+
return p && (s.deadSandboxProbe || s.sandboxId !== c) && O(n, { cacheProofFailed: !0 }), {
|
|
296
306
|
...s,
|
|
297
307
|
sandboxProbed: s.sandboxProbed || u,
|
|
298
308
|
sandboxAdopted: s.sandboxAdopted || d,
|
|
@@ -302,12 +312,12 @@ var Wn = ({ visible: Wn = !0, writeAccess: Gn = "unknown" }) => {
|
|
|
302
312
|
}
|
|
303
313
|
throw s;
|
|
304
314
|
}
|
|
305
|
-
|
|
315
|
+
m = s.sessionId, yr(t, m), te = !0;
|
|
306
316
|
}
|
|
307
317
|
return {
|
|
308
318
|
sandboxId: c,
|
|
309
|
-
sessionId:
|
|
310
|
-
sessionIsNew:
|
|
319
|
+
sessionId: m,
|
|
320
|
+
sessionIsNew: te,
|
|
311
321
|
readAhead: h,
|
|
312
322
|
sandboxIsNew: l,
|
|
313
323
|
sandboxProbed: u,
|
|
@@ -315,673 +325,691 @@ var Wn = ({ visible: Wn = !0, writeAccess: Gn = "unknown" }) => {
|
|
|
315
325
|
deadSandboxProbe: f
|
|
316
326
|
};
|
|
317
327
|
}, [
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
]),
|
|
327
|
-
let
|
|
328
|
-
if (!
|
|
329
|
-
let
|
|
330
|
-
autoRouting:
|
|
331
|
-
autoOffered:
|
|
332
|
-
active:
|
|
333
|
-
selectedMode:
|
|
328
|
+
Di,
|
|
329
|
+
br,
|
|
330
|
+
Sr,
|
|
331
|
+
I,
|
|
332
|
+
R,
|
|
333
|
+
yr,
|
|
334
|
+
Ei,
|
|
335
|
+
q
|
|
336
|
+
]), ki = j((e, t = !1) => {
|
|
337
|
+
let n = A();
|
|
338
|
+
if (!n) return;
|
|
339
|
+
let r = b.getState(), i = Date.now(), a = xn({
|
|
340
|
+
autoRouting: r.autoRouting,
|
|
341
|
+
autoOffered: ai.current,
|
|
342
|
+
active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
|
|
343
|
+
selectedMode: r.mode,
|
|
334
344
|
autoReadMode: s,
|
|
335
|
-
modes:
|
|
336
|
-
acknowledgedWriteModes:
|
|
337
|
-
adminAccess:
|
|
345
|
+
modes: Zr.current,
|
|
346
|
+
acknowledgedWriteModes: r.acknowledgedWriteModes,
|
|
347
|
+
adminAccess: Xr.read(),
|
|
338
348
|
dictated: e,
|
|
339
|
-
voiceProposalBound: (e) =>
|
|
340
|
-
turnInFlight: Object.values(
|
|
341
|
-
...
|
|
342
|
-
now:
|
|
349
|
+
voiceProposalBound: (e) => tr(e),
|
|
350
|
+
turnInFlight: Object.values(r.processingByConversationId).some((e) => lt(e?.status)),
|
|
351
|
+
...wn(n),
|
|
352
|
+
now: i
|
|
343
353
|
});
|
|
344
|
-
if (!
|
|
345
|
-
let
|
|
346
|
-
accessToken:
|
|
347
|
-
workspaceToken:
|
|
348
|
-
userId:
|
|
349
|
-
organizationId:
|
|
354
|
+
if (!a) return;
|
|
355
|
+
let o = Cn(n, a, i), c = {
|
|
356
|
+
accessToken: z(),
|
|
357
|
+
workspaceToken: nr(),
|
|
358
|
+
userId: B,
|
|
359
|
+
organizationId: kt()
|
|
350
360
|
};
|
|
351
|
-
|
|
361
|
+
Di(a.mode, n, c, null, !0, o).then((e) => o.finish({
|
|
352
362
|
ok: !0,
|
|
353
363
|
sandboxId: e.sandboxId,
|
|
354
364
|
didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
|
|
355
365
|
booted: e.sandboxIsNew || e.sandboxAdopted,
|
|
356
|
-
dead:
|
|
366
|
+
dead: o.dead
|
|
357
367
|
}), (e) => {
|
|
358
|
-
if (!(e instanceof
|
|
359
|
-
let e =
|
|
360
|
-
e && (
|
|
368
|
+
if (!(e instanceof yn) && !o.signal.aborted && A() === n) {
|
|
369
|
+
let e = b.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
|
|
370
|
+
e && (J.current.invalidate(e), Y.current.add(e), o.dead.push(e), Sr(a.mode));
|
|
361
371
|
}
|
|
362
|
-
|
|
372
|
+
o.finish({
|
|
363
373
|
ok: !1,
|
|
364
374
|
didWork: !1,
|
|
365
375
|
booted: !1,
|
|
366
|
-
dead:
|
|
376
|
+
dead: o.dead
|
|
367
377
|
});
|
|
368
378
|
});
|
|
369
379
|
}, [
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
R,
|
|
374
|
-
Qn,
|
|
380
|
+
Di,
|
|
381
|
+
Xr,
|
|
382
|
+
Sr,
|
|
375
383
|
z,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
384
|
+
nr,
|
|
385
|
+
B,
|
|
386
|
+
tr
|
|
387
|
+
]), Ai = j(() => ki(!1), [ki]), ji = Vn(v, h, h)?.reference ?? null, [Mi, Ni] = Bn(0), Pi = N(/* @__PURE__ */ new Set()), Fi = N(null), Ii = j(() => {
|
|
388
|
+
let e = b.getState(), t = e.activeConversationId;
|
|
379
389
|
if (!t) return;
|
|
380
|
-
let n = e.processingByConversationId[t], r =
|
|
381
|
-
if (!
|
|
390
|
+
let n = e.processingByConversationId[t], r = lt(n?.status) ? n?.messageId ?? null : null;
|
|
391
|
+
if (!dt({
|
|
382
392
|
interruptedTurnId: r,
|
|
383
393
|
activeTurnId: r,
|
|
384
|
-
alreadyRequested: r ?
|
|
394
|
+
alreadyRequested: r ? Pi.current.has(r) : !1
|
|
385
395
|
}).send || !r) return;
|
|
386
|
-
|
|
387
|
-
let i =
|
|
388
|
-
!i || !a || !o ||
|
|
389
|
-
accessToken:
|
|
390
|
-
workspaceToken:
|
|
391
|
-
userId:
|
|
392
|
-
organizationId:
|
|
396
|
+
Pi.current.add(r);
|
|
397
|
+
let i = y(e), a = A(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
|
|
398
|
+
!i || !a || !o || oe(i.sandboxId, a, o, i.mode, {
|
|
399
|
+
accessToken: z(),
|
|
400
|
+
workspaceToken: nr(),
|
|
401
|
+
userId: B,
|
|
402
|
+
organizationId: kt()
|
|
393
403
|
});
|
|
394
404
|
}, [
|
|
405
|
+
B,
|
|
395
406
|
z,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
let a = t.conversations.find((e) => e.id === i), o = a ? re(je(a.messages), {
|
|
407
|
+
nr
|
|
408
|
+
]), Li = j(async (e) => {
|
|
409
|
+
let t = b.getState(), n = y(t), r = A(), i = t.activeConversationId;
|
|
410
|
+
if (!n || !r || !i || Vt(t.sandboxWriteCapabilities[n.sandboxId])) return;
|
|
411
|
+
let a = t.conversations.find((e) => e.id === i), o = a ? g(T(a.messages), {
|
|
402
412
|
sessionId: a.backendSessionId,
|
|
403
413
|
sandboxId: n.sandboxId,
|
|
404
414
|
nowMs: Date.now()
|
|
405
415
|
}) : null;
|
|
406
416
|
if (o?.reference !== e) {
|
|
407
|
-
|
|
417
|
+
Ni((e) => e + 1);
|
|
408
418
|
return;
|
|
409
419
|
}
|
|
410
420
|
let s = {
|
|
411
421
|
conversationId: i,
|
|
412
422
|
reference: e
|
|
413
423
|
};
|
|
414
|
-
if (!
|
|
424
|
+
if (!m(s)) return;
|
|
415
425
|
try {
|
|
416
|
-
await
|
|
417
|
-
accessToken:
|
|
418
|
-
workspaceToken:
|
|
419
|
-
userId:
|
|
420
|
-
organizationId:
|
|
426
|
+
await se(n.sandboxId, r, e, n.mode, {
|
|
427
|
+
accessToken: z(),
|
|
428
|
+
workspaceToken: nr(),
|
|
429
|
+
userId: B,
|
|
430
|
+
organizationId: kt()
|
|
421
431
|
});
|
|
422
432
|
} catch (e) {
|
|
423
|
-
|
|
424
|
-
id:
|
|
433
|
+
te(s), G(i, {
|
|
434
|
+
id: qn(),
|
|
425
435
|
role: "system",
|
|
426
436
|
content: e instanceof Error ? e.message : "The change could not be approved.",
|
|
427
437
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
428
438
|
});
|
|
429
439
|
return;
|
|
430
440
|
}
|
|
431
|
-
|
|
432
|
-
let c =
|
|
433
|
-
c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId ||
|
|
441
|
+
te(s), gr(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
442
|
+
let c = b.getState(), l = c.conversations.find((e) => e.id === i);
|
|
443
|
+
c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || y(c)?.sandboxId !== n.sandboxId || lt(c.processingByConversationId[i]?.status) || re(T(l.messages)) !== o.messageId || ta.current(F("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
|
|
434
444
|
approvalFollowUp: { approvedReplyId: o.messageId },
|
|
435
445
|
targetConversationId: i
|
|
436
446
|
});
|
|
437
447
|
}, [
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
]),
|
|
443
|
-
theme:
|
|
444
|
-
navigate:
|
|
445
|
-
navItems:
|
|
446
|
-
options:
|
|
448
|
+
B,
|
|
449
|
+
G,
|
|
450
|
+
gr,
|
|
451
|
+
F
|
|
452
|
+
]), Ri = e(), { speakFinishedReply: zi } = Dt(), Bi = a(), { items: Vi } = Rn(), Hi = N({
|
|
453
|
+
theme: Ri,
|
|
454
|
+
navigate: Bi,
|
|
455
|
+
navItems: Vi,
|
|
456
|
+
options: er ?? {}
|
|
447
457
|
});
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
theme:
|
|
451
|
-
navigate:
|
|
452
|
-
navItems:
|
|
453
|
-
options:
|
|
458
|
+
M(() => {
|
|
459
|
+
Hi.current = {
|
|
460
|
+
theme: Ri,
|
|
461
|
+
navigate: Bi,
|
|
462
|
+
navItems: Vi,
|
|
463
|
+
options: er ?? {}
|
|
454
464
|
};
|
|
455
465
|
}, [
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
466
|
+
Ri,
|
|
467
|
+
Bi,
|
|
468
|
+
Vi,
|
|
469
|
+
er
|
|
460
470
|
]);
|
|
461
|
-
let
|
|
462
|
-
let a =
|
|
471
|
+
let Ui = j((e, t, n, r, i) => {
|
|
472
|
+
let a = F(n.key, n.fallback, r), o = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), s = {
|
|
463
473
|
kind: "write-reply",
|
|
464
474
|
line: n.key
|
|
465
|
-
}, c = (/* @__PURE__ */ new Date()).toISOString(), l =
|
|
466
|
-
|
|
475
|
+
}, c = (/* @__PURE__ */ new Date()).toISOString(), l = qn();
|
|
476
|
+
G(e, {
|
|
467
477
|
id: l,
|
|
468
478
|
role: "user",
|
|
469
479
|
content: t,
|
|
470
480
|
timestamp: c,
|
|
471
481
|
metadata: {
|
|
472
482
|
localAction: s,
|
|
473
|
-
...
|
|
483
|
+
...E(i)
|
|
474
484
|
}
|
|
475
485
|
});
|
|
476
|
-
let u =
|
|
477
|
-
|
|
486
|
+
let u = qn();
|
|
487
|
+
G(e, {
|
|
478
488
|
id: u,
|
|
479
489
|
role: "assistant",
|
|
480
490
|
content: a,
|
|
481
491
|
timestamp: c,
|
|
482
492
|
metadata: {
|
|
483
|
-
lang: a === o ? "en" :
|
|
493
|
+
lang: a === o ? "en" : V,
|
|
484
494
|
localAction: s,
|
|
485
|
-
...
|
|
495
|
+
...E(i)
|
|
486
496
|
}
|
|
487
|
-
}),
|
|
497
|
+
}), an.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", A()), zi(e, u);
|
|
488
498
|
}, [
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
]),
|
|
494
|
-
|
|
495
|
-
if (
|
|
496
|
-
let e = window.setTimeout(() =>
|
|
499
|
+
G,
|
|
500
|
+
V,
|
|
501
|
+
zi,
|
|
502
|
+
F
|
|
503
|
+
]), Wi = ln(), Gi = Wi?.request ?? null, Ki = N(() => void 0), [qi, Ji] = Bn(null);
|
|
504
|
+
M(() => {
|
|
505
|
+
if (qi === null) return;
|
|
506
|
+
let e = window.setTimeout(() => Ji(null), Kn);
|
|
497
507
|
return () => window.clearTimeout(e);
|
|
498
|
-
}, [
|
|
499
|
-
let
|
|
500
|
-
|
|
501
|
-
|
|
508
|
+
}, [qi]);
|
|
509
|
+
let Yi = j(() => {
|
|
510
|
+
let e = b.getState();
|
|
511
|
+
return W(void 0, e.autoRouting && ai.current ? s : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
|
|
512
|
+
}, [W]), Xi = j((e) => {
|
|
513
|
+
if (!Gi) return !1;
|
|
514
|
+
let t = e !== void 0, n = b.getState(), r = un({
|
|
502
515
|
spoken: t,
|
|
503
|
-
bound:
|
|
516
|
+
bound: hi.current,
|
|
504
517
|
activeConversationId: n.activeConversationId,
|
|
505
518
|
conversations: n.conversations,
|
|
506
|
-
historyOn:
|
|
519
|
+
historyOn: cn()
|
|
507
520
|
});
|
|
508
|
-
if (r &&
|
|
509
|
-
let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ?
|
|
510
|
-
|
|
511
|
-
id: `conversation-delete:${
|
|
521
|
+
if (r && Gi(r), t) {
|
|
522
|
+
let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? F("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : F("deleteConversation.nothing", "There is no conversation to delete.");
|
|
523
|
+
Ki.current({
|
|
524
|
+
id: `conversation-delete:${qn()}`,
|
|
512
525
|
text: t,
|
|
513
|
-
lang: t === e ? "en" :
|
|
526
|
+
lang: t === e ? "en" : V
|
|
514
527
|
});
|
|
515
|
-
} else r ||
|
|
528
|
+
} else r || Ji(Date.now());
|
|
516
529
|
return !0;
|
|
517
530
|
}, [
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
]),
|
|
522
|
-
if (e.kind === "conversation-delete") return
|
|
523
|
-
let { theme:
|
|
531
|
+
Gi,
|
|
532
|
+
V,
|
|
533
|
+
F
|
|
534
|
+
]), Zi = j((e, t, n, r = !1) => {
|
|
535
|
+
if (e.kind === "conversation-delete") return Xi(n);
|
|
536
|
+
let { theme: i, navigate: a } = Hi.current, o, s;
|
|
524
537
|
if (e.kind === "theme") {
|
|
525
|
-
if (!
|
|
526
|
-
let t =
|
|
527
|
-
mode:
|
|
528
|
-
resolvedTheme:
|
|
538
|
+
if (!i) return !1;
|
|
539
|
+
let t = On(e.request, {
|
|
540
|
+
mode: i.mode,
|
|
541
|
+
resolvedTheme: i.resolvedTheme
|
|
529
542
|
});
|
|
530
543
|
if (!t.alreadyApplied) try {
|
|
531
|
-
|
|
544
|
+
i.setMode(t.mode);
|
|
532
545
|
} catch {}
|
|
533
|
-
|
|
546
|
+
o = jn(F, t, e.request.kind === "family"), s = {
|
|
534
547
|
kind: "theme",
|
|
535
548
|
mode: t.mode,
|
|
536
549
|
alreadyApplied: t.alreadyApplied
|
|
537
550
|
};
|
|
538
551
|
} else {
|
|
539
|
-
if (!
|
|
552
|
+
if (!a) return !1;
|
|
540
553
|
if (e.kind === "navigate") {
|
|
541
|
-
let { destination: t } = e, n =
|
|
542
|
-
n ||
|
|
554
|
+
let { destination: t } = e, n = Tn(t, window.location.pathname + window.location.search, Dn(Hi.current.navItems));
|
|
555
|
+
n || a(t.path), o = An(F, t.label, n), s = {
|
|
543
556
|
kind: "navigate",
|
|
544
557
|
destinationId: t.id,
|
|
545
558
|
path: t.path,
|
|
546
559
|
alreadyHere: n
|
|
547
560
|
};
|
|
548
|
-
} else
|
|
561
|
+
} else o = kn(F, e.candidates[0]?.label ?? e.query, e.candidates), s = {
|
|
549
562
|
kind: "choose-destination",
|
|
550
563
|
candidateIds: e.candidates.map((e) => e.id)
|
|
551
564
|
};
|
|
552
565
|
}
|
|
553
|
-
let
|
|
554
|
-
|
|
566
|
+
let c = (r ? null : b.getState().activeConversationId) ?? Yi();
|
|
567
|
+
r && vi(c);
|
|
568
|
+
let l = (/* @__PURE__ */ new Date()).toISOString(), u = qn();
|
|
569
|
+
G(c, {
|
|
555
570
|
id: u,
|
|
556
571
|
role: "user",
|
|
557
572
|
content: t,
|
|
558
573
|
timestamp: l,
|
|
559
574
|
metadata: {
|
|
560
|
-
localAction:
|
|
561
|
-
...
|
|
575
|
+
localAction: s,
|
|
576
|
+
...E(n)
|
|
562
577
|
}
|
|
563
578
|
});
|
|
564
|
-
let d =
|
|
565
|
-
return
|
|
579
|
+
let d = qn();
|
|
580
|
+
return G(c, {
|
|
566
581
|
id: d,
|
|
567
582
|
role: "assistant",
|
|
568
|
-
content:
|
|
583
|
+
content: o.text,
|
|
569
584
|
timestamp: l,
|
|
570
585
|
metadata: {
|
|
571
|
-
lang:
|
|
572
|
-
localAction:
|
|
573
|
-
...
|
|
586
|
+
lang: o.translated ? V : "en",
|
|
587
|
+
localAction: s,
|
|
588
|
+
...E(n)
|
|
574
589
|
}
|
|
575
|
-
}),
|
|
590
|
+
}), an.recordCommittedEntries(c, [u, d], "LOCAL_COMMAND", A()), zi(c, d), !0;
|
|
576
591
|
}, [
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
592
|
+
G,
|
|
593
|
+
vi,
|
|
594
|
+
Yi,
|
|
595
|
+
V,
|
|
596
|
+
Xi,
|
|
580
597
|
zi,
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
ti.current = !0;
|
|
598
|
+
F
|
|
599
|
+
]), Qi = j(async (e) => {
|
|
600
|
+
si.current = !0;
|
|
585
601
|
try {
|
|
586
|
-
await
|
|
602
|
+
await q.declineForReply(e.conversationId, e.reason, e.origin);
|
|
587
603
|
} finally {
|
|
588
|
-
|
|
604
|
+
si.current = !1;
|
|
589
605
|
}
|
|
590
606
|
if (e.commandText !== null) {
|
|
591
|
-
let t =
|
|
592
|
-
if (t &&
|
|
607
|
+
let t = En(e.commandText, Dn(Hi.current.navItems), Hi.current.options);
|
|
608
|
+
if (t && Zi(t, e.content, e.options.voiceSessionId)) return;
|
|
593
609
|
}
|
|
594
|
-
await
|
|
595
|
-
}, [
|
|
596
|
-
let r = n.voiceSessionId !== void 0, i =
|
|
597
|
-
if (
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
610
|
+
await ta.current(e.content, e.attachments, e.options);
|
|
611
|
+
}, [Zi, q]), X = j(async (e, t = [], n = {}) => {
|
|
612
|
+
let r = n.voiceSessionId !== void 0, i = b.getState(), a = !1, o = hi.current;
|
|
613
|
+
if (r && Re(o)) {
|
|
614
|
+
let e = Ue(o, i.activeConversationId, yi());
|
|
615
|
+
if (e.kind === "gone") return;
|
|
616
|
+
let t = n.voiceEntry ?? e;
|
|
617
|
+
t.kind === "adopt" && vi(t.conversationId), a = t.kind === "own", n = {
|
|
618
|
+
...n,
|
|
619
|
+
voiceEntry: t
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
let s = a ? null : i.activeConversationId, c = a ? null : i.activeConversationId ?? H;
|
|
623
|
+
if (c) {
|
|
624
|
+
if (lt(i.processingByConversationId[c]?.status)) {
|
|
625
|
+
let r = i.processingByConversationId[c]?.messageId ?? null;
|
|
626
|
+
r && Pi.current.has(r) && (Fi.current = {
|
|
627
|
+
conversationId: c,
|
|
602
628
|
content: e,
|
|
603
629
|
attachments: t,
|
|
604
630
|
options: n
|
|
605
631
|
});
|
|
606
632
|
return;
|
|
607
633
|
}
|
|
608
|
-
if (
|
|
634
|
+
if (xi.current.has(c)) return;
|
|
609
635
|
}
|
|
610
|
-
if (
|
|
611
|
-
let
|
|
612
|
-
if (
|
|
613
|
-
let e = i.conversations.find((e) => e.id ===
|
|
614
|
-
if (i.activeConversationId !==
|
|
636
|
+
if (oi.current || h() !== null || si.current) return;
|
|
637
|
+
let d = n.targetConversationId, ee = p(), m = (e) => tn(e) || en(e, ee);
|
|
638
|
+
if (d !== void 0) {
|
|
639
|
+
let e = i.conversations.find((e) => e.id === d);
|
|
640
|
+
if (i.activeConversationId !== d || !e || e.mode !== i.mode || m(e)) return;
|
|
615
641
|
}
|
|
616
642
|
if (n.fromPerson && n.writeReplyBound === void 0) {
|
|
617
|
-
let r =
|
|
643
|
+
let r = d ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", a = Ht({
|
|
618
644
|
text: e,
|
|
619
|
-
locale:
|
|
620
|
-
origin:
|
|
645
|
+
locale: i === "spoken" ? ar.input.code : V,
|
|
646
|
+
origin: i,
|
|
621
647
|
hasAttachments: t.length > 0,
|
|
622
|
-
live:
|
|
623
|
-
matchesLocalCommand: (e) =>
|
|
648
|
+
live: q.liveFor(r),
|
|
649
|
+
matchesLocalCommand: (e) => En(e, Dn(Hi.current.navItems), Hi.current.options) !== null
|
|
624
650
|
});
|
|
625
|
-
if (
|
|
626
|
-
r &&
|
|
651
|
+
if (a.kind === "local_reply") {
|
|
652
|
+
r && Ui(r, e, a.line, a.values, n.voiceSessionId);
|
|
627
653
|
return;
|
|
628
654
|
}
|
|
629
|
-
let
|
|
630
|
-
if (
|
|
655
|
+
let o = a.kind === "local" ? a.fallback : a.bound, c = a.declineAll;
|
|
656
|
+
if (c !== null && r) return Qi({
|
|
631
657
|
conversationId: r,
|
|
632
|
-
reason:
|
|
633
|
-
origin:
|
|
634
|
-
commandText:
|
|
658
|
+
reason: c,
|
|
659
|
+
origin: i,
|
|
660
|
+
commandText: a.kind === "local" ? a.commandText : null,
|
|
635
661
|
content: e,
|
|
636
662
|
attachments: t,
|
|
637
663
|
options: {
|
|
638
664
|
...n,
|
|
639
|
-
writeReplyBound:
|
|
665
|
+
writeReplyBound: o
|
|
640
666
|
}
|
|
641
667
|
});
|
|
642
668
|
n = {
|
|
643
669
|
...n,
|
|
644
|
-
writeReplyBound:
|
|
670
|
+
writeReplyBound: o
|
|
645
671
|
};
|
|
646
672
|
}
|
|
647
|
-
let
|
|
673
|
+
let te = n.writeReplyBound?.promptText ?? e;
|
|
648
674
|
if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
|
|
649
|
-
let t =
|
|
650
|
-
if (t &&
|
|
675
|
+
let t = En(e, Dn(Hi.current.navItems), Hi.current.options);
|
|
676
|
+
if (t && Zi(t, e, n.voiceSessionId, a)) return;
|
|
651
677
|
}
|
|
652
|
-
let
|
|
678
|
+
let re = s ? i.conversations.find((e) => e.id === s) : void 0, g = m(re) ? void 0 : re, _ = i.autoRouting && ai.current && d === void 0 ? f({
|
|
653
679
|
intent: n.autoIntent ?? l(e),
|
|
654
680
|
dictated: r,
|
|
655
|
-
voiceProposalBound: r &&
|
|
656
|
-
conversation:
|
|
657
|
-
mode:
|
|
658
|
-
routedBy:
|
|
659
|
-
hasHistory:
|
|
681
|
+
voiceProposalBound: r && tr("api-calls") && ie(i.acknowledgedWriteModes, "api-calls"),
|
|
682
|
+
conversation: g ? {
|
|
683
|
+
mode: g.mode,
|
|
684
|
+
routedBy: g.routedBy,
|
|
685
|
+
hasHistory: $t(g)
|
|
660
686
|
} : null
|
|
661
687
|
}) : null;
|
|
662
|
-
if (
|
|
663
|
-
|
|
688
|
+
if (_ && Zr.current.find((e) => e.id === _.mode)?.writeCapable && !ie(i.acknowledgedWriteModes, _.mode)) {
|
|
689
|
+
oi.current = {
|
|
664
690
|
content: e,
|
|
665
691
|
attachments: t,
|
|
666
692
|
options: n
|
|
667
|
-
},
|
|
693
|
+
}, ui(_.mode);
|
|
668
694
|
return;
|
|
669
695
|
}
|
|
670
|
-
let
|
|
671
|
-
mode:
|
|
672
|
-
backendSessionId:
|
|
696
|
+
let v = _ ? _.mode : i.mode, y, se, x = d ?? (a ? null : H), ce = x ? b.getState().conversations.find((e) => e.id === x) : void 0, ue = _?.action === "escalate" && g ? {
|
|
697
|
+
mode: g.mode,
|
|
698
|
+
backendSessionId: g.backendSessionId ?? null
|
|
673
699
|
} : null;
|
|
674
|
-
if (
|
|
700
|
+
if (_) _.action === "new" || !g ? x = W(void 0, v, { routedBy: "auto" }) : (x = g.id, Dr(x, v));
|
|
675
701
|
else {
|
|
676
702
|
let e = i.autoRouting ? { routedBy: "auto" } : void 0;
|
|
677
|
-
!
|
|
703
|
+
!x || m(ce) || ce && ce.mode !== v && $t(ce) ? x = W(void 0, v, e) : ce && ce.mode !== v && (e ? Dr(x, v) : fr(x, v));
|
|
678
704
|
}
|
|
679
|
-
if (!
|
|
680
|
-
r &&
|
|
681
|
-
let
|
|
682
|
-
accessToken:
|
|
683
|
-
workspaceToken:
|
|
684
|
-
userId:
|
|
685
|
-
organizationId:
|
|
686
|
-
},
|
|
687
|
-
|
|
688
|
-
accessToken:
|
|
689
|
-
workspaceToken:
|
|
690
|
-
userId:
|
|
691
|
-
organizationId:
|
|
705
|
+
if (!x) return;
|
|
706
|
+
r && hi.current !== void 0 && x !== i.activeConversationId && vi(x), n.approvalFollowUp || (bi.current[x] = t);
|
|
707
|
+
let pe = () => b.getState().conversations.some((e) => e.id === x), S = A(), C = {
|
|
708
|
+
accessToken: z(),
|
|
709
|
+
workspaceToken: nr(),
|
|
710
|
+
userId: B,
|
|
711
|
+
organizationId: kt()
|
|
712
|
+
}, _e = (e, t) => {
|
|
713
|
+
pe() || !S || oe(e, S, t, v, {
|
|
714
|
+
accessToken: z(),
|
|
715
|
+
workspaceToken: nr(),
|
|
716
|
+
userId: B,
|
|
717
|
+
organizationId: kt()
|
|
692
718
|
});
|
|
693
|
-
},
|
|
694
|
-
id:
|
|
719
|
+
}, ve = {
|
|
720
|
+
id: qn(),
|
|
695
721
|
role: "user",
|
|
696
722
|
content: e,
|
|
697
723
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
698
724
|
metadata: {
|
|
699
|
-
...t.length ? { attachments: t.map(
|
|
725
|
+
...t.length ? { attachments: t.map(Ze) } : {},
|
|
700
726
|
...n.approvalFollowUp ? {
|
|
701
727
|
approvalFollowUp: !0,
|
|
702
728
|
approvedReplyId: n.approvalFollowUp.approvedReplyId
|
|
703
729
|
} : {},
|
|
704
|
-
...
|
|
730
|
+
...E(n.voiceSessionId)
|
|
705
731
|
}
|
|
706
732
|
};
|
|
707
|
-
|
|
708
|
-
let
|
|
709
|
-
|
|
710
|
-
id:
|
|
733
|
+
G(x, ve);
|
|
734
|
+
let T = qn();
|
|
735
|
+
G(x, {
|
|
736
|
+
id: T,
|
|
711
737
|
role: "assistant",
|
|
712
738
|
content: "",
|
|
713
739
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
714
740
|
metadata: {
|
|
715
|
-
lang:
|
|
716
|
-
...
|
|
741
|
+
lang: cr,
|
|
742
|
+
...E(n.voiceSessionId)
|
|
717
743
|
}
|
|
718
|
-
}),
|
|
744
|
+
}), Ct(T, {
|
|
719
745
|
channel: r ? "voice" : "chat",
|
|
720
|
-
mode:
|
|
721
|
-
product:
|
|
722
|
-
language:
|
|
723
|
-
device:
|
|
724
|
-
routedByAuto: !!
|
|
725
|
-
}, n.voiceTiming),
|
|
726
|
-
let
|
|
727
|
-
turnId:
|
|
728
|
-
abortRequested:
|
|
729
|
-
activeTurnId:
|
|
730
|
-
conversationExists:
|
|
731
|
-
}),
|
|
732
|
-
|
|
746
|
+
mode: v,
|
|
747
|
+
product: I,
|
|
748
|
+
language: cr,
|
|
749
|
+
device: wt(),
|
|
750
|
+
routedByAuto: !!_
|
|
751
|
+
}, n.voiceTiming), k(T, "accepted"), _r(x, "provisioning", T, null), ne(T);
|
|
752
|
+
let ke = () => ut({
|
|
753
|
+
turnId: T,
|
|
754
|
+
abortRequested: Pi.current.has(T),
|
|
755
|
+
activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
|
|
756
|
+
conversationExists: pe()
|
|
757
|
+
}), Ae = (e, t, r, i, a = !1, o = cr) => {
|
|
758
|
+
hr(x, T, { content: ye(e) }), gr(x, T, {
|
|
733
759
|
lang: o,
|
|
734
760
|
...t?.length ? { artifacts: t } : {},
|
|
735
|
-
...t?.length || r || i ? { mode:
|
|
761
|
+
...t?.length || r || i ? { mode: v } : {},
|
|
736
762
|
...r ? { sessionId: r } : {},
|
|
737
763
|
...i ? { sandboxId: i } : {},
|
|
738
764
|
...a ? { incomplete: !0 } : {},
|
|
739
|
-
...
|
|
765
|
+
...E(n.voiceSessionId)
|
|
740
766
|
});
|
|
741
|
-
}, je = { session: null },
|
|
742
|
-
|
|
767
|
+
}, je = { session: null }, Me = async (i = 1) => {
|
|
768
|
+
k(T, "attemptStarted");
|
|
743
769
|
let a = null, o = null, s = !1;
|
|
744
770
|
try {
|
|
745
|
-
let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew:
|
|
746
|
-
turnId:
|
|
747
|
-
abortRequested:
|
|
748
|
-
activeTurnId:
|
|
749
|
-
conversationExists:
|
|
771
|
+
let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: p, deadSandboxProbe: ee } = await Oi(x, T, v, S, C, { isAbandoned: () => ut({
|
|
772
|
+
turnId: T,
|
|
773
|
+
abortRequested: Pi.current.has(T),
|
|
774
|
+
activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
|
|
775
|
+
conversationExists: pe()
|
|
750
776
|
}).abandon });
|
|
751
|
-
if (a = i,
|
|
752
|
-
runtime:
|
|
753
|
-
deadSandboxProbe:
|
|
777
|
+
if (a = i, k(T, "runtimeReady"), O(T, {
|
|
778
|
+
runtime: d ? "cold" : p ? "adopted" : f ? "probed" : l ? "new-session" : "warm",
|
|
779
|
+
deadSandboxProbe: ee
|
|
754
780
|
}), o = c, je.session = {
|
|
755
781
|
sandboxId: i,
|
|
756
782
|
sessionId: c
|
|
757
|
-
},
|
|
783
|
+
}, ae(v, y, b.getState().acknowledgedWriteModes, {
|
|
758
784
|
dictated: r,
|
|
759
|
-
confirmsWrites: me(
|
|
760
|
-
proposalBound:
|
|
761
|
-
}) === "voice-in-write-mode") throw new
|
|
762
|
-
let m =
|
|
763
|
-
conversation:
|
|
785
|
+
confirmsWrites: me(v),
|
|
786
|
+
proposalBound: tr(v, i)
|
|
787
|
+
}) === "voice-in-write-mode") throw new be("voice-in-write-mode", "Voice in a write mode");
|
|
788
|
+
let m = dn({
|
|
789
|
+
conversation: b.getState().conversations.find((e) => e.id === x),
|
|
764
790
|
content: e,
|
|
765
791
|
sessionIsNew: l,
|
|
766
|
-
sendingMode:
|
|
767
|
-
sendingModeConfig:
|
|
768
|
-
modes:
|
|
769
|
-
answerText: (e) =>
|
|
770
|
-
}), h = await
|
|
771
|
-
|
|
772
|
-
let ne =
|
|
773
|
-
conversationId:
|
|
774
|
-
writeReply:
|
|
775
|
-
}, { prompt:
|
|
776
|
-
content: m ? `${m}${
|
|
792
|
+
sendingMode: v,
|
|
793
|
+
sendingModeConfig: y,
|
|
794
|
+
modes: Zr.current,
|
|
795
|
+
answerText: (e) => yt(e).text
|
|
796
|
+
}), h = await gt(() => fe(i, S, c, v, C, { limit: 50 }), l, ht(u, i, c));
|
|
797
|
+
Ei(x, T, "streaming", "thinking");
|
|
798
|
+
let ne = Xn?.(), re = Ut(b.getState().sandboxWriteCapabilities[i]), g = {
|
|
799
|
+
conversationId: x,
|
|
800
|
+
writeReply: re === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null
|
|
801
|
+
}, { prompt: _, parts: ie } = ct({
|
|
802
|
+
content: m ? `${m}${te}` : te,
|
|
777
803
|
attachments: t,
|
|
778
|
-
limits:
|
|
779
|
-
wrapPrompt: (e) =>
|
|
804
|
+
limits: Xe(y),
|
|
805
|
+
wrapPrompt: (e) => Zn?.(v, e, or, sr, r, { writeApproval: re }) ?? e,
|
|
780
806
|
requestBytes: (e, t) => he({
|
|
781
807
|
sandboxId: i,
|
|
782
|
-
workspaceId:
|
|
808
|
+
workspaceId: S,
|
|
783
809
|
sessionId: c,
|
|
784
|
-
mode:
|
|
810
|
+
mode: v,
|
|
785
811
|
prompt: e,
|
|
786
812
|
parts: t,
|
|
787
813
|
pageContext: ne,
|
|
788
|
-
authContext:
|
|
789
|
-
...
|
|
814
|
+
authContext: C,
|
|
815
|
+
...g
|
|
790
816
|
})
|
|
791
|
-
}),
|
|
792
|
-
s =
|
|
793
|
-
let
|
|
794
|
-
if (
|
|
795
|
-
|
|
817
|
+
}), oe = qe(ie), ce = oe > 0;
|
|
818
|
+
s = Ke(t) > oe;
|
|
819
|
+
let ue = ke();
|
|
820
|
+
if (ue.abandon) {
|
|
821
|
+
ue.clearProcessing && vr(x);
|
|
796
822
|
return;
|
|
797
823
|
}
|
|
798
824
|
try {
|
|
799
|
-
await
|
|
800
|
-
parts:
|
|
801
|
-
...
|
|
802
|
-
} :
|
|
825
|
+
await ge(i, S, c, _, v, ne, C, ie?.length ? {
|
|
826
|
+
parts: ie,
|
|
827
|
+
...g
|
|
828
|
+
} : g);
|
|
803
829
|
} catch (e) {
|
|
804
|
-
if (!
|
|
805
|
-
await
|
|
830
|
+
if (!ie || !At(e)) throw e;
|
|
831
|
+
await ge(i, S, c, _, v, ne, C, g), s ||= ce;
|
|
806
832
|
}
|
|
807
|
-
|
|
808
|
-
let
|
|
809
|
-
for (; Date.now() <
|
|
810
|
-
|
|
811
|
-
let e =
|
|
833
|
+
k(T, "promptSent");
|
|
834
|
+
let xe = null, Se = !1, Ce = pt, w = mt([], h), Ee = Date.now() + se.streamBudgetMs, De = Date.now(), E = Date.now();
|
|
835
|
+
for (; Date.now() < Ee;) {
|
|
836
|
+
_e(i, c);
|
|
837
|
+
let e = ke();
|
|
812
838
|
if (e.abandon) {
|
|
813
|
-
e.clearProcessing &&
|
|
839
|
+
e.clearProcessing && vr(x);
|
|
814
840
|
return;
|
|
815
841
|
}
|
|
816
|
-
if (
|
|
842
|
+
if (w = mt(await fe(i, S, c, v, C, {
|
|
817
843
|
limit: 50,
|
|
818
844
|
sinceMs: h
|
|
819
|
-
}), h, { accumulateNarration:
|
|
845
|
+
}), h, { accumulateNarration: se.accumulatesNarration }), hr(x, T, { content: ye(w.content) }), w.hasRenderableOutput ? Se || (Se = !0, xe !== null && k(T, "lastQuietPoll", xe), k(T, "firstOutput")) : xe = Et(), se.accumulatesNarration) w.hasText && k(T, "firstText");
|
|
820
846
|
else {
|
|
821
|
-
let e =
|
|
822
|
-
|
|
847
|
+
let e = vt(Ce, w, Et());
|
|
848
|
+
Ce = e.tracker, e.confirmedAt !== null && k(T, "firstText", e.confirmedAt);
|
|
823
849
|
}
|
|
824
|
-
if (
|
|
825
|
-
|
|
850
|
+
if (w.pendingWrite && !Vt(b.getState().sandboxWriteCapabilities[i]) && gr(x, T, { pendingWrite: w.pendingWrite }), w.done) {
|
|
851
|
+
k(T, "answerDone"), J.current.markVerified(i);
|
|
826
852
|
break;
|
|
827
853
|
}
|
|
828
|
-
Date.now() -
|
|
854
|
+
Date.now() - De > 3e4 && (await le(i, S, 600, C).catch(() => void 0), De = Date.now()), await new Promise((e) => setTimeout(e, Ne(Date.now() - E)));
|
|
829
855
|
}
|
|
830
|
-
let
|
|
831
|
-
|
|
832
|
-
...
|
|
833
|
-
content:
|
|
834
|
-
}), s && (
|
|
835
|
-
...
|
|
836
|
-
content: `${
|
|
856
|
+
let Me = se.producesArtifacts ? await de(i, S, c, v, C).then((e) => e).catch(() => []) : void 0;
|
|
857
|
+
w.usedTools !== void 0 && O(T, { usedTools: w.usedTools }), w.done || (O(T, { outcome: "timedOut" }), w = {
|
|
858
|
+
...w,
|
|
859
|
+
content: Oe(w.content, v, F, y)
|
|
860
|
+
}), s && (w = {
|
|
861
|
+
...w,
|
|
862
|
+
content: `${w.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._")}`
|
|
837
863
|
});
|
|
838
|
-
let
|
|
839
|
-
|
|
840
|
-
workspaceId:
|
|
864
|
+
let D = !w.done;
|
|
865
|
+
Ae(w.content, Me, c, i, D), w.tokens && (hr(x, T, { tokens: w.tokens }), ($n ? await Te({
|
|
866
|
+
workspaceId: S,
|
|
841
867
|
sessionId: c,
|
|
842
|
-
messageId:
|
|
843
|
-
model:
|
|
844
|
-
tokens:
|
|
845
|
-
},
|
|
846
|
-
let
|
|
847
|
-
if (
|
|
848
|
-
|
|
868
|
+
messageId: w.messageId,
|
|
869
|
+
model: w.model,
|
|
870
|
+
tokens: w.tokens
|
|
871
|
+
}, $n, { ledger: we("panel", I) }) : { ok: !0 }).ok && Nn(I)), w.done || _e(i, c);
|
|
872
|
+
let Pe = ke();
|
|
873
|
+
if (Pe.abandon) {
|
|
874
|
+
Pe.clearProcessing && vr(x);
|
|
849
875
|
return;
|
|
850
876
|
}
|
|
851
|
-
|
|
877
|
+
k(T, "complete"), O(T, { outcome: "answered" }), _r(x, "complete", T, null), an.recordCommittedEntries(x, [ve.id, T], "TURN", S);
|
|
852
878
|
} catch (e) {
|
|
853
|
-
|
|
854
|
-
let t =
|
|
855
|
-
turnId:
|
|
856
|
-
abortRequested:
|
|
857
|
-
activeTurnId:
|
|
858
|
-
conversationExists:
|
|
879
|
+
J.current.invalidate(a ?? b.getState().sandboxesByMode[v]?.sandboxId ?? null);
|
|
880
|
+
let t = ut({
|
|
881
|
+
turnId: T,
|
|
882
|
+
abortRequested: Pi.current.has(T),
|
|
883
|
+
activeTurnId: b.getState().processingByConversationId[x]?.messageId ?? null,
|
|
884
|
+
conversationExists: pe()
|
|
859
885
|
});
|
|
860
|
-
if (a && o &&
|
|
861
|
-
t.clearProcessing &&
|
|
886
|
+
if (a && o && _e(a, o), t.abandon) {
|
|
887
|
+
t.clearProcessing && vr(x);
|
|
862
888
|
return;
|
|
863
889
|
}
|
|
864
|
-
if (i === 1 &&
|
|
865
|
-
let e = a ??
|
|
866
|
-
return e && (
|
|
890
|
+
if (i === 1 && jt(e)) {
|
|
891
|
+
let e = a ?? b.getState().sandboxesByMode[v]?.sandboxId ?? null;
|
|
892
|
+
return e && (Y.current.add(e), J.current.invalidate(e)), br(x), Sr(v), mr(x, T, ""), gr(x, T, { pendingWrite: void 0 }), e && q.retireSandbox(e), Tt(T), Me(2);
|
|
867
893
|
}
|
|
868
894
|
throw e;
|
|
869
895
|
}
|
|
870
|
-
},
|
|
871
|
-
|
|
896
|
+
}, D = x;
|
|
897
|
+
xi.current.add(D);
|
|
872
898
|
try {
|
|
873
|
-
if (!
|
|
899
|
+
if (!S) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
|
|
874
900
|
code: "UNAUTHENTICATED",
|
|
875
901
|
authFailure: "WORKSPACE_CONTEXT_MISSING"
|
|
876
902
|
} });
|
|
877
|
-
let e = await
|
|
878
|
-
|
|
879
|
-
let t =
|
|
903
|
+
let e = await st(v, () => Zr.current.find((e) => e.id === v), Xr);
|
|
904
|
+
y = e.config, se = e.capabilities;
|
|
905
|
+
let t = y, n = ke();
|
|
880
906
|
if (n.abandon) {
|
|
881
|
-
n.clearProcessing &&
|
|
907
|
+
n.clearProcessing && vr(x);
|
|
882
908
|
return;
|
|
883
909
|
}
|
|
884
|
-
let i =
|
|
910
|
+
let i = ae(v, t, b.getState().acknowledgedWriteModes, {
|
|
885
911
|
dictated: r,
|
|
886
|
-
confirmsWrites: me(
|
|
887
|
-
proposalBound:
|
|
912
|
+
confirmsWrites: me(v),
|
|
913
|
+
proposalBound: tr(v)
|
|
888
914
|
});
|
|
889
|
-
if (i) throw new
|
|
890
|
-
let a =
|
|
891
|
-
if (
|
|
892
|
-
let e = await
|
|
893
|
-
if (!e.ok) throw
|
|
894
|
-
let t =
|
|
915
|
+
if (i) throw new be(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
|
|
916
|
+
let a = we("panel", I);
|
|
917
|
+
if ($n && w(a, S)) {
|
|
918
|
+
let e = await Ee(a, S, $n);
|
|
919
|
+
if (!e.ok) throw De(e.kind);
|
|
920
|
+
let t = ke();
|
|
895
921
|
if (t.abandon) {
|
|
896
|
-
t.clearProcessing &&
|
|
922
|
+
t.clearProcessing && vr(x);
|
|
897
923
|
return;
|
|
898
924
|
}
|
|
899
925
|
}
|
|
900
|
-
|
|
926
|
+
k(T, "cleared"), await Me();
|
|
901
927
|
} catch (e) {
|
|
902
|
-
if (
|
|
903
|
-
|
|
928
|
+
if (J.current.invalidate(b.getState().sandboxesByMode[v]?.sandboxId ?? null), !pe()) {
|
|
929
|
+
vr(x);
|
|
904
930
|
return;
|
|
905
931
|
}
|
|
906
|
-
let t = je.session?.sandboxId ?? null, r =
|
|
907
|
-
mode:
|
|
908
|
-
capabilities: t ?
|
|
932
|
+
let t = je.session?.sandboxId ?? null, r = xe(e, { confirmsNoAction: Se({
|
|
933
|
+
mode: v,
|
|
934
|
+
capabilities: t ? b.getState().sandboxWriteCapabilities[t] : null
|
|
909
935
|
}) });
|
|
910
|
-
|
|
911
|
-
let i =
|
|
912
|
-
|
|
913
|
-
lang: i.translated ?
|
|
914
|
-
...
|
|
936
|
+
O(T, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && Mn(I, "sandbox");
|
|
937
|
+
let i = Ce(r, F);
|
|
938
|
+
_r(x, "error", T, i.headline), hr(x, T, { content: i.text }), gr(x, T, {
|
|
939
|
+
lang: i.translated ? V : "en",
|
|
940
|
+
...E(n.voiceSessionId)
|
|
915
941
|
});
|
|
916
942
|
} finally {
|
|
917
|
-
|
|
918
|
-
let e =
|
|
919
|
-
t && (
|
|
943
|
+
xi.current.delete(D), O(T, { outcome: "stopped" }), k(T, "complete");
|
|
944
|
+
let e = b.getState(), t = u(ue, v, e.conversations.find((e) => e.id === D), (t) => !!e.sandboxesByMode[t]?.sandboxId);
|
|
945
|
+
t && (Dr(D, t.mode), t.backendSessionId && yr(D, t.backendSessionId)), je.session && pe() && q.afterTurn({
|
|
920
946
|
...je.session,
|
|
921
|
-
conversationId:
|
|
922
|
-
},
|
|
923
|
-
let n =
|
|
924
|
-
|
|
947
|
+
conversationId: D
|
|
948
|
+
}, T);
|
|
949
|
+
let n = Fi.current;
|
|
950
|
+
Fi.current = null, n && n.conversationId === D && pe() && ta.current(n.content, n.attachments, n.options);
|
|
925
951
|
}
|
|
926
952
|
}, [
|
|
927
|
-
|
|
953
|
+
H,
|
|
954
|
+
G,
|
|
955
|
+
Zn,
|
|
956
|
+
br,
|
|
957
|
+
Sr,
|
|
958
|
+
lr,
|
|
928
959
|
W,
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
960
|
+
Oi,
|
|
961
|
+
q,
|
|
962
|
+
Ui,
|
|
963
|
+
Qi,
|
|
964
|
+
V,
|
|
932
965
|
ar,
|
|
933
|
-
U,
|
|
934
|
-
vi,
|
|
935
|
-
J,
|
|
936
|
-
Ni,
|
|
937
|
-
Vi,
|
|
938
|
-
B,
|
|
939
966
|
tr,
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
R,
|
|
943
|
-
Qn,
|
|
944
|
-
dr,
|
|
945
|
-
F,
|
|
946
|
-
Wr,
|
|
947
|
-
Yn,
|
|
948
|
-
rr,
|
|
949
|
-
B,
|
|
950
|
-
ir,
|
|
967
|
+
Xn,
|
|
968
|
+
z,
|
|
951
969
|
nr,
|
|
952
|
-
Cr,
|
|
953
|
-
Bi,
|
|
954
970
|
hr,
|
|
971
|
+
I,
|
|
972
|
+
Xr,
|
|
973
|
+
$n,
|
|
974
|
+
sr,
|
|
975
|
+
V,
|
|
955
976
|
cr,
|
|
956
|
-
|
|
977
|
+
or,
|
|
978
|
+
Dr,
|
|
979
|
+
Zi,
|
|
980
|
+
vi,
|
|
981
|
+
yi,
|
|
982
|
+
yr,
|
|
983
|
+
fr,
|
|
984
|
+
_r,
|
|
985
|
+
vr,
|
|
986
|
+
F,
|
|
987
|
+
Ei,
|
|
957
988
|
mr,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
Z(e, [], t ? { autoIntent: t } : {});
|
|
964
|
-
}, [Z]), Ui = k(() => {
|
|
965
|
-
let e = [...wr.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
|
|
989
|
+
B
|
|
990
|
+
]), $i = j((e, t) => {
|
|
991
|
+
X(e, [], t ? { autoIntent: t } : {});
|
|
992
|
+
}, [X]), ea = j(() => {
|
|
993
|
+
let e = [...kr.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
|
|
966
994
|
if (!e || e.metadata?.approvalFollowUp) return;
|
|
967
|
-
let t =
|
|
968
|
-
|
|
995
|
+
let t = H ? bi.current[H] ?? [] : [];
|
|
996
|
+
X(e.content, t);
|
|
969
997
|
}, [
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
]),
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
}, [
|
|
977
|
-
let
|
|
978
|
-
if (
|
|
979
|
-
for (let e =
|
|
980
|
-
let t =
|
|
981
|
-
if (t?.role !== "assistant" || !
|
|
982
|
-
let n =
|
|
998
|
+
Ar,
|
|
999
|
+
X,
|
|
1000
|
+
H
|
|
1001
|
+
]), ta = N(X);
|
|
1002
|
+
M(() => {
|
|
1003
|
+
ta.current = X;
|
|
1004
|
+
}, [X]);
|
|
1005
|
+
let na = zn(() => {
|
|
1006
|
+
if (jr) return null;
|
|
1007
|
+
for (let e = Ar.length - 1; e >= 0; --e) {
|
|
1008
|
+
let t = Ar[e];
|
|
1009
|
+
if (t?.role !== "assistant" || !ke(t) || Pi.current.has(t.id)) continue;
|
|
1010
|
+
let n = ft(t, K, F);
|
|
983
1011
|
if (n.kind !== "output") return null;
|
|
984
|
-
let r =
|
|
1012
|
+
let r = yt(n.text).text.trim();
|
|
985
1013
|
return r ? {
|
|
986
1014
|
id: t.id,
|
|
987
1015
|
text: r
|
|
@@ -989,493 +1017,507 @@ var Wn = ({ visible: Wn = !0, writeAccess: Gn = "unknown" }) => {
|
|
|
989
1017
|
}
|
|
990
1018
|
return null;
|
|
991
1019
|
}, [
|
|
992
|
-
|
|
993
|
-
|
|
1020
|
+
Ar,
|
|
1021
|
+
jr,
|
|
994
1022
|
K,
|
|
995
|
-
|
|
996
|
-
]),
|
|
997
|
-
sessionId:
|
|
998
|
-
sandboxId:
|
|
1023
|
+
F
|
|
1024
|
+
]), ra = zn(() => na ? Pe(na.text) : null, [na]), Z = kr.chat, ia = b((e) => y(e)?.sandboxId ?? null), aa = g(Z, {
|
|
1025
|
+
sessionId: Or?.backendSessionId,
|
|
1026
|
+
sandboxId: ia,
|
|
999
1027
|
nowMs: Date.now()
|
|
1000
|
-
}),
|
|
1001
|
-
if (
|
|
1028
|
+
}), oa = _(Z), sa = (e) => {
|
|
1029
|
+
if (Bt(e.metadata).length > 0) return !0;
|
|
1002
1030
|
let t = e.metadata?.sandboxId;
|
|
1003
|
-
return
|
|
1004
|
-
},
|
|
1005
|
-
let t =
|
|
1006
|
-
return t.length === 0 || !
|
|
1031
|
+
return Vt(t ? Pr[t] : null);
|
|
1032
|
+
}, ca = (e) => {
|
|
1033
|
+
let t = Bt(e.metadata);
|
|
1034
|
+
return t.length === 0 || !H ? null : /* @__PURE__ */ P(zt, {
|
|
1007
1035
|
refs: t,
|
|
1008
|
-
conversationId:
|
|
1009
|
-
panel:
|
|
1010
|
-
entries:
|
|
1011
|
-
capabilitiesOf: (e) =>
|
|
1012
|
-
turnInFlight:
|
|
1013
|
-
tr:
|
|
1014
|
-
onReview:
|
|
1015
|
-
retiredSandboxes:
|
|
1036
|
+
conversationId: H,
|
|
1037
|
+
panel: q,
|
|
1038
|
+
entries: Fr,
|
|
1039
|
+
capabilitiesOf: (e) => Pr[e],
|
|
1040
|
+
turnInFlight: jr,
|
|
1041
|
+
tr: F,
|
|
1042
|
+
onReview: Lr.review,
|
|
1043
|
+
retiredSandboxes: Ir
|
|
1016
1044
|
});
|
|
1017
|
-
},
|
|
1018
|
-
|
|
1019
|
-
if (
|
|
1020
|
-
let e = window.setTimeout(() =>
|
|
1045
|
+
}, la = Lr.dialog.view ? Fr[Lr.dialog.view.proposalId] : void 0, ua = aa?.expiresAtMs ?? null;
|
|
1046
|
+
M(() => {
|
|
1047
|
+
if (ua === null) return;
|
|
1048
|
+
let e = window.setTimeout(() => Ni((e) => e + 1), Math.max(0, ua - Date.now()));
|
|
1021
1049
|
return () => window.clearTimeout(e);
|
|
1022
|
-
}, [
|
|
1023
|
-
let Q =
|
|
1050
|
+
}, [ua, Mi]);
|
|
1051
|
+
let Q = zn(() => kr.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
1024
1052
|
id: e.id,
|
|
1025
1053
|
role: e.role,
|
|
1026
|
-
text:
|
|
1027
|
-
sessionId:
|
|
1054
|
+
text: St(e, K, F),
|
|
1055
|
+
sessionId: Ae(e),
|
|
1028
1056
|
timestamp: e.timestamp
|
|
1029
1057
|
})).filter((e) => e.text.length > 0), [
|
|
1030
|
-
|
|
1058
|
+
kr.voice,
|
|
1031
1059
|
K,
|
|
1032
|
-
|
|
1033
|
-
]),
|
|
1060
|
+
F
|
|
1061
|
+
]), da = j(() => {
|
|
1034
1062
|
if (Q.length === 0) return;
|
|
1035
1063
|
let e = /* @__PURE__ */ new Date();
|
|
1036
|
-
|
|
1037
|
-
title:
|
|
1038
|
-
savedAt:
|
|
1039
|
-
session:
|
|
1040
|
-
earlier:
|
|
1041
|
-
you:
|
|
1042
|
-
assistant:
|
|
1043
|
-
}, e),
|
|
1064
|
+
Qt(Me(Q, {
|
|
1065
|
+
title: F("voiceSession.transcript", "Voice conversation"),
|
|
1066
|
+
savedAt: F("voiceSession.savedAt", "Saved"),
|
|
1067
|
+
session: F("voiceSession.sessionLabel", "Session"),
|
|
1068
|
+
earlier: F("voiceSession.earlierLabel", "Earlier"),
|
|
1069
|
+
you: F("voiceSession.speakerYou", "You"),
|
|
1070
|
+
assistant: F("voiceSession.speakerAssistant", "Assistant")
|
|
1071
|
+
}, e), D(I, e), "text/markdown");
|
|
1044
1072
|
}, [
|
|
1045
|
-
|
|
1073
|
+
I,
|
|
1046
1074
|
Q,
|
|
1047
|
-
|
|
1048
|
-
]),
|
|
1049
|
-
|
|
1050
|
-
let
|
|
1051
|
-
onSubmit:
|
|
1052
|
-
let r =
|
|
1053
|
-
let
|
|
1054
|
-
if (!
|
|
1055
|
-
sessionLive:
|
|
1075
|
+
F
|
|
1076
|
+
]), fa = Pn({ perFileChars: ci }), pa = N(fa);
|
|
1077
|
+
pa.current = fa;
|
|
1078
|
+
let ma = N(/* @__PURE__ */ new Set()), ha = N(() => !1), $ = Ot({
|
|
1079
|
+
onSubmit: j((e, t, n) => {
|
|
1080
|
+
let r = hi.current, i = Ge(r), a = () => {
|
|
1081
|
+
let a = pa.current, o = b.getState();
|
|
1082
|
+
if (!ze({
|
|
1083
|
+
sessionLive: ha.current(t),
|
|
1056
1084
|
boundAtSubmit: r,
|
|
1057
|
-
activeConversationId:
|
|
1058
|
-
boundConversationExists:
|
|
1085
|
+
activeConversationId: o.activeConversationId,
|
|
1086
|
+
boundConversationExists: o.conversations.some((e) => e.id === i)
|
|
1059
1087
|
})) {
|
|
1060
|
-
|
|
1088
|
+
a.clear();
|
|
1061
1089
|
return;
|
|
1062
1090
|
}
|
|
1063
|
-
let
|
|
1091
|
+
let s = Je(a.attachments), c = {
|
|
1064
1092
|
...n,
|
|
1065
|
-
handedOver:
|
|
1093
|
+
handedOver: Et()
|
|
1066
1094
|
};
|
|
1067
|
-
|
|
1095
|
+
ta.current(e, s, {
|
|
1068
1096
|
fromPerson: !0,
|
|
1069
1097
|
voiceSessionId: t,
|
|
1070
|
-
voiceTiming:
|
|
1071
|
-
}),
|
|
1098
|
+
voiceTiming: c
|
|
1099
|
+
}), a.clear();
|
|
1072
1100
|
};
|
|
1073
|
-
if (!
|
|
1074
|
-
|
|
1101
|
+
if (!pa.current.isBusy) {
|
|
1102
|
+
a();
|
|
1075
1103
|
return;
|
|
1076
1104
|
}
|
|
1077
|
-
let
|
|
1078
|
-
|
|
1105
|
+
let o = Date.now(), s = ma.current, c = window.setInterval(() => {
|
|
1106
|
+
pa.current.isBusy && Date.now() - o < Wn || (window.clearInterval(c), s.delete(c), a());
|
|
1079
1107
|
}, 200);
|
|
1080
|
-
|
|
1108
|
+
s.add(c);
|
|
1081
1109
|
}, []),
|
|
1082
|
-
latestReply:
|
|
1083
|
-
language:
|
|
1110
|
+
latestReply: na,
|
|
1111
|
+
language: Fe(rr, V).tag
|
|
1084
1112
|
});
|
|
1085
|
-
|
|
1086
|
-
let
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
}, [
|
|
1090
|
-
let
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
]), [
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
}, [
|
|
1098
|
-
let
|
|
1099
|
-
let e =
|
|
1113
|
+
ha.current = $.isCurrentSession;
|
|
1114
|
+
let ga = gi ? Q.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Q, _a = $.answerLocally;
|
|
1115
|
+
M(() => {
|
|
1116
|
+
Ki.current = _a;
|
|
1117
|
+
}, [_a]);
|
|
1118
|
+
let va = $.active, ya = zn(() => rt(Object.values(Fr), H, Ir), [
|
|
1119
|
+
Fr,
|
|
1120
|
+
H,
|
|
1121
|
+
Ir
|
|
1122
|
+
]), [ba, xa] = Bn(null);
|
|
1123
|
+
M(() => {
|
|
1124
|
+
va || xa(null);
|
|
1125
|
+
}, [va]);
|
|
1126
|
+
let Sa = Lr.review, Ca = j(() => {
|
|
1127
|
+
let e = ya[ya.length - 1];
|
|
1100
1128
|
if (!e) return;
|
|
1101
1129
|
let { view: t } = e;
|
|
1102
|
-
if (
|
|
1103
|
-
|
|
1130
|
+
if (It(t) && Ft(t, Pr[e.session.sandboxId]).offerConfirm) {
|
|
1131
|
+
Sa(t);
|
|
1104
1132
|
return;
|
|
1105
1133
|
}
|
|
1106
|
-
|
|
1134
|
+
xa(t.proposalId);
|
|
1107
1135
|
}, [
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
]),
|
|
1112
|
-
content: /* @__PURE__ */
|
|
1136
|
+
ya,
|
|
1137
|
+
Pr,
|
|
1138
|
+
Sa
|
|
1139
|
+
]), wa = va ? et(ya) : null, Ta = ba ? Fr[ba] : void 0, Ea = va && Ta && Ta.session.conversationId === H ? {
|
|
1140
|
+
content: /* @__PURE__ */ P(zt, {
|
|
1113
1141
|
refs: [{
|
|
1114
|
-
proposalId:
|
|
1115
|
-
sandboxId:
|
|
1116
|
-
sessionId:
|
|
1142
|
+
proposalId: Ta.view.proposalId,
|
|
1143
|
+
sandboxId: Ta.session.sandboxId,
|
|
1144
|
+
sessionId: Ta.session.sessionId
|
|
1117
1145
|
}],
|
|
1118
|
-
conversationId:
|
|
1119
|
-
panel:
|
|
1120
|
-
entries:
|
|
1121
|
-
capabilitiesOf: (e) =>
|
|
1122
|
-
turnInFlight:
|
|
1123
|
-
tr:
|
|
1124
|
-
onReview:
|
|
1125
|
-
retiredSandboxes:
|
|
1146
|
+
conversationId: Ta.session.conversationId,
|
|
1147
|
+
panel: q,
|
|
1148
|
+
entries: Fr,
|
|
1149
|
+
capabilitiesOf: (e) => Pr[e],
|
|
1150
|
+
turnInFlight: jr,
|
|
1151
|
+
tr: F,
|
|
1152
|
+
onReview: Sa,
|
|
1153
|
+
retiredSandboxes: Ir
|
|
1126
1154
|
}),
|
|
1127
|
-
closeLabel:
|
|
1128
|
-
onClose: () =>
|
|
1129
|
-
} : null,
|
|
1130
|
-
|
|
1131
|
-
va
|
|
1155
|
+
closeLabel: it(F, Qe.trayClose),
|
|
1156
|
+
onClose: () => xa(null)
|
|
1157
|
+
} : null, Da = Lr.asking, Oa = Wi?.asking === !0, ka = $.holdListening;
|
|
1158
|
+
M(() => {
|
|
1159
|
+
ka(va && (Da || Oa));
|
|
1132
1160
|
}, [
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1161
|
+
va,
|
|
1162
|
+
Da,
|
|
1163
|
+
Oa,
|
|
1164
|
+
ka
|
|
1137
1165
|
]);
|
|
1138
|
-
let
|
|
1139
|
-
|
|
1140
|
-
if (!
|
|
1141
|
-
|
|
1166
|
+
let Aa = N(null), ja = $.announce;
|
|
1167
|
+
M(() => {
|
|
1168
|
+
if (!va) {
|
|
1169
|
+
Aa.current = null;
|
|
1142
1170
|
return;
|
|
1143
1171
|
}
|
|
1144
|
-
let e =
|
|
1172
|
+
let e = Aa.current;
|
|
1145
1173
|
if (e === null) {
|
|
1146
|
-
|
|
1174
|
+
Aa.current = new Set(Object.keys(Fr));
|
|
1147
1175
|
return;
|
|
1148
1176
|
}
|
|
1149
|
-
for (let { view: t, session: n } of
|
|
1177
|
+
for (let { view: t, session: n } of nt(ya, e)) {
|
|
1150
1178
|
e.add(t.proposalId);
|
|
1151
|
-
let r =
|
|
1152
|
-
if (
|
|
1179
|
+
let r = Pr[n.sandboxId];
|
|
1180
|
+
if (!$e({
|
|
1153
1181
|
mode: "api-calls",
|
|
1154
|
-
productWriteApproval:
|
|
1182
|
+
productWriteApproval: R,
|
|
1155
1183
|
capabilities: r
|
|
1156
1184
|
})) continue;
|
|
1157
|
-
let i =
|
|
1158
|
-
|
|
1185
|
+
let i = at(t, Ft(t, r).offerConfirm, F), a = t.proposalId;
|
|
1186
|
+
ja({
|
|
1159
1187
|
id: `write-readback:${a}`,
|
|
1160
1188
|
text: i.text,
|
|
1161
|
-
lang: i.translated ?
|
|
1162
|
-
stillWanted: () =>
|
|
1189
|
+
lang: i.translated ? V : "en",
|
|
1190
|
+
stillWanted: () => q.entry(a)?.view.status === "pending"
|
|
1163
1191
|
});
|
|
1164
1192
|
}
|
|
1165
1193
|
}, [
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1194
|
+
va,
|
|
1195
|
+
ya,
|
|
1196
|
+
Fr,
|
|
1197
|
+
Pr,
|
|
1198
|
+
R,
|
|
1199
|
+
F,
|
|
1200
|
+
V,
|
|
1201
|
+
ja,
|
|
1202
|
+
q
|
|
1175
1203
|
]);
|
|
1176
|
-
let
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
}, [$.active]),
|
|
1180
|
-
if (!
|
|
1181
|
-
let t =
|
|
1182
|
-
return typeof t == "string" ? t === e :
|
|
1204
|
+
let Ma = N(!1);
|
|
1205
|
+
M(() => {
|
|
1206
|
+
Ma.current = $.active;
|
|
1207
|
+
}, [$.active]), M(() => ee((e) => {
|
|
1208
|
+
if (!Ma.current) return !1;
|
|
1209
|
+
let t = hi.current;
|
|
1210
|
+
return typeof t == "string" ? t === e : b.getState().activeConversationId === e;
|
|
1183
1211
|
}), []);
|
|
1184
|
-
let
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1212
|
+
let Na = $.start, Pa = j(() => {
|
|
1213
|
+
let e = b.getState().activeConversationId, t = He(yi());
|
|
1214
|
+
vi(We(t, e)), ki(!0, t.kind === "own"), Na();
|
|
1215
|
+
}, [
|
|
1216
|
+
vi,
|
|
1217
|
+
ki,
|
|
1218
|
+
yi,
|
|
1219
|
+
Na
|
|
1220
|
+
]), Fa = zn(() => xt(Or?.messages ?? []), [Or?.messages]), Ia = bt(kr.voice, K, F), La = bt(Fa, K, F) > 0, Ra = j(() => {
|
|
1221
|
+
let e = b.getState().activeConversationId;
|
|
1188
1222
|
if (!e || Q.length === 0) return;
|
|
1189
|
-
let t = new Set(
|
|
1190
|
-
|
|
1223
|
+
let t = new Set(Fa.map((e) => e.id)), n = qn();
|
|
1224
|
+
G(e, {
|
|
1191
1225
|
id: n,
|
|
1192
1226
|
role: "system",
|
|
1193
|
-
content:
|
|
1194
|
-
intro:
|
|
1195
|
-
nothing:
|
|
1196
|
-
more: (e) =>
|
|
1227
|
+
content: je(Q.filter((e) => t.has(e.id)), {
|
|
1228
|
+
intro: F("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
|
|
1229
|
+
nothing: F("voiceSession.continuedNothing", "Continued from a voice conversation."),
|
|
1230
|
+
more: (e) => F("voiceSession.continuedMore", "…and {{count}} more", { count: e })
|
|
1197
1231
|
}),
|
|
1198
1232
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1199
|
-
metadata: { continuedVoiceTurns:
|
|
1200
|
-
}),
|
|
1233
|
+
metadata: { continuedVoiceTurns: Ia }
|
|
1234
|
+
}), an.recordCommittedEntries(e, [n], "NOTE", A()), mi(!1), $.end();
|
|
1201
1235
|
}, [
|
|
1202
1236
|
Q,
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1237
|
+
Ia,
|
|
1238
|
+
Fa,
|
|
1239
|
+
G,
|
|
1240
|
+
F,
|
|
1207
1241
|
$,
|
|
1208
|
-
|
|
1209
|
-
]),
|
|
1210
|
-
|
|
1211
|
-
|
|
1242
|
+
mi
|
|
1243
|
+
]), za = N({
|
|
1244
|
+
conversationId: null,
|
|
1245
|
+
count: 0
|
|
1246
|
+
});
|
|
1247
|
+
M(() => {
|
|
1248
|
+
$.active && (za.current = {
|
|
1249
|
+
conversationId: H,
|
|
1250
|
+
count: Ia
|
|
1251
|
+
});
|
|
1212
1252
|
}, [$.active]);
|
|
1213
|
-
let
|
|
1214
|
-
let e =
|
|
1215
|
-
$.end(),
|
|
1253
|
+
let Ba = j(() => {
|
|
1254
|
+
let e = za.current, t = Ia > (e.conversationId === H ? e.count : 0);
|
|
1255
|
+
$.end(), t && mi(!0);
|
|
1216
1256
|
}, [
|
|
1217
|
-
|
|
1257
|
+
H,
|
|
1258
|
+
Ia,
|
|
1218
1259
|
$,
|
|
1219
|
-
|
|
1260
|
+
mi
|
|
1220
1261
|
]);
|
|
1221
|
-
|
|
1222
|
-
(!
|
|
1262
|
+
M(() => {
|
|
1263
|
+
(!Jn || !Ti) && $.active && $.end();
|
|
1223
1264
|
}, [
|
|
1224
|
-
|
|
1225
|
-
|
|
1265
|
+
Jn,
|
|
1266
|
+
Ti,
|
|
1226
1267
|
$
|
|
1227
|
-
]),
|
|
1228
|
-
let e =
|
|
1268
|
+
]), M(() => {
|
|
1269
|
+
let e = hi.current, t = Ge(e), n = b.getState(), r = Ve({
|
|
1229
1270
|
sessionLive: $.active,
|
|
1230
1271
|
bound: e,
|
|
1231
|
-
activeConversationId:
|
|
1232
|
-
boundConversationExists:
|
|
1272
|
+
activeConversationId: n.activeConversationId,
|
|
1273
|
+
boundConversationExists: n.conversations.some((e) => e.id === t)
|
|
1233
1274
|
});
|
|
1234
|
-
|
|
1275
|
+
vi(r.bound), r.end && $.end();
|
|
1235
1276
|
}, [
|
|
1236
1277
|
$,
|
|
1237
|
-
|
|
1238
|
-
|
|
1278
|
+
H,
|
|
1279
|
+
lr,
|
|
1280
|
+
vi
|
|
1239
1281
|
]);
|
|
1240
|
-
let
|
|
1241
|
-
|
|
1242
|
-
let e =
|
|
1243
|
-
activeConversationId:
|
|
1244
|
-
chatTurnCount:
|
|
1282
|
+
let Va = N(Le);
|
|
1283
|
+
M(() => {
|
|
1284
|
+
let e = Be(Va.current, {
|
|
1285
|
+
activeConversationId: H,
|
|
1286
|
+
chatTurnCount: Z.length,
|
|
1245
1287
|
voiceTurnCount: Q.length,
|
|
1246
1288
|
sessionLive: $.active,
|
|
1247
|
-
sessionBoundTo:
|
|
1248
|
-
turnInFlight:
|
|
1289
|
+
sessionBoundTo: hi.current,
|
|
1290
|
+
turnInFlight: jr
|
|
1249
1291
|
});
|
|
1250
|
-
|
|
1292
|
+
Va.current = e.state, e.open && mi(!0);
|
|
1251
1293
|
}, [
|
|
1252
|
-
|
|
1253
|
-
|
|
1294
|
+
H,
|
|
1295
|
+
Z.length,
|
|
1254
1296
|
Q.length,
|
|
1255
1297
|
$.active,
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
]),
|
|
1298
|
+
jr,
|
|
1299
|
+
mi
|
|
1300
|
+
]), M(() => {
|
|
1259
1301
|
if (!$.active) {
|
|
1260
|
-
|
|
1261
|
-
for (let e of
|
|
1262
|
-
|
|
1302
|
+
pa.current.clear(), Fi.current = null;
|
|
1303
|
+
for (let e of ma.current) window.clearInterval(e);
|
|
1304
|
+
ma.current.clear();
|
|
1263
1305
|
}
|
|
1264
|
-
}, [$.active]),
|
|
1265
|
-
let e =
|
|
1306
|
+
}, [$.active]), M(() => {
|
|
1307
|
+
let e = ma.current;
|
|
1266
1308
|
return () => {
|
|
1267
1309
|
for (let t of e) window.clearInterval(t);
|
|
1268
1310
|
e.clear();
|
|
1269
1311
|
};
|
|
1270
|
-
}, []),
|
|
1271
|
-
let e =
|
|
1272
|
-
return e &&
|
|
1312
|
+
}, []), M(() => {
|
|
1313
|
+
let e = b.getState().consumePendingPrompt();
|
|
1314
|
+
return e && ta.current(e), b.subscribe((e, t) => {
|
|
1273
1315
|
if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
|
|
1274
|
-
let e =
|
|
1275
|
-
e &&
|
|
1316
|
+
let e = b.getState().consumePendingPrompt();
|
|
1317
|
+
e && ta.current(e);
|
|
1276
1318
|
}
|
|
1277
1319
|
});
|
|
1278
1320
|
}, []);
|
|
1279
|
-
let
|
|
1280
|
-
let t =
|
|
1281
|
-
if (t && t.mode !== e &&
|
|
1321
|
+
let Ha = j((e) => {
|
|
1322
|
+
let t = H ? b.getState().conversations.find((e) => e.id === H) : void 0;
|
|
1323
|
+
if (t && t.mode !== e && q.withdraw(t.id, "mode_switched"), t && $t(t)) {
|
|
1282
1324
|
if (t.mode !== e) {
|
|
1283
|
-
let t =
|
|
1284
|
-
n ?
|
|
1325
|
+
let t = p(), n = b.getState().conversations.find((n) => n.mode === e && nn(n, t) && !b.getState().processingByConversationId[n.id]);
|
|
1326
|
+
n ? pr(n.id) : W(void 0, e);
|
|
1285
1327
|
}
|
|
1286
|
-
} else
|
|
1287
|
-
let n =
|
|
1288
|
-
n ?
|
|
1328
|
+
} else H && fr(H, e);
|
|
1329
|
+
let n = b.getState().activeConversationId;
|
|
1330
|
+
n ? fr(n, e) : Er(!1), dr(e);
|
|
1289
1331
|
}, [
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
]),
|
|
1298
|
-
let e =
|
|
1332
|
+
H,
|
|
1333
|
+
W,
|
|
1334
|
+
pr,
|
|
1335
|
+
Er,
|
|
1336
|
+
fr,
|
|
1337
|
+
dr,
|
|
1338
|
+
q
|
|
1339
|
+
]), Ua = j(() => {
|
|
1340
|
+
let e = b.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
|
|
1299
1341
|
if (!t) {
|
|
1300
|
-
|
|
1342
|
+
Er(!0), dr(s);
|
|
1301
1343
|
return;
|
|
1302
1344
|
}
|
|
1303
1345
|
if (t.routedBy === "auto") {
|
|
1304
|
-
|
|
1346
|
+
Er(!0);
|
|
1305
1347
|
return;
|
|
1306
1348
|
}
|
|
1307
|
-
if (
|
|
1308
|
-
|
|
1349
|
+
if (!$t(t)) {
|
|
1350
|
+
Dr(t.id, s);
|
|
1309
1351
|
return;
|
|
1310
1352
|
}
|
|
1311
|
-
|
|
1312
|
-
let n =
|
|
1313
|
-
r ? (
|
|
1353
|
+
q.withdraw(t.id, "mode_switched");
|
|
1354
|
+
let n = p(), r = e.conversations.find((t) => t.routedBy === "auto" && nn(t, n) && !e.processingByConversationId[t.id]);
|
|
1355
|
+
r ? (pr(r.id), Dr(r.id, s)) : W(void 0, s, { routedBy: "auto" });
|
|
1314
1356
|
}, [
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
]),
|
|
1322
|
-
if (
|
|
1323
|
-
|
|
1357
|
+
W,
|
|
1358
|
+
Dr,
|
|
1359
|
+
pr,
|
|
1360
|
+
Er,
|
|
1361
|
+
dr,
|
|
1362
|
+
q
|
|
1363
|
+
]), Wa = j((e) => {
|
|
1364
|
+
if (L.find((t) => t.id === e)?.writeCapable && !ie(b.getState().acknowledgedWriteModes, e)) {
|
|
1365
|
+
ui(e);
|
|
1324
1366
|
return;
|
|
1325
1367
|
}
|
|
1326
|
-
|
|
1327
|
-
}, [
|
|
1328
|
-
let e =
|
|
1329
|
-
if (
|
|
1330
|
-
let t =
|
|
1331
|
-
if (
|
|
1332
|
-
|
|
1368
|
+
Ha(e);
|
|
1369
|
+
}, [Ha, L]), Ga = j(() => {
|
|
1370
|
+
let e = li;
|
|
1371
|
+
if (ui(null), !e) return;
|
|
1372
|
+
let t = oi.current;
|
|
1373
|
+
if (oi.current = null, t) {
|
|
1374
|
+
wr(e), X(t.content, t.attachments, t.options);
|
|
1333
1375
|
return;
|
|
1334
1376
|
}
|
|
1335
|
-
|
|
1377
|
+
wr(e), Ha(e);
|
|
1336
1378
|
}, [
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
]),
|
|
1342
|
-
|
|
1343
|
-
let e =
|
|
1344
|
-
|
|
1379
|
+
li,
|
|
1380
|
+
wr,
|
|
1381
|
+
Ha,
|
|
1382
|
+
X
|
|
1383
|
+
]), Ka = li === null ? void 0 : L.find((e) => e.id === li) ?? { id: li }, qa = j(() => {
|
|
1384
|
+
ui(null);
|
|
1385
|
+
let e = oi.current;
|
|
1386
|
+
oi.current = null, e && X(e.content, e.attachments, {
|
|
1345
1387
|
...e.options,
|
|
1346
1388
|
autoIntent: "read"
|
|
1347
1389
|
});
|
|
1348
|
-
}, [
|
|
1349
|
-
return /* @__PURE__ */
|
|
1390
|
+
}, [X]);
|
|
1391
|
+
return /* @__PURE__ */ Hn("div", {
|
|
1350
1392
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
1351
1393
|
children: [
|
|
1352
|
-
/* @__PURE__ */
|
|
1394
|
+
/* @__PURE__ */ Hn("div", {
|
|
1353
1395
|
className: "contents",
|
|
1354
1396
|
inert: $.active || void 0,
|
|
1355
1397
|
children: [
|
|
1356
|
-
|
|
1357
|
-
Q.length > 0 && !$.active ? /* @__PURE__ */
|
|
1398
|
+
qr === null ? null : /* @__PURE__ */ P(qt, { onDismiss: () => Kr(qr) }),
|
|
1399
|
+
Q.length > 0 && !$.active ? /* @__PURE__ */ P(Gt, {
|
|
1358
1400
|
count: Q.length,
|
|
1359
|
-
onOpenTranscript: () =>
|
|
1401
|
+
onOpenTranscript: () => mi(!0)
|
|
1360
1402
|
}) : null,
|
|
1361
|
-
|
|
1362
|
-
state:
|
|
1363
|
-
onRetry:
|
|
1364
|
-
}) :
|
|
1403
|
+
Z.length === 0 && (Hr || Ur) ? /* @__PURE__ */ P(Jt, {
|
|
1404
|
+
state: Hr ? "loading" : "failed",
|
|
1405
|
+
onRetry: Qr
|
|
1406
|
+
}) : Z.length === 0 && Or?.sync?.hasOlder ? /* @__PURE__ */ P("div", {
|
|
1365
1407
|
className: "flex min-h-0 flex-1 flex-col",
|
|
1366
|
-
children: /* @__PURE__ */
|
|
1367
|
-
onShowEarlier:
|
|
1368
|
-
disabled:
|
|
1408
|
+
children: /* @__PURE__ */ P(Xt, {
|
|
1409
|
+
onShowEarlier: $r,
|
|
1410
|
+
disabled: Hr
|
|
1369
1411
|
})
|
|
1370
|
-
}) :
|
|
1371
|
-
mode:
|
|
1372
|
-
onSuggestionClick:
|
|
1373
|
-
explainsAuto:
|
|
1374
|
-
suggestions:
|
|
1375
|
-
}) : /* @__PURE__ */
|
|
1412
|
+
}) : Z.length === 0 ? /* @__PURE__ */ P(on, {
|
|
1413
|
+
mode: U,
|
|
1414
|
+
onSuggestionClick: $i,
|
|
1415
|
+
explainsAuto: ii,
|
|
1416
|
+
suggestions: ii && U === "assistant" ? c(L.find((e) => e.id === "assistant")?.suggestions ?? [], L.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
|
|
1417
|
+
}) : /* @__PURE__ */ Hn("div", {
|
|
1376
1418
|
className: "flex min-h-0 flex-1 flex-col",
|
|
1377
|
-
children: [
|
|
1378
|
-
onShowEarlier:
|
|
1379
|
-
disabled:
|
|
1380
|
-
}) : null, /* @__PURE__ */
|
|
1381
|
-
onApprovePendingWrite:
|
|
1382
|
-
approvingWriteRef:
|
|
1383
|
-
approvableMessageId:
|
|
1384
|
-
retryableMessageId:
|
|
1385
|
-
messages:
|
|
1419
|
+
children: [Or?.sync?.hasOlder ? /* @__PURE__ */ P(Xt, {
|
|
1420
|
+
onShowEarlier: $r,
|
|
1421
|
+
disabled: Hr
|
|
1422
|
+
}) : null, /* @__PURE__ */ P(pn, {
|
|
1423
|
+
onApprovePendingWrite: Li,
|
|
1424
|
+
approvingWriteRef: ji,
|
|
1425
|
+
approvableMessageId: aa?.messageId ?? null,
|
|
1426
|
+
retryableMessageId: oa,
|
|
1427
|
+
messages: Z,
|
|
1386
1428
|
processing: K ?? null,
|
|
1387
|
-
streamingMessageId:
|
|
1388
|
-
failedMessageId:
|
|
1389
|
-
onRetry:
|
|
1390
|
-
renderWriteProposals:
|
|
1391
|
-
hidesLegacyWriteCard:
|
|
1429
|
+
streamingMessageId: Mr,
|
|
1430
|
+
failedMessageId: Nr,
|
|
1431
|
+
onRetry: ji === null ? ea : void 0,
|
|
1432
|
+
renderWriteProposals: ca,
|
|
1433
|
+
hidesLegacyWriteCard: sa
|
|
1392
1434
|
})]
|
|
1393
1435
|
}),
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
tr:
|
|
1398
|
-
onDismiss: () =>
|
|
1436
|
+
Br ? /* @__PURE__ */ P(Yt, { onStartNew: () => W() }) : null,
|
|
1437
|
+
Vr && H ? /* @__PURE__ */ P(Kt, { onUnarchive: () => an.updateConversation(H, { archived: !1 }) }) : null,
|
|
1438
|
+
qi === null ? null : /* @__PURE__ */ P(sn, {
|
|
1439
|
+
tr: F,
|
|
1440
|
+
onDismiss: () => Ji(null)
|
|
1399
1441
|
}),
|
|
1400
|
-
|
|
1401
|
-
state:
|
|
1402
|
-
onRetry:
|
|
1442
|
+
Z.length > 0 && (Hr || Ur) ? /* @__PURE__ */ P(Jt, {
|
|
1443
|
+
state: Hr ? "loading" : "failed",
|
|
1444
|
+
onRetry: Qr,
|
|
1403
1445
|
compact: !0
|
|
1404
1446
|
}) : null,
|
|
1405
|
-
/* @__PURE__ */
|
|
1406
|
-
onStartVoiceSession: $.available &&
|
|
1407
|
-
onSend: (e, t) => void
|
|
1408
|
-
onDraftStart:
|
|
1409
|
-
disabled:
|
|
1410
|
-
readOnly:
|
|
1411
|
-
placeholder:
|
|
1412
|
-
mode:
|
|
1413
|
-
writeAccessDenied:
|
|
1414
|
-
availableModes:
|
|
1415
|
-
attachmentCharsPerFile:
|
|
1416
|
-
onModeChange:
|
|
1417
|
-
auto:
|
|
1418
|
-
active:
|
|
1419
|
-
onSelect:
|
|
1447
|
+
/* @__PURE__ */ P(Fn, {
|
|
1448
|
+
onStartVoiceSession: $.available && Ti ? Pa : void 0,
|
|
1449
|
+
onSend: (e, t) => void X(e, t, { fromPerson: !0 }),
|
|
1450
|
+
onDraftStart: Ai,
|
|
1451
|
+
disabled: jr || ji !== null || Hr,
|
|
1452
|
+
readOnly: Br,
|
|
1453
|
+
placeholder: U === "api-calls" ? F("chatArea.placeholderActions", "What would you like me to do?") : F("chatArea.placeholderGeneral", "Ask me anything…"),
|
|
1454
|
+
mode: U,
|
|
1455
|
+
writeAccessDenied: Yn === "denied" && !!Si?.writeCapable,
|
|
1456
|
+
availableModes: ni,
|
|
1457
|
+
attachmentCharsPerFile: ci,
|
|
1458
|
+
onModeChange: Wa,
|
|
1459
|
+
auto: ri ? {
|
|
1460
|
+
active: ii,
|
|
1461
|
+
onSelect: Ua
|
|
1420
1462
|
} : void 0
|
|
1421
1463
|
})
|
|
1422
1464
|
]
|
|
1423
1465
|
}),
|
|
1424
|
-
|
|
1466
|
+
pi && !$.active ? /* @__PURE__ */ P(Zt, {
|
|
1425
1467
|
turns: Q,
|
|
1426
|
-
onClose: () =>
|
|
1427
|
-
onSave:
|
|
1428
|
-
onContinueInChat:
|
|
1468
|
+
onClose: () => mi(!1),
|
|
1469
|
+
onSave: da,
|
|
1470
|
+
onContinueInChat: La ? Ra : void 0,
|
|
1429
1471
|
closeOnEscape: !0,
|
|
1430
|
-
onShowEarlier:
|
|
1431
|
-
showEarlierDisabled:
|
|
1472
|
+
onShowEarlier: Or?.sync?.hasOlder ? $r : void 0,
|
|
1473
|
+
showEarlierDisabled: Hr
|
|
1432
1474
|
}) : null,
|
|
1433
|
-
$.active && /* @__PURE__ */
|
|
1475
|
+
$.active && /* @__PURE__ */ P(mn, {
|
|
1434
1476
|
session: $.session,
|
|
1435
1477
|
notice: $.notice,
|
|
1436
1478
|
capturing: $.capturing,
|
|
1437
1479
|
interrupting: $.interrupting,
|
|
1438
1480
|
awaitingEndpoint: $.awaitingEndpoint,
|
|
1439
|
-
turns:
|
|
1481
|
+
turns: ga,
|
|
1440
1482
|
spokenChunks: $.spokenChunks,
|
|
1441
|
-
attachments:
|
|
1442
|
-
onAttachFiles:
|
|
1443
|
-
onRemoveAttachment:
|
|
1444
|
-
onRetryAttachment:
|
|
1445
|
-
canAttachMore:
|
|
1446
|
-
preparingAttachments:
|
|
1447
|
-
onSaveTranscript:
|
|
1448
|
-
onContinueInChat:
|
|
1483
|
+
attachments: fa.attachments,
|
|
1484
|
+
onAttachFiles: fa.addFiles,
|
|
1485
|
+
onRemoveAttachment: fa.remove,
|
|
1486
|
+
onRetryAttachment: fa.retry,
|
|
1487
|
+
canAttachMore: fa.canAddMore,
|
|
1488
|
+
preparingAttachments: fa.preparingCount,
|
|
1489
|
+
onSaveTranscript: da,
|
|
1490
|
+
onContinueInChat: Ra,
|
|
1449
1491
|
onInterrupt: () => {
|
|
1450
|
-
$.interrupt(),
|
|
1492
|
+
$.interrupt(), Ii();
|
|
1451
1493
|
},
|
|
1452
|
-
spoken:
|
|
1494
|
+
spoken: ra,
|
|
1453
1495
|
onToggleMute: $.toggleMute,
|
|
1454
|
-
onEnd:
|
|
1455
|
-
proposalChip:
|
|
1456
|
-
label:
|
|
1457
|
-
onOpen:
|
|
1496
|
+
onEnd: Ba,
|
|
1497
|
+
proposalChip: wa ? {
|
|
1498
|
+
label: tt(wa, F),
|
|
1499
|
+
onOpen: Ca
|
|
1458
1500
|
} : null,
|
|
1459
|
-
proposalTray:
|
|
1501
|
+
proposalTray: Ea
|
|
1460
1502
|
}),
|
|
1461
|
-
/* @__PURE__ */
|
|
1462
|
-
open:
|
|
1463
|
-
mode:
|
|
1464
|
-
currentMode:
|
|
1465
|
-
onConfirm:
|
|
1466
|
-
onCancel:
|
|
1503
|
+
/* @__PURE__ */ P(Ln, {
|
|
1504
|
+
open: li !== null,
|
|
1505
|
+
mode: Ka,
|
|
1506
|
+
currentMode: Si ?? { id: U },
|
|
1507
|
+
onConfirm: Ga,
|
|
1508
|
+
onCancel: qa
|
|
1467
1509
|
}),
|
|
1468
|
-
/* @__PURE__ */
|
|
1469
|
-
...
|
|
1470
|
-
view:
|
|
1471
|
-
serverNow:
|
|
1472
|
-
arrivedAt:
|
|
1473
|
-
capabilities:
|
|
1474
|
-
turnInFlight:
|
|
1475
|
-
tr:
|
|
1510
|
+
/* @__PURE__ */ P(Lt, {
|
|
1511
|
+
...Lr.dialog,
|
|
1512
|
+
view: la?.view ?? Lr.dialog.view,
|
|
1513
|
+
serverNow: la?.serverNow ?? NaN,
|
|
1514
|
+
arrivedAt: la?.arrivedAt ?? NaN,
|
|
1515
|
+
capabilities: la ? Pr[la.session.sandboxId] : null,
|
|
1516
|
+
turnInFlight: jr,
|
|
1517
|
+
tr: F
|
|
1476
1518
|
})
|
|
1477
1519
|
]
|
|
1478
1520
|
});
|
|
1479
1521
|
};
|
|
1480
1522
|
//#endregion
|
|
1481
|
-
export {
|
|
1523
|
+
export { Jn as AssistantChatArea };
|