@burdenoff/fe-libs 2026.928.3 → 2026.930.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/shared/assistant/adminModeSendGate.d.ts +6 -5
  2. package/dist/shared/assistant/adminModeSendGate.d.ts.map +1 -1
  3. package/dist/shared/assistant/adminModeSendGate.js +11 -11
  4. package/dist/shared/assistant/api.d.ts +313 -28
  5. package/dist/shared/assistant/api.d.ts.map +1 -1
  6. package/dist/shared/assistant/api.js +351 -135
  7. package/dist/shared/assistant/autoRouting.d.ts +11 -3
  8. package/dist/shared/assistant/autoRouting.d.ts.map +1 -1
  9. package/dist/shared/assistant/autoRouting.js +7 -7
  10. package/dist/shared/assistant/capabilities.d.ts +28 -0
  11. package/dist/shared/assistant/capabilities.d.ts.map +1 -1
  12. package/dist/shared/assistant/capabilities.js +19 -10
  13. package/dist/shared/assistant/conversation.d.ts +24 -2
  14. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  15. package/dist/shared/assistant/createSandboxAssistantTransport.d.ts.map +1 -1
  16. package/dist/shared/assistant/createSandboxAssistantTransport.js +67 -54
  17. package/dist/shared/assistant/history/historyList.js +1 -1
  18. package/dist/shared/assistant/history/historyMapping.d.ts.map +1 -1
  19. package/dist/shared/assistant/history/historyMapping.js +5 -1
  20. package/dist/shared/assistant/history/historyResume.js +7 -7
  21. package/dist/shared/assistant/i18nManifest.d.ts +53 -0
  22. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  23. package/dist/shared/assistant/i18nManifest.js +75 -16
  24. package/dist/shared/assistant/index.d.ts +15 -0
  25. package/dist/shared/assistant/index.d.ts.map +1 -1
  26. package/dist/shared/assistant/modeCapabilities.js +1 -1
  27. package/dist/shared/assistant/operations.d.ts +22 -0
  28. package/dist/shared/assistant/operations.d.ts.map +1 -1
  29. package/dist/shared/assistant/operations.js +2 -2
  30. package/dist/shared/assistant/prewarm.d.ts +7 -0
  31. package/dist/shared/assistant/prewarm.d.ts.map +1 -1
  32. package/dist/shared/assistant/prewarm.js +1 -1
  33. package/dist/shared/assistant/product.d.ts +80 -2
  34. package/dist/shared/assistant/product.d.ts.map +1 -1
  35. package/dist/shared/assistant/product.js +10 -6
  36. package/dist/shared/assistant/proposalWriteRules.d.ts +40 -0
  37. package/dist/shared/assistant/proposalWriteRules.d.ts.map +1 -0
  38. package/dist/shared/assistant/proposalWriteRules.js +14 -0
  39. package/dist/shared/assistant/store.d.ts +17 -0
  40. package/dist/shared/assistant/store.d.ts.map +1 -1
  41. package/dist/shared/assistant/store.js +50 -43
  42. package/dist/shared/assistant/turnOutcome.d.ts +34 -2
  43. package/dist/shared/assistant/turnOutcome.d.ts.map +1 -1
  44. package/dist/shared/assistant/turnOutcome.js +28 -17
  45. package/dist/shared/assistant/turnOutcomeCopy.d.ts +29 -7
  46. package/dist/shared/assistant/turnOutcomeCopy.d.ts.map +1 -1
  47. package/dist/shared/assistant/turnOutcomeCopy.js +18 -6
  48. package/dist/shared/assistant/types.d.ts +5 -1
  49. package/dist/shared/assistant/types.d.ts.map +1 -1
  50. package/dist/shared/assistant/ui/AssistantApiCallsConsentDialog.js +4 -4
  51. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  52. package/dist/shared/assistant/ui/AssistantChatArea.js +992 -718
  53. package/dist/shared/assistant/ui/AssistantConversationList.js +6 -6
  54. package/dist/shared/assistant/ui/AssistantLanguageMenu.js +6 -6
  55. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +8 -1
  56. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
  57. package/dist/shared/assistant/ui/AssistantMessageItem.js +77 -76
  58. package/dist/shared/assistant/ui/AssistantMessageList.d.ts +13 -1
  59. package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
  60. package/dist/shared/assistant/ui/AssistantMessageList.js +15 -13
  61. package/dist/shared/assistant/ui/AssistantReplyLanguageSelector.js +5 -5
  62. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +209 -209
  63. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts +62 -0
  64. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts.map +1 -0
  65. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.js +253 -0
  66. package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts +72 -0
  67. package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts.map +1 -0
  68. package/dist/shared/assistant/ui/AssistantWriteProposalCard.js +439 -0
  69. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.d.ts +40 -0
  70. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.d.ts.map +1 -0
  71. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.js +35 -0
  72. package/dist/shared/assistant/ui/composer/AssistantComposer.js +8 -8
  73. package/dist/shared/assistant/ui/useVoiceSession.d.ts +28 -0
  74. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  75. package/dist/shared/assistant/ui/useVoiceSession.js +159 -110
  76. package/dist/shared/assistant/ui/useWriteProposalConfirm.d.ts +61 -0
  77. package/dist/shared/assistant/ui/useWriteProposalConfirm.d.ts.map +1 -0
  78. package/dist/shared/assistant/ui/useWriteProposalConfirm.js +109 -0
  79. package/dist/shared/assistant/ui/useWriteProposals.d.ts +128 -0
  80. package/dist/shared/assistant/ui/useWriteProposals.d.ts.map +1 -0
  81. package/dist/shared/assistant/ui/useWriteProposals.js +240 -0
  82. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +17 -1
  83. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
  84. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +141 -109
  85. package/dist/shared/assistant/ui/writeProposalPresentation.d.ts +76 -0
  86. package/dist/shared/assistant/ui/writeProposalPresentation.d.ts.map +1 -0
  87. package/dist/shared/assistant/ui/writeProposalPresentation.js +110 -0
  88. package/dist/shared/assistant/usageReporting.d.ts +108 -0
  89. package/dist/shared/assistant/usageReporting.d.ts.map +1 -0
  90. package/dist/shared/assistant/usageReporting.js +155 -0
  91. package/dist/shared/assistant/useAssistantApiAccess.d.ts +49 -14
  92. package/dist/shared/assistant/useAssistantApiAccess.d.ts.map +1 -1
  93. package/dist/shared/assistant/useAssistantApiAccess.js +43 -25
  94. package/dist/shared/assistant/useAssistantHeartbeat.d.ts.map +1 -1
  95. package/dist/shared/assistant/useAssistantHeartbeat.js +5 -5
  96. package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts +5 -6
  97. package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts.map +1 -1
  98. package/dist/shared/assistant/voice/voiceSession.d.ts +46 -0
  99. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  100. package/dist/shared/assistant/voice/voiceSession.js +35 -2
  101. package/dist/shared/assistant/writeConfirmSeam.d.ts +32 -0
  102. package/dist/shared/assistant/writeConfirmSeam.d.ts.map +1 -0
  103. package/dist/shared/assistant/writeConfirmSeam.js +23 -0
  104. package/dist/shared/assistant/writeModeConsent.d.ts +16 -8
  105. package/dist/shared/assistant/writeModeConsent.d.ts.map +1 -1
  106. package/dist/shared/assistant/writeModeConsent.js +2 -2
  107. package/dist/shared/assistant/writeProposalDiscovery.d.ts +187 -0
  108. package/dist/shared/assistant/writeProposalDiscovery.d.ts.map +1 -0
  109. package/dist/shared/assistant/writeProposalDiscovery.js +246 -0
  110. package/dist/shared/assistant/writeProposalErrorCopy.d.ts +135 -0
  111. package/dist/shared/assistant/writeProposalErrorCopy.d.ts.map +1 -0
  112. package/dist/shared/assistant/writeProposalErrorCopy.js +135 -0
  113. package/dist/shared/assistant/writeProposalVoice.d.ts +133 -0
  114. package/dist/shared/assistant/writeProposalVoice.d.ts.map +1 -0
  115. package/dist/shared/assistant/writeProposalVoice.js +66 -0
  116. package/dist/shared/assistant/writeProposals.d.ts +268 -0
  117. package/dist/shared/assistant/writeProposals.d.ts.map +1 -0
  118. package/dist/shared/assistant/writeProposals.js +445 -0
  119. package/dist/shared/assistant/writeReplyBinder.d.ts +166 -0
  120. package/dist/shared/assistant/writeReplyBinder.d.ts.map +1 -0
  121. package/dist/shared/assistant/writeReplyBinder.js +233 -0
  122. package/dist/shared/assistant/writeReplySend.d.ts +110 -0
  123. package/dist/shared/assistant/writeReplySend.d.ts.map +1 -0
  124. package/dist/shared/assistant/writeReplySend.js +93 -0
  125. package/dist/shared-assistant.js +168 -153
  126. package/dist/ui/modal-shell.d.ts +14 -1
  127. package/dist/ui/modal-shell.d.ts.map +1 -1
  128. package/dist/ui/modal-shell.js +8 -6
  129. package/package.json +1 -1
@@ -6,308 +6,353 @@ import { useAssistantProduct as r } from "../product.js";
6
6
  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
