@burdenoff/fe-libs 2026.1007.3 → 2026.1007.4

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