@burdenoff/fe-libs 2026.1004.8 → 2026.1005.1
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/api.d.ts +18 -0
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +169 -147
- package/dist/shared/assistant/capabilities.d.ts +21 -0
- package/dist/shared/assistant/capabilities.d.ts.map +1 -1
- package/dist/shared/assistant/capabilities.js +11 -1
- package/dist/shared/assistant/index.d.ts +4 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/liveDeltas.d.ts +76 -0
- package/dist/shared/assistant/liveDeltas.d.ts.map +1 -0
- package/dist/shared/assistant/liveDeltas.js +196 -0
- package/dist/shared/assistant/liveOverlay.d.ts +62 -0
- package/dist/shared/assistant/liveOverlay.d.ts.map +1 -0
- package/dist/shared/assistant/liveOverlay.js +64 -0
- package/dist/shared/assistant/snapshotPoller.d.ts +48 -0
- package/dist/shared/assistant/snapshotPoller.d.ts.map +1 -0
- package/dist/shared/assistant/snapshotPoller.js +58 -0
- package/dist/shared/assistant/turnStream.d.ts +71 -0
- package/dist/shared/assistant/turnStream.d.ts.map +1 -0
- package/dist/shared/assistant/turnStream.js +266 -0
- package/dist/shared/assistant/turnTimeline.d.ts +27 -2
- package/dist/shared/assistant/turnTimeline.d.ts.map +1 -1
- package/dist/shared/assistant/turnTimeline.js +17 -28
- package/dist/shared/assistant/types.d.ts +10 -0
- package/dist/shared/assistant/types.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +1049 -1008
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts +2 -0
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageList.js +48 -32
- package/dist/shared-assistant.js +208 -204
- package/package.json +1 -1
|
@@ -11,218 +11,222 @@ import { AUTO_READ_MODE as c, autoSuggestions as l, classifyAssistantIntent as u
|
|
|
11
11
|
import { getHistoryStamp as ee, setHistoryBusyProbe as m } from "../history/stampRegistry.js";
|
|
12
12
|
import { beginApprovalInFlight as te, endApprovalInFlight as h, getApprovalInFlight as g, markLiveTurn as ne, newestModelReplyId as _, resolveApprovablePendingWrite as v, resolveRetryableMessageId as y, subscribeApprovalInFlight as re } from "../liveTurns.js";
|
|
13
13
|
import { isWriteModeAcknowledged as ie, writeModeSendRefusalReason as ae } from "../writeModeConsent.js";
|
|
14
|
-
import { resolveActiveModeSandbox as
|
|
15
|
-
import { abortAssistantTurn as
|
|
14
|
+
import { resolveActiveModeSandbox as b, useAssistantStore as x } from "../store.js";
|
|
15
|
+
import { abortAssistantTurn as oe, approvePendingWrite as S, createAssistantSandbox as se, createAssistantSession as ce, extendAssistantSandboxTTL as le, findExistingSandboxWithStatus as ue, getAssistantArtifacts as de, getAssistantMessages as fe, getAssistantSession as C, mintAssistantTurnStream as pe, modeRequiresConfirmWrites as me, promptGatewayRequestBytes as he, releaseSupersededAssistantSandboxes as ge, sendAssistantPromptAsync as _e, waitForAssistantServiceReady as ve, waitForSandboxRunning as ye, writeApprovalModeOf as w } from "../api.js";
|
|
16
16
|
import { sanitize as be } from "../progress.js";
|
|
17
17
|
import { AssistantSendRefusal as xe, classifyTurnFailure as Se, turnConfirmsNoAction as Ce, turnOutcomeCopy as we } from "../turnOutcome.js";
|
|
18
18
|
import { assistantUsageLedger as Te, hasPendingUsageReports as Ee, reportUsageWithRetry as De, retryPendingUsageReports as Oe, usageSendRefusal as ke } from "../usageReporting.js";
|
|
19
19
|
import { withIncompleteTurnNotice as Ae } from "../streamBudget.js";
|
|
20
|
-
import { chatTurns as je, isVoiceTurn as Me, voiceMarker as
|
|
20
|
+
import { chatTurns as je, isVoiceTurn as Me, voiceMarker as T, voiceSessionIdOf as Ne } from "../voice/turnVisibility.js";
|
|
21
21
|
import { speechFeed as Pe } from "../speech/speechFeed.js";
|
|
22
|
-
import { isTurnSuperseded as
|
|
23
|
-
import { buildContinuedFromVoiceNote as
|
|
22
|
+
import { isTurnSuperseded as E, markTurnSuperseded as Fe } from "../voice/supersededTurns.js";
|
|
23
|
+
import { buildContinuedFromVoiceNote as Ie, buildVoiceTranscriptMarkdown as Le, voiceTranscriptFilename as Re } from "../voice/voiceTranscript.js";
|
|
24
24
|
import { pollDelayMs as ze } from "../voice/assistantPollSchedule.js";
|
|
25
|
-
import { toCaptionText as
|
|
26
|
-
import { resolveAssistantLanguage as
|
|
27
|
-
import { resolveLanguagePair as
|
|
28
|
-
import { INITIAL_TRANSCRIPT_AUTO_OPEN as
|
|
29
|
-
import { countInlineImageCandidates as
|
|
30
|
-
import { WRITE_PROPOSAL_VOICE_COPY as
|
|
31
|
-
import { createAdminModeAccessGate as
|
|
32
|
-
import { buildBoundedAttachmentTurn as
|
|
33
|
-
import { isTurnInFlight as
|
|
34
|
-
import { getAssistantDisplayContent as
|
|
35
|
-
import { NO_FIRST_TEXT as
|
|
36
|
-
import { parseToolActivity as
|
|
37
|
-
import { countSpokenTurns as
|
|
38
|
-
import { beginTurn as
|
|
39
|
-
import { useAssistantSpeech as
|
|
40
|
-
import { useVoiceSession as
|
|
41
|
-
import { getOrganizationId as
|
|
42
|
-
import { isMultimodalBodyRejection as
|
|
43
|
-
import { createReadinessTracker as
|
|
44
|
-
import { writeProposalConfirmState as
|
|
45
|
-
import { writeProposalUsesDialog as
|
|
46
|
-
import { AssistantWriteConfirmDialog as
|
|
47
|
-
import { useWriteProposalConfirm as
|
|
48
|
-
import { AssistantWriteProposalSlot as
|
|
49
|
-
import { readWriteProposalRefs as
|
|
50
|
-
import { planWriteReply as
|
|
51
|
-
import { useWriteProposals as
|
|
52
|
-
import { AssistantSpokenTurnsNotice as
|
|
53
|
-
import { AssistantHistoryArchivedNotice as
|
|
54
|
-
import { VoiceTranscriptDrawer as
|
|
55
|
-
import { downloadFile as
|
|
56
|
-
import { conversationHasHistory as
|
|
57
|
-
import { useAssistantHistoryStatus as
|
|
58
|
-
import { assistantHistory as
|
|
59
|
-
import { AssistantEmptyState as
|
|
60
|
-
import { AssistantNothingToDeleteNotice as
|
|
61
|
-
import { assistantHistoryIsOn as
|
|
62
|
-
import { useConversationDeleteDialog as
|
|
63
|
-
import { backDoneCopy as
|
|
64
|
-
import { appControlCopy as
|
|
65
|
-
import { useControlConfirmDialog as
|
|
66
|
-
import { resolveConversationDeleteTarget as
|
|
67
|
-
import { resumeContextFor as
|
|
68
|
-
import { useHistoryRowControlsFor as
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
25
|
+
import { toCaptionText as D } from "../voice/captionText.js";
|
|
26
|
+
import { resolveAssistantLanguage as Be } from "../voice/languages.js";
|
|
27
|
+
import { resolveLanguagePair as Ve } from "../voice/languagePair.js";
|
|
28
|
+
import { INITIAL_TRANSCRIPT_AUTO_OPEN as He, isAwaitingOwnConversation as Ue, maySendSpokenTurn as We, planTranscriptAutoOpen as Ge, planVoiceSessionBinding as Ke, planVoiceSessionStart as qe, planVoiceSpokenEntry as Je, voiceBindingAtStart as Ye, voiceBindingConversationId as Xe } from "../voice/voiceReopen.js";
|
|
29
|
+
import { countInlineImageCandidates as Ze, countInlinedImageParts as Qe, getSendableAttachments as $e, largestInlineCharsPerFile as et, resolveAssistantInlineLimits as tt, toMessageAttachment as nt } from "../attachments.js";
|
|
30
|
+
import { WRITE_PROPOSAL_VOICE_COPY as rt, isVoiceProposalBound as it, voiceProposalChip as at, voiceProposalChipText as ot, voiceReadbacksDue as st, voiceWaitingProposals as ct, writeProposalVoiceLine as lt, writeProposalVoiceReadback as ut } from "../writeProposalVoice.js";
|
|
31
|
+
import { createAdminModeAccessGate as dt, resolveAssistantSendModeAfterAccess as ft } from "../adminModeSendGate.js";
|
|
32
|
+
import { buildBoundedAttachmentTurn as pt } from "../attachmentTurn.js";
|
|
33
|
+
import { isTurnInFlight as mt, planAbandonedTurn as ht, planTurnAbort as gt } from "../turnState.js";
|
|
34
|
+
import { getAssistantDisplayContent as _t } from "../displayContent.js";
|
|
35
|
+
import { NO_FIRST_TEXT as vt, buildAssistantProgress as yt, readAheadFor as bt, snapshotReplyFloor as xt, startSessionReadAhead as St, trackFirstText as Ct } from "../turnProgress.js";
|
|
36
|
+
import { parseToolActivity as wt } from "./AssistantToolActivity.js";
|
|
37
|
+
import { countSpokenTurns as Tt, spokenMessagesSinceContinueNote as Et, spokenTurnText as Dt } from "../spokenTurns.js";
|
|
38
|
+
import { beginTurn as Ot, describeTurn as O, detectTurnDevice as kt, markTurn as k, restartAttempt as At, turnClockMs as jt } from "../turnTimeline.js";
|
|
39
|
+
import { useAssistantSpeech as Mt } from "./AssistantSpeechProvider.js";
|
|
40
|
+
import { useVoiceSession as Nt } from "./useVoiceSession.js";
|
|
41
|
+
import { getOrganizationId as Pt, getWorkspaceId as A } from "../context.js";
|
|
42
|
+
import { isMultimodalBodyRejection as Ft, isRecoverableAssistantError as It } from "../transportErrors.js";
|
|
43
|
+
import { createReadinessTracker as Lt, planAfterTransportFailure as Rt, planTrustedSandboxFailure as zt } from "../sandboxReadiness.js";
|
|
44
|
+
import { writeProposalConfirmState as Bt } from "./writeProposalPresentation.js";
|
|
45
|
+
import { writeProposalUsesDialog as Vt } from "./AssistantWriteProposalCard.js";
|
|
46
|
+
import { AssistantWriteConfirmDialog as Ht } from "./AssistantWriteConfirmDialog.js";
|
|
47
|
+
import { useWriteProposalConfirm as Ut } from "./useWriteProposalConfirm.js";
|
|
48
|
+
import { AssistantWriteProposalSlot as Wt } from "./AssistantWriteProposalSlot.js";
|
|
49
|
+
import { readWriteProposalRefs as Gt, writeProposalsEnabledFor as Kt } from "../writeProposalDiscovery.js";
|
|
50
|
+
import { planWriteReply as qt, promptWriteApproval as Jt } from "../writeReplySend.js";
|
|
51
|
+
import { useWriteProposals as Yt } from "./useWriteProposals.js";
|
|
52
|
+
import { AssistantSpokenTurnsNotice as Xt } from "./AssistantSpokenTurnsNotice.js";
|
|
53
|
+
import { AssistantHistoryArchivedNotice as Zt, AssistantHistoryDeletedNotice as Qt, AssistantHistoryLoadState as $t, AssistantHistoryReadOnlyBanner as en, AssistantHistoryShowEarlier as tn } from "./AssistantHistoryNotices.js";
|
|
54
|
+
import { VoiceTranscriptDrawer as nn } from "./voice/VoiceTranscriptDrawer.js";
|
|
55
|
+
import { downloadFile as rn } from "../exportConversation.js";
|
|
56
|
+
import { conversationHasHistory as an, isOtherScopeHistoryConversation as on, isReadOnlyHistoryConversation as sn, isReusableHistoryDraft as cn } from "../history/historyList.js";
|
|
57
|
+
import { useAssistantHistoryStatus as ln } from "../history/historyStatus.js";
|
|
58
|
+
import { assistantHistory as un } from "../history/historyEngine.js";
|
|
59
|
+
import { AssistantEmptyState as dn } from "./AssistantEmptyState.js";
|
|
60
|
+
import { AssistantNothingToDeleteNotice as fn } from "./AssistantDeleteConversationDialog.js";
|
|
61
|
+
import { assistantHistoryIsOn as pn } from "./conversationDelete.js";
|
|
62
|
+
import { useConversationDeleteDialog as mn } from "./conversationDeleteDialog.js";
|
|
63
|
+
import { backDoneCopy as hn, chooseDestinationCopy as gn, chooseLinkedCopy as _n, entityNounText as vn, linkNotOpenableCopy as yn, navigationCommandCopy as bn, navigationOutcomeCopy as xn, pickFromListCopy as Sn, recordChoiceCopy as Cn, recordKindsCopy as wn, themeCommandCopy as Tn } from "../localUiCommandCopy.js";
|
|
64
|
+
import { appControlCopy as En } from "../appControls/copy.js";
|
|
65
|
+
import { useControlConfirmDialog as Dn } from "./controlConfirmDialog.js";
|
|
66
|
+
import { resolveConversationDeleteTarget as On } from "../conversationDeleteCommand.js";
|
|
67
|
+
import { resumeContextFor as kn } from "../history/historyResume.js";
|
|
68
|
+
import { useHistoryRowControlsFor as An } from "../history/useHistoryRowControls.js";
|
|
69
|
+
import { liveCoverage as jn } from "../liveDeltas.js";
|
|
70
|
+
import { createLiveRender as Mn } from "../liveOverlay.js";
|
|
71
|
+
import { AssistantMessageList as Nn } from "./AssistantMessageList.js";
|
|
72
|
+
import { AssistantVoiceSession as Pn } from "./voice/AssistantVoiceSession.js";
|
|
73
|
+
import { useAssistantApiAccess as Fn } from "../useAssistantApiAccess.js";
|
|
74
|
+
import { useConversationTurns as In } from "../useConversationTurns.js";
|
|
75
|
+
import { openTurnStream as Ln, turnStreamAvailable as Rn } from "../turnStream.js";
|
|
76
|
+
import { createSnapshotPoller as zn } from "../snapshotPoller.js";
|
|
77
|
+
import { sendAssistantTurnTimings as Bn, startTurnTimingReporting as Vn } from "../turnTimingReporter.js";
|
|
78
|
+
import { QuarantineSet as Hn, WarmCancelled as Un, claimPreopenedSession as Wn, consumeWarm as Gn, preopenKey as Kn, preopenWanted as qn, prewarmTarget as Jn, settleWarmBeforeSend as Yn, startPreopen as Xn, startWarm as Zn, warmState as Qn } from "../prewarm.js";
|
|
79
|
+
import { isThereRequest as $n, parseChoice as er } from "../uiActions/deixis.js";
|
|
80
|
+
import { navEntryIds as tr } from "../uiActions/resolveTarget.js";
|
|
81
|
+
import { lookupNamedRecords as nr } from "../uiActions/recordNames.js";
|
|
82
|
+
import { isAlreadyThere as rr, matchLocalUiCommand as ir, navDestinations as ar, normaliseUtterance as or, planThemeChange as sr } from "../localUiCommands.js";
|
|
83
|
+
import { runNavigation as cr } from "../uiActions/navigationOutcome.js";
|
|
84
|
+
import { assistantBackStack as lr, isBackRunnable as ur } from "../uiActions/backStack.js";
|
|
85
|
+
import { buildNavigateAction as dr, destinationForPath as fr, labelForPath as pr, newestAssistantOnSurface as mr } from "../uiActions/navigateAction.js";
|
|
86
|
+
import { buildNavigationContext as hr, latestReplyOnSurface as gr, rememberPresentedList as _r } from "../uiActions/linkContext.js";
|
|
87
|
+
import { buildUiCatalogue as vr } from "../uiActions/uiCatalogue.js";
|
|
88
|
+
import { readControlSnapshot as yr } from "../appControls/snapshot.js";
|
|
89
|
+
import { planAppControl as br } from "../appControls/plan.js";
|
|
90
|
+
import { dispatchAssistantQuotaExhausted as xr, notifyAiCreditsUpdated as Sr } from "../aiCredits.js";
|
|
91
|
+
import { useAssistantAttachments as Cr } from "../useAssistantAttachments.js";
|
|
92
|
+
import { AssistantComposer as wr } from "./composer/AssistantComposer.js";
|
|
93
|
+
import { isProdRuntime as Tr } from "../env.js";
|
|
94
|
+
import { AssistantApiCallsConsentDialog as Er } from "./AssistantApiCallsConsentDialog.js";
|
|
95
|
+
import { useVisibleNavItems as Dr } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
|
|
96
|
+
import { useCallback as j, useEffect as M, useMemo as Or, useRef as N, useState as kr, useSyncExternalStore as Ar } from "react";
|
|
97
|
+
import { jsx as P, jsxs as jr } from "react/jsx-runtime";
|
|
94
98
|
//#region src/shared/assistant/ui/AssistantChatArea.tsx
|
|
95
|
-
var
|
|
96
|
-
function
|
|
99
|
+
var Mr = 2500, Nr = 600, Pr = 2e4, Fr = 1e4, Ir = 6e3;
|
|
100
|
+
function F() {
|
|
97
101
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
98
102
|
}
|
|
99
|
-
var
|
|
100
|
-
let
|
|
101
|
-
let n =
|
|
102
|
-
return
|
|
103
|
+
var Lr = ({ visible: Lr = !0, writeAccess: Rr = "unknown" }) => {
|
|
104
|
+
let I = a(), { product: L, modes: R, gatherPageContext: zr, buildPrompt: Br, reportTurnTimings: Vr, reportTokenUsage: Hr, localUiCommands: Ur } = i(), z = w(i().writeApproval), Wr = j((e, t) => {
|
|
105
|
+
let n = x.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
|
|
106
|
+
return it({
|
|
103
107
|
mode: e,
|
|
104
|
-
productWriteApproval:
|
|
108
|
+
productWriteApproval: z,
|
|
105
109
|
capabilities: r ? n.sandboxWriteCapabilities[r] : null
|
|
106
110
|
});
|
|
107
|
-
}, [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
]),
|
|
112
|
-
tr:
|
|
113
|
-
productWriteApproval:
|
|
114
|
-
}),
|
|
111
|
+
}, [z]), { getAccessToken: B, getWorkspaceToken: Gr, userId: V } = n(), { locale: H } = t(), Kr = x((e) => e.voiceGraceMs), qr = x((e) => e.assistantLanguage), Jr = x((e) => e.replyLanguage), Yr = Or(() => Ve(qr, Jr, H), [
|
|
112
|
+
qr,
|
|
113
|
+
Jr,
|
|
114
|
+
H
|
|
115
|
+
]), Xr = Yr.reply.english, Zr = Yr.replyIsExplicit, Qr = Yr.reply.code, { conversations: $r, activeConversationId: U, mode: W, processingByConversationId: ei, setMode: ti, setConversationMode: ni, setActiveConversation: ri, createConversation: ii, addMessage: G, updateMessage: ai, patchMessage: oi, mergeMessageMetadata: si, setConversationProcessing: ci, clearConversationProcessing: li, setBackendSessionId: ui, clearBackendSessionId: di, setSandbox: fi, clearSandbox: pi, acknowledgedWriteModes: mi, acknowledgeWriteMode: hi, autoRouting: gi, setAutoRouting: _i, routeConversation: vi } = x(), yi = $r.find((e) => e.id === U), bi = In(yi), xi = bi.all, K = U ? ei[U] : void 0, Si = mt(K?.status), Ci = Si ? K?.messageId ?? null : null, wi = K?.status === "error" ? K.messageId : null, Ti = x((e) => e.sandboxWriteCapabilities), { panel: q, entries: Ei, retiredSandboxes: Di } = Yt({
|
|
116
|
+
tr: I,
|
|
117
|
+
productWriteApproval: z
|
|
118
|
+
}), Oi = Ut({
|
|
115
119
|
approve: (e, t) => q.approve(e, t),
|
|
116
120
|
decline: (e, t, n) => q.decline(e, t, n),
|
|
117
121
|
presented: (e, t) => q.presented(e, t)
|
|
118
|
-
}),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
let e =
|
|
122
|
-
|
|
122
|
+
}), ki = Oi.dismiss, Ai = N(null);
|
|
123
|
+
M(() => {
|
|
124
|
+
ki();
|
|
125
|
+
let e = Ai.current;
|
|
126
|
+
Ai.current = U, e && e !== U && q.withdraw(e, "conversation_closed"), U && q.openConversation(U);
|
|
123
127
|
}, [
|
|
124
|
-
|
|
128
|
+
U,
|
|
125
129
|
q,
|
|
126
|
-
|
|
130
|
+
ki
|
|
127
131
|
]);
|
|
128
|
-
let
|
|
129
|
-
|
|
130
|
-
if (
|
|
131
|
-
let e = window.setTimeout(() =>
|
|
132
|
+
let ji = sn(yi), Mi = An(yi)?.archivedAt != null, Ni = ln((e) => U !== null && U in e.loadingIds), Pi = ln((e) => U !== null && U in e.loadErrorIds), Fi = ln((e) => e.remoteDelete), [Ii, Li] = kr(() => ln.getState().remoteDelete?.at ?? null), Ri = Fi?.wasActive === !0 && Fi.at !== Ii ? Fi.at : null;
|
|
133
|
+
M(() => {
|
|
134
|
+
if (Ri === null) return;
|
|
135
|
+
let e = window.setTimeout(() => Li(Ri), Fr);
|
|
132
136
|
return () => window.clearTimeout(e);
|
|
133
|
-
}, [
|
|
134
|
-
let { canUseApiCalls:
|
|
135
|
-
loading:
|
|
136
|
-
canUseAdminModes:
|
|
137
|
-
})).current,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}, [
|
|
141
|
-
let
|
|
142
|
-
let e =
|
|
143
|
-
e &&
|
|
144
|
-
},
|
|
145
|
-
let e =
|
|
146
|
-
e &&
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}, [
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
if (
|
|
154
|
-
workspaceId:
|
|
137
|
+
}, [Ri]);
|
|
138
|
+
let { canUseApiCalls: zi, loading: Bi } = Fn(A(), V), Vi = N(dt({
|
|
139
|
+
loading: Bi,
|
|
140
|
+
canUseAdminModes: zi
|
|
141
|
+
})).current, Hi = N(R);
|
|
142
|
+
M(() => {
|
|
143
|
+
Hi.current = R;
|
|
144
|
+
}, [R]);
|
|
145
|
+
let Ui = () => {
|
|
146
|
+
let e = x.getState().activeConversationId;
|
|
147
|
+
e && un.openConversation(e, { modes: Hi.current });
|
|
148
|
+
}, Wi = () => {
|
|
149
|
+
let e = x.getState().activeConversationId;
|
|
150
|
+
e && un.loadEarlier(e);
|
|
151
|
+
}, Gi = N(B);
|
|
152
|
+
M(() => {
|
|
153
|
+
Gi.current = B;
|
|
154
|
+
}, [B]);
|
|
155
|
+
let Ki = !!L && Vr !== !1;
|
|
156
|
+
M(() => {
|
|
157
|
+
if (Ki) return Vn({ send: (e) => Bn(e, {
|
|
158
|
+
workspaceId: A(),
|
|
155
159
|
authContext: {
|
|
156
|
-
accessToken:
|
|
157
|
-
organizationId:
|
|
160
|
+
accessToken: Gi.current(),
|
|
161
|
+
organizationId: Pt()
|
|
158
162
|
}
|
|
159
163
|
}) });
|
|
160
|
-
}, [
|
|
161
|
-
|
|
162
|
-
loading:
|
|
163
|
-
canUseAdminModes:
|
|
164
|
+
}, [Ki]), M(() => {
|
|
165
|
+
Vi.update({
|
|
166
|
+
loading: Bi,
|
|
167
|
+
canUseAdminModes: zi
|
|
164
168
|
});
|
|
165
169
|
}, [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
]),
|
|
170
|
-
|
|
171
|
-
}, [
|
|
172
|
-
let
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}, [
|
|
176
|
-
let
|
|
177
|
-
|
|
170
|
+
Vi,
|
|
171
|
+
Bi,
|
|
172
|
+
zi
|
|
173
|
+
]), M(() => () => {
|
|
174
|
+
Vi.abandon();
|
|
175
|
+
}, [Vi]);
|
|
176
|
+
let qi = Or(() => R.filter((e) => !e.requiresAdmin || zi), [R, zi]), Ji = f(qi), Yi = gi && Ji, Xi = N(Ji);
|
|
177
|
+
M(() => {
|
|
178
|
+
Xi.current = Ji;
|
|
179
|
+
}, [Ji]);
|
|
180
|
+
let Zi = N(null), Qi = N(!1), $i = et(R), [ea, ta] = kr(null), [na, ra] = kr(null), ia = na !== null && na === U, aa = j((e) => {
|
|
181
|
+
ra(e ? x.getState().activeConversationId : null);
|
|
178
182
|
}, []);
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}, [
|
|
182
|
-
let
|
|
183
|
-
|
|
184
|
-
}, []),
|
|
185
|
-
let e =
|
|
183
|
+
M(() => {
|
|
184
|
+
ra((e) => e !== null && e !== U ? null : e);
|
|
185
|
+
}, [U]);
|
|
186
|
+
let oa = N(void 0), [sa, ca] = kr(!1), la = j((e) => {
|
|
187
|
+
oa.current = e, ca(Ue(e));
|
|
188
|
+
}, []), ua = j(() => {
|
|
189
|
+
let e = x.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
|
|
186
190
|
return !t || !n ? null : {
|
|
187
191
|
id: t,
|
|
188
|
-
reusableDraft:
|
|
192
|
+
reusableDraft: cn(n, ee()),
|
|
189
193
|
liveProposals: q.liveFor(t).count,
|
|
190
|
-
turnInFlight:
|
|
194
|
+
turnInFlight: mt(e.processingByConversationId[t]?.status)
|
|
191
195
|
};
|
|
192
|
-
}, [q]),
|
|
193
|
-
let t = e.sandboxesByMode[
|
|
196
|
+
}, [q]), da = N({}), J = N(Lt()), Y = N(new Hn()), fa = N(/* @__PURE__ */ new Set()), pa = Or(() => R.find((e) => e.id === W), [R, W]), ma = x((e) => {
|
|
197
|
+
let t = e.sandboxesByMode[W]?.sandboxId;
|
|
194
198
|
return t ? e.sandboxWriteCapabilities[t] : void 0;
|
|
195
|
-
}),
|
|
196
|
-
mode:
|
|
197
|
-
productWriteApproval:
|
|
198
|
-
capabilities:
|
|
199
|
-
}),
|
|
200
|
-
|
|
201
|
-
if (
|
|
202
|
-
|
|
199
|
+
}), ha = pa !== void 0 && it({
|
|
200
|
+
mode: W,
|
|
201
|
+
productWriteApproval: z,
|
|
202
|
+
capabilities: ma
|
|
203
|
+
}), ga = W === "assistant" || pa !== void 0 && !pa.writeCapable && !me(W) || ha;
|
|
204
|
+
M(() => {
|
|
205
|
+
if (W !== "assistant" && pa?.writeCapable && !ie(mi, W)) {
|
|
206
|
+
ti("assistant");
|
|
203
207
|
return;
|
|
204
208
|
}
|
|
205
|
-
|
|
209
|
+
Bi || (!pa || pa.requiresAdmin && !zi) && W !== "assistant" && ti("assistant");
|
|
206
210
|
}, [
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
W,
|
|
212
|
+
pa,
|
|
213
|
+
zi,
|
|
214
|
+
Bi,
|
|
215
|
+
ti,
|
|
216
|
+
mi
|
|
213
217
|
]);
|
|
214
|
-
let
|
|
215
|
-
|
|
216
|
-
}, [
|
|
218
|
+
let _a = j((e, t, n, r) => {
|
|
219
|
+
ci(e, n, t, null, r);
|
|
220
|
+
}, [ci]), va = j(async (e, t, n, r, i, a = null) => {
|
|
217
221
|
let o = (e, t) => {
|
|
218
|
-
r &&
|
|
222
|
+
r && _a(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
|
|
219
223
|
}, c = (e) => {
|
|
220
|
-
r &&
|
|
224
|
+
r && k(r.assistantMessageId, e);
|
|
221
225
|
}, l = () => {
|
|
222
226
|
c("bootAdopted"), a?.beginBoot();
|
|
223
|
-
}, u = () => a !== null && (a.signal.aborted ||
|
|
224
|
-
if (u()) throw new
|
|
225
|
-
}, f =
|
|
227
|
+
}, u = () => a !== null && (a.signal.aborted || A() !== t), d = () => {
|
|
228
|
+
if (u()) throw new Un("cancelled");
|
|
229
|
+
}, f = x.getState().sandboxesByMode[e]?.sandboxId ?? null, p = !1, ee = !1, m = !1, te = !1, h = !1, g = async (r) => {
|
|
226
230
|
if (i && !Y.current.has(r) && J.current.isFresh(r)) return p = !0, !0;
|
|
227
231
|
m = !0;
|
|
228
232
|
let o = !1;
|
|
@@ -231,43 +235,43 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
231
235
|
o = !0, l();
|
|
232
236
|
});
|
|
233
237
|
} catch {
|
|
234
|
-
if (u()) throw new
|
|
238
|
+
if (u()) throw new Un("cancelled");
|
|
235
239
|
return J.current.invalidate(r), Y.current.add(r), a?.dead.push(r), h = !0, !1;
|
|
236
240
|
}
|
|
237
241
|
return d(), J.current.markVerified(r), o && (te = !0), !0;
|
|
238
242
|
};
|
|
239
|
-
if (f && (
|
|
243
|
+
if (f && (fi(e, f, "provisioning"), o("provisioning", "reusingEnvironment"), await g(f) || (fi(e, null, "provisioning"), f = null)), !f) {
|
|
240
244
|
o("provisioning", "lookingForEnvironment");
|
|
241
|
-
let r = await
|
|
245
|
+
let r = await ue(t, L, e, Tr(), n, Y.current, z);
|
|
242
246
|
d();
|
|
243
247
|
let i = r?.id ?? null;
|
|
244
248
|
if (i) {
|
|
245
|
-
|
|
249
|
+
fi(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
|
|
246
250
|
let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
|
|
247
|
-
t && l(), await g(i) ? (f = i, t && (te = !0)) :
|
|
251
|
+
t && l(), await g(i) ? (f = i, t && (te = !0)) : fi(e, null, "provisioning");
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
254
|
if (!f) {
|
|
251
|
-
if (a && !a.mayCreate) throw new
|
|
252
|
-
if (c("provisionStarted"), e === "api-calls" && !
|
|
253
|
-
o("provisioning", "startingEnvironment"),
|
|
254
|
-
let r = a ? [] : await ge(t,
|
|
255
|
+
if (a && !a.mayCreate) throw new Un("no-create");
|
|
256
|
+
if (c("provisionStarted"), e === "api-calls" && !B()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
257
|
+
o("provisioning", "startingEnvironment"), fi(e, null, "provisioning");
|
|
258
|
+
let r = a ? [] : await ge(t, L, e, Tr(), n, Y.current, z);
|
|
255
259
|
if (r.length > 0) {
|
|
256
260
|
let e = new Set(r);
|
|
257
261
|
for (let e of r) J.current.invalidate(e), Y.current.add(e);
|
|
258
|
-
let t =
|
|
259
|
-
for (let [n, r] of Object.entries(t)) s(n) && r?.sandboxId && e.has(r.sandboxId) &&
|
|
262
|
+
let t = x.getState().sandboxesByMode;
|
|
263
|
+
for (let [n, r] of Object.entries(t)) s(n) && r?.sandboxId && e.has(r.sandboxId) && pi(n);
|
|
260
264
|
}
|
|
261
265
|
c("createRequested");
|
|
262
266
|
let i = a?.beginCreate();
|
|
263
267
|
try {
|
|
264
|
-
f = await
|
|
268
|
+
f = await se(L, e, t, Tr(), Nr, n, { writeApproval: z });
|
|
265
269
|
} finally {
|
|
266
270
|
i?.();
|
|
267
271
|
}
|
|
268
|
-
ee = !0, d(),
|
|
272
|
+
ee = !0, d(), fi(e, f, "provisioning"), await ye(f, t, n, 3e5), d(), c("sandboxRunning"), await ve(f, t, e, n, 9e4), d(), c("serviceReady"), J.current.markVerified(f);
|
|
269
273
|
}
|
|
270
|
-
return
|
|
274
|
+
return fi(e, f, "running"), {
|
|
271
275
|
sandboxId: f,
|
|
272
276
|
sandboxIsNew: ee,
|
|
273
277
|
sandboxProbed: m,
|
|
@@ -276,64 +280,64 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
276
280
|
trustedFromCache: p
|
|
277
281
|
};
|
|
278
282
|
}, [
|
|
279
|
-
|
|
283
|
+
pi,
|
|
284
|
+
B,
|
|
285
|
+
L,
|
|
280
286
|
z,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
]), pa = k(async function e(t, n, r, i, a, o = {}) {
|
|
286
|
-
let s = await Gn(i, r, (e) => da(t, n, "provisioning", e), () => D(n, "prewarmJoined"));
|
|
287
|
+
fi,
|
|
288
|
+
_a
|
|
289
|
+
]), ya = j(async function e(t, n, r, i, a, o = {}) {
|
|
290
|
+
let s = await Yn(i, r, (e) => _a(t, n, "provisioning", e), () => k(n, "prewarmJoined"));
|
|
287
291
|
for (let e of s.dead) J.current.invalidate(e), Y.current.add(e);
|
|
288
|
-
s.verified && !Y.current.has(s.verified) && J.current.markVerified(s.verified), s.joined &&
|
|
289
|
-
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await
|
|
292
|
+
s.verified && !Y.current.has(s.verified) && J.current.markVerified(s.verified), s.joined && O(n, { prewarm: s.joined });
|
|
293
|
+
let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await va(r, i, a, {
|
|
290
294
|
conversationId: t,
|
|
291
295
|
assistantMessageId: n
|
|
292
|
-
}, o.trustCache !== !1), ee =
|
|
293
|
-
!s.waited && ee &&
|
|
294
|
-
let m =
|
|
296
|
+
}, o.trustCache !== !1), ee = Gn(i, r, c);
|
|
297
|
+
!s.waited && ee && O(n, { prewarm: "hit" });
|
|
298
|
+
let m = x.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, te = !1, h = null;
|
|
295
299
|
if (m) {
|
|
296
|
-
let e =
|
|
300
|
+
let e = St(c, m, (e, t) => fe(e, i, t, r, a, { limit: 50 }));
|
|
297
301
|
try {
|
|
298
|
-
let t = await
|
|
302
|
+
let t = await C(c, i, m, r, a);
|
|
299
303
|
if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
|
|
300
304
|
h = e;
|
|
301
305
|
} catch {
|
|
302
|
-
|
|
306
|
+
di(t), m = null;
|
|
303
307
|
}
|
|
304
308
|
}
|
|
305
309
|
let g = !1;
|
|
306
310
|
if (!m) {
|
|
307
|
-
let e =
|
|
311
|
+
let e = Wn(Kn({
|
|
308
312
|
workspaceId: i,
|
|
309
313
|
mode: r,
|
|
310
314
|
sandboxId: c,
|
|
311
|
-
userId:
|
|
315
|
+
userId: V
|
|
312
316
|
}), Date.now());
|
|
313
317
|
if (e) {
|
|
314
|
-
"pending" in e &&
|
|
318
|
+
"pending" in e && _a(t, n, "connecting", "preparingSession");
|
|
315
319
|
let o = "sessionId" in e ? e.sessionId : await e.pending;
|
|
316
320
|
if (o && !Y.current.has(c)) try {
|
|
317
|
-
(await
|
|
321
|
+
(await C(c, i, o, r, a)).mode === r && (m = o, g = !0, ui(t, m), te = !0);
|
|
318
322
|
} catch {}
|
|
319
323
|
}
|
|
320
324
|
}
|
|
321
325
|
if (!m) {
|
|
322
|
-
|
|
326
|
+
_a(t, n, "connecting", "preparingSession");
|
|
323
327
|
let s;
|
|
324
328
|
try {
|
|
325
|
-
s = await
|
|
329
|
+
s = await ce(c, i, r, a);
|
|
326
330
|
} catch (s) {
|
|
327
331
|
if (p) {
|
|
328
332
|
J.current.invalidate(c);
|
|
329
|
-
let l =
|
|
330
|
-
if (l === "check-network" && (l = await
|
|
331
|
-
p ||
|
|
333
|
+
let l = zt(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
|
|
334
|
+
if (l === "check-network" && (l = await Rt(() => ue(i, L, r, Tr(), a, Y.current, z))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
|
|
335
|
+
p || O(n, { cacheProofFailed: !0 }), l === "replace" && (Y.current.add(c), di(t), pi(r), q.retireSandbox(c));
|
|
332
336
|
let s = await e(t, n, r, i, a, {
|
|
333
337
|
...o,
|
|
334
338
|
trustCache: !1
|
|
335
339
|
});
|
|
336
|
-
return p && (s.deadSandboxProbe || s.sandboxId !== c) &&
|
|
340
|
+
return p && (s.deadSandboxProbe || s.sandboxId !== c) && O(n, { cacheProofFailed: !0 }), {
|
|
337
341
|
...s,
|
|
338
342
|
sandboxProbed: s.sandboxProbed || u,
|
|
339
343
|
sandboxAdopted: s.sandboxAdopted || d,
|
|
@@ -343,7 +347,7 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
343
347
|
}
|
|
344
348
|
throw s;
|
|
345
349
|
}
|
|
346
|
-
m = s.sessionId,
|
|
350
|
+
m = s.sessionId, ui(t, m), te = !0;
|
|
347
351
|
}
|
|
348
352
|
return {
|
|
349
353
|
sandboxId: c,
|
|
@@ -357,67 +361,67 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
357
361
|
sessionPreopened: g
|
|
358
362
|
};
|
|
359
363
|
}, [
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
364
|
+
va,
|
|
365
|
+
di,
|
|
366
|
+
pi,
|
|
367
|
+
L,
|
|
368
|
+
z,
|
|
369
|
+
ui,
|
|
370
|
+
_a,
|
|
371
|
+
V,
|
|
368
372
|
q
|
|
369
|
-
]),
|
|
370
|
-
let n =
|
|
373
|
+
]), ba = j((e, t = !1) => {
|
|
374
|
+
let n = A();
|
|
371
375
|
if (!n) return;
|
|
372
|
-
let r =
|
|
376
|
+
let r = x.getState(), i = Date.now(), a = Jn({
|
|
373
377
|
autoRouting: r.autoRouting,
|
|
374
|
-
autoOffered:
|
|
378
|
+
autoOffered: Xi.current,
|
|
375
379
|
active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
|
|
376
380
|
selectedMode: r.mode,
|
|
377
381
|
autoReadMode: c,
|
|
378
|
-
modes:
|
|
382
|
+
modes: Hi.current,
|
|
379
383
|
acknowledgedWriteModes: r.acknowledgedWriteModes,
|
|
380
|
-
adminAccess:
|
|
384
|
+
adminAccess: Vi.read(),
|
|
381
385
|
dictated: e,
|
|
382
|
-
voiceProposalBound: (e) =>
|
|
383
|
-
turnInFlight: Object.values(r.processingByConversationId).some((e) =>
|
|
384
|
-
...
|
|
386
|
+
voiceProposalBound: (e) => Wr(e),
|
|
387
|
+
turnInFlight: Object.values(r.processingByConversationId).some((e) => mt(e?.status)),
|
|
388
|
+
...Qn(n),
|
|
385
389
|
now: i
|
|
386
390
|
});
|
|
387
391
|
if (!a) return;
|
|
388
|
-
let o =
|
|
389
|
-
accessToken:
|
|
390
|
-
workspaceToken:
|
|
391
|
-
userId:
|
|
392
|
-
organizationId:
|
|
392
|
+
let o = Zn(n, a, i), s = {
|
|
393
|
+
accessToken: B(),
|
|
394
|
+
workspaceToken: Gr(),
|
|
395
|
+
userId: V,
|
|
396
|
+
organizationId: Pt()
|
|
393
397
|
};
|
|
394
|
-
|
|
398
|
+
va(a.mode, n, s, null, !0, o).then((e) => {
|
|
395
399
|
if (o.finish({
|
|
396
400
|
ok: !0,
|
|
397
401
|
sandboxId: e.sandboxId,
|
|
398
402
|
didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
|
|
399
403
|
booted: e.sandboxIsNew || e.sandboxAdopted,
|
|
400
404
|
dead: o.dead
|
|
401
|
-
}), o.signal.aborted ||
|
|
402
|
-
let r =
|
|
403
|
-
|
|
405
|
+
}), o.signal.aborted || A() !== n || Y.current.has(e.sandboxId)) return;
|
|
406
|
+
let r = x.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = ee();
|
|
407
|
+
qn({
|
|
404
408
|
active: i ? {
|
|
405
409
|
mode: i.mode,
|
|
406
410
|
backendSessionId: i.backendSessionId,
|
|
407
|
-
continuable: !
|
|
408
|
-
hasHistory:
|
|
411
|
+
continuable: !sn(i) && !on(i, c),
|
|
412
|
+
hasHistory: an(i)
|
|
409
413
|
} : void 0,
|
|
410
414
|
mode: a.mode
|
|
411
|
-
}) && Kn(
|
|
415
|
+
}) && Xn(Kn({
|
|
412
416
|
workspaceId: n,
|
|
413
417
|
mode: a.mode,
|
|
414
418
|
sandboxId: e.sandboxId,
|
|
415
|
-
userId:
|
|
416
|
-
}), () =>
|
|
419
|
+
userId: V
|
|
420
|
+
}), () => ce(e.sandboxId, n, a.mode, s).then((e) => e.sessionId), Date.now());
|
|
417
421
|
}, (e) => {
|
|
418
|
-
if (!(e instanceof
|
|
419
|
-
let e =
|
|
420
|
-
e && (J.current.invalidate(e), Y.current.add(e), o.dead.push(e),
|
|
422
|
+
if (!(e instanceof Un) && !o.signal.aborted && A() === n) {
|
|
423
|
+
let e = x.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
|
|
424
|
+
e && (J.current.invalidate(e), Y.current.add(e), o.dead.push(e), pi(a.mode));
|
|
421
425
|
}
|
|
422
426
|
o.finish({
|
|
423
427
|
ok: !1,
|
|
@@ -427,50 +431,50 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
427
431
|
});
|
|
428
432
|
});
|
|
429
433
|
}, [
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
z,
|
|
434
|
-
Br,
|
|
434
|
+
va,
|
|
435
|
+
Vi,
|
|
436
|
+
pi,
|
|
435
437
|
B,
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
Gr,
|
|
439
|
+
V,
|
|
440
|
+
Wr
|
|
441
|
+
]), xa = j(() => ba(!1), [ba]), Sa = Ar(re, g, g)?.reference ?? null, [Ca, wa] = kr(0), Ta = N(/* @__PURE__ */ new Set()), Ea = N(null), Da = j(() => {
|
|
442
|
+
let e = x.getState(), t = e.activeConversationId;
|
|
439
443
|
if (!t) return null;
|
|
440
|
-
let n = e.processingByConversationId[t], r =
|
|
441
|
-
if (!
|
|
444
|
+
let n = e.processingByConversationId[t], r = mt(n?.status) ? n?.messageId ?? null : null;
|
|
445
|
+
if (!gt({
|
|
442
446
|
interruptedTurnId: r,
|
|
443
447
|
activeTurnId: r,
|
|
444
|
-
alreadyRequested: r ?
|
|
448
|
+
alreadyRequested: r ? Ta.current.has(r) : !1
|
|
445
449
|
}).send || !r) return null;
|
|
446
|
-
|
|
447
|
-
let i =
|
|
448
|
-
return !i || !a || !o ||
|
|
449
|
-
accessToken:
|
|
450
|
-
workspaceToken:
|
|
451
|
-
userId:
|
|
452
|
-
organizationId:
|
|
450
|
+
Ta.current.add(r);
|
|
451
|
+
let i = b(e), a = A(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
|
|
452
|
+
return !i || !a || !o || oe(i.sandboxId, a, o, i.mode, {
|
|
453
|
+
accessToken: B(),
|
|
454
|
+
workspaceToken: Gr(),
|
|
455
|
+
userId: V,
|
|
456
|
+
organizationId: Pt()
|
|
453
457
|
}), r;
|
|
454
458
|
}, [
|
|
459
|
+
V,
|
|
455
460
|
B,
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
if (!n || !r || !i || qt(t.sandboxWriteCapabilities[n.sandboxId])) return;
|
|
461
|
+
Gr
|
|
462
|
+
]), Oa = j(() => {
|
|
463
|
+
let e = Da();
|
|
464
|
+
return e && (Fe(e), Pe.abort(e)), e;
|
|
465
|
+
}, [Da]), ka = j(() => {
|
|
466
|
+
let e = x.getState().activeConversationId;
|
|
467
|
+
Oa(), e && q.declineForReply(e, "corrected", "spoken");
|
|
468
|
+
}, [Oa, q]), Aa = j(async (e) => {
|
|
469
|
+
let t = x.getState(), n = b(t), r = A(), i = t.activeConversationId;
|
|
470
|
+
if (!n || !r || !i || Kt(t.sandboxWriteCapabilities[n.sandboxId])) return;
|
|
467
471
|
let a = t.conversations.find((e) => e.id === i), o = a ? v(je(a.messages), {
|
|
468
472
|
sessionId: a.backendSessionId,
|
|
469
473
|
sandboxId: n.sandboxId,
|
|
470
474
|
nowMs: Date.now()
|
|
471
475
|
}) : null;
|
|
472
476
|
if (o?.reference !== e) {
|
|
473
|
-
|
|
477
|
+
wa((e) => e + 1);
|
|
474
478
|
return;
|
|
475
479
|
}
|
|
476
480
|
let s = {
|
|
@@ -479,97 +483,97 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
479
483
|
};
|
|
480
484
|
if (!te(s)) return;
|
|
481
485
|
try {
|
|
482
|
-
await
|
|
483
|
-
accessToken:
|
|
484
|
-
workspaceToken:
|
|
485
|
-
userId:
|
|
486
|
-
organizationId:
|
|
486
|
+
await S(n.sandboxId, r, e, n.mode, {
|
|
487
|
+
accessToken: B(),
|
|
488
|
+
workspaceToken: Gr(),
|
|
489
|
+
userId: V,
|
|
490
|
+
organizationId: Pt()
|
|
487
491
|
});
|
|
488
492
|
} catch (e) {
|
|
489
493
|
h(s), G(i, {
|
|
490
|
-
id:
|
|
494
|
+
id: F(),
|
|
491
495
|
role: "system",
|
|
492
496
|
content: e instanceof Error ? e.message : "The change could not be approved.",
|
|
493
497
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
494
498
|
});
|
|
495
499
|
return;
|
|
496
500
|
}
|
|
497
|
-
h(s),
|
|
498
|
-
let c =
|
|
499
|
-
c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId ||
|
|
501
|
+
h(s), si(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
502
|
+
let c = x.getState(), l = c.conversations.find((e) => e.id === i);
|
|
503
|
+
c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || b(c)?.sandboxId !== n.sandboxId || mt(c.processingByConversationId[i]?.status) || _(je(l.messages)) !== o.messageId || ao.current(I("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
|
|
500
504
|
approvalFollowUp: { approvedReplyId: o.messageId },
|
|
501
505
|
targetConversationId: i
|
|
502
506
|
});
|
|
503
507
|
}, [
|
|
504
|
-
|
|
508
|
+
V,
|
|
505
509
|
G,
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
]),
|
|
509
|
-
theme:
|
|
510
|
-
navigate:
|
|
511
|
-
navItems:
|
|
512
|
-
options:
|
|
513
|
-
navPermissionsSettled:
|
|
514
|
-
navSimulating:
|
|
510
|
+
si,
|
|
511
|
+
I
|
|
512
|
+
]), ja = e(), { speakFinishedReply: Ma } = Mt(), Na = o(), { items: Pa, permissionsSettled: Fa, simulating: Ia } = Dr(), La = N({
|
|
513
|
+
theme: ja,
|
|
514
|
+
navigate: Na,
|
|
515
|
+
navItems: Pa,
|
|
516
|
+
options: Ur ?? {},
|
|
517
|
+
navPermissionsSettled: Fa,
|
|
518
|
+
navSimulating: Ia
|
|
515
519
|
});
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
theme:
|
|
519
|
-
navigate:
|
|
520
|
-
navItems:
|
|
521
|
-
options:
|
|
522
|
-
navPermissionsSettled:
|
|
523
|
-
navSimulating:
|
|
520
|
+
M(() => {
|
|
521
|
+
La.current = {
|
|
522
|
+
theme: ja,
|
|
523
|
+
navigate: Na,
|
|
524
|
+
navItems: Pa,
|
|
525
|
+
options: Ur ?? {},
|
|
526
|
+
navPermissionsSettled: Fa,
|
|
527
|
+
navSimulating: Ia
|
|
524
528
|
};
|
|
525
529
|
}, [
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
530
|
+
ja,
|
|
531
|
+
Na,
|
|
532
|
+
Pa,
|
|
533
|
+
Ur,
|
|
534
|
+
Fa,
|
|
535
|
+
Ia
|
|
532
536
|
]);
|
|
533
|
-
let
|
|
534
|
-
|
|
535
|
-
|
|
537
|
+
let Ra = N(!0);
|
|
538
|
+
M(() => (Ra.current = !0, () => {
|
|
539
|
+
Ra.current = !1;
|
|
536
540
|
}), []);
|
|
537
|
-
let
|
|
538
|
-
let t =
|
|
539
|
-
return n ?
|
|
540
|
-
}, []),
|
|
541
|
-
let { navItems: r, options: i } =
|
|
542
|
-
if (
|
|
543
|
-
let e =
|
|
544
|
-
n && s && !l && (o =
|
|
541
|
+
let za = N(null), [Ba, Va] = kr(!1), Ha = j((e) => {
|
|
542
|
+
let t = x.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
|
|
543
|
+
return n ? ur(lr, window.location.pathname, mr(n.messages, e)) : !1;
|
|
544
|
+
}, []), Ua = j((e, t, n = !1) => {
|
|
545
|
+
let { navItems: r, options: i } = La.current, a = ar(r), o = null, s = or(e);
|
|
546
|
+
if ($n(s) || er(s) !== null) {
|
|
547
|
+
let e = x.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? gr(n.messages, t) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && mt(c.status);
|
|
548
|
+
n && s && !l && (o = hr({
|
|
545
549
|
reply: s,
|
|
546
|
-
text:
|
|
550
|
+
text: Dt(s, c, I),
|
|
547
551
|
resolve: {
|
|
548
552
|
destinations: a,
|
|
549
553
|
entityRoutes: i.entityRoutes,
|
|
550
|
-
visibleNavIds:
|
|
551
|
-
nounLabel: (e) =>
|
|
554
|
+
visibleNavIds: tr(r),
|
|
555
|
+
nounLabel: (e) => vn(I, e)
|
|
552
556
|
}
|
|
553
557
|
}));
|
|
554
558
|
}
|
|
555
|
-
return
|
|
559
|
+
return ir(e, a, {
|
|
556
560
|
...i,
|
|
557
|
-
locale: t === void 0 ?
|
|
561
|
+
locale: t === void 0 ? H : Yr.input.code
|
|
558
562
|
}, {
|
|
559
|
-
backRunnable:
|
|
563
|
+
backRunnable: Ha(t),
|
|
560
564
|
navigation: o,
|
|
561
565
|
skipRecords: n,
|
|
562
|
-
controls:
|
|
566
|
+
controls: yr()
|
|
563
567
|
});
|
|
564
568
|
}, [
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
]),
|
|
570
|
-
let n =
|
|
569
|
+
Ha,
|
|
570
|
+
Yr,
|
|
571
|
+
H,
|
|
572
|
+
I
|
|
573
|
+
]), Wa = j((e, t) => {
|
|
574
|
+
let n = Ua(e, t);
|
|
571
575
|
if (!n) return !1;
|
|
572
|
-
let { theme: r, navigate: i } =
|
|
576
|
+
let { theme: r, navigate: i } = La.current;
|
|
573
577
|
switch (n.kind) {
|
|
574
578
|
case "theme": return r !== null;
|
|
575
579
|
case "navigate":
|
|
@@ -579,18 +583,18 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
579
583
|
case "link-not-openable":
|
|
580
584
|
case "back": return i !== null;
|
|
581
585
|
case "conversation-delete": return !1;
|
|
582
|
-
case "app-control": return
|
|
586
|
+
case "app-control": return br(n.request, { voiceLive: t !== void 0 || Ro.current }) !== null;
|
|
583
587
|
case "open-record": return !1;
|
|
584
588
|
}
|
|
585
|
-
}, [
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
}, [
|
|
589
|
-
let
|
|
590
|
-
let a =
|
|
589
|
+
}, [Ua]), Ga = N(Wa);
|
|
590
|
+
M(() => {
|
|
591
|
+
Ga.current = Wa;
|
|
592
|
+
}, [Wa]);
|
|
593
|
+
let Ka = j((e, t, n, r, i) => {
|
|
594
|
+
let a = I(n.key, n.fallback, r), o = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), s = {
|
|
591
595
|
kind: "write-reply",
|
|
592
596
|
line: n.key
|
|
593
|
-
}, c = (/* @__PURE__ */ new Date()).toISOString(), l =
|
|
597
|
+
}, c = (/* @__PURE__ */ new Date()).toISOString(), l = F();
|
|
594
598
|
G(e, {
|
|
595
599
|
id: l,
|
|
596
600
|
role: "user",
|
|
@@ -598,64 +602,64 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
598
602
|
timestamp: c,
|
|
599
603
|
metadata: {
|
|
600
604
|
localAction: s,
|
|
601
|
-
...
|
|
605
|
+
...T(i)
|
|
602
606
|
}
|
|
603
607
|
});
|
|
604
|
-
let u =
|
|
608
|
+
let u = F();
|
|
605
609
|
G(e, {
|
|
606
610
|
id: u,
|
|
607
611
|
role: "assistant",
|
|
608
612
|
content: a,
|
|
609
613
|
timestamp: c,
|
|
610
614
|
metadata: {
|
|
611
|
-
lang: a === o ? "en" :
|
|
615
|
+
lang: a === o ? "en" : H,
|
|
612
616
|
localAction: s,
|
|
613
|
-
...
|
|
617
|
+
...T(i)
|
|
614
618
|
}
|
|
615
|
-
}),
|
|
619
|
+
}), un.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", A()), Ma(e, u);
|
|
616
620
|
}, [
|
|
617
621
|
G,
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
]),
|
|
622
|
-
|
|
623
|
-
if (
|
|
624
|
-
let e = window.setTimeout(() =>
|
|
622
|
+
H,
|
|
623
|
+
Ma,
|
|
624
|
+
I
|
|
625
|
+
]), qa = mn(), Ja = Dn(), Ya = qa?.request ?? null, Xa = N(() => void 0), [Za, Qa] = kr(null);
|
|
626
|
+
M(() => {
|
|
627
|
+
if (Za === null) return;
|
|
628
|
+
let e = window.setTimeout(() => Qa(null), Ir);
|
|
625
629
|
return () => window.clearTimeout(e);
|
|
626
|
-
}, [
|
|
627
|
-
let
|
|
628
|
-
let e =
|
|
629
|
-
return
|
|
630
|
-
}, [
|
|
631
|
-
if (!
|
|
632
|
-
let t = e !== void 0, n =
|
|
630
|
+
}, [Za]);
|
|
631
|
+
let $a = j(() => {
|
|
632
|
+
let e = x.getState();
|
|
633
|
+
return ii(void 0, e.autoRouting && Xi.current ? c : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
|
|
634
|
+
}, [ii]), eo = j((e) => {
|
|
635
|
+
if (!Ya) return !1;
|
|
636
|
+
let t = e !== void 0, n = x.getState(), r = On({
|
|
633
637
|
spoken: t,
|
|
634
|
-
bound:
|
|
638
|
+
bound: oa.current,
|
|
635
639
|
activeConversationId: n.activeConversationId,
|
|
636
640
|
conversations: n.conversations,
|
|
637
|
-
historyOn:
|
|
641
|
+
historyOn: pn()
|
|
638
642
|
});
|
|
639
|
-
if (r &&
|
|
640
|
-
let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ?
|
|
641
|
-
|
|
642
|
-
id: `conversation-delete:${
|
|
643
|
+
if (r && Ya(r), t) {
|
|
644
|
+
let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? I("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : I("deleteConversation.nothing", "There is no conversation to delete.");
|
|
645
|
+
Xa.current({
|
|
646
|
+
id: `conversation-delete:${F()}`,
|
|
643
647
|
text: t,
|
|
644
|
-
lang: t === e ? "en" :
|
|
648
|
+
lang: t === e ? "en" : H
|
|
645
649
|
});
|
|
646
|
-
} else r ||
|
|
650
|
+
} else r || Qa(Date.now());
|
|
647
651
|
return !0;
|
|
648
652
|
}, [
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
]),
|
|
653
|
-
if (e.kind === "conversation-delete") return
|
|
654
|
-
let { theme: i, navigate: a } =
|
|
655
|
-
let e = (r ? null : o ??
|
|
656
|
-
return r &&
|
|
653
|
+
Ya,
|
|
654
|
+
H,
|
|
655
|
+
I
|
|
656
|
+
]), to = j((e, t, n, r = !1) => {
|
|
657
|
+
if (e.kind === "conversation-delete") return eo(n);
|
|
658
|
+
let { theme: i, navigate: a } = La.current, o = null, s = () => {
|
|
659
|
+
let e = (r ? null : o ?? x.getState().activeConversationId) ?? $a();
|
|
660
|
+
return r && la(e), e;
|
|
657
661
|
}, c = (e, r) => {
|
|
658
|
-
let i =
|
|
662
|
+
let i = F();
|
|
659
663
|
return G(e, {
|
|
660
664
|
id: i,
|
|
661
665
|
role: "user",
|
|
@@ -663,67 +667,67 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
663
667
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
664
668
|
metadata: {
|
|
665
669
|
localAction: r,
|
|
666
|
-
...
|
|
670
|
+
...T(n)
|
|
667
671
|
}
|
|
668
672
|
}), i;
|
|
669
673
|
}, l = (e, t, r, i, a, o) => {
|
|
670
|
-
let s =
|
|
674
|
+
let s = F();
|
|
671
675
|
return G(e, {
|
|
672
676
|
id: s,
|
|
673
677
|
role: "assistant",
|
|
674
678
|
content: r.text,
|
|
675
679
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
676
680
|
metadata: {
|
|
677
|
-
lang: r.translated ?
|
|
681
|
+
lang: r.translated ? H : "en",
|
|
678
682
|
localAction: i,
|
|
679
|
-
...
|
|
683
|
+
...T(n)
|
|
680
684
|
}
|
|
681
|
-
}),
|
|
685
|
+
}), un.recordCommittedEntries(e, [t, s], "LOCAL_COMMAND", a), o && Ma(e, s), s;
|
|
682
686
|
}, u = (e, t, n) => {
|
|
683
|
-
let r = s(), i = l(r, c(r, t), e, t,
|
|
687
|
+
let r = s(), i = l(r, c(r, t), e, t, A(), !0);
|
|
684
688
|
return n?.(i), !0;
|
|
685
689
|
}, d = (e) => {
|
|
686
|
-
let t = s(), n =
|
|
690
|
+
let t = s(), n = A(), r = window.location.pathname, i = c(t, dr({
|
|
687
691
|
destinationId: e.destinationId,
|
|
688
692
|
path: e.registryPath,
|
|
689
693
|
alreadyHere: !1,
|
|
690
694
|
via: e.via
|
|
691
|
-
})), o =
|
|
692
|
-
|
|
695
|
+
})), o = F();
|
|
696
|
+
za.current = o, Va(!0);
|
|
693
697
|
let u = (a) => {
|
|
694
698
|
try {
|
|
695
|
-
if (!
|
|
696
|
-
let o =
|
|
699
|
+
if (!x.getState().conversations.some((e) => e.id === t)) return;
|
|
700
|
+
let o = ar(La.current.navItems), s = a.status === "arrived" || a.status === "redirected" ? a.landedPath : null, c = dr({
|
|
697
701
|
destinationId: e.destinationId,
|
|
698
702
|
path: e.registryPath,
|
|
699
703
|
alreadyHere: !1,
|
|
700
704
|
via: e.via,
|
|
701
705
|
outcome: a
|
|
702
706
|
});
|
|
703
|
-
|
|
704
|
-
let u = l(t, i, e.via === "back" && a.status === "arrived" ?
|
|
707
|
+
si(t, i, { localAction: c });
|
|
708
|
+
let u = l(t, i, e.via === "back" && a.status === "arrived" ? hn(I, e.pageLabel()) : xn(I, a, {
|
|
705
709
|
page: e.pageLabel(),
|
|
706
|
-
landed: s === null ? null :
|
|
710
|
+
landed: s === null ? null : pr(o, s),
|
|
707
711
|
path: e.target
|
|
708
|
-
}), c, n,
|
|
712
|
+
}), c, n, Ra.current);
|
|
709
713
|
a.status === "arrived" && e.onArrived?.({
|
|
710
714
|
replyId: u,
|
|
711
715
|
fromPath: r,
|
|
712
716
|
landedPath: a.landedPath
|
|
713
717
|
});
|
|
714
718
|
} finally {
|
|
715
|
-
|
|
719
|
+
za.current === o && (za.current = null, Ra.current && Va(!1));
|
|
716
720
|
}
|
|
717
721
|
};
|
|
718
|
-
return
|
|
722
|
+
return cr(a, e.target, {
|
|
719
723
|
readPath: () => window.location.pathname + window.location.search,
|
|
720
724
|
now: () => Date.now(),
|
|
721
725
|
schedule: (e, t) => {
|
|
722
726
|
window.setTimeout(e, t);
|
|
723
727
|
},
|
|
724
|
-
isShellLess: () => !
|
|
728
|
+
isShellLess: () => !Ra.current
|
|
725
729
|
}).then(u, () => u({ status: "unconfirmed" })), !0;
|
|
726
|
-
}, f = ({ replyId: e, fromPath: t, landedPath: n }) =>
|
|
730
|
+
}, f = ({ replyId: e, fromPath: t, landedPath: n }) => lr.push({
|
|
727
731
|
fromPath: t,
|
|
728
732
|
toPath: n,
|
|
729
733
|
replyMessageId: e,
|
|
@@ -731,75 +735,75 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
731
735
|
});
|
|
732
736
|
if (e.kind === "theme") {
|
|
733
737
|
if (!i) return !1;
|
|
734
|
-
let t =
|
|
738
|
+
let t = sr(e.request, {
|
|
735
739
|
mode: i.mode,
|
|
736
740
|
resolvedTheme: i.resolvedTheme
|
|
737
741
|
});
|
|
738
742
|
if (!t.alreadyApplied) try {
|
|
739
743
|
i.setMode(t.mode);
|
|
740
744
|
} catch {}
|
|
741
|
-
return u(
|
|
745
|
+
return u(Tn(I, t, e.request.kind === "family"), {
|
|
742
746
|
kind: "theme",
|
|
743
747
|
mode: t.mode,
|
|
744
748
|
alreadyApplied: t.alreadyApplied
|
|
745
749
|
});
|
|
746
750
|
}
|
|
747
751
|
if (e.kind === "app-control") {
|
|
748
|
-
let t =
|
|
752
|
+
let t = br(e.request, { voiceLive: n !== void 0 || Ro.current });
|
|
749
753
|
if (!t) return !1;
|
|
750
754
|
let r = (e) => ({
|
|
751
755
|
kind: "app-control",
|
|
752
756
|
control: t.control,
|
|
753
757
|
outcome: e.outcome
|
|
754
|
-
}), i = (e) => u(
|
|
758
|
+
}), i = (e) => u(En(I, e.reply), r(e));
|
|
755
759
|
if (t.kind === "reply") return i(t.run);
|
|
756
760
|
if (t.kind === "run") {
|
|
757
761
|
let e = t.run();
|
|
758
762
|
return t.silent && (e.outcome === "done" || e.outcome === "already") ? !0 : i(e);
|
|
759
763
|
}
|
|
760
|
-
let a =
|
|
764
|
+
let a = Ja;
|
|
761
765
|
if (!a) return !1;
|
|
762
766
|
let o = null;
|
|
763
|
-
return u(
|
|
764
|
-
o =
|
|
767
|
+
return u(En(I, t.ask.reply), r(t.ask), (e) => {
|
|
768
|
+
o = x.getState().conversations.find((t) => t.messages.some((t) => t.id === e))?.id ?? null;
|
|
765
769
|
}), a.request({
|
|
766
770
|
prompt: t.prompt,
|
|
767
771
|
onConfirm: () => {
|
|
768
|
-
let e = t.confirmed(), i = o, a = i !== null &&
|
|
772
|
+
let e = t.confirmed(), i = o, a = i !== null && x.getState().conversations.some((e) => e.id === i);
|
|
769
773
|
if (!i || !a) return;
|
|
770
|
-
let s =
|
|
774
|
+
let s = En(I, e.reply);
|
|
771
775
|
G(i, {
|
|
772
|
-
id:
|
|
776
|
+
id: F(),
|
|
773
777
|
role: "assistant",
|
|
774
778
|
content: s.text,
|
|
775
779
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
776
780
|
metadata: {
|
|
777
|
-
lang: s.translated ?
|
|
781
|
+
lang: s.translated ? H : "en",
|
|
778
782
|
localAction: r(e),
|
|
779
|
-
...
|
|
783
|
+
...T(n)
|
|
780
784
|
}
|
|
781
785
|
});
|
|
782
786
|
}
|
|
783
787
|
}), !0;
|
|
784
788
|
}
|
|
785
789
|
if (!a) return !1;
|
|
786
|
-
if (e.kind === "choose-destination") return u(
|
|
790
|
+
if (e.kind === "choose-destination") return u(gn(I, e.candidates[0]?.label ?? e.query, e.candidates), {
|
|
787
791
|
kind: "choose-destination",
|
|
788
792
|
candidateIds: e.candidates.map((e) => e.id)
|
|
789
|
-
}, (t) =>
|
|
790
|
-
if (e.kind === "choose-linked") return u(
|
|
793
|
+
}, (t) => _r(t, e.candidates));
|
|
794
|
+
if (e.kind === "choose-linked") return u(_n(I, e.candidates), {
|
|
791
795
|
kind: "choose-destination",
|
|
792
796
|
candidateIds: e.candidates.map((e) => e.id)
|
|
793
|
-
}, (t) =>
|
|
797
|
+
}, (t) => _r(t, e.candidates));
|
|
794
798
|
if (e.kind === "pick-from-list") {
|
|
795
799
|
let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
|
|
796
|
-
return u(
|
|
800
|
+
return u(Sn(I), t ? {
|
|
797
801
|
kind: "choose-destination",
|
|
798
802
|
candidateIds: t.map((e) => e.id)
|
|
799
803
|
} : e.candidateIds.length > 0 ? {
|
|
800
804
|
kind: "choose-destination",
|
|
801
805
|
candidateIds: [...e.candidateIds]
|
|
802
|
-
} :
|
|
806
|
+
} : dr({
|
|
803
807
|
destinationId: "",
|
|
804
808
|
path: "",
|
|
805
809
|
alreadyHere: !1,
|
|
@@ -808,9 +812,9 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
808
812
|
status: "refused",
|
|
809
813
|
reason: "not-routable"
|
|
810
814
|
}
|
|
811
|
-
}), t ? (e) =>
|
|
815
|
+
}), t ? (e) => _r(e, t) : void 0);
|
|
812
816
|
}
|
|
813
|
-
if (e.kind === "link-not-openable") return u(
|
|
817
|
+
if (e.kind === "link-not-openable") return u(yn(I), dr({
|
|
814
818
|
destinationId: "",
|
|
815
819
|
path: "",
|
|
816
820
|
alreadyHere: !1,
|
|
@@ -823,7 +827,7 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
823
827
|
if (e.kind === "open-record") {
|
|
824
828
|
let r;
|
|
825
829
|
try {
|
|
826
|
-
let { options: t, navItems: n } =
|
|
830
|
+
let { options: t, navItems: n } = La.current, i = t.entityRoutes ?? [], a = tr(n);
|
|
827
831
|
r = (t.records ?? []).flatMap((t) => {
|
|
828
832
|
let n = i.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
|
|
829
833
|
return n && r && (n.visibleWith === void 0 || a.has(n.visibleWith)) ? [{
|
|
@@ -835,28 +839,28 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
835
839
|
return !1;
|
|
836
840
|
}
|
|
837
841
|
if (r.length === 0) return !1;
|
|
838
|
-
let i =
|
|
839
|
-
|
|
842
|
+
let i = x.getState().activeConversationId, a = F();
|
|
843
|
+
za.current = a, Va(!0);
|
|
840
844
|
let s = () => {
|
|
841
|
-
|
|
845
|
+
za.current === a && (za.current = null, Ra.current && Va(!1));
|
|
842
846
|
};
|
|
843
847
|
return (async () => {
|
|
844
848
|
let a = { kind: "none" }, c = !0;
|
|
845
849
|
try {
|
|
846
|
-
a = await
|
|
850
|
+
a = await nr({
|
|
847
851
|
name: e.request.name,
|
|
848
852
|
usable: r,
|
|
849
|
-
nounOf: (e) =>
|
|
850
|
-
timeoutMs:
|
|
851
|
-
}), c =
|
|
853
|
+
nounOf: (e) => vn(I, e.noun),
|
|
854
|
+
timeoutMs: Mr
|
|
855
|
+
}), c = x.getState().conversations.some((e) => e.id === i);
|
|
852
856
|
} catch {
|
|
853
857
|
a = { kind: "none" };
|
|
854
858
|
} finally {
|
|
855
859
|
s();
|
|
856
860
|
}
|
|
857
|
-
if (!
|
|
861
|
+
if (!Ra.current) return;
|
|
858
862
|
if (a.kind === "none") {
|
|
859
|
-
|
|
863
|
+
ao.current(t, [], {
|
|
860
864
|
fromPerson: !0,
|
|
861
865
|
...n === void 0 ? {} : { voiceSessionId: n },
|
|
862
866
|
localRecordsChecked: !0
|
|
@@ -877,16 +881,16 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
877
881
|
return;
|
|
878
882
|
}
|
|
879
883
|
let l = a.candidates[0];
|
|
880
|
-
u(a.why === "kinds" ?
|
|
884
|
+
u(a.why === "kinds" ? wn(I, a.nouns, a.candidates) : Cn(I, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
|
|
881
885
|
kind: "choose-destination",
|
|
882
886
|
candidateIds: a.candidates.map((e) => e.id)
|
|
883
|
-
}, (e) =>
|
|
887
|
+
}, (e) => _r(e, a.candidates));
|
|
884
888
|
})().catch(() => void 0), !0;
|
|
885
889
|
}
|
|
886
890
|
if (e.kind === "back") {
|
|
887
|
-
let e =
|
|
891
|
+
let e = lr.top();
|
|
888
892
|
if (!e) return !1;
|
|
889
|
-
let t =
|
|
893
|
+
let t = fr(ar(La.current.navItems), e.fromPath);
|
|
890
894
|
return d({
|
|
891
895
|
target: e.fromPath,
|
|
892
896
|
destinationId: t?.id ?? "",
|
|
@@ -894,12 +898,12 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
894
898
|
via: "back",
|
|
895
899
|
pageLabel: () => t?.label ?? null,
|
|
896
900
|
onArrived: () => {
|
|
897
|
-
|
|
901
|
+
lr.top() === e && lr.pop();
|
|
898
902
|
}
|
|
899
903
|
});
|
|
900
904
|
}
|
|
901
905
|
let { destination: p } = e;
|
|
902
|
-
return
|
|
906
|
+
return rr(p, window.location.pathname + window.location.search, ar(La.current.navItems)) ? u(bn(I, p.label, !0), dr({
|
|
903
907
|
destinationId: p.id,
|
|
904
908
|
path: p.path,
|
|
905
909
|
alreadyHere: !0,
|
|
@@ -914,46 +918,46 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
914
918
|
});
|
|
915
919
|
}, [
|
|
916
920
|
G,
|
|
917
|
-
|
|
918
|
-
Ha,
|
|
919
|
-
qa,
|
|
920
|
-
V,
|
|
921
|
-
ti,
|
|
921
|
+
la,
|
|
922
922
|
Ja,
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
923
|
+
$a,
|
|
924
|
+
H,
|
|
925
|
+
si,
|
|
926
|
+
eo,
|
|
927
|
+
Ma,
|
|
928
|
+
I
|
|
929
|
+
]), no = j(async (e) => {
|
|
930
|
+
Qi.current = !0;
|
|
927
931
|
try {
|
|
928
932
|
await q.declineForReply(e.conversationId, e.reason, e.origin);
|
|
929
933
|
} finally {
|
|
930
|
-
|
|
934
|
+
Qi.current = !1;
|
|
931
935
|
}
|
|
932
936
|
if (e.commandText !== null) {
|
|
933
|
-
let t =
|
|
934
|
-
if (t &&
|
|
937
|
+
let t = Ua(e.commandText, e.options.voiceSessionId);
|
|
938
|
+
if (t && to(t, e.content, e.options.voiceSessionId)) return;
|
|
935
939
|
}
|
|
936
|
-
await
|
|
940
|
+
await ao.current(e.content, e.attachments, e.options);
|
|
937
941
|
}, [
|
|
938
|
-
|
|
939
|
-
|
|
942
|
+
Ua,
|
|
943
|
+
to,
|
|
940
944
|
q
|
|
941
|
-
]), X =
|
|
942
|
-
let r = n.voiceSessionId !== void 0, i =
|
|
943
|
-
if (r &&
|
|
944
|
-
let e =
|
|
945
|
+
]), X = j(async (e, t = [], n = {}) => {
|
|
946
|
+
let r = n.voiceSessionId !== void 0, i = x.getState(), a = !1, o = oa.current;
|
|
947
|
+
if (r && Ue(o)) {
|
|
948
|
+
let e = Je(o, i.activeConversationId, ua());
|
|
945
949
|
if (e.kind === "gone") return;
|
|
946
950
|
let t = n.voiceEntry ?? e;
|
|
947
|
-
t.kind === "adopt" &&
|
|
951
|
+
t.kind === "adopt" && la(t.conversationId), a = t.kind === "own", n = {
|
|
948
952
|
...n,
|
|
949
953
|
voiceEntry: t
|
|
950
954
|
};
|
|
951
955
|
}
|
|
952
|
-
let s = a ? null : i.activeConversationId, c = a ? null : i.activeConversationId ??
|
|
956
|
+
let s = a ? null : i.activeConversationId, c = a ? null : i.activeConversationId ?? U;
|
|
953
957
|
if (c) {
|
|
954
|
-
if (
|
|
958
|
+
if (mt(i.processingByConversationId[c]?.status)) {
|
|
955
959
|
let r = i.processingByConversationId[c]?.messageId ?? null;
|
|
956
|
-
r && n.correctsInFlightTurn === !0 && !
|
|
960
|
+
r && n.correctsInFlightTurn === !0 && !Ta.current.has(r) && Oa(), r && Ta.current.has(r) && (Ea.current = {
|
|
957
961
|
conversationId: c,
|
|
958
962
|
content: e,
|
|
959
963
|
attachments: t,
|
|
@@ -961,29 +965,29 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
961
965
|
});
|
|
962
966
|
return;
|
|
963
967
|
}
|
|
964
|
-
if (
|
|
968
|
+
if (fa.current.has(c)) return;
|
|
965
969
|
}
|
|
966
|
-
if (
|
|
967
|
-
let l = n.targetConversationId, f = ee(), m = (e) =>
|
|
970
|
+
if (Zi.current || g() !== null || Qi.current || za.current !== null) return;
|
|
971
|
+
let l = n.targetConversationId, f = ee(), m = (e) => sn(e) || on(e, f);
|
|
968
972
|
if (l !== void 0) {
|
|
969
973
|
let e = i.conversations.find((e) => e.id === l);
|
|
970
974
|
if (i.activeConversationId !== l || !e || e.mode !== i.mode || m(e)) return;
|
|
971
975
|
}
|
|
972
976
|
if (n.fromPerson && n.writeReplyBound === void 0) {
|
|
973
|
-
let r = l ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", a =
|
|
977
|
+
let r = l ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", a = qt({
|
|
974
978
|
text: e,
|
|
975
|
-
locale: i === "spoken" ?
|
|
979
|
+
locale: i === "spoken" ? Yr.input.code : H,
|
|
976
980
|
origin: i,
|
|
977
981
|
hasAttachments: t.length > 0,
|
|
978
982
|
live: q.liveFor(r),
|
|
979
|
-
matchesLocalCommand: (e) =>
|
|
983
|
+
matchesLocalCommand: (e) => Ua(e, n.voiceSessionId) !== null
|
|
980
984
|
});
|
|
981
985
|
if (a.kind === "local_reply") {
|
|
982
|
-
r &&
|
|
986
|
+
r && Ka(r, e, a.line, a.values, n.voiceSessionId);
|
|
983
987
|
return;
|
|
984
988
|
}
|
|
985
989
|
let o = a.kind === "local" ? a.fallback : a.bound, c = a.declineAll;
|
|
986
|
-
if (c !== null && r) return
|
|
990
|
+
if (c !== null && r) return no({
|
|
987
991
|
conversationId: r,
|
|
988
992
|
reason: c,
|
|
989
993
|
origin: i,
|
|
@@ -1002,365 +1006,402 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
1002
1006
|
}
|
|
1003
1007
|
let te = n.writeReplyBound?.promptText ?? e;
|
|
1004
1008
|
if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
|
|
1005
|
-
let t =
|
|
1006
|
-
if (t &&
|
|
1009
|
+
let t = Ua(e, n.voiceSessionId, n.localRecordsChecked === !0);
|
|
1010
|
+
if (t && to(t, e, n.voiceSessionId, a)) return;
|
|
1007
1011
|
}
|
|
1008
|
-
let h = s ? i.conversations.find((e) => e.id === s) : void 0, _ = m(h) ? void 0 : h, v = i.autoRouting &&
|
|
1012
|
+
let h = s ? i.conversations.find((e) => e.id === s) : void 0, _ = m(h) ? void 0 : h, v = i.autoRouting && Xi.current && l === void 0 ? p({
|
|
1009
1013
|
intent: n.autoIntent ?? u(e),
|
|
1010
1014
|
dictated: r,
|
|
1011
|
-
voiceProposalBound: r &&
|
|
1015
|
+
voiceProposalBound: r && Wr("api-calls") && ie(i.acknowledgedWriteModes, "api-calls"),
|
|
1012
1016
|
conversation: _ ? {
|
|
1013
1017
|
mode: _.mode,
|
|
1014
1018
|
routedBy: _.routedBy,
|
|
1015
|
-
hasHistory:
|
|
1019
|
+
hasHistory: an(_)
|
|
1016
1020
|
} : null
|
|
1017
1021
|
}) : null;
|
|
1018
|
-
if (v &&
|
|
1019
|
-
|
|
1022
|
+
if (v && Hi.current.find((e) => e.id === v.mode)?.writeCapable && !ie(i.acknowledgedWriteModes, v.mode)) {
|
|
1023
|
+
Zi.current = {
|
|
1020
1024
|
content: e,
|
|
1021
1025
|
attachments: t,
|
|
1022
1026
|
options: n
|
|
1023
|
-
},
|
|
1027
|
+
}, ta(v.mode);
|
|
1024
1028
|
return;
|
|
1025
1029
|
}
|
|
1026
|
-
let y = v ? v.mode : i.mode, re,
|
|
1030
|
+
let y = v ? v.mode : i.mode, re, b, S = l ?? (a ? null : U), se = S ? x.getState().conversations.find((e) => e.id === S) : void 0, ce = v?.action === "escalate" && _ ? {
|
|
1027
1031
|
mode: _.mode,
|
|
1028
1032
|
backendSessionId: _.backendSessionId ?? null
|
|
1029
1033
|
} : null;
|
|
1030
|
-
if (v) v.action === "new" || !_ ?
|
|
1034
|
+
if (v) v.action === "new" || !_ ? S = ii(void 0, y, { routedBy: "auto" }) : (S = _.id, vi(S, y));
|
|
1031
1035
|
else {
|
|
1032
1036
|
let e = i.autoRouting ? { routedBy: "auto" } : void 0;
|
|
1033
|
-
!
|
|
1037
|
+
!S || m(se) || se && se.mode !== y && an(se) ? S = ii(void 0, y, e) : se && se.mode !== y && (e ? vi(S, y) : ni(S, y));
|
|
1034
1038
|
}
|
|
1035
|
-
if (!
|
|
1036
|
-
r &&
|
|
1037
|
-
let
|
|
1038
|
-
accessToken:
|
|
1039
|
-
workspaceToken:
|
|
1040
|
-
userId:
|
|
1041
|
-
organizationId:
|
|
1039
|
+
if (!S) return;
|
|
1040
|
+
r && oa.current !== void 0 && S !== i.activeConversationId && la(S), n.approvalFollowUp || (da.current[S] = t);
|
|
1041
|
+
let ue = () => x.getState().conversations.some((e) => e.id === S), C = A(), ge = {
|
|
1042
|
+
accessToken: B(),
|
|
1043
|
+
workspaceToken: Gr(),
|
|
1044
|
+
userId: V,
|
|
1045
|
+
organizationId: Pt()
|
|
1042
1046
|
}, ve = (e, t) => {
|
|
1043
|
-
|
|
1044
|
-
accessToken:
|
|
1045
|
-
workspaceToken:
|
|
1046
|
-
userId:
|
|
1047
|
-
organizationId:
|
|
1047
|
+
ue() || !C || oe(e, C, t, y, {
|
|
1048
|
+
accessToken: B(),
|
|
1049
|
+
workspaceToken: Gr(),
|
|
1050
|
+
userId: V,
|
|
1051
|
+
organizationId: Pt()
|
|
1048
1052
|
});
|
|
1049
1053
|
}, ye = {
|
|
1050
|
-
id:
|
|
1054
|
+
id: F(),
|
|
1051
1055
|
role: "user",
|
|
1052
1056
|
content: e,
|
|
1053
1057
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1054
1058
|
metadata: {
|
|
1055
|
-
...t.length ? { attachments: t.map(
|
|
1059
|
+
...t.length ? { attachments: t.map(nt) } : {},
|
|
1056
1060
|
...n.approvalFollowUp ? {
|
|
1057
1061
|
approvalFollowUp: !0,
|
|
1058
1062
|
approvedReplyId: n.approvalFollowUp.approvedReplyId
|
|
1059
1063
|
} : {},
|
|
1060
|
-
...
|
|
1064
|
+
...T(n.voiceSessionId)
|
|
1061
1065
|
}
|
|
1062
1066
|
};
|
|
1063
|
-
G(
|
|
1064
|
-
let
|
|
1065
|
-
G(
|
|
1066
|
-
id:
|
|
1067
|
+
G(S, ye);
|
|
1068
|
+
let w = F();
|
|
1069
|
+
G(S, {
|
|
1070
|
+
id: w,
|
|
1067
1071
|
role: "assistant",
|
|
1068
1072
|
content: "",
|
|
1069
1073
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1070
1074
|
metadata: {
|
|
1071
|
-
lang:
|
|
1072
|
-
...
|
|
1075
|
+
lang: Qr,
|
|
1076
|
+
...T(n.voiceSessionId)
|
|
1073
1077
|
}
|
|
1074
|
-
}),
|
|
1078
|
+
}), Ot(w, {
|
|
1075
1079
|
channel: r ? "voice" : "chat",
|
|
1076
1080
|
mode: y,
|
|
1077
|
-
product:
|
|
1078
|
-
language:
|
|
1079
|
-
device:
|
|
1081
|
+
product: L,
|
|
1082
|
+
language: Qr,
|
|
1083
|
+
device: kt(),
|
|
1080
1084
|
routedByAuto: !!v
|
|
1081
|
-
}, n.voiceTiming),
|
|
1082
|
-
let je = () =>
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1085
|
+
}, n.voiceTiming), k(w, "accepted"), ci(S, "provisioning", w, null), ne(w);
|
|
1086
|
+
let je = () => {
|
|
1087
|
+
let e = ht({
|
|
1088
|
+
turnId: w,
|
|
1089
|
+
abortRequested: Ta.current.has(w),
|
|
1090
|
+
activeTurnId: x.getState().processingByConversationId[S]?.messageId ?? null,
|
|
1091
|
+
conversationExists: ue()
|
|
1092
|
+
});
|
|
1093
|
+
return e.abandon && Fe(), e;
|
|
1094
|
+
}, Me = (e, t, r, i, a = !1, o = Qr) => {
|
|
1095
|
+
oi(S, w, { content: be(e) }), si(S, w, {
|
|
1089
1096
|
lang: o,
|
|
1090
1097
|
...t?.length ? { artifacts: t } : {},
|
|
1091
1098
|
...t?.length || r || i ? { mode: y } : {},
|
|
1092
1099
|
...r ? { sessionId: r } : {},
|
|
1093
1100
|
...i ? { sandboxId: i } : {},
|
|
1094
1101
|
...a ? { incomplete: !0 } : {},
|
|
1095
|
-
...
|
|
1102
|
+
...T(n.voiceSessionId)
|
|
1096
1103
|
});
|
|
1097
|
-
}, Ne = { session: null },
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1104
|
+
}, Ne = { session: null }, E = {
|
|
1105
|
+
stream: null,
|
|
1106
|
+
render: null
|
|
1107
|
+
}, Fe = () => {
|
|
1108
|
+
E.render?.end();
|
|
1109
|
+
}, Ie = () => {
|
|
1110
|
+
Fe(), E.stream?.close(), E.stream = null, E.render = null;
|
|
1111
|
+
}, Le = !1, Re = () => {
|
|
1112
|
+
Le && (Le = !1, Pe.abort(w));
|
|
1113
|
+
}, D = async (i = 1) => {
|
|
1114
|
+
k(w, "attemptStarted");
|
|
1101
1115
|
let a = null, o = null, s = !1;
|
|
1102
1116
|
try {
|
|
1103
|
-
let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: p, deadSandboxProbe: ee, sessionPreopened: m } = await
|
|
1104
|
-
turnId:
|
|
1105
|
-
abortRequested:
|
|
1106
|
-
activeTurnId:
|
|
1107
|
-
conversationExists:
|
|
1117
|
+
let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: p, deadSandboxProbe: ee, sessionPreopened: m } = await ya(S, w, y, C, ge, { isAbandoned: () => ht({
|
|
1118
|
+
turnId: w,
|
|
1119
|
+
abortRequested: Ta.current.has(w),
|
|
1120
|
+
activeTurnId: x.getState().processingByConversationId[S]?.messageId ?? null,
|
|
1121
|
+
conversationExists: ue()
|
|
1108
1122
|
}).abandon });
|
|
1109
|
-
if (a = i,
|
|
1123
|
+
if (a = i, k(w, "runtimeReady"), O(w, {
|
|
1110
1124
|
runtime: d ? "cold" : p ? "adopted" : f ? "probed" : m ? "preopened" : l ? "new-session" : "warm",
|
|
1111
1125
|
deadSandboxProbe: ee
|
|
1112
|
-
}), o = c, Ne.session = {
|
|
1126
|
+
}), O(w, { session: m ? "preopened" : l ? "created" : "reused" }), o = c, Ne.session = {
|
|
1113
1127
|
sandboxId: i,
|
|
1114
1128
|
sessionId: c
|
|
1115
|
-
}, ae(y, re,
|
|
1129
|
+
}, ae(y, re, x.getState().acknowledgedWriteModes, {
|
|
1116
1130
|
dictated: r,
|
|
1117
1131
|
confirmsWrites: me(y),
|
|
1118
|
-
proposalBound:
|
|
1132
|
+
proposalBound: Wr(y, i)
|
|
1119
1133
|
}) === "voice-in-write-mode") throw new xe("voice-in-write-mode", "Voice in a write mode");
|
|
1120
|
-
let h =
|
|
1121
|
-
conversation:
|
|
1134
|
+
let h = kn({
|
|
1135
|
+
conversation: x.getState().conversations.find((e) => e.id === S),
|
|
1122
1136
|
content: e,
|
|
1123
1137
|
sessionIsNew: l,
|
|
1124
1138
|
sendingMode: y,
|
|
1125
1139
|
sendingModeConfig: re,
|
|
1126
|
-
modes:
|
|
1127
|
-
answerText: (e) =>
|
|
1128
|
-
})
|
|
1129
|
-
|
|
1130
|
-
|
|
1140
|
+
modes: Hi.current,
|
|
1141
|
+
answerText: (e) => wt(e).text
|
|
1142
|
+
});
|
|
1143
|
+
if (Ie(), Rn()) {
|
|
1144
|
+
let e = Ln({
|
|
1145
|
+
mint: () => pe(i, C, c, y, ge),
|
|
1146
|
+
mark: (e) => k(w, e)
|
|
1147
|
+
});
|
|
1148
|
+
E.stream = e, E.render = Mn({
|
|
1149
|
+
stream: e,
|
|
1150
|
+
conversationId: S,
|
|
1151
|
+
messageId: w,
|
|
1152
|
+
build: (e, t) => be(yt(e, t, { accumulateNarration: b.accumulatesNarration }).content),
|
|
1153
|
+
onFirstDelta: () => k(w, "firstDelta"),
|
|
1154
|
+
onFirstVisible: () => k(w, "firstOutput")
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
let g = await xt(() => fe(i, C, c, y, ge, { limit: 50 }), l, bt(u, i, c));
|
|
1158
|
+
_a(S, w, "streaming", "thinking");
|
|
1159
|
+
let ne = zr?.(), _ = Jt(x.getState().sandboxWriteCapabilities[i]), v = La.current, ie = v.options.uiCatalogue ? vr(ar(v.navItems), {
|
|
1131
1160
|
permissionsSettled: v.navPermissionsSettled,
|
|
1132
1161
|
simulating: v.navSimulating
|
|
1133
|
-
}) : null,
|
|
1134
|
-
conversationId:
|
|
1162
|
+
}) : null, oe = {
|
|
1163
|
+
conversationId: S,
|
|
1135
1164
|
writeReply: _ === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null,
|
|
1136
1165
|
...ie ? { uiCatalogue: ie } : {}
|
|
1137
|
-
}, { prompt:
|
|
1166
|
+
}, { prompt: se, parts: ce } = pt({
|
|
1138
1167
|
content: h ? `${h}${te}` : te,
|
|
1139
1168
|
attachments: t,
|
|
1140
|
-
limits:
|
|
1141
|
-
wrapPrompt: (e) =>
|
|
1169
|
+
limits: tt(re),
|
|
1170
|
+
wrapPrompt: (e) => Br?.(y, e, Xr, Zr, r, { writeApproval: _ }) ?? e,
|
|
1142
1171
|
requestBytes: (e, t) => he({
|
|
1143
1172
|
sandboxId: i,
|
|
1144
|
-
workspaceId:
|
|
1173
|
+
workspaceId: C,
|
|
1145
1174
|
sessionId: c,
|
|
1146
1175
|
mode: y,
|
|
1147
1176
|
prompt: e,
|
|
1148
1177
|
parts: t,
|
|
1149
1178
|
pageContext: ne,
|
|
1150
1179
|
authContext: ge,
|
|
1151
|
-
...
|
|
1180
|
+
...oe
|
|
1152
1181
|
})
|
|
1153
|
-
}), Se =
|
|
1154
|
-
s =
|
|
1182
|
+
}), Se = Qe(ce), Ce = Se > 0;
|
|
1183
|
+
s = Ze(t) > Se;
|
|
1155
1184
|
let we = je();
|
|
1156
1185
|
if (we.abandon) {
|
|
1157
|
-
we.clearProcessing &&
|
|
1186
|
+
we.clearProcessing && li(S);
|
|
1158
1187
|
return;
|
|
1159
1188
|
}
|
|
1160
1189
|
try {
|
|
1161
|
-
await _e(i,
|
|
1162
|
-
parts:
|
|
1163
|
-
...
|
|
1164
|
-
} :
|
|
1190
|
+
await _e(i, C, c, se, y, ne, ge, ce?.length ? {
|
|
1191
|
+
parts: ce,
|
|
1192
|
+
...oe
|
|
1193
|
+
} : oe);
|
|
1165
1194
|
} catch (e) {
|
|
1166
|
-
if (!
|
|
1167
|
-
await _e(i,
|
|
1195
|
+
if (!ce || !Ft(e)) throw e;
|
|
1196
|
+
await _e(i, C, c, se, y, ne, ge, oe), s ||= Ce;
|
|
1168
1197
|
}
|
|
1169
|
-
let Ee = (e) =>
|
|
1170
|
-
|
|
1171
|
-
let ke = null,
|
|
1172
|
-
|
|
1198
|
+
let Ee = (e) => oi(S, w, { content: e }), Oe = (e) => s ? `${e}\n\n${I("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._")}` : e;
|
|
1199
|
+
k(w, "promptSent");
|
|
1200
|
+
let ke = null, T = !1, Re = vt, D = yt([], g);
|
|
1201
|
+
E.render?.arm(g);
|
|
1202
|
+
let Be = Date.now() + b.streamBudgetMs, Ve = Date.now(), He = Date.now(), Ue = zn(() => fe(i, C, c, y, ge, {
|
|
1203
|
+
limit: 50,
|
|
1204
|
+
sinceMs: g,
|
|
1205
|
+
surfaceTurnTerminal: !0
|
|
1206
|
+
})), We = E.stream?.onIdle(() => Ue.startExtra());
|
|
1207
|
+
for (; Date.now() < Be;) {
|
|
1173
1208
|
ve(i, c);
|
|
1174
1209
|
let e = je();
|
|
1175
1210
|
if (e.abandon) {
|
|
1176
|
-
e.clearProcessing &&
|
|
1211
|
+
e.clearProcessing && li(S);
|
|
1177
1212
|
return;
|
|
1178
1213
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
sinceMs: g,
|
|
1182
|
-
surfaceTurnTerminal: !0
|
|
1183
|
-
}), g, { accumulateNarration: oe.accumulatesNarration }), ei(x, C, { content: be(T.content) }), T.hasRenderableOutput ? w || (w = !0, ke !== null && D(C, "lastQuietPoll", ke), D(C, "firstOutput")) : ke = Mt(), oe.accumulatesNarration) T.hasText && D(C, "firstText");
|
|
1214
|
+
let t = await Ue.next();
|
|
1215
|
+
if (D = yt(t, g, { accumulateNarration: b.accumulatesNarration }), oi(S, w, { content: be(D.content) }), D.hasRenderableOutput ? T || (T = !0, ke !== null && k(w, "lastQuietPoll", ke), k(w, "firstOutput")) : ke = jt(), b.accumulatesNarration) D.hasText && k(w, "firstText");
|
|
1184
1216
|
else {
|
|
1185
|
-
let e =
|
|
1186
|
-
|
|
1217
|
+
let e = Ct(Re, D, jt());
|
|
1218
|
+
Re = e.tracker, e.confirmedAt !== null && k(w, "firstText", e.confirmedAt);
|
|
1187
1219
|
}
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
1220
|
+
if (D.pendingWrite && !Kt(x.getState().sandboxWriteCapabilities[i]) && si(S, w, { pendingWrite: D.pendingWrite }), D.done && (E.stream ? O(w, {
|
|
1221
|
+
transport: E.stream.reachedOpen ? "sse" : "poll",
|
|
1222
|
+
live: jn(E.stream.live)
|
|
1223
|
+
}) : O(w, {
|
|
1224
|
+
transport: "poll",
|
|
1225
|
+
live: "none"
|
|
1226
|
+
}), Fe()), D.done) {
|
|
1227
|
+
k(w, "answerDone"), J.current.markVerified(i);
|
|
1190
1228
|
break;
|
|
1191
1229
|
}
|
|
1192
|
-
Date.now() -
|
|
1230
|
+
if (E.render?.refresh(t), Date.now() - Ve > 3e4 && (await le(i, C, 600, ge).catch(() => void 0), Ve = Date.now()), !Ue.hasPending()) {
|
|
1231
|
+
let e = ze(Date.now() - He);
|
|
1232
|
+
E.stream ? await E.stream.waitWake(e) : await new Promise((t) => setTimeout(t, e));
|
|
1233
|
+
}
|
|
1193
1234
|
}
|
|
1194
|
-
if (
|
|
1195
|
-
let e = be(Oe(
|
|
1196
|
-
e.trim() && (s && Ee(e),
|
|
1197
|
-
conversationId:
|
|
1235
|
+
if (We?.(), Ie(), D.done && n.voiceSessionId !== void 0 && !je().abandon) {
|
|
1236
|
+
let e = be(Oe(D.content));
|
|
1237
|
+
e.trim() && (s && Ee(e), k(w, "speechQueued"), Le = !0, Pe.publish(w, {
|
|
1238
|
+
conversationId: S,
|
|
1198
1239
|
channel: "voice",
|
|
1199
1240
|
voiceSessionId: n.voiceSessionId,
|
|
1200
1241
|
text: e,
|
|
1201
|
-
lang:
|
|
1242
|
+
lang: Qr,
|
|
1202
1243
|
final: !0
|
|
1203
1244
|
}));
|
|
1204
1245
|
}
|
|
1205
|
-
let
|
|
1206
|
-
|
|
1207
|
-
...
|
|
1208
|
-
content: Ae(
|
|
1209
|
-
}), s && (
|
|
1210
|
-
...
|
|
1211
|
-
content: Oe(
|
|
1246
|
+
let Ge = b.producesArtifacts ? await de(i, C, c, y, ge).then((e) => e).catch(() => []) : void 0;
|
|
1247
|
+
D.usedTools !== void 0 && O(w, { usedTools: D.usedTools }), D.done || (O(w, { outcome: "timedOut" }), D = {
|
|
1248
|
+
...D,
|
|
1249
|
+
content: Ae(D.content, y, I, re)
|
|
1250
|
+
}), s && (D = {
|
|
1251
|
+
...D,
|
|
1252
|
+
content: Oe(D.content)
|
|
1212
1253
|
});
|
|
1213
|
-
let
|
|
1214
|
-
Me(
|
|
1215
|
-
workspaceId:
|
|
1254
|
+
let Ke = !D.done;
|
|
1255
|
+
Me(D.content, Ge, c, i, Ke), D.tokens && (oi(S, w, { tokens: D.tokens }), (Hr ? await De({
|
|
1256
|
+
workspaceId: C,
|
|
1216
1257
|
sessionId: c,
|
|
1217
|
-
messageId:
|
|
1218
|
-
model:
|
|
1219
|
-
tokens:
|
|
1220
|
-
},
|
|
1221
|
-
let
|
|
1222
|
-
if (
|
|
1223
|
-
|
|
1258
|
+
messageId: D.messageId,
|
|
1259
|
+
model: D.model,
|
|
1260
|
+
tokens: D.tokens
|
|
1261
|
+
}, Hr, { ledger: Te("panel", L) }) : { ok: !0 }).ok && Sr(L)), D.done || ve(i, c);
|
|
1262
|
+
let qe = je();
|
|
1263
|
+
if (qe.abandon) {
|
|
1264
|
+
qe.clearProcessing && li(S);
|
|
1224
1265
|
return;
|
|
1225
1266
|
}
|
|
1226
|
-
|
|
1267
|
+
k(w, "complete"), O(w, { outcome: "answered" }), ci(S, "complete", w, null), un.recordCommittedEntries(S, [ye.id, w], "TURN", C), Le = !1;
|
|
1227
1268
|
} catch (e) {
|
|
1228
|
-
J.current.invalidate(a ??
|
|
1229
|
-
let t =
|
|
1230
|
-
turnId:
|
|
1231
|
-
abortRequested:
|
|
1232
|
-
activeTurnId:
|
|
1233
|
-
conversationExists:
|
|
1269
|
+
J.current.invalidate(a ?? x.getState().sandboxesByMode[y]?.sandboxId ?? null);
|
|
1270
|
+
let t = ht({
|
|
1271
|
+
turnId: w,
|
|
1272
|
+
abortRequested: Ta.current.has(w),
|
|
1273
|
+
activeTurnId: x.getState().processingByConversationId[S]?.messageId ?? null,
|
|
1274
|
+
conversationExists: ue()
|
|
1234
1275
|
});
|
|
1235
|
-
if (a && o && ve(a, o), t.abandon) {
|
|
1236
|
-
t.clearProcessing &&
|
|
1276
|
+
if (Fe(), a && o && ve(a, o), t.abandon) {
|
|
1277
|
+
t.clearProcessing && li(S);
|
|
1237
1278
|
return;
|
|
1238
1279
|
}
|
|
1239
|
-
if (i === 1 &&
|
|
1240
|
-
let e = a ??
|
|
1241
|
-
return e && (Y.current.add(e), J.current.invalidate(e)),
|
|
1280
|
+
if (i === 1 && It(e)) {
|
|
1281
|
+
let e = a ?? x.getState().sandboxesByMode[y]?.sandboxId ?? null;
|
|
1282
|
+
return e && (Y.current.add(e), J.current.invalidate(e)), di(S), pi(y), ai(S, w, ""), si(S, w, { pendingWrite: void 0 }), e && q.retireSandbox(e), Ie(), Re(), At(w), D(2);
|
|
1242
1283
|
}
|
|
1243
1284
|
throw e;
|
|
1244
1285
|
}
|
|
1245
|
-
},
|
|
1246
|
-
|
|
1286
|
+
}, Be = S;
|
|
1287
|
+
fa.current.add(Be);
|
|
1247
1288
|
try {
|
|
1248
|
-
if (!
|
|
1289
|
+
if (!C) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
|
|
1249
1290
|
code: "UNAUTHENTICATED",
|
|
1250
1291
|
authFailure: "WORKSPACE_CONTEXT_MISSING"
|
|
1251
1292
|
} });
|
|
1252
|
-
let e = await
|
|
1253
|
-
re = e.config,
|
|
1293
|
+
let e = await ft(y, () => Hi.current.find((e) => e.id === y), Vi);
|
|
1294
|
+
re = e.config, b = e.capabilities;
|
|
1254
1295
|
let t = re, n = je();
|
|
1255
1296
|
if (n.abandon) {
|
|
1256
|
-
n.clearProcessing &&
|
|
1297
|
+
n.clearProcessing && li(S);
|
|
1257
1298
|
return;
|
|
1258
1299
|
}
|
|
1259
|
-
let i = ae(y, t,
|
|
1300
|
+
let i = ae(y, t, x.getState().acknowledgedWriteModes, {
|
|
1260
1301
|
dictated: r,
|
|
1261
1302
|
confirmsWrites: me(y),
|
|
1262
|
-
proposalBound:
|
|
1303
|
+
proposalBound: Wr(y)
|
|
1263
1304
|
});
|
|
1264
1305
|
if (i) throw new xe(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
|
|
1265
|
-
let a = Te("panel",
|
|
1266
|
-
if (
|
|
1267
|
-
let e = await Oe(a,
|
|
1306
|
+
let a = Te("panel", L);
|
|
1307
|
+
if (Hr && Ee(a, C)) {
|
|
1308
|
+
let e = await Oe(a, C, Hr);
|
|
1268
1309
|
if (!e.ok) throw ke(e.kind);
|
|
1269
1310
|
let t = je();
|
|
1270
1311
|
if (t.abandon) {
|
|
1271
|
-
t.clearProcessing &&
|
|
1312
|
+
t.clearProcessing && li(S);
|
|
1272
1313
|
return;
|
|
1273
1314
|
}
|
|
1274
1315
|
}
|
|
1275
|
-
|
|
1316
|
+
k(w, "cleared"), await D();
|
|
1276
1317
|
} catch (e) {
|
|
1277
|
-
if (J.current.invalidate(
|
|
1278
|
-
|
|
1318
|
+
if (J.current.invalidate(x.getState().sandboxesByMode[y]?.sandboxId ?? null), !ue()) {
|
|
1319
|
+
li(S);
|
|
1279
1320
|
return;
|
|
1280
1321
|
}
|
|
1281
1322
|
let t = Ne.session?.sandboxId ?? null, r = Se(e, { confirmsNoAction: Ce({
|
|
1282
1323
|
mode: y,
|
|
1283
|
-
capabilities: t ?
|
|
1324
|
+
capabilities: t ? x.getState().sandboxWriteCapabilities[t] : null
|
|
1284
1325
|
}) });
|
|
1285
|
-
|
|
1286
|
-
let i = we(r,
|
|
1287
|
-
|
|
1288
|
-
lang: i.translated ?
|
|
1289
|
-
...
|
|
1326
|
+
O(w, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && xr(L, "sandbox");
|
|
1327
|
+
let i = we(r, I, { locale: H });
|
|
1328
|
+
ci(S, "error", w, i.headline), oi(S, w, { content: i.text }), si(S, w, {
|
|
1329
|
+
lang: i.translated ? H : "en",
|
|
1330
|
+
...T(n.voiceSessionId)
|
|
1290
1331
|
});
|
|
1291
1332
|
} finally {
|
|
1292
|
-
|
|
1293
|
-
let e =
|
|
1294
|
-
t && (
|
|
1333
|
+
fa.current.delete(Be), O(w, { outcome: "stopped" }), k(w, "complete"), Re(), Ie();
|
|
1334
|
+
let e = x.getState(), t = d(ce, y, e.conversations.find((e) => e.id === Be), (t) => !!e.sandboxesByMode[t]?.sandboxId);
|
|
1335
|
+
t && (vi(Be, t.mode), t.backendSessionId && ui(Be, t.backendSessionId)), Ne.session && ue() && q.afterTurn({
|
|
1295
1336
|
...Ne.session,
|
|
1296
|
-
conversationId:
|
|
1297
|
-
},
|
|
1298
|
-
let n =
|
|
1299
|
-
|
|
1337
|
+
conversationId: Be
|
|
1338
|
+
}, w);
|
|
1339
|
+
let n = Ea.current;
|
|
1340
|
+
Ea.current = null, n && n.conversationId === Be && ue() && ao.current(n.content, n.attachments, n.options);
|
|
1300
1341
|
}
|
|
1301
1342
|
}, [
|
|
1302
|
-
|
|
1343
|
+
U,
|
|
1303
1344
|
G,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1345
|
+
Br,
|
|
1346
|
+
di,
|
|
1347
|
+
pi,
|
|
1348
|
+
$r,
|
|
1349
|
+
ii,
|
|
1350
|
+
ya,
|
|
1310
1351
|
q,
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1352
|
+
Oa,
|
|
1353
|
+
Ka,
|
|
1354
|
+
no,
|
|
1355
|
+
H,
|
|
1356
|
+
Yr,
|
|
1315
1357
|
Wr,
|
|
1316
1358
|
zr,
|
|
1317
|
-
|
|
1318
|
-
z,
|
|
1319
|
-
Br,
|
|
1320
|
-
ei,
|
|
1321
|
-
I,
|
|
1322
|
-
Fi,
|
|
1323
|
-
Lr,
|
|
1324
|
-
Kr,
|
|
1325
|
-
V,
|
|
1326
|
-
qr,
|
|
1359
|
+
B,
|
|
1327
1360
|
Gr,
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
ia,
|
|
1333
|
-
ii,
|
|
1361
|
+
oi,
|
|
1362
|
+
L,
|
|
1363
|
+
Vi,
|
|
1364
|
+
Hr,
|
|
1334
1365
|
Zr,
|
|
1366
|
+
H,
|
|
1367
|
+
Qr,
|
|
1368
|
+
Xr,
|
|
1369
|
+
vi,
|
|
1370
|
+
to,
|
|
1371
|
+
Ua,
|
|
1372
|
+
la,
|
|
1373
|
+
ua,
|
|
1374
|
+
ui,
|
|
1335
1375
|
ni,
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1376
|
+
ci,
|
|
1377
|
+
li,
|
|
1378
|
+
I,
|
|
1379
|
+
_a,
|
|
1380
|
+
ai,
|
|
1381
|
+
V
|
|
1382
|
+
]), ro = j((e, t) => {
|
|
1342
1383
|
X(e, [], t ? { autoIntent: t } : {});
|
|
1343
|
-
}, [X]),
|
|
1344
|
-
let e = [...
|
|
1384
|
+
}, [X]), io = j(() => {
|
|
1385
|
+
let e = [...bi.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
|
|
1345
1386
|
if (!e || e.metadata?.approvalFollowUp) return;
|
|
1346
|
-
let t =
|
|
1387
|
+
let t = U ? da.current[U] ?? [] : [];
|
|
1347
1388
|
X(e.content, t);
|
|
1348
1389
|
}, [
|
|
1349
|
-
|
|
1390
|
+
xi,
|
|
1350
1391
|
X,
|
|
1351
|
-
|
|
1352
|
-
]),
|
|
1353
|
-
|
|
1354
|
-
|
|
1392
|
+
U
|
|
1393
|
+
]), ao = N(X);
|
|
1394
|
+
M(() => {
|
|
1395
|
+
ao.current = X;
|
|
1355
1396
|
}, [X]);
|
|
1356
|
-
let
|
|
1357
|
-
if (
|
|
1358
|
-
for (let e =
|
|
1359
|
-
let t =
|
|
1360
|
-
if (t?.role !== "assistant" || !Me(t) ||
|
|
1361
|
-
let n =
|
|
1397
|
+
let oo = Or(() => {
|
|
1398
|
+
if (Si) return null;
|
|
1399
|
+
for (let e = xi.length - 1; e >= 0; --e) {
|
|
1400
|
+
let t = xi[e];
|
|
1401
|
+
if (t?.role !== "assistant" || !Me(t) || Ta.current.has(t.id) || E(t.id)) continue;
|
|
1402
|
+
let n = _t(t, K, I);
|
|
1362
1403
|
if (n.kind !== "output") return null;
|
|
1363
|
-
let r =
|
|
1404
|
+
let r = wt(n.text).text.trim();
|
|
1364
1405
|
return r ? {
|
|
1365
1406
|
id: t.id,
|
|
1366
1407
|
text: r
|
|
@@ -1368,70 +1409,70 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
1368
1409
|
}
|
|
1369
1410
|
return null;
|
|
1370
1411
|
}, [
|
|
1371
|
-
|
|
1372
|
-
|
|
1412
|
+
xi,
|
|
1413
|
+
Si,
|
|
1373
1414
|
K,
|
|
1374
|
-
|
|
1375
|
-
]),
|
|
1376
|
-
sessionId:
|
|
1377
|
-
sandboxId:
|
|
1415
|
+
I
|
|
1416
|
+
]), so = Or(() => oo ? D(oo.text) : null, [oo]), co = bi.chat, lo = x((e) => b(e)?.sandboxId ?? null), uo = v(co, {
|
|
1417
|
+
sessionId: yi?.backendSessionId,
|
|
1418
|
+
sandboxId: lo,
|
|
1378
1419
|
nowMs: Date.now()
|
|
1379
|
-
}),
|
|
1380
|
-
if (
|
|
1420
|
+
}), fo = y(co), po = (e) => {
|
|
1421
|
+
if (Gt(e.metadata).length > 0) return !0;
|
|
1381
1422
|
let t = e.metadata?.sandboxId;
|
|
1382
|
-
return
|
|
1383
|
-
},
|
|
1384
|
-
let t =
|
|
1385
|
-
return t.length === 0 || !
|
|
1423
|
+
return Kt(t ? Ti[t] : null);
|
|
1424
|
+
}, mo = (e) => {
|
|
1425
|
+
let t = Gt(e.metadata);
|
|
1426
|
+
return t.length === 0 || !U ? null : /* @__PURE__ */ P(Wt, {
|
|
1386
1427
|
refs: t,
|
|
1387
|
-
conversationId:
|
|
1428
|
+
conversationId: U,
|
|
1388
1429
|
panel: q,
|
|
1389
|
-
entries:
|
|
1390
|
-
capabilitiesOf: (e) =>
|
|
1391
|
-
turnInFlight:
|
|
1392
|
-
tr:
|
|
1393
|
-
onReview:
|
|
1394
|
-
retiredSandboxes:
|
|
1430
|
+
entries: Ei,
|
|
1431
|
+
capabilitiesOf: (e) => Ti[e],
|
|
1432
|
+
turnInFlight: Si,
|
|
1433
|
+
tr: I,
|
|
1434
|
+
onReview: Oi.review,
|
|
1435
|
+
retiredSandboxes: Di
|
|
1395
1436
|
});
|
|
1396
|
-
},
|
|
1397
|
-
|
|
1398
|
-
if (
|
|
1399
|
-
let e = window.setTimeout(() =>
|
|
1437
|
+
}, ho = Oi.dialog.view ? Ei[Oi.dialog.view.proposalId] : void 0, go = uo?.expiresAtMs ?? null;
|
|
1438
|
+
M(() => {
|
|
1439
|
+
if (go === null) return;
|
|
1440
|
+
let e = window.setTimeout(() => wa((e) => e + 1), Math.max(0, go - Date.now()));
|
|
1400
1441
|
return () => window.clearTimeout(e);
|
|
1401
|
-
}, [
|
|
1402
|
-
let Z =
|
|
1442
|
+
}, [go, Ca]);
|
|
1443
|
+
let Z = Or(() => bi.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
|
|
1403
1444
|
id: e.id,
|
|
1404
1445
|
role: e.role,
|
|
1405
|
-
text:
|
|
1446
|
+
text: Dt(e, K, I),
|
|
1406
1447
|
sessionId: Ne(e),
|
|
1407
1448
|
timestamp: e.timestamp
|
|
1408
1449
|
})).filter((e) => e.text.length > 0), [
|
|
1409
|
-
|
|
1450
|
+
bi.voice,
|
|
1410
1451
|
K,
|
|
1411
|
-
|
|
1412
|
-
]),
|
|
1452
|
+
I
|
|
1453
|
+
]), _o = j(() => {
|
|
1413
1454
|
if (Z.length === 0) return;
|
|
1414
1455
|
let e = /* @__PURE__ */ new Date();
|
|
1415
|
-
|
|
1416
|
-
title:
|
|
1417
|
-
savedAt:
|
|
1418
|
-
session:
|
|
1419
|
-
earlier:
|
|
1420
|
-
you:
|
|
1421
|
-
assistant:
|
|
1422
|
-
}, e), Re(
|
|
1456
|
+
rn(Le(Z, {
|
|
1457
|
+
title: I("voiceSession.transcript", "Voice conversation"),
|
|
1458
|
+
savedAt: I("voiceSession.savedAt", "Saved"),
|
|
1459
|
+
session: I("voiceSession.sessionLabel", "Session"),
|
|
1460
|
+
earlier: I("voiceSession.earlierLabel", "Earlier"),
|
|
1461
|
+
you: I("voiceSession.speakerYou", "You"),
|
|
1462
|
+
assistant: I("voiceSession.speakerAssistant", "Assistant")
|
|
1463
|
+
}, e), Re(L, e), "text/markdown");
|
|
1423
1464
|
}, [
|
|
1424
|
-
|
|
1465
|
+
L,
|
|
1425
1466
|
Z,
|
|
1426
|
-
|
|
1427
|
-
]),
|
|
1428
|
-
|
|
1429
|
-
let
|
|
1430
|
-
onSubmit:
|
|
1431
|
-
let i =
|
|
1432
|
-
let o =
|
|
1433
|
-
if (!
|
|
1434
|
-
sessionLive:
|
|
1467
|
+
I
|
|
1468
|
+
]), vo = Cr({ perFileChars: $i }), yo = N(vo);
|
|
1469
|
+
yo.current = vo;
|
|
1470
|
+
let bo = N(/* @__PURE__ */ new Set()), xo = N(() => !1), Q = Nt({
|
|
1471
|
+
onSubmit: j((e, t, n, r) => {
|
|
1472
|
+
let i = oa.current, a = Xe(i), o = () => {
|
|
1473
|
+
let o = yo.current, s = x.getState();
|
|
1474
|
+
if (!We({
|
|
1475
|
+
sessionLive: xo.current(t),
|
|
1435
1476
|
boundAtSubmit: i,
|
|
1436
1477
|
activeConversationId: s.activeConversationId,
|
|
1437
1478
|
boundConversationExists: s.conversations.some((e) => e.id === a)
|
|
@@ -1439,11 +1480,11 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
1439
1480
|
o.clear();
|
|
1440
1481
|
return;
|
|
1441
1482
|
}
|
|
1442
|
-
let c =
|
|
1483
|
+
let c = $e(o.attachments), l = {
|
|
1443
1484
|
...n,
|
|
1444
|
-
handedOver:
|
|
1485
|
+
handedOver: jt()
|
|
1445
1486
|
};
|
|
1446
|
-
|
|
1487
|
+
ao.current(e, c, {
|
|
1447
1488
|
fromPerson: !0,
|
|
1448
1489
|
voiceSessionId: t,
|
|
1449
1490
|
voiceTiming: l,
|
|
@@ -1451,409 +1492,409 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
1451
1492
|
}), o.clear();
|
|
1452
1493
|
};
|
|
1453
1494
|
if ((() => {
|
|
1454
|
-
let e =
|
|
1455
|
-
return
|
|
1456
|
-
sessionLive:
|
|
1495
|
+
let e = x.getState();
|
|
1496
|
+
return We({
|
|
1497
|
+
sessionLive: xo.current(t),
|
|
1457
1498
|
boundAtSubmit: i,
|
|
1458
1499
|
activeConversationId: e.activeConversationId,
|
|
1459
1500
|
boundConversationExists: e.conversations.some((e) => e.id === a)
|
|
1460
1501
|
});
|
|
1461
|
-
})() &&
|
|
1462
|
-
|
|
1502
|
+
})() && Ga.current(e, t)) {
|
|
1503
|
+
ao.current(e, [], {
|
|
1463
1504
|
fromPerson: !0,
|
|
1464
1505
|
voiceSessionId: t,
|
|
1465
1506
|
voiceTiming: {
|
|
1466
1507
|
...n,
|
|
1467
|
-
handedOver:
|
|
1508
|
+
handedOver: jt()
|
|
1468
1509
|
}
|
|
1469
1510
|
});
|
|
1470
1511
|
return;
|
|
1471
1512
|
}
|
|
1472
|
-
if (!
|
|
1513
|
+
if (!yo.current.isBusy) {
|
|
1473
1514
|
o();
|
|
1474
1515
|
return;
|
|
1475
1516
|
}
|
|
1476
|
-
let s = Date.now(), c =
|
|
1477
|
-
|
|
1517
|
+
let s = Date.now(), c = bo.current, l = window.setInterval(() => {
|
|
1518
|
+
yo.current.isBusy && Date.now() - s < Pr || (window.clearInterval(l), c.delete(l), o());
|
|
1478
1519
|
}, 200);
|
|
1479
1520
|
c.add(l);
|
|
1480
1521
|
}, []),
|
|
1481
|
-
latestReply:
|
|
1482
|
-
language:
|
|
1483
|
-
graceMs:
|
|
1484
|
-
onSupersede:
|
|
1522
|
+
latestReply: oo,
|
|
1523
|
+
language: Be(qr, H).tag,
|
|
1524
|
+
graceMs: Kr,
|
|
1525
|
+
onSupersede: ka
|
|
1485
1526
|
});
|
|
1486
|
-
|
|
1487
|
-
let
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}, [
|
|
1491
|
-
let $ = Q.active,
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
]), [
|
|
1496
|
-
|
|
1497
|
-
$ ||
|
|
1527
|
+
xo.current = Q.isCurrentSession;
|
|
1528
|
+
let So = sa ? Z.filter((e) => e.sessionId !== void 0 && Q.isCurrentSession(e.sessionId)) : Z, Co = Q.answerLocally;
|
|
1529
|
+
M(() => {
|
|
1530
|
+
Xa.current = Co;
|
|
1531
|
+
}, [Co]);
|
|
1532
|
+
let $ = Q.active, wo = Or(() => ct(Object.values(Ei), U, Di), [
|
|
1533
|
+
Ei,
|
|
1534
|
+
U,
|
|
1535
|
+
Di
|
|
1536
|
+
]), [To, Eo] = kr(null);
|
|
1537
|
+
M(() => {
|
|
1538
|
+
$ || Eo(null);
|
|
1498
1539
|
}, [$]);
|
|
1499
|
-
let
|
|
1500
|
-
let e =
|
|
1540
|
+
let Do = Oi.review, Oo = j(() => {
|
|
1541
|
+
let e = wo[wo.length - 1];
|
|
1501
1542
|
if (!e) return;
|
|
1502
1543
|
let { view: t } = e;
|
|
1503
|
-
if (
|
|
1504
|
-
|
|
1544
|
+
if (Vt(t) && Bt(t, Ti[e.session.sandboxId]).offerConfirm) {
|
|
1545
|
+
Do(t);
|
|
1505
1546
|
return;
|
|
1506
1547
|
}
|
|
1507
|
-
|
|
1548
|
+
Eo(t.proposalId);
|
|
1508
1549
|
}, [
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
]),
|
|
1513
|
-
content: /* @__PURE__ */
|
|
1550
|
+
wo,
|
|
1551
|
+
Ti,
|
|
1552
|
+
Do
|
|
1553
|
+
]), ko = $ ? at(wo) : null, Ao = To ? Ei[To] : void 0, jo = $ && Ao && Ao.session.conversationId === U ? {
|
|
1554
|
+
content: /* @__PURE__ */ P(Wt, {
|
|
1514
1555
|
refs: [{
|
|
1515
|
-
proposalId:
|
|
1516
|
-
sandboxId:
|
|
1517
|
-
sessionId:
|
|
1556
|
+
proposalId: Ao.view.proposalId,
|
|
1557
|
+
sandboxId: Ao.session.sandboxId,
|
|
1558
|
+
sessionId: Ao.session.sessionId
|
|
1518
1559
|
}],
|
|
1519
|
-
conversationId:
|
|
1560
|
+
conversationId: Ao.session.conversationId,
|
|
1520
1561
|
panel: q,
|
|
1521
|
-
entries:
|
|
1522
|
-
capabilitiesOf: (e) =>
|
|
1523
|
-
turnInFlight:
|
|
1524
|
-
tr:
|
|
1525
|
-
onReview:
|
|
1526
|
-
retiredSandboxes:
|
|
1562
|
+
entries: Ei,
|
|
1563
|
+
capabilitiesOf: (e) => Ti[e],
|
|
1564
|
+
turnInFlight: Si,
|
|
1565
|
+
tr: I,
|
|
1566
|
+
onReview: Do,
|
|
1567
|
+
retiredSandboxes: Di
|
|
1527
1568
|
}),
|
|
1528
|
-
closeLabel:
|
|
1529
|
-
onClose: () =>
|
|
1530
|
-
} : null,
|
|
1531
|
-
r("assistant.transcript",
|
|
1569
|
+
closeLabel: lt(I, rt.trayClose),
|
|
1570
|
+
onClose: () => Eo(null)
|
|
1571
|
+
} : null, Mo = Oi.asking, No = qa?.asking === !0, Po = Ja?.asking === !0, Fo = Q.holdListening;
|
|
1572
|
+
r("assistant.transcript", Or(() => $ ? null : { run: () => ia ? { status: "already" } : (aa(!0), { status: "done" }) }, [
|
|
1532
1573
|
$,
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
])), r("assistant.conversation.new",
|
|
1536
|
-
let e =
|
|
1574
|
+
ia,
|
|
1575
|
+
aa
|
|
1576
|
+
])), r("assistant.conversation.new", Or(() => $ ? null : { run: () => {
|
|
1577
|
+
let e = x.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
|
|
1537
1578
|
return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
|
|
1538
|
-
} }, [$])),
|
|
1539
|
-
|
|
1579
|
+
} }, [$])), M(() => {
|
|
1580
|
+
Fo($ && (Mo || No || Po));
|
|
1540
1581
|
}, [
|
|
1541
1582
|
$,
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1583
|
+
Mo,
|
|
1584
|
+
No,
|
|
1585
|
+
Po,
|
|
1586
|
+
Fo
|
|
1546
1587
|
]);
|
|
1547
|
-
let
|
|
1548
|
-
|
|
1588
|
+
let Io = N(null), Lo = Q.announce;
|
|
1589
|
+
M(() => {
|
|
1549
1590
|
if (!$) {
|
|
1550
|
-
|
|
1591
|
+
Io.current = null;
|
|
1551
1592
|
return;
|
|
1552
1593
|
}
|
|
1553
|
-
let e =
|
|
1594
|
+
let e = Io.current;
|
|
1554
1595
|
if (e === null) {
|
|
1555
|
-
|
|
1596
|
+
Io.current = new Set(Object.keys(Ei));
|
|
1556
1597
|
return;
|
|
1557
1598
|
}
|
|
1558
|
-
for (let { view: t, session: n } of
|
|
1599
|
+
for (let { view: t, session: n } of st(wo, e)) {
|
|
1559
1600
|
e.add(t.proposalId);
|
|
1560
|
-
let r =
|
|
1561
|
-
if (!
|
|
1601
|
+
let r = Ti[n.sandboxId];
|
|
1602
|
+
if (!it({
|
|
1562
1603
|
mode: "api-calls",
|
|
1563
|
-
productWriteApproval:
|
|
1604
|
+
productWriteApproval: z,
|
|
1564
1605
|
capabilities: r
|
|
1565
1606
|
})) continue;
|
|
1566
|
-
let i =
|
|
1567
|
-
|
|
1607
|
+
let i = ut(t, Bt(t, r).offerConfirm, I), a = t.proposalId;
|
|
1608
|
+
Lo({
|
|
1568
1609
|
id: `write-readback:${a}`,
|
|
1569
1610
|
text: i.text,
|
|
1570
|
-
lang: i.translated ?
|
|
1611
|
+
lang: i.translated ? H : "en",
|
|
1571
1612
|
stillWanted: () => q.entry(a)?.view.status === "pending"
|
|
1572
1613
|
});
|
|
1573
1614
|
}
|
|
1574
1615
|
}, [
|
|
1575
1616
|
$,
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1617
|
+
wo,
|
|
1618
|
+
Ei,
|
|
1619
|
+
Ti,
|
|
1620
|
+
z,
|
|
1621
|
+
I,
|
|
1622
|
+
H,
|
|
1623
|
+
Lo,
|
|
1583
1624
|
q
|
|
1584
1625
|
]);
|
|
1585
|
-
let
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}, [Q.active]),
|
|
1589
|
-
if (!
|
|
1590
|
-
let t =
|
|
1591
|
-
return typeof t == "string" ? t === e :
|
|
1626
|
+
let Ro = N(!1);
|
|
1627
|
+
M(() => {
|
|
1628
|
+
Ro.current = Q.active;
|
|
1629
|
+
}, [Q.active]), M(() => m((e) => {
|
|
1630
|
+
if (!Ro.current) return !1;
|
|
1631
|
+
let t = oa.current;
|
|
1632
|
+
return typeof t == "string" ? t === e : x.getState().activeConversationId === e;
|
|
1592
1633
|
}), []);
|
|
1593
|
-
let
|
|
1594
|
-
let e =
|
|
1595
|
-
|
|
1634
|
+
let zo = Q.start, Bo = j(() => {
|
|
1635
|
+
let e = x.getState().activeConversationId, t = qe(ua());
|
|
1636
|
+
la(Ye(t, e)), ba(!0, t.kind === "own"), zo();
|
|
1596
1637
|
}, [
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
]),
|
|
1602
|
-
let e =
|
|
1638
|
+
la,
|
|
1639
|
+
ba,
|
|
1640
|
+
ua,
|
|
1641
|
+
zo
|
|
1642
|
+
]), Vo = Or(() => Et(yi?.messages ?? []), [yi?.messages]), Ho = Tt(bi.voice, K, I), Uo = Tt(Vo, K, I) > 0, Wo = j(() => {
|
|
1643
|
+
let e = x.getState().activeConversationId;
|
|
1603
1644
|
if (!e || Z.length === 0) return;
|
|
1604
|
-
let t = new Set(
|
|
1645
|
+
let t = new Set(Vo.map((e) => e.id)), n = F();
|
|
1605
1646
|
G(e, {
|
|
1606
1647
|
id: n,
|
|
1607
1648
|
role: "system",
|
|
1608
|
-
content:
|
|
1609
|
-
intro:
|
|
1610
|
-
nothing:
|
|
1611
|
-
more: (e) =>
|
|
1649
|
+
content: Ie(Z.filter((e) => t.has(e.id)), {
|
|
1650
|
+
intro: I("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
|
|
1651
|
+
nothing: I("voiceSession.continuedNothing", "Continued from a voice conversation."),
|
|
1652
|
+
more: (e) => I("voiceSession.continuedMore", "…and {{count}} more", { count: e })
|
|
1612
1653
|
}),
|
|
1613
1654
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1614
|
-
metadata: { continuedVoiceTurns:
|
|
1615
|
-
}),
|
|
1655
|
+
metadata: { continuedVoiceTurns: Ho }
|
|
1656
|
+
}), un.recordCommittedEntries(e, [n], "NOTE", A()), aa(!1), Q.end();
|
|
1616
1657
|
}, [
|
|
1617
1658
|
Z,
|
|
1618
|
-
|
|
1619
|
-
|
|
1659
|
+
Ho,
|
|
1660
|
+
Vo,
|
|
1620
1661
|
G,
|
|
1621
|
-
|
|
1662
|
+
I,
|
|
1622
1663
|
Q,
|
|
1623
|
-
|
|
1624
|
-
]),
|
|
1664
|
+
aa
|
|
1665
|
+
]), Go = N({
|
|
1625
1666
|
conversationId: null,
|
|
1626
1667
|
count: 0
|
|
1627
1668
|
});
|
|
1628
|
-
|
|
1629
|
-
Q.active && (
|
|
1630
|
-
conversationId:
|
|
1631
|
-
count:
|
|
1669
|
+
M(() => {
|
|
1670
|
+
Q.active && (Go.current = {
|
|
1671
|
+
conversationId: U,
|
|
1672
|
+
count: Ho
|
|
1632
1673
|
});
|
|
1633
1674
|
}, [Q.active]);
|
|
1634
|
-
let
|
|
1635
|
-
let e =
|
|
1636
|
-
Q.end(), t &&
|
|
1675
|
+
let Ko = j(() => {
|
|
1676
|
+
let e = Go.current, t = Ho > (e.conversationId === U ? e.count : 0);
|
|
1677
|
+
Q.end(), t && aa(!0);
|
|
1637
1678
|
}, [
|
|
1638
|
-
|
|
1639
|
-
|
|
1679
|
+
U,
|
|
1680
|
+
Ho,
|
|
1640
1681
|
Q,
|
|
1641
|
-
|
|
1682
|
+
aa
|
|
1642
1683
|
]);
|
|
1643
|
-
|
|
1644
|
-
(!
|
|
1684
|
+
M(() => {
|
|
1685
|
+
(!Lr || !ga) && Q.active && Q.end();
|
|
1645
1686
|
}, [
|
|
1646
|
-
|
|
1647
|
-
|
|
1687
|
+
Lr,
|
|
1688
|
+
ga,
|
|
1648
1689
|
Q
|
|
1649
|
-
]),
|
|
1650
|
-
let e =
|
|
1690
|
+
]), M(() => {
|
|
1691
|
+
let e = oa.current, t = Xe(e), n = x.getState(), r = Ke({
|
|
1651
1692
|
sessionLive: Q.active,
|
|
1652
1693
|
bound: e,
|
|
1653
1694
|
activeConversationId: n.activeConversationId,
|
|
1654
1695
|
boundConversationExists: n.conversations.some((e) => e.id === t)
|
|
1655
1696
|
});
|
|
1656
|
-
|
|
1697
|
+
la(r.bound), r.end && Q.end();
|
|
1657
1698
|
}, [
|
|
1658
1699
|
Q,
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1700
|
+
U,
|
|
1701
|
+
$r,
|
|
1702
|
+
la
|
|
1662
1703
|
]);
|
|
1663
|
-
let
|
|
1664
|
-
|
|
1665
|
-
let e =
|
|
1666
|
-
activeConversationId:
|
|
1667
|
-
chatTurnCount:
|
|
1704
|
+
let qo = N(He);
|
|
1705
|
+
M(() => {
|
|
1706
|
+
let e = Ge(qo.current, {
|
|
1707
|
+
activeConversationId: U,
|
|
1708
|
+
chatTurnCount: co.length,
|
|
1668
1709
|
voiceTurnCount: Z.length,
|
|
1669
1710
|
sessionLive: Q.active,
|
|
1670
|
-
sessionBoundTo:
|
|
1671
|
-
turnInFlight:
|
|
1711
|
+
sessionBoundTo: oa.current,
|
|
1712
|
+
turnInFlight: Si
|
|
1672
1713
|
});
|
|
1673
|
-
|
|
1714
|
+
qo.current = e.state, e.open && aa(!0);
|
|
1674
1715
|
}, [
|
|
1675
|
-
|
|
1676
|
-
|
|
1716
|
+
U,
|
|
1717
|
+
co.length,
|
|
1677
1718
|
Z.length,
|
|
1678
1719
|
Q.active,
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
]),
|
|
1720
|
+
Si,
|
|
1721
|
+
aa
|
|
1722
|
+
]), M(() => {
|
|
1682
1723
|
if (!Q.active) {
|
|
1683
|
-
|
|
1684
|
-
for (let e of
|
|
1685
|
-
|
|
1724
|
+
yo.current.clear(), Ea.current = null;
|
|
1725
|
+
for (let e of bo.current) window.clearInterval(e);
|
|
1726
|
+
bo.current.clear();
|
|
1686
1727
|
}
|
|
1687
|
-
}, [Q.active]),
|
|
1688
|
-
let e =
|
|
1728
|
+
}, [Q.active]), M(() => {
|
|
1729
|
+
let e = bo.current;
|
|
1689
1730
|
return () => {
|
|
1690
1731
|
for (let t of e) window.clearInterval(t);
|
|
1691
1732
|
e.clear();
|
|
1692
1733
|
};
|
|
1693
|
-
}, []),
|
|
1694
|
-
let e =
|
|
1695
|
-
return e &&
|
|
1734
|
+
}, []), M(() => {
|
|
1735
|
+
let e = x.getState().consumePendingPrompt();
|
|
1736
|
+
return e && ao.current(e), x.subscribe((e, t) => {
|
|
1696
1737
|
if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
|
|
1697
|
-
let e =
|
|
1698
|
-
e &&
|
|
1738
|
+
let e = x.getState().consumePendingPrompt();
|
|
1739
|
+
e && ao.current(e);
|
|
1699
1740
|
}
|
|
1700
1741
|
});
|
|
1701
1742
|
}, []);
|
|
1702
|
-
let
|
|
1703
|
-
let t =
|
|
1704
|
-
if (t && t.mode !== e && q.withdraw(t.id, "mode_switched"), t &&
|
|
1743
|
+
let Jo = j((e) => {
|
|
1744
|
+
let t = U ? x.getState().conversations.find((e) => e.id === U) : void 0;
|
|
1745
|
+
if (t && t.mode !== e && q.withdraw(t.id, "mode_switched"), t && an(t)) {
|
|
1705
1746
|
if (t.mode !== e) {
|
|
1706
|
-
let t = ee(), n =
|
|
1707
|
-
n ?
|
|
1747
|
+
let t = ee(), n = x.getState().conversations.find((n) => n.mode === e && cn(n, t) && !x.getState().processingByConversationId[n.id]);
|
|
1748
|
+
n ? ri(n.id) : ii(void 0, e);
|
|
1708
1749
|
}
|
|
1709
|
-
} else
|
|
1710
|
-
let n =
|
|
1711
|
-
n ?
|
|
1750
|
+
} else U && ni(U, e);
|
|
1751
|
+
let n = x.getState().activeConversationId;
|
|
1752
|
+
n ? ni(n, e) : _i(!1), ti(e);
|
|
1712
1753
|
}, [
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1754
|
+
U,
|
|
1755
|
+
ii,
|
|
1756
|
+
ri,
|
|
1757
|
+
_i,
|
|
1758
|
+
ni,
|
|
1759
|
+
ti,
|
|
1719
1760
|
q
|
|
1720
|
-
]),
|
|
1721
|
-
let e =
|
|
1761
|
+
]), Yo = j(() => {
|
|
1762
|
+
let e = x.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
|
|
1722
1763
|
if (!t) {
|
|
1723
|
-
|
|
1764
|
+
_i(!0), ti(c);
|
|
1724
1765
|
return;
|
|
1725
1766
|
}
|
|
1726
1767
|
if (t.routedBy === "auto") {
|
|
1727
|
-
|
|
1768
|
+
_i(!0);
|
|
1728
1769
|
return;
|
|
1729
1770
|
}
|
|
1730
|
-
if (!
|
|
1731
|
-
|
|
1771
|
+
if (!an(t)) {
|
|
1772
|
+
vi(t.id, c);
|
|
1732
1773
|
return;
|
|
1733
1774
|
}
|
|
1734
1775
|
q.withdraw(t.id, "mode_switched");
|
|
1735
|
-
let n = ee(), r = e.conversations.find((t) => t.routedBy === "auto" &&
|
|
1736
|
-
r ? (
|
|
1776
|
+
let n = ee(), r = e.conversations.find((t) => t.routedBy === "auto" && cn(t, n) && !e.processingByConversationId[t.id]);
|
|
1777
|
+
r ? (ri(r.id), vi(r.id, c)) : ii(void 0, c, { routedBy: "auto" });
|
|
1737
1778
|
}, [
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1779
|
+
ii,
|
|
1780
|
+
vi,
|
|
1781
|
+
ri,
|
|
1782
|
+
_i,
|
|
1783
|
+
ti,
|
|
1743
1784
|
q
|
|
1744
|
-
]),
|
|
1745
|
-
if (
|
|
1746
|
-
|
|
1785
|
+
]), Xo = j((e) => {
|
|
1786
|
+
if (R.find((t) => t.id === e)?.writeCapable && !ie(x.getState().acknowledgedWriteModes, e)) {
|
|
1787
|
+
ta(e);
|
|
1747
1788
|
return;
|
|
1748
1789
|
}
|
|
1749
|
-
|
|
1750
|
-
}, [
|
|
1751
|
-
let e =
|
|
1752
|
-
if (
|
|
1753
|
-
let t =
|
|
1754
|
-
if (
|
|
1755
|
-
|
|
1790
|
+
Jo(e);
|
|
1791
|
+
}, [Jo, R]), Zo = j(() => {
|
|
1792
|
+
let e = ea;
|
|
1793
|
+
if (ta(null), !e) return;
|
|
1794
|
+
let t = Zi.current;
|
|
1795
|
+
if (Zi.current = null, t) {
|
|
1796
|
+
hi(e), X(t.content, t.attachments, t.options);
|
|
1756
1797
|
return;
|
|
1757
1798
|
}
|
|
1758
|
-
|
|
1799
|
+
hi(e), Jo(e);
|
|
1759
1800
|
}, [
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1801
|
+
ea,
|
|
1802
|
+
hi,
|
|
1803
|
+
Jo,
|
|
1763
1804
|
X
|
|
1764
|
-
]),
|
|
1765
|
-
|
|
1766
|
-
let e =
|
|
1767
|
-
|
|
1805
|
+
]), Qo = ea === null ? void 0 : R.find((e) => e.id === ea) ?? { id: ea }, $o = j(() => {
|
|
1806
|
+
ta(null);
|
|
1807
|
+
let e = Zi.current;
|
|
1808
|
+
Zi.current = null, e && X(e.content, e.attachments, {
|
|
1768
1809
|
...e.options,
|
|
1769
1810
|
autoIntent: "read"
|
|
1770
1811
|
});
|
|
1771
1812
|
}, [X]);
|
|
1772
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ jr("div", {
|
|
1773
1814
|
className: "relative flex flex-1 flex-col overflow-hidden",
|
|
1774
1815
|
children: [
|
|
1775
|
-
/* @__PURE__ */
|
|
1816
|
+
/* @__PURE__ */ jr("div", {
|
|
1776
1817
|
className: "contents",
|
|
1777
1818
|
inert: Q.active || void 0,
|
|
1778
1819
|
children: [
|
|
1779
|
-
|
|
1780
|
-
Z.length > 0 && !Q.active ? /* @__PURE__ */
|
|
1820
|
+
Ri === null ? null : /* @__PURE__ */ P(Qt, { onDismiss: () => Li(Ri) }),
|
|
1821
|
+
Z.length > 0 && !Q.active ? /* @__PURE__ */ P(Xt, {
|
|
1781
1822
|
count: Z.length,
|
|
1782
|
-
onOpenTranscript: () =>
|
|
1823
|
+
onOpenTranscript: () => aa(!0)
|
|
1783
1824
|
}) : null,
|
|
1784
|
-
|
|
1785
|
-
state:
|
|
1786
|
-
onRetry:
|
|
1787
|
-
}) :
|
|
1825
|
+
co.length === 0 && (Ni || Pi) ? /* @__PURE__ */ P($t, {
|
|
1826
|
+
state: Ni ? "loading" : "failed",
|
|
1827
|
+
onRetry: Ui
|
|
1828
|
+
}) : co.length === 0 && yi?.sync?.hasOlder ? /* @__PURE__ */ P("div", {
|
|
1788
1829
|
className: "flex min-h-0 flex-1 flex-col",
|
|
1789
|
-
children: /* @__PURE__ */
|
|
1790
|
-
onShowEarlier:
|
|
1791
|
-
disabled:
|
|
1830
|
+
children: /* @__PURE__ */ P(tn, {
|
|
1831
|
+
onShowEarlier: Wi,
|
|
1832
|
+
disabled: Ni
|
|
1792
1833
|
})
|
|
1793
|
-
}) :
|
|
1794
|
-
mode:
|
|
1795
|
-
onSuggestionClick:
|
|
1796
|
-
explainsAuto:
|
|
1797
|
-
suggestions:
|
|
1798
|
-
}) : /* @__PURE__ */
|
|
1834
|
+
}) : co.length === 0 ? /* @__PURE__ */ P(dn, {
|
|
1835
|
+
mode: W,
|
|
1836
|
+
onSuggestionClick: ro,
|
|
1837
|
+
explainsAuto: Yi,
|
|
1838
|
+
suggestions: Yi && W === "assistant" ? l(R.find((e) => e.id === "assistant")?.suggestions ?? [], R.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
|
|
1839
|
+
}) : /* @__PURE__ */ jr("div", {
|
|
1799
1840
|
className: "flex min-h-0 flex-1 flex-col",
|
|
1800
|
-
children: [
|
|
1801
|
-
onShowEarlier:
|
|
1802
|
-
disabled:
|
|
1803
|
-
}) : null, /* @__PURE__ */
|
|
1804
|
-
onApprovePendingWrite:
|
|
1805
|
-
approvingWriteRef:
|
|
1806
|
-
approvableMessageId:
|
|
1807
|
-
retryableMessageId:
|
|
1808
|
-
messages:
|
|
1841
|
+
children: [yi?.sync?.hasOlder ? /* @__PURE__ */ P(tn, {
|
|
1842
|
+
onShowEarlier: Wi,
|
|
1843
|
+
disabled: Ni
|
|
1844
|
+
}) : null, /* @__PURE__ */ P(Nn, {
|
|
1845
|
+
onApprovePendingWrite: Aa,
|
|
1846
|
+
approvingWriteRef: Sa,
|
|
1847
|
+
approvableMessageId: uo?.messageId ?? null,
|
|
1848
|
+
retryableMessageId: fo,
|
|
1849
|
+
messages: co,
|
|
1809
1850
|
processing: K ?? null,
|
|
1810
|
-
streamingMessageId:
|
|
1811
|
-
failedMessageId:
|
|
1812
|
-
onRetry:
|
|
1813
|
-
renderWriteProposals:
|
|
1814
|
-
hidesLegacyWriteCard:
|
|
1851
|
+
streamingMessageId: Ci,
|
|
1852
|
+
failedMessageId: wi,
|
|
1853
|
+
onRetry: Sa === null ? io : void 0,
|
|
1854
|
+
renderWriteProposals: mo,
|
|
1855
|
+
hidesLegacyWriteCard: po
|
|
1815
1856
|
})]
|
|
1816
1857
|
}),
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
tr:
|
|
1821
|
-
onDismiss: () =>
|
|
1858
|
+
ji ? /* @__PURE__ */ P(en, { onStartNew: () => ii() }) : null,
|
|
1859
|
+
Mi && U ? /* @__PURE__ */ P(Zt, { onUnarchive: () => un.updateConversation(U, { archived: !1 }) }) : null,
|
|
1860
|
+
Za === null ? null : /* @__PURE__ */ P(fn, {
|
|
1861
|
+
tr: I,
|
|
1862
|
+
onDismiss: () => Qa(null)
|
|
1822
1863
|
}),
|
|
1823
|
-
|
|
1824
|
-
state:
|
|
1825
|
-
onRetry:
|
|
1864
|
+
co.length > 0 && (Ni || Pi) ? /* @__PURE__ */ P($t, {
|
|
1865
|
+
state: Ni ? "loading" : "failed",
|
|
1866
|
+
onRetry: Ui,
|
|
1826
1867
|
compact: !0
|
|
1827
1868
|
}) : null,
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
onStartVoiceSession: Q.available &&
|
|
1869
|
+
/* @__PURE__ */ P(wr, {
|
|
1870
|
+
onStartVoiceSession: Q.available && ga ? Bo : void 0,
|
|
1830
1871
|
onSend: (e, t) => void X(e, t, { fromPerson: !0 }),
|
|
1831
|
-
onDraftStart:
|
|
1832
|
-
disabled:
|
|
1833
|
-
readOnly:
|
|
1834
|
-
placeholder:
|
|
1835
|
-
mode:
|
|
1836
|
-
writeAccessDenied:
|
|
1837
|
-
availableModes:
|
|
1838
|
-
attachmentCharsPerFile:
|
|
1839
|
-
onModeChange:
|
|
1840
|
-
auto:
|
|
1841
|
-
active:
|
|
1842
|
-
onSelect:
|
|
1872
|
+
onDraftStart: xa,
|
|
1873
|
+
disabled: Si || Sa !== null || Ni || Ba,
|
|
1874
|
+
readOnly: ji,
|
|
1875
|
+
placeholder: W === "api-calls" ? I("chatArea.placeholderActions", "What would you like me to do?") : I("chatArea.placeholderGeneral", "Ask me anything…"),
|
|
1876
|
+
mode: W,
|
|
1877
|
+
writeAccessDenied: Rr === "denied" && !!pa?.writeCapable,
|
|
1878
|
+
availableModes: qi,
|
|
1879
|
+
attachmentCharsPerFile: $i,
|
|
1880
|
+
onModeChange: Xo,
|
|
1881
|
+
auto: Ji ? {
|
|
1882
|
+
active: Yi,
|
|
1883
|
+
onSelect: Yo
|
|
1843
1884
|
} : void 0
|
|
1844
1885
|
})
|
|
1845
1886
|
]
|
|
1846
1887
|
}),
|
|
1847
|
-
|
|
1888
|
+
ia && !Q.active ? /* @__PURE__ */ P(nn, {
|
|
1848
1889
|
turns: Z,
|
|
1849
|
-
onClose: () =>
|
|
1850
|
-
onSave:
|
|
1851
|
-
onContinueInChat:
|
|
1890
|
+
onClose: () => aa(!1),
|
|
1891
|
+
onSave: _o,
|
|
1892
|
+
onContinueInChat: Uo ? Wo : void 0,
|
|
1852
1893
|
closeOnEscape: !0,
|
|
1853
|
-
onShowEarlier:
|
|
1854
|
-
showEarlierDisabled:
|
|
1894
|
+
onShowEarlier: yi?.sync?.hasOlder ? Wi : void 0,
|
|
1895
|
+
showEarlierDisabled: Ni
|
|
1855
1896
|
}) : null,
|
|
1856
|
-
Q.active && /* @__PURE__ */
|
|
1897
|
+
Q.active && /* @__PURE__ */ P(Pn, {
|
|
1857
1898
|
session: Q.session,
|
|
1858
1899
|
notice: Q.notice,
|
|
1859
1900
|
capturing: Q.capturing,
|
|
@@ -1863,46 +1904,46 @@ var Mr = ({ visible: Mr = !0, writeAccess: Nr = "unknown" }) => {
|
|
|
1863
1904
|
correcting: Q.correcting,
|
|
1864
1905
|
onLetMeFinish: Q.letMeFinish,
|
|
1865
1906
|
onImDone: Q.imDone,
|
|
1866
|
-
turns:
|
|
1907
|
+
turns: So,
|
|
1867
1908
|
spokenChunks: Q.spokenChunks,
|
|
1868
|
-
attachments:
|
|
1869
|
-
onAttachFiles:
|
|
1870
|
-
onRemoveAttachment:
|
|
1871
|
-
onRetryAttachment:
|
|
1872
|
-
canAttachMore:
|
|
1873
|
-
preparingAttachments:
|
|
1874
|
-
onSaveTranscript:
|
|
1875
|
-
onContinueInChat:
|
|
1909
|
+
attachments: vo.attachments,
|
|
1910
|
+
onAttachFiles: vo.addFiles,
|
|
1911
|
+
onRemoveAttachment: vo.remove,
|
|
1912
|
+
onRetryAttachment: vo.retry,
|
|
1913
|
+
canAttachMore: vo.canAddMore,
|
|
1914
|
+
preparingAttachments: vo.preparingCount,
|
|
1915
|
+
onSaveTranscript: _o,
|
|
1916
|
+
onContinueInChat: Wo,
|
|
1876
1917
|
onInterrupt: () => {
|
|
1877
|
-
Q.interrupt(),
|
|
1918
|
+
Q.interrupt(), Oa();
|
|
1878
1919
|
},
|
|
1879
|
-
spoken:
|
|
1920
|
+
spoken: so,
|
|
1880
1921
|
onToggleMute: Q.toggleMute,
|
|
1881
|
-
onEnd:
|
|
1882
|
-
proposalChip:
|
|
1883
|
-
label:
|
|
1884
|
-
onOpen:
|
|
1922
|
+
onEnd: Ko,
|
|
1923
|
+
proposalChip: ko ? {
|
|
1924
|
+
label: ot(ko, I),
|
|
1925
|
+
onOpen: Oo
|
|
1885
1926
|
} : null,
|
|
1886
|
-
proposalTray:
|
|
1927
|
+
proposalTray: jo
|
|
1887
1928
|
}),
|
|
1888
|
-
/* @__PURE__ */
|
|
1889
|
-
open:
|
|
1890
|
-
mode:
|
|
1891
|
-
currentMode:
|
|
1892
|
-
onConfirm:
|
|
1893
|
-
onCancel:
|
|
1929
|
+
/* @__PURE__ */ P(Er, {
|
|
1930
|
+
open: ea !== null,
|
|
1931
|
+
mode: Qo,
|
|
1932
|
+
currentMode: pa ?? { id: W },
|
|
1933
|
+
onConfirm: Zo,
|
|
1934
|
+
onCancel: $o
|
|
1894
1935
|
}),
|
|
1895
|
-
/* @__PURE__ */
|
|
1896
|
-
...
|
|
1897
|
-
view:
|
|
1898
|
-
serverNow:
|
|
1899
|
-
arrivedAt:
|
|
1900
|
-
capabilities:
|
|
1901
|
-
turnInFlight:
|
|
1902
|
-
tr:
|
|
1936
|
+
/* @__PURE__ */ P(Ht, {
|
|
1937
|
+
...Oi.dialog,
|
|
1938
|
+
view: ho?.view ?? Oi.dialog.view,
|
|
1939
|
+
serverNow: ho?.serverNow ?? NaN,
|
|
1940
|
+
arrivedAt: ho?.arrivedAt ?? NaN,
|
|
1941
|
+
capabilities: ho ? Ti[ho.session.sandboxId] : null,
|
|
1942
|
+
turnInFlight: Si,
|
|
1943
|
+
tr: I
|
|
1903
1944
|
})
|
|
1904
1945
|
]
|
|
1905
1946
|
});
|
|
1906
1947
|
};
|
|
1907
1948
|
//#endregion
|
|
1908
|
-
export {
|
|
1949
|
+
export { Lr as AssistantChatArea };
|