@burdenoff/fe-libs 2026.1028.4 → 2026.1028.6

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