@athenaintel/react 0.43.0 → 0.50.0

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 (746) hide show
  1. package/README.md +258 -8
  2. package/dist/agent-runtime/src/answer-label.cjs +137 -0
  3. package/dist/agent-runtime/src/answer-label.cjs.map +1 -0
  4. package/dist/agent-runtime/src/answer-label.d.ts +104 -0
  5. package/dist/agent-runtime/src/answer-label.js +137 -0
  6. package/dist/agent-runtime/src/answer-label.js.map +1 -0
  7. package/dist/agent-runtime/src/answer-rows.cjs +180 -0
  8. package/dist/agent-runtime/src/answer-rows.cjs.map +1 -0
  9. package/dist/agent-runtime/src/answer-rows.d.ts +86 -0
  10. package/dist/agent-runtime/src/answer-rows.js +180 -0
  11. package/dist/agent-runtime/src/answer-rows.js.map +1 -0
  12. package/dist/agent-runtime/src/call-recap.cjs +319 -0
  13. package/dist/agent-runtime/src/call-recap.cjs.map +1 -0
  14. package/dist/agent-runtime/src/call-recap.d.ts +142 -0
  15. package/dist/agent-runtime/src/call-recap.js +319 -0
  16. package/dist/agent-runtime/src/call-recap.js.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-store.cjs +1 -0
  18. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -1
  19. package/dist/agent-runtime/src/chat-outbox-store.d.ts +7 -0
  20. package/dist/agent-runtime/src/chat-outbox-store.js +1 -0
  21. package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -1
  22. package/dist/agent-runtime/src/chat-outbox.cjs +46 -5
  23. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
  24. package/dist/agent-runtime/src/chat-outbox.d.ts +29 -0
  25. package/dist/agent-runtime/src/chat-outbox.js +46 -5
  26. package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
  27. package/dist/agent-runtime/src/client-tool-bridge.cjs +15 -15
  28. package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
  29. package/dist/agent-runtime/src/conversation-index.cjs +8 -8
  30. package/dist/agent-runtime/src/conversation-index.cjs.map +1 -1
  31. package/dist/agent-runtime/src/conversation-index.d.ts +7 -0
  32. package/dist/agent-runtime/src/conversation-index.js.map +1 -1
  33. package/dist/agent-runtime/src/conversation-list.cjs +2 -1
  34. package/dist/agent-runtime/src/conversation-list.cjs.map +1 -1
  35. package/dist/agent-runtime/src/conversation-list.d.ts +19 -3
  36. package/dist/agent-runtime/src/conversation-list.js +2 -1
  37. package/dist/agent-runtime/src/conversation-list.js.map +1 -1
  38. package/dist/agent-runtime/src/decision-checks.cjs +207 -0
  39. package/dist/agent-runtime/src/decision-checks.cjs.map +1 -0
  40. package/dist/agent-runtime/src/decision-checks.d.ts +142 -0
  41. package/dist/agent-runtime/src/decision-checks.js +207 -0
  42. package/dist/agent-runtime/src/decision-checks.js.map +1 -0
  43. package/dist/agent-runtime/src/desktop-handoff.d.ts +12 -0
  44. package/dist/agent-runtime/src/errors.cjs +18 -0
  45. package/dist/agent-runtime/src/errors.cjs.map +1 -1
  46. package/dist/agent-runtime/src/errors.d.ts +7 -0
  47. package/dist/agent-runtime/src/errors.js +18 -0
  48. package/dist/agent-runtime/src/errors.js.map +1 -1
  49. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +12 -0
  50. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  51. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +6 -6
  52. package/dist/agent-runtime/src/generated/runconfig-contract.js +12 -0
  53. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  54. package/dist/agent-runtime/src/handoff-arrival.cjs +60 -0
  55. package/dist/agent-runtime/src/handoff-arrival.cjs.map +1 -0
  56. package/dist/agent-runtime/src/handoff-arrival.d.ts +46 -0
  57. package/dist/agent-runtime/src/handoff-arrival.js +60 -0
  58. package/dist/agent-runtime/src/handoff-arrival.js.map +1 -0
  59. package/dist/agent-runtime/src/index.d.ts +16 -9
  60. package/dist/agent-runtime/src/interrupts.cjs +71 -19
  61. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  62. package/dist/agent-runtime/src/interrupts.d.ts +40 -3
  63. package/dist/agent-runtime/src/interrupts.js +56 -4
  64. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  65. package/dist/agent-runtime/src/lane-history.cjs +8 -8
  66. package/dist/agent-runtime/src/lane-history.cjs.map +1 -1
  67. package/dist/agent-runtime/src/messages.cjs +43 -8
  68. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  69. package/dist/agent-runtime/src/messages.d.ts +25 -3
  70. package/dist/agent-runtime/src/messages.js +43 -8
  71. package/dist/agent-runtime/src/messages.js.map +1 -1
  72. package/dist/agent-runtime/src/model-context.cjs +3 -2
  73. package/dist/agent-runtime/src/model-context.cjs.map +1 -1
  74. package/dist/agent-runtime/src/model-context.d.ts +6 -1
  75. package/dist/agent-runtime/src/model-context.js +3 -2
  76. package/dist/agent-runtime/src/model-context.js.map +1 -1
  77. package/dist/agent-runtime/src/offline-status.cjs +36 -0
  78. package/dist/agent-runtime/src/offline-status.cjs.map +1 -0
  79. package/dist/agent-runtime/src/offline-status.d.ts +118 -3
  80. package/dist/agent-runtime/src/offline-status.js +36 -0
  81. package/dist/agent-runtime/src/offline-status.js.map +1 -0
  82. package/dist/agent-runtime/src/queue.cjs +0 -9
  83. package/dist/agent-runtime/src/queue.cjs.map +1 -1
  84. package/dist/agent-runtime/src/queue.js +0 -9
  85. package/dist/agent-runtime/src/queue.js.map +1 -1
  86. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +9 -9
  87. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  88. package/dist/agent-runtime/src/runtime-catalog.cjs +42 -0
  89. package/dist/agent-runtime/src/runtime-catalog.cjs.map +1 -0
  90. package/dist/agent-runtime/src/runtime-catalog.d.ts +35 -0
  91. package/dist/agent-runtime/src/runtime-catalog.js +42 -0
  92. package/dist/agent-runtime/src/runtime-catalog.js.map +1 -0
  93. package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -1
  94. package/dist/agent-runtime/src/runtime-messages.d.ts +1 -1
  95. package/dist/agent-runtime/src/runtime-messages.js.map +1 -1
  96. package/dist/agent-runtime/src/runtime.d.ts +41 -0
  97. package/dist/agent-runtime/src/send-recovery.cjs +37 -3
  98. package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
  99. package/dist/agent-runtime/src/send-recovery.d.ts +19 -0
  100. package/dist/agent-runtime/src/send-recovery.js +37 -3
  101. package/dist/agent-runtime/src/send-recovery.js.map +1 -1
  102. package/dist/agent-runtime/src/statewire-suspended.cjs +3 -3
  103. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  104. package/dist/agent-runtime/src/subagents.cjs +32 -2
  105. package/dist/agent-runtime/src/subagents.cjs.map +1 -1
  106. package/dist/agent-runtime/src/subagents.d.ts +9 -0
  107. package/dist/agent-runtime/src/subagents.js +30 -0
  108. package/dist/agent-runtime/src/subagents.js.map +1 -1
  109. package/dist/agent-runtime/src/thread-driver.cjs +67 -0
  110. package/dist/agent-runtime/src/thread-driver.cjs.map +1 -0
  111. package/dist/agent-runtime/src/thread-driver.d.ts +49 -0
  112. package/dist/agent-runtime/src/thread-driver.js +67 -0
  113. package/dist/agent-runtime/src/thread-driver.js.map +1 -0
  114. package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +172 -0
  115. package/dist/agent-runtime/src/thread-handoff-protocol.d.ts +868 -0
  116. package/dist/agent-runtime/src/thread-handoff-qr.d.ts +11 -0
  117. package/dist/agent-runtime/src/thread-handoff.d.ts +3 -364
  118. package/dist/agent-runtime/src/thread-status.cjs +3 -3
  119. package/dist/agent-runtime/src/thread-status.cjs.map +1 -1
  120. package/dist/agent-runtime/src/tool-metadata.cjs +210 -25
  121. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  122. package/dist/agent-runtime/src/tool-metadata.d.ts +12 -0
  123. package/dist/agent-runtime/src/tool-metadata.js +210 -25
  124. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  125. package/dist/agent-runtime/src/tool-names.cjs +2 -0
  126. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  127. package/dist/agent-runtime/src/tool-names.d.ts +2 -0
  128. package/dist/agent-runtime/src/tool-names.js +2 -0
  129. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  130. package/dist/agent-runtime/src/types.d.ts +10 -2
  131. package/dist/agent-runtime/src/use-conversation-list.cjs +14 -13
  132. package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
  133. package/dist/agent-runtime/src/use-conversation-list.d.ts +6 -0
  134. package/dist/agent-runtime/src/use-conversation-list.js +3 -2
  135. package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
  136. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +45 -20
  137. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
  138. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +10 -3
  139. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +27 -2
  140. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
  141. package/dist/agent-runtime/src/use-deep-agent-config.cjs +14 -14
  142. package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
  143. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +6 -6
  144. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  145. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +40 -22
  146. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  147. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +17 -0
  148. package/dist/agent-runtime/src/use-deep-agent-runtime.js +24 -6
  149. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  150. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +45 -45
  151. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  152. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +588 -130
  153. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
  154. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +162 -10
  155. package/dist/agent-runtime/src/use-deep-agent-voice.js +529 -71
  156. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
  157. package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +26 -26
  158. package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
  159. package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +4 -4
  160. package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -1
  161. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +34 -26
  162. package/dist/agent-runtime/src/voice-earcon.cjs +139 -0
  163. package/dist/agent-runtime/src/voice-earcon.cjs.map +1 -0
  164. package/dist/agent-runtime/src/voice-earcon.d.ts +38 -0
  165. package/dist/agent-runtime/src/voice-earcon.js +139 -0
  166. package/dist/agent-runtime/src/voice-earcon.js.map +1 -0
  167. package/dist/agent-runtime/src/voice-media.cjs +117 -0
  168. package/dist/agent-runtime/src/voice-media.cjs.map +1 -0
  169. package/dist/agent-runtime/src/voice-media.d.ts +63 -0
  170. package/dist/agent-runtime/src/voice-media.js +117 -0
  171. package/dist/agent-runtime/src/voice-media.js.map +1 -0
  172. package/dist/agent-runtime/src/voice-presentation.cjs +2 -0
  173. package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -1
  174. package/dist/agent-runtime/src/voice-presentation.js +2 -0
  175. package/dist/agent-runtime/src/voice-presentation.js.map +1 -1
  176. package/dist/agent-runtime/src/voice-wire-types.d.ts +32 -0
  177. package/dist/assets/AssetPanel.cjs +11 -11
  178. package/dist/assets/AssetPanel.cjs.map +1 -1
  179. package/dist/assets/AthenaAssetEmbed.cjs +11 -9
  180. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  181. package/dist/assets/AthenaAssetEmbed.d.ts +18 -5
  182. package/dist/assets/AthenaAssetEmbed.js +4 -2
  183. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  184. package/dist/assets/AthenaLayout.cjs +16 -16
  185. package/dist/assets/AthenaLayout.cjs.map +1 -1
  186. package/dist/assets/use-asset-content.cjs +4 -4
  187. package/dist/assets/use-asset-content.cjs.map +1 -1
  188. package/dist/assets/use-asset-embed.cjs +14 -7
  189. package/dist/assets/use-asset-embed.cjs.map +1 -1
  190. package/dist/assets/use-asset-embed.d.ts +23 -6
  191. package/dist/assets/use-asset-embed.js +10 -3
  192. package/dist/assets/use-asset-embed.js.map +1 -1
  193. package/dist/auth/AthenaAuthContext.cjs +3 -3
  194. package/dist/auth/AthenaAuthContext.cjs.map +1 -1
  195. package/dist/auth/AthenaAuthProvider.cjs +8 -8
  196. package/dist/auth/AthenaAuthProvider.cjs.map +1 -1
  197. package/dist/auth/AthenaCredentialSourceContext.cjs +5 -5
  198. package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
  199. package/dist/auth/AthenaSSOProvider.cjs +14 -14
  200. package/dist/auth/AthenaSSOProvider.cjs.map +1 -1
  201. package/dist/auth/credential-source.cjs +26 -13
  202. package/dist/auth/credential-source.cjs.map +1 -1
  203. package/dist/auth/credential-source.d.ts +8 -0
  204. package/dist/auth/credential-source.js +26 -13
  205. package/dist/auth/credential-source.js.map +1 -1
  206. package/dist/catalog/agent-model-options.cjs +25 -17
  207. package/dist/catalog/agent-model-options.cjs.map +1 -1
  208. package/dist/catalog/agent-model-options.d.ts +38 -5
  209. package/dist/catalog/agent-model-options.js +25 -17
  210. package/dist/catalog/agent-model-options.js.map +1 -1
  211. package/dist/catalog/channel-refusal.cjs +36 -0
  212. package/dist/catalog/channel-refusal.cjs.map +1 -0
  213. package/dist/catalog/channel-refusal.d.ts +29 -0
  214. package/dist/catalog/channel-refusal.js +36 -0
  215. package/dist/catalog/channel-refusal.js.map +1 -0
  216. package/dist/catalog/chat-pickers.cjs +60 -24
  217. package/dist/catalog/chat-pickers.cjs.map +1 -1
  218. package/dist/catalog/chat-pickers.d.ts +12 -2
  219. package/dist/catalog/chat-pickers.js +56 -20
  220. package/dist/catalog/chat-pickers.js.map +1 -1
  221. package/dist/catalog/runtime-catalog.cjs +89 -23
  222. package/dist/catalog/runtime-catalog.cjs.map +1 -1
  223. package/dist/catalog/runtime-catalog.d.ts +8 -2
  224. package/dist/catalog/runtime-catalog.js +83 -17
  225. package/dist/catalog/runtime-catalog.js.map +1 -1
  226. package/dist/catalog/use-athena-chat-mode.cjs +12 -12
  227. package/dist/catalog/use-athena-chat-mode.cjs.map +1 -1
  228. package/dist/chat/AthenaChat.cjs +155 -67
  229. package/dist/chat/AthenaChat.cjs.map +1 -1
  230. package/dist/chat/AthenaChat.d.ts +42 -2
  231. package/dist/chat/AthenaChat.js +106 -18
  232. package/dist/chat/AthenaChat.js.map +1 -1
  233. package/dist/chat/AthenaChatErrorBoundary.cjs +3 -3
  234. package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -1
  235. package/dist/chat/DrivingOnChip.cjs +23 -0
  236. package/dist/chat/DrivingOnChip.cjs.map +1 -0
  237. package/dist/chat/DrivingOnChip.d.ts +17 -0
  238. package/dist/chat/DrivingOnChip.js +23 -0
  239. package/dist/chat/DrivingOnChip.js.map +1 -0
  240. package/dist/chat/StatewireApprovalCard.cjs +166 -37
  241. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  242. package/dist/chat/StatewireApprovalCard.d.ts +91 -2
  243. package/dist/chat/StatewireApprovalCard.js +156 -27
  244. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  245. package/dist/chat/StatewireClientToolBridge.cjs +2 -2
  246. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
  247. package/dist/chat/StatewireQueuedMessages.cjs +81 -69
  248. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  249. package/dist/chat/StatewireQueuedMessages.d.ts +25 -13
  250. package/dist/chat/StatewireQueuedMessages.js +73 -61
  251. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  252. package/dist/chat/WaitingOnYouBanner.cjs +9 -5
  253. package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
  254. package/dist/chat/WaitingOnYouBanner.js +7 -3
  255. package/dist/chat/WaitingOnYouBanner.js.map +1 -1
  256. package/dist/chat/athena-chat-welcome.cjs +2 -2
  257. package/dist/chat/athena-chat-welcome.cjs.map +1 -1
  258. package/dist/chat/athena-citation-links.cjs +5 -5
  259. package/dist/chat/athena-citation-links.cjs.map +1 -1
  260. package/dist/chat/athena-composer-controls.cjs +26 -16
  261. package/dist/chat/athena-composer-controls.cjs.map +1 -1
  262. package/dist/chat/athena-composer-controls.d.ts +6 -0
  263. package/dist/chat/athena-composer-controls.js +26 -16
  264. package/dist/chat/athena-composer-controls.js.map +1 -1
  265. package/dist/chat/athena-turn-end-status.cjs +42 -0
  266. package/dist/chat/athena-turn-end-status.cjs.map +1 -0
  267. package/dist/chat/athena-turn-end-status.d.ts +24 -0
  268. package/dist/chat/athena-turn-end-status.js +42 -0
  269. package/dist/chat/athena-turn-end-status.js.map +1 -0
  270. package/dist/chat/browser-decision-check.cjs +131 -0
  271. package/dist/chat/browser-decision-check.cjs.map +1 -0
  272. package/dist/chat/browser-decision-check.d.ts +61 -0
  273. package/dist/chat/browser-decision-check.js +131 -0
  274. package/dist/chat/browser-decision-check.js.map +1 -0
  275. package/dist/chat/chat-outbox-rows.cjs +3 -3
  276. package/dist/chat/chat-outbox-rows.cjs.map +1 -1
  277. package/dist/chat/chat-voice-controls.cjs +96 -29
  278. package/dist/chat/chat-voice-controls.cjs.map +1 -1
  279. package/dist/chat/chat-voice-controls.d.ts +42 -3
  280. package/dist/chat/chat-voice-controls.js +92 -25
  281. package/dist/chat/chat-voice-controls.js.map +1 -1
  282. package/dist/chat/composer-keyboard-hint.cjs +5 -5
  283. package/dist/chat/composer-keyboard-hint.cjs.map +1 -1
  284. package/dist/chat/device-operation.cjs +29 -0
  285. package/dist/chat/device-operation.cjs.map +1 -0
  286. package/dist/chat/device-operation.d.ts +34 -0
  287. package/dist/chat/device-operation.js +29 -0
  288. package/dist/chat/device-operation.js.map +1 -0
  289. package/dist/chat/super-grouping/CollapsibleGroup.cjs +14 -14
  290. package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
  291. package/dist/chat/super-grouping/GroupedMessageParts.cjs +4 -4
  292. package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -1
  293. package/dist/chat/super-grouping/SuperGroupingCard.cjs +52 -36
  294. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  295. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +19 -4
  296. package/dist/chat/super-grouping/SuperGroupingCard.js +29 -13
  297. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  298. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +32 -32
  299. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  300. package/dist/chat/super-grouping/SuperGroupingTranscript.js +3 -3
  301. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  302. package/dist/chat/super-grouping/ToolTimeline.cjs +73 -40
  303. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
  304. package/dist/chat/super-grouping/ToolTimeline.d.ts +10 -2
  305. package/dist/chat/super-grouping/ToolTimeline.js +69 -36
  306. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
  307. package/dist/chat/super-grouping/activity-timeline.cjs +47 -12
  308. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  309. package/dist/chat/super-grouping/activity-timeline.d.ts +21 -0
  310. package/dist/chat/super-grouping/activity-timeline.js +47 -12
  311. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  312. package/dist/chat/super-grouping/grouping-function.cjs +4 -0
  313. package/dist/chat/super-grouping/grouping-function.cjs.map +1 -1
  314. package/dist/chat/super-grouping/grouping-function.d.ts +7 -0
  315. package/dist/chat/super-grouping/grouping-function.js +5 -1
  316. package/dist/chat/super-grouping/grouping-function.js.map +1 -1
  317. package/dist/chat/super-grouping/index.cjs +6 -0
  318. package/dist/chat/super-grouping/index.cjs.map +1 -1
  319. package/dist/chat/super-grouping/index.d.ts +5 -2
  320. package/dist/chat/super-grouping/index.js +7 -1
  321. package/dist/chat/super-grouping/index.js.map +1 -1
  322. package/dist/chat/super-grouping/tool-part-placement.cjs +17 -0
  323. package/dist/chat/super-grouping/tool-part-placement.cjs.map +1 -0
  324. package/dist/chat/super-grouping/tool-part-placement.d.ts +22 -0
  325. package/dist/chat/super-grouping/tool-part-placement.js +17 -0
  326. package/dist/chat/super-grouping/tool-part-placement.js.map +1 -0
  327. package/dist/chat/thread-scroll-to-bottom.cjs +2 -2
  328. package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -1
  329. package/dist/chat/thread-scroll-to-bottom.d.ts +10 -7
  330. package/dist/chat/thread-scroll-to-bottom.js +2 -2
  331. package/dist/chat/thread-scroll-to-bottom.js.map +1 -1
  332. package/dist/chat/tooltip-icon-button.cjs +2 -2
  333. package/dist/chat/tooltip-icon-button.cjs.map +1 -1
  334. package/dist/chat/use-athena-voice-live.cjs +11 -0
  335. package/dist/chat/use-athena-voice-live.cjs.map +1 -0
  336. package/dist/chat/use-athena-voice-live.d.ts +11 -0
  337. package/dist/chat/use-athena-voice-live.js +11 -0
  338. package/dist/chat/use-athena-voice-live.js.map +1 -0
  339. package/dist/chat/use-statewire-approval-request.cjs +56 -24
  340. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  341. package/dist/chat/use-statewire-approval-request.d.ts +33 -4
  342. package/dist/chat/use-statewire-approval-request.js +41 -9
  343. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  344. package/dist/chat-ui/auth/sign-in-card.cjs +2 -2
  345. package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -1
  346. package/dist/chat-ui/composer/tiptap-composer.cjs +138 -107
  347. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  348. package/dist/chat-ui/composer/tiptap-composer.d.ts +20 -4
  349. package/dist/chat-ui/composer/tiptap-composer.js +85 -54
  350. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  351. package/dist/chat-ui/header/conversation-history-panel.cjs +49 -23
  352. package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -1
  353. package/dist/chat-ui/header/conversation-history-panel.d.ts +12 -1
  354. package/dist/chat-ui/header/conversation-history-panel.js +38 -12
  355. package/dist/chat-ui/header/conversation-history-panel.js.map +1 -1
  356. package/dist/chat-ui/index.cjs +21 -0
  357. package/dist/chat-ui/index.cjs.map +1 -1
  358. package/dist/chat-ui/index.d.ts +8 -1
  359. package/dist/chat-ui/index.js +21 -0
  360. package/dist/chat-ui/index.js.map +1 -1
  361. package/dist/chat-ui/mentions/mention-chip.cjs +4 -4
  362. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  363. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +10 -9
  364. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
  365. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +3 -2
  366. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
  367. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +2 -2
  368. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
  369. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +29 -6
  370. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
  371. package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +7 -1
  372. package/dist/chat-ui/mentions/suggestions/components/menu-list.js +25 -2
  373. package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
  374. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +2 -2
  375. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -1
  376. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +2 -2
  377. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -1
  378. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +3 -3
  379. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  380. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +56 -2
  381. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -1
  382. package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +12 -0
  383. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +56 -2
  384. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -1
  385. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +24 -3
  386. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  387. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +7 -0
  388. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +24 -3
  389. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  390. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +35 -13
  391. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
  392. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +15 -1
  393. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +28 -6
  394. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
  395. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +9 -6
  396. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -1
  397. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +3 -0
  398. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +5 -2
  399. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -1
  400. package/dist/chat-ui/mentions/use-account-workspace-id.cjs +45 -10
  401. package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
  402. package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +24 -1
  403. package/dist/chat-ui/mentions/use-account-workspace-id.js +46 -11
  404. package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
  405. package/dist/chat-ui/mentions/use-member-avatar.cjs +4 -4
  406. package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -1
  407. package/dist/chat-ui/mentions/use-mention-asset.cjs +3 -3
  408. package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -1
  409. package/dist/chat-ui/messages/answer-label.cjs +42 -0
  410. package/dist/chat-ui/messages/answer-label.cjs.map +1 -0
  411. package/dist/chat-ui/messages/answer-label.d.ts +33 -0
  412. package/dist/chat-ui/messages/answer-label.js +42 -0
  413. package/dist/chat-ui/messages/answer-label.js.map +1 -0
  414. package/dist/chat-ui/messages/arrival-animation.cjs +13 -0
  415. package/dist/chat-ui/messages/arrival-animation.cjs.map +1 -0
  416. package/dist/chat-ui/messages/arrival-animation.d.ts +14 -0
  417. package/dist/chat-ui/messages/arrival-animation.js +13 -0
  418. package/dist/chat-ui/messages/arrival-animation.js.map +1 -0
  419. package/dist/chat-ui/messages/continue-pill.cjs +5 -5
  420. package/dist/chat-ui/messages/continue-pill.cjs.map +1 -1
  421. package/dist/chat-ui/messages/from-the-call-card.cjs +124 -0
  422. package/dist/chat-ui/messages/from-the-call-card.cjs.map +1 -0
  423. package/dist/chat-ui/messages/from-the-call-card.d.ts +17 -0
  424. package/dist/chat-ui/messages/from-the-call-card.js +124 -0
  425. package/dist/chat-ui/messages/from-the-call-card.js.map +1 -0
  426. package/dist/chat-ui/messages/handoff-arrival-divider.cjs +44 -0
  427. package/dist/chat-ui/messages/handoff-arrival-divider.cjs.map +1 -0
  428. package/dist/chat-ui/messages/handoff-arrival-divider.d.ts +17 -0
  429. package/dist/chat-ui/messages/handoff-arrival-divider.js +44 -0
  430. package/dist/chat-ui/messages/handoff-arrival-divider.js.map +1 -0
  431. package/dist/chat-ui/messages/message-actions-config.cjs +3 -3
  432. package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -1
  433. package/dist/chat-ui/messages/message-components.cjs +8 -4
  434. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  435. package/dist/chat-ui/messages/message-components.js +5 -1
  436. package/dist/chat-ui/messages/message-components.js.map +1 -1
  437. package/dist/chat-ui/messages/message-images.cjs +66 -0
  438. package/dist/chat-ui/messages/message-images.cjs.map +1 -0
  439. package/dist/chat-ui/messages/message-images.d.ts +16 -0
  440. package/dist/chat-ui/messages/message-images.js +66 -0
  441. package/dist/chat-ui/messages/message-images.js.map +1 -0
  442. package/dist/chat-ui/messages/user-edit-composer.cjs +2 -2
  443. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  444. package/dist/chat-ui/messages/wake-marker.cjs +3 -3
  445. package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
  446. package/dist/chat-ui/rich-text/chat-link.cjs +3 -2
  447. package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
  448. package/dist/chat-ui/rich-text/chat-link.d.ts +4 -0
  449. package/dist/chat-ui/rich-text/chat-link.js +4 -3
  450. package/dist/chat-ui/rich-text/chat-link.js.map +1 -1
  451. package/dist/chat-ui/rich-text/chat-message-body.cjs +9 -8
  452. package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
  453. package/dist/chat-ui/rich-text/chat-message-body.d.ts +12 -0
  454. package/dist/chat-ui/rich-text/chat-message-body.js +2 -1
  455. package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
  456. package/dist/chat-ui/rich-text/chat-node-views.cjs +6 -6
  457. package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
  458. package/dist/chat-ui/rich-text/dom-output-spec.cjs +2 -2
  459. package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -1
  460. package/dist/chat-ui/statewire.cjs +3 -0
  461. package/dist/chat-ui/statewire.cjs.map +1 -1
  462. package/dist/chat-ui/statewire.d.ts +2 -1
  463. package/dist/chat-ui/statewire.js +3 -0
  464. package/dist/chat-ui/statewire.js.map +1 -1
  465. package/dist/chat-ui/thread/chat-thread-shell.cjs +45 -14
  466. package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
  467. package/dist/chat-ui/thread/chat-thread-shell.d.ts +16 -2
  468. package/dist/chat-ui/thread/chat-thread-shell.js +37 -6
  469. package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
  470. package/dist/chat-ui/thread/composer-send-or-stop.cjs +30 -20
  471. package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
  472. package/dist/chat-ui/thread/composer-send-or-stop.d.ts +8 -0
  473. package/dist/chat-ui/thread/composer-send-or-stop.js +29 -19
  474. package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
  475. package/dist/chat-ui/thread/statewire-history-edge.cjs +20 -21
  476. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  477. package/dist/chat-ui/thread/statewire-history-edge.js +3 -4
  478. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  479. package/dist/chat-ui/thread/thread-loading-overlay.cjs +5 -5
  480. package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -1
  481. package/dist/collab/client.cjs +52 -3
  482. package/dist/collab/client.cjs.map +1 -1
  483. package/dist/collab/client.d.ts +27 -0
  484. package/dist/collab/client.js +52 -3
  485. package/dist/collab/client.js.map +1 -1
  486. package/dist/collab/document-status.cjs +150 -0
  487. package/dist/collab/document-status.cjs.map +1 -0
  488. package/dist/collab/document-status.d.ts +68 -0
  489. package/dist/collab/document-status.js +150 -0
  490. package/dist/collab/document-status.js.map +1 -0
  491. package/dist/collab/index.cjs +7 -0
  492. package/dist/collab/index.cjs.map +1 -1
  493. package/dist/collab/index.d.ts +6 -1
  494. package/dist/collab/index.js +7 -0
  495. package/dist/collab/index.js.map +1 -1
  496. package/dist/collab/presence-react.cjs +11 -11
  497. package/dist/collab/presence-react.cjs.map +1 -1
  498. package/dist/collab/react.cjs +6 -6
  499. package/dist/collab/react.cjs.map +1 -1
  500. package/dist/composer/AttachmentContext.cjs +24 -11
  501. package/dist/composer/AttachmentContext.cjs.map +1 -1
  502. package/dist/composer/AttachmentContext.js +18 -5
  503. package/dist/composer/AttachmentContext.js.map +1 -1
  504. package/dist/composer/ComposerAttachmentPreview.cjs +78 -23
  505. package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -1
  506. package/dist/composer/ComposerAttachmentPreview.d.ts +5 -3
  507. package/dist/composer/ComposerAttachmentPreview.js +79 -24
  508. package/dist/composer/ComposerAttachmentPreview.js.map +1 -1
  509. package/dist/composer/ComposerDropZone.cjs +7 -7
  510. package/dist/composer/ComposerDropZone.cjs.map +1 -1
  511. package/dist/composer/FileUploadButton.cjs +37 -22
  512. package/dist/composer/FileUploadButton.cjs.map +1 -1
  513. package/dist/composer/FileUploadButton.d.ts +6 -0
  514. package/dist/composer/FileUploadButton.js +34 -19
  515. package/dist/composer/FileUploadButton.js.map +1 -1
  516. package/dist/composer/QuoteContext.cjs +8 -8
  517. package/dist/composer/QuoteContext.cjs.map +1 -1
  518. package/dist/composer/composer-handoff.cjs +4 -4
  519. package/dist/composer/composer-handoff.cjs.map +1 -1
  520. package/dist/composer/index.d.ts +1 -1
  521. package/dist/composer/useAppendToComposer.cjs +4 -4
  522. package/dist/composer/useAppendToComposer.cjs.map +1 -1
  523. package/dist/composer/useAttachFiles.cjs +23 -6
  524. package/dist/composer/useAttachFiles.cjs.map +1 -1
  525. package/dist/composer/useAttachFiles.d.ts +15 -7
  526. package/dist/composer/useAttachFiles.js +22 -5
  527. package/dist/composer/useAttachFiles.js.map +1 -1
  528. package/dist/composer/useComposerAttachment.cjs +4 -4
  529. package/dist/composer/useComposerAttachment.cjs.map +1 -1
  530. package/dist/composer/useFileUpload.cjs +21 -16
  531. package/dist/composer/useFileUpload.cjs.map +1 -1
  532. package/dist/composer/useFileUpload.d.ts +12 -0
  533. package/dist/composer/useFileUpload.js +12 -7
  534. package/dist/composer/useFileUpload.js.map +1 -1
  535. package/dist/composer/useReadComposerDraft.cjs +27 -8
  536. package/dist/composer/useReadComposerDraft.cjs.map +1 -1
  537. package/dist/composer/useReadComposerDraft.d.ts +23 -1
  538. package/dist/composer/useReadComposerDraft.js +27 -8
  539. package/dist/composer/useReadComposerDraft.js.map +1 -1
  540. package/dist/composer/useSendMessage.cjs +4 -4
  541. package/dist/composer/useSendMessage.cjs.map +1 -1
  542. package/dist/diagnostics/useAthenaDiagnostics.cjs +4 -4
  543. package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -1
  544. package/dist/dictation/audio-level-history.cjs +3 -3
  545. package/dist/dictation/audio-level-history.cjs.map +1 -1
  546. package/dist/dictation/dictation-controls.cjs +24 -20
  547. package/dist/dictation/dictation-controls.cjs.map +1 -1
  548. package/dist/dictation/dictation-controls.d.ts +6 -1
  549. package/dist/dictation/dictation-controls.js +24 -20
  550. package/dist/dictation/dictation-controls.js.map +1 -1
  551. package/dist/dictation/use-athena-dictation-engine.cjs +3 -3
  552. package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -1
  553. package/dist/dictation/use-dictation.cjs +22 -22
  554. package/dist/dictation/use-dictation.cjs.map +1 -1
  555. package/dist/index.cjs +29 -2
  556. package/dist/index.cjs.map +1 -1
  557. package/dist/index.d.ts +18 -4
  558. package/dist/index.js +30 -3
  559. package/dist/index.js.map +1 -1
  560. package/dist/keryx-http/src/receive-only-socket.cjs +40 -0
  561. package/dist/keryx-http/src/receive-only-socket.cjs.map +1 -0
  562. package/dist/keryx-http/src/receive-only-socket.d.ts +27 -0
  563. package/dist/keryx-http/src/receive-only-socket.js +40 -0
  564. package/dist/keryx-http/src/receive-only-socket.js.map +1 -0
  565. package/dist/keryx-http/src/unconfirmed-update-attributions.cjs +190 -0
  566. package/dist/keryx-http/src/unconfirmed-update-attributions.cjs.map +1 -0
  567. package/dist/keryx-http/src/unconfirmed-update-attributions.d.ts +132 -0
  568. package/dist/keryx-http/src/unconfirmed-update-attributions.js +190 -0
  569. package/dist/keryx-http/src/unconfirmed-update-attributions.js.map +1 -0
  570. package/dist/keryx-http/src/update-attributions.cjs +141 -0
  571. package/dist/keryx-http/src/update-attributions.cjs.map +1 -0
  572. package/dist/keryx-http/src/update-attributions.d.ts +107 -0
  573. package/dist/keryx-http/src/update-attributions.js +141 -0
  574. package/dist/keryx-http/src/update-attributions.js.map +1 -0
  575. package/dist/lib/owner-document.cjs +6 -6
  576. package/dist/lib/owner-document.cjs.map +1 -1
  577. package/dist/lib/use-athena-rest-query.cjs +4 -4
  578. package/dist/lib/use-athena-rest-query.cjs.map +1 -1
  579. package/dist/lib/use-document-active.cjs +4 -4
  580. package/dist/lib/use-document-active.cjs.map +1 -1
  581. package/dist/lib/use-prefers-reduced-motion.cjs +2 -2
  582. package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -1
  583. package/dist/offline/offline-history.cjs +7 -7
  584. package/dist/offline/offline-history.cjs.map +1 -1
  585. package/dist/provider/AthenaContext.cjs +3 -3
  586. package/dist/provider/AthenaContext.cjs.map +1 -1
  587. package/dist/provider/AthenaProvider.cjs +120 -79
  588. package/dist/provider/AthenaProvider.cjs.map +1 -1
  589. package/dist/provider/AthenaProvider.d.ts +11 -1
  590. package/dist/provider/AthenaProvider.js +44 -3
  591. package/dist/provider/AthenaProvider.js.map +1 -1
  592. package/dist/provider/PostHogProvider.cjs +2 -2
  593. package/dist/provider/PostHogProvider.cjs.map +1 -1
  594. package/dist/provider/agent-selection-context.cjs +2 -2
  595. package/dist/provider/agent-selection-context.cjs.map +1 -1
  596. package/dist/provider/chat-mode-context.cjs +2 -2
  597. package/dist/provider/chat-mode-context.cjs.map +1 -1
  598. package/dist/provider/session-persistence-context.cjs +10 -0
  599. package/dist/provider/session-persistence-context.cjs.map +1 -0
  600. package/dist/provider/session-persistence-context.d.ts +15 -0
  601. package/dist/provider/session-persistence-context.js +10 -0
  602. package/dist/provider/session-persistence-context.js.map +1 -0
  603. package/dist/provider/statewire-history-context.cjs +4 -4
  604. package/dist/provider/statewire-history-context.cjs.map +1 -1
  605. package/dist/provider/statewire-lifecycle-context.cjs +3 -3
  606. package/dist/provider/statewire-lifecycle-context.cjs.map +1 -1
  607. package/dist/provider/statewire-window-context.cjs +3 -3
  608. package/dist/provider/statewire-window-context.cjs.map +1 -1
  609. package/dist/provider/theme-style-context.cjs +3 -3
  610. package/dist/provider/theme-style-context.cjs.map +1 -1
  611. package/dist/react/package.json.cjs +1 -1
  612. package/dist/react/package.json.js +1 -1
  613. package/dist/runtime/StatewireThreadConfigLaneSync.cjs +10 -10
  614. package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
  615. package/dist/runtime/auth-refusal-restart.cjs +7 -7
  616. package/dist/runtime/auth-refusal-restart.cjs.map +1 -1
  617. package/dist/runtime/auth.cjs +13 -13
  618. package/dist/runtime/auth.cjs.map +1 -1
  619. package/dist/runtime/statewire-lifecycle.cjs +1 -0
  620. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  621. package/dist/runtime/statewire-lifecycle.d.ts +3 -1
  622. package/dist/runtime/statewire-lifecycle.js +2 -1
  623. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  624. package/dist/runtime/statewire-server-lane-context.cjs +2 -2
  625. package/dist/runtime/statewire-server-lane-context.cjs.map +1 -1
  626. package/dist/runtime/statewire-session-lane.cjs +4 -4
  627. package/dist/runtime/statewire-session-lane.cjs.map +1 -1
  628. package/dist/runtime/useAthenaStatewireRuntime.cjs +10 -8
  629. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  630. package/dist/runtime/useAthenaStatewireRuntime.d.ts +2 -0
  631. package/dist/runtime/useAthenaStatewireRuntime.js +2 -0
  632. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  633. package/dist/styles.css +1 -1
  634. package/dist/threads/Inbox.cjs +8 -8
  635. package/dist/threads/Inbox.cjs.map +1 -1
  636. package/dist/threads/SessionList.cjs +9 -9
  637. package/dist/threads/SessionList.cjs.map +1 -1
  638. package/dist/threads/SessionsPage.cjs +11 -11
  639. package/dist/threads/SessionsPage.cjs.map +1 -1
  640. package/dist/threads/api.cjs.map +1 -1
  641. package/dist/threads/api.d.ts +15 -0
  642. package/dist/threads/api.js.map +1 -1
  643. package/dist/threads/conversation-list-fetcher.cjs +13 -5
  644. package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
  645. package/dist/threads/conversation-list-fetcher.d.ts +4 -1
  646. package/dist/threads/conversation-list-fetcher.js +13 -5
  647. package/dist/threads/conversation-list-fetcher.js.map +1 -1
  648. package/dist/threads/index-triggered-refresh.cjs +10 -10
  649. package/dist/threads/index-triggered-refresh.cjs.map +1 -1
  650. package/dist/threads/mark-viewed-thread-read.cjs +12 -12
  651. package/dist/threads/mark-viewed-thread-read.cjs.map +1 -1
  652. package/dist/threads/offline-session-list.cjs +3 -3
  653. package/dist/threads/offline-session-list.cjs.map +1 -1
  654. package/dist/threads/session-list-tab-share.cjs +5 -5
  655. package/dist/threads/session-list-tab-share.cjs.map +1 -1
  656. package/dist/threads/statewire-thread-list.cjs +79 -57
  657. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  658. package/dist/threads/statewire-thread-list.d.ts +20 -8
  659. package/dist/threads/statewire-thread-list.js +28 -6
  660. package/dist/threads/statewire-thread-list.js.map +1 -1
  661. package/dist/threads/thread-id-context.cjs +5 -5
  662. package/dist/threads/thread-id-context.cjs.map +1 -1
  663. package/dist/threads/use-athena-session-attention.cjs +2 -2
  664. package/dist/threads/use-athena-session-attention.cjs.map +1 -1
  665. package/dist/threads/use-athena-sessions.cjs +37 -15
  666. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  667. package/dist/threads/use-athena-sessions.d.ts +10 -5
  668. package/dist/threads/use-athena-sessions.js +28 -6
  669. package/dist/threads/use-athena-sessions.js.map +1 -1
  670. package/dist/threads/use-athena-thread-model.cjs +3 -3
  671. package/dist/threads/use-athena-thread-model.cjs.map +1 -1
  672. package/dist/threads/use-rest-conversation-history.cjs +3 -3
  673. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  674. package/dist/threads/use-rest-conversation-history.d.ts +1 -0
  675. package/dist/threads/use-statewire-conversation-history.cjs +8 -8
  676. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  677. package/dist/threads/use-thread-archive.cjs +9 -9
  678. package/dist/threads/use-thread-archive.cjs.map +1 -1
  679. package/dist/threads/use-thread-favorite.cjs +2 -2
  680. package/dist/threads/use-thread-favorite.cjs.map +1 -1
  681. package/dist/threads/use-thread-field-override.cjs +20 -20
  682. package/dist/threads/use-thread-field-override.cjs.map +1 -1
  683. package/dist/threads/use-thread-read-state.cjs +4 -4
  684. package/dist/threads/use-thread-read-state.cjs.map +1 -1
  685. package/dist/threads/use-thread-rename.cjs +2 -2
  686. package/dist/threads/use-thread-rename.cjs.map +1 -1
  687. package/dist/threads/useAthenaThreadManager.cjs +2 -2
  688. package/dist/threads/useAthenaThreadManager.cjs.map +1 -1
  689. package/dist/tools/NestedPtcMessages.cjs +6 -6
  690. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  691. package/dist/tools/append-document-tool-ui.cjs +7 -7
  692. package/dist/tools/append-document-tool-ui.cjs.map +1 -1
  693. package/dist/tools/file-tool-uis.cjs +2 -2
  694. package/dist/tools/file-tool-uis.cjs.map +1 -1
  695. package/dist/tools/misc-tool-uis.cjs +2 -2
  696. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  697. package/dist/tools/primitives.cjs +6 -6
  698. package/dist/tools/primitives.cjs.map +1 -1
  699. package/dist/tools/read-asset-tool-ui.cjs +6 -6
  700. package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
  701. package/dist/tools/subagent-task-tool-ui.cjs +21 -21
  702. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
  703. package/dist/tools/test-recording-tool-uis.cjs +16 -16
  704. package/dist/tools/test-recording-tool-uis.cjs.map +1 -1
  705. package/dist/tools/todo-plan-store.cjs +4 -4
  706. package/dist/tools/todo-plan-store.cjs.map +1 -1
  707. package/dist/tools/tool-appearance.cjs +3 -3
  708. package/dist/tools/tool-appearance.cjs.map +1 -1
  709. package/dist/tools/tool-fallback.cjs +14 -14
  710. package/dist/tools/tool-fallback.cjs.map +1 -1
  711. package/dist/tools/tool-uis.cjs +74 -74
  712. package/dist/tools/tool-uis.cjs.map +1 -1
  713. package/dist/tools/use-elapsed-seconds.cjs +3 -3
  714. package/dist/tools/use-elapsed-seconds.cjs.map +1 -1
  715. package/dist/tools/write-todos-tool-ui.cjs +9 -9
  716. package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
  717. package/dist/ui/image-viewer.cjs +382 -0
  718. package/dist/ui/image-viewer.cjs.map +1 -0
  719. package/dist/ui/image-viewer.d.ts +50 -0
  720. package/dist/ui/image-viewer.js +382 -0
  721. package/dist/ui/image-viewer.js.map +1 -0
  722. package/dist/voice/chat.cjs +6 -0
  723. package/dist/voice/chat.cjs.map +1 -1
  724. package/dist/voice/chat.d.ts +1 -1
  725. package/dist/voice/chat.js +8 -2
  726. package/dist/voice/livekit-join.cjs +52 -101
  727. package/dist/voice/livekit-join.cjs.map +1 -1
  728. package/dist/voice/livekit-join.d.ts +1 -6
  729. package/dist/voice/livekit-join.js +52 -101
  730. package/dist/voice/livekit-join.js.map +1 -1
  731. package/dist/voice/livekit.cjs.map +1 -1
  732. package/dist/voice/livekit.d.ts +11 -1
  733. package/dist/voice/livekit.js.map +1 -1
  734. package/dist/voice/use-athena-voice-session.cjs +34 -34
  735. package/dist/voice/use-athena-voice-session.cjs.map +1 -1
  736. package/dist/workbench/ComputerLiveDesktop.cjs +13 -13
  737. package/dist/workbench/ComputerLiveDesktop.cjs.map +1 -1
  738. package/dist/workbench/SessionWorkbench.cjs +22 -22
  739. package/dist/workbench/SessionWorkbench.cjs.map +1 -1
  740. package/dist/workbench/session-workbench-context.cjs +3 -3
  741. package/dist/workbench/session-workbench-context.cjs.map +1 -1
  742. package/dist/workbench/session-workbench-panes.cjs +8 -8
  743. package/dist/workbench/session-workbench-panes.cjs.map +1 -1
  744. package/dist/workbench/workbench-layout-context.cjs +3 -3
  745. package/dist/workbench/workbench-layout-context.cjs.map +1 -1
  746. package/package.json +2 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const reactStatewire = require("@assistant-ui/react-statewire");
