@burdenoff/fe-libs 2026.1004.3 → 2026.1004.5

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