- import { abortAssistantTurn as s, approvePendingWrite as c, createAssistantSandbox as l, createAssistantSession as u, extendAssistantSandboxTTL as ee, findExistingSandboxWithStatus as d, getAssistantArtifacts as f, getAssistantMessages as p, getAssistantSession as m, modeRequiresConfirmWrites as te, promptGatewayRequestBytes as ne, releaseSupersededAssistantSandboxes as h, sendAssistantPromptAsync as g, waitForAssistantServiceReady as _, waitForSandboxRunning as v } from "../api.js";
10
- import { sanitize as re } from "../progress.js";
11
- import { withIncompleteTurnNotice as ie } from "../streamBudget.js";
12
- import { chatTurns as y, isVoiceTurn as b, voiceMarker as x, voiceSessionIdOf as ae } from "../voice/turnVisibility.js";
13
- import { buildContinuedFromVoiceNote as oe, buildVoiceTranscriptMarkdown as S, voiceTranscriptFilename as C } from "../voice/voiceTranscript.js";
14
- import { pollDelayMs as se } from "../voice/assistantPollSchedule.js";
15
- import { toCaptionText as ce } from "../voice/captionText.js";
16
- import { resolveAssistantLanguage as le } from "../voice/languages.js";
17
- import { resolveLanguagePair as w } from "../voice/languagePair.js";
18
- import { INITIAL_TRANSCRIPT_AUTO_OPEN as ue, maySendSpokenTurn as de, planTranscriptAutoOpen as fe, planVoiceSessionBinding as T } from "../voice/voiceReopen.js";
19
- import { beginApprovalInFlight as pe, endApprovalInFlight as me, getApprovalInFlight as he, markLiveTurn as ge, newestModelReplyId as _e, resolveApprovablePendingWrite as ve, resolveRetryableMessageId as E, subscribeApprovalInFlight as ye } from "../liveTurns.js";
20
- import { countInlineImageCandidates as be, countInlinedImageParts as xe, getSendableAttachments as Se, largestInlineCharsPerFile as Ce, resolveAssistantInlineLimits as we, toMessageAttachment as Te } from "../attachments.js";
21
- import { AssistantSendRefusal as Ee, classifyTurnFailure as De, turnOutcomeCopy as Oe } from "../turnOutcome.js";
22
- import { createAdminModeAccessGate as ke, resolveAssistantSendModeAfterAccess as Ae } from "../adminModeSendGate.js";
23
- import { buildBoundedAttachmentTurn as je } from "../attachmentTurn.js";
24
- import { isWriteModeAcknowledged as Me, writeModeSendRefusalReason as Ne } from "../writeModeConsent.js";
25
- import { AUTO_READ_MODE as Pe, autoSuggestions as Fe, classifyAssistantIntent as Ie, escalationToUndo as Le, isAutoRoutingOffered as Re, resolveAutoRoute as ze } from "../autoRouting.js";
26
- import { getHistoryStamp as Be, setHistoryBusyProbe as Ve } from "../history/stampRegistry.js";
27
- import { resolveActiveModeSandbox as He, useAssistantStore as D } from "../store.js";
28
- import { isTurnInFlight as Ue, planAbandonedTurn as We, planTurnAbort as Ge } from "../turnState.js";
29
- import { getAssistantDisplayContent as Ke } from "../displayContent.js";
30
- import { NO_FIRST_TEXT as qe, buildAssistantProgress as Je, readAheadFor as Ye, snapshotReplyFloor as Xe, startSessionReadAhead as Ze, trackFirstText as Qe } from "../turnProgress.js";
31
- import { parseToolActivity as $e } from "./AssistantToolActivity.js";
32
- import { countSpokenTurns as et, spokenMessagesSinceContinueNote as tt, spokenTurnText as nt } from "../spokenTurns.js";
33
- import { beginTurn as rt, describeTurn as O, detectTurnDevice as it, markTurn as k, restartAttempt as at, turnClockMs as ot } from "../turnTimeline.js";
34
- import { useAssistantSpeech as st } from "./AssistantSpeechProvider.js";
35
- import { useVoiceSession as ct } from "./useVoiceSession.js";
36
- import { getOrganizationId as lt, getWorkspaceId as A } from "../context.js";
37
- import { isMultimodalBodyRejection as ut, isRecoverableAssistantError as dt } from "../transportErrors.js";
38
- import { createReadinessTracker as ft, planAfterTransportFailure as pt, planTrustedSandboxFailure as mt } from "../sandboxReadiness.js";
39
- import { AssistantSpokenTurnsNotice as ht } from "./AssistantSpokenTurnsNotice.js";
40
- import { AssistantHistoryDeletedNotice as gt, AssistantHistoryLoadState as _t, AssistantHistoryReadOnlyBanner as vt, AssistantHistoryShowEarlier as yt } from "./AssistantHistoryNotices.js";
41
- import { VoiceTranscriptDrawer as bt } from "./voice/VoiceTranscriptDrawer.js";
42
- import { downloadFile as xt } from "../exportConversation.js";
43
- import { conversationHasHistory as St, isOtherScopeHistoryConversation as Ct, isReadOnlyHistoryConversation as wt, isReusableHistoryDraft as Tt } from "../history/historyList.js";
44
- import { useAssistantHistoryStatus as Et } from "../history/historyStatus.js";
45
- import { assistantHistory as Dt } from "../history/historyEngine.js";
46
- import { AssistantEmptyState as Ot } from "./AssistantEmptyState.js";
47
- import { resumeContextFor as kt } from "../history/historyResume.js";
48
- import { AssistantMessageList as At } from "./AssistantMessageList.js";
49
- import { AssistantVoiceSession as jt } from "./voice/AssistantVoiceSession.js";
50
- import { useAssistantApiAccess as Mt } from "../useAssistantApiAccess.js";
51
- import { useConversationTurns as Nt } from "../useConversationTurns.js";
52
- import { sendAssistantTurnTimings as Pt, startTurnTimingReporting as Ft } from "../turnTimingReporter.js";
53
- import { WarmCancelled as It, consumeWarm as Lt, prewarmTarget as Rt, settleWarmBeforeSend as zt, startWarm as Bt, warmState as Vt } from "../prewarm.js";
54
- import { isAlreadyThere as Ht, matchLocalUiCommand as Ut, navDestinations as Wt, planThemeChange as Gt } from "../localUiCommands.js";
55
- import { chooseDestinationCopy as Kt, navigationCommandCopy as qt, themeCommandCopy as Jt } from "../localUiCommandCopy.js";
56
- import { dispatchAssistantQuotaExhausted as Yt, notifyAiCreditsUpdated as Xt } from "../aiCredits.js";
57
- import { useAssistantAttachments as Zt } from "../useAssistantAttachments.js";
58
- import { AssistantComposer as Qt } from "./composer/AssistantComposer.js";
59
- import { isProdRuntime as $t } from "../env.js";
60
- import { AssistantApiCallsConsentDialog as en } from "./AssistantApiCallsConsentDialog.js";
61
- import { useVisibleNavItems as tn } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
62
- import { useCallback as j, useEffect as M, useMemo as nn, useRef as N, useState as rn, useSyncExternalStore as an } from "react";
63
- import { jsx as P, jsxs as on } from "react/jsx-runtime";
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 g, markLiveTurn as te, newestModelReplyId as _, resolveApprovablePendingWrite as ne, resolveRetryableMessageId as re, 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 ce, createAssistantSession as x, extendAssistantSandboxTTL as le, findExistingSandboxWithStatus as S, getAssistantArtifacts as ue, getAssistantMessages as de, getAssistantSession as fe, modeRequiresConfirmWrites as pe, promptGatewayRequestBytes as me, releaseSupersededAssistantSandboxes as he, sendAssistantPromptAsync as ge, waitForAssistantServiceReady as C, waitForSandboxRunning as _e, writeApprovalModeOf as ve } from "../api.js";
15
+ import { sanitize as ye } from "../progress.js";
16
+ import { AssistantSendRefusal as be, classifyTurnFailure as xe, turnConfirmsNoAction as Se, turnOutcomeCopy as Ce } from "../turnOutcome.js";
17
+ import { assistantUsageLedger as we, hasPendingUsageReports as Te, reportUsageWithRetry as Ee, retryPendingUsageReports as De, usageSendRefusal as Oe } from "../usageReporting.js";
18
+ import { withIncompleteTurnNotice as ke } from "../streamBudget.js";
19
+ import { chatTurns as Ae, isVoiceTurn as w, voiceMarker as T, voiceSessionIdOf as E } from "../voice/turnVisibility.js";
20
+ import { buildContinuedFromVoiceNote as je, buildVoiceTranscriptMarkdown as Me, voiceTranscriptFilename as Ne } from "../voice/voiceTranscript.js";
21
+ import { pollDelayMs as Pe } from "../voice/assistantPollSchedule.js";
22
+ import { toCaptionText as Fe } from "../voice/captionText.js";
23
+ import { resolveAssistantLanguage as Ie } from "../voice/languages.js";
24
+ import { resolveLanguagePair as Le } from "../voice/languagePair.js";
25
+ import { INITIAL_TRANSCRIPT_AUTO_OPEN as Re, maySendSpokenTurn as ze, planTranscriptAutoOpen as Be, planVoiceSessionBinding as Ve } from "../voice/voiceReopen.js";
26
+ import { countInlineImageCandidates as He, countInlinedImageParts as Ue, getSendableAttachments as We, largestInlineCharsPerFile as Ge, resolveAssistantInlineLimits as Ke, toMessageAttachment as qe } from "../attachments.js";
27
+ import { WRITE_PROPOSAL_VOICE_COPY as Je, isVoiceProposalBound as Ye, voiceProposalChip as Xe, voiceProposalChipText as Ze, voiceReadbacksDue as Qe, voiceWaitingProposals as $e, writeProposalVoiceLine as et, writeProposalVoiceReadback as tt } from "../writeProposalVoice.js";
28
+ import { createAdminModeAccessGate as nt, resolveAssistantSendModeAfterAccess as rt } from "../adminModeSendGate.js";
29
+ import { buildBoundedAttachmentTurn as it } from "../attachmentTurn.js";
30
+ import { isTurnInFlight as at, planAbandonedTurn as ot, planTurnAbort as st } from "../turnState.js";
31
+ import { getAssistantDisplayContent as ct } from "../displayContent.js";
32
+ import { NO_FIRST_TEXT as lt, buildAssistantProgress as ut, readAheadFor as dt, snapshotReplyFloor as ft, startSessionReadAhead as pt, trackFirstText as mt } from "../turnProgress.js";
33
+ import { parseToolActivity as ht } from "./AssistantToolActivity.js";
34
+ import { countSpokenTurns as gt, spokenMessagesSinceContinueNote as _t, spokenTurnText as vt } from "../spokenTurns.js";
35
+ import { beginTurn as yt, describeTurn as D, detectTurnDevice as bt, markTurn as O, restartAttempt as xt, turnClockMs as St } from "../turnTimeline.js";
36
+ import { useAssistantSpeech as Ct } from "./AssistantSpeechProvider.js";
37
+ import { useVoiceSession as wt } from "./useVoiceSession.js";
38
+ import { getOrganizationId as Tt, getWorkspaceId as k } from "../context.js";
39
+ import { isMultimodalBodyRejection as Et, isRecoverableAssistantError as Dt } from "../transportErrors.js";
40
+ import { createReadinessTracker as Ot, planAfterTransportFailure as kt, planTrustedSandboxFailure as At } from "../sandboxReadiness.js";
41
+ import { writeProposalConfirmState as jt } from "./writeProposalPresentation.js";
42
+ import { writeProposalUsesDialog as Mt } from "./AssistantWriteProposalCard.js";
43
+ import { AssistantWriteConfirmDialog as Nt } from "./AssistantWriteConfirmDialog.js";
44
+ import { useWriteProposalConfirm as Pt } from "./useWriteProposalConfirm.js";
45
+ import { AssistantWriteProposalSlot as Ft } from "./AssistantWriteProposalSlot.js";
46
+ import { readWriteProposalRefs as It, writeProposalsEnabledFor as Lt } from "../writeProposalDiscovery.js";
47
+ import { planWriteReply as Rt, promptWriteApproval as zt } from "../writeReplySend.js";
48
+ import { useWriteProposals as Bt } from "./useWriteProposals.js";
49
+ import { AssistantSpokenTurnsNotice as Vt } from "./AssistantSpokenTurnsNotice.js";
50
+ import { AssistantHistoryDeletedNotice as Ht, AssistantHistoryLoadState as Ut, AssistantHistoryReadOnlyBanner as Wt, AssistantHistoryShowEarlier as Gt } from "./AssistantHistoryNotices.js";
51
+ import { VoiceTranscriptDrawer as Kt } from "./voice/VoiceTranscriptDrawer.js";
52
+ import { downloadFile as qt } from "../exportConversation.js";
53
+ import { conversationHasHistory as Jt, isOtherScopeHistoryConversation as Yt, isReadOnlyHistoryConversation as Xt, isReusableHistoryDraft as Zt } from "../history/historyList.js";
54
+ import { useAssistantHistoryStatus as Qt } from "../history/historyStatus.js";
55
+ import { assistantHistory as $t } from "../history/historyEngine.js";
56
+ import { AssistantEmptyState as en } from "./AssistantEmptyState.js";
57
+ import { resumeContextFor as tn } from "../history/historyResume.js";
58
+ import { AssistantMessageList as nn } from "./AssistantMessageList.js";
59
+ import { AssistantVoiceSession as rn } from "./voice/AssistantVoiceSession.js";
60
+ import { useAssistantApiAccess as an } from "../useAssistantApiAccess.js";
61
+ import { useConversationTurns as on } from "../useConversationTurns.js";
62
+ import { sendAssistantTurnTimings as sn, startTurnTimingReporting as cn } from "../turnTimingReporter.js";
63
+ import { WarmCancelled as ln, consumeWarm as un, prewarmTarget as dn, settleWarmBeforeSend as fn, startWarm as pn, warmState as mn } from "../prewarm.js";
64
+ import { isAlreadyThere as hn, matchLocalUiCommand as gn, navDestinations as _n, planThemeChange as vn } from "../localUiCommands.js";
65
+ import { chooseDestinationCopy as yn, navigationCommandCopy as bn, themeCommandCopy as xn } from "../localUiCommandCopy.js";
66
+ import { dispatchAssistantQuotaExhausted as Sn, notifyAiCreditsUpdated as Cn } from "../aiCredits.js";
67
+ import { useAssistantAttachments as wn } from "../useAssistantAttachments.js";
68
+ import { AssistantComposer as Tn } from "./composer/AssistantComposer.js";
69
+ import { isProdRuntime as En } from "../env.js";
70
+ import { AssistantApiCallsConsentDialog as Dn } from "./AssistantApiCallsConsentDialog.js";
71
+ import { useVisibleNavItems as On } from "../../../chrome/mobileTabBar/useVisibleNavItems.js";
72
+ import { useCallback as A, useEffect as j, useMemo as kn, useRef as M, useState as An, useSyncExternalStore as jn } from "react";
73
+ import { jsx as N, jsxs as Mn } from "react/jsx-runtime";
64
74
  //#region src/shared/assistant/ui/AssistantChatArea.tsx
