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