@burdenoff/fe-libs 2026.1007.5 → 2026.1008.1

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