65
- var sn = 600, cn = 2e4, ln = 1e4;
66
- function un() {
75
+ var Nn = 600, Pn = 2e4, Fn = 1e4;
76
+ function In() {
67
77
  return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
68
78
  }
69
- var dn = ({ visible: dn = !0, writeAccess: fn = "unknown" }) => {
70
- let F = i(), { product: I, modes: L, gatherPageContext: pn, buildPrompt: mn, reportTurnTimings: hn, reportTokenUsage: gn, localUiCommands: _n } = r(), { getAccessToken: R, getWorkspaceToken: z, userId: B } = n(), { locale: vn } = t(), yn = D((e) => e.assistantLanguage), bn = D((e) => e.replyLanguage), xn = nn(() => w(yn, bn, vn), [
71
- yn,
72
- bn,
73
- vn
74
- ]), Sn = xn.reply.english, Cn = xn.replyIsExplicit, wn = xn.reply.code, { conversations: Tn, activeConversationId: V, mode: H, processingByConversationId: En, setMode: Dn, setConversationMode: On, setActiveConversation: kn, createConversation: U, addMessage: W, updateMessage: An, patchMessage: jn, mergeMessageMetadata: Mn, setConversationProcessing: Nn, clearConversationProcessing: Pn, setBackendSessionId: Fn, clearBackendSessionId: In, setSandbox: G, clearSandbox: K, acknowledgedWriteModes: Ln, acknowledgeWriteMode: Rn, autoRouting: zn, setAutoRouting: Bn, routeConversation: Vn } = D(), Hn = Tn.find((e) => e.id === V), Un = Nt(Hn), Wn = Un.all, q = V ? En[V] : void 0, Gn = Ue(q?.status), Kn = Gn ? q?.messageId ?? null : null, qn = q?.status === "error" ? q.messageId : null, Jn = wt(Hn), Yn = Et((e) => V !== null && V in e.loadingIds), Xn = Et((e) => V !== null && V in e.loadErrorIds), Zn = Et((e) => e.remoteDelete), [Qn, $n] = rn(() => Et.getState().remoteDelete?.at ?? null), er = Zn?.wasActive === !0 && Zn.at !== Qn ? Zn.at : null;
75
- M(() => {
76
- if (er === null) return;
77
- let e = window.setTimeout(() => $n(er), ln);
79
+ var Ln = ({ visible: Ln = !0, writeAccess: Rn = "unknown" }) => {
80
+ let P = i(), { product: F, modes: I, gatherPageContext: zn, buildPrompt: Bn, reportTurnTimings: Vn, reportTokenUsage: Hn, localUiCommands: Un } = r(), L = ve(r().writeApproval), Wn = A((e, t) => {
81
+ let n = b.getState(), r = t ?? n.sandboxesByMode[e]?.sandboxId ?? null;
82
+ return Ye({
83
+ mode: e,
84
+ productWriteApproval: L,
85
+ capabilities: r ? n.sandboxWriteCapabilities[r] : null
86
+ });
87
+ }, [L]), { getAccessToken: R, getWorkspaceToken: Gn, userId: z } = n(), { locale: B } = t(), Kn = b((e) => e.assistantLanguage), qn = b((e) => e.replyLanguage), Jn = kn(() => Le(Kn, qn, B), [
88
+ Kn,
89
+ qn,
90
+ B
91
+ ]), Yn = Jn.reply.english, Xn = Jn.replyIsExplicit, Zn = Jn.reply.code, { conversations: Qn, activeConversationId: V, mode: H, processingByConversationId: $n, setMode: er, setConversationMode: tr, setActiveConversation: nr, createConversation: U, addMessage: W, updateMessage: rr, patchMessage: ir, mergeMessageMetadata: ar, setConversationProcessing: or, clearConversationProcessing: sr, setBackendSessionId: cr, clearBackendSessionId: lr, setSandbox: ur, clearSandbox: dr, acknowledgedWriteModes: fr, acknowledgeWriteMode: pr, autoRouting: mr, setAutoRouting: hr, routeConversation: gr } = b(), _r = Qn.find((e) => e.id === V), vr = on(_r), yr = vr.all, G = V ? $n[V] : void 0, K = at(G?.status), br = K ? G?.messageId ?? null : null, xr = G?.status === "error" ? G.messageId : null, Sr = b((e) => e.sandboxWriteCapabilities), { panel: q, entries: Cr, retiredSandboxes: wr } = Bt({
92
+ tr: P,
93
+ productWriteApproval: L
94
+ }), Tr = Pt({
95
+ approve: (e, t) => q.approve(e, t),
96
+ decline: (e, t, n) => q.decline(e, t, n),
97
+ presented: (e, t) => q.presented(e, t)
98
+ }), Er = Tr.dismiss, Dr = M(null);
99
+ j(() => {
100
+ Er();
101
+ let e = Dr.current;
102
+ Dr.current = V, e && e !== V && q.withdraw(e, "conversation_closed"), V && q.openConversation(V);
103
+ }, [
104
+ V,
105
+ q,
106
+ Er
107
+ ]);
108
+ let Or = Xt(_r), kr = Qt((e) => V !== null && V in e.loadingIds), Ar = Qt((e) => V !== null && V in e.loadErrorIds), jr = Qt((e) => e.remoteDelete), [Mr, Nr] = An(() => Qt.getState().remoteDelete?.at ?? null), Pr = jr?.wasActive === !0 && jr.at !== Mr ? jr.at : null;
109
+ j(() => {
110
+ if (Pr === null) return;
111
+ let e = window.setTimeout(() => Nr(Pr), Fn);
78
112
  return () => window.clearTimeout(e);
79
- }, [er]);
80
- let { canUseApiCalls: tr, loading: nr } = Mt(lt()), rr = N(ke({
81
- loading: nr,
82
- canUseAdminModes: tr
83
- })).current, ir = N(L);
84
- M(() => {
85
- ir.current = L;
86
- }, [L]);
87
- let ar = () => {
88
- let e = D.getState().activeConversationId;
89
- e && Dt.openConversation(e, { modes: ir.current });
90
- }, or = () => {
91
- let e = D.getState().activeConversationId;
92
- e && Dt.loadEarlier(e);
93
- }, sr = N(R);
94
- M(() => {
95
- sr.current = R;
113
+ }, [Pr]);
114
+ let { canUseApiCalls: Fr, loading: Ir } = an(k(), z), Lr = M(nt({
115
+ loading: Ir,
116
+ canUseAdminModes: Fr
117
+ })).current, Rr = M(I);
118
+ j(() => {
119
+ Rr.current = I;
120
+ }, [I]);
121
+ let zr = () => {
122
+ let e = b.getState().activeConversationId;
123
+ e && $t.openConversation(e, { modes: Rr.current });
124
+ }, Br = () => {
125
+ let e = b.getState().activeConversationId;
126
+ e && $t.loadEarlier(e);
127
+ }, Vr = M(R);
128
+ j(() => {
129
+ Vr.current = R;
96
130
  }, [R]);
97
- let cr = !!I && hn !== !1;
98
- M(() => {
99
- if (cr) return Ft({ send: (e) => Pt(e, {
100
- workspaceId: A(),
131
+ let Hr = !!F && Vn !== !1;
132
+ j(() => {
133
+ if (Hr) return cn({ send: (e) => sn(e, {
134
+ workspaceId: k(),
101
135
  authContext: {
102
- accessToken: sr.current(),
103
- organizationId: lt()
136
+ accessToken: Vr.current(),
137
+ organizationId: Tt()
104
138
  }
105
139
  }) });
106
- }, [cr]), M(() => {
107
- rr.update({
108
- loading: nr,
109
- canUseAdminModes: tr
140
+ }, [Hr]), j(() => {
141
+ Lr.update({
142
+ loading: Ir,
143
+ canUseAdminModes: Fr
110
144
  });
111
145
  }, [
112
- rr,
113
- nr,
114
- tr
115
- ]), M(() => () => {
116
- rr.abandon();
117
- }, [rr]);
118
- let lr = nn(() => L.filter((e) => !e.requiresAdmin || tr), [L, tr]), ur = Re(lr), dr = zn && ur, fr = N(ur);
119
- M(() => {
120
- fr.current = ur;
121
- }, [ur]);
122
- let pr = N(null), mr = Ce(L), [hr, gr] = rn(null), [_r, vr] = rn(null), yr = _r !== null && _r === V, br = j((e) => {
123
- vr(e ? D.getState().activeConversationId : null);
146
+ Lr,
147
+ Ir,
148
+ Fr
149
+ ]), j(() => () => {
150
+ Lr.abandon();
151
+ }, [Lr]);
152
+ let Ur = kn(() => I.filter((e) => !e.requiresAdmin || Fr), [I, Fr]), Wr = d(Ur), Gr = mr && Wr, Kr = M(Wr);
153
+ j(() => {
154
+ Kr.current = Wr;
155
+ }, [Wr]);
156
+ let qr = M(null), Jr = M(!1), Yr = Ge(I), [Xr, Zr] = An(null), [Qr, $r] = An(null), ei = Qr !== null && Qr === V, ti = A((e) => {
157
+ $r(e ? b.getState().activeConversationId : null);
124
158
  }, []);
125
- M(() => {
126
- vr((e) => e !== null && e !== V ? null : e);
159
+ j(() => {
160
+ $r((e) => e !== null && e !== V ? null : e);
127
161
  }, [V]);
128
- let xr = N(void 0), Sr = N({}), J = N(ft()), Y = N(/* @__PURE__ */ new Set()), Cr = N(/* @__PURE__ */ new Set()), wr = nn(() => L.find((e) => e.id === H), [L, H]), Tr = H === "assistant" || wr !== void 0 && !wr.writeCapable && !te(H);
129
- M(() => {
130
- if (H !== "assistant" && wr?.writeCapable && !Me(Ln, H)) {
131
- Dn("assistant");
162
+ let ni = M(void 0), ri = M({}), J = M(Ot()), Y = M(/* @__PURE__ */ new Set()), ii = M(/* @__PURE__ */ new Set()), X = kn(() => I.find((e) => e.id === H), [I, H]), ai = b((e) => {
163
+ let t = e.sandboxesByMode[H]?.sandboxId;
164
+ return t ? e.sandboxWriteCapabilities[t] : void 0;
165
+ }), oi = X !== void 0 && Ye({
166
+ mode: H,
167
+ productWriteApproval: L,
168
+ capabilities: ai
169
+ }), si = H === "assistant" || X !== void 0 && !X.writeCapable && !pe(H) || oi;
170
+ j(() => {
171
+ if (H !== "assistant" && X?.writeCapable && !ie(fr, H)) {
172
+ er("assistant");
132
173
  return;
133
174
  }
134
- nr || (!wr || wr.requiresAdmin && !tr) && H !== "assistant" && Dn("assistant");
175
+ Ir || (!X || X.requiresAdmin && !Fr) && H !== "assistant" && er("assistant");
135
176
  }, [
136
177
  H,
137
- wr,
138
- tr,
139
- nr,
140
- Dn,
141
- Ln
178
+ X,
179
+ Fr,
180
+ Ir,
181
+ er,
182
+ fr
142
183
  ]);
143
- let Er = j((e, t, n, r) => {
144
- Nn(e, n, t, null, r);
145
- }, [Nn]), Dr = j(async (e, t, n, r, i, a = null) => {
184
+ let ci = A((e, t, n, r) => {
185
+ or(e, n, t, null, r);
186
+ }, [or]), li = A(async (e, t, n, r, i, a = null) => {
146
187
  let s = (e, t) => {
147
- r && Er(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
188
+ r && ci(r.conversationId, r.assistantMessageId, e, t), a && (a.step = t, a.onStep?.(t));
148
189
  }, c = (e) => {
149
- r && k(r.assistantMessageId, e);
150
- }, u = () => {
190
+ r && O(r.assistantMessageId, e);
191
+ }, l = () => {
151
192
  c("bootAdopted"), a?.beginBoot();
152
- }, ee = () => a !== null && (a.signal.aborted || A() !== t), f = () => {
153
- if (ee()) throw new It("cancelled");
154
- }, p = D.getState().sandboxesByMode[e]?.sandboxId ?? null, m = !1, te = !1, ne = !1, g = !1, re = !1, ie = async (r) => {
155
- if (i && !Y.current.has(r) && J.current.isFresh(r)) return m = !0, !0;
156
- ne = !0;
193
+ }, u = () => a !== null && (a.signal.aborted || k() !== t), d = () => {
194
+ if (u()) throw new ln("cancelled");
195
+ }, f = b.getState().sandboxesByMode[e]?.sandboxId ?? null, p = !1, ee = !1, m = !1, h = !1, g = !1, te = async (r) => {
196
+ if (i && !Y.current.has(r) && J.current.isFresh(r)) return p = !0, !0;
197
+ m = !0;
157
198
  let o = !1;
158
199
  try {
159
- await v(r, t, n, 3e5), await _(r, t, e, n, 9e4, () => {
160
- o = !0, u();
200
+ await _e(r, t, n, 3e5), await C(r, t, e, n, 9e4, () => {
201
+ o = !0, l();
161
202
  });
162
203
  } catch {
163
- if (ee()) throw new It("cancelled");
164
- return J.current.invalidate(r), Y.current.add(r), a?.dead.push(r), re = !0, !1;
204
+ if (u()) throw new ln("cancelled");
205
+ return J.current.invalidate(r), Y.current.add(r), a?.dead.push(r), g = !0, !1;
165
206
  }
166
- return f(), J.current.markVerified(r), o && (g = !0), !0;
207
+ return d(), J.current.markVerified(r), o && (h = !0), !0;
167
208
  };
168
- if (p && (G(e, p, "provisioning"), s("provisioning", "reusingEnvironment"), await ie(p) || (G(e, null, "provisioning"), p = null)), !p) {
209
+ if (f && (ur(e, f, "provisioning"), s("provisioning", "reusingEnvironment"), await te(f) || (ur(e, null, "provisioning"), f = null)), !f) {
169
210
  s("provisioning", "lookingForEnvironment");
170
- let r = await d(t, I, e, $t(), n, Y.current);
171
- f();
211
+ let r = await S(t, F, e, En(), n, Y.current, L);
212
+ d();
172
213
  let i = r?.id ?? null;
173
214
  if (i) {
174
- G(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
215
+ ur(e, i, "provisioning"), s("provisioning", "reusingEnvironment");
175
216
  let t = r?.status === "PROVISIONING" || r?.status === "PENDING";
176
- t && u(), await ie(i) ? (p = i, t && (g = !0)) : G(e, null, "provisioning");
217
+ t && l(), await te(i) ? (f = i, t && (h = !0)) : ur(e, null, "provisioning");
177
218
  }
178
219
  }
179
- if (!p) {
180
- if (a && !a.mayCreate) throw new It("no-create");
220
+ if (!f) {
221
+ if (a && !a.mayCreate) throw new ln("no-create");
181
222
  if (c("provisionStarted"), e === "api-calls" && !R()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
182
- s("provisioning", "startingEnvironment"), G(e, null, "provisioning");
183
- let r = a ? [] : await h(t, I, e, $t(), n, Y.current);
223
+ s("provisioning", "startingEnvironment"), ur(e, null, "provisioning");
224
+ let r = a ? [] : await he(t, F, e, En(), n, Y.current, L);
184
225
  if (r.length > 0) {
185
226
  let e = new Set(r);
186
227
  for (let e of r) J.current.invalidate(e), Y.current.add(e);
187
- let t = D.getState().sandboxesByMode;
188
- for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && K(n);
228
+ let t = b.getState().sandboxesByMode;
229
+ for (let [n, r] of Object.entries(t)) o(n) && r?.sandboxId && e.has(r.sandboxId) && dr(n);
189
230
  }
190
231
  c("createRequested");
191
232
  let i = a?.beginCreate();
192
233
  try {
193
- p = await l(I, e, t, $t(), sn, n);
234
+ f = await ce(F, e, t, En(), Nn, n, { writeApproval: L });
194
235
  } finally {
195
236
  i?.();
196
237
  }
197
- te = !0, f(), G(e, p, "provisioning"), await v(p, t, n, 3e5), f(), c("sandboxRunning"), await _(p, t, e, n, 9e4), f(), c("serviceReady"), J.current.markVerified(p);
238
+ ee = !0, d(), ur(e, f, "provisioning"), await _e(f, t, n, 3e5), d(), c("sandboxRunning"), await C(f, t, e, n, 9e4), d(), c("serviceReady"), J.current.markVerified(f);
198
239
  }
199
- return G(e, p, "running"), {
200
- sandboxId: p,
201
- sandboxIsNew: te,
202
- sandboxProbed: ne,
203
- sandboxAdopted: g,
204
- deadSandboxProbe: re,
205
- trustedFromCache: m
240
+ return ur(e, f, "running"), {
241
+ sandboxId: f,
242
+ sandboxIsNew: ee,
243
+ sandboxProbed: m,
244
+ sandboxAdopted: h,
245
+ deadSandboxProbe: g,
246
+ trustedFromCache: p
206
247
  };
207
248
  }, [
208
- K,
249
+ dr,
209
250
  R,
210
- I,
211
- G,
212
- Er
213
- ]), Or = j(async function e(t, n, r, i, a, o = {}) {
214
- let s = await zt(i, r, (e) => Er(t, n, "provisioning", e), () => k(n, "prewarmJoined"));
251
+ F,
252
+ L,
253
+ ur,
254
+ ci
255
+ ]), ui = A(async function e(t, n, r, i, a, o = {}) {
256
+ let s = await fn(i, r, (e) => ci(t, n, "provisioning", e), () => O(n, "prewarmJoined"));
215
257
  for (let e of s.dead) J.current.invalidate(e), Y.current.add(e);
216
- s.verified && !Y.current.has(s.verified) && J.current.markVerified(s.verified), s.joined && O(n, { prewarm: s.joined });
217
- let { sandboxId: c, sandboxIsNew: l, sandboxProbed: ee, sandboxAdopted: f, deadSandboxProbe: te, trustedFromCache: ne } = await Dr(r, i, a, {
258
+ s.verified && !Y.current.has(s.verified) && J.current.markVerified(s.verified), s.joined && D(n, { prewarm: s.joined });
259
+ let { sandboxId: c, sandboxIsNew: l, sandboxProbed: u, sandboxAdopted: d, deadSandboxProbe: f, trustedFromCache: p } = await li(r, i, a, {
218
260
  conversationId: t,
219
261
  assistantMessageId: n
220
- }, o.trustCache !== !1), h = Lt(i, r, c);
221
- !s.waited && h && O(n, { prewarm: "hit" });
222
- let g = D.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, _ = !1, v = null;
223
- if (g) {
224
- let e = Ze(c, g, (e, t) => p(e, i, t, r, a, { limit: 50 }));
262
+ }, o.trustCache !== !1), ee = un(i, r, c);
263
+ !s.waited && ee && D(n, { prewarm: "hit" });
264
+ let m = b.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null, h = !1, g = null;
265
+ if (m) {
266
+ let e = pt(c, m, (e, t) => de(e, i, t, r, a, { limit: 50 }));
225
267
  try {
226
- let t = await m(c, i, g, r, a);
268
+ let t = await fe(c, i, m, r, a);
227
269
  if (t.mode !== r) throw Error(`Session mode mismatch: expected ${r}, received ${t.mode}`);
228
- v = e;
270
+ g = e;
229
271
  } catch {
230
- In(t), g = null;
272
+ lr(t), m = null;
231
273
  }
232
274
  }
233
- if (!g) {
234
- Er(t, n, "connecting", "preparingSession");
275
+ if (!m) {
276
+ ci(t, n, "connecting", "preparingSession");
235
277
  let s;
236
278
  try {
237
- s = await u(c, i, r, a);
279
+ s = await x(c, i, r, a);
238
280
  } catch (s) {
239
- if (ne) {
281
+ if (p) {
240
282
  J.current.invalidate(c);
241
- let l = mt(s, o.isAbandoned?.() ?? !1), u = l === "check-network";
242
- if (l === "check-network" && (l = await pt(() => d(i, I, r, $t(), a, Y.current))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
243
- u || O(n, { cacheProofFailed: !0 }), l === "replace" && (Y.current.add(c), In(t), K(r));
283
+ let l = At(s, o.isAbandoned?.() ?? !1), p = l === "check-network";
284
+ if (l === "check-network" && (l = await kt(() => S(i, F, r, En(), a, Y.current, L))), l !== "rethrow" && o.isAbandoned?.() && (l = "rethrow"), l !== "rethrow") {
285
+ p || D(n, { cacheProofFailed: !0 }), l === "replace" && (Y.current.add(c), lr(t), dr(r), q.retireSandbox(c));
244
286
  let s = await e(t, n, r, i, a, {
245
287
  ...o,
246
288
  trustCache: !1
247
289
  });
248
- return u && (s.deadSandboxProbe || s.sandboxId !== c) && O(n, { cacheProofFailed: !0 }), {
290
+ return p && (s.deadSandboxProbe || s.sandboxId !== c) && D(n, { cacheProofFailed: !0 }), {
249
291
  ...s,
250
- sandboxProbed: s.sandboxProbed || ee,
251
- sandboxAdopted: s.sandboxAdopted || f,
252
- deadSandboxProbe: s.deadSandboxProbe || te
292
+ sandboxProbed: s.sandboxProbed || u,
293
+ sandboxAdopted: s.sandboxAdopted || d,
294
+ deadSandboxProbe: s.deadSandboxProbe || f
253
295
  };
254
296
  }
255
297
  }
256
298
  throw s;
257
299
  }
258
- g = s.sessionId, Fn(t, g), _ = !0;
300
+ m = s.sessionId, cr(t, m), h = !0;
259
301
  }
260
302
  return {
261
303
  sandboxId: c,
262
- sessionId: g,
263
- sessionIsNew: _,
264
- readAhead: v,
304
+ sessionId: m,
305
+ sessionIsNew: h,
306
+ readAhead: g,
265
307
  sandboxIsNew: l,
266
- sandboxProbed: ee,
267
- sandboxAdopted: f,
268
- deadSandboxProbe: te
308
+ sandboxProbed: u,
309
+ sandboxAdopted: d,
310
+ deadSandboxProbe: f
269
311
  };
270
312
  }, [
271
- Dr,
272
- In,
273
- K,
274
- I,
275
- Fn,
276
- Er
277
- ]), kr = j((e) => {
278
- let t = A();
313
+ li,
314
+ lr,
315
+ dr,
316
+ F,
317
+ L,
318
+ cr,
319
+ ci,
320
+ q
321
+ ]), di = A((e) => {
322
+ let t = k();
279
323
  if (!t) return;
280
- let n = D.getState(), r = Date.now(), i = Rt({
324
+ let n = b.getState(), r = Date.now(), i = dn({
281
325
  autoRouting: n.autoRouting,
282
- autoOffered: fr.current,
326
+ autoOffered: Kr.current,
283
327
  active: n.activeConversationId ? n.conversations.find((e) => e.id === n.activeConversationId) : void 0,
284
328
  selectedMode: n.mode,
285
- autoReadMode: Pe,
286
- modes: ir.current,
329
+ autoReadMode: s,
330
+ modes: Rr.current,
287
331
  acknowledgedWriteModes: n.acknowledgedWriteModes,
288
- adminAccess: rr.read(),
332
+ adminAccess: Lr.read(),
289
333
  dictated: e,
290
- turnInFlight: Object.values(n.processingByConversationId).some((e) => Ue(e?.status)),
291
- ...Vt(t),
334
+ voiceProposalBound: (e) => Wn(e),
335
+ turnInFlight: Object.values(n.processingByConversationId).some((e) => at(e?.status)),
336
+ ...mn(t),
292
337
  now: r
293
338
  });
294
339
  if (!i) return;
295
- let a = Bt(t, i, r), o = {
340
+ let a = pn(t, i, r), o = {
296
341
  accessToken: R(),
297
- workspaceToken: z(),
298
- userId: B,
299
- organizationId: lt()
342
+ workspaceToken: Gn(),
343
+ userId: z,
344
+ organizationId: Tt()
300
345
  };
301
- Dr(i.mode, t, o, null, !0, a).then((e) => a.finish({
346
+ li(i.mode, t, o, null, !0, a).then((e) => a.finish({
302
347
  ok: !0,
303
348
  sandboxId: e.sandboxId,
304
349
  didWork: !e.trustedFromCache && (e.sandboxIsNew || e.sandboxProbed || e.sandboxAdopted),
305
350
  booted: e.sandboxIsNew || e.sandboxAdopted,
306
351
  dead: a.dead
307
352
  }), (e) => {
308
- if (!(e instanceof It) && !a.signal.aborted && A() === t) {
309
- let e = D.getState().sandboxesByMode[i.mode]?.sandboxId ?? null;
310
- e && (J.current.invalidate(e), Y.current.add(e), a.dead.push(e), K(i.mode));
353
+ if (!(e instanceof ln) && !a.signal.aborted && k() === t) {
354
+ let e = b.getState().sandboxesByMode[i.mode]?.sandboxId ?? null;
355
+ e && (J.current.invalidate(e), Y.current.add(e), a.dead.push(e), dr(i.mode));
311
356
  }
312
357
  a.finish({
313
358
  ok: !1,
@@ -317,108 +362,141 @@ var dn = ({ visible: dn = !0, writeAccess: fn = "unknown" }) => {
317
362
  });
318
363
  });
319
364
  }, [
320
- Dr,
321
- rr,
322
- K,
365
+ li,
366
+ Lr,
367
+ dr,
323
368
  R,
369
+ Gn,
324
370
  z,
325
- B
326
- ]), Ar = j(() => kr(!1), [kr]), jr = an(ye, he, he)?.reference ?? null, [Mr, Nr] = rn(0), Pr = N(/* @__PURE__ */ new Set()), Fr = N(null), Ir = j(() => {
327
- let e = D.getState(), t = e.activeConversationId;
371
+ Wn
372
+ ]), fi = A(() => di(!1), [di]), pi = jn(v, g, g)?.reference ?? null, [mi, hi] = An(0), gi = M(/* @__PURE__ */ new Set()), _i = M(null), vi = A(() => {
373
+ let e = b.getState(), t = e.activeConversationId;
328
374
  if (!t) return;
329
- let n = e.processingByConversationId[t], r = Ue(n?.status) ? n?.messageId ?? null : null;
330
- if (!Ge({
375
+ let n = e.processingByConversationId[t], r = at(n?.status) ? n?.messageId ?? null : null;
376
+ if (!st({
331
377
  interruptedTurnId: r,
332
378
  activeTurnId: r,
333
- alreadyRequested: r ? Pr.current.has(r) : !1
379
+ alreadyRequested: r ? gi.current.has(r) : !1
334
380
  }).send || !r) return;
335
- Pr.current.add(r);
336
- let i = He(e), a = A(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
337
- !i || !a || !o || s(i.sandboxId, a, o, i.mode, {
381
+ gi.current.add(r);
382
+ let i = y(e), a = k(), o = e.conversations.find((e) => e.id === t)?.backendSessionId;
383
+ !i || !a || !o || oe(i.sandboxId, a, o, i.mode, {
338
384
  accessToken: R(),
339
- workspaceToken: z(),
340
- userId: B,
341
- organizationId: lt()
385
+ workspaceToken: Gn(),
386
+ userId: z,
387
+ organizationId: Tt()
342
388
  });
343
389
  }, [
344
- B,
390
+ z,
345
391
  R,
346
- z
347
- ]), Lr = j(async (e) => {
348
- let t = D.getState(), n = He(t), r = A(), i = t.activeConversationId;
349
- if (!n || !r || !i) return;
350
- let a = t.conversations.find((e) => e.id === i), o = a ? ve(y(a.messages), {
392
+ Gn
393
+ ]), yi = A(async (e) => {
394
+ let t = b.getState(), n = y(t), r = k(), i = t.activeConversationId;
395
+ if (!n || !r || !i || Lt(t.sandboxWriteCapabilities[n.sandboxId])) return;
396
+ let a = t.conversations.find((e) => e.id === i), o = a ? ne(Ae(a.messages), {
351
397
  sessionId: a.backendSessionId,
352
398
  sandboxId: n.sandboxId,
353
399
  nowMs: Date.now()
354
400
  }) : null;
355
401
  if (o?.reference !== e) {
356
- Nr((e) => e + 1);
402
+ hi((e) => e + 1);
357
403
  return;
358
404
  }
359
405
  let s = {
360
406
  conversationId: i,
361
407
  reference: e
362
408
  };
363
- if (!pe(s)) return;
409
+ if (!m(s)) return;
364
410
  try {
365
- await c(n.sandboxId, r, e, n.mode, {
411
+ await se(n.sandboxId, r, e, n.mode, {
366
412
  accessToken: R(),
367
- workspaceToken: z(),
368
- userId: B,
369
- organizationId: lt()
413
+ workspaceToken: Gn(),
414
+ userId: z,
415
+ organizationId: Tt()
370
416
  });
371
417
  } catch (e) {
372
- me(s), W(i, {
373
- id: un(),
418
+ h(s), W(i, {
419
+ id: In(),
374
420
  role: "system",
375
421
  content: e instanceof Error ? e.message : "The change could not be approved.",
376
422
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
377
423
  });
378
424
  return;
379
425
  }
380
- me(s), Mn(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
381
- let l = D.getState(), u = l.conversations.find((e) => e.id === i);
382
- l.activeConversationId !== i || !u || l.mode !== n.mode || u.backendSessionId !== a?.backendSessionId || He(l)?.sandboxId !== n.sandboxId || Ue(l.processingByConversationId[i]?.status) || _e(y(u.messages)) !== o.messageId || Kr.current(F("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
426
+ h(s), ar(i, o.messageId, { pendingWriteApprovedAt: (/* @__PURE__ */ new Date()).toISOString() });
427
+ let c = b.getState(), l = c.conversations.find((e) => e.id === i);
428
+ c.activeConversationId !== i || !l || c.mode !== n.mode || l.backendSessionId !== a?.backendSessionId || y(c)?.sandboxId !== n.sandboxId || at(c.processingByConversationId[i]?.status) || _(Ae(l.messages)) !== o.messageId || Ai.current(P("pendingWrite.approvedPrompt", "I approved that change — go ahead."), [], {
383
429
  approvalFollowUp: { approvedReplyId: o.messageId },
384
430
  targetConversationId: i
385
431
  });
386
432
  }, [
387
- B,
433
+ z,
388
434
  W,
389
- Mn,
390
- F
391
- ]), Rr = e(), { speakFinishedReply: zr } = st(), Br = a(), { items: Vr } = tn(), Hr = N({
392
- theme: Rr,
393
- navigate: Br,
394
- navItems: Vr,
395
- options: _n ?? {}
435
+ ar,
436
+ P
437
+ ]), bi = e(), { speakFinishedReply: xi } = Ct(), Si = a(), { items: Ci } = On(), wi = M({
438
+ theme: bi,
439
+ navigate: Si,
440
+ navItems: Ci,
441
+ options: Un ?? {}
396
442
  });
397
- M(() => {
398
- Hr.current = {
399
- theme: Rr,
400
- navigate: Br,
401
- navItems: Vr,
402
- options: _n ?? {}
443
+ j(() => {
444
+ wi.current = {
445
+ theme: bi,
446
+ navigate: Si,
447
+ navItems: Ci,
448
+ options: Un ?? {}
403
449
  };
404
450
  }, [
405
- Rr,
406
- Br,
407
- Vr,
408
- _n
451
+ bi,
452
+ Si,
453
+ Ci,
454
+ Un
409
455
  ]);
410
- let Ur = j((e, t, n) => {
411
- let { theme: r, navigate: i } = Hr.current, a, o;
456
+ let Ti = A((e, t, n, r, i) => {
457
+ let a = P(n.key, n.fallback, r), o = n.fallback.replace(/\{\{\s*count\s*\}\}/g, String(r.count)), s = {
458
+ kind: "write-reply",
459
+ line: n.key
460
+ }, c = (/* @__PURE__ */ new Date()).toISOString(), l = In();
461
+ W(e, {
462
+ id: l,
463
+ role: "user",
464
+ content: t,
465
+ timestamp: c,
466
+ metadata: {
467
+ localAction: s,
468
+ ...T(i)
469
+ }
470
+ });
471
+ let u = In();
472
+ W(e, {
473
+ id: u,
474
+ role: "assistant",
475
+ content: a,
476
+ timestamp: c,
477
+ metadata: {
478
+ lang: a === o ? "en" : B,
479
+ localAction: s,
480
+ ...T(i)
481
+ }
482
+ }), $t.recordCommittedEntries(e, [l, u], "LOCAL_COMMAND", k()), xi(e, u);
483
+ }, [
484
+ W,
485
+ B,
486
+ xi,
487
+ P
488
+ ]), Ei = A((e, t, n) => {
489
+ let { theme: r, navigate: i } = wi.current, a, o;
412
490
  if (e.kind === "theme") {
413
491
  if (!r) return !1;
414
- let t = Gt(e.request, {
492
+ let t = vn(e.request, {
415
493
  mode: r.mode,
416
494
  resolvedTheme: r.resolvedTheme
417
495
  });
418
496
  if (!t.alreadyApplied) try {
419
497
  r.setMode(t.mode);
420
498
  } catch {}
421
- a = Jt(F, t, e.request.kind === "family"), o = {
499
+ a = xn(P, t, e.request.kind === "family"), o = {
422
500
  kind: "theme",
423
501
  mode: t.mode,
424
502
  alreadyApplied: t.alreadyApplied
@@ -426,19 +504,19 @@ var dn = ({ visible: dn = !0, writeAccess: fn = "unknown" }) => {
426
504
  } else {
427
505
  if (!i) return !1;
428
506
  if (e.kind === "navigate") {
429
- let { destination: t } = e, n = Ht(t, window.location.pathname + window.location.search, Wt(Hr.current.navItems));
430
- n || i(t.path), a = qt(F, t.label, n), o = {
507
+ let { destination: t } = e, n = hn(t, window.location.pathname + window.location.search, _n(wi.current.navItems));
508
+ n || i(t.path), a = bn(P, t.label, n), o = {
431
509
  kind: "navigate",
432
510
  destinationId: t.id,
433
511
  path: t.path,
434
512
  alreadyHere: n
435
513
  };
436
- } else a = Kt(F, e.candidates[0]?.label ?? e.query, e.candidates), o = {
514
+ } else a = yn(P, e.candidates[0]?.label ?? e.query, e.candidates), o = {
437
515
  kind: "choose-destination",
438
516
  candidateIds: e.candidates.map((e) => e.id)
439
517
  };
440
518
  }
441
- let s = D.getState(), c = s.activeConversationId ?? U(void 0, s.autoRouting && fr.current ? "assistant" : s.mode, s.autoRouting ? { routedBy: "auto" } : void 0), l = (/* @__PURE__ */ new Date()).toISOString(), u = un();
519
+ let s = b.getState(), c = s.activeConversationId ?? U(void 0, s.autoRouting && Kr.current ? "assistant" : s.mode, s.autoRouting ? { routedBy: "auto" } : void 0), l = (/* @__PURE__ */ new Date()).toISOString(), u = In();
442
520
  W(c, {
443
521
  id: u,
444
522
  role: "user",
@@ -446,33 +524,45 @@ var dn = ({ visible: dn = !0, writeAccess: fn = "unknown" }) => {
446
524
  timestamp: l,
447
525
  metadata: {
448
526
  localAction: o,
449
- ...x(n)
527
+ ...T(n)
450
528
  }
451
529
  });
452
- let ee = un();
530
+ let d = In();
453
531
  return W(c, {
454
- id: ee,
532
+ id: d,
455
533
  role: "assistant",
456
534
  content: a.text,
457
535
  timestamp: l,
458
536
  metadata: {
459
- lang: a.translated ? vn : "en",
537
+ lang: a.translated ? B : "en",
460
538
  localAction: o,
461
- ...x(n)
539
+ ...T(n)
462
540
  }
463
- }), Dt.recordCommittedEntries(c, [u, ee], "LOCAL_COMMAND", A()), zr(c, ee), !0;
541
+ }), $t.recordCommittedEntries(c, [u, d], "LOCAL_COMMAND", k()), xi(c, d), !0;
464
542
  }, [
465
543
  W,
466
544
  U,
467
- vn,
468
- zr,
469
- F
470
- ]), X = j(async (e, t = [], n = {}) => {
471
- let r = n.voiceSessionId !== void 0, i = D.getState(), a = i.activeConversationId ?? V;
545
+ B,
546
+ xi,
547
+ P
548
+ ]), Di = A(async (e) => {
549
+ Jr.current = !0;
550
+ try {
551
+ await q.declineForReply(e.conversationId, e.reason, e.origin);
552
+ } finally {
553
+ Jr.current = !1;
554
+ }
555
+ if (e.commandText !== null) {
556
+ let t = gn(e.commandText, _n(wi.current.navItems), wi.current.options);
557
+ if (t && Ei(t, e.content, e.options.voiceSessionId)) return;
558
+ }
559
+ await Ai.current(e.content, e.attachments, e.options);
560
+ }, [Ei, q]), Z = A(async (e, t = [], n = {}) => {
561
+ let r = n.voiceSessionId !== void 0, i = b.getState(), a = i.activeConversationId ?? V;
472
562
  if (a) {
473
- if (Ue(i.processingByConversationId[a]?.status)) {
563
+ if (at(i.processingByConversationId[a]?.status)) {
474
564
  let r = i.processingByConversationId[a]?.messageId ?? null;
475
- r && Pr.current.has(r) && (Fr.current = {
565
+ r && gi.current.has(r) && (_i.current = {
476
566
  conversationId: a,
477
567
  content: e,
478
568
  attachments: t,
@@ -480,319 +570,383 @@ var dn = ({ visible: dn = !0, writeAccess: fn = "unknown" }) => {
480
570
  });
481
571
  return;
482
572
  }
483
- if (Cr.current.has(a)) return;
573
+ if (ii.current.has(a)) return;
484
574
  }
485
- if (pr.current || he() !== null) return;
486
- let o = n.targetConversationId, c = Be(), l = (e) => wt(e) || Ct(e, c);
575
+ if (qr.current || g() !== null || Jr.current) return;
576
+ let o = n.targetConversationId, s = p(), c = (e) => Xt(e) || Yt(e, s);
487
577
  if (o !== void 0) {
488
578
  let e = i.conversations.find((e) => e.id === o);
489
- if (i.activeConversationId !== o || !e || e.mode !== i.mode || l(e)) return;
579
+ if (i.activeConversationId !== o || !e || e.mode !== i.mode || c(e)) return;
580
+ }
581
+ if (n.fromPerson && n.writeReplyBound === void 0) {
582
+ let r = o ?? i.activeConversationId ?? null, a = n.voiceSessionId === void 0 ? "typed" : "spoken", s = Rt({
583
+ text: e,
584
+ locale: a === "spoken" ? Jn.input.code : B,
585
+ origin: a,
586
+ hasAttachments: t.length > 0,
587
+ live: q.liveFor(r),
588
+ matchesLocalCommand: (e) => gn(e, _n(wi.current.navItems), wi.current.options) !== null
589
+ });
590
+ if (s.kind === "local_reply") {
591
+ r && Ti(r, e, s.line, s.values, n.voiceSessionId);
592
+ return;
593
+ }
594
+ let c = s.kind === "local" ? s.fallback : s.bound, l = s.declineAll;
595
+ if (l !== null && r) return Di({
596
+ conversationId: r,
597
+ reason: l,
598
+ origin: a,
599
+ commandText: s.kind === "local" ? s.commandText : null,
600
+ content: e,
601
+ attachments: t,
602
+ options: {
603
+ ...n,
604
+ writeReplyBound: c
605
+ }
606
+ });
607
+ n = {
608
+ ...n,
609
+ writeReplyBound: c
610
+ };
490
611
  }
491
- if (n.fromPerson && t.length === 0) {
492
- let t = Ut(e, Wt(Hr.current.navItems), Hr.current.options);
493
- if (t && Ur(t, e, n.voiceSessionId)) return;
612
+ let d = n.writeReplyBound?.promptText ?? e;
613
+ if (n.fromPerson && t.length === 0 && n.writeReplyBound?.localCommands !== !1) {
614
+ let t = gn(e, _n(wi.current.navItems), wi.current.options);
615
+ if (t && Ei(t, e, n.voiceSessionId)) return;
494
616
  }
495
- let u = i.activeConversationId ? i.conversations.find((e) => e.id === i.activeConversationId) : void 0, d = l(u) ? void 0 : u, m = i.autoRouting && fr.current && o === void 0 ? ze({
496
- intent: n.autoIntent ?? Ie(e),
617
+ let ee = i.activeConversationId ? i.conversations.find((e) => e.id === i.activeConversationId) : void 0, m = c(ee) ? void 0 : ee, h = i.autoRouting && Kr.current && o === void 0 ? f({
618
+ intent: n.autoIntent ?? l(e),
497
619
  dictated: r,
498
- conversation: d ? {
499
- mode: d.mode,
500
- routedBy: d.routedBy,
501
- hasHistory: St(d)
620
+ voiceProposalBound: r && Wn("api-calls") && ie(i.acknowledgedWriteModes, "api-calls"),
621
+ conversation: m ? {
622
+ mode: m.mode,
623
+ routedBy: m.routedBy,
624
+ hasHistory: Jt(m)
502
625
  } : null
503
626
  }) : null;
504
- if (m && ir.current.find((e) => e.id === m.mode)?.writeCapable && !Me(i.acknowledgedWriteModes, m.mode)) {
505
- pr.current = {
627
+ if (h && Rr.current.find((e) => e.id === h.mode)?.writeCapable && !ie(i.acknowledgedWriteModes, h.mode)) {
628
+ qr.current = {
506
629
  content: e,
507
630
  attachments: t,
508
631
  options: n
509
- }, gr(m.mode);
632
+ }, Zr(h.mode);
510
633
  return;
511
634
  }
512
- let h = m ? m.mode : i.mode, _, v, y = o ?? V, b = y ? D.getState().conversations.find((e) => e.id === y) : void 0, ae = m?.action === "escalate" && d ? {
513
- mode: d.mode,
514
- backendSessionId: d.backendSessionId ?? null
635
+ let _ = h ? h.mode : i.mode, ne, re, v = o ?? V, y = v ? b.getState().conversations.find((e) => e.id === v) : void 0, se = h?.action === "escalate" && m ? {
636
+ mode: m.mode,
637
+ backendSessionId: m.backendSessionId ?? null
515
638
  } : null;
516
- if (m) m.action === "new" || !d ? y = U(void 0, h, { routedBy: "auto" }) : (y = d.id, Vn(y, h));
639
+ if (h) h.action === "new" || !m ? v = U(void 0, _, { routedBy: "auto" }) : (v = m.id, gr(v, _));
517
640
  else {
518
641
  let e = i.autoRouting ? { routedBy: "auto" } : void 0;
519
- !y || l(b) || b && b.mode !== h && St(b) ? y = U(void 0, h, e) : b && b.mode !== h && (e ? Vn(y, h) : On(y, h));
642
+ !v || c(y) || y && y.mode !== _ && Jt(y) ? v = U(void 0, _, e) : y && y.mode !== _ && (e ? gr(v, _) : tr(v, _));
520
643
  }
521
- if (!y) return;
522
- r && xr.current !== void 0 && y !== i.activeConversationId && (xr.current = y), n.approvalFollowUp || (Sr.current[y] = t);
523
- let oe = () => D.getState().conversations.some((e) => e.id === y), S = A(), C = {
644
+ if (!v) return;
645
+ r && ni.current !== void 0 && v !== i.activeConversationId && (ni.current = v), n.approvalFollowUp || (ri.current[v] = t);
646
+ let ce = () => b.getState().conversations.some((e) => e.id === v), x = k(), S = {
524
647
  accessToken: R(),
525
- workspaceToken: z(),
526
- userId: B,
527
- organizationId: lt()
528
- }, ce = (e, t) => {
529
- oe() || !S || s(e, S, t, h, {
648
+ workspaceToken: Gn(),
649
+ userId: z,
650
+ organizationId: Tt()
651
+ }, fe = (e, t) => {
652
+ ce() || !x || oe(e, x, t, _, {
530
653
  accessToken: R(),
531
- workspaceToken: z(),
532
- userId: B,
533
- organizationId: lt()
654
+ workspaceToken: Gn(),
655
+ userId: z,
656
+ organizationId: Tt()
534
657
  });
535
- }, le = {
536
- id: un(),
658
+ }, he = {
659
+ id: In(),
537
660
  role: "user",
538
661
  content: e,
539
662
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
540
663
  metadata: {
541
- ...t.length ? { attachments: t.map(Te) } : {},
664
+ ...t.length ? { attachments: t.map(qe) } : {},
542
665
  ...n.approvalFollowUp ? {
543
666
  approvalFollowUp: !0,
544
667
  approvedReplyId: n.approvalFollowUp.approvedReplyId
545
668
  } : {},
546
- ...x(n.voiceSessionId)
669
+ ...T(n.voiceSessionId)
547
670
  }
548
671
  };
549
- W(y, le);
550
- let w = un();
551
- W(y, {
552
- id: w,
672
+ W(v, he);
673
+ let C = In();
674
+ W(v, {
675
+ id: C,
553
676
  role: "assistant",
554
677
  content: "",
555
678
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
556
679
  metadata: {
557
- lang: wn,
558
- ...x(n.voiceSessionId)
680
+ lang: Zn,
681
+ ...T(n.voiceSessionId)
559
682
  }
560
- }), rt(w, {
683
+ }), yt(C, {
561
684
  channel: r ? "voice" : "chat",
562
- mode: h,
563
- product: I,
564
- language: wn,
565
- device: it(),
566
- routedByAuto: !!m
567
- }, n.voiceTiming), k(w, "accepted"), Nn(y, "provisioning", w, null), ge(w);
568
- let ue = () => We({
569
- turnId: w,
570
- abortRequested: Pr.current.has(w),
571
- activeTurnId: D.getState().processingByConversationId[y]?.messageId ?? null,
572
- conversationExists: oe()
573
- }), de = (e, t, r, i, a = !1, o = wn) => {
574
- jn(y, w, { content: re(e) }), Mn(y, w, {
685
+ mode: _,
686
+ product: F,
687
+ language: Zn,
688
+ device: bt(),
689
+ routedByAuto: !!h
690
+ }, n.voiceTiming), O(C, "accepted"), or(v, "provisioning", C, null), te(C);
691
+ let _e = () => ot({
692
+ turnId: C,
693
+ abortRequested: gi.current.has(C),
694
+ activeTurnId: b.getState().processingByConversationId[v]?.messageId ?? null,
695
+ conversationExists: ce()
696
+ }), ve = (e, t, r, i, a = !1, o = Zn) => {
697
+ ir(v, C, { content: ye(e) }), ar(v, C, {
575
698
  lang: o,
576
699
  ...t?.length ? { artifacts: t } : {},
577
- ...t?.length || r || i ? { mode: h } : {},
700
+ ...t?.length || r || i ? { mode: _ } : {},
578
701
  ...r ? { sessionId: r } : {},
579
702
  ...i ? { sandboxId: i } : {},
580
703
  ...a ? { incomplete: !0 } : {},
581
- ...x(n.voiceSessionId)
704
+ ...T(n.voiceSessionId)
582
705
  });
583
- }, fe = async (n = 1) => {
584
- k(w, "attemptStarted");
585
- let i = null, a = null, o = !1;
706
+ }, Ae = { session: null }, w = async (i = 1) => {
707
+ O(C, "attemptStarted");
708
+ let a = null, o = null, s = !1;
586
709
  try {
587
- let { sandboxId: n, sessionId: s, sessionIsNew: c, readAhead: l, sandboxIsNew: u, sandboxProbed: d, sandboxAdopted: m, deadSandboxProbe: te } = await Or(y, w, h, S, C, { isAbandoned: () => We({
588
- turnId: w,
589
- abortRequested: Pr.current.has(w),
590
- activeTurnId: D.getState().processingByConversationId[y]?.messageId ?? null,
591
- conversationExists: oe()
710
+ let { sandboxId: i, sessionId: c, sessionIsNew: l, readAhead: u, sandboxIsNew: f, sandboxProbed: p, sandboxAdopted: ee, deadSandboxProbe: m } = await ui(v, C, _, x, S, { isAbandoned: () => ot({
711
+ turnId: C,
712
+ abortRequested: gi.current.has(C),
713
+ activeTurnId: b.getState().processingByConversationId[v]?.messageId ?? null,
714
+ conversationExists: ce()
592
715
  }).abandon });
593
- i = n, k(w, "runtimeReady"), O(w, {
594
- runtime: u ? "cold" : m ? "adopted" : d ? "probed" : c ? "new-session" : "warm",
595
- deadSandboxProbe: te
596
- }), a = s;
597
- let b = kt({
598
- conversation: D.getState().conversations.find((e) => e.id === y),
716
+ if (a = i, O(C, "runtimeReady"), D(C, {
717
+ runtime: f ? "cold" : ee ? "adopted" : p ? "probed" : l ? "new-session" : "warm",
718
+ deadSandboxProbe: m
719
+ }), o = c, Ae.session = {
720
+ sandboxId: i,
721
+ sessionId: c
722
+ }, ae(_, ne, b.getState().acknowledgedWriteModes, {
723
+ dictated: r,
724
+ confirmsWrites: pe(_),
725
+ proposalBound: Wn(_, i)
726
+ }) === "voice-in-write-mode") throw new be("voice-in-write-mode", "Voice in a write mode");
727
+ let h = tn({
728
+ conversation: b.getState().conversations.find((e) => e.id === v),
599
729
  content: e,
600
- sessionIsNew: c,
601
- sendingMode: h,
602
- sendingModeConfig: _,
603
- modes: ir.current,
604
- answerText: (e) => $e(e).text
605
- }), x = await Xe(() => p(n, S, s, h, C, { limit: 50 }), c, Ye(l, n, s));
606
- Er(y, w, "streaming", "thinking");
607
- let ae = pn?.(), { prompt: fe, parts: T } = je({
608
- content: b ? `${b}${e}` : e,
730
+ sessionIsNew: l,
731
+ sendingMode: _,
732
+ sendingModeConfig: ne,
733
+ modes: Rr.current,
734
+ answerText: (e) => ht(e).text
735
+ }), g = await ft(() => de(i, x, c, _, S, { limit: 50 }), l, dt(u, i, c));
736
+ ci(v, C, "streaming", "thinking");
737
+ let te = zn?.(), ie = zt(b.getState().sandboxWriteCapabilities[i]), y = {
738
+ conversationId: v,
739
+ writeReply: ie === "proposal-v1" ? n.writeReplyBound?.writeReply ?? null : null
740
+ }, { prompt: oe, parts: se } = it({
741
+ content: h ? `${h}${d}` : d,
609
742
  attachments: t,
610
- limits: we(_),
611
- wrapPrompt: (e) => mn?.(h, e, Sn, Cn, r) ?? e,
612
- requestBytes: (e, t) => ne({
613
- sandboxId: n,
614
- workspaceId: S,
615
- sessionId: s,
616
- mode: h,
743
+ limits: Ke(ne),
744
+ wrapPrompt: (e) => Bn?.(_, e, Yn, Xn, r, { writeApproval: ie }) ?? e,
745
+ requestBytes: (e, t) => me({
746
+ sandboxId: i,
747
+ workspaceId: x,
748
+ sessionId: c,
749
+ mode: _,
617
750
  prompt: e,
618
751
  parts: t,
619
- pageContext: ae,
620
- authContext: C
752
+ pageContext: te,
753
+ authContext: S,
754
+ ...y
621
755
  })
622
- }), pe = xe(T), me = pe > 0;
623
- o = be(t) > pe;
624
- let he = ue();
625
- if (he.abandon) {
626
- he.clearProcessing && Pn(y);
756
+ }), xe = Ue(se), Se = xe > 0;
757
+ s = He(t) > xe;
758
+ let Ce = _e();
759
+ if (Ce.abandon) {
760
+ Ce.clearProcessing && sr(v);
627
761
  return;
628
762
  }
629
763
  try {
630
- await g(n, S, s, fe, h, ae, C, T?.length ? { parts: T } : void 0);
764
+ await ge(i, x, c, oe, _, te, S, se?.length ? {
765
+ parts: se,
766
+ ...y
767
+ } : y);
631
768
  } catch (e) {
632
- if (!T || !ut(e)) throw e;
633
- await g(n, S, s, fe, h, ae, C, void 0), o ||= me;
769
+ if (!se || !Et(e)) throw e;
770
+ await ge(i, x, c, oe, _, te, S, y), s ||= Se;
634
771
  }
635
- k(w, "promptSent");
636
- let ge = null, _e = !1, ve = qe, E = Je([], x), ye = Date.now() + v.streamBudgetMs, Se = Date.now(), Ce = Date.now();
637
- for (; Date.now() < ye;) {
638
- ce(n, s);
639
- let e = ue();
772
+ O(C, "promptSent");
773
+ let Te = null, De = !1, Oe = lt, w = ut([], g), T = Date.now() + re.streamBudgetMs, E = Date.now(), je = Date.now();
774
+ for (; Date.now() < T;) {
775
+ fe(i, c);
776
+ let e = _e();
640
777
  if (e.abandon) {
641
- e.clearProcessing && Pn(y);
778
+ e.clearProcessing && sr(v);
642
779
  return;
643
780
  }
644
- if (E = Je(await p(n, S, s, h, C, {
781
+ if (w = ut(await de(i, x, c, _, S, {
645
782
  limit: 50,
646
- sinceMs: x
647
- }), x, { accumulateNarration: v.accumulatesNarration }), jn(y, w, { content: re(E.content) }), E.hasRenderableOutput ? _e || (_e = !0, ge !== null && k(w, "lastQuietPoll", ge), k(w, "firstOutput")) : ge = ot(), v.accumulatesNarration) E.hasText && k(w, "firstText");
783
+ sinceMs: g
784
+ }), g, { accumulateNarration: re.accumulatesNarration }), ir(v, C, { content: ye(w.content) }), w.hasRenderableOutput ? De || (De = !0, Te !== null && O(C, "lastQuietPoll", Te), O(C, "firstOutput")) : Te = St(), re.accumulatesNarration) w.hasText && O(C, "firstText");
648
785
  else {
649
- let e = Qe(ve, E, ot());
650
- ve = e.tracker, e.confirmedAt !== null && k(w, "firstText", e.confirmedAt);
786
+ let e = mt(Oe, w, St());
787
+ Oe = e.tracker, e.confirmedAt !== null && O(C, "firstText", e.confirmedAt);
651
788
  }
652
- if (E.pendingWrite && Mn(y, w, { pendingWrite: E.pendingWrite }), E.done) {
653
- k(w, "answerDone"), J.current.markVerified(n);
789
+ if (w.pendingWrite && !Lt(b.getState().sandboxWriteCapabilities[i]) && ar(v, C, { pendingWrite: w.pendingWrite }), w.done) {
790
+ O(C, "answerDone"), J.current.markVerified(i);
654
791
  break;
655
792
  }
656
- Date.now() - Se > 3e4 && (await ee(n, S, 600, C).catch(() => void 0), Se = Date.now()), await new Promise((e) => setTimeout(e, se(Date.now() - Ce)));
793
+ Date.now() - E > 3e4 && (await le(i, x, 600, S).catch(() => void 0), E = Date.now()), await new Promise((e) => setTimeout(e, Pe(Date.now() - je)));
657
794
  }
658
- let Te = v.producesArtifacts ? await f(n, S, s, h, C).then((e) => e).catch(() => []) : void 0;
659
- E.usedTools !== void 0 && O(w, { usedTools: E.usedTools }), E.done || (O(w, { outcome: "timedOut" }), E = {
660
- ...E,
661
- content: ie(E.content, h, F, _)
662
- }), o && (E = {
663
- ...E,
664
- content: `${E.content}\n\n${F("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
795
+ let Me = re.producesArtifacts ? await ue(i, x, c, _, S).then((e) => e).catch(() => []) : void 0;
796
+ w.usedTools !== void 0 && D(C, { usedTools: w.usedTools }), w.done || (D(C, { outcome: "timedOut" }), w = {
797
+ ...w,
798
+ content: ke(w.content, _, P, ne)
799
+ }), s && (w = {
800
+ ...w,
801
+ content: `${w.content}\n\n${P("attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
665
802
  });
666
- let Ee = !E.done;
667
- if (de(E.content, Te, s, n, Ee), E.tokens) {
668
- jn(y, w, { tokens: E.tokens });
669
- try {
670
- await gn?.({
671
- workspaceId: S,
672
- sessionId: s,
673
- messageId: E.messageId,
674
- model: E.model,
675
- tokens: E.tokens
676
- }), Xt(I);
677
- } catch {}
678
- }
679
- E.done || ce(n, s);
680
- let De = ue();
681
- if (De.abandon) {
682
- De.clearProcessing && Pn(y);
803
+ let Ne = !w.done;
804
+ ve(w.content, Me, c, i, Ne), w.tokens && (ir(v, C, { tokens: w.tokens }), (Hn ? await Ee({
805
+ workspaceId: x,
806
+ sessionId: c,
807
+ messageId: w.messageId,
808
+ model: w.model,
809
+ tokens: w.tokens
810
+ }, Hn, { ledger: we("panel", F) }) : { ok: !0 }).ok && Cn(F)), w.done || fe(i, c);
811
+ let Fe = _e();
812
+ if (Fe.abandon) {
813
+ Fe.clearProcessing && sr(v);
683
814
  return;
684
815
  }
685
- k(w, "complete"), O(w, { outcome: "answered" }), Nn(y, "complete", w, null), Dt.recordCommittedEntries(y, [le.id, w], "TURN", S);
816
+ O(C, "complete"), D(C, { outcome: "answered" }), or(v, "complete", C, null), $t.recordCommittedEntries(v, [he.id, C], "TURN", x);
686
817
  } catch (e) {
687
- J.current.invalidate(i ?? D.getState().sandboxesByMode[h]?.sandboxId ?? null);
688
- let t = We({
689
- turnId: w,
690
- abortRequested: Pr.current.has(w),
691
- activeTurnId: D.getState().processingByConversationId[y]?.messageId ?? null,
692
- conversationExists: oe()
818
+ J.current.invalidate(a ?? b.getState().sandboxesByMode[_]?.sandboxId ?? null);
819
+ let t = ot({
820
+ turnId: C,
821
+ abortRequested: gi.current.has(C),
822
+ activeTurnId: b.getState().processingByConversationId[v]?.messageId ?? null,
823
+ conversationExists: ce()
693
824
  });
694
- if (i && a && ce(i, a), t.abandon) {
695
- t.clearProcessing && Pn(y);
825
+ if (a && o && fe(a, o), t.abandon) {
826
+ t.clearProcessing && sr(v);
696
827
  return;
697
828
  }
698
- if (n === 1 && dt(e)) {
699
- let e = i ?? D.getState().sandboxesByMode[h]?.sandboxId ?? null;
700
- return e && (Y.current.add(e), J.current.invalidate(e)), In(y), K(h), An(y, w, ""), Mn(y, w, { pendingWrite: void 0 }), at(w), fe(2);
829
+ if (i === 1 && Dt(e)) {
830
+ let e = a ?? b.getState().sandboxesByMode[_]?.sandboxId ?? null;
831
+ return e && (Y.current.add(e), J.current.invalidate(e)), lr(v), dr(_), rr(v, C, ""), ar(v, C, { pendingWrite: void 0 }), e && q.retireSandbox(e), xt(C), w(2);
701
832
  }
702
833
  throw e;
703
834
  }
704
- }, T = y;
705
- Cr.current.add(T);
835
+ }, E = v;
836
+ ii.current.add(E);
706
837
  try {
707
- if (!S) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
838
+ if (!x) throw Object.assign(/* @__PURE__ */ Error("Assistant backend is unavailable without an active workspace context."), { extensions: {
708
839
  code: "UNAUTHENTICATED",
709
840
  authFailure: "WORKSPACE_CONTEXT_MISSING"
710
841
  } });
711
- let e = await Ae(h, () => ir.current.find((e) => e.id === h), rr);
712
- _ = e.config, v = e.capabilities;
713
- let t = _, n = ue();
842
+ let e = await rt(_, () => Rr.current.find((e) => e.id === _), Lr);
843
+ ne = e.config, re = e.capabilities;
844
+ let t = ne, n = _e();
714
845
  if (n.abandon) {
715
- n.clearProcessing && Pn(y);
846
+ n.clearProcessing && sr(v);
716
847
  return;
717
848
  }
718
- let i = Ne(h, t, D.getState().acknowledgedWriteModes, {
849
+ let i = ae(_, t, b.getState().acknowledgedWriteModes, {
719
850
  dictated: r,
720
- confirmsWrites: te(h)
851
+ confirmsWrites: pe(_),
852
+ proposalBound: Wn(_)
721
853
  });
722
- if (i) throw new Ee(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
723
- k(w, "cleared"), await fe();
854
+ if (i) throw new be(i, i === "confirm-write-mode" ? "Write mode not confirmed" : "Voice in a write mode");
855
+ let a = we("panel", F);
856
+ if (Hn && Te(a, x)) {
857
+ let e = await De(a, x, Hn);
858
+ if (!e.ok) throw Oe(e.kind);
859
+ let t = _e();
860
+ if (t.abandon) {
861
+ t.clearProcessing && sr(v);
862
+ return;
863
+ }
864
+ }
865
+ O(C, "cleared"), await w();
724
866
  } catch (e) {
725
- if (J.current.invalidate(D.getState().sandboxesByMode[h]?.sandboxId ?? null), !oe()) {
726
- Pn(y);
867
+ if (J.current.invalidate(b.getState().sandboxesByMode[_]?.sandboxId ?? null), !ce()) {
868
+ sr(v);
727
869
  return;
728
870
  }
729
- let t = De(e);
730
- O(w, { outcome: t.kind === "temporary" ? "failed" : "refused" }), t.offersUpgrade && Yt(I, "sandbox");
731
- let r = Oe(t, F);
732
- Nn(y, "error", w, r.headline), jn(y, w, { content: r.text }), Mn(y, w, {
733
- lang: r.translated ? vn : "en",
734
- ...x(n.voiceSessionId)
871
+ let t = Ae.session?.sandboxId ?? null, r = xe(e, { confirmsNoAction: Se({
872
+ mode: _,
873
+ capabilities: t ? b.getState().sandboxWriteCapabilities[t] : null
874
+ }) });
875
+ D(C, { outcome: r.kind === "temporary" ? "failed" : "refused" }), r.offersUpgrade && Sn(F, "sandbox");
876
+ let i = Ce(r, P);
877
+ or(v, "error", C, i.headline), ir(v, C, { content: i.text }), ar(v, C, {
878
+ lang: i.translated ? B : "en",
879
+ ...T(n.voiceSessionId)
735
880
  });
736
881
  } finally {
737
- Cr.current.delete(T), O(w, { outcome: "stopped" }), k(w, "complete");
738
- let e = D.getState(), t = Le(ae, h, e.conversations.find((e) => e.id === T), (t) => !!e.sandboxesByMode[t]?.sandboxId);
739
- t && (Vn(T, t.mode), t.backendSessionId && Fn(T, t.backendSessionId));
740
- let n = Fr.current;
741
- Fr.current = null, n && n.conversationId === T && oe() && Kr.current(n.content, n.attachments, n.options);
882
+ ii.current.delete(E), D(C, { outcome: "stopped" }), O(C, "complete");
883
+ let e = b.getState(), t = u(se, _, e.conversations.find((e) => e.id === E), (t) => !!e.sandboxesByMode[t]?.sandboxId);
884
+ t && (gr(E, t.mode), t.backendSessionId && cr(E, t.backendSessionId)), Ae.session && ce() && q.afterTurn({
885
+ ...Ae.session,
886
+ conversationId: E
887
+ }, C);
888
+ let n = _i.current;
889
+ _i.current = null, n && n.conversationId === E && ce() && Ai.current(n.content, n.attachments, n.options);
742
890
  }
743
891
  }, [
744
892
  V,
745
893
  W,
746
- mn,
747
- In,
748
- K,
749
- Tn,
894
+ Bn,
895
+ lr,
896
+ dr,
897
+ Qn,
750
898
  U,
751
- Or,
752
- pn,
899
+ ui,
900
+ q,
901
+ Ti,
902
+ Di,
903
+ B,
904
+ Jn,
905
+ Wn,
906
+ zn,
753
907
  R,
754
- z,
755
- jn,
756
- I,
757
- rr,
758
- gn,
759
- Cn,
760
- vn,
761
- wn,
762
- Sn,
763
- Vn,
764
- Ur,
765
- Fn,
766
- On,
767
- Nn,
768
- Pn,
908
+ Gn,
909
+ ir,
769
910
  F,
770
- Er,
771
- An,
772
- B
773
- ]), Wr = j((e, t) => {
774
- X(e, [], t ? { autoIntent: t } : {});
775
- }, [X]), Gr = j(() => {
776
- let e = [...Un.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
911
+ Lr,
912
+ Hn,
913
+ Xn,
914
+ B,
915
+ Zn,
916
+ Yn,
917
+ gr,
918
+ Ei,
919
+ cr,
920
+ tr,
921
+ or,
922
+ sr,
923
+ P,
924
+ ci,
925
+ rr,
926
+ z
927
+ ]), Oi = A((e, t) => {
928
+ Z(e, [], t ? { autoIntent: t } : {});
929
+ }, [Z]), ki = A(() => {
930
+ let e = [...vr.chat].reverse().find((e) => e.role === "user" && !e.metadata?.localAction);
777
931
  if (!e || e.metadata?.approvalFollowUp) return;
778
- let t = V ? Sr.current[V] ?? [] : [];
779
- X(e.content, t);
932
+ let t = V ? ri.current[V] ?? [] : [];
933
+ Z(e.content, t);
780
934
  }, [
781
- Wn,
782
- X,
935
+ yr,
936
+ Z,
783
937
  V
784
- ]), Kr = N(X);
785
- M(() => {
786
- Kr.current = X;
787
- }, [X]);
788
- let qr = nn(() => {
789
- if (Gn) return null;
790
- for (let e = Wn.length - 1; e >= 0; --e) {
791
- let t = Wn[e];
792
- if (t?.role !== "assistant" || !b(t) || Pr.current.has(t.id)) continue;
793
- let n = Ke(t, q, F);
938
+ ]), Ai = M(Z);
939
+ j(() => {
940
+ Ai.current = Z;
941
+ }, [Z]);
942
+ let ji = kn(() => {
943
+ if (K) return null;
944
+ for (let e = yr.length - 1; e >= 0; --e) {
945
+ let t = yr[e];
946
+ if (t?.role !== "assistant" || !w(t) || gi.current.has(t.id)) continue;
947
+ let n = ct(t, G, P);
794
948
  if (n.kind !== "output") return null;
795
- let r = $e(n.text).text.trim();
949
+ let r = ht(n.text).text.trim();
796
950
  return r ? {
797
951
  id: t.id,
798
952
  text: r
@@ -800,53 +954,70 @@ var dn = ({ visible: dn = !0, writeAccess: fn = "unknown" }) => {
800
954
  }
801
955
  return null;
802
956
  }, [
803
- Wn,
804
- Gn,
805
- q,
806
- F
807
- ]), Jr = nn(() => qr ? ce(qr.text) : null, [qr]), Z = Un.chat, Yr = D((e) => He(e)?.sandboxId ?? null), Xr = ve(Z, {
808
- sessionId: Hn?.backendSessionId,
809
- sandboxId: Yr,
957
+ yr,
958
+ K,
959
+ G,
960
+ P
961
+ ]), Mi = kn(() => ji ? Fe(ji.text) : null, [ji]), Ni = vr.chat, Pi = b((e) => y(e)?.sandboxId ?? null), Fi = ne(Ni, {
962
+ sessionId: _r?.backendSessionId,
963
+ sandboxId: Pi,
810
964
  nowMs: Date.now()
811
- }), Zr = E(Z), Qr = Xr?.expiresAtMs ?? null;
812
- M(() => {
813
- if (Qr === null) return;
814
- let e = window.setTimeout(() => Nr((e) => e + 1), Math.max(0, Qr - Date.now()));
965
+ }), Ii = re(Ni), Li = (e) => {
966
+ if (It(e.metadata).length > 0) return !0;
967
+ let t = e.metadata?.sandboxId;
968
+ return Lt(t ? Sr[t] : null);
969
+ }, Ri = (e) => {
970
+ let t = It(e.metadata);
971
+ return t.length === 0 || !V ? null : /* @__PURE__ */ N(Ft, {
972
+ refs: t,
973
+ conversationId: V,
974
+ panel: q,
975
+ entries: Cr,
976
+ capabilitiesOf: (e) => Sr[e],
977
+ turnInFlight: K,
978
+ tr: P,
979
+ onReview: Tr.review,
980
+ retiredSandboxes: wr
981
+ });
982
+ }, zi = Tr.dialog.view ? Cr[Tr.dialog.view.proposalId] : void 0, Bi = Fi?.expiresAtMs ?? null;
983
+ j(() => {
984
+ if (Bi === null) return;
985
+ let e = window.setTimeout(() => hi((e) => e + 1), Math.max(0, Bi - Date.now()));
815
986
  return () => window.clearTimeout(e);
816
- }, [Qr, Mr]);
817
- let Q = nn(() => Un.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
987
+ }, [Bi, mi]);
988
+ let Q = kn(() => vr.voice.filter((e) => e.role === "user" || e.role === "assistant").map((e) => ({
818
989
  id: e.id,
819
990
  role: e.role,
820
- text: nt(e, q, F),
821
- sessionId: ae(e),
991
+ text: vt(e, G, P),
992
+ sessionId: E(e),
822
993
  timestamp: e.timestamp
823
994
  })).filter((e) => e.text.length > 0), [
824
- Un.voice,
825
- q,
826
- F
827
- ]), $r = j(() => {
995
+ vr.voice,
996
+ G,
997
+ P
998
+ ]), Vi = A(() => {
828
999
  if (Q.length === 0) return;
829
1000
  let e = /* @__PURE__ */ new Date();
830
- xt(S(Q, {
831
- title: F("voiceSession.transcript", "Voice conversation"),
832
- savedAt: F("voiceSession.savedAt", "Saved"),
833
- session: F("voiceSession.sessionLabel", "Session"),
834
- earlier: F("voiceSession.earlierLabel", "Earlier"),
835
- you: F("voiceSession.speakerYou", "You"),
836
- assistant: F("voiceSession.speakerAssistant", "Assistant")
837
- }, e), C(I, e), "text/markdown");
1001
+ qt(Me(Q, {
1002
+ title: P("voiceSession.transcript", "Voice conversation"),
1003
+ savedAt: P("voiceSession.savedAt", "Saved"),
1004
+ session: P("voiceSession.sessionLabel", "Session"),
1005
+ earlier: P("voiceSession.earlierLabel", "Earlier"),
1006
+ you: P("voiceSession.speakerYou", "You"),
1007
+ assistant: P("voiceSession.speakerAssistant", "Assistant")
1008
+ }, e), Ne(F, e), "text/markdown");
838
1009
  }, [
839
- I,
1010
+ F,
840
1011
  Q,
841
- F
842
- ]), ei = Zt({ perFileChars: mr }), ti = N(ei);
843
- ti.current = ei;
844
- let ni = N(/* @__PURE__ */ new Set()), ri = N(() => !1), $ = ct({
845
- onSubmit: j((e, t, n) => {
846
- let r = xr.current, i = () => {
847
- let i = ti.current, a = D.getState();
848
- if (!de({
849
- sessionLive: ri.current(t),
1012
+ P
1013
+ ]), Hi = wn({ perFileChars: Yr }), Ui = M(Hi);
1014
+ Ui.current = Hi;
1015
+ let Wi = M(/* @__PURE__ */ new Set()), Gi = M(() => !1), $ = wt({
1016
+ onSubmit: A((e, t, n) => {
1017
+ let r = ni.current, i = () => {
1018
+ let i = Ui.current, a = b.getState();
1019
+ if (!ze({
1020
+ sessionLive: Gi.current(t),
850
1021
  boundAtSubmit: r,
851
1022
  activeConversationId: a.activeConversationId,
852
1023
  boundConversationExists: a.conversations.some((e) => e.id === r)
@@ -854,277 +1025,367 @@ var dn = ({ visible: dn = !0, writeAccess: fn = "unknown" }) => {
854
1025
  i.clear();
855
1026
  return;
856
1027
  }
857
- let o = Se(i.attachments), s = {
1028
+ let o = We(i.attachments), s = {
858
1029
  ...n,
859
- handedOver: ot()
1030
+ handedOver: St()
860
1031
  };
861
- Kr.current(e, o, {
1032
+ Ai.current(e, o, {
862
1033
  fromPerson: !0,
863
1034
  voiceSessionId: t,
864
1035
  voiceTiming: s
865
1036
  }), i.clear();
866
1037
  };
867
- if (!ti.current.isBusy) {
1038
+ if (!Ui.current.isBusy) {
868
1039
  i();
869
1040
  return;
870
1041
  }
871
- let a = Date.now(), o = ni.current, s = window.setInterval(() => {
872
- ti.current.isBusy && Date.now() - a < cn || (window.clearInterval(s), o.delete(s), i());
1042
+ let a = Date.now(), o = Wi.current, s = window.setInterval(() => {
1043
+ Ui.current.isBusy && Date.now() - a < Pn || (window.clearInterval(s), o.delete(s), i());
873
1044
  }, 200);
874
1045
  o.add(s);
875
1046
  }, []),
876
- latestReply: qr,
877
- language: le(yn, vn).tag
1047
+ latestReply: ji,
1048
+ language: Ie(Kn, B).tag
878
1049
  });
879
- ri.current = $.isCurrentSession;
880
- let ii = N(!1);
881
- M(() => {
882
- ii.current = $.active;
883
- }, [$.active]), M(() => Ve((e) => {
884
- if (!ii.current) return !1;
885
- let t = xr.current;
886
- return typeof t == "string" ? t === e : D.getState().activeConversationId === e;
1050
+ Gi.current = $.isCurrentSession;
1051
+ let Ki = $.active, qi = kn(() => $e(Object.values(Cr), V, wr), [
1052
+ Cr,
1053
+ V,
1054
+ wr
1055
+ ]), [Ji, Yi] = An(null);
1056
+ j(() => {
1057
+ Ki || Yi(null);
1058
+ }, [Ki]);
1059
+ let Xi = Tr.review, Zi = A(() => {
1060
+ let e = qi[qi.length - 1];
1061
+ if (!e) return;
1062
+ let { view: t } = e;
1063
+ if (Mt(t) && jt(t, Sr[e.session.sandboxId]).offerConfirm) {
1064
+ Xi(t);
1065
+ return;
1066
+ }
1067
+ Yi(t.proposalId);
1068
+ }, [
1069
+ qi,
1070
+ Sr,
1071
+ Xi
1072
+ ]), Qi = Ki ? Xe(qi) : null, $i = Ji ? Cr[Ji] : void 0, ea = Ki && $i && $i.session.conversationId === V ? {
1073
+ content: /* @__PURE__ */ N(Ft, {
1074
+ refs: [{
1075
+ proposalId: $i.view.proposalId,
1076
+ sandboxId: $i.session.sandboxId,
1077
+ sessionId: $i.session.sessionId
1078
+ }],
1079
+ conversationId: $i.session.conversationId,
1080
+ panel: q,
1081
+ entries: Cr,
1082
+ capabilitiesOf: (e) => Sr[e],
1083
+ turnInFlight: K,
1084
+ tr: P,
1085
+ onReview: Xi,
1086
+ retiredSandboxes: wr
1087
+ }),
1088
+ closeLabel: et(P, Je.trayClose),
1089
+ onClose: () => Yi(null)
1090
+ } : null, ta = Tr.asking, na = $.holdListening;
1091
+ j(() => {
1092
+ na(Ki && ta);
1093
+ }, [
1094
+ Ki,
1095
+ ta,
1096
+ na
1097
+ ]);
1098
+ let ra = M(null), ia = $.announce;
1099
+ j(() => {
1100
+ if (!Ki) {
1101
+ ra.current = null;
1102
+ return;
1103
+ }
1104
+ let e = ra.current;
1105
+ if (e === null) {
1106
+ ra.current = new Set(Object.keys(Cr));
1107
+ return;
1108
+ }
1109
+ for (let { view: t, session: n } of Qe(qi, e)) {
1110
+ e.add(t.proposalId);
1111
+ let r = Sr[n.sandboxId];
1112
+ if (!Ye({
1113
+ mode: "api-calls",
1114
+ productWriteApproval: L,
1115
+ capabilities: r
1116
+ })) continue;
1117
+ let i = tt(t, jt(t, r).offerConfirm, P), a = t.proposalId;
1118
+ ia({
1119
+ id: `write-readback:${a}`,
1120
+ text: i.text,
1121
+ lang: i.translated ? B : "en",
1122
+ stillWanted: () => q.entry(a)?.view.status === "pending"
1123
+ });
1124
+ }
1125
+ }, [
1126
+ Ki,
1127
+ qi,
1128
+ Cr,
1129
+ Sr,
1130
+ L,
1131
+ P,
1132
+ B,
1133
+ ia,
1134
+ q
1135
+ ]);
1136
+ let aa = M(!1);
1137
+ j(() => {
1138
+ aa.current = $.active;
1139
+ }, [$.active]), j(() => ee((e) => {
1140
+ if (!aa.current) return !1;
1141
+ let t = ni.current;
1142
+ return typeof t == "string" ? t === e : b.getState().activeConversationId === e;
887
1143
  }), []);
888
- let ai = $.start, oi = j(() => {
889
- kr(!0), ai();
890
- }, [kr, ai]), si = nn(() => tt(Hn?.messages ?? []), [Hn?.messages]), ci = et(Un.voice, q, F), li = et(si, q, F) > 0, ui = j(() => {
891
- let e = D.getState().activeConversationId;
1144
+ let oa = $.start, sa = A(() => {
1145
+ di(!0), oa();
1146
+ }, [di, oa]), ca = kn(() => _t(_r?.messages ?? []), [_r?.messages]), la = gt(vr.voice, G, P), ua = gt(ca, G, P) > 0, da = A(() => {
1147
+ let e = b.getState().activeConversationId;
892
1148
  if (!e || Q.length === 0) return;
893
- let t = new Set(si.map((e) => e.id)), n = un();
1149
+ let t = new Set(ca.map((e) => e.id)), n = In();
894
1150
  W(e, {
895
1151
  id: n,
896
1152
  role: "system",
897
- content: oe(Q.filter((e) => t.has(e.id)), {
898
- intro: F("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
899
- nothing: F("voiceSession.continuedNothing", "Continued from a voice conversation."),
900
- more: (e) => F("voiceSession.continuedMore", "…and {{count}} more", { count: e })
1153
+ content: je(Q.filter((e) => t.has(e.id)), {
1154
+ intro: P("voiceSession.continuedIntro", "Continued from a voice conversation. You asked about:"),
1155
+ nothing: P("voiceSession.continuedNothing", "Continued from a voice conversation."),
1156
+ more: (e) => P("voiceSession.continuedMore", "…and {{count}} more", { count: e })
901
1157
  }),
902
1158
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
903
- metadata: { continuedVoiceTurns: ci }
904
- }), Dt.recordCommittedEntries(e, [n], "NOTE", A()), br(!1), $.end();
1159
+ metadata: { continuedVoiceTurns: la }
1160
+ }), $t.recordCommittedEntries(e, [n], "NOTE", k()), ti(!1), $.end();
905
1161
  }, [
906
1162
  Q,
907
- ci,
908
- si,
1163
+ la,
1164
+ ca,
909
1165
  W,
910
- F,
1166
+ P,
911
1167
  $,
912
- br
913
- ]), di = N(0);
914
- M(() => {
915
- $.active && (di.current = ci);
1168
+ ti
1169
+ ]), fa = M(0);
1170
+ j(() => {
1171
+ $.active && (fa.current = la);
916
1172
  }, [$.active]);
917
- let fi = j(() => {
918
- let e = ci > di.current;
919
- $.end(), e && br(!0);
1173
+ let pa = A(() => {
1174
+ let e = la > fa.current;
1175
+ $.end(), e && ti(!0);
920
1176
  }, [
921
- ci,
1177
+ la,
922
1178
  $,
923
- br
1179
+ ti
924
1180
  ]);
925
- M(() => {
926
- (!dn || !Tr) && $.active && $.end();
1181
+ j(() => {
1182
+ (!Ln || !si) && $.active && $.end();
927
1183
  }, [
928
- dn,
929
- Tr,
1184
+ Ln,
1185
+ si,
930
1186
  $
931
- ]), M(() => {
932
- let e = xr.current, t = D.getState(), n = T({
1187
+ ]), j(() => {
1188
+ let e = ni.current, t = b.getState(), n = Ve({
933
1189
  sessionLive: $.active,
934
1190
  bound: e,
935
1191
  activeConversationId: t.activeConversationId,
936
1192
  boundConversationExists: t.conversations.some((t) => t.id === e)
937
1193
  });
938
- xr.current = n.bound, n.end && $.end();
1194
+ ni.current = n.bound, n.end && $.end();
939
1195
  }, [
940
1196
  $,
941
1197
  V,
942
- Tn
1198
+ Qn
943
1199
  ]);
944
- let pi = N(ue);
945
- M(() => {
946
- let e = fe(pi.current, {
1200
+ let ma = M(Re);
1201
+ j(() => {
1202
+ let e = Be(ma.current, {
947
1203
  activeConversationId: V,
948
- chatTurnCount: Z.length,
1204
+ chatTurnCount: Ni.length,
949
1205
  voiceTurnCount: Q.length,
950
1206
  sessionLive: $.active,
951
- sessionBoundTo: xr.current,
952
- turnInFlight: Gn
1207
+ sessionBoundTo: ni.current,
1208
+ turnInFlight: K
953
1209
  });
954
- pi.current = e.state, e.open && br(!0);
1210
+ ma.current = e.state, e.open && ti(!0);
955
1211
  }, [
956
1212
  V,
957
- Z.length,
1213
+ Ni.length,
958
1214
  Q.length,
959
1215
  $.active,
960
- Gn,
961
- br
962
- ]), M(() => {
1216
+ K,
1217
+ ti
1218
+ ]), j(() => {
963
1219
  if (!$.active) {
964
- ti.current.clear(), Fr.current = null;
965
- for (let e of ni.current) window.clearInterval(e);
966
- ni.current.clear();
1220
+ Ui.current.clear(), _i.current = null;
1221
+ for (let e of Wi.current) window.clearInterval(e);
1222
+ Wi.current.clear();
967
1223
  }
968
- }, [$.active]), M(() => {
969
- let e = ni.current;
1224
+ }, [$.active]), j(() => {
1225
+ let e = Wi.current;
970
1226
  return () => {
971
1227
  for (let t of e) window.clearInterval(t);
972
1228
  e.clear();
973
1229
  };
974
- }, []), M(() => {
975
- let e = D.getState().consumePendingPrompt();
976
- return e && Kr.current(e), D.subscribe((e, t) => {
1230
+ }, []), j(() => {
1231
+ let e = b.getState().consumePendingPrompt();
1232
+ return e && Ai.current(e), b.subscribe((e, t) => {
977
1233
  if (e.pendingPrompt && e.pendingPrompt !== t.pendingPrompt) {
978
- let e = D.getState().consumePendingPrompt();
979
- e && Kr.current(e);
1234
+ let e = b.getState().consumePendingPrompt();
1235
+ e && Ai.current(e);
980
1236
  }
981
1237
  });
982
1238
  }, []);
983
- let mi = j((e) => {
984
- let t = V ? D.getState().conversations.find((e) => e.id === V) : void 0;
985
- if (t && St(t)) {
1239
+ let ha = A((e) => {
1240
+ let t = V ? b.getState().conversations.find((e) => e.id === V) : void 0;
1241
+ if (t && t.mode !== e && q.withdraw(t.id, "mode_switched"), t && Jt(t)) {
986
1242
  if (t.mode !== e) {
987
- let t = Be(), n = D.getState().conversations.find((n) => n.mode === e && Tt(n, t) && !D.getState().processingByConversationId[n.id]);
988
- n ? kn(n.id) : U(void 0, e);
1243
+ let t = p(), n = b.getState().conversations.find((n) => n.mode === e && Zt(n, t) && !b.getState().processingByConversationId[n.id]);
1244
+ n ? nr(n.id) : U(void 0, e);
989
1245
  }
990
- } else V && On(V, e);
991
- let n = D.getState().activeConversationId;
992
- n ? On(n, e) : Bn(!1), Dn(e);
1246
+ } else V && tr(V, e);
1247
+ let n = b.getState().activeConversationId;
1248
+ n ? tr(n, e) : hr(!1), er(e);
993
1249
  }, [
994
1250
  V,
995
1251
  U,
996
- kn,
997
- Bn,
998
- On,
999
- Dn
1000
- ]), hi = j(() => {
1001
- let e = D.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
1252
+ nr,
1253
+ hr,
1254
+ tr,
1255
+ er,
1256
+ q
1257
+ ]), ga = A(() => {
1258
+ let e = b.getState(), t = e.activeConversationId ? e.conversations.find((t) => t.id === e.activeConversationId) : void 0;
1002
1259
  if (!t) {
1003
- Bn(!0), Dn(Pe);
1260
+ hr(!0), er(s);
1004
1261
  return;
1005
1262
  }
1006
1263
  if (t.routedBy === "auto") {
1007
- Bn(!0);
1264
+ hr(!0);
1008
1265
  return;
1009
1266
  }
1010
- if (!St(t)) {
1011
- Vn(t.id, Pe);
1267
+ if (!Jt(t)) {
1268
+ gr(t.id, s);
1012
1269
  return;
1013
1270
  }
1014
- let n = Be(), r = e.conversations.find((t) => t.routedBy === "auto" && Tt(t, n) && !e.processingByConversationId[t.id]);
1015
- r ? (kn(r.id), Vn(r.id, Pe)) : U(void 0, Pe, { routedBy: "auto" });
1271
+ q.withdraw(t.id, "mode_switched");
1272
+ let n = p(), r = e.conversations.find((t) => t.routedBy === "auto" && Zt(t, n) && !e.processingByConversationId[t.id]);
1273
+ r ? (nr(r.id), gr(r.id, s)) : U(void 0, s, { routedBy: "auto" });
1016
1274
  }, [
1017
1275
  U,
1018
- Vn,
1019
- kn,
1020
- Bn,
1021
- Dn
1022
- ]), gi = j((e) => {
1023
- if (L.find((t) => t.id === e)?.writeCapable && !Me(D.getState().acknowledgedWriteModes, e)) {
1024
- gr(e);
1276
+ gr,
1277
+ nr,
1278
+ hr,
1279
+ er,
1280
+ q
1281
+ ]), _a = A((e) => {
1282
+ if (I.find((t) => t.id === e)?.writeCapable && !ie(b.getState().acknowledgedWriteModes, e)) {
1283
+ Zr(e);
1025
1284
  return;
1026
1285
  }
1027
- mi(e);
1028
- }, [mi, L]), _i = j(() => {
1029
- let e = hr;
1030
- if (gr(null), !e) return;
1031
- let t = pr.current;
1032
- if (pr.current = null, t) {
1033
- Rn(e), X(t.content, t.attachments, t.options);
1286
+ ha(e);
1287
+ }, [ha, I]), va = A(() => {
1288
+ let e = Xr;
1289
+ if (Zr(null), !e) return;
1290
+ let t = qr.current;
1291
+ if (qr.current = null, t) {
1292
+ pr(e), Z(t.content, t.attachments, t.options);
1034
1293
  return;
1035
1294
  }
1036
- Rn(e), mi(e);
1295
+ pr(e), ha(e);
1037
1296
  }, [
1038
- hr,
1039
- Rn,
1040
- mi,
1041
- X
1042
- ]), vi = hr === null ? void 0 : L.find((e) => e.id === hr) ?? { id: hr }, yi = j(() => {
1043
- gr(null);
1044
- let e = pr.current;
1045
- pr.current = null, e && X(e.content, e.attachments, {
1297
+ Xr,
1298
+ pr,
1299
+ ha,
1300
+ Z
1301
+ ]), ya = Xr === null ? void 0 : I.find((e) => e.id === Xr) ?? { id: Xr }, ba = A(() => {
1302
+ Zr(null);
1303
+ let e = qr.current;
1304
+ qr.current = null, e && Z(e.content, e.attachments, {
1046
1305
  ...e.options,
1047
1306
  autoIntent: "read"
1048
1307
  });
1049
- }, [X]);
1050
- return /* @__PURE__ */ on("div", {
1308
+ }, [Z]);
1309
+ return /* @__PURE__ */ Mn("div", {
1051
1310
  className: "relative flex flex-1 flex-col overflow-hidden",
1052
1311
  children: [
1053
- /* @__PURE__ */ on("div", {
1312
+ /* @__PURE__ */ Mn("div", {
1054
1313
  className: "contents",
1055
1314
  inert: $.active || void 0,
1056
1315
  children: [
1057
- er === null ? null : /* @__PURE__ */ P(gt, { onDismiss: () => $n(er) }),
1058
- Q.length > 0 && !$.active ? /* @__PURE__ */ P(ht, {
1316
+ Pr === null ? null : /* @__PURE__ */ N(Ht, { onDismiss: () => Nr(Pr) }),
1317
+ Q.length > 0 && !$.active ? /* @__PURE__ */ N(Vt, {
1059
1318
  count: Q.length,
1060
- onOpenTranscript: () => br(!0)
1319
+ onOpenTranscript: () => ti(!0)
1061
1320
  }) : null,
1062
- Z.length === 0 && (Yn || Xn) ? /* @__PURE__ */ P(_t, {
1063
- state: Yn ? "loading" : "failed",
1064
- onRetry: ar
1065
- }) : Z.length === 0 && Hn?.sync?.hasOlder ? /* @__PURE__ */ P("div", {
1321
+ Ni.length === 0 && (kr || Ar) ? /* @__PURE__ */ N(Ut, {
1322
+ state: kr ? "loading" : "failed",
1323
+ onRetry: zr
1324
+ }) : Ni.length === 0 && _r?.sync?.hasOlder ? /* @__PURE__ */ N("div", {
1066
1325
  className: "flex min-h-0 flex-1 flex-col",
1067
- children: /* @__PURE__ */ P(yt, {
1068
- onShowEarlier: or,
1069
- disabled: Yn
1326
+ children: /* @__PURE__ */ N(Gt, {
1327
+ onShowEarlier: Br,
1328
+ disabled: kr
1070
1329
  })
1071
- }) : Z.length === 0 ? /* @__PURE__ */ P(Ot, {
1330
+ }) : Ni.length === 0 ? /* @__PURE__ */ N(en, {
1072
1331
  mode: H,
1073
- onSuggestionClick: Wr,
1074
- explainsAuto: dr,
1075
- suggestions: dr && H === "assistant" ? Fe(L.find((e) => e.id === "assistant")?.suggestions ?? [], L.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
1076
- }) : /* @__PURE__ */ on("div", {
1332
+ onSuggestionClick: Oi,
1333
+ explainsAuto: Gr,
1334
+ suggestions: Gr && H === "assistant" ? c(I.find((e) => e.id === "assistant")?.suggestions ?? [], I.find((e) => e.id === "api-calls")?.suggestions ?? []) : void 0
1335
+ }) : /* @__PURE__ */ Mn("div", {
1077
1336
  className: "flex min-h-0 flex-1 flex-col",
1078
- children: [Hn?.sync?.hasOlder ? /* @__PURE__ */ P(yt, {
1079
- onShowEarlier: or,
1080
- disabled: Yn
1081
- }) : null, /* @__PURE__ */ P(At, {
1082
- onApprovePendingWrite: Lr,
1083
- approvingWriteRef: jr,
1084
- approvableMessageId: Xr?.messageId ?? null,
1085
- retryableMessageId: Zr,
1086
- messages: Z,
1087
- processing: q ?? null,
1088
- streamingMessageId: Kn,
1089
- failedMessageId: qn,
1090
- onRetry: jr === null ? Gr : void 0
1337
+ children: [_r?.sync?.hasOlder ? /* @__PURE__ */ N(Gt, {
1338
+ onShowEarlier: Br,
1339
+ disabled: kr
1340
+ }) : null, /* @__PURE__ */ N(nn, {
1341
+ onApprovePendingWrite: yi,
1342
+ approvingWriteRef: pi,
1343
+ approvableMessageId: Fi?.messageId ?? null,
1344
+ retryableMessageId: Ii,
1345
+ messages: Ni,
1346
+ processing: G ?? null,
1347
+ streamingMessageId: br,
1348
+ failedMessageId: xr,
1349
+ onRetry: pi === null ? ki : void 0,
1350
+ renderWriteProposals: Ri,
1351
+ hidesLegacyWriteCard: Li
1091
1352
  })]
1092
1353
  }),
1093
- Jn ? /* @__PURE__ */ P(vt, { onStartNew: () => U() }) : null,
1094
- Z.length > 0 && (Yn || Xn) ? /* @__PURE__ */ P(_t, {
1095
- state: Yn ? "loading" : "failed",
1096
- onRetry: ar,
1354
+ Or ? /* @__PURE__ */ N(Wt, { onStartNew: () => U() }) : null,
1355
+ Ni.length > 0 && (kr || Ar) ? /* @__PURE__ */ N(Ut, {
1356
+ state: kr ? "loading" : "failed",
1357
+ onRetry: zr,
1097
1358
  compact: !0
1098
1359
  }) : null,
1099
- /* @__PURE__ */ P(Qt, {
1100
- onStartVoiceSession: $.available && Tr ? oi : void 0,
1101
- onSend: (e, t) => void X(e, t, { fromPerson: !0 }),
1102
- onDraftStart: Ar,
1103
- disabled: Gn || jr !== null || Yn,
1104
- readOnly: Jn,
1105
- placeholder: H === "api-calls" ? F("chatArea.placeholderActions", "What would you like me to do?") : F("chatArea.placeholderGeneral", "Ask me anything…"),
1360
+ /* @__PURE__ */ N(Tn, {
1361
+ onStartVoiceSession: $.available && si ? sa : void 0,
1362
+ onSend: (e, t) => void Z(e, t, { fromPerson: !0 }),
1363
+ onDraftStart: fi,
1364
+ disabled: K || pi !== null || kr,
1365
+ readOnly: Or,
1366
+ placeholder: H === "api-calls" ? P("chatArea.placeholderActions", "What would you like me to do?") : P("chatArea.placeholderGeneral", "Ask me anything…"),
1106
1367
  mode: H,
1107
- writeAccessDenied: fn === "denied" && !!wr?.writeCapable,
1108
- availableModes: lr,
1109
- attachmentCharsPerFile: mr,
1110
- onModeChange: gi,
1111
- auto: ur ? {
1112
- active: dr,
1113
- onSelect: hi
1368
+ writeAccessDenied: Rn === "denied" && !!X?.writeCapable,
1369
+ availableModes: Ur,
1370
+ attachmentCharsPerFile: Yr,
1371
+ onModeChange: _a,
1372
+ auto: Wr ? {
1373
+ active: Gr,
1374
+ onSelect: ga
1114
1375
  } : void 0
1115
1376
  })
1116
1377
  ]
1117
1378
  }),
1118
- yr && !$.active ? /* @__PURE__ */ P(bt, {
1379
+ ei && !$.active ? /* @__PURE__ */ N(Kt, {
1119
1380
  turns: Q,
1120
- onClose: () => br(!1),
1121
- onSave: $r,
1122
- onContinueInChat: li ? ui : void 0,
1381
+ onClose: () => ti(!1),
1382
+ onSave: Vi,
1383
+ onContinueInChat: ua ? da : void 0,
1123
1384
  closeOnEscape: !0,
1124
- onShowEarlier: Hn?.sync?.hasOlder ? or : void 0,
1125
- showEarlierDisabled: Yn
1385
+ onShowEarlier: _r?.sync?.hasOlder ? Br : void 0,
1386
+ showEarlierDisabled: kr
1126
1387
  }) : null,
1127
- $.active && /* @__PURE__ */ P(jt, {
1388
+ $.active && /* @__PURE__ */ N(rn, {
1128
1389
  session: $.session,
1129
1390
  notice: $.notice,
1130
1391
  capturing: $.capturing,
@@ -1132,30 +1393,43 @@ var dn = ({ visible: dn = !0, writeAccess: fn = "unknown" }) => {
1132
1393
  awaitingEndpoint: $.awaitingEndpoint,
1133
1394
  turns: Q,
1134
1395
  spokenChunks: $.spokenChunks,
1135
- attachments: ei.attachments,
1136
- onAttachFiles: ei.addFiles,
1137
- onRemoveAttachment: ei.remove,
1138
- onRetryAttachment: ei.retry,
1139
- canAttachMore: ei.canAddMore,
1140
- preparingAttachments: ei.preparingCount,
1141
- onSaveTranscript: $r,
1142
- onContinueInChat: ui,
1396
+ attachments: Hi.attachments,
1397
+ onAttachFiles: Hi.addFiles,
1398
+ onRemoveAttachment: Hi.remove,
1399
+ onRetryAttachment: Hi.retry,
1400
+ canAttachMore: Hi.canAddMore,
1401
+ preparingAttachments: Hi.preparingCount,
1402
+ onSaveTranscript: Vi,
1403
+ onContinueInChat: da,
1143
1404
  onInterrupt: () => {
1144
- $.interrupt(), Ir();
1405
+ $.interrupt(), vi();
1145
1406
  },
1146
- spoken: Jr,
1407
+ spoken: Mi,
1147
1408
  onToggleMute: $.toggleMute,
1148
- onEnd: fi
1409
+ onEnd: pa,
1410
+ proposalChip: Qi ? {
1411
+ label: Ze(Qi, P),
1412
+ onOpen: Zi
1413
+ } : null,
1414
+ proposalTray: ea
1415
+ }),
1416
+ /* @__PURE__ */ N(Dn, {
1417
+ open: Xr !== null,
1418
+ mode: ya,
1419
+ currentMode: X ?? { id: H },
1420
+ onConfirm: va,
1421
+ onCancel: ba
1149
1422
  }),
1150
- /* @__PURE__ */ P(en, {
1151
- open: hr !== null,
1152
- mode: vi,
1153
- currentMode: wr ?? { id: H },
1154
- onConfirm: _i,
1155
- onCancel: yi
1423
+ /* @__PURE__ */ N(Nt, {
1424
+ ...Tr.dialog,
1425
+ view: zi?.view ?? Tr.dialog.view,
1426
+ serverNow: zi?.serverNow ?? NaN,
1427
+ capabilities: zi ? Sr[zi.session.sandboxId] : null,
1428
+ turnInFlight: K,
1429
+ tr: P
1156
1430
  })
1157
1431
  ]
1158
1432
  });
1159
1433
  };
1160
1434
  //#endregion
1161
- export { dn as AssistantChatArea };
1435
+ export { Ln as AssistantChatArea };