@burdenoff/fe-libs 2026.1022.3 → 2026.1023.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.
@@ -6,298 +6,299 @@ import { useAssistantControl as r } from "../appControls/useAssistantControl.js"
6
6
  import { useAssistantProduct as i } from "../product.js";
7
7
  import { useAssistantTr as a } from "../i18n.js";
8
8
  import { useAssistantNavigate as o } from "./AssistantMarkdownRenderer.js";
9
- import { isAssistantModeId as s } from "../modeIds.js";
10
- import { AUTO_READ_MODE as c, autoSuggestions as l, classifyAssistantIntent as u, escalationToUndo as d, isAutoRoutingOffered as f, resolveAutoRoute as ee } from "../autoRouting.js";
11
- import { getHistoryStamp as te, setHistoryBusyProbe as p } from "../history/stampRegistry.js";
12
- import { beginApprovalInFlight as ne, endApprovalInFlight as re, getApprovalInFlight as ie, markLiveTurn as ae, newestModelReplyId as oe, resolveApprovablePendingWrite as m, resolveRetryableMessageId as h, subscribeApprovalInFlight as se } from "../liveTurns.js";
13
- import { isWriteModeAcknowledged as ce, writeModeSendRefusalReason as le } from "../writeModeConsent.js";
14
- import { resolveActiveModeSandbox as ue, useAssistantStore as g } from "../store.js";
15
- import { abortAssistantTurn as de, approvePendingWrite as _, createAssistantSandbox as fe, createAssistantSession as pe, extendAssistantSandboxTTL as me, findExistingSandboxWithStatus as he, getAssistantArtifacts as ge, getAssistantMessages as _e, getAssistantSession as v, mintAssistantTurnStream as ve, modeRequiresConfirmWrites as ye, promptGatewayRequestBytes as be, releaseSupersededAssistantSandboxes as xe, sendAssistantPromptAsync as Se, waitForAssistantServiceReady as Ce, waitForSandboxRunning as we, writeApprovalModeOf as Te } from "../api.js";
16
- import { sanitize as Ee } from "../progress.js";
17
- import { UiOfferSession as De, sandboxServesUiOffers as Oe, uiOfferHintKind as y, uiOfferInTime as ke } from "../uiActions/uiOffers.js";
18
- import { AssistantSendRefusal as Ae, classifyTurnFailure as je, turnConfirmsNoAction as Me, turnOutcomeCopy as Ne } from "../turnOutcome.js";
19
- import { assistantUsageLedger as Pe, hasPendingUsageReports as Fe, reportUsageWithRetry as Ie, retryPendingUsageReports as Le, usageSendRefusal as Re } from "../usageReporting.js";
20
- import { withIncompleteTurnNotice as ze } from "../streamBudget.js";
21
- import { chatTurns as Be, isVoiceTurn as Ve, voiceMarker as b, voiceSessionIdOf as x } from "../voice/turnVisibility.js";
22
- import { speechFeed as He } from "../speech/speechFeed.js";
23
- import { requestReplyOnAvatar as Ue } from "../speech/replySpeechRequests.js";
24
- import { toVoiceReply as We } from "../voice/voiceReply.js";
25
- import { isTurnSuperseded as Ge, markTurnSuperseded as Ke } from "../voice/supersededTurns.js";
26
- import { buildContinuedFromVoiceNote as qe, buildVoiceTranscriptMarkdown as Je, voiceTranscriptFilename as Ye } from "../voice/voiceTranscript.js";
27
- import { pollDelayMs as Xe } from "../voice/assistantPollSchedule.js";
28
- import { toCaptionText as Ze } from "../voice/captionText.js";
29
- import { resolveAssistantLanguage as Qe } from "../voice/languages.js";
30
- import { resolveLanguagePair as S } from "../voice/languagePair.js";
31
- import { INITIAL_TRANSCRIPT_AUTO_OPEN as $e, isAwaitingOwnConversation as et, maySendSpokenTurn as tt, planTranscriptAutoOpen as nt, planVoiceSessionBinding as rt, planVoiceSessionStart as it, planVoiceSpokenEntry as at, voiceBindingAtStart as ot, voiceBindingConversationId as st } from "../voice/voiceReopen.js";
32
- import { countInlineImageCandidates as ct, countInlinedImageParts as lt, largestInlineCharsPerFile as ut, resolveAssistantInlineLimits as dt, toMessageAttachment as ft } from "../attachments.js";
33
- import { WRITE_PROPOSAL_VOICE_COPY as pt, isVoiceProposalBound as mt, voiceProposalChip as ht, voiceProposalChipText as gt, voiceReadbacksDue as _t, voiceWaitingProposals as vt, writeProposalVoiceLine as yt, writeProposalVoiceReadback as bt } from "../writeProposalVoice.js";
34
- import { createAdminModeAccessGate as xt, resolveAssistantSendModeAfterAccess as St } from "../adminModeSendGate.js";
35
- import { buildBoundedAttachmentTurn as Ct } from "../attachmentTurn.js";
36
- import { useAvatarCopy as wt } from "../avatar/useAvatarCopy.js";
37
- import { attachmentUrlIsStale as Tt, refreshStaleAttachmentUrls as Et } from "../attachmentCommit.js";
38
- import { VOICE_COMMIT_BUDGET_MS as Dt, settleAndCommitSpokenTurn as Ot } from "../voiceCommit.js";
39
- import { getOrganizationId as kt, getWorkspaceId as C } from "../context.js";
40
- import { useAttachmentUrlResolver as At } from "../useAttachmentCommitter.js";
41
- import { isTurnInFlight as jt, planAbandonedTurn as Mt, planTurnAbort as Nt } from "../turnState.js";
42
- import { backDoneCopy as Pt, chooseDestinationCopy as Ft, chooseLinkedCopy as It, entityNounText as Lt, linkNotOpenableCopy as Rt, navigationCommandCopy as zt, navigationOutcomeCopy as Bt, offerExpiredCopy as Vt, offerKeptForUnsavedCopy as Ht, offerNotAvailableCopy as Ut, pickFromListCopy as Wt, recordChoiceCopy as Gt, recordKindsCopy as Kt, themeCommandCopy as qt } from "../localUiCommandCopy.js";
43
- import { appControlCopy as Jt } from "../appControls/copy.js";
44
- import { LANGUAGE_REPLY_DEADLINE_MS as Yt, languageConfirmationCopy as Xt, languageReplyStep as Zt } from "../appControls/languageReply.js";
45
- import { getAssistantDisplayContent as Qt } from "../displayContent.js";
46
- import { NO_FIRST_TEXT as $t, buildAssistantProgress as en, readAheadFor as tn, snapshotReplyFloor as nn, startSessionReadAhead as rn, trackFirstText as an } from "../turnProgress.js";
47
- import { parseToolActivity as on } from "./AssistantToolActivity.js";
48
- import { countSpokenTurns as sn, spokenMessagesSinceContinueNote as cn, spokenTurnText as ln } from "../spokenTurns.js";
49
- import { beginTurn as un, describeTurn as dn, detectTurnDevice as fn, markTurn as w, restartAttempt as pn, turnClockMs as mn } from "../turnTimeline.js";
50
- import { useAssistantSpeech as hn } from "./AssistantSpeechProvider.js";
51
- import { useLiveAvatarTab as gn, useLiveAvatarTabSeam as _n } from "./assistantLiveAvatarSeam.js";
52
- import { useVoiceSession as vn } from "./useVoiceSession.js";
53
- import { isMultimodalBodyRejection as yn, isRecoverableAssistantError as bn } from "../transportErrors.js";
54
- import { createReadinessTracker as xn, planAfterTransportFailure as Sn, planTrustedSandboxFailure as Cn } from "../sandboxReadiness.js";
55
- import { writeProposalConfirmState as wn } from "./writeProposalPresentation.js";
56
- import { writeProposalUsesDialog as Tn } from "./AssistantWriteProposalCard.js";
57
- import { AssistantWriteConfirmDialog as En } from "./AssistantWriteConfirmDialog.js";
58
- import { useWriteProposalConfirm as Dn } from "./useWriteProposalConfirm.js";
59
- import { AssistantWriteProposalSlot as On } from "./AssistantWriteProposalSlot.js";
60
- import { readWriteProposalRefs as kn, writeProposalsEnabledFor as An } from "../writeProposalDiscovery.js";
61
- import { planWriteReply as jn, promptWriteApproval as Mn } from "../writeReplySend.js";
62
- import { useWriteProposals as Nn } from "./useWriteProposals.js";
63
- import { AssistantSpokenTurnsNotice as Pn } from "./AssistantSpokenTurnsNotice.js";
64
- import { AssistantHistoryArchivedNotice as Fn, AssistantHistoryDeletedNotice as In, AssistantHistoryLoadState as Ln, AssistantHistoryReadOnlyBanner as Rn, AssistantHistoryShowEarlier as zn } from "./AssistantHistoryNotices.js";
65
- import { VoiceTranscriptDrawer as Bn } from "./voice/VoiceTranscriptDrawer.js";
66
- import { downloadFile as Vn } from "../exportConversation.js";
67
- import { conversationHasHistory as Hn, isOtherScopeHistoryConversation as Un, isReadOnlyHistoryConversation as Wn, isReusableHistoryDraft as Gn } from "../history/historyList.js";
68
- import { useAssistantHistoryStatus as Kn } from "../history/historyStatus.js";
69
- import { assistantHistory as qn } from "../history/historyEngine.js";
70
- import { AssistantEmptyState as Jn } from "./AssistantEmptyState.js";
71
- import { AssistantNothingToDeleteNotice as Yn } from "./AssistantDeleteConversationDialog.js";
72
- import { assistantHistoryIsOn as Xn } from "./conversationDelete.js";
73
- import { useConversationDeleteDialog as Zn } from "./conversationDeleteDialog.js";
74
- import { useControlConfirmDialog as Qn } from "./controlConfirmDialog.js";
75
- import { useLeaveConfirmAsking as $n } from "./leaveConfirm.js";
76
- import { startFocusReturnAfterKeep as er } from "./leaveConfirmFocus.js";
77
- import { resolveConversationDeleteTarget as tr } from "../conversationDeleteCommand.js";
78
- import { resumeContextFor as nr } from "../history/historyResume.js";
79
- import { useHistoryRowControlsFor as rr } from "../history/useHistoryRowControls.js";
80
- import { liveCoverage as ir } from "../liveDeltas.js";
81
- import { createLiveRender as ar } from "../liveOverlay.js";
82
- import { AssistantMessageList as or } from "./AssistantMessageList.js";
83
- import { AssistantUiOfferLinks as sr } from "./AssistantUiOfferLink.js";
84
- import { AssistantVoiceSession as cr } from "./voice/AssistantVoiceSession.js";
85
- import { voiceStartBlocker as lr, voiceStartBlockerLasts as ur } from "./voice/voiceStartGate.js";
86
- import { avatarAskBlocker as dr, avatarAskWrites as fr, avatarTabAskLine as pr } from "./avatar/avatarAskGate.js";
87
- import { createAvatarTabDraft as mr } from "./avatar/avatarTabDraft.js";
88
- import { AssistantAvatarTab as hr } from "./avatar/AssistantAvatarTab.js";
89
- import { useAssistantApiAccess as gr } from "../useAssistantApiAccess.js";
90
- import { useConversationTurns as _r } from "../useConversationTurns.js";
91
- import { openTurnStream as vr, turnStreamAvailable as yr } from "../turnStream.js";
92
- import { createSnapshotPoller as br } from "../snapshotPoller.js";
93
- import { sendAssistantTurnTimings as xr, startTurnTimingReporting as Sr } from "../turnTimingReporter.js";
94
- import { QuarantineSet as Cr, WarmCancelled as wr, claimPreopenedSession as Tr, consumeWarm as Er, preopenKey as Dr, preopenWanted as Or, prewarmTarget as kr, settleWarmBeforeSend as Ar, startPreopen as jr, startWarm as Mr, warmState as Nr } from "../prewarm.js";
95
- import { navEntryIds as Pr } from "../uiActions/resolveTarget.js";
96
- import { lookupNamedRecords as Fr } from "../uiActions/recordNames.js";
97
- import { isAlreadyThere as Ir, matchLocalUiCommand as Lr, mayBeNavigationFollowUp as Rr, navDestinations as zr, planThemeChange as Br } from "../localUiCommands.js";
98
- import { offerAssentFor as Vr } from "../localeCommands/assent.js";
99
- import { readControlSnapshot as Hr } from "../appControls/snapshot.js";
100
- import { runNavigation as Ur } from "../uiActions/navigationOutcome.js";
101
- import { assistantBackStack as Wr, isBackRunnable as Gr } from "../uiActions/backStack.js";
102
- import { buildNavigateAction as Kr, destinationForPath as qr, labelForPath as Jr, newestAssistantOnSurface as Yr } from "../uiActions/navigateAction.js";
103
- import { buildNavigationContext as Xr, latestReplyOnSurface as Zr, rememberPresentedList as Qr } from "../uiActions/linkContext.js";
104
- import { buildUiCatalogue as $r, markUiCatalogueSent as ei, uiCatalogueSent as ti, uiCatalogueSessionKey as ni } from "../uiActions/uiCatalogue.js";
105
- import { offerYesOnSurface as ri } from "../uiActions/offerYesOnSurface.js";
106
- import { parseNavIntent as ii } from "../uiActions/navIntent.js";
107
- import { decideActOnResolve as ai, n4LeaveGuard as oi } from "../uiActions/actOnResolve.js";
108
- import { planAppControl as si } from "../appControls/plan.js";
109
- import { dispatchAssistantQuotaExhausted as ci, notifyAiCreditsUpdated as li } from "../aiCredits.js";
110
- import { useAssistantAttachments as ui } from "../useAssistantAttachments.js";
111
- import { AssistantComposer as di } from "./composer/AssistantComposer.js";
112
- import { isProdRuntime as fi } from "../env.js";
113
- import { AssistantApiCallsConsentDialog as pi } from "./AssistantApiCallsConsentDialog.js";
114
- import { useVisibleNavItems as mi } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
115
- import { useCallback as T, useEffect as E, useLayoutEffect as hi, useMemo as D, useRef as O, useState as k, useSyncExternalStore as gi } from "react";
116
- import { jsx as A, jsxs as _i } from "react/jsx-runtime";
9
+ import { sanitize as s } from "../progress.js";
10
+ import { AssistantPromptDelivery as c, trackAssistantSandboxTurn as l } from "../promptDelivery.js";
11
+ import { isAssistantModeId as u } from "../modeIds.js";
12
+ import { AUTO_READ_MODE as d, autoSuggestions as f, classifyAssistantIntent as ee, escalationToUndo as te, isAutoRoutingOffered as p, resolveAutoRoute as ne } from "../autoRouting.js";
13
+ import { getHistoryStamp as re, setHistoryBusyProbe as ie } from "../history/stampRegistry.js";
14
+ import { beginApprovalInFlight as ae, endApprovalInFlight as oe, getApprovalInFlight as se, markLiveTurn as ce, newestModelReplyId as m, resolveApprovablePendingWrite as h, resolveRetryableMessageId as g, subscribeApprovalInFlight as le } from "../liveTurns.js";
15
+ import { isWriteModeAcknowledged as ue, writeModeSendRefusalReason as de } from "../writeModeConsent.js";
16
+ import { resolveActiveModeSandbox as fe, useAssistantStore as _ } from "../store.js";
17
+ import { abortAssistantTurn as pe, approvePendingWrite as v, createAssistantSandbox as me, createAssistantSession as he, extendAssistantSandboxTTL as ge, findExistingSandboxWithStatus as _e, getAssistantArtifacts as ve, getAssistantMessages as ye, getAssistantSession as y, mintAssistantTurnStream as be, modeRequiresConfirmWrites as xe, promptGatewayRequestBytes as Se, releaseSupersededAssistantSandboxes as Ce, sendAssistantPromptAsync as we, waitForAssistantServiceReady as Te, waitForSandboxRunning as Ee, writeApprovalModeOf as De } from "../api.js";
18
+ import { UiOfferSession as Oe, sandboxServesUiOffers as ke, uiOfferHintKind as b, uiOfferInTime as Ae } from "../uiActions/uiOffers.js";
19
+ import { AssistantSendRefusal as je, classifyTurnFailure as Me, turnConfirmsNoAction as Ne, turnOutcomeCopy as Pe } from "../turnOutcome.js";
20
+ import { assistantUsageLedger as Fe, hasPendingUsageReports as Ie, reportUsageWithRetry as Le, retryPendingUsageReports as Re, usageSendRefusal as ze } from "../usageReporting.js";
21
+ import { withIncompleteTurnNotice as Be } from "../streamBudget.js";
22
+ import { chatTurns as Ve, isVoiceTurn as He, voiceMarker as x, voiceSessionIdOf as S } from "../voice/turnVisibility.js";
23
+ import { speechFeed as Ue } from "../speech/speechFeed.js";
24
+ import { requestReplyOnAvatar as We } from "../speech/replySpeechRequests.js";
25
+ import { toVoiceReply as Ge } from "../voice/voiceReply.js";
26
+ import { isTurnSuperseded as Ke, markTurnSuperseded as qe } from "../voice/supersededTurns.js";
27
+ import { buildContinuedFromVoiceNote as Je, buildVoiceTranscriptMarkdown as Ye, voiceTranscriptFilename as Xe } from "../voice/voiceTranscript.js";
28
+ import { pollDelayMs as Ze } from "../voice/assistantPollSchedule.js";
29
+ import { toCaptionText as Qe } from "../voice/captionText.js";
30
+ import { resolveAssistantLanguage as $e } from "../voice/languages.js";
31
+ import { resolveLanguagePair as et } from "../voice/languagePair.js";
32
+ import { INITIAL_TRANSCRIPT_AUTO_OPEN as tt, isAwaitingOwnConversation as nt, maySendSpokenTurn as C, planTranscriptAutoOpen as rt, planVoiceSessionBinding as it, planVoiceSessionStart as at, planVoiceSpokenEntry as ot, voiceBindingAtStart as st, voiceBindingConversationId as ct } from "../voice/voiceReopen.js";
33
+ import { countInlineImageCandidates as lt, countInlinedImageParts as ut, largestInlineCharsPerFile as dt, resolveAssistantInlineLimits as ft, toMessageAttachment as pt } from "../attachments.js";
34
+ import { WRITE_PROPOSAL_VOICE_COPY as mt, isVoiceProposalBound as ht, voiceProposalChip as gt, voiceProposalChipText as _t, voiceReadbacksDue as vt, voiceWaitingProposals as yt, writeProposalVoiceLine as bt, writeProposalVoiceReadback as xt } from "../writeProposalVoice.js";
35
+ import { createAdminModeAccessGate as St, resolveAssistantSendModeAfterAccess as Ct } from "../adminModeSendGate.js";
36
+ import { buildBoundedAttachmentTurn as wt } from "../attachmentTurn.js";
37
+ import { useAvatarCopy as Tt } from "../avatar/useAvatarCopy.js";
38
+ import { attachmentUrlIsStale as Et, refreshStaleAttachmentUrls as Dt } from "../attachmentCommit.js";
39
+ import { VOICE_COMMIT_BUDGET_MS as Ot, settleAndCommitSpokenTurn as kt } from "../voiceCommit.js";
40
+ import { getOrganizationId as At, getWorkspaceId as w } from "../context.js";
41
+ import { useAttachmentUrlResolver as jt } from "../useAttachmentCommitter.js";
42
+ import { isTurnInFlight as Mt, planAbandonedTurn as Nt, planTurnAbort as Pt } from "../turnState.js";
43
+ import { backDoneCopy as Ft, chooseDestinationCopy as It, chooseLinkedCopy as Lt, entityNounText as Rt, linkNotOpenableCopy as zt, navigationCommandCopy as Bt, navigationOutcomeCopy as Vt, offerExpiredCopy as Ht, offerKeptForUnsavedCopy as Ut, offerNotAvailableCopy as Wt, pickFromListCopy as Gt, recordChoiceCopy as Kt, recordKindsCopy as qt, themeCommandCopy as Jt } from "../localUiCommandCopy.js";
44
+ import { appControlCopy as Yt } from "../appControls/copy.js";
45
+ import { LANGUAGE_REPLY_DEADLINE_MS as Xt, languageConfirmationCopy as Zt, languageReplyStep as Qt } from "../appControls/languageReply.js";
46
+ import { getAssistantDisplayContent as $t } from "../displayContent.js";
47
+ import { NO_FIRST_TEXT as en, buildAssistantProgress as tn, readAheadFor as nn, snapshotReplyFloor as rn, startSessionReadAhead as an, trackFirstText as on } from "../turnProgress.js";
48
+ import { parseToolActivity as sn } from "./AssistantToolActivity.js";
49
+ import { countSpokenTurns as cn, spokenMessagesSinceContinueNote as ln, spokenTurnText as un } from "../spokenTurns.js";
50
+ import { beginTurn as dn, describeTurn as fn, detectTurnDevice as pn, markTurn as T, restartAttempt as mn, turnClockMs as hn } from "../turnTimeline.js";
51
+ import { useAssistantSpeech as gn } from "./AssistantSpeechProvider.js";
52
+ import { useLiveAvatarTab as _n, useLiveAvatarTabSeam as vn } from "./assistantLiveAvatarSeam.js";
53
+ import { useVoiceSession as yn } from "./useVoiceSession.js";
54
+ import { isMultimodalBodyRejection as bn, isRecoverableAssistantError as xn } from "../transportErrors.js";
55
+ import { createReadinessTracker as Sn, planAfterTransportFailure as Cn, planTrustedSandboxFailure as wn } from "../sandboxReadiness.js";
56
+ import { writeProposalConfirmState as Tn } from "./writeProposalPresentation.js";
57
+ import { writeProposalUsesDialog as En } from "./AssistantWriteProposalCard.js";
58
+ import { AssistantWriteConfirmDialog as Dn } from "./AssistantWriteConfirmDialog.js";
59
+ import { useWriteProposalConfirm as On } from "./useWriteProposalConfirm.js";
60
+ import { AssistantWriteProposalSlot as kn } from "./AssistantWriteProposalSlot.js";
61
+ import { readWriteProposalRefs as An, writeProposalsEnabledFor as jn } from "../writeProposalDiscovery.js";
62
+ import { planWriteReply as Mn, promptWriteApproval as Nn } from "../writeReplySend.js";
63
+ import { useWriteProposals as Pn } from "./useWriteProposals.js";
64
+ import { AssistantSpokenTurnsNotice as Fn } from "./AssistantSpokenTurnsNotice.js";
65
+ import { AssistantHistoryArchivedNotice as In, AssistantHistoryDeletedNotice as Ln, AssistantHistoryLoadState as Rn, AssistantHistoryReadOnlyBanner as zn, AssistantHistoryShowEarlier as Bn } from "./AssistantHistoryNotices.js";
66
+ import { VoiceTranscriptDrawer as Vn } from "./voice/VoiceTranscriptDrawer.js";
67
+ import { downloadFile as Hn } from "../exportConversation.js";
68
+ import { conversationHasHistory as Un, isOtherScopeHistoryConversation as Wn, isReadOnlyHistoryConversation as Gn, isReusableHistoryDraft as Kn } from "../history/historyList.js";
69
+ import { useAssistantHistoryStatus as qn } from "../history/historyStatus.js";
70
+ import { assistantHistory as Jn } from "../history/historyEngine.js";
71
+ import { AssistantEmptyState as Yn } from "./AssistantEmptyState.js";
72
+ import { AssistantNothingToDeleteNotice as Xn } from "./AssistantDeleteConversationDialog.js";
73
+ import { assistantHistoryIsOn as Zn } from "./conversationDelete.js";
74
+ import { useConversationDeleteDialog as Qn } from "./conversationDeleteDialog.js";
75
+ import { useControlConfirmDialog as $n } from "./controlConfirmDialog.js";
76
+ import { useLeaveConfirmAsking as er } from "./leaveConfirm.js";
77
+ import { startFocusReturnAfterKeep as tr } from "./leaveConfirmFocus.js";
78
+ import { resolveConversationDeleteTarget as nr } from "../conversationDeleteCommand.js";
79
+ import { resumeContextFor as rr } from "../history/historyResume.js";
80
+ import { useHistoryRowControlsFor as ir } from "../history/useHistoryRowControls.js";
81
+ import { liveCoverage as ar } from "../liveDeltas.js";
82
+ import { createLiveRender as or } from "../liveOverlay.js";
83
+ import { AssistantMessageList as sr } from "./AssistantMessageList.js";
84
+ import { AssistantUiOfferLinks as cr } from "./AssistantUiOfferLink.js";
85
+ import { AssistantVoiceSession as lr } from "./voice/AssistantVoiceSession.js";
86
+ import { voiceStartBlocker as ur, voiceStartBlockerLasts as dr } from "./voice/voiceStartGate.js";
87
+ import { avatarAskBlocker as fr, avatarAskWrites as pr, avatarTabAskLine as mr } from "./avatar/avatarAskGate.js";
88
+ import { createAvatarTabDraft as hr } from "./avatar/avatarTabDraft.js";
89
+ import { AssistantAvatarTab as gr } from "./avatar/AssistantAvatarTab.js";
90
+ import { useAssistantApiAccess as _r } from "../useAssistantApiAccess.js";
91
+ import { useConversationTurns as vr } from "../useConversationTurns.js";
92
+ import { openTurnStream as yr, turnStreamAvailable as br } from "../turnStream.js";
93
+ import { createSnapshotPoller as xr } from "../snapshotPoller.js";
94
+ import { sendAssistantTurnTimings as Sr, startTurnTimingReporting as Cr } from "../turnTimingReporter.js";
95
+ import { QuarantineSet as wr, WarmCancelled as Tr, claimPreopenedSession as Er, consumeWarm as Dr, preopenKey as Or, preopenWanted as kr, prewarmTarget as Ar, settleWarmBeforeSend as jr, startPreopen as Mr, startWarm as Nr, warmState as Pr } from "../prewarm.js";
96
+ import { navEntryIds as Fr } from "../uiActions/resolveTarget.js";
97
+ import { lookupNamedRecords as Ir } from "../uiActions/recordNames.js";
98
+ import { isAlreadyThere as Lr, matchLocalUiCommand as Rr, mayBeNavigationFollowUp as zr, navDestinations as Br, planThemeChange as Vr } from "../localUiCommands.js";
99
+ import { offerAssentFor as Hr } from "../localeCommands/assent.js";
100
+ import { readControlSnapshot as Ur } from "../appControls/snapshot.js";
101
+ import { runNavigation as Wr } from "../uiActions/navigationOutcome.js";
102
+ import { assistantBackStack as Gr, isBackRunnable as Kr } from "../uiActions/backStack.js";
103
+ import { buildNavigateAction as qr, destinationForPath as Jr, labelForPath as Yr, newestAssistantOnSurface as Xr } from "../uiActions/navigateAction.js";
104
+ import { buildNavigationContext as Zr, latestReplyOnSurface as Qr, rememberPresentedList as $r } from "../uiActions/linkContext.js";
105
+ import { buildUiCatalogue as ei, markUiCatalogueSent as ti, uiCatalogueSent as ni, uiCatalogueSessionKey as ri } from "../uiActions/uiCatalogue.js";
106
+ import { offerYesOnSurface as ii } from "../uiActions/offerYesOnSurface.js";
107
+ import { parseNavIntent as ai } from "../uiActions/navIntent.js";
108
+ import { decideActOnResolve as oi, n4LeaveGuard as si } from "../uiActions/actOnResolve.js";
109
+ import { planAppControl as ci } from "../appControls/plan.js";
110
+ import { dispatchAssistantQuotaExhausted as li, notifyAiCreditsUpdated as ui } from "../aiCredits.js";
111
+ import { useAssistantAttachments as di } from "../useAssistantAttachments.js";
112
+ import { AssistantComposer as fi } from "./composer/AssistantComposer.js";
113
+ import { isProdRuntime as pi } from "../env.js";
114
+ import { AssistantApiCallsConsentDialog as mi } from "./AssistantApiCallsConsentDialog.js";
115
+ import { useVisibleNavItems as hi } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
116
+ import { useCallback as E, useEffect as D, useLayoutEffect as gi, useMemo as O, useRef as k, useState as A, useSyncExternalStore as _i } from "react";
117
+ import { jsx as j, jsxs as vi } from "react/jsx-runtime";
117
118
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
118
- var vi = 2500, yi = 600, bi = 2e4, xi = 1e4, Si = 1e4, Ci = {
119
+ var yi = 2500, bi = 600, xi = 2e4, Si = 1e4, Ci = 1e4, wi = {
119
120
  committing: !1,
120
121
  dictating: !1
121
- }, wi = 6e3;
122
- function j() {
122
+ }, Ti = 6e3;
123
+ function M() {
123
124
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
124
125
  }
125
- var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess: Oi = "unknown" }) => {
126
- let M = a(), { product: N, modes: P, gatherPageContext: ki, buildPrompt: Ai, reportTurnTimings: ji, reportTokenUsage: Mi, localUiCommands: Ni } = i(), F = Te(i().writeApproval), Pi = T((e, t) => {
127
- let n = g.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
128
- return mt({
126
+ var Ei = () => () => {}, Di = () => "off", Oi = ({ visible: Oi = !0, writeAccess: ki = "unknown" }) => {
127
+ let N = a(), { product: P, modes: F, gatherPageContext: Ai, buildPrompt: ji, reportTurnTimings: Mi, reportTokenUsage: Ni, localUiCommands: Pi } = i(), I = De(i().writeApproval), Fi = E((e, t) => {
128
+ let n = _.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
129
+ return ht({
129
130
  mode: e,
130
- productWriteApproval: F,
131
+ productWriteApproval: I,
131
132
  capabilities: r ? n.sandboxWriteCapabilities[r] : null
132
133
  });
133
- }, [F]), { getAccessToken: I, getWorkspaceToken: Fi, userId: L } = n(), { locale: R, isLocaleLoading: Ii } = e(), Li = g((e) => e.voiceGraceMs), Ri = g((e) => e.handsFreeInterrupt), zi = g((e) => e.handsFreeStreamNoticeAccepted), Bi = g((e) => e.acceptHandsFreeStreamNotice), Vi = g((e) => e.assistantLanguage), Hi = g((e) => e.replyLanguage), Ui = D(() => S(Vi, Hi, R), [
134
- Vi,
134
+ }, [I]), { getAccessToken: L, getWorkspaceToken: Ii, userId: R } = n(), { locale: z, isLocaleLoading: Li } = e(), Ri = _((e) => e.voiceGraceMs), zi = _((e) => e.handsFreeInterrupt), Bi = _((e) => e.handsFreeStreamNoticeAccepted), Vi = _((e) => e.acceptHandsFreeStreamNotice), Hi = _((e) => e.assistantLanguage), Ui = _((e) => e.replyLanguage), Wi = O(() => et(Hi, Ui, z), [
135
135
  Hi,
136
- R
137
- ]), Wi = Ui.reply.english, Gi = Ui.replyIsExplicit, Ki = Ui.reply.code, { conversations: qi, activeConversationId: z, mode: B, processingByConversationId: Ji, setMode: Yi, setConversationMode: Xi, setActiveConversation: Zi, createConversation: Qi, addMessage: V, updateMessage: $i, patchMessage: ea, mergeMessageMetadata: ta, setConversationProcessing: na, clearConversationProcessing: ra, setBackendSessionId: ia, clearBackendSessionId: aa, setSandbox: oa, clearSandbox: sa, acknowledgedWriteModes: ca, acknowledgeWriteMode: la, autoRouting: ua, setAutoRouting: da, routeConversation: fa } = g(), H = qi.find((e) => e.id === z), pa = _r(H), ma = pa.all, ha = z ? Ji[z] : void 0, ga = jt(ha?.status), _a = ga ? ha?.messageId ?? null : null, va = ha?.status === "error" ? ha.messageId : null, ya = g((e) => e.sandboxWriteCapabilities), { panel: U, entries: ba, retiredSandboxes: xa } = Nn({
138
- tr: M,
139
- productWriteApproval: F
140
- }), Sa = Dn({
141
- approve: (e, t) => U.approve(e, t),
142
- decline: (e, t, n) => U.decline(e, t, n),
143
- presented: (e, t) => U.presented(e, t)
144
- }), Ca = Sa.dismiss, wa = O(null);
145
- E(() => {
146
- Ca();
147
- let e = wa.current;
148
- wa.current = z, e && e !== z && U.withdraw(e, "conversation_closed"), z && U.openConversation(z);
136
+ Ui,
137
+ z
138
+ ]), Gi = Wi.reply.english, Ki = Wi.replyIsExplicit, qi = Wi.reply.code, { conversations: Ji, activeConversationId: B, mode: V, processingByConversationId: Yi, setMode: Xi, setConversationMode: Zi, setActiveConversation: Qi, createConversation: $i, addMessage: H, updateMessage: ea, patchMessage: ta, mergeMessageMetadata: na, setConversationProcessing: ra, clearConversationProcessing: ia, setBackendSessionId: aa, clearBackendSessionId: oa, setSandbox: sa, clearSandbox: ca, acknowledgedWriteModes: la, acknowledgeWriteMode: ua, autoRouting: da, setAutoRouting: fa, routeConversation: pa } = _(), U = Ji.find((e) => e.id === B), ma = vr(U), ha = ma.all, ga = B ? Yi[B] : void 0, _a = Mt(ga?.status), va = _a ? ga?.messageId ?? null : null, ya = ga?.status === "error" ? ga.messageId : null, ba = _((e) => e.sandboxWriteCapabilities), { panel: W, entries: xa, retiredSandboxes: Sa } = Pn({
139
+ tr: N,
140
+ productWriteApproval: I
141
+ }), Ca = On({
142
+ approve: (e, t) => W.approve(e, t),
143
+ decline: (e, t, n) => W.decline(e, t, n),
144
+ presented: (e, t) => W.presented(e, t)
145
+ }), wa = Ca.dismiss, Ta = k(null);
146
+ D(() => {
147
+ wa();
148
+ let e = Ta.current;
149
+ Ta.current = B, e && e !== B && W.withdraw(e, "conversation_closed"), B && W.openConversation(B);
149
150
  }, [
150
- z,
151
- U,
152
- Ca
151
+ B,
152
+ W,
153
+ wa
153
154
  ]);
154
- let Ta = Wn(H), Ea = rr(H)?.archivedAt != null, Da = Kn((e) => z !== null && z in e.loadingIds), Oa = Kn((e) => z !== null && z in e.loadErrorIds), ka = Kn((e) => e.remoteDelete), [Aa, ja] = k(() => Kn.getState().remoteDelete?.at ?? null), Ma = ka?.wasActive === !0 && ka.at !== Aa ? ka.at : null;
155
- E(() => {
156
- if (Ma === null) return;
157
- let e = window.setTimeout(() => ja(Ma), Si);
155
+ let Ea = Gn(U), Da = ir(U)?.archivedAt != null, Oa = qn((e) => B !== null && B in e.loadingIds), ka = qn((e) => B !== null && B in e.loadErrorIds), Aa = qn((e) => e.remoteDelete), [ja, Ma] = A(() => qn.getState().remoteDelete?.at ?? null), Na = Aa?.wasActive === !0 && Aa.at !== ja ? Aa.at : null;
156
+ D(() => {
157
+ if (Na === null) return;
158
+ let e = window.setTimeout(() => Ma(Na), Ci);
158
159
  return () => window.clearTimeout(e);
159
- }, [Ma]);
160
- let { canUseApiCalls: Na, loading: Pa } = gr(C(), L), Fa = O(xt({
161
- loading: Pa,
162
- canUseAdminModes: Na
163
- })).current, Ia = O(P);
164
- E(() => {
165
- Ia.current = P;
166
- }, [P]);
167
- let La = () => {
168
- let e = g.getState().activeConversationId;
169
- e && qn.openConversation(e, { modes: Ia.current });
170
- }, Ra = () => {
171
- let e = g.getState().activeConversationId;
172
- e && qn.loadEarlier(e);
173
- }, za = O(I);
174
- E(() => {
175
- za.current = I;
176
- }, [I]);
177
- let Ba = !!N && ji !== !1;
178
- E(() => {
179
- if (Ba) return Sr({ send: (e) => xr(e, {
180
- workspaceId: C(),
160
+ }, [Na]);
161
+ let { canUseApiCalls: Pa, loading: Fa } = _r(w(), R), Ia = k(St({
162
+ loading: Fa,
163
+ canUseAdminModes: Pa
164
+ })).current, La = k(F);
165
+ D(() => {
166
+ La.current = F;
167
+ }, [F]);
168
+ let Ra = () => {
169
+ let e = _.getState().activeConversationId;
170
+ e && Jn.openConversation(e, { modes: La.current });
171
+ }, za = () => {
172
+ let e = _.getState().activeConversationId;
173
+ e && Jn.loadEarlier(e);
174
+ }, Ba = k(L);
175
+ D(() => {
176
+ Ba.current = L;
177
+ }, [L]);
178
+ let Va = !!P && Mi !== !1;
179
+ D(() => {
180
+ if (Va) return Cr({ send: (e) => Sr(e, {
181
+ workspaceId: w(),
181
182
  authContext: {
182
- accessToken: za.current(),
183
- organizationId: kt()
183
+ accessToken: Ba.current(),
184
+ organizationId: At()
184
185
  }
185
186
  }) });
186
- }, [Ba]), E(() => {
187
- Fa.update({
188
- loading: Pa,
189
- canUseAdminModes: Na
187
+ }, [Va]), D(() => {
188
+ Ia.update({
189
+ loading: Fa,
190
+ canUseAdminModes: Pa
190
191
  });
191
192
  }, [
193
+ Ia,
192
194
  Fa,
193
- Pa,
194
- Na
195
- ]), E(() => () => {
196
- Fa.abandon();
197
- }, [Fa]);
198
- let Va = D(() => P.filter((e) => !e.requiresAdmin || Na), [P, Na]), Ha = f(Va), Ua = ua && Ha, Wa = O(Ha);
199
- E(() => {
200
- Wa.current = Ha;
201
- }, [Ha]);
202
- let Ga = O(null), Ka = O(!1), [qa, Ja] = k(!1), Ya = ut(P), [Xa, Za] = k(null), [Qa, $a] = k(null), eo = Qa !== null && Qa === z, W = gn(), to = _n(), G = W.open && to !== null, no = W.close, ro = O(G);
203
- hi(() => {
204
- ro.current = G;
205
- }, [G]);
206
- let io = T((e) => {
207
- e && ro.current || $a(e ? g.getState().activeConversationId : null);
195
+ Pa
196
+ ]), D(() => () => {
197
+ Ia.abandon();
198
+ }, [Ia]);
199
+ let Ha = O(() => F.filter((e) => !e.requiresAdmin || Pa), [F, Pa]), Ua = p(Ha), Wa = da && Ua, Ga = k(Ua);
200
+ D(() => {
201
+ Ga.current = Ua;
202
+ }, [Ua]);
203
+ let Ka = k(null), qa = k(!1), [Ja, Ya] = A(!1), Xa = dt(F), [Za, Qa] = A(null), [$a, eo] = A(null), to = $a !== null && $a === B, G = _n(), no = vn(), K = G.open && no !== null, ro = G.close, io = k(K);
204
+ gi(() => {
205
+ io.current = K;
206
+ }, [K]);
207
+ let ao = E((e) => {
208
+ e && io.current || eo(e ? _.getState().activeConversationId : null);
208
209
  }, []);
209
- E(() => {
210
- $a((e) => e !== null && e !== z ? null : e);
211
- }, [z]);
212
- let ao = O(void 0), [oo, so] = k(!1), co = T((e) => {
213
- ao.current = e, so(et(e));
214
- }, []), lo = T(() => {
215
- let e = g.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
210
+ D(() => {
211
+ eo((e) => e !== null && e !== B ? null : e);
212
+ }, [B]);
213
+ let oo = k(void 0), [so, co] = A(!1), lo = E((e) => {
214
+ oo.current = e, co(nt(e));
215
+ }, []), uo = E(() => {
216
+ let e = _.getState(), t = e.activeConversationId, n = t ? e.conversations.find((e) => e.id === t) : void 0;
216
217
  return !t || !n ? null : {
217
218
  id: t,
218
- reusableDraft: Gn(n, te()),
219
- liveProposals: U.liveFor(t).count,
220
- turnInFlight: jt(e.processingByConversationId[t]?.status)
219
+ reusableDraft: Kn(n, re()),
220
+ liveProposals: W.liveFor(t).count,
221
+ turnInFlight: Mt(e.processingByConversationId[t]?.status)
221
222
  };
222
- }, [U]), uo = O({}), K = O(xn()), q = O(new Cr()), fo = O(/* @__PURE__ */ new Set()), po = D(() => P.find((e) => e.id === B), [P, B]), mo = g((e) => {
223
- let t = e.sandboxesByMode[B]?.sandboxId;
223
+ }, [W]), fo = k({}), q = k(Sn()), J = k(new wr()), po = k(/* @__PURE__ */ new Set()), mo = O(() => F.find((e) => e.id === V), [F, V]), ho = _((e) => {
224
+ let t = e.sandboxesByMode[V]?.sandboxId;
224
225
  return t ? e.sandboxWriteCapabilities[t] : void 0;
225
- }), ho = po !== void 0 && mt({
226
- mode: B,
227
- productWriteApproval: F,
228
- capabilities: mo
229
- }), go = B === "assistant" || po !== void 0 && !po.writeCapable && !ye(B) || ho;
230
- E(() => {
231
- if (B !== "assistant" && po?.writeCapable && !ce(ca, B)) {
232
- Yi("assistant");
226
+ }), go = mo !== void 0 && ht({
227
+ mode: V,
228
+ productWriteApproval: I,
229
+ capabilities: ho
230
+ }), _o = V === "assistant" || mo !== void 0 && !mo.writeCapable && !xe(V) || go;
231
+ D(() => {
232
+ if (V !== "assistant" && mo?.writeCapable && !ue(la, V)) {
233
+ Xi("assistant");
233
234
  return;
234
235
  }
235
- Pa || (!po || po.requiresAdmin && !Na) && B !== "assistant" && Yi("assistant");
236
+ Fa || (!mo || mo.requiresAdmin && !Pa) && V !== "assistant" && Xi("assistant");
236
237
  }, [
237
- B,
238
- po,
239
- Na,
238
+ V,
239
+ mo,
240
240
  Pa,
241
- Yi,
242
- ca
241
+ Fa,
242
+ Xi,
243
+ la
243
244
  ]);
244
- let _o = T((e, t, n, r) => {
245
- na(e, n, t, null, r);
246
- }, [na]), vo = T(async (e, t, n, r, i, a = null) => {
245
+ let vo = E((e, t, n, r) => {
246
+ ra(e, n, t, null, r);
247
+ }, [ra]), yo = E(async (e, t, n, r, i, a = null) => {
247
248
  let o = (e, t) => {
248
- r && _o(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
249
- }, c = (e) => {
250
- r && w(r.assistantMessageId, e);
251
- }, l = () => {
252
- c("bootAdopted"), a?.beginBoot();
253
- }, u = () => a !== null && (a.signal.aborted || C() !== t), d = () => {
254
- if (u()) throw new wr("cancelled");
255
- }, f = g.getState().sandboxesByMode[e]?.sandboxId ?? null, ee = !1, te = !1, p = !1, ne = !1, re = !1, ie = async (r) => {
256
- if (i && !q.current.has(r) && K.current.isFresh(r)) return ee = !0, !0;
249
+ r && vo(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
250
+ }, s = (e) => {
251
+ r && T(r.assistantMessageId, e);
252
+ }, c = () => {
253
+ s("bootAdopted"), a?.beginBoot();
254
+ }, l = () => a !== null && (a.signal.aborted || w() !== t), d = () => {
255
+ if (l()) throw new Tr("cancelled");
256
+ }, f = _.getState().sandboxesByMode[e]?.sandboxId ?? null, ee = !1, te = !1, p = !1, ne = !1, re = !1, ie = async (r) => {
257
+ if (i && !J.current.has(r) && q.current.isFresh(r)) return ee = !0, !0;
257
258
  p = !0;
258
259
  let o = !1;
259
260
  try {
260
- await we(r, t, n, 3e5), await Ce(r, t, e, n, 9e4, () => {
261
- o = !0, l();
261
+ await Ee(r, t, n, 3e5), await Te(r, t, e, n, 9e4, () => {
262
+ o = !0, c();
262
263
  });
263
264
  } catch {
264
- if (u()) throw new wr("cancelled");
265
- return K.current.invalidate(r), q.current.add(r), a?.dead.push(r), re = !0, !1;
265
+ if (l()) throw new Tr("cancelled");
266
+ return q.current.invalidate(r), J.current.add(r), a?.dead.push(r), re = !0, !1;
266
267
  }
267
- return d(), K.current.markVerified(r), o && (ne = !0), !0;
268
+ return d(), q.current.markVerified(r), o && (ne = !0), !0;
268
269
  };
269
- if (f && (oa(e, f, "provisioning"), o("provisioning", "reusingEnvironment"), await ie(f) || (oa(e, null, "provisioning"), f = null)), !f) {
270
+ if (f && (sa(e, f, "provisioning"), o("provisioning", "reusingEnvironment"), await ie(f) || (sa(e, null, "provisioning"), f = null)), !f) {
270
271
  o("provisioning", "lookingForEnvironment");
271
- let r = await he(t, N, e, fi(), n, q.current, F);
272
+ let r = await _e(t, P, e, pi(), n, J.current, I);
272
273
  d();
273
274
  let i = r?.id ?? null;
274
275
  if (i) {
275
- oa(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
276
+ sa(e, i, "provisioning"), o("provisioning", "reusingEnvironment");
276
277
  let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
277
- t && l(), await ie(i) ? (f = i, t && (ne = !0)) : oa(e, null, "provisioning");
278
+ t && c(), await ie(i) ? (f = i, t && (ne = !0)) : sa(e, null, "provisioning");
278
279
  }
279
280
  }
280
281
  if (!f) {
281
- if (a && !a.mayCreate) throw new wr("no-create");
282
- if (c("provisionStarted"), e === "api-calls" && !I()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
283
- o("provisioning", "startingEnvironment"), oa(e, null, "provisioning");
284
- let r = a ? [] : await xe(t, N, e, fi(), n, q.current, F);
282
+ if (a && !a.mayCreate) throw new Tr("no-create");
283
+ if (s("provisionStarted"), e === "api-calls" && !L()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
284
+ o("provisioning", "startingEnvironment"), sa(e, null, "provisioning");
285
+ let r = a ? [] : await Ce(t, P, e, pi(), n, J.current, I);
285
286
  if (r.length > 0) {
286
287
  let e = new Set(r);
287
- for (let e of r) K.current.invalidate(e), q.current.add(e);
288
- let t = g.getState().sandboxesByMode;
289
- for (let [n, r] of Object.entries(t)) s(n) && r?.sandboxId && e.has(r.sandboxId) && sa(n);
288
+ for (let e of r) q.current.invalidate(e), J.current.add(e);
289
+ let t = _.getState().sandboxesByMode;
290
+ for (let [n, r] of Object.entries(t)) u(n) && r?.sandboxId && e.has(r.sandboxId) && ca(n);
290
291
  }
291
- c("createRequested");
292
+ s("createRequested");
292
293
  let i = a?.beginCreate();
293
294
  try {
294
- f = await fe(N, e, t, fi(), yi, n, { writeApproval: F });
295
+ f = await me(P, e, t, pi(), bi, n, { writeApproval: I });
295
296
  } finally {
296
297
  i?.();
297
298
  }
298
- te = !0, d(), oa(e, f, "provisioning"), await we(f, t, n, 3e5), d(), c("sandboxRunning"), await Ce(f, t, e, n, 9e4), d(), c("serviceReady"), K.current.markVerified(f);
299
+ te = !0, d(), sa(e, f, "provisioning"), await Ee(f, t, n, 3e5), d(), s("sandboxRunning"), await Te(f, t, e, n, 9e4), d(), s("serviceReady"), q.current.markVerified(f);
299
300
  }
300
- return oa(e, f, "running"), {
301
+ return sa(e, f, "running"), {
301
302
  sandboxId: f,
302
303
  sandboxIsNew: te,
303
304
  sandboxProbed: p,
@@ -306,64 +307,64 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
306
307
  trustedFromCache: ee
307
308
  };
308
309
  }, [
309
- sa,
310
+ ca,
311
+ L,
312
+ P,
310
313
  I,
311
- N,
312
- F,
313
- oa,
314
- _o
315
- ]), yo = T(async function e(t, n, r, i, a, o = {}) {
316
- let s = await Ar(i, r, (e) => _o(t, n, "provisioning", e), () => w(n, "prewarmJoined"));
317
- for (let e of s.dead) K.current.invalidate(e), q.current.add(e);
318
- s.verified && !q.current.has(s.verified) && K.current.markVerified(s.verified), s.joined && dn(n, { prewarm: s.joined });
319
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: ee } = await vo(r, i, a, {
314
+ sa,
315
+ vo
316
+ ]), bo = E(async function e(t, n, r, i, a, o = {}) {
317
+ let s = await jr(i, r, (e) => vo(t, n, "provisioning", e), () => T(n, "prewarmJoined"));
318
+ for (let e of s.dead) q.current.invalidate(e), J.current.add(e);
319
+ s.verified && !J.current.has(s.verified) && q.current.markVerified(s.verified), s.joined && fn(n, { prewarm: s.joined });
320
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: ee } = await yo(r, i, a, {
320
321
  conversationId: t,
321
322
  assistantMessageId: n
322
- }, o.trustCache !== !1), te = Er(i, r, c);
323
- !s.waited && te && dn(n, { prewarm: "hit" });
324
- let p = g.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, ne = !1, re = null;
323
+ }, o.trustCache !== !1), te = Dr(i, r, c);
324
+ !s.waited && te && fn(n, { prewarm: "hit" });
325
+ let p = _.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, ne = !1, re = null;
325
326
  if (p) {
326
- let e = rn(c, p, (e, t) => _e(e, i, t, r, a, { limit: 50 }));
327
+ let e = an(c, p, (e, t) => ye(e, i, t, r, a, { limit: 50 }));
327
328
  try {
328
- let t = await v(c, i, p, r, a);
329
+ let t = await y(c, i, p, r, a);
329
330
  if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
330
331
  re = e;
331
332
  } catch {
332
- aa(t), p = null;
333
+ oa(t), p = null;
333
334
  }
334
335
  }
335
336
  let ie = !1;
336
337
  if (!p) {
337
- let e = Tr(Dr({
338
+ let e = Er(Or({
338
339
  workspaceId: i,
339
340
  mode: r,
340
341
  sandboxId: c,
341
- userId: L
342
+ userId: R
342
343
  }), Date.now());
343
344
  if (e) {
344
- "pending" in e && _o(t, n, "connecting", "preparingSession");
345
+ "pending" in e && vo(t, n, "connecting", "preparingSession");
345
346
  let o = "sessionId" in e ? e.sessionId : await e.pending;
346
- if (o && !q.current.has(c)) try {
347
- (await v(c, i, o, r, a)).mode === r && (p = o, ie = !0, ia(t, p), ne = !0);
347
+ if (o && !J.current.has(c)) try {
348
+ (await y(c, i, o, r, a)).mode === r && (p = o, ie = !0, aa(t, p), ne = !0);
348
349
  } catch {}
349
350
  }
350
351
  }
351
352
  if (!p) {
352
- _o(t, n, "connecting", "preparingSession");
353
+ vo(t, n, "connecting", "preparingSession");
353
354
  let s;
354
355
  try {
355
- s = await pe(c, i, r, a);
356
+ s = await he(c, i, r, a);
356
357
  } catch (s) {
357
358
  if (ee) {
358
- K.current.invalidate(c);
359
- let l = Cn(s, o.isAbandoned?.() ?? !1), ee = l === "check-network";
360
- if (l === "check-network" && (l = await Sn(() => he(i, N, r, fi(), a, q.current, F))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
361
- ee || dn(n, { cacheProofFailed: !0 }), l === "replace" && (q.current.add(c), aa(t), sa(r), U.retireSandbox(c));
359
+ q.current.invalidate(c);
360
+ let l = wn(s, o.isAbandoned?.() ?? !1), ee = l === "check-network";
361
+ if (l === "check-network" && (l = await Cn(() => _e(i, P, r, pi(), a, J.current, I))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
362
+ ee || fn(n, { cacheProofFailed: !0 }), l === "replace" && (J.current.add(c), oa(t), ca(r), W.retireSandbox(c));
362
363
  let s = await e(t, n, r, i, a, {
363
364
  ...o,
364
365
  trustCache: !1
365
366
  });
366
- return ee && (s.deadSandboxProbe || s.sandboxId !== c) && dn(n, { cacheProofFailed: !0 }), {
367
+ return ee && (s.deadSandboxProbe || s.sandboxId !== c) && fn(n, { cacheProofFailed: !0 }), {
367
368
  ...s,
368
369
  sandboxProbed: s.sandboxProbed || u,
369
370
  sandboxAdopted: s.sandboxAdopted || d,
@@ -373,7 +374,7 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
373
374
  }
374
375
  throw s;
375
376
  }
376
- p = s.sessionId, ia(t, p), ne = !0;
377
+ p = s.sessionId, aa(t, p), ne = !0;
377
378
  }
378
379
  return {
379
380
  sandboxId: c,
@@ -387,67 +388,67 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
387
388
  sessionPreopened: ie
388
389
  };
389
390
  }, [
390
- vo,
391
+ yo,
392
+ oa,
393
+ ca,
394
+ P,
395
+ I,
391
396
  aa,
392
- sa,
393
- N,
394
- F,
395
- ia,
396
- _o,
397
- L,
398
- U
399
- ]), bo = T((e, t = !1) => {
400
- let n = C();
397
+ vo,
398
+ R,
399
+ W
400
+ ]), xo = E((e, t = !1) => {
401
+ let n = w();
401
402
  if (!n) return;
402
- let r = g.getState(), i = Date.now(), a = kr({
403
+ let r = _.getState(), i = Date.now(), a = Ar({
403
404
  autoRouting: r.autoRouting,
404
- autoOffered: Wa.current,
405
+ autoOffered: Ga.current,
405
406
  active: !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0,
406
407
  selectedMode: r.mode,
407
- autoReadMode: c,
408
- modes: Ia.current,
408
+ autoReadMode: d,
409
+ modes: La.current,
409
410
  acknowledgedWriteModes: r.acknowledgedWriteModes,
410
- adminAccess: Fa.read(),
411
+ adminAccess: Ia.read(),
411
412
  dictated: e,
412
- voiceProposalBound: (e) => Pi(e),
413
- turnInFlight: Object.values(r.processingByConversationId).some((e) => jt(e?.status)),
414
- ...Nr(n),
413
+ voiceProposalBound: (e) => Fi(e),
414
+ turnInFlight: Object.values(r.processingByConversationId).some((e) => Mt(e?.status)),
415
+ ...Pr(n),
415
416
  now: i
416
417
  });
417
418
  if (!a) return;
418
- let o = Mr(n, a, i), s = {
419
- accessToken: I(),
420
- workspaceToken: Fi(),
421
- userId: L,
422
- organizationId: kt()
419
+ let o = Nr(n, a, i), s = {
420
+ accessToken: L(),
421
+ workspaceToken: Ii(),
422
+ userId: R,
423
+ organizationId: At()
423
424
  };
424
- vo(a.mode, n, s, null, !0, o).then((e) => {
425
+ yo(a.mode, n, s, null, !0, o).then((e) => {
425
426
  if (o.finish({
426
427
  ok: !0,
427
428
  sandboxId: e.sandboxId,
428
429
  didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
429
430
  booted: e.sandboxIsNew || e.sandboxAdopted,
430
431
  dead: o.dead
431
- }), o.signal.aborted || C() !== n || q.current.has(e.sandboxId)) return;
432
- let r = g.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = te();
433
- Or({
432
+ }), o.signal.aborted || w() !== n || J.current.has(e.sandboxId)) return;
433
+ let r = _.getState(), i = !t && r.activeConversationId ? r.conversations.find((e) => e.id === r.activeConversationId) : void 0, c = re();
434
+ kr({
434
435
  active: i ? {
435
436
  mode: i.mode,
436
437
  backendSessionId: i.backendSessionId,
437
- continuable: !Wn(i) && !Un(i, c),
438
- hasHistory: Hn(i)
438
+ continuable: !Gn(i) && !Wn(i, c),
439
+ hasHistory: Un(i)
439
440
  } : void 0,
440
441
  mode: a.mode
441
- }) && jr(Dr({
442
+ }) && Mr(Or({
442
443
  workspaceId: n,
443
444
  mode: a.mode,
444
445
  sandboxId: e.sandboxId,
445
- userId: L
446
- }), () => pe(e.sandboxId, n, a.mode, s).then((e) => e.sessionId), Date.now());
446
+ userId: R
447
+ }), () => he(e.sandboxId, n, a.mode, s).then((e) => e.sessionId), Date.now());
447
448
  }, (e) => {
448
- if (!(e instanceof wr) && !o.signal.aborted && C() === n) {
449
- let e = g.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
450
- e && (K.current.invalidate(e), q.current.add(e), o.dead.push(e), sa(a.mode));
449
+ if (!(e instanceof Tr) && !o.signal.aborted && w() === n) {
450
+ let e = _.getState().sandboxesByMode[a.mode]?.sandboxId ?? null;
451
+ e && (q.current.invalidate(e), J.current.add(e), o.dead.push(e), ca(a.mode));
451
452
  }
452
453
  o.finish({
453
454
  ok: !1,
@@ -457,137 +458,137 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
457
458
  });
458
459
  });
459
460
  }, [
460
- vo,
461
- Fa,
462
- sa,
463
- I,
464
- Fi,
461
+ yo,
462
+ Ia,
463
+ ca,
465
464
  L,
466
- Pi
467
- ]), xo = T(() => bo(!1), [bo]), So = gi(se, ie, ie)?.reference ?? null, [Co, wo] = k(0), To = O(/* @__PURE__ */ new Set()), Eo = O(null), Do = T(() => {
468
- let e = g.getState(), t = e.activeConversationId;
465
+ Ii,
466
+ R,
467
+ Fi
468
+ ]), So = E(() => xo(!1), [xo]), Co = _i(le, se, se)?.reference ?? null, [wo, To] = A(0), Eo = k(/* @__PURE__ */ new Set()), Do = k(null), Oo = E(() => {
469
+ let e = _.getState(), t = e.activeConversationId;
469
470
  if (!t) return null;
470
- let n = e.processingByConversationId[t], r = jt(n?.status) ? n?.messageId ?? null : null;
471
- if (!Nt({
471
+ let n = e.processingByConversationId[t], r = Mt(n?.status) ? n?.messageId ?? null : null;
472
+ if (!Pt({
472
473
  interruptedTurnId: r,
473
474
  activeTurnId: r,
474
- alreadyRequested: r ? To.current.has(r) : !1
475
+ alreadyRequested: r ? Eo.current.has(r) : !1
475
476
  }).send || !r) return null;
476
- To.current.add(r);
477
- let i = ue(e), a = C(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
478
- return !i || !a || !o || de(i.sandboxId, a, o, i.mode, {
479
- accessToken: I(),
480
- workspaceToken: Fi(),
481
- userId: L,
482
- organizationId: kt()
477
+ Eo.current.add(r);
478
+ let i = fe(e), a = w(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
479
+ return !i || !a || !o || pe(i.sandboxId, a, o, i.mode, {
480
+ accessToken: L(),
481
+ workspaceToken: Ii(),
482
+ userId: R,
483
+ organizationId: At()
483
484
  }), r;
484
485
  }, [
486
+ R,
485
487
  L,
486
- I,
487
- Fi
488
- ]), Oo = T(() => {
489
- let e = Do();
490
- return e && (Ke(e), He.abort(e)), e;
491
- }, [Do]), ko = T(() => {
492
- let e = g.getState().activeConversationId;
493
- Oo(), e && U.declineForReply(e, "corrected", "spoken");
494
- }, [Oo, U]), Ao = T(async (e) => {
495
- let t = g.getState(), n = ue(t), r = C(), i = t.activeConversationId;
496
- if (!n || !r || !i || An(t.sandboxWriteCapabilities[n.sandboxId])) return;
497
- let a = t.conversations.find((e) => e.id === i), o = a ? m(Be(a.messages), {
488
+ Ii
489
+ ]), ko = E(() => {
490
+ let e = Oo();
491
+ return e && (qe(e), Ue.abort(e)), e;
492
+ }, [Oo]), Ao = E(() => {
493
+ let e = _.getState().activeConversationId;
494
+ ko(), e && W.declineForReply(e, "corrected", "spoken");
495
+ }, [ko, W]), jo = E(async (e) => {
496
+ let t = _.getState(), n = fe(t), r = w(), i = t.activeConversationId;
497
+ if (!n || !r || !i || jn(t.sandboxWriteCapabilities[n.sandboxId])) return;
498
+ let a = t.conversations.find((e) => e.id === i), o = a ? h(Ve(a.messages), {
498
499
  sessionId: a.backendSessionId,
499
500
  sandboxId: n.sandboxId,
500
501
  nowMs: Date.now()
501
502
  }) : null;
502
503
  if (o?.reference !== e) {
503
- wo((e) => e + 1);
504
+ To((e) => e + 1);
504
505
  return;
505
506
  }
506
507
  let s = {
507
508
  conversationId: i,
508
509
  reference: e
509
510
  };
510
- if (!ne(s)) return;
511
+ if (!ae(s)) return;
511
512
  try {
512
- await _(n.sandboxId, r, e, n.mode, {
513
- accessToken: I(),
514
- workspaceToken: Fi(),
515
- userId: L,
516
- organizationId: kt()
513
+ await v(n.sandboxId, r, e, n.mode, {
514
+ accessToken: L(),
515
+ workspaceToken: Ii(),
516
+ userId: R,
517
+ organizationId: At()
517
518
  });
518
519
  } catch (e) {
519
- re(s), V(i, {
520
- id: j(),
520
+ oe(s), H(i, {
521
+ id: M(),
521
522
  role: "system",
522
523
  content: e instanceof Error ? e.message : "The change could not be approved.",
523
524
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
524
525
  });
525
526
  return;
526
527
  }
527
- re(s), ta(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
528
- let c = g.getState(), l = c.conversations.find((e) => e.id === i);
529
- c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || ue(c)?.sandboxId !== n.sandboxId || jt(c.processingByConversationId[i]?.status) || oe(Be(l.messages)) !== o.messageId || Ns.current(M("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
528
+ oe(s), na(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
529
+ let c = _.getState(), l = c.conversations.find((e) => e.id === i);
530
+ c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || fe(c)?.sandboxId !== n.sandboxId || Mt(c.processingByConversationId[i]?.status) || m(Ve(l.messages)) !== o.messageId || Ps.current(N("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
530
531
  approvalFollowUp: { approvedReplyId: o.messageId },
531
532
  targetConversationId: i
532
533
  });
533
534
  }, [
534
- L,
535
- V,
536
- ta,
537
- M
538
- ]), jo = t(), { speakFinishedReply: Mo, speakingMessageId: No, stop: Po } = hn(), Fo = O(null), Io = T((e, t) => {
539
- let n = Fo.current;
535
+ R,
536
+ H,
537
+ na,
538
+ N
539
+ ]), Mo = t(), { speakFinishedReply: No, speakingMessageId: Po, stop: Fo } = gn(), Io = k(null), Lo = E((e, t) => {
540
+ let n = Io.current;
540
541
  n?.token === e && n.exchange === null && (n.exchange = t);
541
- }, []), Lo = T((e) => {
542
- let t = Fo.current;
542
+ }, []), Ro = E((e) => {
543
+ let t = Io.current;
543
544
  e !== void 0 && t?.token === e && (t.handled = !0);
544
- }, []), Ro = T((e, t) => {
545
- Io(e, t), ro.current && Ue(t);
546
- }, [Io]), zo = o(), { items: Bo, permissionsSettled: Vo, simulating: Ho } = mi(), J = O({
547
- theme: jo,
548
- navigate: zo,
549
- navItems: Bo,
550
- options: Ni ?? {},
551
- navPermissionsSettled: Vo,
552
- navSimulating: Ho
545
+ }, []), zo = E((e, t) => {
546
+ Lo(e, t), io.current && We(t);
547
+ }, [Lo]), Bo = o(), { items: Vo, permissionsSettled: Ho, simulating: Uo } = hi(), Y = k({
548
+ theme: Mo,
549
+ navigate: Bo,
550
+ navItems: Vo,
551
+ options: Pi ?? {},
552
+ navPermissionsSettled: Ho,
553
+ navSimulating: Uo
553
554
  });
554
- E(() => {
555
- J.current = {
556
- theme: jo,
557
- navigate: zo,
558
- navItems: Bo,
559
- options: Ni ?? {},
560
- navPermissionsSettled: Vo,
561
- navSimulating: Ho
555
+ D(() => {
556
+ Y.current = {
557
+ theme: Mo,
558
+ navigate: Bo,
559
+ navItems: Vo,
560
+ options: Pi ?? {},
561
+ navPermissionsSettled: Ho,
562
+ navSimulating: Uo
562
563
  };
563
564
  }, [
564
- jo,
565
- zo,
565
+ Mo,
566
566
  Bo,
567
- Ni,
568
567
  Vo,
569
- Ho
568
+ Pi,
569
+ Ho,
570
+ Uo
570
571
  ]);
571
- let Y = O(!0);
572
- E(() => (Y.current = !0, () => {
573
- Y.current = !1;
572
+ let X = k(!0);
573
+ D(() => (X.current = !0, () => {
574
+ X.current = !1;
574
575
  }), []);
575
- let Uo = O({
576
- tr: M,
577
- locale: R
578
- }), Wo = O(null), [Go, Ko] = k(null), qo = O(null), Jo = T((e) => {
579
- qo.current !== null && (window.clearTimeout(qo.current), qo.current = null);
580
- let t = Wo.current;
581
- t && (Wo.current = null, window.clearTimeout(t.deadline), Y.current && Ko(null), !(!e || !Y.current) && (qo.current = window.setTimeout(() => {
582
- if (qo.current = null, !Y.current) return;
583
- let e = g.getState();
576
+ let Wo = k({
577
+ tr: N,
578
+ locale: z
579
+ }), Go = k(null), [Ko, qo] = A(null), Jo = k(null), Yo = E((e) => {
580
+ Jo.current !== null && (window.clearTimeout(Jo.current), Jo.current = null);
581
+ let t = Go.current;
582
+ t && (Go.current = null, window.clearTimeout(t.deadline), X.current && qo(null), !(!e || !X.current) && (Jo.current = window.setTimeout(() => {
583
+ if (Jo.current = null, !X.current) return;
584
+ let e = _.getState();
584
585
  if (e.activeConversationId !== t.conversationId) return;
585
586
  let n = e.conversations.find((e) => e.id === t.conversationId)?.messages.find((e) => e.id === t.messageId);
586
587
  if (!n) return;
587
- let r = Uo.current, i = Qt(n, null, r.tr);
588
+ let r = Wo.current, i = $t(n, null, r.tr);
588
589
  if (i.kind !== "output") return;
589
- let a = Xt(n, r.tr);
590
- He.publish(n.id, {
590
+ let a = Zt(n, r.tr);
591
+ Ue.publish(n.id, {
591
592
  conversationId: t.conversationId,
592
593
  channel: n.metadata?.voice === !0 ? "voice" : "chat",
593
594
  voiceSessionId: n.metadata?.voiceSessionId,
@@ -596,48 +597,48 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
596
597
  final: !0
597
598
  });
598
599
  }, 0)));
599
- }, []), Yo = T(() => Jo(!0), [Jo]);
600
- E(() => {
601
- Uo.current = {
602
- tr: M,
603
- locale: R
600
+ }, []), Xo = E(() => Yo(!0), [Yo]);
601
+ D(() => {
602
+ Wo.current = {
603
+ tr: N,
604
+ locale: z
604
605
  };
605
- let e = Wo.current;
606
+ let e = Go.current;
606
607
  if (!e) return;
607
- let t = Zt({
608
+ let t = Qt({
608
609
  wanted: e.wanted,
609
- locale: R,
610
- isLoading: Ii(e.wanted),
611
- translatedNow: Jt(M, e.reply).translated
610
+ locale: z,
611
+ isLoading: Li(e.wanted),
612
+ translatedNow: Yt(N, e.reply).translated
612
613
  });
613
614
  if (t === "write") {
614
- Yo();
615
+ Xo();
615
616
  return;
616
617
  }
617
618
  if (t === "grace") {
618
- let e = window.setTimeout(Yo, 400);
619
+ let e = window.setTimeout(Xo, 400);
619
620
  return () => window.clearTimeout(e);
620
621
  }
621
622
  }, [
622
- M,
623
- R,
624
- Ii,
625
- Go,
626
- Yo
627
- ]), E(() => () => Jo(!1), [Jo]);
628
- let Xo = O(null), [Zo, Qo] = k(!1), [$o, es] = k(null), [X] = k(() => new De()), [ts, ns] = k(0), rs = T(() => ns((e) => e + 1), []), is = T(() => {
629
- let e = J.current;
623
+ N,
624
+ z,
625
+ Li,
626
+ Ko,
627
+ Xo
628
+ ]), D(() => () => Yo(!1), [Yo]);
629
+ let Zo = k(null), [Qo, $o] = A(!1), [es, ts] = A(null), [Z] = A(() => new Oe()), [ns, rs] = A(0), is = E(() => rs((e) => e + 1), []), as = E(() => {
630
+ let e = Y.current;
630
631
  return {
631
- destinations: zr(e.navItems),
632
+ destinations: Br(e.navItems),
632
633
  permissionsSettled: e.navPermissionsSettled,
633
634
  simulating: e.navSimulating
634
635
  };
635
- }, []), as = O(L);
636
- E(() => {
637
- as.current = L;
638
- }, [L]);
639
- let os = T((e, t) => {
640
- let n = X.replyIdOf(e), r = n ? X.turnFor(n) : void 0, i = X.offer(e), a = {
636
+ }, []), os = k(R);
637
+ D(() => {
638
+ os.current = R;
639
+ }, [R]);
640
+ let ss = E((e, t) => {
641
+ let n = Z.replyIdOf(e), r = n ? Z.turnFor(n) : void 0, i = Z.offer(e), a = {
641
642
  ok: !1,
642
643
  reason: "gone",
643
644
  copy: null,
@@ -645,59 +646,59 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
645
646
  voiceSessionId: void 0
646
647
  };
647
648
  if (!n || !r || !i || i.used) return a;
648
- let o = r.conversationId, s = g.getState().conversations.find((e) => e.id === o);
649
+ let o = r.conversationId, s = _.getState().conversations.find((e) => e.id === o);
649
650
  if (!s) return a;
650
- let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = X.liveOffersFor(n, {
651
- registry: is(),
652
- actorId: as.current,
651
+ let c = s.messages.find((e) => e.id === n), l = c?.metadata?.voice === !0 ? c.metadata.voiceSessionId : void 0, u = Z.liveOffersFor(n, {
652
+ registry: as(),
653
+ actorId: os.current,
653
654
  conversationId: o,
654
655
  perfNow: performance.now()
655
656
  }).find((t) => t.offer.offerId === e);
656
657
  if (!u) {
657
- let e = ke(i, performance.now());
658
+ let e = Ae(i, performance.now());
658
659
  return {
659
660
  ok: !1,
660
661
  reason: e ? "unavailable" : "expired",
661
- copy: e ? Ut(M, t || null) : Vt(M),
662
+ copy: e ? Wt(N, t || null) : Ht(N),
662
663
  conversationId: o,
663
664
  voiceSessionId: l
664
665
  };
665
666
  }
666
- return X.markUsed(e) ? (rs(), {
667
+ return Z.markUsed(e) ? (is(), {
667
668
  ok: !0,
668
669
  target: u.target,
669
670
  conversationId: o,
670
671
  voiceSessionId: l
671
672
  }) : a;
672
673
  }, [
673
- X,
674
- is,
675
- M,
676
- rs
677
- ]), ss = T((e, t, n, r, i) => {
678
- let a = j();
679
- V(e, {
674
+ Z,
675
+ as,
676
+ N,
677
+ is
678
+ ]), cs = E((e, t, n, r, i) => {
679
+ let a = M();
680
+ H(e, {
680
681
  id: a,
681
682
  role: "system",
682
683
  content: n.text,
683
684
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
684
685
  metadata: {
685
- lang: n.translated ? R : "en",
686
+ lang: n.translated ? z : "en",
686
687
  ...i ? { localAction: i } : {},
687
- ...b(t)
688
+ ...x(t)
688
689
  }
689
- }), i && qn.recordCommittedEntries(e, [a], "NOTE", r);
690
- }, [V, R]), cs = T((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && X.release(e), [X]), ls = O(null);
691
- E(() => () => {
692
- ls.current?.(), ls.current = null;
690
+ }), i && Jn.recordCommittedEntries(e, [a], "NOTE", r);
691
+ }, [H, z]), ls = E((e, t) => (t.status === "kept" || t.status === "refused" && t.reason === "unsaved-changes") && Z.release(e), [Z]), us = k(null);
692
+ D(() => () => {
693
+ us.current?.(), us.current = null;
693
694
  }, []);
694
- let us = T((e) => {
695
- ls.current?.(), ls.current = Y.current ? er(document, e) : null;
696
- }, []), ds = T((e, t, n, r = !1) => {
697
- if (Xo.current !== null) return;
698
- let i = os(e, n), a = C(), o = (e, t, n, r) => ss(e, t, n, a, r);
695
+ let ds = E((e) => {
696
+ us.current?.(), us.current = X.current ? tr(document, e) : null;
697
+ }, []), fs = E((e, t, n, r = !1) => {
698
+ if (Zo.current !== null) return;
699
+ let i = ss(e, n), a = w(), o = (e, t, n, r) => cs(e, t, n, a, r);
699
700
  if (!i.ok) {
700
- i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), rs();
701
+ i.copy && i.conversationId && o(i.conversationId, i.voiceSessionId, i.copy), is();
701
702
  return;
702
703
  }
703
704
  let { target: s, conversationId: c, voiceSessionId: l } = i, u = {
@@ -705,7 +706,7 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
705
706
  offerId: e
706
707
  };
707
708
  if (r) {
708
- o(c, l, zt(M, s.label, !0), Kr({
709
+ o(c, l, Bt(N, s.label, !0), qr({
709
710
  destinationId: s.id,
710
711
  path: s.path,
711
712
  alreadyHere: !0,
@@ -714,17 +715,17 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
714
715
  }));
715
716
  return;
716
717
  }
717
- let d = j();
718
- Xo.current = d, Qo(!0);
718
+ let d = M();
719
+ Zo.current = d, $o(!0);
719
720
  let f = (t) => {
720
721
  try {
721
- if (cs(e, t) && (rs(), t.status === "kept" && us(e)), t.status === "kept" || !g.getState().conversations.some((e) => e.id === c)) return;
722
+ if (ls(e, t) && (is(), t.status === "kept" && ds(e)), t.status === "kept" || !_.getState().conversations.some((e) => e.id === c)) return;
722
723
  let n = t.status === "arrived" || t.status === "redirected" ? t.landedPath : null;
723
- o(c, l, Bt(M, t, {
724
+ o(c, l, Vt(N, t, {
724
725
  page: s.label,
725
- landed: n === null ? null : Jr(zr(J.current.navItems), n),
726
+ landed: n === null ? null : Yr(Br(Y.current.navItems), n),
726
727
  path: s.path
727
- }), Kr({
728
+ }), qr({
728
729
  destinationId: s.id,
729
730
  path: s.path,
730
731
  alreadyHere: !1,
@@ -733,89 +734,89 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
733
734
  offer: u
734
735
  }));
735
736
  } finally {
736
- Xo.current === d && (Xo.current = null, Y.current && Qo(!1));
737
+ Zo.current === d && (Zo.current = null, X.current && $o(!1));
737
738
  }
738
739
  };
739
- Ur(J.current.navigate, s.path, {
740
+ Wr(Y.current.navigate, s.path, {
740
741
  readPath: () => window.location.pathname + window.location.search,
741
742
  now: () => Date.now(),
742
743
  schedule: (e, t) => {
743
744
  window.setTimeout(e, t);
744
745
  },
745
- isShellLess: () => !Y.current,
746
+ isShellLess: () => !X.current,
746
747
  initiator: t === "tap" ? "person" : "assistant",
747
748
  surface: "offer"
748
749
  }).then(f, () => f({ status: "unconfirmed" }));
749
750
  }, [
750
- os,
751
751
  ss,
752
- M,
753
- rs,
754
752
  cs,
755
- us
756
- ]), fs = T((e, t) => ds(e, "tap", t || null), [ds]), ps = T((e) => {
757
- let { replyId: t, conversationId: n } = e, r = X.turnFor(t);
753
+ N,
754
+ is,
755
+ ls,
756
+ ds
757
+ ]), ps = E((e, t) => fs(e, "tap", t || null), [fs]), ms = E((e) => {
758
+ let { replyId: t, conversationId: n } = e, r = Z.turnFor(t);
758
759
  if (!r) return;
759
- let i = window.location.pathname + window.location.search, a = zr(J.current.navItems), o = ai({
760
+ let i = window.location.pathname + window.location.search, a = Br(Y.current.navItems), o = oi({
760
761
  intent: e.intent,
761
- live: X.liveOffersFor(t, {
762
- registry: is(),
763
- actorId: as.current,
762
+ live: Z.liveOffersFor(t, {
763
+ registry: as(),
764
+ actorId: os.current,
764
765
  conversationId: n,
765
766
  perfNow: performance.now()
766
767
  }),
767
- unusedCount: X.offersFor(t).filter((e) => !e.used).length,
768
- pendingProposals: U.liveFor(n).count,
768
+ unusedCount: Z.offersFor(t).filter((e) => !e.used).length,
769
+ pendingProposals: W.liveFor(n).count,
769
770
  turnWriteCapable: r.writeCapable,
770
771
  atSend: e.atSend,
771
772
  now: {
772
773
  location: i,
773
- conversationId: g.getState().activeConversationId,
774
- workspaceId: C(),
775
- actorId: as.current ?? null
774
+ conversationId: _.getState().activeConversationId,
775
+ workspaceId: w(),
776
+ actorId: os.current ?? null
776
777
  },
777
- mounted: Y.current,
778
+ mounted: X.current,
778
779
  visible: document.visibilityState === "visible",
779
- unsavedChanges: oi(J.current.options),
780
+ unsavedChanges: si(Y.current.options),
780
781
  alreadyThere: ({ target: e }) => {
781
782
  let t = a.find((t) => t.id === e.id);
782
- return t ? Ir(t, i, a) : !1;
783
+ return t ? Lr(t, i, a) : !1;
783
784
  }
784
785
  });
785
786
  if (o.act === "navigate" || o.act === "already-here") {
786
- ds(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
787
+ fs(o.offer.offer.offerId, "resolve", o.offer.target.label, o.act === "already-here");
787
788
  return;
788
789
  }
789
- let [s] = o.unsaved ?? [], [c] = X.liveOffersFor(t, {
790
- registry: is(),
791
- actorId: as.current,
790
+ let [s] = o.unsaved ?? [], [c] = Z.liveOffersFor(t, {
791
+ registry: as(),
792
+ actorId: os.current,
792
793
  conversationId: n,
793
794
  perfNow: performance.now()
794
795
  });
795
- o.hold === "R5-unsaved" && s && c && ss(n, e.voiceSessionId, Ht(M, s.label, c.target.label), C());
796
+ o.hold === "R5-unsaved" && s && c && cs(n, e.voiceSessionId, Ut(N, s.label, c.target.label), w());
796
797
  }, [
797
- X,
798
- is,
799
- U,
800
- ds,
801
- ss,
802
- M
803
- ]), ms = T((e) => {
804
- let t = g.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
805
- return n ? Gr(Wr, window.location.pathname, Yr(n.messages, e)) : !1;
806
- }, []), hs = T((e, t, n = !1) => {
807
- let { navItems: r, options: i } = J.current, a = zr(r), o = null, s = {
798
+ Z,
799
+ as,
800
+ W,
801
+ fs,
802
+ cs,
803
+ N
804
+ ]), hs = E((e) => {
805
+ let t = _.getState(), n = t.conversations.find((e) => e.id === t.activeConversationId);
806
+ return n ? Kr(Gr, window.location.pathname, Xr(n.messages, e)) : !1;
807
+ }, []), gs = E((e, t, n = !1) => {
808
+ let { navItems: r, options: i } = Y.current, a = Br(r), o = null, s = {
808
809
  ...i,
809
- locale: t === void 0 ? R : Ui.input.code,
810
- uiLocale: R,
811
- inputLocale: Ui.input.code
810
+ locale: t === void 0 ? z : Wi.input.code,
811
+ uiLocale: z,
812
+ inputLocale: Wi.input.code
812
813
  };
813
- if (Rr(e, s)) {
814
- let e = g.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? Zr(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => X.offersFor(e.id).some((e) => e.offerId === t) } }) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && jt(c.status);
814
+ if (zr(e, s)) {
815
+ let e = _.getState(), n = e.conversations.find((t) => t.id === e.activeConversationId), s = n ? Qr(n.messages, t, { lookThroughRefusedOffers: { ownsOffer: (e, t) => Z.offersFor(e.id).some((e) => e.offerId === t) } }) : null, c = n ? e.processingByConversationId[n.id] ?? null : null, l = c !== null && c.messageId === s?.id && Mt(c.status);
815
816
  if (n && s && !l) {
816
- let e = X.liveOffersFor(s.id, {
817
- registry: is(),
818
- actorId: as.current,
817
+ let e = Z.liveOffersFor(s.id, {
818
+ registry: as(),
819
+ actorId: os.current,
819
820
  conversationId: n.id,
820
821
  perfNow: performance.now()
821
822
  }).flatMap(({ offer: e, target: t }) => {
@@ -825,36 +826,36 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
825
826
  target: n
826
827
  }] : [];
827
828
  });
828
- o = Xr({
829
+ o = Zr({
829
830
  reply: s,
830
- text: ln(s, c, M),
831
+ text: un(s, c, N),
831
832
  resolve: {
832
833
  destinations: a,
833
834
  entityRoutes: i.entityRoutes,
834
- visibleNavIds: Pr(r),
835
- nounLabel: (e) => Lt(M, e)
835
+ visibleNavIds: Fr(r),
836
+ nounLabel: (e) => Rt(N, e)
836
837
  },
837
838
  offers: e
838
839
  });
839
840
  }
840
841
  }
841
- return Lr(e, a, s, {
842
- backRunnable: ms(t),
842
+ return Rr(e, a, s, {
843
+ backRunnable: hs(t),
843
844
  navigation: o,
844
845
  skipRecords: n,
845
- controls: Hr()
846
+ controls: Ur()
846
847
  });
847
848
  }, [
848
- ms,
849
- Ui,
850
- R,
851
- M,
852
- X,
853
- is
854
- ]), gs = T((e, t) => {
855
- let n = hs(e, t);
849
+ hs,
850
+ Wi,
851
+ z,
852
+ N,
853
+ Z,
854
+ as
855
+ ]), _s = E((e, t) => {
856
+ let n = gs(e, t);
856
857
  if (!n) return !1;
857
- let { theme: r, navigate: i } = J.current;
858
+ let { theme: r, navigate: i } = Y.current;
858
859
  switch (n.kind) {
859
860
  case "theme": return r !== null;
860
861
  case "navigate":
@@ -864,40 +865,40 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
864
865
  case "link-not-openable":
865
866
  case "back": return i !== null;
866
867
  case "conversation-delete": return !1;
867
- case "app-control": return si(n.request, { voiceLive: t !== void 0 || vc.current }) !== null;
868
+ case "app-control": return ci(n.request, { voiceLive: t !== void 0 || bc.current }) !== null;
868
869
  case "open-record": return !1;
869
870
  }
870
- }, [hs]), _s = O(gs);
871
- E(() => {
872
- _s.current = gs;
873
- }, [gs]);
874
- let vs = T((e, t) => {
871
+ }, [gs]), vs = k(_s);
872
+ D(() => {
873
+ vs.current = _s;
874
+ }, [_s]);
875
+ let ys = E((e, t) => {
875
876
  let n = {
876
877
  state: "none",
877
878
  accept: null
878
- }, { navigate: r, options: i, navItems: a } = J.current;
879
+ }, { navigate: r, options: i, navItems: a } = Y.current;
879
880
  if (!e || r === null || i.uiOffers !== !0) return n;
880
- let o = g.getState(), s = o.conversations.find((t) => t.id === e);
881
+ let o = _.getState(), s = o.conversations.find((t) => t.id === e);
881
882
  if (!s) return n;
882
883
  let c = o.processingByConversationId[s.id] ?? null, l = {
883
- registry: is(),
884
- actorId: as.current,
884
+ registry: as(),
885
+ actorId: os.current,
885
886
  conversationId: s.id,
886
887
  perfNow: performance.now()
887
- }, { state: u, reply: d } = ri(X, {
888
+ }, { state: u, reply: d } = ii(Z, {
888
889
  ...l,
889
890
  messages: s.messages,
890
891
  voiceSessionId: t,
891
892
  processing: c,
892
- displayedText: (e) => ln(e, c, M),
893
- productWriteApproval: F,
894
- capabilitiesOf: (e) => g.getState().sandboxWriteCapabilities[e]
893
+ displayedText: (e) => un(e, c, N),
894
+ productWriteApproval: I,
895
+ capabilitiesOf: (e) => _.getState().sandboxWriteCapabilities[e]
895
896
  });
896
897
  if (u !== "acceptable" || !d) return {
897
898
  state: u,
898
899
  accept: null
899
900
  };
900
- let [f] = X.liveOffersFor(d.id, l), ee = f ? zr(a).find((e) => e.id === f.target.id) : void 0;
901
+ let [f] = Z.liveOffersFor(d.id, l), ee = f ? Br(a).find((e) => e.id === f.target.id) : void 0;
901
902
  return !f || !ee ? n : {
902
903
  state: u,
903
904
  accept: {
@@ -906,134 +907,134 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
906
907
  }
907
908
  };
908
909
  }, [
909
- X,
910
- is,
911
- F,
912
- M
913
- ]), ys = T((e, t, n, r, i, a) => {
914
- let o = M(n.key, n.fallback, r), s = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), c = {
910
+ Z,
911
+ as,
912
+ I,
913
+ N
914
+ ]), bs = E((e, t, n, r, i, a) => {
915
+ let o = N(n.key, n.fallback, r), s = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), c = {
915
916
  kind: "write-reply",
916
917
  line: n.key
917
- }, l = (/* @__PURE__ */ new Date()).toISOString(), u = j();
918
- V(e, {
918
+ }, l = (/* @__PURE__ */ new Date()).toISOString(), u = M();
919
+ H(e, {
919
920
  id: u,
920
921
  role: "user",
921
922
  content: t,
922
923
  timestamp: l,
923
924
  metadata: {
924
925
  localAction: c,
925
- ...b(i)
926
+ ...x(i)
926
927
  }
927
928
  });
928
- let d = j();
929
- V(e, {
929
+ let d = M();
930
+ H(e, {
930
931
  id: d,
931
932
  role: "assistant",
932
933
  content: o,
933
934
  timestamp: l,
934
935
  metadata: {
935
- lang: o === s ? "en" : R,
936
+ lang: o === s ? "en" : z,
936
937
  localAction: c,
937
- ...b(i)
938
+ ...x(i)
938
939
  }
939
- }), qn.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", C()), a !== void 0 && Ro(a, {
940
+ }), Jn.recordCommittedEntries(e, [u, d], "LOCAL_COMMAND", w()), a !== void 0 && zo(a, {
940
941
  conversationId: e,
941
942
  questionId: u,
942
943
  replyId: d
943
- }), Mo(e, d);
944
+ }), No(e, d);
944
945
  }, [
945
- V,
946
- R,
947
- Ro,
948
- Mo,
949
- M
950
- ]), bs = Zn(), xs = Qn(), Ss = bs?.request ?? null, Cs = O(() => void 0), [ws, Ts] = k(null);
951
- E(() => {
952
- if (ws === null) return;
953
- let e = window.setTimeout(() => Ts(null), wi);
946
+ H,
947
+ z,
948
+ zo,
949
+ No,
950
+ N
951
+ ]), xs = Qn(), Ss = $n(), Cs = xs?.request ?? null, ws = k(() => void 0), [Ts, Es] = A(null);
952
+ D(() => {
953
+ if (Ts === null) return;
954
+ let e = window.setTimeout(() => Es(null), Ti);
954
955
  return () => window.clearTimeout(e);
955
- }, [ws]);
956
- let Es = T(() => {
957
- let e = g.getState();
958
- return Qi(void 0, e.autoRouting && Wa.current ? c : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
959
- }, [Qi]), Ds = T((e) => {
960
- if (!Ss) return !1;
961
- let t = e !== void 0, n = g.getState(), r = tr({
956
+ }, [Ts]);
957
+ let Ds = E(() => {
958
+ let e = _.getState();
959
+ return $i(void 0, e.autoRouting && Ga.current ? d : e.mode, e.autoRouting ? { routedBy: "auto" } : void 0);
960
+ }, [$i]), Os = E((e) => {
961
+ if (!Cs) return !1;
962
+ let t = e !== void 0, n = _.getState(), r = nr({
962
963
  spoken: t,
963
- bound: ao.current,
964
+ bound: oo.current,
964
965
  activeConversationId: n.activeConversationId,
965
966
  conversations: n.conversations,
966
- historyOn: Xn()
967
+ historyOn: Zn()
967
968
  });
968
- if (r && Ss(r), t) {
969
- let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? M("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : M("deleteConversation.nothing", "There is no conversation to delete.");
970
- Cs.current({
971
- id: `conversation-delete:${j()}`,
969
+ if (r && Cs(r), t) {
970
+ let e = r ? "Opened the delete confirmation. Choose Delete or Cancel on screen." : "There is no conversation to delete.", t = r ? N("deleteConversation.opened", "Opened the delete confirmation. Choose Delete or Cancel on screen.") : N("deleteConversation.nothing", "There is no conversation to delete.");
971
+ ws.current({
972
+ id: `conversation-delete:${M()}`,
972
973
  text: t,
973
- lang: t === e ? "en" : R
974
+ lang: t === e ? "en" : z
974
975
  });
975
- } else r || Ts(Date.now());
976
+ } else r || Es(Date.now());
976
977
  return !0;
977
978
  }, [
978
- Ss,
979
- R,
980
- M
981
- ]), Os = T((e, t, n, r = !1, i) => {
982
- if (e.kind === "conversation-delete") return Ds(n);
983
- let { theme: a, navigate: o } = J.current, s = null, c = () => {
984
- let e = (r ? null : s ?? g.getState().activeConversationId) ?? Es();
985
- return r && co(e), e;
979
+ Cs,
980
+ z,
981
+ N
982
+ ]), ks = E((e, t, n, r = !1, i) => {
983
+ if (e.kind === "conversation-delete") return Os(n);
984
+ let { theme: a, navigate: o } = Y.current, s = null, c = () => {
985
+ let e = (r ? null : s ?? _.getState().activeConversationId) ?? Ds();
986
+ return r && lo(e), e;
986
987
  }, l = (e, r) => {
987
- let i = j();
988
- return V(e, {
988
+ let i = M();
989
+ return H(e, {
989
990
  id: i,
990
991
  role: "user",
991
992
  content: t,
992
993
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
993
994
  metadata: {
994
995
  localAction: r,
995
- ...b(n)
996
+ ...x(n)
996
997
  }
997
998
  }), i;
998
999
  }, u = (e, t, r, a, o, s, c) => {
999
- let l = c ?? j();
1000
- return V(e, {
1000
+ let l = c ?? M();
1001
+ return H(e, {
1001
1002
  id: l,
1002
1003
  role: "assistant",
1003
1004
  content: r.text,
1004
1005
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1005
1006
  metadata: {
1006
- lang: r.translated ? R : "en",
1007
+ lang: r.translated ? z : "en",
1007
1008
  localAction: a,
1008
- ...b(n)
1009
+ ...x(n)
1009
1010
  }
1010
- }), qn.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && Ro(i, {
1011
+ }), Jn.recordCommittedEntries(e, [t, l], "LOCAL_COMMAND", o), i !== void 0 && zo(i, {
1011
1012
  conversationId: e,
1012
1013
  questionId: t,
1013
1014
  replyId: l
1014
- }), s && Mo(e, l), l;
1015
+ }), s && No(e, l), l;
1015
1016
  }, d = (e, t, n) => {
1016
- let r = c(), i = u(r, l(r, t), e, t, C(), !0);
1017
+ let r = c(), i = u(r, l(r, t), e, t, w(), !0);
1017
1018
  return n?.(i), !0;
1018
1019
  }, f = (e) => {
1019
- let t = c(), n = C(), r = window.location.pathname, a = l(t, Kr({
1020
+ let t = c(), n = w(), r = window.location.pathname, a = l(t, qr({
1020
1021
  destinationId: e.destinationId,
1021
1022
  path: e.registryPath,
1022
1023
  alreadyHere: !1,
1023
1024
  via: e.via,
1024
1025
  offer: e.offer
1025
- })), s = i === void 0 ? void 0 : j();
1026
- i !== void 0 && s !== void 0 && (Io(i, {
1026
+ })), s = i === void 0 ? void 0 : M();
1027
+ i !== void 0 && s !== void 0 && (Lo(i, {
1027
1028
  conversationId: t,
1028
1029
  questionId: a,
1029
1030
  replyId: s
1030
- }), es(s));
1031
- let d = j();
1032
- Xo.current = d, Qo(!0);
1031
+ }), ts(s));
1032
+ let d = M();
1033
+ Zo.current = d, $o(!0);
1033
1034
  let f = (i) => {
1034
1035
  try {
1035
- if (e.offer && cs(e.offer.offerId, i) && rs(), i.status === "kept" || !g.getState().conversations.some((e) => e.id === t)) return;
1036
- let o = zr(J.current.navItems), c = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, l = Kr({
1036
+ if (e.offer && ls(e.offer.offerId, i) && is(), i.status === "kept" || !_.getState().conversations.some((e) => e.id === t)) return;
1037
+ let o = Br(Y.current.navItems), c = i.status === "arrived" || i.status === "redirected" ? i.landedPath : null, l = qr({
1037
1038
  destinationId: e.destinationId,
1038
1039
  path: e.registryPath,
1039
1040
  alreadyHere: !1,
@@ -1041,30 +1042,30 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1041
1042
  outcome: i,
1042
1043
  offer: e.offer
1043
1044
  });
1044
- ta(t, a, { localAction: l });
1045
- let d = u(t, a, e.via === "back" && i.status === "arrived" ? Pt(M, e.pageLabel()) : Bt(M, i, {
1045
+ na(t, a, { localAction: l });
1046
+ let d = u(t, a, e.via === "back" && i.status === "arrived" ? Ft(N, e.pageLabel()) : Vt(N, i, {
1046
1047
  page: e.pageLabel(),
1047
- landed: c === null ? null : Jr(o, c),
1048
+ landed: c === null ? null : Yr(o, c),
1048
1049
  path: e.target
1049
- }), l, n, Y.current, s);
1050
+ }), l, n, X.current, s);
1050
1051
  i.status === "arrived" && e.onArrived?.({
1051
1052
  replyId: d,
1052
1053
  fromPath: r,
1053
1054
  landedPath: i.landedPath
1054
1055
  });
1055
1056
  } finally {
1056
- Xo.current === d && (Xo.current = null, Y.current && Qo(!1)), s !== void 0 && Y.current && es((e) => e === s ? null : e);
1057
+ Zo.current === d && (Zo.current = null, X.current && $o(!1)), s !== void 0 && X.current && ts((e) => e === s ? null : e);
1057
1058
  }
1058
1059
  };
1059
- return Ur(o, e.target, {
1060
+ return Wr(o, e.target, {
1060
1061
  readPath: () => window.location.pathname + window.location.search,
1061
1062
  now: () => Date.now(),
1062
1063
  schedule: (e, t) => {
1063
1064
  window.setTimeout(e, t);
1064
1065
  },
1065
- isShellLess: () => !Y.current
1066
+ isShellLess: () => !X.current
1066
1067
  }).then(f, () => f({ status: "unconfirmed" })), !0;
1067
- }, ee = ({ replyId: e, fromPath: t, landedPath: n }) => Wr.push({
1068
+ }, ee = ({ replyId: e, fromPath: t, landedPath: n }) => Gr.push({
1068
1069
  fromPath: t,
1069
1070
  toPath: n,
1070
1071
  replyMessageId: e,
@@ -1072,21 +1073,21 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1072
1073
  });
1073
1074
  if (e.kind === "theme") {
1074
1075
  if (!a) return !1;
1075
- let t = Br(e.request, {
1076
+ let t = Vr(e.request, {
1076
1077
  mode: a.mode,
1077
1078
  resolvedTheme: a.resolvedTheme
1078
1079
  });
1079
1080
  if (!t.alreadyApplied) try {
1080
1081
  a.setMode(t.mode);
1081
1082
  } catch {}
1082
- return d(qt(M, t, e.request.kind === "family"), {
1083
+ return d(Jt(N, t, e.request.kind === "family"), {
1083
1084
  kind: "theme",
1084
1085
  mode: t.mode,
1085
1086
  alreadyApplied: t.alreadyApplied
1086
1087
  });
1087
1088
  }
1088
1089
  if (e.kind === "app-control") {
1089
- let t = si(e.request, { voiceLive: n !== void 0 || vc.current });
1090
+ let t = ci(e.request, { voiceLive: n !== void 0 || bc.current });
1090
1091
  if (!t) return !1;
1091
1092
  let r = (e) => ({
1092
1093
  kind: "app-control",
@@ -1094,66 +1095,66 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1094
1095
  outcome: e.outcome,
1095
1096
  ...e.reply.code === "language" ? { languageLabel: e.reply.label } : {}
1096
1097
  }), i = (t) => {
1097
- if (e.request.control === "language" && Jo(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
1098
- let n = c(), i = r(t), a = u(n, l(n, i), Jt((e, t) => t, t.reply), i, C(), !1);
1099
- return Wo.current = {
1098
+ if (e.request.control === "language" && Yo(!1), e.request.control === "language" && t.reply.code === "language" && !t.reply.already && t.outcome === "done") {
1099
+ let n = c(), i = r(t), a = u(n, l(n, i), Yt((e, t) => t, t.reply), i, w(), !1);
1100
+ return Go.current = {
1100
1101
  wanted: e.request.code,
1101
1102
  reply: t.reply,
1102
1103
  conversationId: n,
1103
1104
  messageId: a,
1104
- deadline: window.setTimeout(Yo, Yt)
1105
- }, Ko(a), !0;
1105
+ deadline: window.setTimeout(Xo, Xt)
1106
+ }, qo(a), !0;
1106
1107
  }
1107
- return d(Jt(M, t.reply), r(t));
1108
+ return d(Yt(N, t.reply), r(t));
1108
1109
  };
1109
1110
  if (t.kind === "reply") return i(t.run);
1110
1111
  if (t.kind === "run") {
1111
1112
  let e = t.run();
1112
1113
  return t.silent && (e.outcome === "done" || e.outcome === "already") ? !0 : i(e);
1113
1114
  }
1114
- let a = xs;
1115
+ let a = Ss;
1115
1116
  if (!a) return !1;
1116
1117
  let o = null;
1117
- return d(Jt(M, t.ask.reply), r(t.ask), (e) => {
1118
- o = g.getState().conversations.find((t) => t.messages.some((t) => t.id === e))?.id ?? null;
1118
+ return d(Yt(N, t.ask.reply), r(t.ask), (e) => {
1119
+ o = _.getState().conversations.find((t) => t.messages.some((t) => t.id === e))?.id ?? null;
1119
1120
  }), a.request({
1120
1121
  prompt: t.prompt,
1121
1122
  onConfirm: () => {
1122
- let e = t.confirmed(), i = o, a = i !== null && g.getState().conversations.some((e) => e.id === i);
1123
+ let e = t.confirmed(), i = o, a = i !== null && _.getState().conversations.some((e) => e.id === i);
1123
1124
  if (!i || !a) return;
1124
- let s = Jt(M, e.reply);
1125
- V(i, {
1126
- id: j(),
1125
+ let s = Yt(N, e.reply);
1126
+ H(i, {
1127
+ id: M(),
1127
1128
  role: "assistant",
1128
1129
  content: s.text,
1129
1130
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1130
1131
  metadata: {
1131
- lang: s.translated ? R : "en",
1132
+ lang: s.translated ? z : "en",
1132
1133
  localAction: r(e),
1133
- ...b(n)
1134
+ ...x(n)
1134
1135
  }
1135
1136
  });
1136
1137
  }
1137
1138
  }), !0;
1138
1139
  }
1139
1140
  if (!o) return !1;
1140
- if (e.kind === "choose-destination") return d(Ft(M, e.candidates[0]?.label ?? e.query, e.candidates), {
1141
+ if (e.kind === "choose-destination") return d(It(N, e.candidates[0]?.label ?? e.query, e.candidates), {
1141
1142
  kind: "choose-destination",
1142
1143
  candidateIds: e.candidates.map((e) => e.id)
1143
- }, (t) => Qr(t, e.candidates));
1144
- if (e.kind === "choose-linked") return d(It(M, e.candidates), {
1144
+ }, (t) => $r(t, e.candidates));
1145
+ if (e.kind === "choose-linked") return d(Lt(N, e.candidates), {
1145
1146
  kind: "choose-destination",
1146
1147
  candidateIds: e.candidates.map((e) => e.id)
1147
- }, (t) => Qr(t, e.candidates));
1148
+ }, (t) => $r(t, e.candidates));
1148
1149
  if (e.kind === "pick-from-list") {
1149
1150
  let t = e.candidates !== null && e.candidates.every((e) => e !== null) ? e.candidates : null;
1150
- return d(Wt(M), t ? {
1151
+ return d(Gt(N), t ? {
1151
1152
  kind: "choose-destination",
1152
1153
  candidateIds: t.map((e) => e.id)
1153
1154
  } : e.candidateIds.length > 0 ? {
1154
1155
  kind: "choose-destination",
1155
1156
  candidateIds: [...e.candidateIds]
1156
- } : Kr({
1157
+ } : qr({
1157
1158
  destinationId: "",
1158
1159
  path: "",
1159
1160
  alreadyHere: !1,
@@ -1162,9 +1163,9 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1162
1163
  status: "refused",
1163
1164
  reason: "not-routable"
1164
1165
  }
1165
- }), t ? (e) => Qr(e, t) : void 0);
1166
+ }), t ? (e) => $r(e, t) : void 0);
1166
1167
  }
1167
- if (e.kind === "link-not-openable") return d(Rt(M), Kr({
1168
+ if (e.kind === "link-not-openable") return d(zt(N), qr({
1168
1169
  destinationId: "",
1169
1170
  path: "",
1170
1171
  alreadyHere: !1,
@@ -1177,7 +1178,7 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1177
1178
  if (e.kind === "open-record") {
1178
1179
  let r;
1179
1180
  try {
1180
- let { options: t, navItems: n } = J.current, i = t.entityRoutes ?? [], a = Pr(n);
1181
+ let { options: t, navItems: n } = Y.current, i = t.entityRoutes ?? [], a = Fr(n);
1181
1182
  r = (t.records ?? []).flatMap((t) => {
1182
1183
  let n = i.find((e) => e.id === t.entityRouteId), r = e.request.adapterIds.length === 0 || e.request.adapterIds.includes(t.id);
1183
1184
  return n && r && (n.visibleWith === void 0 || a.has(n.visibleWith)) ? [{
@@ -1189,28 +1190,28 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1189
1190
  return !1;
1190
1191
  }
1191
1192
  if (r.length === 0) return !1;
1192
- let i = g.getState().activeConversationId, a = j();
1193
- Xo.current = a, Qo(!0);
1193
+ let i = _.getState().activeConversationId, a = M();
1194
+ Zo.current = a, $o(!0);
1194
1195
  let o = () => {
1195
- Xo.current === a && (Xo.current = null, Y.current && Qo(!1));
1196
+ Zo.current === a && (Zo.current = null, X.current && $o(!1));
1196
1197
  };
1197
1198
  return (async () => {
1198
1199
  let a = { kind: "none" }, c = !0;
1199
1200
  try {
1200
- a = await Fr({
1201
+ a = await Ir({
1201
1202
  name: e.request.name,
1202
1203
  usable: r,
1203
- nounOf: (e) => Lt(M, e.noun),
1204
- timeoutMs: vi
1205
- }), c = g.getState().conversations.some((e) => e.id === i);
1204
+ nounOf: (e) => Rt(N, e.noun),
1205
+ timeoutMs: yi
1206
+ }), c = _.getState().conversations.some((e) => e.id === i);
1206
1207
  } catch {
1207
1208
  a = { kind: "none" };
1208
1209
  } finally {
1209
1210
  o();
1210
1211
  }
1211
- if (!Y.current) return;
1212
+ if (!X.current) return;
1212
1213
  if (a.kind === "none") {
1213
- Ns.current(t, [], {
1214
+ Ps.current(t, [], {
1214
1215
  fromPerson: !0,
1215
1216
  ...n === void 0 ? {} : { voiceSessionId: n },
1216
1217
  localRecordsChecked: !0
@@ -1231,16 +1232,16 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1231
1232
  return;
1232
1233
  }
1233
1234
  let l = a.candidates[0];
1234
- d(a.why === "kinds" ? Kt(M, a.nouns, a.candidates) : Gt(M, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
1235
+ d(a.why === "kinds" ? qt(N, a.nouns, a.candidates) : Kt(N, a.nouns[0] ?? "", l?.label ?? e.request.name, a.candidates), {
1235
1236
  kind: "choose-destination",
1236
1237
  candidateIds: a.candidates.map((e) => e.id)
1237
- }, (e) => Qr(e, a.candidates));
1238
+ }, (e) => $r(e, a.candidates));
1238
1239
  })().catch(() => void 0), !0;
1239
1240
  }
1240
1241
  if (e.kind === "back") {
1241
- let e = Wr.top();
1242
+ let e = Gr.top();
1242
1243
  if (!e) return !1;
1243
- let t = qr(zr(J.current.navItems), e.fromPath);
1244
+ let t = Jr(Br(Y.current.navItems), e.fromPath);
1244
1245
  return f({
1245
1246
  target: e.fromPath,
1246
1247
  destinationId: t?.id ?? "",
@@ -1248,27 +1249,27 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1248
1249
  via: "back",
1249
1250
  pageLabel: () => t?.label ?? null,
1250
1251
  onArrived: () => {
1251
- Wr.top() === e && Wr.pop();
1252
+ Gr.top() === e && Gr.pop();
1252
1253
  }
1253
1254
  });
1254
1255
  }
1255
1256
  let te, p = e.destination;
1256
1257
  if (e.via === "offer") {
1257
- let t = os(e.offerId, e.destination.label);
1258
- if (!t.ok) return d(t.copy ?? Vt(M), {
1258
+ let t = ss(e.offerId, e.destination.label);
1259
+ if (!t.ok) return d(t.copy ?? Ht(N), {
1259
1260
  kind: "write-reply",
1260
1261
  line: t.reason === "unavailable" ? "offer.notAvailable" : "offer.expired"
1261
1262
  });
1262
1263
  te = {
1263
1264
  trigger: e.trigger,
1264
1265
  offerId: e.offerId
1265
- }, p = zr(J.current.navItems).find((e) => e.id === t.target.id) ?? {
1266
+ }, p = Br(Y.current.navItems).find((e) => e.id === t.target.id) ?? {
1266
1267
  id: t.target.id,
1267
1268
  label: t.target.label,
1268
1269
  path: t.target.path
1269
1270
  };
1270
1271
  }
1271
- return Ir(p, window.location.pathname + window.location.search, zr(J.current.navItems)) ? d(zt(M, p.label, !0), Kr({
1272
+ return Lr(p, window.location.pathname + window.location.search, Br(Y.current.navItems)) ? d(Bt(N, p.label, !0), qr({
1272
1273
  destinationId: p.id,
1273
1274
  path: p.path,
1274
1275
  alreadyHere: !0,
@@ -1284,119 +1285,119 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1284
1285
  onArrived: ee
1285
1286
  });
1286
1287
  }, [
1287
- V,
1288
- co,
1289
- xs,
1290
- Es,
1291
- Yo,
1292
- R,
1293
- ta,
1294
- Io,
1288
+ H,
1289
+ lo,
1290
+ Ss,
1295
1291
  Ds,
1296
- Ro,
1297
- Jo,
1298
- Mo,
1299
- M,
1300
- os,
1301
- cs,
1302
- rs
1303
- ]), ks = T(async (e) => {
1304
- Ka.current = !0, Ja(!0);
1292
+ Xo,
1293
+ z,
1294
+ na,
1295
+ Lo,
1296
+ Os,
1297
+ zo,
1298
+ Yo,
1299
+ No,
1300
+ N,
1301
+ ss,
1302
+ ls,
1303
+ is
1304
+ ]), As = E(async (e) => {
1305
+ qa.current = !0, Ya(!0);
1305
1306
  try {
1306
- await U.declineForReply(e.conversationId, e.reason, e.origin);
1307
+ await W.declineForReply(e.conversationId, e.reason, e.origin);
1307
1308
  } finally {
1308
- Ka.current = !1, Y.current && Ja(!1);
1309
+ qa.current = !1, X.current && Ya(!1);
1309
1310
  }
1310
1311
  if (e.commandText !== null) {
1311
- let t = hs(e.commandText, e.options.voiceSessionId);
1312
- if (t && Os(t, e.content, e.options.voiceSessionId)) return;
1312
+ let t = gs(e.commandText, e.options.voiceSessionId);
1313
+ if (t && ks(t, e.content, e.options.voiceSessionId)) return;
1313
1314
  }
1314
- await Ns.current(e.content, e.attachments, e.options);
1315
+ await Ps.current(e.content, e.attachments, e.options);
1315
1316
  }, [
1316
- hs,
1317
- Os,
1318
- U
1319
- ]), Z = T(async (e, t = [], n = {}) => {
1320
- let r = n.voiceSessionId !== void 0, i = g.getState(), a = !1, o = ao.current;
1321
- if (r && et(o)) {
1322
- let e = at(o, i.activeConversationId, lo());
1317
+ gs,
1318
+ ks,
1319
+ W
1320
+ ]), Q = E(async (e, t = [], n = {}) => {
1321
+ let r = n.voiceSessionId !== void 0, i = _.getState(), a = !1, o = oo.current;
1322
+ if (r && nt(o)) {
1323
+ let e = ot(o, i.activeConversationId, uo());
1323
1324
  if (e.kind === "gone") return;
1324
1325
  let t = n.voiceEntry ?? e;
1325
- t.kind === "adopt" && co(t.conversationId), a = t.kind === "own", n = {
1326
+ t.kind === "adopt" && lo(t.conversationId), a = t.kind === "own", n = {
1326
1327
  ...n,
1327
1328
  voiceEntry: t
1328
1329
  };
1329
1330
  }
1330
- let s = a ? null : i.activeConversationId, c = a ? null : i.activeConversationId ?? z;
1331
- if (c) {
1332
- if (jt(i.processingByConversationId[c]?.status)) {
1331
+ let u = a ? null : i.activeConversationId, d = a ? null : i.activeConversationId ?? B;
1332
+ if (d) {
1333
+ if (Mt(i.processingByConversationId[d]?.status)) {
1333
1334
  if (n.avatarTabAsk !== void 0) return;
1334
- let r = i.processingByConversationId[c]?.messageId ?? null;
1335
- r && n.correctsInFlightTurn === !0 && !To.current.has(r) && Oo(), r && To.current.has(r) && (Eo.current = {
1336
- conversationId: c,
1335
+ let r = i.processingByConversationId[d]?.messageId ?? null;
1336
+ r && n.correctsInFlightTurn === !0 && !Eo.current.has(r) && ko(), r && Eo.current.has(r) && (Do.current = {
1337
+ conversationId: d,
1337
1338
  content: e,
1338
1339
  attachments: t,
1339
1340
  options: n
1340
1341
  });
1341
1342
  return;
1342
1343
  }
1343
- if (fo.current.has(c)) return;
1344
+ if (po.current.has(d)) return;
1344
1345
  }
1345
- if (Ga.current || ie() !== null || Ka.current || Xo.current !== null) return;
1346
- let l = n.targetConversationId, f = te(), p = (e) => Wn(e) || Un(e, f);
1347
- if (l !== void 0) {
1348
- let e = i.conversations.find((e) => e.id === l);
1349
- if (i.activeConversationId !== l || !e || e.mode !== i.mode || p(e)) return;
1346
+ if (Ka.current || se() !== null || qa.current || Zo.current !== null) return;
1347
+ let f = n.targetConversationId, p = re(), ie = (e) => Gn(e) || Wn(e, p);
1348
+ if (f !== void 0) {
1349
+ let e = i.conversations.find((e) => e.id === f);
1350
+ if (i.activeConversationId !== f || !e || e.mode !== i.mode || ie(e)) return;
1350
1351
  }
1351
1352
  if (n.avatarTabAsk !== void 0) {
1352
- let e = s ? i.conversations.find((e) => e.id === s) : void 0, t = e && !p(e) ? e : void 0;
1353
- if (fr({
1354
- auto: i.autoRouting && Wa.current && l === void 0,
1353
+ let e = u ? i.conversations.find((e) => e.id === u) : void 0, t = e && !ie(e) ? e : void 0;
1354
+ if (pr({
1355
+ auto: i.autoRouting && Ga.current && f === void 0,
1355
1356
  selectedMode: i.mode,
1356
1357
  conversation: t ? {
1357
1358
  mode: t.mode,
1358
1359
  routedBy: t.routedBy,
1359
- hasHistory: Hn(t)
1360
+ hasHistory: Un(t)
1360
1361
  } : null,
1361
- modeWrites: (e) => Ia.current.find((t) => t.id === e)?.writeCapable === !0 || ye(e)
1362
+ modeWrites: (e) => La.current.find((t) => t.id === e)?.writeCapable === !0 || xe(e)
1362
1363
  }) !== null) return;
1363
1364
  }
1364
1365
  if (n.fromPerson && n.writeReplyBound === void 0) {
1365
- let r = l ?? s ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", o = vs(r, n.voiceSessionId), c = jn({
1366
+ let r = f ?? u ?? null, i = n.voiceSessionId === void 0 ? "typed" : "spoken", o = ys(r, n.voiceSessionId), s = Mn({
1366
1367
  text: e,
1367
- locale: i === "spoken" ? Ui.input.code : R,
1368
+ locale: i === "spoken" ? Wi.input.code : z,
1368
1369
  origin: i,
1369
1370
  hasAttachments: t.length > 0,
1370
- live: U.liveFor(r),
1371
- matchesLocalCommand: (e) => hs(e, n.voiceSessionId) !== null,
1371
+ live: W.liveFor(r),
1372
+ matchesLocalCommand: (e) => gs(e, n.voiceSessionId) !== null,
1372
1373
  offer: o.state,
1373
- offerAssent: o.state !== "none" && Vr({
1374
+ offerAssent: o.state !== "none" && Hr({
1374
1375
  text: e,
1375
- uiLocale: R,
1376
- inputLocale: Ui.input.code,
1377
- commandLocales: J.current.options.commandLocales,
1378
- manifest: J.current.options.commandManifest,
1379
- leaveGuard: J.current.options.leaveGuard
1376
+ uiLocale: z,
1377
+ inputLocale: Wi.input.code,
1378
+ commandLocales: Y.current.options.commandLocales,
1379
+ manifest: Y.current.options.commandManifest,
1380
+ leaveGuard: Y.current.options.leaveGuard
1380
1381
  })
1381
1382
  });
1382
- if (c.kind === "accept_offer") {
1383
+ if (s.kind === "accept_offer") {
1383
1384
  let t = o.accept;
1384
- if (t && Os({
1385
+ if (t && ks({
1385
1386
  kind: "navigate",
1386
1387
  destination: t.destination,
1387
1388
  via: "offer",
1388
1389
  offerId: t.offerId,
1389
1390
  trigger: "yes"
1390
1391
  }, e, n.voiceSessionId, a, n.avatarTabAsk)) {
1391
- Lo(n.avatarTabAsk);
1392
+ Ro(n.avatarTabAsk);
1392
1393
  return;
1393
1394
  }
1394
- c = {
1395
+ s = {
1395
1396
  kind: "send",
1396
1397
  declineAll: null,
1397
1398
  bound: {
1398
1399
  writeReply: {
1399
- kind: c.viaAssent === !0 ? "other" : "affirm",
1400
+ kind: s.viaAssent === !0 ? "other" : "affirm",
1400
1401
  origin: i
1401
1402
  },
1402
1403
  promptText: e,
@@ -1404,1150 +1405,1159 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
1404
1405
  }
1405
1406
  };
1406
1407
  }
1407
- if (c.kind === "local_reply") {
1408
- r && ys(r, e, c.line, c.values, n.voiceSessionId, n.avatarTabAsk);
1408
+ if (s.kind === "local_reply") {
1409
+ r && bs(r, e, s.line, s.values, n.voiceSessionId, n.avatarTabAsk);
1409
1410
  return;
1410
1411
  }
1411
- let u = c.kind === "local" ? c.fallback : c.bound, d = c.declineAll;
1412
- if (d !== null && r) return n.avatarTabAsk === void 0 ? ks({
1412
+ let c = s.kind === "local" ? s.fallback : s.bound, l = s.declineAll;
1413
+ if (l !== null && r) return n.avatarTabAsk === void 0 ? As({
1413
1414
  conversationId: r,
1414
- reason: d,
1415
+ reason: l,
1415
1416
  origin: i,
1416
- commandText: c.kind === "local" ? c.commandText : null,
1417
+ commandText: s.kind === "local" ? s.commandText : null,
1417
1418
  content: e,
1418
1419
  attachments: t,
1419
1420
  options: {
1420
1421
  ...n,
1421
- writeReplyBound: u
1422
+ writeReplyBound: c
1422
1423
  }
1423
1424
  }) : void 0;
1424
1425
  n = {
1425
1426
  ...n,
1426
- writeReplyBound: u
1427
+ writeReplyBound: c
1427
1428
  };
1428
1429
  }
1429
- let ne = n.writeReplyBound?.promptText ?? e;
1430
+ let ae = n.writeReplyBound?.promptText ?? e;
1430
1431
  if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
1431
- let t = hs(e, n.voiceSessionId, n.localRecordsChecked === !0);
1432
- if (t && Os(t, e, n.voiceSessionId, a, n.avatarTabAsk)) {
1433
- Lo(n.avatarTabAsk);
1432
+ let t = gs(e, n.voiceSessionId, n.localRecordsChecked === !0);
1433
+ if (t && ks(t, e, n.voiceSessionId, a, n.avatarTabAsk)) {
1434
+ Ro(n.avatarTabAsk);
1434
1435
  return;
1435
1436
  }
1436
1437
  }
1437
- let re = s ? i.conversations.find((e) => e.id === s) : void 0, oe = p(re) ? void 0 : re, m = i.autoRouting && Wa.current && l === void 0 ? ee({
1438
- intent: n.avatarTabAsk === void 0 ? n.autoIntent ?? u(e) : "read",
1438
+ let oe = u ? i.conversations.find((e) => e.id === u) : void 0, m = ie(oe) ? void 0 : oe, h = i.autoRouting && Ga.current && f === void 0 ? ne({
1439
+ intent: n.avatarTabAsk === void 0 ? n.autoIntent ?? ee(e) : "read",
1439
1440
  dictated: r,
1440
- voiceProposalBound: r && Pi("api-calls") && ce(i.acknowledgedWriteModes, "api-calls"),
1441
- conversation: oe ? {
1442
- mode: oe.mode,
1443
- routedBy: oe.routedBy,
1444
- hasHistory: Hn(oe)
1441
+ voiceProposalBound: r && Fi("api-calls") && ue(i.acknowledgedWriteModes, "api-calls"),
1442
+ conversation: m ? {
1443
+ mode: m.mode,
1444
+ routedBy: m.routedBy,
1445
+ hasHistory: Un(m)
1445
1446
  } : null
1446
1447
  }) : null;
1447
- if (m && Ia.current.find((e) => e.id === m.mode)?.writeCapable && !ce(i.acknowledgedWriteModes, m.mode)) {
1448
- Ga.current = {
1448
+ if (h && La.current.find((e) => e.id === h.mode)?.writeCapable && !ue(i.acknowledgedWriteModes, h.mode)) {
1449
+ Ka.current = {
1449
1450
  content: e,
1450
1451
  attachments: t,
1451
1452
  options: n
1452
- }, Za(m.mode);
1453
+ }, Qa(h.mode);
1453
1454
  return;
1454
1455
  }
1455
- let h = m ? m.mode : i.mode, se, ue, _ = l ?? (a ? null : z), fe = _ ? g.getState().conversations.find((e) => e.id === _) : void 0, pe = m?.action === "escalate" && oe ? {
1456
- mode: oe.mode,
1457
- backendSessionId: oe.backendSessionId ?? null
1456
+ let g = h ? h.mode : i.mode, le, fe, v = f ?? (a ? null : B), me = v ? _.getState().conversations.find((e) => e.id === v) : void 0, he = h?.action === "escalate" && m ? {
1457
+ mode: m.mode,
1458
+ backendSessionId: m.backendSessionId ?? null
1458
1459
  } : null;
1459
- if (m) m.action === "new" || !oe ? _ = Qi(void 0, h, { routedBy: "auto" }) : (_ = oe.id, fa(_, h));
1460
+ if (h) h.action === "new" || !m ? v = $i(void 0, g, { routedBy: "auto" }) : (v = m.id, pa(v, g));
1460
1461
  else {
1461
1462
  let e = i.autoRouting ? { routedBy: "auto" } : void 0;
1462
- !_ || p(fe) || fe && fe.mode !== h && Hn(fe) ? _ = Qi(void 0, h, e) : fe && fe.mode !== h && (e ? fa(_, h) : Xi(_, h));
1463
+ !v || ie(me) || me && me.mode !== g && Un(me) ? v = $i(void 0, g, e) : me && me.mode !== g && (e ? pa(v, g) : Zi(v, g));
1463
1464
  }
1464
- if (!_) return;
1465
- r && ao.current !== void 0 && _ !== i.activeConversationId && co(_), n.approvalFollowUp || (uo.current[_] = t);
1466
- let he = () => g.getState().conversations.some((e) => e.id === _), v = C(), xe = {
1467
- accessToken: I(),
1468
- workspaceToken: Fi(),
1469
- userId: L,
1470
- organizationId: kt()
1471
- }, Ce = (e, t) => {
1472
- he() || !v || de(e, v, t, h, {
1473
- accessToken: I(),
1474
- workspaceToken: Fi(),
1475
- userId: L,
1476
- organizationId: kt()
1465
+ if (!v) return;
1466
+ r && oo.current !== void 0 && v !== i.activeConversationId && lo(v), n.approvalFollowUp || (fo.current[v] = t);
1467
+ let _e = () => _.getState().conversations.some((e) => e.id === v), y = w(), Ce = {
1468
+ accessToken: L(),
1469
+ workspaceToken: Ii(),
1470
+ userId: R,
1471
+ organizationId: At()
1472
+ }, Te = (e, t) => {
1473
+ _e() || !y || pe(e, y, t, g, {
1474
+ accessToken: L(),
1475
+ workspaceToken: Ii(),
1476
+ userId: R,
1477
+ organizationId: At()
1477
1478
  });
1478
- }, we = {
1479
- id: j(),
1479
+ }, Ee = {
1480
+ id: M(),
1480
1481
  role: "user",
1481
1482
  content: e,
1482
1483
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1483
1484
  metadata: {
1484
- ...t.length ? { attachments: t.map(ft) } : {},
1485
+ ...t.length ? { attachments: t.map(pt) } : {},
1485
1486
  ...n.approvalFollowUp ? {
1486
1487
  approvalFollowUp: !0,
1487
1488
  approvedReplyId: n.approvalFollowUp.approvedReplyId
1488
1489
  } : {},
1489
- ...b(n.voiceSessionId)
1490
+ ...x(n.voiceSessionId)
1490
1491
  }
1491
1492
  };
1492
- V(_, we);
1493
- let Te = n.fromPerson === !0 && t.length === 0 && n.approvalFollowUp === void 0 && ne === e ? ii(e, r ? Ui.input.code : R) : null, De = {
1493
+ H(v, Ee);
1494
+ let De = n.fromPerson === !0 && t.length === 0 && n.approvalFollowUp === void 0 && ae === e ? ai(e, r ? Wi.input.code : z) : null, Oe = {
1494
1495
  location: window.location.pathname + window.location.search,
1495
- conversationId: g.getState().activeConversationId,
1496
- workspaceId: C(),
1497
- actorId: L ?? null
1498
- }, y = j();
1499
- V(_, {
1500
- id: y,
1496
+ conversationId: _.getState().activeConversationId,
1497
+ workspaceId: w(),
1498
+ actorId: R ?? null
1499
+ }, b = M();
1500
+ H(v, {
1501
+ id: b,
1501
1502
  role: "assistant",
1502
1503
  content: "",
1503
1504
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1504
1505
  metadata: {
1505
- lang: Ki,
1506
- ...b(n.voiceSessionId)
1506
+ lang: qi,
1507
+ ...x(n.voiceSessionId)
1507
1508
  }
1508
- }), un(y, {
1509
+ }), dn(b, {
1509
1510
  channel: r ? "voice" : "chat",
1510
- mode: h,
1511
- product: N,
1512
- language: Ki,
1513
- device: fn(),
1514
- routedByAuto: !!m
1515
- }, n.voiceTiming), w(y, "accepted"), na(_, "provisioning", y, null), ae(y), n.avatarTabAsk !== void 0 && Ro(n.avatarTabAsk, {
1516
- conversationId: _,
1517
- questionId: we.id,
1518
- replyId: y
1511
+ mode: g,
1512
+ product: P,
1513
+ language: qi,
1514
+ device: pn(),
1515
+ routedByAuto: !!h
1516
+ }, n.voiceTiming), T(b, "accepted"), ra(v, "provisioning", b, null), ce(b), n.avatarTabAsk !== void 0 && zo(n.avatarTabAsk, {
1517
+ conversationId: v,
1518
+ questionId: Ee.id,
1519
+ replyId: b
1519
1520
  });
1520
- let ke = () => {
1521
- let e = Mt({
1522
- turnId: y,
1523
- abortRequested: To.current.has(y),
1524
- activeTurnId: g.getState().processingByConversationId[_]?.messageId ?? null,
1525
- conversationExists: he()
1521
+ let Ae = () => {
1522
+ let e = Nt({
1523
+ turnId: b,
1524
+ abortRequested: Eo.current.has(b),
1525
+ activeTurnId: _.getState().processingByConversationId[v]?.messageId ?? null,
1526
+ conversationExists: _e()
1526
1527
  });
1527
- return e.abandon && Ue(), e;
1528
- }, Be = (e, t, r, i, a = !1, o = Ki) => {
1529
- ea(_, y, { content: Ee(e) }), ta(_, y, {
1528
+ return e.abandon && We(), e;
1529
+ }, Ve = (e, t, r, i, a = !1, o = qi) => {
1530
+ ta(v, b, { content: s(e) }), na(v, b, {
1530
1531
  lang: o,
1531
1532
  ...t?.length ? { artifacts: t } : {},
1532
- ...t?.length || r || i ? { mode: h } : {},
1533
+ ...t?.length || r || i ? { mode: g } : {},
1533
1534
  ...r ? { sessionId: r } : {},
1534
1535
  ...i ? { sandboxId: i } : {},
1535
1536
  ...a ? { incomplete: !0 } : {},
1536
- ...b(n.voiceSessionId)
1537
+ ...x(n.voiceSessionId)
1537
1538
  });
1538
- }, Ve = { session: null }, x = {
1539
+ }, He = { session: null }, S = {
1539
1540
  stream: null,
1540
1541
  render: null
1541
- }, Ue = () => {
1542
- x.render?.end();
1543
1542
  }, We = () => {
1544
- Ue(), x.stream?.close(), x.stream = null, x.render = null;
1545
- }, Ge = !1, Ke = () => {
1546
- Ge && (Ge = !1, He.abort(y));
1547
- }, qe = async (i = 1) => {
1548
- w(y, "attemptStarted");
1549
- let a = null, o = null, s = !1;
1543
+ S.render?.end();
1544
+ }, Ge = () => {
1545
+ We(), S.stream?.close(), S.stream = null, S.render = null;
1546
+ }, Ke = !1, Je = () => {
1547
+ Ke && (Ke = !1, Ue.abort(b));
1548
+ }, Ye = new c(), Xe = () => {}, Qe = async (i = 1) => {
1549
+ T(b, "attemptStarted");
1550
+ let a = null, o = null, c = !1;
1550
1551
  try {
1551
- let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: d, sandboxProbed: f, sandboxAdopted: ee, deadSandboxProbe: te, sessionPreopened: p } = await yo(_, y, h, v, xe, { isAbandoned: () => Mt({
1552
- turnId: y,
1553
- abortRequested: To.current.has(y),
1554
- activeTurnId: g.getState().processingByConversationId[_]?.messageId ?? null,
1555
- conversationExists: he()
1552
+ let { sandboxId: i, sessionId: u, sessionIsNew: d, readAhead: f, sandboxIsNew: ee, sandboxProbed: te, sandboxAdopted: p, deadSandboxProbe: ne, sessionPreopened: re } = await bo(v, b, g, y, Ce, { isAbandoned: () => Nt({
1553
+ turnId: b,
1554
+ abortRequested: Eo.current.has(b),
1555
+ activeTurnId: _.getState().processingByConversationId[v]?.messageId ?? null,
1556
+ conversationExists: _e()
1556
1557
  }).abandon });
1557
- if (a = i, w(y, "runtimeReady"), dn(y, {
1558
- runtime: d ? "cold" : ee ? "adopted" : f ? "probed" : p ? "preopened" : l ? "new-session" : "warm",
1559
- deadSandboxProbe: te
1560
- }), dn(y, { session: p ? "preopened" : l ? "created" : "reused" }), o = c, Ve.session = {
1558
+ if (a = i, Xe(), Xe = l(i, () => {
1559
+ Eo.current.add(b), qe(b), Ue.abort(b);
1560
+ }), T(b, "runtimeReady"), fn(b, {
1561
+ runtime: ee ? "cold" : p ? "adopted" : te ? "probed" : re ? "preopened" : d ? "new-session" : "warm",
1562
+ deadSandboxProbe: ne
1563
+ }), fn(b, { session: re ? "preopened" : d ? "created" : "reused" }), o = u, He.session = {
1561
1564
  sandboxId: i,
1562
- sessionId: c
1563
- }, le(h, se, g.getState().acknowledgedWriteModes, {
1565
+ sessionId: u
1566
+ }, de(g, le, _.getState().acknowledgedWriteModes, {
1564
1567
  dictated: r,
1565
- confirmsWrites: ye(h),
1566
- proposalBound: Pi(h, i)
1567
- }) === "voice-in-write-mode") throw new Ae("voice-in-write-mode", "Voice in a write mode");
1568
- let re = nr({
1569
- conversation: g.getState().conversations.find((e) => e.id === _),
1568
+ confirmsWrites: xe(g),
1569
+ proposalBound: Fi(g, i)
1570
+ }) === "voice-in-write-mode") throw new je("voice-in-write-mode", "Voice in a write mode");
1571
+ let ie = rr({
1572
+ conversation: _.getState().conversations.find((e) => e.id === v),
1570
1573
  content: e,
1571
- sessionIsNew: l,
1572
- sendingMode: h,
1573
- sendingModeConfig: se,
1574
- modes: Ia.current,
1575
- answerText: (e) => on(e).text
1574
+ sessionIsNew: d,
1575
+ sendingMode: g,
1576
+ sendingModeConfig: le,
1577
+ modes: La.current,
1578
+ answerText: (e) => sn(e).text
1576
1579
  });
1577
- if (We(), yr()) {
1578
- let e = vr({
1579
- mint: () => ve(i, v, c, h, xe),
1580
- mark: (e) => w(y, e)
1580
+ if (Ge(), br()) {
1581
+ let e = yr({
1582
+ mint: () => be(i, y, u, g, Ce),
1583
+ mark: (e) => T(b, e)
1581
1584
  });
1582
- x.stream = e, x.render = ar({
1585
+ S.stream = e, S.render = or({
1583
1586
  stream: e,
1584
- conversationId: _,
1585
- messageId: y,
1586
- build: (e, t) => Ee(en(e, t, { accumulateNarration: ue.accumulatesNarration }).content),
1587
- onFirstDelta: () => w(y, "firstDelta"),
1588
- onFirstVisible: () => w(y, "firstOutput")
1587
+ conversationId: v,
1588
+ messageId: b,
1589
+ build: (e, t) => s(tn(e, t, { accumulateNarration: fe.accumulatesNarration }).content),
1590
+ onFirstDelta: () => T(b, "firstDelta"),
1591
+ onFirstVisible: () => T(b, "firstOutput")
1589
1592
  });
1590
1593
  }
1591
- let ie = await nn(() => _e(i, v, c, h, xe, { limit: 50 }), l, tn(u, i, c));
1592
- _o(_, y, "streaming", "thinking");
1593
- let ae = ki?.(), oe = Mn(g.getState().sandboxWriteCapabilities[i]), m = J.current, ce = ni(i, c), de = m.options.uiCatalogue ? $r(zr(m.navItems), {
1594
+ let oe = await rn(() => ye(i, y, u, g, Ce, { limit: 50 }), d, nn(f, i, u));
1595
+ vo(v, b, "streaming", "thinking");
1596
+ let se = Ai?.(), ce = Nn(_.getState().sandboxWriteCapabilities[i]), m = Y.current, h = ri(i, u), ue = m.options.uiCatalogue ? ei(Br(m.navItems), {
1594
1597
  permissionsSettled: m.navPermissionsSettled,
1595
1598
  simulating: m.navSimulating,
1596
- sentBefore: ti(ce)
1597
- }) : null, fe = {
1598
- conversationId: _,
1599
- writeReply: oe === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null,
1600
- ...de ? { uiCatalogue: de } : {}
1601
- }, { prompt: pe, parts: je } = Ct({
1602
- content: re ? `${re}${ne}` : ne,
1599
+ sentBefore: ni(h)
1600
+ }) : null, pe = {
1601
+ conversationId: v,
1602
+ writeReply: ce === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null,
1603
+ ...ue ? { uiCatalogue: ue } : {}
1604
+ }, { prompt: me, parts: he } = wt({
1605
+ content: ie ? `${ie}${ae}` : ae,
1603
1606
  attachments: t,
1604
- limits: dt(se),
1605
- wrapPrompt: (e) => Ai?.(h, e, Wi, Gi, r, { writeApproval: oe }) ?? e,
1606
- requestBytes: (e, t) => be({
1607
+ limits: ft(le),
1608
+ wrapPrompt: (e) => ji?.(g, e, Gi, Ki, r, { writeApproval: ce }) ?? e,
1609
+ requestBytes: (e, t) => Se({
1607
1610
  sandboxId: i,
1608
- workspaceId: v,
1609
- sessionId: c,
1610
- mode: h,
1611
+ workspaceId: y,
1612
+ sessionId: u,
1613
+ mode: g,
1611
1614
  prompt: e,
1612
1615
  parts: t,
1613
- pageContext: ae,
1614
- authContext: xe,
1615
- ...fe
1616
+ pageContext: se,
1617
+ authContext: Ce,
1618
+ ...pe
1616
1619
  })
1617
- }), Me = lt(je), Ne = Me > 0;
1618
- s = ct(t) > Me;
1619
- let Fe = ke();
1620
- if (Fe.abandon) {
1621
- Fe.clearProcessing && ra(_);
1620
+ }), Me = ut(he), Ne = Me > 0;
1621
+ c = lt(t) > Me;
1622
+ let Pe = Ae();
1623
+ if (Pe.abandon) {
1624
+ Pe.clearProcessing && ia(v);
1622
1625
  return;
1623
1626
  }
1627
+ let Ie = (e) => Ye.dispatch({
1628
+ prompt: me,
1629
+ isAbandoned: () => Ae().abandon,
1630
+ readMessages: (e) => ye(i, y, u, g, Ce, { sinceMs: e }),
1631
+ send: () => we(i, y, u, me, g, se, Ce, e?.length ? {
1632
+ parts: e,
1633
+ ...pe
1634
+ } : pe)
1635
+ });
1624
1636
  try {
1625
- await Se(i, v, c, pe, h, ae, xe, je?.length ? {
1626
- parts: je,
1627
- ...fe
1628
- } : fe);
1637
+ await Ie(he);
1629
1638
  } catch (e) {
1630
- if (!je || !yn(e)) throw e;
1631
- await Se(i, v, c, pe, h, ae, xe, fe), s ||= Ne;
1639
+ if (!Ye.canFailover() || !he || !bn(e)) throw e;
1640
+ await Ie(void 0), c ||= Ne;
1632
1641
  }
1633
- de && ei(ce);
1634
- let Le = g.getState().sandboxWriteCapabilities[i], Re = m.options.uiOffers === !0 && Oe(Le) ? L : null, b = !!Re;
1635
- Re && X.recordTurn({
1636
- replyId: y,
1637
- conversationId: _,
1642
+ ue && ti(h);
1643
+ let Re = _.getState().sandboxWriteCapabilities[i], ze = m.options.uiOffers === !0 && ke(Re) ? R : null, x = !!ze;
1644
+ ze && Z.recordTurn({
1645
+ replyId: b,
1646
+ conversationId: v,
1638
1647
  sandboxId: i,
1639
- sessionId: c,
1640
- mode: h,
1641
- writeCapable: se?.writeCapable === !0,
1642
- actorId: Re,
1643
- floorMs: ie
1648
+ sessionId: u,
1649
+ mode: g,
1650
+ writeCapable: le?.writeCapable === !0,
1651
+ actorId: ze,
1652
+ floorMs: oe
1644
1653
  });
1645
- let Ke = b ? (e, t) => {
1646
- X.receive(y, e, t, performance.now()) && rs();
1647
- } : void 0, qe = (e) => ea(_, y, { content: e }), Je = (e) => s ? `${e}\n\n${M("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;
1648
- w(y, "promptSent");
1649
- let Ye = null, Ze = !1, Qe = $t, S = en([], ie);
1650
- x.render?.arm(ie);
1651
- let $e = Date.now() + ue.streamBudgetMs, et = Date.now(), tt = Date.now(), nt = br(() => _e(i, v, c, h, xe, {
1654
+ let Je = x ? (e, t) => {
1655
+ Z.receive(b, e, t, performance.now()) && is();
1656
+ } : void 0, Qe = (e) => ta(v, b, { content: e }), $e = (e) => c ? `${e}\n\n${N("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;
1657
+ T(b, "promptSent");
1658
+ let et = null, tt = !1, nt = en, C = tn([], oe);
1659
+ S.render?.arm(oe);
1660
+ let rt = Date.now() + fe.streamBudgetMs, it = Date.now(), at = Date.now(), ot = xr(() => ye(i, y, u, g, Ce, {
1652
1661
  limit: 50,
1653
- sinceMs: ie,
1662
+ sinceMs: oe,
1654
1663
  surfaceTurnTerminal: !0,
1655
- surfaceUiOffers: Ke
1656
- })), rt = x.stream?.onIdle(() => nt.startExtra());
1657
- for (; Date.now() < $e;) {
1658
- Ce(i, c);
1659
- let e = ke();
1664
+ surfaceUiOffers: Je
1665
+ })), st = S.stream?.onIdle(() => ot.startExtra());
1666
+ for (; Date.now() < rt;) {
1667
+ Te(i, u);
1668
+ let e = Ae();
1660
1669
  if (e.abandon) {
1661
- e.clearProcessing && ra(_);
1670
+ e.clearProcessing && ia(v);
1662
1671
  return;
1663
1672
  }
1664
- let t = await nt.next();
1665
- if (b && X.observeMessages(y, t) && rs(), S = en(t, ie, { accumulateNarration: ue.accumulatesNarration }), ea(_, y, { content: Ee(S.content) }), S.hasRenderableOutput ? Ze || (Ze = !0, Ye !== null && w(y, "lastQuietPoll", Ye), w(y, "firstOutput")) : Ye = mn(), ue.accumulatesNarration) S.hasText && w(y, "firstText");
1673
+ let t = await ot.next();
1674
+ if (x && Z.observeMessages(b, t) && is(), C = tn(t, oe, { accumulateNarration: fe.accumulatesNarration }), ta(v, b, { content: s(C.content) }), C.hasRenderableOutput ? tt || (tt = !0, et !== null && T(b, "lastQuietPoll", et), T(b, "firstOutput")) : et = hn(), fe.accumulatesNarration) C.hasText && T(b, "firstText");
1666
1675
  else {
1667
- let e = an(Qe, S, mn());
1668
- Qe = e.tracker, e.confirmedAt !== null && w(y, "firstText", e.confirmedAt);
1676
+ let e = on(nt, C, hn());
1677
+ nt = e.tracker, e.confirmedAt !== null && T(b, "firstText", e.confirmedAt);
1669
1678
  }
1670
- if (S.pendingWrite && !An(g.getState().sandboxWriteCapabilities[i]) && ta(_, y, { pendingWrite: S.pendingWrite }), S.done && (x.stream ? dn(y, {
1671
- transport: x.stream.reachedOpen ? "sse" : "poll",
1672
- live: ir(x.stream.live)
1673
- }) : dn(y, {
1679
+ if (C.pendingWrite && !jn(_.getState().sandboxWriteCapabilities[i]) && na(v, b, { pendingWrite: C.pendingWrite }), C.done && (S.stream ? fn(b, {
1680
+ transport: S.stream.reachedOpen ? "sse" : "poll",
1681
+ live: ar(S.stream.live)
1682
+ }) : fn(b, {
1674
1683
  transport: "poll",
1675
1684
  live: "none"
1676
- }), Ue()), S.done) {
1677
- w(y, "answerDone"), K.current.markVerified(i);
1685
+ }), We()), C.done) {
1686
+ T(b, "answerDone"), q.current.markVerified(i);
1678
1687
  break;
1679
1688
  }
1680
- if (x.render?.refresh(t), Date.now() - et > 3e4 && (await me(i, v, 600, xe).catch(() => void 0), et = Date.now()), !nt.hasPending()) {
1681
- let e = Xe(Date.now() - tt);
1682
- x.stream ? await x.stream.waitWake(e) : await new Promise((t) => setTimeout(t, e));
1689
+ if (S.render?.refresh(t), Date.now() - it > 3e4 && (await ge(i, y, 600, Ce).catch(() => void 0), it = Date.now()), !ot.hasPending()) {
1690
+ let e = Ze(Date.now() - at);
1691
+ S.stream ? await S.stream.waitWake(e) : await new Promise((t) => setTimeout(t, e));
1683
1692
  }
1684
1693
  }
1685
- if (rt?.(), We(), S.done && n.voiceSessionId !== void 0 && !ke().abandon) {
1686
- let e = Ee(Je(S.content));
1687
- e.trim() && (s && qe(e), w(y, "speechQueued"), Ge = !0, He.publish(y, {
1688
- conversationId: _,
1694
+ if (st?.(), Ge(), C.done && n.voiceSessionId !== void 0 && !Ae().abandon) {
1695
+ let e = s($e(C.content));
1696
+ e.trim() && (c && Qe(e), T(b, "speechQueued"), Ke = !0, Ue.publish(b, {
1697
+ conversationId: v,
1689
1698
  channel: "voice",
1690
1699
  voiceSessionId: n.voiceSessionId,
1691
1700
  text: e,
1692
- lang: Ki,
1701
+ lang: qi,
1693
1702
  final: !0
1694
1703
  }));
1695
1704
  }
1696
- let it = ue.producesArtifacts ? await ge(i, v, c, h, xe).then((e) => e).catch(() => []) : void 0;
1697
- S.usedTools !== void 0 && dn(y, { usedTools: S.usedTools }), S.done || (dn(y, { outcome: "timedOut" }), S = {
1698
- ...S,
1699
- content: ze(S.content, h, M, se)
1700
- }), s && (S = {
1701
- ...S,
1702
- content: Je(S.content)
1705
+ let ct = fe.producesArtifacts ? await ve(i, y, u, g, Ce).then((e) => e).catch(() => []) : void 0;
1706
+ C.usedTools !== void 0 && fn(b, { usedTools: C.usedTools }), C.done || (fn(b, { outcome: "timedOut" }), C = {
1707
+ ...C,
1708
+ content: Be(C.content, g, N, le)
1709
+ }), c && (C = {
1710
+ ...C,
1711
+ content: $e(C.content)
1703
1712
  });
1704
- let at = !S.done;
1705
- Be(S.content, it, c, i, at), S.tokens && (ea(_, y, { tokens: S.tokens }), (Mi ? await Ie({
1706
- workspaceId: v,
1707
- sessionId: c,
1708
- messageId: S.messageId,
1709
- model: S.model,
1710
- tokens: S.tokens
1711
- }, Mi, { ledger: Pe("panel", N) }) : { ok: !0 }).ok && li(N)), S.done || Ce(i, c);
1712
- let ot = ke();
1713
- if (ot.abandon) {
1714
- ot.clearProcessing && ra(_);
1713
+ let dt = !C.done;
1714
+ Ve(C.content, ct, u, i, dt), C.tokens && (ta(v, b, { tokens: C.tokens }), (Ni ? await Le({
1715
+ workspaceId: y,
1716
+ sessionId: u,
1717
+ messageId: C.messageId,
1718
+ model: C.model,
1719
+ tokens: C.tokens
1720
+ }, Ni, { ledger: Fe("panel", P) }) : { ok: !0 }).ok && ui(P)), C.done || Te(i, u);
1721
+ let pt = Ae();
1722
+ if (pt.abandon) {
1723
+ pt.clearProcessing && ia(v);
1715
1724
  return;
1716
1725
  }
1717
- w(y, "complete"), dn(y, { outcome: "answered" }), na(_, "complete", y, null), qn.recordCommittedEntries(_, [we.id, y], "TURN", v), Ge = !1, b && Te && S.done && ps({
1718
- replyId: y,
1719
- conversationId: _,
1726
+ T(b, "complete"), fn(b, { outcome: "answered" }), ra(v, "complete", b, null), Jn.recordCommittedEntries(v, [Ee.id, b], "TURN", y), Ke = !1, x && De && C.done && ms({
1727
+ replyId: b,
1728
+ conversationId: v,
1720
1729
  voiceSessionId: n.voiceSessionId,
1721
- intent: Te,
1722
- atSend: De
1730
+ intent: De,
1731
+ atSend: Oe
1723
1732
  });
1724
1733
  } catch (e) {
1725
- K.current.invalidate(a ?? g.getState().sandboxesByMode[h]?.sandboxId ?? null);
1726
- let t = Mt({
1727
- turnId: y,
1728
- abortRequested: To.current.has(y),
1729
- activeTurnId: g.getState().processingByConversationId[_]?.messageId ?? null,
1730
- conversationExists: he()
1734
+ q.current.invalidate(a ?? _.getState().sandboxesByMode[g]?.sandboxId ?? null);
1735
+ let t = Nt({
1736
+ turnId: b,
1737
+ abortRequested: Eo.current.has(b),
1738
+ activeTurnId: _.getState().processingByConversationId[v]?.messageId ?? null,
1739
+ conversationExists: _e()
1731
1740
  });
1732
- if (Ue(), a && o && Ce(a, o), t.abandon) {
1733
- t.clearProcessing && ra(_);
1741
+ if (We(), a && o && Te(a, o), t.abandon) {
1742
+ t.clearProcessing && ia(v);
1734
1743
  return;
1735
1744
  }
1736
- if (i === 1 && bn(e)) {
1737
- let e = a ?? g.getState().sandboxesByMode[h]?.sandboxId ?? null;
1738
- return e && (q.current.add(e), K.current.invalidate(e)), aa(_), sa(h), $i(_, y, ""), ta(_, y, { pendingWrite: void 0 }), e && U.retireSandbox(e), We(), Ke(), pn(y), qe(2);
1745
+ if (i === 1 && Ye.canFailover() && xn(e)) {
1746
+ Xe();
1747
+ let e = a ?? _.getState().sandboxesByMode[g]?.sandboxId ?? null;
1748
+ return e && (J.current.add(e), q.current.invalidate(e)), oa(v), ca(g), ea(v, b, ""), na(v, b, { pendingWrite: void 0 }), e && W.retireSandbox(e), Ge(), Je(), mn(b), Qe(2);
1739
1749
  }
1740
1750
  throw e;
1741
1751
  }
1742
- }, Je = _;
1743
- fo.current.add(Je);
1752
+ }, $e = v;
1753
+ po.current.add($e);
1744
1754
  try {
1745
- if (!v) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
1755
+ if (!y) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
1746
1756
  code: "UNAUTHENTICATED",
1747
1757
  authFailure: "WORKSPACE_CONTEXT_MISSING"
1748
1758
  } });
1749
- let e = await St(h, () => Ia.current.find((e) => e.id === h), Fa);
1750
- se = e.config, ue = e.capabilities;
1751
- let t = se, n = ke();
1759
+ let e = await Ct(g, () => La.current.find((e) => e.id === g), Ia);
1760
+ le = e.config, fe = e.capabilities;
1761
+ let t = le, n = Ae();
1752
1762
  if (n.abandon) {
1753
- n.clearProcessing && ra(_);
1763
+ n.clearProcessing && ia(v);
1754
1764
  return;
1755
1765
  }
1756
- let i = le(h, t, g.getState().acknowledgedWriteModes, {
1766
+ let i = de(g, t, _.getState().acknowledgedWriteModes, {
1757
1767
  dictated: r,
1758
- confirmsWrites: ye(h),
1759
- proposalBound: Pi(h)
1768
+ confirmsWrites: xe(g),
1769
+ proposalBound: Fi(g)
1760
1770
  });
1761
- if (i) throw new Ae(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1762
- let a = Pe("panel", N);
1763
- if (Mi && Fe(a, v)) {
1764
- let e = await Le(a, v, Mi);
1765
- if (!e.ok) throw Re(e.kind);
1766
- let t = ke();
1771
+ if (i) throw new je(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
1772
+ let a = Fe("panel", P);
1773
+ if (Ni && Ie(a, y)) {
1774
+ let e = await Re(a, y, Ni);
1775
+ if (!e.ok) throw ze(e.kind);
1776
+ let t = Ae();
1767
1777
  if (t.abandon) {
1768
- t.clearProcessing && ra(_);
1778
+ t.clearProcessing && ia(v);
1769
1779
  return;
1770
1780
  }
1771
1781
  }
1772
- w(y, "cleared"), await qe();
1782
+ T(b, "cleared"), await Qe();
1773
1783
  } catch (e) {
1774
- if (K.current.invalidate(g.getState().sandboxesByMode[h]?.sandboxId ?? null), !he()) {
1775
- ra(_);
1784
+ if (q.current.invalidate(_.getState().sandboxesByMode[g]?.sandboxId ?? null), !_e()) {
1785
+ ia(v);
1776
1786
  return;
1777
1787
  }
1778
- let t = Ve.session?.sandboxId ?? null, r = je(e, { confirmsNoAction: Me({
1779
- mode: h,
1780
- capabilities: t ? g.getState().sandboxWriteCapabilities[t] : null
1788
+ let t = He.session?.sandboxId ?? null, r = Me(e, { confirmsNoAction: Ne({
1789
+ mode: g,
1790
+ capabilities: t ? _.getState().sandboxWriteCapabilities[t] : null
1781
1791
  }) });
1782
- dn(y, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && ci(N, "sandbox");
1783
- let i = Ne(r, M, { locale: R });
1784
- na(_, "error", y, i.headline), ea(_, y, { content: i.text }), ta(_, y, {
1785
- lang: i.translated ? R : "en",
1786
- ...b(n.voiceSessionId)
1792
+ fn(b, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && li(P, "sandbox");
1793
+ let i = Pe(r, N, { locale: z });
1794
+ ra(v, "error", b, i.headline), ta(v, b, { content: i.text }), na(v, b, {
1795
+ lang: i.translated ? z : "en",
1796
+ ...x(n.voiceSessionId)
1787
1797
  });
1788
1798
  } finally {
1789
- fo.current.delete(Je), dn(y, { outcome: "stopped" }), w(y, "complete"), Ke(), We();
1790
- let e = g.getState(), t = d(pe, h, e.conversations.find((e) => e.id === Je), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1791
- t && (fa(Je, t.mode), t.backendSessionId && ia(Je, t.backendSessionId)), Ve.session && he() && U.afterTurn({
1792
- ...Ve.session,
1793
- conversationId: Je
1794
- }, y);
1795
- let n = Eo.current;
1796
- Eo.current = null, n && n.conversationId === Je && he() && Ns.current(n.content, n.attachments, n.options);
1799
+ Xe(), po.current.delete($e), fn(b, { outcome: "stopped" }), T(b, "complete"), Je(), Ge();
1800
+ let e = _.getState(), t = te(he, g, e.conversations.find((e) => e.id === $e), (t) => !!e.sandboxesByMode[t]?.sandboxId);
1801
+ t && (pa($e, t.mode), t.backendSessionId && aa($e, t.backendSessionId)), He.session && _e() && W.afterTurn({
1802
+ ...He.session,
1803
+ conversationId: $e
1804
+ }, b);
1805
+ let n = Do.current;
1806
+ Do.current = null, n && n.conversationId === $e && _e() && Ps.current(n.content, n.attachments, n.options);
1797
1807
  }
1798
1808
  }, [
1809
+ B,
1810
+ H,
1811
+ ji,
1812
+ oa,
1813
+ ca,
1814
+ Ji,
1815
+ $i,
1816
+ bo,
1817
+ W,
1818
+ ko,
1819
+ bs,
1820
+ As,
1799
1821
  z,
1800
- V,
1822
+ Wi,
1823
+ Fi,
1801
1824
  Ai,
1802
- aa,
1803
- sa,
1825
+ L,
1826
+ Ii,
1827
+ ta,
1828
+ P,
1829
+ Ia,
1830
+ Ni,
1831
+ Ki,
1832
+ z,
1804
1833
  qi,
1805
- Qi,
1806
- yo,
1807
- U,
1808
- Oo,
1809
- ys,
1810
- ks,
1811
- R,
1812
- Ui,
1813
- Pi,
1814
- ki,
1815
- I,
1816
- Fi,
1817
- ea,
1818
- N,
1819
- Fa,
1820
- Mi,
1821
1834
  Gi,
1822
- R,
1823
- Ki,
1824
- Wi,
1825
- fa,
1826
- Os,
1827
- hs,
1828
- co,
1835
+ pa,
1836
+ ks,
1837
+ gs,
1829
1838
  lo,
1830
- ia,
1831
- Xi,
1832
- na,
1839
+ uo,
1840
+ aa,
1841
+ Zi,
1833
1842
  ra,
1834
- M,
1835
- _o,
1836
- $i,
1837
- L,
1838
- X,
1839
- rs,
1840
- vs,
1841
- ps,
1842
- Ro,
1843
- Lo
1844
- ]), As = T((e, t) => {
1845
- Z(e, [], t ? { autoIntent: t } : {});
1846
- }, [Z]), js = At(), Ms = T(() => {
1847
- let e = [...pa.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1843
+ ia,
1844
+ N,
1845
+ vo,
1846
+ ea,
1847
+ R,
1848
+ Z,
1849
+ is,
1850
+ ys,
1851
+ ms,
1852
+ zo,
1853
+ Ro
1854
+ ]), js = E((e, t) => {
1855
+ Q(e, [], t ? { autoIntent: t } : {});
1856
+ }, [Q]), Ms = jt(), Ns = E(() => {
1857
+ let e = [...ma.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
1848
1858
  if (!e || e.metadata?.approvalFollowUp) return;
1849
- let t = z ? uo.current[z] ?? [] : [];
1850
- if (t.some((e) => Tt(e, Date.now()))) {
1851
- let n = z ?? void 0;
1852
- Et(t, js).then((t) => {
1853
- Z(e.content, t, n === void 0 ? void 0 : { targetConversationId: n });
1859
+ let t = B ? fo.current[B] ?? [] : [];
1860
+ if (t.some((e) => Et(e, Date.now()))) {
1861
+ let n = B ?? void 0;
1862
+ Dt(t, Ms).then((t) => {
1863
+ Q(e.content, t, n === void 0 ? void 0 : { targetConversationId: n });
1854
1864
  });
1855
1865
  return;
1856
1866
  }
1857
- Z(e.content, t);
1867
+ Q(e.content, t);
1858
1868
  }, [
1859
- ma,
1860
- Z,
1861
- z,
1862
- js
1863
- ]), Ns = O(Z);
1864
- E(() => {
1865
- Ns.current = Z;
1866
- }, [Z]);
1867
- let Ps = D(() => {
1868
- if (ga) return null;
1869
- for (let e = ma.length - 1; e >= 0; --e) {
1870
- let t = ma[e];
1869
+ ha,
1870
+ Q,
1871
+ B,
1872
+ Ms
1873
+ ]), Ps = k(Q);
1874
+ D(() => {
1875
+ Ps.current = Q;
1876
+ }, [Q]);
1877
+ let Fs = O(() => {
1878
+ if (_a) return null;
1879
+ for (let e = ha.length - 1; e >= 0; --e) {
1880
+ let t = ha[e];
1871
1881
  if (t?.role !== "assistant") continue;
1872
- if (t.id === Go) return null;
1873
- if (!Ve(t) || To.current.has(t.id) || Ge(t.id)) continue;
1874
- let n = Qt(t, ha, M);
1882
+ if (t.id === Ko) return null;
1883
+ if (!He(t) || Eo.current.has(t.id) || Ke(t.id)) continue;
1884
+ let n = $t(t, ga, N);
1875
1885
  if (n.kind !== "output") return null;
1876
- let r = on(n.text).text.trim();
1877
- return r ? We(t, r, ha) : null;
1886
+ let r = sn(n.text).text.trim();
1887
+ return r ? Ge(t, r, ga) : null;
1878
1888
  }
1879
1889
  return null;
1880
1890
  }, [
1881
- ma,
1882
- ga,
1883
1891
  ha,
1884
- Go,
1885
- M
1886
- ]), Fs = D(() => Ps ? Ze(Ps.text) : null, [Ps]), Is = D(() => pa.chat.filter((e) => e.id !== Go), [pa.chat, Go]), Ls = g((e) => ue(e)?.sandboxId ?? null), Rs = m(Is, {
1887
- sessionId: H?.backendSessionId,
1888
- sandboxId: Ls,
1892
+ _a,
1893
+ ga,
1894
+ Ko,
1895
+ N
1896
+ ]), Is = O(() => Fs ? Qe(Fs.text) : null, [Fs]), Ls = O(() => ma.chat.filter((e) => e.id !== Ko), [ma.chat, Ko]), Rs = _((e) => fe(e)?.sandboxId ?? null), zs = h(Ls, {
1897
+ sessionId: U?.backendSessionId,
1898
+ sandboxId: Rs,
1889
1899
  nowMs: Date.now()
1890
- }), zs = h(Is), Bs = (e) => {
1891
- if (kn(e.metadata).length > 0) return !0;
1900
+ }), Bs = g(Ls), Vs = (e) => {
1901
+ if (An(e.metadata).length > 0) return !0;
1892
1902
  let t = e.metadata?.sandboxId;
1893
- return An(t ? ya[t] : null);
1894
- }, Vs = (e) => {
1895
- let t = kn(e.metadata);
1896
- return t.length === 0 || !z ? null : /* @__PURE__ */ A(On, {
1903
+ return jn(t ? ba[t] : null);
1904
+ }, Hs = (e) => {
1905
+ let t = An(e.metadata);
1906
+ return t.length === 0 || !B ? null : /* @__PURE__ */ j(kn, {
1897
1907
  refs: t,
1898
- conversationId: z,
1899
- panel: U,
1900
- entries: ba,
1901
- capabilitiesOf: (e) => ya[e],
1902
- turnInFlight: ga,
1903
- tr: M,
1904
- onReview: Sa.review,
1905
- retiredSandboxes: xa
1908
+ conversationId: B,
1909
+ panel: W,
1910
+ entries: xa,
1911
+ capabilitiesOf: (e) => ba[e],
1912
+ turnInFlight: _a,
1913
+ tr: N,
1914
+ onReview: Ca.review,
1915
+ retiredSandboxes: Sa
1906
1916
  });
1907
- }, Hs = (e) => {
1908
- if (!z) return null;
1909
- let t = X.liveOffersFor(e, {
1917
+ }, Us = (e) => {
1918
+ if (!B) return null;
1919
+ let t = Z.liveOffersFor(e, {
1910
1920
  registry: {
1911
- destinations: zr(Bo),
1912
- permissionsSettled: Vo,
1913
- simulating: Ho
1921
+ destinations: Br(Vo),
1922
+ permissionsSettled: Ho,
1923
+ simulating: Uo
1914
1924
  },
1915
- actorId: L,
1916
- conversationId: z,
1925
+ actorId: R,
1926
+ conversationId: B,
1917
1927
  perfNow: performance.now()
1918
1928
  }), n = t[0];
1919
- return n ? /* @__PURE__ */ A(sr, {
1929
+ return n ? /* @__PURE__ */ j(cr, {
1920
1930
  offers: t.map(({ offer: e, target: t }) => ({
1921
1931
  offerId: e.offerId,
1922
1932
  label: t.label,
1923
1933
  path: t.path
1924
1934
  })),
1925
- hint: t.length === 1 && F === "proposal-v1" ? y(n.offer, X.turnFor(e)) : "link",
1926
- onOpen: fs
1935
+ hint: t.length === 1 && I === "proposal-v1" ? b(n.offer, Z.turnFor(e)) : "link",
1936
+ onOpen: ps
1927
1937
  }, n.offer.offerId) : null;
1928
- }, Us = (e) => e.role === "assistant" ? Hs(e.id) : null;
1929
- E(() => {
1930
- let e = X.nextExpiryInMs(performance.now());
1938
+ }, Ws = (e) => e.role === "assistant" ? Us(e.id) : null;
1939
+ D(() => {
1940
+ let e = Z.nextExpiryInMs(performance.now());
1931
1941
  if (e === null) return;
1932
- let t = window.setTimeout(rs, e + 1);
1942
+ let t = window.setTimeout(is, e + 1);
1933
1943
  return () => window.clearTimeout(t);
1934
1944
  }, [
1935
- X,
1936
- ts,
1937
- rs
1945
+ Z,
1946
+ ns,
1947
+ is
1938
1948
  ]);
1939
- let Ws = Sa.dialog.view ? ba[Sa.dialog.view.proposalId] : void 0, Gs = Rs?.expiresAtMs ?? null;
1940
- E(() => {
1941
- if (Gs === null) return;
1942
- let e = window.setTimeout(() => wo((e) => e + 1), Math.max(0, Gs - Date.now()));
1949
+ let Gs = Ca.dialog.view ? xa[Ca.dialog.view.proposalId] : void 0, Ks = zs?.expiresAtMs ?? null;
1950
+ D(() => {
1951
+ if (Ks === null) return;
1952
+ let e = window.setTimeout(() => To((e) => e + 1), Math.max(0, Ks - Date.now()));
1943
1953
  return () => window.clearTimeout(e);
1944
- }, [Gs, Co]);
1945
- let Q = D(() => pa.voice.filter((e) => e.id !== Go && (e.role === "user" || e.role === "assistant")).map((e) => ({
1954
+ }, [Ks, wo]);
1955
+ let qs = O(() => ma.voice.filter((e) => e.id !== Ko && (e.role === "user" || e.role === "assistant")).map((e) => ({
1946
1956
  id: e.id,
1947
1957
  role: e.role,
1948
- text: ln(e, ha, M),
1949
- sessionId: x(e),
1958
+ text: un(e, ga, N),
1959
+ sessionId: S(e),
1950
1960
  timestamp: e.timestamp
1951
1961
  })).filter((e) => e.text.length > 0), [
1952
- pa.voice,
1953
- ha,
1954
- Go,
1955
- M
1956
- ]), Ks = T(() => {
1957
- if (Q.length === 0) return;
1962
+ ma.voice,
1963
+ ga,
1964
+ Ko,
1965
+ N
1966
+ ]), Js = E(() => {
1967
+ if (qs.length === 0) return;
1958
1968
  let e = /* @__PURE__ */ new Date();
1959
- Vn(Je(Q, {
1960
- title: M("voiceSession.transcript", "Voice conversation"),
1961
- savedAt: M("voiceSession.savedAt", "Saved"),
1962
- session: M("voiceSession.sessionLabel", "Session"),
1963
- earlier: M("voiceSession.earlierLabel", "Earlier"),
1964
- you: M("voiceSession.speakerYou", "You"),
1965
- assistant: M("voiceSession.speakerAssistant", "Assistant")
1966
- }, e), Ye(N, e), "text/markdown");
1969
+ Hn(Ye(qs, {
1970
+ title: N("voiceSession.transcript", "Voice conversation"),
1971
+ savedAt: N("voiceSession.savedAt", "Saved"),
1972
+ session: N("voiceSession.sessionLabel", "Session"),
1973
+ earlier: N("voiceSession.earlierLabel", "Earlier"),
1974
+ you: N("voiceSession.speakerYou", "You"),
1975
+ assistant: N("voiceSession.speakerAssistant", "Assistant")
1976
+ }, e), Xe(P, e), "text/markdown");
1967
1977
  }, [
1968
- N,
1969
- Q,
1970
- M
1971
- ]), qs = ui({ perFileChars: Ya }), Js = O(qs);
1972
- Js.current = qs;
1973
- let [Ys, Xs] = k(null), Zs = Ys === null ? null : M("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: Ys });
1974
- E(() => {
1975
- if (Ys === null) return;
1976
- let e = window.setTimeout(() => Xs(null), xi);
1978
+ P,
1979
+ qs,
1980
+ N
1981
+ ]), Ys = di({ perFileChars: Xa }), Xs = k(Ys);
1982
+ Xs.current = Ys;
1983
+ let [Zs, Qs] = A(null), $s = Zs === null ? null : N("attachments.voiceDropped", "{{count}} attachment(s) couldn't be saved and weren't sent.", { count: Zs });
1984
+ D(() => {
1985
+ if (Zs === null) return;
1986
+ let e = window.setTimeout(() => Qs(null), Si);
1977
1987
  return () => window.clearTimeout(e);
1978
- }, [Ys]);
1979
- let Qs = O(/* @__PURE__ */ new Set()), $s = O(() => !1), $ = vn({
1980
- onSubmit: T((e, t, n, r) => {
1981
- let i = ao.current, a = st(i), o = () => {
1982
- let e = g.getState();
1983
- return tt({
1984
- sessionLive: $s.current(t),
1988
+ }, [Zs]);
1989
+ let ec = k(/* @__PURE__ */ new Set()), tc = k(() => !1), $ = yn({
1990
+ onSubmit: E((e, t, n, r) => {
1991
+ let i = oo.current, a = ct(i), o = () => {
1992
+ let e = _.getState();
1993
+ return C({
1994
+ sessionLive: tc.current(t),
1985
1995
  boundAtSubmit: i,
1986
1996
  activeConversationId: e.activeConversationId,
1987
1997
  boundConversationExists: e.conversations.some((e) => e.id === a)
1988
1998
  });
1989
1999
  }, s = () => {
1990
- let i = Js.current;
1991
- Ot({
2000
+ let i = Xs.current;
2001
+ kt({
1992
2002
  draft: i,
1993
2003
  maySend: o,
1994
- budgetMs: Dt,
2004
+ budgetMs: Ot,
1995
2005
  sendTurn: (i) => {
1996
2006
  let a = {
1997
2007
  ...n,
1998
- handedOver: mn()
2008
+ handedOver: hn()
1999
2009
  };
2000
- Ns.current(e, i, {
2010
+ Ps.current(e, i, {
2001
2011
  fromPerson: !0,
2002
2012
  voiceSessionId: t,
2003
2013
  voiceTiming: a,
2004
2014
  ...r.correction ? { correctsInFlightTurn: !0 } : {}
2005
2015
  });
2006
2016
  },
2007
- announceDropped: (e) => Xs(e)
2017
+ announceDropped: (e) => Qs(e)
2008
2018
  });
2009
2019
  };
2010
- if (o() && _s.current(e, t)) {
2011
- Ns.current(e, [], {
2020
+ if (o() && vs.current(e, t)) {
2021
+ Ps.current(e, [], {
2012
2022
  fromPerson: !0,
2013
2023
  voiceSessionId: t,
2014
2024
  voiceTiming: {
2015
2025
  ...n,
2016
- handedOver: mn()
2026
+ handedOver: hn()
2017
2027
  }
2018
2028
  });
2019
2029
  return;
2020
2030
  }
2021
- if (!Js.current.isBusy) {
2031
+ if (!Xs.current.isBusy) {
2022
2032
  s();
2023
2033
  return;
2024
2034
  }
2025
- let c = Date.now(), l = Qs.current, u = window.setInterval(() => {
2026
- let e = Js.current.isBusy;
2027
- Js.current.isCommitting || e && Date.now() - c < bi || (window.clearInterval(u), l.delete(u), s());
2035
+ let c = Date.now(), l = ec.current, u = window.setInterval(() => {
2036
+ let e = Xs.current.isBusy;
2037
+ Xs.current.isCommitting || e && Date.now() - c < xi || (window.clearInterval(u), l.delete(u), s());
2028
2038
  }, 200);
2029
2039
  l.add(u);
2030
2040
  }, []),
2031
- latestReply: Ps,
2032
- language: Qe(Vi, R).tag,
2033
- graceMs: Li,
2034
- onSupersede: ko,
2035
- handsFreeStreamNoticeAccepted: zi,
2036
- onAcceptHandsFreeStreamNotice: Bi,
2037
- handsFreeInterrupt: Ri,
2038
- onBargeIn: Oo
2041
+ latestReply: Fs,
2042
+ language: $e(Hi, z).tag,
2043
+ graceMs: Ri,
2044
+ onSupersede: Ao,
2045
+ handsFreeStreamNoticeAccepted: Bi,
2046
+ onAcceptHandsFreeStreamNotice: Vi,
2047
+ handsFreeInterrupt: zi,
2048
+ onBargeIn: ko
2039
2049
  });
2040
- $s.current = $.isCurrentSession;
2041
- let ec = oo ? Q.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : Q, tc = $.answerLocally;
2042
- E(() => {
2043
- Cs.current = tc;
2044
- }, [tc]);
2045
- let nc = $.active, rc = D(() => vt(Object.values(ba), z, xa), [
2046
- ba,
2047
- z,
2048
- xa
2049
- ]), [ic, ac] = k(null);
2050
- E(() => {
2051
- nc || ac(null);
2052
- }, [nc]);
2053
- let oc = Sa.review, sc = T(() => {
2054
- let e = rc[rc.length - 1];
2050
+ tc.current = $.isCurrentSession;
2051
+ let nc = so ? qs.filter((e) => e.sessionId !== void 0 && $.isCurrentSession(e.sessionId)) : qs, rc = $.answerLocally;
2052
+ D(() => {
2053
+ ws.current = rc;
2054
+ }, [rc]);
2055
+ let ic = $.active, ac = O(() => yt(Object.values(xa), B, Sa), [
2056
+ xa,
2057
+ B,
2058
+ Sa
2059
+ ]), [oc, sc] = A(null);
2060
+ D(() => {
2061
+ ic || sc(null);
2062
+ }, [ic]);
2063
+ let cc = Ca.review, lc = E(() => {
2064
+ let e = ac[ac.length - 1];
2055
2065
  if (!e) return;
2056
2066
  let { view: t } = e;
2057
- if (Tn(t) && wn(t, ya[e.session.sandboxId]).offerConfirm) {
2058
- oc(t);
2067
+ if (En(t) && Tn(t, ba[e.session.sandboxId]).offerConfirm) {
2068
+ cc(t);
2059
2069
  return;
2060
2070
  }
2061
- ac(t.proposalId);
2071
+ sc(t.proposalId);
2062
2072
  }, [
2063
- rc,
2064
- ya,
2065
- oc
2066
- ]), cc = nc ? ht(rc) : null, lc = ic ? ba[ic] : void 0, uc = nc && lc && lc.session.conversationId === z ? {
2067
- content: /* @__PURE__ */ A(On, {
2073
+ ac,
2074
+ ba,
2075
+ cc
2076
+ ]), uc = ic ? gt(ac) : null, dc = oc ? xa[oc] : void 0, fc = ic && dc && dc.session.conversationId === B ? {
2077
+ content: /* @__PURE__ */ j(kn, {
2068
2078
  refs: [{
2069
- proposalId: lc.view.proposalId,
2070
- sandboxId: lc.session.sandboxId,
2071
- sessionId: lc.session.sessionId
2079
+ proposalId: dc.view.proposalId,
2080
+ sandboxId: dc.session.sandboxId,
2081
+ sessionId: dc.session.sessionId
2072
2082
  }],
2073
- conversationId: lc.session.conversationId,
2074
- panel: U,
2075
- entries: ba,
2076
- capabilitiesOf: (e) => ya[e],
2077
- turnInFlight: ga,
2078
- tr: M,
2079
- onReview: oc,
2080
- retiredSandboxes: xa
2083
+ conversationId: dc.session.conversationId,
2084
+ panel: W,
2085
+ entries: xa,
2086
+ capabilitiesOf: (e) => ba[e],
2087
+ turnInFlight: _a,
2088
+ tr: N,
2089
+ onReview: cc,
2090
+ retiredSandboxes: Sa
2081
2091
  }),
2082
- closeLabel: yt(M, pt.trayClose),
2083
- onClose: () => ac(null)
2084
- } : null, dc = Sa.asking, fc = bs?.asking === !0, pc = xs?.asking === !0, mc = $n(), hc = $.holdListening;
2085
- r("assistant.transcript", D(() => nc || G ? null : { run: () => eo ? { status: "already" } : (io(!0), { status: "done" }) }, [
2086
- nc,
2087
- G,
2088
- eo,
2089
- io
2090
- ])), r("assistant.conversation.new", D(() => nc ? null : { run: () => {
2091
- let e = g.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
2092
+ closeLabel: bt(N, mt.trayClose),
2093
+ onClose: () => sc(null)
2094
+ } : null, pc = Ca.asking, mc = xs?.asking === !0, hc = Ss?.asking === !0, gc = er(), _c = $.holdListening;
2095
+ r("assistant.transcript", O(() => ic || K ? null : { run: () => to ? { status: "already" } : (ao(!0), { status: "done" }) }, [
2096
+ ic,
2097
+ K,
2098
+ to,
2099
+ ao
2100
+ ])), r("assistant.conversation.new", O(() => ic ? null : { run: () => {
2101
+ let e = _.getState(), t = e.conversations.find((t) => t.id === e.activeConversationId);
2092
2102
  return t && t.messages.length === 0 ? { status: "already" } : (e.createConversation(), { status: "done" });
2093
- } }, [nc])), E(() => {
2094
- hc(nc && (dc || fc || pc || mc));
2103
+ } }, [ic])), D(() => {
2104
+ _c(ic && (pc || mc || hc || gc));
2095
2105
  }, [
2096
- nc,
2097
- dc,
2098
- fc,
2106
+ ic,
2099
2107
  pc,
2100
2108
  mc,
2101
- hc
2109
+ hc,
2110
+ gc,
2111
+ _c
2102
2112
  ]);
2103
- let gc = O(null), _c = $.announce;
2104
- E(() => {
2105
- if (!nc) {
2106
- gc.current = null;
2113
+ let vc = k(null), yc = $.announce;
2114
+ D(() => {
2115
+ if (!ic) {
2116
+ vc.current = null;
2107
2117
  return;
2108
2118
  }
2109
- let e = gc.current;
2119
+ let e = vc.current;
2110
2120
  if (e === null) {
2111
- gc.current = new Set(Object.keys(ba));
2121
+ vc.current = new Set(Object.keys(xa));
2112
2122
  return;
2113
2123
  }
2114
- for (let { view: t, session: n } of _t(rc, e)) {
2124
+ for (let { view: t, session: n } of vt(ac, e)) {
2115
2125
  e.add(t.proposalId);
2116
- let r = ya[n.sandboxId];
2117
- if (!mt({
2126
+ let r = ba[n.sandboxId];
2127
+ if (!ht({
2118
2128
  mode: "api-calls",
2119
- productWriteApproval: F,
2129
+ productWriteApproval: I,
2120
2130
  capabilities: r
2121
2131
  })) continue;
2122
- let i = bt(t, wn(t, r).offerConfirm, M), a = t.proposalId;
2123
- _c({
2132
+ let i = xt(t, Tn(t, r).offerConfirm, N), a = t.proposalId;
2133
+ yc({
2124
2134
  id: `write-readback:${a}`,
2125
2135
  text: i.text,
2126
- lang: i.translated ? R : "en",
2127
- stillWanted: () => U.entry(a)?.view.status === "pending"
2136
+ lang: i.translated ? z : "en",
2137
+ stillWanted: () => W.entry(a)?.view.status === "pending"
2128
2138
  });
2129
2139
  }
2130
2140
  }, [
2131
- nc,
2132
- rc,
2141
+ ic,
2142
+ ac,
2143
+ xa,
2133
2144
  ba,
2134
- ya,
2135
- F,
2136
- M,
2137
- R,
2138
- _c,
2139
- U
2145
+ I,
2146
+ N,
2147
+ z,
2148
+ yc,
2149
+ W
2140
2150
  ]);
2141
- let vc = O(!1);
2142
- E(() => {
2143
- vc.current = $.active;
2144
- }, [$.active]), E(() => p((e) => {
2145
- if (!vc.current) return !1;
2146
- let t = ao.current;
2147
- return typeof t == "string" ? t === e : g.getState().activeConversationId === e;
2151
+ let bc = k(!1);
2152
+ D(() => {
2153
+ bc.current = $.active;
2154
+ }, [$.active]), D(() => ie((e) => {
2155
+ if (!bc.current) return !1;
2156
+ let t = oo.current;
2157
+ return typeof t == "string" ? t === e : _.getState().activeConversationId === e;
2148
2158
  }), []);
2149
- let yc = $.start, bc = T(() => {
2150
- let e = g.getState().activeConversationId, t = it(lo());
2151
- co(ot(t, e)), bo(!0, t.kind === "own"), yc();
2159
+ let xc = $.start, Sc = E(() => {
2160
+ let e = _.getState().activeConversationId, t = at(uo());
2161
+ lo(st(t, e)), xo(!0, t.kind === "own"), xc();
2152
2162
  }, [
2153
- co,
2154
- bo,
2155
2163
  lo,
2156
- yc
2157
- ]), xc = D(() => cn(H?.messages ?? []), [H?.messages]), Sc = sn(pa.voice, ha, M), Cc = sn(xc, ha, M) > 0, wc = T(() => {
2158
- let e = g.getState().activeConversationId;
2159
- if (!e || Q.length === 0) return;
2160
- let t = new Set(xc.map((e) => e.id)), n = j();
2161
- V(e, {
2164
+ xo,
2165
+ uo,
2166
+ xc
2167
+ ]), Cc = O(() => ln(U?.messages ?? []), [U?.messages]), wc = cn(ma.voice, ga, N), Tc = cn(Cc, ga, N) > 0, Ec = E(() => {
2168
+ let e = _.getState().activeConversationId;
2169
+ if (!e || qs.length === 0) return;
2170
+ let t = new Set(Cc.map((e) => e.id)), n = M();
2171
+ H(e, {
2162
2172
  id: n,
2163
2173
  role: "system",
2164
- content: qe(Q.filter((e) => t.has(e.id)), {
2165
- intro: M("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
2166
- nothing: M("voiceSession.continuedNothing", "Continued from a voice conversation."),
2167
- more: (e) => M("voiceSession.continuedMore", "…and {{count}} more", { count: e })
2174
+ content: Je(qs.filter((e) => t.has(e.id)), {
2175
+ intro: N("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
2176
+ nothing: N("voiceSession.continuedNothing", "Continued from a voice conversation."),
2177
+ more: (e) => N("voiceSession.continuedMore", "…and {{count}} more", { count: e })
2168
2178
  }),
2169
2179
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2170
- metadata: { continuedVoiceTurns: Sc }
2171
- }), qn.recordCommittedEntries(e, [n], "NOTE", C()), io(!1), $.end(), no();
2180
+ metadata: { continuedVoiceTurns: wc }
2181
+ }), Jn.recordCommittedEntries(e, [n], "NOTE", w()), ao(!1), $.end(), ro();
2172
2182
  }, [
2173
- Q,
2174
- Sc,
2175
- xc,
2176
- V,
2177
- M,
2183
+ qs,
2184
+ wc,
2185
+ Cc,
2186
+ H,
2187
+ N,
2178
2188
  $,
2179
- io,
2180
- no
2181
- ]), Tc = O({
2189
+ ao,
2190
+ ro
2191
+ ]), Dc = k({
2182
2192
  conversationId: null,
2183
2193
  count: 0
2184
2194
  });
2185
- E(() => {
2186
- $.active && (Tc.current = {
2187
- conversationId: z,
2188
- count: Sc
2195
+ D(() => {
2196
+ $.active && (Dc.current = {
2197
+ conversationId: B,
2198
+ count: wc
2189
2199
  });
2190
2200
  }, [$.active]);
2191
- let Ec = T(() => {
2192
- let e = Tc.current, t = Sc > (e.conversationId === z ? e.count : 0);
2193
- $.end(), t && io(!0);
2201
+ let Oc = E(() => {
2202
+ let e = Dc.current, t = wc > (e.conversationId === B ? e.count : 0);
2203
+ $.end(), t && ao(!0);
2194
2204
  }, [
2195
- z,
2196
- Sc,
2205
+ B,
2206
+ wc,
2197
2207
  $,
2198
- io
2208
+ ao
2199
2209
  ]);
2200
- E(() => {
2201
- (!Di || !go) && $.active && $.end();
2210
+ D(() => {
2211
+ (!Oi || !_o) && $.active && $.end();
2202
2212
  }, [
2203
- Di,
2204
- go,
2213
+ Oi,
2214
+ _o,
2205
2215
  $
2206
2216
  ]);
2207
- let [Dc, Oc] = k(Ci), kc = lr({
2217
+ let [kc, Ac] = A(wi), jc = ur({
2208
2218
  available: $.available,
2209
- allowedInMode: go,
2210
- readOnly: Ta,
2211
- busy: ga || So !== null || Da || Zo,
2212
- committing: Dc.committing,
2213
- dictating: Dc.dictating
2214
- }), Ac = wt(), [jc, Mc] = k(null);
2215
- E(() => {
2216
- jc !== null && (!G || jc.conversationId !== z) && Mc(null);
2219
+ allowedInMode: _o,
2220
+ readOnly: Ea,
2221
+ busy: _a || Co !== null || Oa || Qo,
2222
+ committing: kc.committing,
2223
+ dictating: kc.dictating
2224
+ }), Mc = Tt(), [Nc, Pc] = A(null);
2225
+ D(() => {
2226
+ Nc !== null && (!K || Nc.conversationId !== B) && Pc(null);
2217
2227
  }, [
2218
- G,
2219
- z,
2220
- jc
2228
+ K,
2229
+ B,
2230
+ Nc
2221
2231
  ]);
2222
- let Nc = jc !== null && No === jc.replyId, Pc = O(!1), Fc = T(() => {
2223
- Pc.current = !0, Nc && Po(), bc();
2232
+ let Fc = Nc !== null && Po === Nc.replyId, Ic = k(!1), Lc = E(() => {
2233
+ Ic.current = !0, Fc && Fo(), Sc();
2224
2234
  }, [
2225
- bc,
2226
- Nc,
2227
- Po
2235
+ Sc,
2236
+ Fc,
2237
+ Fo
2228
2238
  ]);
2229
- E(() => {
2230
- $.active || (Pc.current = !1);
2231
- }, [$.active]), E(() => {
2232
- G || !Pc.current || (Pc.current = !1, $.active && Ec());
2239
+ D(() => {
2240
+ $.active || (Ic.current = !1);
2241
+ }, [$.active]), D(() => {
2242
+ K || !Ic.current || (Ic.current = !1, $.active && Oc());
2233
2243
  }, [
2234
- G,
2244
+ K,
2235
2245
  $.active,
2236
- Ec
2237
- ]), E(() => {
2238
- G && io(!1);
2239
- }, [G, io]);
2240
- let Ic = D(() => ({
2246
+ Oc
2247
+ ]), D(() => {
2248
+ K && ao(!1);
2249
+ }, [K, ao]);
2250
+ let Rc = O(() => ({
2241
2251
  live: $.active,
2242
- blocked: kc === null ? null : Ac.voiceStartBlocked(kc),
2243
- impossible: ur(kc),
2244
- start: Fc
2252
+ blocked: jc === null ? null : Mc.voiceStartBlocked(jc),
2253
+ impossible: dr(jc),
2254
+ start: Lc
2245
2255
  }), [
2246
2256
  $.active,
2247
- kc,
2248
- Ac,
2249
- Fc
2250
- ]), [Lc, Rc] = k("mini"), zc = Di && W.covered !== !0 && !($.active && Lc !== "mini") && !(eo && !$.active) && !(dc || fc || pc || mc), Bc = to?.ask, Vc = gi(Bc?.subscribe ?? Ti, Bc?.getSnapshot ?? Ei, Bc?.getSnapshot ?? Ei), Hc = dr({
2257
+ jc,
2258
+ Mc,
2259
+ Lc
2260
+ ]), [zc, Bc] = A("mini"), Vc = Oi && G.covered !== !0 && !($.active && zc !== "mini") && !(to && !$.active) && !(pc || mc || hc || gc), Hc = no?.ask, Uc = _i(Hc?.subscribe ?? Ei, Hc?.getSnapshot ?? Di, Hc?.getSnapshot ?? Di), Wc = fr({
2251
2261
  voiceLive: $.active,
2252
- readOnly: Ta,
2253
- writes: fr({
2254
- auto: Ua,
2255
- selectedMode: B,
2256
- conversation: H && !Ta ? {
2257
- mode: H.mode,
2258
- routedBy: H.routedBy,
2259
- hasHistory: Hn(H)
2262
+ readOnly: Ea,
2263
+ writes: pr({
2264
+ auto: Wa,
2265
+ selectedMode: V,
2266
+ conversation: U && !Ea ? {
2267
+ mode: U.mode,
2268
+ routedBy: U.routedBy,
2269
+ hasHistory: Un(U)
2260
2270
  } : null,
2261
- modeWrites: (e) => P.find((t) => t.id === e)?.writeCapable === !0 || ye(e)
2271
+ modeWrites: (e) => F.find((t) => t.id === e)?.writeCapable === !0 || xe(e)
2262
2272
  }),
2263
- avatar: Vc,
2264
- busy: ga || So !== null || Da || Zo || Xa !== null || qa,
2265
- committing: Dc.committing
2266
- }), Uc = O(Hc);
2267
- hi(() => {
2268
- Uc.current = Hc;
2269
- }, [Hc]);
2270
- let Wc = T((e) => {
2273
+ avatar: Uc,
2274
+ busy: _a || Co !== null || Oa || Qo || Za !== null || Ja,
2275
+ committing: kc.committing
2276
+ }), Gc = k(Wc);
2277
+ gi(() => {
2278
+ Gc.current = Wc;
2279
+ }, [Wc]);
2280
+ let Kc = E((e) => {
2271
2281
  let t = e.trim();
2272
- if (t === "" || Uc.current !== null) return { accepted: !1 };
2273
- Nc && Po();
2282
+ if (t === "" || Gc.current !== null) return { accepted: !1 };
2283
+ Fc && Fo();
2274
2284
  let n = {
2275
- token: j(),
2285
+ token: M(),
2276
2286
  exchange: null,
2277
2287
  handled: !1
2278
2288
  };
2279
- Fo.current = n;
2289
+ Io.current = n;
2280
2290
  try {
2281
- Z(t, [], {
2291
+ Q(t, [], {
2282
2292
  fromPerson: !0,
2283
2293
  avatarTabAsk: n.token,
2284
2294
  localRecordsChecked: !0,
2285
- ...Ua ? { autoIntent: "read" } : {}
2295
+ ...Wa ? { autoIntent: "read" } : {}
2286
2296
  });
2287
2297
  } finally {
2288
- Fo.current = null;
2298
+ Io.current = null;
2289
2299
  }
2290
2300
  let r = n.exchange;
2291
2301
  return r === null ? n.handled ? {
2292
2302
  accepted: !0,
2293
2303
  recorded: !1
2294
- } : { accepted: !1 } : (Mc(r), {
2304
+ } : { accepted: !1 } : (Pc(r), {
2295
2305
  accepted: !0,
2296
2306
  recorded: !0,
2297
2307
  ...r
2298
2308
  });
2299
2309
  }, [
2300
- Ua,
2301
- Z,
2302
- Po,
2303
- Nc
2304
- ]), [Gc] = k(() => mr()), Kc = D(() => ({
2305
- blocker: Hc,
2306
- line: pr(Hc, kc),
2307
- send: Wc,
2308
- last: jc,
2309
- navigatingReplyId: $o,
2310
- draft: Gc
2310
+ Wa,
2311
+ Q,
2312
+ Fo,
2313
+ Fc
2314
+ ]), [qc] = A(() => hr()), Jc = O(() => ({
2315
+ blocker: Wc,
2316
+ line: mr(Wc, jc),
2317
+ send: Kc,
2318
+ last: Nc,
2319
+ navigatingReplyId: es,
2320
+ draft: qc
2311
2321
  }), [
2312
- Hc,
2313
- kc,
2314
2322
  Wc,
2315
2323
  jc,
2316
- $o,
2317
- Gc
2318
- ]), qc = W.setReplyEscape, Jc = G && zc && Nc;
2319
- E(() => {
2320
- if (!(!qc || !Jc)) return qc(Po), () => qc(null);
2324
+ Kc,
2325
+ Nc,
2326
+ es,
2327
+ qc
2328
+ ]), Yc = G.setReplyEscape, Xc = K && Vc && Fc;
2329
+ D(() => {
2330
+ if (!(!Yc || !Xc)) return Yc(Fo), () => Yc(null);
2321
2331
  }, [
2322
- qc,
2323
- Jc,
2324
- Po
2325
- ]), E(() => {
2326
- let e = ao.current, t = st(e), n = g.getState(), r = rt({
2332
+ Yc,
2333
+ Xc,
2334
+ Fo
2335
+ ]), D(() => {
2336
+ let e = oo.current, t = ct(e), n = _.getState(), r = it({
2327
2337
  sessionLive: $.active,
2328
2338
  bound: e,
2329
2339
  activeConversationId: n.activeConversationId,
2330
2340
  boundConversationExists: n.conversations.some((e) => e.id === t)
2331
2341
  });
2332
- co(r.bound), r.end && $.end();
2342
+ lo(r.bound), r.end && $.end();
2333
2343
  }, [
2334
2344
  $,
2335
- z,
2336
- qi,
2337
- co
2345
+ B,
2346
+ Ji,
2347
+ lo
2338
2348
  ]);
2339
- let Yc = O($e);
2340
- E(() => {
2341
- let e = nt(Yc.current, {
2342
- activeConversationId: z,
2343
- chatTurnCount: Is.length,
2344
- voiceTurnCount: Q.length,
2349
+ let Zc = k(tt);
2350
+ D(() => {
2351
+ let e = rt(Zc.current, {
2352
+ activeConversationId: B,
2353
+ chatTurnCount: Ls.length,
2354
+ voiceTurnCount: qs.length,
2345
2355
  sessionLive: $.active,
2346
- sessionBoundTo: ao.current,
2347
- turnInFlight: ga
2356
+ sessionBoundTo: oo.current,
2357
+ turnInFlight: _a
2348
2358
  });
2349
- Yc.current = e.state, e.open && io(!0);
2359
+ Zc.current = e.state, e.open && ao(!0);
2350
2360
  }, [
2351
- z,
2352
- Is.length,
2353
- Q.length,
2361
+ B,
2362
+ Ls.length,
2363
+ qs.length,
2354
2364
  $.active,
2355
- ga,
2356
- io
2357
- ]), E(() => {
2365
+ _a,
2366
+ ao
2367
+ ]), D(() => {
2358
2368
  if (!$.active) {
2359
- Js.current.clear(), Xs(null), Eo.current = null;
2360
- for (let e of Qs.current) window.clearInterval(e);
2361
- Qs.current.clear();
2369
+ Xs.current.clear(), Qs(null), Do.current = null;
2370
+ for (let e of ec.current) window.clearInterval(e);
2371
+ ec.current.clear();
2362
2372
  }
2363
- }, [$.active]), E(() => {
2364
- let e = Qs.current;
2373
+ }, [$.active]), D(() => {
2374
+ let e = ec.current;
2365
2375
  return () => {
2366
2376
  for (let t of e) window.clearInterval(t);
2367
2377
  e.clear();
2368
2378
  };
2369
- }, []), E(() => {
2370
- let e = g.getState().consumePendingPrompt();
2371
- return e && Ns.current(e), g.subscribe((e, t) => {
2379
+ }, []), D(() => {
2380
+ let e = _.getState().consumePendingPrompt();
2381
+ return e && Ps.current(e), _.subscribe((e, t) => {
2372
2382
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
2373
- let e = g.getState().consumePendingPrompt();
2374
- e && Ns.current(e);
2383
+ let e = _.getState().consumePendingPrompt();
2384
+ e && Ps.current(e);
2375
2385
  }
2376
2386
  });
2377
2387
  }, []);
2378
- let Xc = T((e) => {
2379
- let t = z ? g.getState().conversations.find((e) => e.id === z) : void 0;
2380
- if (t && t.mode !== e && U.withdraw(t.id, "mode_switched"), t && Hn(t)) {
2388
+ let Qc = E((e) => {
2389
+ let t = B ? _.getState().conversations.find((e) => e.id === B) : void 0;
2390
+ if (t && t.mode !== e && W.withdraw(t.id, "mode_switched"), t && Un(t)) {
2381
2391
  if (t.mode !== e) {
2382
- let t = te(), n = g.getState().conversations.find((n) => n.mode === e && Gn(n, t) && !g.getState().processingByConversationId[n.id]);
2383
- n ? Zi(n.id) : Qi(void 0, e);
2392
+ let t = re(), n = _.getState().conversations.find((n) => n.mode === e && Kn(n, t) && !_.getState().processingByConversationId[n.id]);
2393
+ n ? Qi(n.id) : $i(void 0, e);
2384
2394
  }
2385
- } else z && Xi(z, e);
2386
- let n = g.getState().activeConversationId;
2387
- n ? Xi(n, e) : da(!1), Yi(e);
2395
+ } else B && Zi(B, e);
2396
+ let n = _.getState().activeConversationId;
2397
+ n ? Zi(n, e) : fa(!1), Xi(e);
2388
2398
  }, [
2389
- z,
2399
+ B,
2400
+ $i,
2390
2401
  Qi,
2402
+ fa,
2391
2403
  Zi,
2392
- da,
2393
2404
  Xi,
2394
- Yi,
2395
- U
2396
- ]), Zc = T(() => {
2397
- let e = g.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
2405
+ W
2406
+ ]), $c = E(() => {
2407
+ let e = _.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
2398
2408
  if (!t) {
2399
- da(!0), Yi(c);
2409
+ fa(!0), Xi(d);
2400
2410
  return;
2401
2411
  }
2402
2412
  if (t.routedBy === "auto") {
2403
- da(!0);
2413
+ fa(!0);
2404
2414
  return;
2405
2415
  }
2406
- if (!Hn(t)) {
2407
- fa(t.id, c);
2416
+ if (!Un(t)) {
2417
+ pa(t.id, d);
2408
2418
  return;
2409
2419
  }
2410
- U.withdraw(t.id, "mode_switched");
2411
- let n = te(), r = e.conversations.find((t) => t.routedBy === "auto" && Gn(t, n) && !e.processingByConversationId[t.id]);
2412
- r ? (Zi(r.id), fa(r.id, c)) : Qi(void 0, c, { routedBy: "auto" });
2420
+ W.withdraw(t.id, "mode_switched");
2421
+ let n = re(), r = e.conversations.find((t) => t.routedBy === "auto" && Kn(t, n) && !e.processingByConversationId[t.id]);
2422
+ r ? (Qi(r.id), pa(r.id, d)) : $i(void 0, d, { routedBy: "auto" });
2413
2423
  }, [
2424
+ $i,
2425
+ pa,
2414
2426
  Qi,
2415
2427
  fa,
2416
- Zi,
2417
- da,
2418
- Yi,
2419
- U
2420
- ]), Qc = T((e) => {
2421
- if (P.find((t) => t.id === e)?.writeCapable && !ce(g.getState().acknowledgedWriteModes, e)) {
2422
- Za(e);
2428
+ Xi,
2429
+ W
2430
+ ]), el = E((e) => {
2431
+ if (F.find((t) => t.id === e)?.writeCapable && !ue(_.getState().acknowledgedWriteModes, e)) {
2432
+ Qa(e);
2423
2433
  return;
2424
2434
  }
2425
- Xc(e);
2426
- }, [Xc, P]), $c = T(() => {
2427
- let e = Xa;
2428
- if (Za(null), !e) return;
2429
- let t = Ga.current;
2430
- if (Ga.current = null, t) {
2431
- la(e), Z(t.content, t.attachments, t.options);
2435
+ Qc(e);
2436
+ }, [Qc, F]), tl = E(() => {
2437
+ let e = Za;
2438
+ if (Qa(null), !e) return;
2439
+ let t = Ka.current;
2440
+ if (Ka.current = null, t) {
2441
+ ua(e), Q(t.content, t.attachments, t.options);
2432
2442
  return;
2433
2443
  }
2434
- la(e), Xc(e);
2444
+ ua(e), Qc(e);
2435
2445
  }, [
2436
- Xa,
2437
- la,
2438
- Xc,
2439
- Z
2440
- ]), el = Xa === null ? void 0 : P.find((e) => e.id === Xa) ?? { id: Xa }, tl = T(() => {
2441
- Za(null);
2442
- let e = Ga.current;
2443
- Ga.current = null, e && Z(e.content, e.attachments, {
2446
+ Za,
2447
+ ua,
2448
+ Qc,
2449
+ Q
2450
+ ]), nl = Za === null ? void 0 : F.find((e) => e.id === Za) ?? { id: Za }, rl = E(() => {
2451
+ Qa(null);
2452
+ let e = Ka.current;
2453
+ Ka.current = null, e && Q(e.content, e.attachments, {
2444
2454
  ...e.options,
2445
2455
  autoIntent: "read"
2446
2456
  });
2447
- }, [Z]);
2448
- return /* @__PURE__ */ _i("div", {
2457
+ }, [Q]);
2458
+ return /* @__PURE__ */ vi("div", {
2449
2459
  className: "relative flex flex-1 flex-col overflow-hidden",
2450
2460
  children: [
2451
- /* @__PURE__ */ _i("div", {
2461
+ /* @__PURE__ */ vi("div", {
2452
2462
  className: "contents",
2453
- inert: $.active || G || void 0,
2454
- ...W.ids ? {
2463
+ inert: $.active || K || void 0,
2464
+ ...G.ids ? {
2455
2465
  role: "tabpanel",
2456
- id: W.ids.chatPanel,
2457
- "aria-labelledby": W.ids.chatTab
2466
+ id: G.ids.chatPanel,
2467
+ "aria-labelledby": G.ids.chatTab
2458
2468
  } : {},
2459
2469
  children: [
2460
- Ma === null ? null : /* @__PURE__ */ A(In, { onDismiss: () => ja(Ma) }),
2461
- Q.length > 0 && !$.active ? /* @__PURE__ */ A(Pn, {
2462
- count: Q.length,
2463
- onOpenTranscript: () => io(!0)
2470
+ Na === null ? null : /* @__PURE__ */ j(Ln, { onDismiss: () => Ma(Na) }),
2471
+ qs.length > 0 && !$.active ? /* @__PURE__ */ j(Fn, {
2472
+ count: qs.length,
2473
+ onOpenTranscript: () => ao(!0)
2464
2474
  }) : null,
2465
- Is.length === 0 && (Da || Oa) ? /* @__PURE__ */ A(Ln, {
2466
- state: Da ? "loading" : "failed",
2467
- onRetry: La
2468
- }) : Is.length === 0 && H?.sync?.hasOlder ? /* @__PURE__ */ A("div", {
2475
+ Ls.length === 0 && (Oa || ka) ? /* @__PURE__ */ j(Rn, {
2476
+ state: Oa ? "loading" : "failed",
2477
+ onRetry: Ra
2478
+ }) : Ls.length === 0 && U?.sync?.hasOlder ? /* @__PURE__ */ j("div", {
2469
2479
  className: "flex min-h-0 flex-1 flex-col",
2470
- children: /* @__PURE__ */ A(zn, {
2471
- onShowEarlier: Ra,
2472
- disabled: Da
2480
+ children: /* @__PURE__ */ j(Bn, {
2481
+ onShowEarlier: za,
2482
+ disabled: Oa
2473
2483
  })
2474
- }) : Is.length === 0 ? /* @__PURE__ */ A(Jn, {
2475
- mode: B,
2476
- onSuggestionClick: As,
2477
- explainsAuto: Ua,
2478
- suggestions: Ua && B === "assistant" ? l(P.find((e) => e.id === "assistant")?.suggestions ?? [], P.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2479
- }) : /* @__PURE__ */ _i("div", {
2484
+ }) : Ls.length === 0 ? /* @__PURE__ */ j(Yn, {
2485
+ mode: V,
2486
+ onSuggestionClick: js,
2487
+ explainsAuto: Wa,
2488
+ suggestions: Wa && V === "assistant" ? f(F.find((e) => e.id === "assistant")?.suggestions ?? [], F.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
2489
+ }) : /* @__PURE__ */ vi("div", {
2480
2490
  className: "flex min-h-0 flex-1 flex-col",
2481
- children: [H?.sync?.hasOlder ? /* @__PURE__ */ A(zn, {
2482
- onShowEarlier: Ra,
2483
- disabled: Da
2484
- }) : null, /* @__PURE__ */ A(or, {
2485
- onApprovePendingWrite: Ao,
2486
- approvingWriteRef: So,
2487
- approvableMessageId: Rs?.messageId ?? null,
2488
- retryableMessageId: zs,
2489
- messages: Is,
2490
- processing: ha ?? null,
2491
- streamingMessageId: _a,
2492
- failedMessageId: va,
2493
- onRetry: So === null ? Ms : void 0,
2494
- renderWriteProposals: Vs,
2495
- hidesLegacyWriteCard: Bs,
2496
- renderUiOffers: Us
2491
+ children: [U?.sync?.hasOlder ? /* @__PURE__ */ j(Bn, {
2492
+ onShowEarlier: za,
2493
+ disabled: Oa
2494
+ }) : null, /* @__PURE__ */ j(sr, {
2495
+ onApprovePendingWrite: jo,
2496
+ approvingWriteRef: Co,
2497
+ approvableMessageId: zs?.messageId ?? null,
2498
+ retryableMessageId: Bs,
2499
+ messages: Ls,
2500
+ processing: ga ?? null,
2501
+ streamingMessageId: va,
2502
+ failedMessageId: ya,
2503
+ onRetry: Co === null ? Ns : void 0,
2504
+ renderWriteProposals: Hs,
2505
+ hidesLegacyWriteCard: Vs,
2506
+ renderUiOffers: Ws
2497
2507
  })]
2498
2508
  }),
2499
- Ta ? /* @__PURE__ */ A(Rn, { onStartNew: () => Qi() }) : null,
2500
- Ea && z ? /* @__PURE__ */ A(Fn, { onUnarchive: () => qn.updateConversation(z, { archived: !1 }) }) : null,
2501
- ws === null ? null : /* @__PURE__ */ A(Yn, {
2502
- tr: M,
2503
- onDismiss: () => Ts(null)
2509
+ Ea ? /* @__PURE__ */ j(zn, { onStartNew: () => $i() }) : null,
2510
+ Da && B ? /* @__PURE__ */ j(In, { onUnarchive: () => Jn.updateConversation(B, { archived: !1 }) }) : null,
2511
+ Ts === null ? null : /* @__PURE__ */ j(Xn, {
2512
+ tr: N,
2513
+ onDismiss: () => Es(null)
2504
2514
  }),
2505
- Is.length > 0 && (Da || Oa) ? /* @__PURE__ */ A(Ln, {
2506
- state: Da ? "loading" : "failed",
2507
- onRetry: La,
2515
+ Ls.length > 0 && (Oa || ka) ? /* @__PURE__ */ j(Rn, {
2516
+ state: Oa ? "loading" : "failed",
2517
+ onRetry: Ra,
2508
2518
  compact: !0
2509
2519
  }) : null,
2510
- /* @__PURE__ */ A(di, {
2511
- onStartVoiceSession: $.available && go ? bc : void 0,
2512
- onSend: (e, t) => void Z(e, t, { fromPerson: !0 }),
2513
- onDraftStart: xo,
2514
- disabled: ga || So !== null || Da || Zo,
2515
- readOnly: Ta,
2516
- placeholder: B === "api-calls" ? M("chatArea.placeholderActions", "What would you like me to do?") : M("chatArea.placeholderGeneral", "Ask me anything…"),
2517
- mode: B,
2518
- writeAccessDenied: Oi === "denied" && !!po?.writeCapable,
2519
- availableModes: Va,
2520
- attachmentCharsPerFile: Ya,
2521
- onModeChange: Qc,
2522
- auto: Ha ? {
2523
- active: Ua,
2524
- onSelect: Zc
2520
+ /* @__PURE__ */ j(fi, {
2521
+ onStartVoiceSession: $.available && _o ? Sc : void 0,
2522
+ onSend: (e, t) => void Q(e, t, { fromPerson: !0 }),
2523
+ onDraftStart: So,
2524
+ disabled: _a || Co !== null || Oa || Qo,
2525
+ readOnly: Ea,
2526
+ placeholder: V === "api-calls" ? N("chatArea.placeholderActions", "What would you like me to do?") : N("chatArea.placeholderGeneral", "Ask me anything…"),
2527
+ mode: V,
2528
+ writeAccessDenied: ki === "denied" && !!mo?.writeCapable,
2529
+ availableModes: Ha,
2530
+ attachmentCharsPerFile: Xa,
2531
+ onModeChange: el,
2532
+ auto: Ua ? {
2533
+ active: Wa,
2534
+ onSelect: $c
2525
2535
  } : void 0,
2526
- suspendDictation: G,
2527
- onVoiceStateChange: W.ids ? Oc : void 0
2536
+ suspendDictation: K,
2537
+ onVoiceStateChange: G.ids ? Ac : void 0
2528
2538
  })
2529
2539
  ]
2530
2540
  }),
2531
- eo && !$.active ? /* @__PURE__ */ A(Bn, {
2532
- turns: Q,
2533
- onClose: () => io(!1),
2534
- onSave: Ks,
2535
- onContinueInChat: Cc ? wc : void 0,
2541
+ to && !$.active ? /* @__PURE__ */ j(Vn, {
2542
+ turns: qs,
2543
+ onClose: () => ao(!1),
2544
+ onSave: Js,
2545
+ onContinueInChat: Tc ? Ec : void 0,
2536
2546
  closeOnEscape: !0,
2537
- onShowEarlier: H?.sync?.hasOlder ? Ra : void 0,
2538
- showEarlierDisabled: Da,
2539
- renderAfterTurn: Hs
2547
+ onShowEarlier: U?.sync?.hasOlder ? za : void 0,
2548
+ showEarlierDisabled: Oa,
2549
+ renderAfterTurn: Us
2540
2550
  }) : null,
2541
- G && to && W.ids ? /* @__PURE__ */ A(hr, {
2542
- tab: to,
2543
- id: W.ids.avatarPanel,
2544
- labelledBy: W.ids.avatarTab,
2545
- leaveHintId: W.ids.leaveHint,
2546
- shown: zc,
2547
- voice: Ic,
2548
- ...Bc ? { ask: Kc } : {}
2551
+ K && no && G.ids ? /* @__PURE__ */ j(gr, {
2552
+ tab: no,
2553
+ id: G.ids.avatarPanel,
2554
+ labelledBy: G.ids.avatarTab,
2555
+ leaveHintId: G.ids.leaveHint,
2556
+ shown: Vc,
2557
+ voice: Rc,
2558
+ ...Hc ? { ask: Jc } : {}
2549
2559
  }) : null,
2550
- $.active && /* @__PURE__ */ A(cr, {
2560
+ $.active && /* @__PURE__ */ j(lr, {
2551
2561
  session: $.session,
2552
2562
  notice: $.notice,
2553
2563
  privacyNotice: $.handsFree.privacyNotice,
@@ -2558,50 +2568,50 @@ var Ti = () => () => {}, Ei = () => "off", Di = ({ visible: Di = !0, writeAccess
2558
2568
  correcting: $.correcting,
2559
2569
  onLetMeFinish: $.letMeFinish,
2560
2570
  onImDone: $.imDone,
2561
- turns: ec,
2571
+ turns: nc,
2562
2572
  spokenChunks: $.spokenChunks,
2563
- attachments: qs.attachments,
2564
- onAttachFiles: qs.addFiles,
2565
- onRemoveAttachment: qs.remove,
2566
- onRetryAttachment: qs.retry,
2567
- canAttachMore: qs.canAddMore,
2568
- preparingAttachments: qs.preparingCount,
2569
- attachmentsLocked: qs.isCommitting,
2570
- attachmentNotice: Zs,
2571
- onSaveTranscript: Ks,
2572
- onContinueInChat: wc,
2573
+ attachments: Ys.attachments,
2574
+ onAttachFiles: Ys.addFiles,
2575
+ onRemoveAttachment: Ys.remove,
2576
+ onRetryAttachment: Ys.retry,
2577
+ canAttachMore: Ys.canAddMore,
2578
+ preparingAttachments: Ys.preparingCount,
2579
+ attachmentsLocked: Ys.isCommitting,
2580
+ attachmentNotice: $s,
2581
+ onSaveTranscript: Js,
2582
+ onContinueInChat: Ec,
2573
2583
  onInterrupt: () => {
2574
- $.interrupt(), Oo();
2584
+ $.interrupt(), ko();
2575
2585
  },
2576
- spoken: Fs,
2586
+ spoken: Is,
2577
2587
  onToggleMute: $.toggleMute,
2578
- onEnd: Ec,
2579
- proposalChip: cc ? {
2580
- label: gt(cc, M),
2581
- onOpen: sc
2588
+ onEnd: Oc,
2589
+ proposalChip: uc ? {
2590
+ label: _t(uc, N),
2591
+ onOpen: lc
2582
2592
  } : null,
2583
- proposalTray: uc,
2584
- renderAfterTurn: Hs,
2585
- onViewChange: W.ids ? Rc : void 0
2593
+ proposalTray: fc,
2594
+ renderAfterTurn: Us,
2595
+ onViewChange: G.ids ? Bc : void 0
2586
2596
  }),
2587
- /* @__PURE__ */ A(pi, {
2588
- open: Xa !== null,
2589
- mode: el,
2590
- currentMode: po ?? { id: B },
2591
- onConfirm: $c,
2592
- onCancel: tl
2597
+ /* @__PURE__ */ j(mi, {
2598
+ open: Za !== null,
2599
+ mode: nl,
2600
+ currentMode: mo ?? { id: V },
2601
+ onConfirm: tl,
2602
+ onCancel: rl
2593
2603
  }),
2594
- /* @__PURE__ */ A(En, {
2595
- ...Sa.dialog,
2596
- view: Ws?.view ?? Sa.dialog.view,
2597
- serverNow: Ws?.serverNow ?? NaN,
2598
- arrivedAt: Ws?.arrivedAt ?? NaN,
2599
- capabilities: Ws ? ya[Ws.session.sandboxId] : null,
2600
- turnInFlight: ga,
2601
- tr: M
2604
+ /* @__PURE__ */ j(Dn, {
2605
+ ...Ca.dialog,
2606
+ view: Gs?.view ?? Ca.dialog.view,
2607
+ serverNow: Gs?.serverNow ?? NaN,
2608
+ arrivedAt: Gs?.arrivedAt ?? NaN,
2609
+ capabilities: Gs ? ba[Gs.session.sandboxId] : null,
2610
+ turnInFlight: _a,
2611
+ tr: N
2602
2612
  })
2603
2613
  ]
2604
2614
  });
2605
2615
  };
2606
2616
  //#endregion
2607
- export { Di as AssistantChatArea };
2617
+ export { Oi as AssistantChatArea };