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