@burdenoff/fe-libs 2026.1028.3 → 2026.1028.5

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