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