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