4
- const react = require("react");
4
+ const require$$0 = require("react");
5
5
  const errors = require("./errors.cjs");
6
6
  const statewireState = require("./statewire-state.cjs");
7
7
  const readSendFailure = (error) => {
@@ -69,6 +69,47 @@ const parseVoiceLiveKitAnswer = (answer) => {
69
69
  }
70
70
  return { serverUrl, token, roomName };
71
71
  };
72
+ class VoiceTransferRoomDroppedError extends Error {
73
+ constructor(reason) {
74
+ super(`The voice room disconnected before the call moved (${reason})`);
75
+ this.reason = reason;
76
+ this.name = "VoiceTransferRoomDroppedError";
77
+ }
78
+ }
79
+ const withAnswerDeadline = async (promise, ms) => {
80
+ let timer = null;
81
+ try {
82
+ return await Promise.race([
83
+ promise,
84
+ new Promise((_, reject) => {
85
+ timer = setTimeout(() => reject(new VoiceAnswerTimeoutError()), ms);
86
+ })
87
+ ]);
88
+ } finally {
89
+ if (timer !== null) clearTimeout(timer);
90
+ }
91
+ };
92
+ const readTransferOffer = (result) => {
93
+ const record = result !== null && typeof result === "object" ? result : null;
94
+ const answer = record == null ? void 0 : record.answer;
95
+ const transferId = record == null ? void 0 : record.transferId;
96
+ return {
97
+ answer: typeof answer === "string" && answer !== "" ? answer : null,
98
+ transferId: typeof transferId === "string" && transferId !== "" ? transferId : null
99
+ };
100
+ };
101
+ const classifyTransferFailure = (error, stage) => {
102
+ const underlying = stage === "commit" ? error instanceof VoiceTransferRoomDroppedError ? { kind: "room_failed" } : classifyVoiceStartError(error) : classifyStartFailure(error, stage);
103
+ return {
104
+ kind: "transfer_failed",
105
+ stage,
106
+ message: describeVoiceTransferFailure({ reason: underlying.kind }),
107
+ reason: underlying.kind,
108
+ ...underlying.code !== void 0 && { code: underlying.code },
109
+ ...underlying.status !== void 0 && { status: underlying.status },
110
+ ...underlying.fate !== void 0 && { fate: underlying.fate }
111
+ };
112
+ };
72
113
  const classifyStartFailure = (error, stage) => {
73
114
  const message = errorMessage(error);
74
115
  switch (stage) {
@@ -111,6 +152,7 @@ const isMicrophoneDenied = (error) => {
111
152
  }
112
153
  return /permission|denied|not allowed/i.test(errorMessage(error));
113
154
  };
155
+ const describeVoiceTransferFailure = ({ reason }) => reason === "microphone_denied" ? "Microphone access is blocked, so the call stayed on your other device. Allow the microphone for Athena and try again." : "The call couldn't move here and is still on your other device. Try again.";
114
156
  const describeVoiceFailure = (failure) => {
115
157
  switch (failure.kind) {
116
158
  case "microphone_denied":
@@ -125,6 +167,8 @@ const describeVoiceFailure = (failure) => {
125
167
  return "The voice room could not be joined. Check your connection and try again.";
126
168
  case "media_lost":
127
169
  return "The voice connection was lost. Start voice again to continue.";
170
+ case "transfer_failed":
171
+ return describeVoiceTransferFailure({ reason: failure.reason });
128
172
  case "server_rejected":
129
173
  if (failure.code === "voice-active") {
130
174
  return "A voice session is already live on another device or tab. End it there first.";
@@ -190,6 +234,8 @@ const RELAY_CAPTURE_FRAME_SAMPLES = 1024;
190
234
  const RELAY_PLAYBACK_LEAD_SECONDS = 0.02;
191
235
  const MEDIA_DISCONNECT_GRACE_MS = 5e3;
192
236
  const END_BEFORE_RESTART_TIMEOUT_MS = 3e3;
237
+ const TRANSFER_OFFER_TIMEOUT_MS = 15e3;
238
+ const TRANSFER_COMMIT_TIMEOUT_MS = 15e3;
193
239
  const mintVoiceId = ({ kind }) => `voice${kind}_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}`;
194
240
  const formatVoiceElapsed = (sinceMs, nowMs = Date.now()) => {
195
241
  const total = Math.max(0, Math.floor((nowMs - sinceMs) / 1e3));
@@ -200,8 +246,8 @@ const formatVoiceElapsed = (sinceMs, nowMs = Date.now()) => {
200
246
  return hours > 0 ? `${hours}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}` : mmss;
201
247
  };
202
248
  const useVoiceElapsed = (since) => {
203
- const [now, setNow] = react.useState(() => Date.now());
204
- react.useEffect(() => {
249
+ const [now, setNow] = require$$0.useState(() => Date.now());
250
+ require$$0.useEffect(() => {
205
251
  if (since === null) return;
206
252
  setNow(Date.now());
207
253
  const timer = setInterval(() => setNow(Date.now()), 1e3);
@@ -209,6 +255,42 @@ const useVoiceElapsed = (since) => {
209
255
  }, [since]);
210
256
  return since === null ? null : formatVoiceElapsed(since, now);
211
257
  };
258
+ const VOICE_SURFACE_LABELS = {
259
+ web: "browser",
260
+ mobile: "phone",
261
+ chrome: "Chrome",
262
+ desktop: "desktop app",
263
+ office: "Office"
264
+ };
265
+ const voiceSurfaceLabel = (surface) => VOICE_SURFACE_LABELS[surface];
266
+ const VOICE_MOVE_CALL_HERE_LABEL = "Move call here";
267
+ const VOICE_MOVE_HERE_ACTION = "Move here";
268
+ const VOICE_CONTINUE_BY_VOICE_LABEL = "Continue by voice";
269
+ const describeVoiceLiveElsewhere = (surface) => `Live call on your ${voiceSurfaceLabel(surface)}`;
270
+ const describeVoiceMovedTo = (surface) => `Call moved to your ${voiceSurfaceLabel(surface)}`;
271
+ const VOICE_MOVED_NOTICE_MS = 6e3;
272
+ const useVoiceMovedNotice = (movedTo) => {
273
+ const [expired, setExpired] = require$$0.useState(null);
274
+ require$$0.useEffect(() => {
275
+ if (movedTo === null) return;
276
+ const timer = setTimeout(() => setExpired(movedTo), VOICE_MOVED_NOTICE_MS);
277
+ return () => clearTimeout(timer);
278
+ }, [movedTo]);
279
+ return movedTo !== null && expired !== movedTo ? describeVoiceMovedTo(movedTo.surface) : null;
280
+ };
281
+ const VOICE_SURFACES = new Set(Object.keys(VOICE_SURFACE_LABELS));
282
+ const parseVoiceOwner = (value) => {
283
+ if (value === null || typeof value !== "object") return null;
284
+ const { clientId, surface, since, transferable } = value;
285
+ if (typeof clientId !== "string" || clientId === "") return null;
286
+ if (typeof since !== "number" || !Number.isFinite(since)) return null;
287
+ return {
288
+ clientId,
289
+ surface: typeof surface === "string" && VOICE_SURFACES.has(surface) ? surface : "web",
290
+ since,
291
+ transferable: transferable === true
292
+ };
293
+ };
212
294
  const REQUEST_LABELS = {
213
295
  "session.commentary.append": "a result for the voice conversation",
214
296
  "session.thinking.append": "a context update",
@@ -277,11 +359,16 @@ const waitForRelayOpen = (ws, timeoutMs) => new Promise((resolve, reject) => {
277
359
  reject(new Error("The voice relay closed before it opened"));
278
360
  });
279
361
  });
362
+ const useRetainedHydrated = (value, initial) => {
363
+ const ref = require$$0.useRef(initial);
364
+ if (value !== void 0) ref.current = value;
365
+ return ref.current;
366
+ };
280
367
  const useDeepAgentVoice = (options = {}) => {
281
368
  const wireSendCommand = reactStatewire.useStatewireSendCommand();
282
- const sendCommandRef = react.useRef(wireSendCommand);
369
+ const sendCommandRef = require$$0.useRef(wireSendCommand);
283
370
  sendCommandRef.current = wireSendCommand;
284
- const sendCommand = react.useCallback(
371
+ const sendCommand = require$$0.useCallback(
285
372
  async (command) => sendCommandRef.current(command),
286
373
  []
287
374
  );
@@ -289,60 +376,106 @@ const useDeepAgentVoice = (options = {}) => {
289
376
  // The raw wire state is non-object until the attach snapshot hydrates it.
290
377
  (s) => statewireState.readDeepAgentStreamValues(s).voice ?? null
291
378
  );
292
- const [phase, setPhase] = react.useState("idle");
293
- const [failure, setFailure] = react.useState(null);
379
+ const [phase, setPhase] = require$$0.useState("idle");
380
+ const [failure, setFailure] = require$$0.useState(null);
294
381
  const error = (failure == null ? void 0 : failure.message) ?? null;
295
- const [micMuted, setMicMutedState] = react.useState(false);
296
- const micMutedRef = react.useRef(false);
297
- const micChangeRef = react.useRef(0);
298
- const [liveSince, setLiveSince] = react.useState(null);
299
- const [handoffTask, setHandoffTask] = react.useState(null);
300
- const lastActiveTaskRef = react.useRef(null);
301
- const pcRef = react.useRef(null);
302
- const releasePeerListenersRef = react.useRef(null);
303
- const streamRef = react.useRef(null);
304
- const wsRef = react.useRef(null);
305
- const audioContextRef = react.useRef(null);
306
- const audioNodesRef = react.useRef([]);
307
- const playheadRef = react.useRef(0);
308
- const livekitRef = react.useRef(null);
309
- const livekitAbortRef = react.useRef(null);
310
- const attemptRef = react.useRef(0);
311
- const callAttemptIdRef = react.useRef("");
382
+ const [micMuted, setMicMutedState] = require$$0.useState(false);
383
+ const micMutedRef = require$$0.useRef(false);
384
+ const micChangeRef = require$$0.useRef(0);
385
+ const [liveSince, setLiveSince] = require$$0.useState(null);
386
+ const [handoffTask, setHandoffTask] = require$$0.useState(null);
387
+ const lastActiveTaskRef = require$$0.useRef(null);
388
+ const pcRef = require$$0.useRef(null);
389
+ const releasePeerListenersRef = require$$0.useRef(null);
390
+ const streamRef = require$$0.useRef(null);
391
+ const wsRef = require$$0.useRef(null);
392
+ const audioContextRef = require$$0.useRef(null);
393
+ const audioNodesRef = require$$0.useRef([]);
394
+ const playheadRef = require$$0.useRef(0);
395
+ const livekitRef = require$$0.useRef(null);
396
+ const livekitAbortRef = require$$0.useRef(null);
397
+ const attemptRef = require$$0.useRef(0);
398
+ const callAttemptIdRef = require$$0.useRef("");
312
399
  const observedAttempt = reactStatewire.useStatewireState((s) => {
313
400
  if (!statewireState.isDeepAgentStateHydrated(s)) return void 0;
314
401
  const values = statewireState.readDeepAgentStreamValues(s);
315
402
  const value = values.voiceStartFence ?? values.voiceAttemptId;
316
403
  return typeof value === "string" ? value : null;
317
404
  });
318
- const observedAttemptRef = react.useRef(void 0);
405
+ const observedAttemptRef = require$$0.useRef(void 0);
319
406
  if (observedAttempt !== void 0) observedAttemptRef.current = observedAttempt ?? void 0;
320
- const startingRef = react.useRef(false);
321
- const startPromiseRef = react.useRef(null);
322
- const autoRestartedRef = react.useRef(false);
323
- const onRemoteStreamRef = react.useRef(options.onRemoteStream);
407
+ const startingRef = require$$0.useRef(false);
408
+ const startPromiseRef = require$$0.useRef(null);
409
+ const autoRestartedRef = require$$0.useRef(false);
410
+ const onRemoteStreamRef = require$$0.useRef(options.onRemoteStream);
324
411
  onRemoteStreamRef.current = options.onRemoteStream;
325
- const audioSessionRef = react.useRef(options.audioSession);
412
+ const audioSessionRef = require$$0.useRef(options.audioSession);
326
413
  audioSessionRef.current = options.audioSession;
327
- const transportRef = react.useRef(options.transport ?? "webrtc");
414
+ const transportRef = require$$0.useRef(options.transport ?? "webrtc");
328
415
  transportRef.current = options.transport ?? "webrtc";
329
- const relayUrlRef = react.useRef(options.relayUrl);
416
+ const relayUrlRef = require$$0.useRef(options.relayUrl);
330
417
  relayUrlRef.current = options.relayUrl;
331
- const livekitAdapterRef = react.useRef(options.livekit);
418
+ const livekitAdapterRef = require$$0.useRef(options.livekit);
332
419
  livekitAdapterRef.current = options.livekit;
333
- const modelRef = react.useRef(options.model);
420
+ const modelRef = require$$0.useRef(options.model);
334
421
  modelRef.current = options.model;
335
- const onDiagnosticRef = react.useRef(options.onDiagnostic);
422
+ const onDiagnosticRef = require$$0.useRef(options.onDiagnostic);
336
423
  onDiagnosticRef.current = options.onDiagnostic;
337
- const timeoutsRef = react.useRef(options.timeouts);
424
+ const onCallMovedRef = require$$0.useRef(options.onCallMoved);
425
+ onCallMovedRef.current = options.onCallMoved;
426
+ const timeoutsRef = require$$0.useRef(options.timeouts);
338
427
  timeoutsRef.current = options.timeouts;
339
- const phaseRef = react.useRef("idle");
428
+ const phaseRef = require$$0.useRef("idle");
340
429
  phaseRef.current = phase;
341
- const attemptStartedAtRef = react.useRef(0);
342
- const activeAudioSessionRef = react.useRef(null);
343
- const startingAudioSessionRef = react.useRef(null);
344
- const audioSessionIdleRef = react.useRef(Promise.resolve());
345
- const report = react.useCallback(
430
+ const attemptStartedAtRef = require$$0.useRef(0);
431
+ const activeAudioSessionRef = require$$0.useRef(null);
432
+ const startingAudioSessionRef = require$$0.useRef(null);
433
+ const audioSessionIdleRef = require$$0.useRef(Promise.resolve());
434
+ const ownClientIdRef = require$$0.useRef(null);
435
+ const lastOwnedClientIdRef = require$$0.useRef(null);
436
+ const transferRef = require$$0.useRef(null);
437
+ const [movedTo, setMovedTo] = require$$0.useState(null);
438
+ const hydratedTransferCapable = reactStatewire.useStatewireState(
439
+ (s) => statewireState.isDeepAgentStateHydrated(s) ? "voiceOwner" in statewireState.readDeepAgentStreamValues(s) : void 0
440
+ );
441
+ const hydratedVoiceOwner = reactStatewire.useStatewireState(
442
+ (s) => statewireState.isDeepAgentStateHydrated(s) ? statewireState.readDeepAgentStreamValues(s).voiceOwner ?? null : void 0
443
+ );
444
+ const hydratedWireOwnerId = reactStatewire.useStatewireState((s) => {
445
+ if (!statewireState.isDeepAgentStateHydrated(s)) return void 0;
446
+ const wire = statewireState.readDeepAgentStreamValues(s).voice;
447
+ return typeof (wire == null ? void 0 : wire.clientId) === "string" && wire.clientId !== "" ? wire.clientId : null;
448
+ });
449
+ const hydratedWireLive = reactStatewire.useStatewireState((s) => {
450
+ if (!statewireState.isDeepAgentStateHydrated(s)) return void 0;
451
+ const wire = statewireState.readDeepAgentStreamValues(s).voice;
452
+ return (wire == null ? void 0 : wire.status) === "live";
453
+ });
454
+ const transferCapable = useRetainedHydrated(hydratedTransferCapable, false);
455
+ const wireVoiceOwner = useRetainedHydrated(hydratedVoiceOwner, null);
456
+ const wireOwnerId = useRetainedHydrated(hydratedWireOwnerId, null);
457
+ const wireLive = useRetainedHydrated(hydratedWireLive, false);
458
+ const voiceOwner = require$$0.useMemo(
459
+ () => transferCapable ? parseVoiceOwner(wireVoiceOwner) : null,
460
+ [transferCapable, wireVoiceOwner]
461
+ );
462
+ const transferCapableRef = require$$0.useRef(transferCapable);
463
+ transferCapableRef.current = transferCapable;
464
+ const voiceOwnerRef = require$$0.useRef(voiceOwner);
465
+ voiceOwnerRef.current = voiceOwner;
466
+ const wireOwnerIdRef = require$$0.useRef(wireOwnerId);
467
+ wireOwnerIdRef.current = wireOwnerId;
468
+ const canTakeCall = transportRef.current === "livekit" && livekitAdapterRef.current !== void 0;
469
+ const elsewhere = voiceOwner !== null && voiceOwner.transferable && wireLive && canTakeCall && (phase === "idle" || phase === "error") && voiceOwner.clientId !== lastOwnedClientIdRef.current ? voiceOwner : null;
470
+ const elsewhereSurface = (elsewhere == null ? void 0 : elsewhere.surface) ?? null;
471
+ const elsewhereSince = (elsewhere == null ? void 0 : elsewhere.since) ?? null;
472
+ const liveElsewhere = require$$0.useMemo(
473
+ () => elsewhereSurface === null || elsewhereSince === null ? null : { surface: elsewhereSurface, since: elsewhereSince },
474
+ [elsewhereSurface, elsewhereSince]
475
+ );
476
+ const liveElsewhereRef = require$$0.useRef(liveElsewhere);
477
+ liveElsewhereRef.current = liveElsewhere;
478
+ const report = require$$0.useCallback(
346
479
  (event, attempt, data) => {
347
480
  const observer = onDiagnosticRef.current;
348
481
  if (!observer) return;
@@ -360,13 +493,21 @@ const useDeepAgentVoice = (options = {}) => {
360
493
  },
361
494
  []
362
495
  );
363
- const releaseAudioSession = react.useCallback(() => {
496
+ const releaseAudioSession = require$$0.useCallback(() => {
364
497
  const session = activeAudioSessionRef.current;
365
498
  if (!session) return;
366
499
  activeAudioSessionRef.current = null;
367
500
  audioSessionIdleRef.current = audioSessionIdleRef.current.then(() => session.stop()).catch(() => void 0);
368
501
  }, []);
369
- const teardown = react.useCallback(() => {
502
+ const notifyCallMoved = require$$0.useCallback((move) => {
503
+ const observer = onCallMovedRef.current;
504
+ if (!observer) return;
505
+ try {
506
+ void Promise.resolve(observer(move)).catch(() => void 0);
507
+ } catch {
508
+ }
509
+ }, []);
510
+ const teardown = require$$0.useCallback((options2) => {
370
511
  attemptRef.current += 1;
371
512
  const livekitAbort = livekitAbortRef.current;
372
513
  livekitAbortRef.current = null;
@@ -375,7 +516,7 @@ const useDeepAgentVoice = (options = {}) => {
375
516
  var _a, _b;
376
517
  return (_b = (_a = startingAudioSessionRef.current) == null ? void 0 : _a.cancelStart) == null ? void 0 : _b.call(_a);
377
518
  });
378
- releaseAudioSession();
519
+ if ((options2 == null ? void 0 : options2.keepAudioSession) !== true) releaseAudioSession();
379
520
  const releasePeerListeners = releasePeerListenersRef.current;
380
521
  releasePeerListenersRef.current = null;
381
522
  releaseSafely(() => releasePeerListeners == null ? void 0 : releasePeerListeners());
@@ -406,7 +547,7 @@ const useDeepAgentVoice = (options = {}) => {
406
547
  return (_a = onRemoteStreamRef.current) == null ? void 0 : _a.call(onRemoteStreamRef, null);
407
548
  });
408
549
  }, [releaseAudioSession]);
409
- const fail = react.useCallback(
550
+ const fail = require$$0.useCallback(
410
551
  (nextFailure) => {
411
552
  report("error", attemptRef.current, {
412
553
  kind: nextFailure.kind,
@@ -423,10 +564,105 @@ const useDeepAgentVoice = (options = {}) => {
423
564
  },
424
565
  [report, teardown]
425
566
  );
426
- const handleMediaLossRef = react.useRef(
567
+ const handleMovedAway = require$$0.useCallback(() => {
568
+ var _a;
569
+ const surface = ((_a = voiceOwnerRef.current) == null ? void 0 : _a.surface) ?? "web";
570
+ report("moved", attemptRef.current, { toSurface: surface });
571
+ notifyCallMoved({ direction: "away", surface });
572
+ teardown();
573
+ ownClientIdRef.current = null;
574
+ micMutedRef.current = false;
575
+ setMicMutedState(false);
576
+ setHandoffTask(null);
577
+ setFailure(null);
578
+ setPhase("idle");
579
+ setMovedTo({ surface });
580
+ }, [notifyCallMoved, report, teardown]);
581
+ const ownerMovedAway = require$$0.useCallback(() => {
582
+ const own = ownClientIdRef.current;
583
+ const current = wireOwnerIdRef.current;
584
+ return transferCapableRef.current && own !== null && current !== null && current !== own;
585
+ }, []);
586
+ const acquireAudioSession = require$$0.useCallback(
587
+ async ({
588
+ attempt,
589
+ audioSession
590
+ }) => {
591
+ const held = activeAudioSessionRef.current;
592
+ if (held !== null && held !== audioSession) releaseAudioSession();
593
+ await audioSessionIdleRef.current;
594
+ if (attemptRef.current !== attempt) {
595
+ report("stale-attempt", attempt, { stage: "audio-session" });
596
+ return false;
597
+ }
598
+ if (activeAudioSessionRef.current === audioSession) {
599
+ report("audio-session-ready", attempt, { reused: true });
600
+ return true;
601
+ }
602
+ startingAudioSessionRef.current = audioSession;
603
+ try {
604
+ await audioSession.start();
605
+ } finally {
606
+ startingAudioSessionRef.current = null;
607
+ }
608
+ activeAudioSessionRef.current = audioSession;
609
+ if (attemptRef.current !== attempt) {
610
+ report("stale-attempt", attempt, { stage: "audio-session" });
611
+ releaseAudioSession();
612
+ return false;
613
+ }
614
+ report("audio-session-ready", attempt);
615
+ return true;
616
+ },
617
+ [releaseAudioSession, report]
618
+ );
619
+ const joinVoiceRoom = require$$0.useCallback(
620
+ async ({
621
+ attempt,
622
+ room,
623
+ adapter,
624
+ controller = new AbortController(),
625
+ onDisconnectedAfterJoin
626
+ }) => {
627
+ let joined = false;
628
+ let disconnectedWhileJoining = false;
629
+ livekitAbortRef.current = controller;
630
+ const session = await adapter.connect(room, {
631
+ micMuted: micMutedRef.current,
632
+ signal: controller.signal,
633
+ onDisconnected: (reason) => {
634
+ if (attemptRef.current !== attempt) return;
635
+ if (!joined) {
636
+ disconnectedWhileJoining = true;
637
+ return;
638
+ }
639
+ onDisconnectedAfterJoin(reason);
640
+ },
641
+ // Telemetry about this attempt's room stays this attempt's even after
642
+ // it ended: the room's closing summary arrives after teardown.
643
+ onEvent: (event) => {
644
+ report("media-event", attempt, { ...event.data, type: event.type });
645
+ }
646
+ });
647
+ if (attemptRef.current !== attempt) {
648
+ releaseSafely(() => session.disconnect());
649
+ return false;
650
+ }
651
+ if (disconnectedWhileJoining) {
652
+ releaseSafely(() => session.disconnect());
653
+ throw new Error("The voice room disconnected while joining");
654
+ }
655
+ joined = true;
656
+ livekitRef.current = session;
657
+ report("room-joined", attempt, { roomName: room.roomName });
658
+ return true;
659
+ },
660
+ [report]
661
+ );
662
+ const handleMediaLossRef = require$$0.useRef(
427
663
  async () => void 0
428
664
  );
429
- const watchConnection = react.useCallback((pc, attempt) => {
665
+ const watchConnection = require$$0.useCallback((pc, attempt) => {
430
666
  let disconnectTimer = null;
431
667
  const clearDisconnectTimer = () => {
432
668
  if (disconnectTimer === null) return;
@@ -467,7 +703,7 @@ const useDeepAgentVoice = (options = {}) => {
467
703
  releaseSafely(() => pc.removeEventListener("iceconnectionstatechange", onChange));
468
704
  };
469
705
  }, [report]);
470
- const playRelayChunk = react.useCallback((audio, data) => {
706
+ const playRelayChunk = require$$0.useCallback((audio, data) => {
471
707
  const pcm = new Int16Array(data);
472
708
  if (pcm.length === 0) return;
473
709
  const samples = float32FromPcm16(pcm);
@@ -480,12 +716,15 @@ const useDeepAgentVoice = (options = {}) => {
480
716
  node.start(startAt);
481
717
  playheadRef.current = startAt + buffer.duration;
482
718
  }, []);
483
- const runStartSession = react.useCallback(async () => {
719
+ const runStartSession = require$$0.useCallback(async ({
720
+ opening
721
+ } = {}) => {
484
722
  var _a, _b, _c;
485
723
  const attempt = attemptRef.current += 1;
486
724
  const attemptId = mintVoiceId({ kind: "attempt" });
487
725
  const previousAttemptId = observedAttemptRef.current;
488
726
  callAttemptIdRef.current = attemptId;
727
+ ownClientIdRef.current = null;
489
728
  startingRef.current = true;
490
729
  attemptStartedAtRef.current = Date.now();
491
730
  setFailure(null);
@@ -499,7 +738,10 @@ const useDeepAgentVoice = (options = {}) => {
499
738
  report("stale-attempt", attempt, { stage });
500
739
  releaseAudioSession();
501
740
  };
502
- report("start-requested", attempt, { transport: transportRef.current });
741
+ report("start-requested", attempt, {
742
+ transport: transportRef.current,
743
+ ...opening !== void 0 && { opening }
744
+ });
503
745
  try {
504
746
  const transport = transportRef.current;
505
747
  const mediaDevices = (_a = voiceGlobals.navigator) == null ? void 0 : _a.mediaDevices;
@@ -521,23 +763,7 @@ const useDeepAgentVoice = (options = {}) => {
521
763
  const audioSession = audioSessionRef.current;
522
764
  if (audioSession) {
523
765
  stage = "audio-session";
524
- await audioSessionIdleRef.current;
525
- if (attemptRef.current !== attempt) {
526
- report("stale-attempt", attempt, { stage });
527
- return;
528
- }
529
- startingAudioSessionRef.current = audioSession;
530
- try {
531
- await audioSession.start();
532
- } finally {
533
- startingAudioSessionRef.current = null;
534
- }
535
- activeAudioSessionRef.current = audioSession;
536
- if (attemptRef.current !== attempt) {
537
- stale();
538
- return;
539
- }
540
- report("audio-session-ready", attempt);
766
+ if (!await acquireAudioSession({ attempt, audioSession })) return;
541
767
  }
542
768
  const modelOption = modelRef.current;
543
769
  const requestedModel = typeof modelOption === "function" ? modelOption() : modelOption;
@@ -547,7 +773,8 @@ const useDeepAgentVoice = (options = {}) => {
547
773
  offer: offer2,
548
774
  attemptId,
549
775
  ...previousAttemptId !== void 0 && { previousAttemptId },
550
- ...model2 !== void 0 && { model: model2 }
776
+ ...model2 !== void 0 && { model: model2 },
777
+ ...opening !== void 0 && { opening }
551
778
  });
552
779
  const negotiateStart = async (offer2) => {
553
780
  stage = "negotiate";
@@ -592,34 +819,16 @@ const useDeepAgentVoice = (options = {}) => {
592
819
  try {
593
820
  const room = parseVoiceLiveKitAnswer(answer2);
594
821
  stage = "room";
595
- let joined = false;
596
- let disconnectedWhileJoining = false;
597
- const controller = new AbortController();
598
- livekitAbortRef.current = controller;
599
- const session = await livekitAdapter.connect(room, {
600
- micMuted: micMutedRef.current,
601
- signal: controller.signal,
602
- onDisconnected: (reason) => {
603
- if (attemptRef.current !== attempt) return;
604
- if (!joined) {
605
- disconnectedWhileJoining = true;
606
- return;
607
- }
608
- void handleMediaLossRef.current(attempt, reason);
609
- }
822
+ const joinedRoom = await joinVoiceRoom({
823
+ attempt,
824
+ room,
825
+ adapter: livekitAdapter,
826
+ onDisconnectedAfterJoin: (reason) => void handleMediaLossRef.current(attempt, reason)
610
827
  });
611
- if (attemptRef.current !== attempt) {
612
- releaseSafely(() => session.disconnect());
828
+ if (!joinedRoom) {
613
829
  stale();
614
830
  return;
615
831
  }
616
- if (disconnectedWhileJoining) {
617
- releaseSafely(() => session.disconnect());
618
- throw new Error("The voice room disconnected while joining");
619
- }
620
- joined = true;
621
- livekitRef.current = session;
622
- report("room-joined", attempt, { roomName: room.roomName });
623
832
  } catch (roomError) {
624
833
  if (attemptRef.current === attempt)
625
834
  void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
@@ -781,10 +990,19 @@ const useDeepAgentVoice = (options = {}) => {
781
990
  } finally {
782
991
  startingRef.current = false;
783
992
  }
784
- }, [fail, playRelayChunk, releaseAudioSession, report, sendCommand, watchConnection]);
785
- const startSession = react.useCallback(async () => {
993
+ }, [
994
+ acquireAudioSession,
995
+ fail,
996
+ joinVoiceRoom,
997
+ playRelayChunk,
998
+ releaseAudioSession,
999
+ report,
1000
+ sendCommand,
1001
+ watchConnection
1002
+ ]);
1003
+ const startSession = require$$0.useCallback(async (options2 = {}) => {
786
1004
  if (pcRef.current || wsRef.current || livekitRef.current || startingRef.current) return;
787
- const run = runStartSession();
1005
+ const run = runStartSession(options2);
788
1006
  startPromiseRef.current = run;
789
1007
  try {
790
1008
  await run;
@@ -792,18 +1010,23 @@ const useDeepAgentVoice = (options = {}) => {
792
1010
  if (startPromiseRef.current === run) startPromiseRef.current = null;
793
1011
  }
794
1012
  }, [runStartSession]);
795
- const startRef = react.useRef(startSession);
1013
+ const startRef = require$$0.useRef(startSession);
796
1014
  startRef.current = startSession;
797
- const handleMediaLoss = react.useCallback(
1015
+ const handleMediaLoss = require$$0.useCallback(
798
1016
  async (attempt, reason) => {
799
1017
  if (attemptRef.current !== attempt) return;
1018
+ if (ownerMovedAway()) {
1019
+ handleMovedAway();
1020
+ return;
1021
+ }
1022
+ const restarting = !autoRestartedRef.current;
800
1023
  report("media-loss", attempt, {
801
1024
  reason,
802
- restartBudgetLeft: !autoRestartedRef.current
1025
+ restartBudgetLeft: restarting
803
1026
  });
804
1027
  if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
805
1028
  const ending = sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
806
- teardown();
1029
+ teardown({ keepAudioSession: restarting });
807
1030
  const recovery = attemptRef.current;
808
1031
  setPhase("idle");
809
1032
  let endTimer;
@@ -820,6 +1043,10 @@ const useDeepAgentVoice = (options = {}) => {
820
1043
  const inflight = startPromiseRef.current;
821
1044
  if (inflight) await inflight.catch(() => void 0);
822
1045
  if (attemptRef.current !== recovery) return;
1046
+ if (ownerMovedAway()) {
1047
+ handleMovedAway();
1048
+ return;
1049
+ }
823
1050
  if (!autoRestartedRef.current) {
824
1051
  autoRestartedRef.current = true;
825
1052
  report("auto-restart", recovery, { trigger: "media-loss", reason });
@@ -842,69 +1069,284 @@ const useDeepAgentVoice = (options = {}) => {
842
1069
  setFailure(lost);
843
1070
  setPhase("error");
844
1071
  },
845
- [report, sendCommand, teardown]
1072
+ [handleMovedAway, ownerMovedAway, report, sendCommand, teardown]
846
1073
  );
847
1074
  handleMediaLossRef.current = handleMediaLoss;
848
- const start = react.useCallback(async () => {
1075
+ const start = require$$0.useCallback(async (options2) => {
849
1076
  if (pcRef.current || wsRef.current || livekitRef.current || startingRef.current) return;
850
1077
  micMutedRef.current = false;
851
1078
  setMicMutedState(false);
852
1079
  autoRestartedRef.current = false;
853
1080
  setHandoffTask(null);
854
- await startSession();
1081
+ setMovedTo(null);
1082
+ await startSession((options2 == null ? void 0 : options2.opening) === "recap" ? { opening: "recap" } : {});
855
1083
  }, [startSession]);
856
- const end = react.useCallback(() => {
1084
+ const runTransferHere = require$$0.useCallback(async () => {
1085
+ var _a;
1086
+ const fromSurface = ((_a = liveElsewhereRef.current) == null ? void 0 : _a.surface) ?? "web";
1087
+ const attempt = attemptRef.current += 1;
1088
+ const attemptId = mintVoiceId({ kind: "attempt" });
1089
+ callAttemptIdRef.current = attemptId;
1090
+ ownClientIdRef.current = null;
1091
+ const transfer = { attempt, transferId: null };
1092
+ transferRef.current = transfer;
1093
+ startingRef.current = true;
1094
+ attemptStartedAtRef.current = Date.now();
1095
+ setFailure(null);
1096
+ setPhase("connecting");
1097
+ let stage = "preflight";
1098
+ const timeouts = timeoutsRef.current;
1099
+ const offerMs = Math.min((timeouts == null ? void 0 : timeouts.answerMs) ?? ANSWER_TIMEOUT_MS, TRANSFER_OFFER_TIMEOUT_MS);
1100
+ const commitMs = (timeouts == null ? void 0 : timeouts.transferCommitMs) ?? TRANSFER_COMMIT_TIMEOUT_MS;
1101
+ const cancel = () => {
1102
+ const transferId = transfer.transferId;
1103
+ if (transferId === null) return;
1104
+ void sendCommand({ type: "voice/transfer-cancel", transferId }).catch(() => void 0);
1105
+ };
1106
+ let promotedCallEnded = false;
1107
+ const endPromotedCall = () => {
1108
+ if (promotedCallEnded) return;
1109
+ promotedCallEnded = true;
1110
+ void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
1111
+ };
1112
+ const stale = () => {
1113
+ report("stale-attempt", attempt, { stage, transfer: true });
1114
+ if (transferRef.current === transfer) {
1115
+ transferRef.current = null;
1116
+ cancel();
1117
+ }
1118
+ releaseAudioSession();
1119
+ };
1120
+ const controller = new AbortController();
1121
+ livekitAbortRef.current = controller;
1122
+ const superseded = new Promise((_, reject) => {
1123
+ controller.signal.addEventListener("abort", () => reject(new Error("The move was superseded")), {
1124
+ once: true
1125
+ });
1126
+ });
1127
+ void superseded.catch(() => void 0);
1128
+ report("start-requested", attempt, { transport: "livekit", transfer: true });
1129
+ try {
1130
+ const livekitAdapter = livekitAdapterRef.current;
1131
+ if (transportRef.current !== "livekit" || !livekitAdapter)
1132
+ throw new Error("Voice is unavailable in this environment");
1133
+ const audioSession = audioSessionRef.current;
1134
+ if (audioSession) {
1135
+ stage = "audio-session";
1136
+ if (!await acquireAudioSession({ attempt, audioSession })) {
1137
+ stale();
1138
+ return;
1139
+ }
1140
+ }
1141
+ stage = "negotiate";
1142
+ const negotiationStartedAt = Date.now();
1143
+ const offer = sendCommand({ type: "voice/transfer-offer", attemptId });
1144
+ void offer.then((result) => {
1145
+ if (attemptRef.current === attempt) return;
1146
+ const { transferId } = readTransferOffer(result);
1147
+ if (transferId !== null)
1148
+ void sendCommand({ type: "voice/transfer-cancel", transferId }).catch(() => void 0);
1149
+ }).catch(() => void 0);
1150
+ const offered = readTransferOffer(
1151
+ await withAnswerDeadline(Promise.race([offer, superseded]), offerMs)
1152
+ );
1153
+ report("answer-received", attempt, {
1154
+ negotiationMs: Date.now() - negotiationStartedAt,
1155
+ transfer: true
1156
+ });
1157
+ if (attemptRef.current !== attempt) {
1158
+ stale();
1159
+ return;
1160
+ }
1161
+ stage = "answer";
1162
+ transfer.transferId = offered.transferId;
1163
+ if (offered.transferId === null || offered.answer === null)
1164
+ throw new VoiceNoAnswerError("voice/transfer-offer returned no voice room");
1165
+ const room = parseVoiceLiveKitAnswer(offered.answer);
1166
+ stage = "room";
1167
+ let moved = false;
1168
+ let roomDropped = () => void 0;
1169
+ const dropped = new Promise((_, reject) => {
1170
+ roomDropped = (reason) => reject(new VoiceTransferRoomDroppedError(reason));
1171
+ });
1172
+ void dropped.catch(() => void 0);
1173
+ const joinedRoom = await joinVoiceRoom({
1174
+ attempt,
1175
+ room,
1176
+ adapter: livekitAdapter,
1177
+ controller,
1178
+ onDisconnectedAfterJoin: (reason) => {
1179
+ if (moved) void handleMediaLossRef.current(attempt, reason);
1180
+ else roomDropped(reason);
1181
+ }
1182
+ });
1183
+ if (!joinedRoom) {
1184
+ stale();
1185
+ return;
1186
+ }
1187
+ stage = "commit";
1188
+ const commit = sendCommand({
1189
+ type: "voice/transfer-commit",
1190
+ transferId: offered.transferId,
1191
+ attemptId
1192
+ });
1193
+ void commit.then(
1194
+ () => {
1195
+ if (attemptRef.current !== attempt) endPromotedCall();
1196
+ },
1197
+ (commitError) => {
1198
+ if (attemptRef.current === attempt) return;
1199
+ const failure2 = readSendFailure(commitError);
1200
+ if (failure2 !== null && failure2.fate !== "rejected") endPromotedCall();
1201
+ }
1202
+ );
1203
+ await withAnswerDeadline(Promise.race([commit, dropped, superseded]), commitMs);
1204
+ if (attemptRef.current !== attempt) {
1205
+ stale();
1206
+ return;
1207
+ }
1208
+ moved = true;
1209
+ transferRef.current = null;
1210
+ report("live", attempt, { transport: "livekit", transfer: true });
1211
+ setPhase("live");
1212
+ setLiveSince(Date.now());
1213
+ notifyCallMoved({ direction: "here", surface: fromSurface });
1214
+ } catch (transferError) {
1215
+ if (attemptRef.current !== attempt) {
1216
+ stale();
1217
+ return;
1218
+ }
1219
+ cancel();
1220
+ const sendFailure = readSendFailure(transferError);
1221
+ if (stage === "commit" && sendFailure !== null && sendFailure.fate !== "rejected")
1222
+ endPromotedCall();
1223
+ transferRef.current = null;
1224
+ fail(classifyTransferFailure(transferError, stage));
1225
+ } finally {
1226
+ startingRef.current = false;
1227
+ }
1228
+ }, [
1229
+ acquireAudioSession,
1230
+ fail,
1231
+ joinVoiceRoom,
1232
+ notifyCallMoved,
1233
+ releaseAudioSession,
1234
+ report,
1235
+ sendCommand
1236
+ ]);
1237
+ const transferHere = require$$0.useCallback(async () => {
1238
+ if (pcRef.current || wsRef.current || livekitRef.current || startingRef.current) return;
1239
+ if (liveElsewhereRef.current === null) return;
1240
+ micMutedRef.current = false;
1241
+ setMicMutedState(false);
1242
+ autoRestartedRef.current = false;
1243
+ setHandoffTask(null);
1244
+ setMovedTo(null);
1245
+ const run = runTransferHere();
1246
+ startPromiseRef.current = run;
1247
+ try {
1248
+ await run;
1249
+ } finally {
1250
+ if (startPromiseRef.current === run) startPromiseRef.current = null;
1251
+ }
1252
+ }, [runTransferHere]);
1253
+ const releaseCall = require$$0.useCallback(() => {
1254
+ const transfer = transferRef.current;
1255
+ transferRef.current = null;
1256
+ if (transfer !== null) {
1257
+ if (transfer.transferId !== null) {
1258
+ void sendCommand({ type: "voice/transfer-cancel", transferId: transfer.transferId }).catch(
1259
+ () => void 0
1260
+ );
1261
+ }
1262
+ return;
1263
+ }
1264
+ void sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
1265
+ }, [sendCommand]);
1266
+ const end = require$$0.useCallback(() => {
857
1267
  if (phase === "connecting" || phase === "live") {
858
1268
  report("end", attemptRef.current, { source: "user", phase });
859
- void sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
860
- if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
1269
+ const moving = transferRef.current !== null;
1270
+ releaseCall();
1271
+ if (!moving && lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
861
1272
  }
862
1273
  teardown();
863
1274
  micMutedRef.current = false;
864
1275
  setMicMutedState(false);
865
1276
  setPhase("idle");
866
- }, [phase, report, sendCommand, teardown]);
867
- const setMicMuted = react.useCallback(
1277
+ }, [phase, releaseCall, report, teardown]);
1278
+ const setMicMuted = require$$0.useCallback(
868
1279
  (muted) => {
869
1280
  if (phase !== "live") return;
870
1281
  const attempt = attemptRef.current;
1282
+ const attemptId = callAttemptIdRef.current;
871
1283
  const change = ++micChangeRef.current;
872
1284
  const applyLocal = (value) => {
873
1285
  var _a;
874
1286
  micMutedRef.current = value;
875
1287
  setMicMutedState(value);
876
- for (const track of ((_a = streamRef.current) == null ? void 0 : _a.getTracks()) ?? []) track.enabled = !value;
877
1288
  const room = livekitRef.current;
878
- if (room) releaseSafely(() => room.setMicrophoneEnabled(!value));
1289
+ const mediaFailed = () => {
1290
+ if (attemptRef.current !== attempt || micChangeRef.current !== change || livekitRef.current !== room) return;
1291
+ void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
1292
+ if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
1293
+ fail({
1294
+ kind: "media_lost",
1295
+ stage: "media",
1296
+ reason: "microphone-control-failed",
1297
+ message: "Voice ended because the microphone could not be changed. Start a new call to try again."
1298
+ });
1299
+ };
1300
+ try {
1301
+ for (const track of ((_a = streamRef.current) == null ? void 0 : _a.getTracks()) ?? []) track.enabled = !value;
1302
+ if (room) void room.setMicrophoneEnabled(!value).catch(mediaFailed);
1303
+ return true;
1304
+ } catch {
1305
+ mediaFailed();
1306
+ return false;
1307
+ }
879
1308
  };
880
- applyLocal(muted);
881
- void sendCommand({ type: "voice/set-mic", paused: muted, attemptId: callAttemptIdRef.current }).catch(() => {
1309
+ if (!applyLocal(muted)) return;
1310
+ void sendCommand({ type: "voice/set-mic", paused: muted, attemptId }).catch(() => {
882
1311
  if (!muted && attemptRef.current === attempt && micChangeRef.current === change) {
883
1312
  applyLocal(true);
884
1313
  }
885
1314
  });
886
1315
  },
887
- [phase, sendCommand]
1316
+ [phase, sendCommand, fail]
888
1317
  );
889
1318
  const sessionGone = reactStatewire.useStatewireState(
890
1319
  (s) => statewireState.isDeepAgentStateHydrated(s) && (statewireState.readDeepAgentStreamValues(s).voice ?? null) === null
891
1320
  );
892
- react.useEffect(() => {
1321
+ require$$0.useEffect(() => {
893
1322
  var _a;
894
1323
  if (phase !== "live" || !sessionGone) return;
1324
+ const restarting = !autoRestartedRef.current;
895
1325
  report("server-ended", attemptRef.current, {
896
- restartBudgetLeft: !autoRestartedRef.current
1326
+ restartBudgetLeft: restarting
897
1327
  });
898
1328
  if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
899
- teardown();
1329
+ teardown({ keepAudioSession: restarting });
900
1330
  setPhase("idle");
901
- if (!autoRestartedRef.current) {
1331
+ if (restarting) {
902
1332
  autoRestartedRef.current = true;
903
1333
  report("auto-restart", attemptRef.current, { trigger: "server-ended" });
904
1334
  void ((_a = startRef.current) == null ? void 0 : _a.call(startRef));
905
1335
  }
906
1336
  }, [phase, report, sessionGone, teardown]);
907
- react.useEffect(
1337
+ require$$0.useEffect(() => {
1338
+ if (phase !== "live" || !transferCapable || wireOwnerId === null) return;
1339
+ const own = ownClientIdRef.current;
1340
+ if (own === null) {
1341
+ const fence = observedAttemptRef.current;
1342
+ if (fence !== void 0 && fence !== callAttemptIdRef.current) return;
1343
+ ownClientIdRef.current = wireOwnerId;
1344
+ lastOwnedClientIdRef.current = wireOwnerId;
1345
+ return;
1346
+ }
1347
+ if (wireOwnerId !== own) handleMovedAway();
1348
+ }, [phase, transferCapable, wireOwnerId, observedAttempt, handleMovedAway]);
1349
+ require$$0.useEffect(
908
1350
  () => () => {
909
1351
  const phaseAtUnmount = phaseRef.current;
910
1352
  if (phaseAtUnmount === "connecting" || phaseAtUnmount === "live") {
@@ -912,14 +1354,15 @@ const useDeepAgentVoice = (options = {}) => {
912
1354
  source: "unmount",
913
1355
  phase: phaseAtUnmount
914
1356
  });
915
- void sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
1357
+ releaseCall();
916
1358
  }
1359
+ transferRef.current = null;
917
1360
  teardown();
918
1361
  },
919
- [report, sendCommand, teardown]
1362
+ [releaseCall, report, teardown]
920
1363
  );
921
1364
  const activeTask = (voice == null ? void 0 : voice.activeTask) ?? null;
922
- react.useEffect(() => {
1365
+ require$$0.useEffect(() => {
923
1366
  if (phase === "live") lastActiveTaskRef.current = activeTask;
924
1367
  else if (phase === "idle" || phase === "error") lastActiveTaskRef.current = null;
925
1368
  }, [phase, activeTask]);
@@ -928,7 +1371,7 @@ const useDeepAgentVoice = (options = {}) => {
928
1371
  const status = statewireState.readDeepAgentStreamValues(s).status;
929
1372
  return status === "running" || status === "stopping" || status === "input-required";
930
1373
  });
931
- react.useEffect(() => {
1374
+ require$$0.useEffect(() => {
932
1375
  if (handoffTask !== null && !handoffRunActive) setHandoffTask(null);
933
1376
  }, [handoffTask, handoffRunActive]);
934
1377
  const wireError = reactStatewire.useStatewireState(
@@ -943,19 +1386,19 @@ const useDeepAgentVoice = (options = {}) => {
943
1386
  const wireModelOptions = reactStatewire.useStatewireState(
944
1387
  (s) => statewireState.isDeepAgentStateHydrated(s) ? statewireState.readDeepAgentStreamValues(s).voiceModelOptions ?? null : null
945
1388
  );
946
- const modelOptionsRef = react.useRef(null);
947
- const modelOptions = react.useMemo(() => {
1389
+ const modelOptionsRef = require$$0.useRef(null);
1390
+ const modelOptions = require$$0.useMemo(() => {
948
1391
  const next = parseVoiceModelOptions(wireModelOptions);
949
1392
  const previous = modelOptionsRef.current;
950
1393
  if (previous !== null && next !== null && sameVoiceModelOptions(previous, next)) return previous;
951
1394
  modelOptionsRef.current = next;
952
1395
  return next;
953
1396
  }, [wireModelOptions]);
954
- const syncProfile = react.useCallback(() => {
1397
+ const syncProfile = require$$0.useCallback(() => {
955
1398
  if (phase !== "connecting" && phase !== "live") return;
956
1399
  void sendCommand({ type: "voice/profile-sync", attemptId: callAttemptIdRef.current }).catch(() => void 0);
957
1400
  }, [phase, sendCommand]);
958
- const sendContext = react.useCallback(
1401
+ const sendContext = require$$0.useCallback(
959
1402
  (text) => {
960
1403
  const trimmed = text.trim();
961
1404
  if (phase !== "live" || !trimmed) return;
@@ -963,7 +1406,7 @@ const useDeepAgentVoice = (options = {}) => {
963
1406
  },
964
1407
  [phase, sendCommand]
965
1408
  );
966
- const sendUserText = react.useCallback(
1409
+ const sendUserText = require$$0.useCallback(
967
1410
  async (text) => {
968
1411
  if (phase !== "live" || !text.trim()) return false;
969
1412
  const messageId = mintVoiceId({ kind: "text" });
@@ -976,7 +1419,7 @@ const useDeepAgentVoice = (options = {}) => {
976
1419
  },
977
1420
  [phase, sendCommand]
978
1421
  );
979
- return react.useMemo(
1422
+ return require$$0.useMemo(
980
1423
  () => ({
981
1424
  phase,
982
1425
  error,
@@ -993,7 +1436,10 @@ const useDeepAgentVoice = (options = {}) => {
993
1436
  notice,
994
1437
  sendContext,
995
1438
  model,
996
- modelOptions
1439
+ modelOptions,
1440
+ liveElsewhere,
1441
+ transferHere,
1442
+ movedTo
997
1443
  }),
998
1444
  [
999
1445
  phase,
@@ -1011,24 +1457,36 @@ const useDeepAgentVoice = (options = {}) => {
1011
1457
  notice,
1012
1458
  sendContext,
1013
1459
  model,
1014
- modelOptions
1460
+ modelOptions,
1461
+ liveElsewhere,
1462
+ transferHere,
1463
+ movedTo
1015
1464
  ]
1016
1465
  );
1017
1466
  };
1467
+ exports.VOICE_CONTINUE_BY_VOICE_LABEL = VOICE_CONTINUE_BY_VOICE_LABEL;
1018
1468
  exports.VOICE_LIVEKIT_ANSWER_PREFIX = VOICE_LIVEKIT_ANSWER_PREFIX;
1019
1469
  exports.VOICE_LIVEKIT_OFFER = VOICE_LIVEKIT_OFFER;
1470
+ exports.VOICE_MOVED_NOTICE_MS = VOICE_MOVED_NOTICE_MS;
1471
+ exports.VOICE_MOVE_CALL_HERE_LABEL = VOICE_MOVE_CALL_HERE_LABEL;
1472
+ exports.VOICE_MOVE_HERE_ACTION = VOICE_MOVE_HERE_ACTION;
1020
1473
  exports.VOICE_RELAY_ANSWER_PREFIX = VOICE_RELAY_ANSWER_PREFIX;
1021
1474
  exports.VOICE_RELAY_SAMPLE_RATE = VOICE_RELAY_SAMPLE_RATE;
1022
1475
  exports.VOICE_WEBSOCKET_OFFER = VOICE_WEBSOCKET_OFFER;
1023
1476
  exports.classifyVoiceStartError = classifyVoiceStartError;
1024
1477
  exports.describeVoiceFailure = describeVoiceFailure;
1478
+ exports.describeVoiceLiveElsewhere = describeVoiceLiveElsewhere;
1479
+ exports.describeVoiceMovedTo = describeVoiceMovedTo;
1025
1480
  exports.describeVoiceWireError = describeVoiceWireError;
1026
1481
  exports.float32FromPcm16 = float32FromPcm16;
1027
1482
  exports.formatVoiceElapsed = formatVoiceElapsed;
1028
1483
  exports.parseVoiceLiveKitAnswer = parseVoiceLiveKitAnswer;
1029
1484
  exports.parseVoiceModelOptions = parseVoiceModelOptions;
1485
+ exports.parseVoiceOwner = parseVoiceOwner;
1030
1486
  exports.pcm16FromFloat32 = pcm16FromFloat32;
1031
1487
  exports.useDeepAgentVoice = useDeepAgentVoice;
1032
1488
  exports.useVoiceElapsed = useVoiceElapsed;
1489
+ exports.useVoiceMovedNotice = useVoiceMovedNotice;
1033
1490
  exports.voiceRelayUrl = voiceRelayUrl;
1491
+ exports.voiceSurfaceLabel = voiceSurfaceLabel;
1034
1492
  //# sourceMappingURL=use-deep-agent-voice.cjs.map