@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
@@ -4,6 +4,18 @@ export interface UploadedAsset {
4
4
  fileName: string;
5
5
  fileSize: number;
6
6
  mediaType: string;
7
+ /**
8
+ * The position, in the batch `upload` was given, of the file this asset was
9
+ * uploaded from (the upload's `success_file_indexes`; absent from a server
10
+ * that does not send them).
11
+ */
12
+ fileIndex?: number;
13
+ /**
14
+ * A local `blob:` URL of the picture this attachment was uploaded from, for
15
+ * the composer's thumbnail and full-screen viewer. Set by the composer's
16
+ * intake for image files, and revoked when the draft lets the attachment go.
17
+ */
18
+ previewUrl?: string;
7
19
  }
8
20
  export interface UploadProgress {
9
21
  current: number;
@@ -68,13 +68,18 @@ function useFileUpload() {
68
68
  if (xhr.status >= 200 && xhr.status < 300) {
69
69
  try {
70
70
  const data = JSON.parse(xhr.responseText);
71
- const assets = (data.success ?? []).map((a) => ({
72
- id: a.id,
73
- title: a.title ?? a.file_name,
74
- fileName: a.file_name,
75
- fileSize: a.file_size,
76
- mediaType: a.media_type
77
- }));
71
+ const fileIndexes = data.success_file_indexes;
72
+ const assets = (data.success ?? []).map((a, at) => {
73
+ const fileIndex = Array.isArray(fileIndexes) ? fileIndexes[at] : void 0;
74
+ return {
75
+ id: a.id,
76
+ title: a.title ?? a.file_name,
77
+ fileName: a.file_name,
78
+ fileSize: a.file_size,
79
+ mediaType: a.media_type,
80
+ ...typeof fileIndex === "number" && { fileIndex }
81
+ };
82
+ });
78
83
  resolve({ success: assets, errors: data.errors ?? [] });
79
84
  } catch {
80
85
  reject(new Error("Failed to parse upload response"));
@@ -1 +1 @@
1
- {"version":3,"file":"useFileUpload.js","sources":["../../src/composer/useFileUpload.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { useAthenaConfig } from '../provider/AthenaContext';\n\nexport interface UploadedAsset {\n id: string;\n title: string;\n fileName: string;\n fileSize: number;\n mediaType: string;\n}\n\nexport interface UploadProgress {\n current: number;\n total: number;\n fileName: string;\n /** 0–1 normalized progress for the current file */\n percent: number;\n}\n\nexport interface UseFileUploadReturn {\n /** Upload one or more files to Athena. Returns the created asset(s). */\n upload: (files: File[]) => Promise<UploadedAsset[]>;\n /** Whether an upload is currently in progress. */\n isUploading: boolean;\n /** Upload progress info (null when idle). */\n progress: UploadProgress | null;\n /** Last upload error (null when no error). */\n error: string | null;\n /** Clear the error state. */\n clearError: () => void;\n}\n\nconst MAX_FILE_SIZE = 5 * 1024 * 1024 * 1024; // 5 GB\n\n/**\n * Hook for uploading files to the Athena platform via the Athena upload endpoint.\n * Files become Athena assets (documents, spreadsheets, PDFs, images, etc.).\n *\n * Usage:\n * const { upload, isUploading, progress, error } = useFileUpload();\n * const assets = await upload(fileList);\n */\nexport function useFileUpload(): UseFileUploadReturn {\n const config = useAthenaConfig();\n // Keep config in a ref so upload() always reads the latest token at call\n // time. AthenaConfig's token is a getter that returns the current value\n // from PropelAuth, and reading via the ref avoids capturing stale\n // destructured values in the useCallback closure.\n const configRef = useRef(config);\n configRef.current = config;\n const { backendUrl, apiKey } = config;\n const [isUploading, setIsUploading] = useState(false);\n const [progress, setProgress] = useState<UploadProgress | null>(null);\n const [error, setError] = useState<string | null>(null);\n const xhrRef = useRef<XMLHttpRequest | null>(null);\n\n // Abort any in-flight upload when the component unmounts\n useEffect(() => {\n return () => {\n xhrRef.current?.abort();\n };\n }, []);\n\n const clearError = useCallback(() => setError(null), []);\n\n const upload = useCallback(\n async (files: File[]): Promise<UploadedAsset[]> => {\n if (files.length === 0) return [];\n\n // Validate file sizes\n for (const file of files) {\n if (file.size > MAX_FILE_SIZE) {\n const msg = `File \"${file.name}\" exceeds the maximum size of 5 GB.`;\n setError(msg);\n throw new Error(msg);\n }\n }\n\n setIsUploading(true);\n setError(null);\n setProgress({ current: 0, total: files.length, fileName: files[0]?.name ?? '', percent: 0 });\n\n try {\n const formData = new FormData();\n for (const file of files) {\n formData.append('files', file, file.name);\n }\n\n // Derive the upload URL from the configured Athena backend URL.\n // If backendUrl points at a nested Athena endpoint, trim it back to the API base first.\n const baseUrl = backendUrl.replace(/\\/api\\/assistant-ui\\/?$/, '');\n const uploadUrl = `${baseUrl}/api/upload/`;\n\n // Read the current token at call time so rotated tokens are picked up.\n const currentToken = configRef.current.token;\n const headers: Record<string, string> = {};\n if (currentToken) {\n headers['Authorization'] = `Bearer ${currentToken}`;\n } else if (apiKey) {\n headers['X-API-KEY'] = apiKey;\n }\n\n const xhr = new XMLHttpRequest();\n xhrRef.current = xhr;\n\n const result = await new Promise<{ success: UploadedAsset[]; errors: Array<{ file: { filename: string }; error: string }> }>((resolve, reject) => {\n xhr.upload.addEventListener('progress', (e) => {\n if (e.lengthComputable) {\n const percent = e.loaded / e.total;\n // Estimate which file we're on based on progress\n const fileIndex = Math.min(\n Math.floor(percent * files.length),\n files.length - 1,\n );\n setProgress({\n current: fileIndex + 1,\n total: files.length,\n fileName: files[fileIndex]?.name ?? '',\n percent,\n });\n }\n });\n\n xhr.addEventListener('load', () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n try {\n const data = JSON.parse(xhr.responseText);\n const assets: UploadedAsset[] = (data.success ?? []).map((a: Record<string, unknown>) => ({\n id: a.id as string,\n title: (a.title ?? a.file_name) as string,\n fileName: a.file_name as string,\n fileSize: a.file_size as number,\n mediaType: a.media_type as string,\n }));\n resolve({ success: assets, errors: data.errors ?? [] });\n } catch {\n reject(new Error('Failed to parse upload response'));\n }\n } else if (xhr.status === 401 || xhr.status === 403) {\n reject(new Error('Authentication failed. Check your API key or token.'));\n } else {\n reject(new Error(`Upload failed with status ${xhr.status}`));\n }\n });\n\n xhr.addEventListener('error', () => reject(new Error('Network error during upload')));\n xhr.addEventListener('abort', () => reject(new Error('Upload was cancelled')));\n\n xhr.open('POST', uploadUrl);\n for (const [key, value] of Object.entries(headers)) {\n xhr.setRequestHeader(key, value);\n }\n xhr.withCredentials = !currentToken && !apiKey;\n xhr.send(formData);\n });\n\n if (result.errors.length > 0) {\n const errMsg = result.errors.map((e) => `${e.file.filename}: ${e.error}`).join('; ');\n if (result.success.length === 0) {\n setError(errMsg);\n throw new Error(errMsg);\n }\n // Partial success — set error but still return successful uploads\n setError(errMsg);\n }\n\n return result.success;\n } catch (err) {\n const msg = err instanceof Error ? err.message : 'Upload failed';\n setError(msg);\n throw err;\n } finally {\n xhrRef.current = null;\n setIsUploading(false);\n setProgress(null);\n }\n },\n [backendUrl, apiKey],\n );\n\n return { upload, isUploading, progress, error, clearError };\n}\n"],"names":["_a"],"mappings":";;AAgCA,MAAM,gBAAgB,IAAI,OAAO,OAAO;AAUjC,SAAS,gBAAqC;AACnD,QAAM,SAAS,gBAAA;AAKf,QAAM,YAAY,OAAO,MAAM;AAC/B,YAAU,UAAU;AACpB,QAAM,EAAE,YAAY,OAAA,IAAW;AAC/B,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AACpD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAgC,IAAI;AACpE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,SAAS,OAA8B,IAAI;AAGjD,YAAU,MAAM;AACd,WAAO,MAAM;;AACX,mBAAO,YAAP,mBAAgB;AAAA,IAClB;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAM,aAAa,YAAY,MAAM,SAAS,IAAI,GAAG,CAAA,CAAE;AAEvD,QAAM,SAAS;AAAA,IACb,OAAO,UAA4C;;AACjD,UAAI,MAAM,WAAW,EAAG,QAAO,CAAA;AAG/B,iBAAW,QAAQ,OAAO;AACxB,YAAI,KAAK,OAAO,eAAe;AAC7B,gBAAM,MAAM,SAAS,KAAK,IAAI;AAC9B,mBAAS,GAAG;AACZ,gBAAM,IAAI,MAAM,GAAG;AAAA,QACrB;AAAA,MACF;AAEA,qB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AAG;AACZ,cAAM;AAAA,MACR,UAAA;AACE,eAAO,UAAU;AACjB,uBAAe,KAAK;AACpB,oBAAY,IAAI;AAAA,MAClB;AAAA,IACF;AAAA,IACA,CAAC,YAAY,MAAM;AAAA,EAAA;AAGrB,SAAO,EAAE,QAAQ,aAAa,UAAU,OAAO,WAAA;AACjD;"}
1
+ {"version":3,"file":"useFileUpload.js","sources":["../../src/composer/useFileUpload.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { useAthenaConfig } from '../provider/AthenaContext';\n\nexport interface UploadedAsset {\n id: string;\n title: string;\n fileName: string;\n fileSize: number;\n mediaType: string;\n /**\n * The position, in the batch `upload` was given, of the file this asset was\n * uploaded from (the upload's `success_file_indexes`; absent from a server\n * that does not send them).\n */\n fileIndex?: number;\n /**\n * A local `blob:` URL of the picture this attachment was uploaded from, for\n * the composer's thumbnail and full-screen viewer. Set by the composer's\n * intake for image files, and revoked when the draft lets the attachment go.\n */\n previewUrl?: string;\n}\n\nexport interface UploadProgress {\n current: number;\n total: number;\n fileName: string;\n /** 0–1 normalized progress for the current file */\n percent: number;\n}\n\nexport interface UseFileUploadReturn {\n /** Upload one or more files to Athena. Returns the created asset(s). */\n upload: (files: File[]) => Promise<UploadedAsset[]>;\n /** Whether an upload is currently in progress. */\n isUploading: boolean;\n /** Upload progress info (null when idle). */\n progress: UploadProgress | null;\n /** Last upload error (null when no error). */\n error: string | null;\n /** Clear the error state. */\n clearError: () => void;\n}\n\nconst MAX_FILE_SIZE = 5 * 1024 * 1024 * 1024; // 5 GB\n\n/**\n * Hook for uploading files to the Athena platform via the Athena upload endpoint.\n * Files become Athena assets (documents, spreadsheets, PDFs, images, etc.).\n *\n * Usage:\n * const { upload, isUploading, progress, error } = useFileUpload();\n * const assets = await upload(fileList);\n */\nexport function useFileUpload(): UseFileUploadReturn {\n const config = useAthenaConfig();\n // Keep config in a ref so upload() always reads the latest token at call\n // time. AthenaConfig's token is a getter that returns the current value\n // from PropelAuth, and reading via the ref avoids capturing stale\n // destructured values in the useCallback closure.\n const configRef = useRef(config);\n configRef.current = config;\n const { backendUrl, apiKey } = config;\n const [isUploading, setIsUploading] = useState(false);\n const [progress, setProgress] = useState<UploadProgress | null>(null);\n const [error, setError] = useState<string | null>(null);\n const xhrRef = useRef<XMLHttpRequest | null>(null);\n\n // Abort any in-flight upload when the component unmounts\n useEffect(() => {\n return () => {\n xhrRef.current?.abort();\n };\n }, []);\n\n const clearError = useCallback(() => setError(null), []);\n\n const upload = useCallback(\n async (files: File[]): Promise<UploadedAsset[]> => {\n if (files.length === 0) return [];\n\n // Validate file sizes\n for (const file of files) {\n if (file.size > MAX_FILE_SIZE) {\n const msg = `File \"${file.name}\" exceeds the maximum size of 5 GB.`;\n setError(msg);\n throw new Error(msg);\n }\n }\n\n setIsUploading(true);\n setError(null);\n setProgress({ current: 0, total: files.length, fileName: files[0]?.name ?? '', percent: 0 });\n\n try {\n const formData = new FormData();\n for (const file of files) {\n formData.append('files', file, file.name);\n }\n\n // Derive the upload URL from the configured Athena backend URL.\n // If backendUrl points at a nested Athena endpoint, trim it back to the API base first.\n const baseUrl = backendUrl.replace(/\\/api\\/assistant-ui\\/?$/, '');\n const uploadUrl = `${baseUrl}/api/upload/`;\n\n // Read the current token at call time so rotated tokens are picked up.\n const currentToken = configRef.current.token;\n const headers: Record<string, string> = {};\n if (currentToken) {\n headers['Authorization'] = `Bearer ${currentToken}`;\n } else if (apiKey) {\n headers['X-API-KEY'] = apiKey;\n }\n\n const xhr = new XMLHttpRequest();\n xhrRef.current = xhr;\n\n const result = await new Promise<{ success: UploadedAsset[]; errors: Array<{ file: { filename: string }; error: string }> }>((resolve, reject) => {\n xhr.upload.addEventListener('progress', (e) => {\n if (e.lengthComputable) {\n const percent = e.loaded / e.total;\n // Estimate which file we're on based on progress\n const fileIndex = Math.min(\n Math.floor(percent * files.length),\n files.length - 1,\n );\n setProgress({\n current: fileIndex + 1,\n total: files.length,\n fileName: files[fileIndex]?.name ?? '',\n percent,\n });\n }\n });\n\n xhr.addEventListener('load', () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n try {\n const data = JSON.parse(xhr.responseText);\n const fileIndexes: unknown = data.success_file_indexes;\n const assets: UploadedAsset[] = (data.success ?? []).map((a: Record<string, unknown>, at: number) => {\n const fileIndex = Array.isArray(fileIndexes) ? fileIndexes[at] : undefined;\n return {\n id: a.id as string,\n title: (a.title ?? a.file_name) as string,\n fileName: a.file_name as string,\n fileSize: a.file_size as number,\n mediaType: a.media_type as string,\n ...(typeof fileIndex === 'number' && { fileIndex }),\n };\n });\n resolve({ success: assets, errors: data.errors ?? [] });\n } catch {\n reject(new Error('Failed to parse upload response'));\n }\n } else if (xhr.status === 401 || xhr.status === 403) {\n reject(new Error('Authentication failed. Check your API key or token.'));\n } else {\n reject(new Error(`Upload failed with status ${xhr.status}`));\n }\n });\n\n xhr.addEventListener('error', () => reject(new Error('Network error during upload')));\n xhr.addEventListener('abort', () => reject(new Error('Upload was cancelled')));\n\n xhr.open('POST', uploadUrl);\n for (const [key, value] of Object.entries(headers)) {\n xhr.setRequestHeader(key, value);\n }\n xhr.withCredentials = !currentToken && !apiKey;\n xhr.send(formData);\n });\n\n if (result.errors.length > 0) {\n const errMsg = result.errors.map((e) => `${e.file.filename}: ${e.error}`).join('; ');\n if (result.success.length === 0) {\n setError(errMsg);\n throw new Error(errMsg);\n }\n // Partial success — set error but still return successful uploads\n setError(errMsg);\n }\n\n return result.success;\n } catch (err) {\n const msg = err instanceof Error ? err.message : 'Upload failed';\n setError(msg);\n throw err;\n } finally {\n xhrRef.current = null;\n setIsUploading(false);\n setProgress(null);\n }\n },\n [backendUrl, apiKey],\n );\n\n return { upload, isUploading, progress, error, clearError };\n}\n"],"names":["_a"],"mappings":";;AA4CA,MAAM,gBAAgB,IAAI,OAAO,OAAO;AAUjC,SAAS,gBAAqC;AACnD,QAAM,SAAS,gBAAA;AAKf,QAAM,YAAY,OAAO,MAAM;AAC/B,YAAU,UAAU;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AAM,6BAA6B,IAAI,MAAM,EAAE,CAAC;AAAA,YAC7D;AAAA,UACF,CAAC;AAED,cAAI,iBAAiB,SAAS,MAAM,OAAO,IAAI,MAAM,6BAA6B,CAAC,CAAC;AACpF,cAAI,iBAAiB,SAAS,MAAM,OAAO,IAAI,MAAM,sBAAsB,CAAC,CAAC;AAE7E,cAAI,KAAK,QAAQ,SAAS;AAC1B,qBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,gBAAI,iBAAiB,KAAK,KAAK;AAAA,UACjC;AACA,cAAI,kBAAkB,CAAC,gBAAgB,CAAC;AACxC,cAAI,KAAK,QAAQ;AAAA,QACnB,CAAC;AAED,YAAI,OAAO,OAAO,SAAS,GAAG;AAC5B,gBAAM,SAAS,OAAO,OAAO,IAAI,CAAC,MAAM,GAAG,EAAE,KAAK,QAAQ,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,IAAI;AACnF,cAAI,OAAO,QAAQ,WAAW,GAAG;AAC/B,qBAAS,MAAM;AACf,kBAAM,IAAI,MAAM,MAAM;AAAA,UACxB;AAEA,mBAAS,MAAM;AAAA,QACjB;AAEA,eAAO,OAAO;AAAA,MAChB,SAAS,KAAK;AACZ,cAAM,MAAM,eAAe,QAAQ,IAAI,UAAU;AACjD,iBAAS,GAAG;AACZ,cAAM;AAAA,MACR,UAAA;AACE,eAAO,UAAU;AACjB,uBAAe,KAAK;AACpB,oBAAY,IAAI;AAAA,MAClB;AAAA,IACF;AAAA,IACA,CAAC,YAAY,MAAM;AAAA,EAAA;AAGrB,SAAO,EAAE,QAAQ,aAAa,UAAU,OAAO,WAAA;AACjD;"}
@@ -1,16 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react$1 = require("react");
3
+ const require$$0 = require("react");
4
4
  const react = require("@assistant-ui/react");
5
+ const composerHandoff = require("./composer-handoff.cjs");
6
+ function tryReadComposerText({
7
+ read,
8
+ store
9
+ }) {
10
+ if (store !== null && (store.focusEnd === null || store.pending.length > 0)) return null;
11
+ try {
12
+ return read().text ?? null;
13
+ } catch {
14
+ return null;
15
+ }
16
+ }
17
+ function useTryReadComposerDraft() {
18
+ const aui = react.useAui();
19
+ const store = composerHandoff.useComposerHandoffStore();
20
+ return require$$0.useCallback(
21
+ () => tryReadComposerText({ read: () => aui.composer.getState(), store }),
22
+ [aui, store]
23
+ );
24
+ }
5
25
  function useReadComposerDraft() {
6
26
  const aui = react.useAui();
7
- return react$1.useCallback(() => {
8
- try {
9
- return aui.composer.getState().text ?? "";
10
- } catch {
11
- return "";
12
- }
13
- }, [aui]);
27
+ return require$$0.useCallback(
28
+ () => tryReadComposerText({ read: () => aui.composer.getState(), store: null }) ?? "",
29
+ [aui]
30
+ );
14
31
  }
32
+ exports.tryReadComposerText = tryReadComposerText;
15
33
  exports.useReadComposerDraft = useReadComposerDraft;
34
+ exports.useTryReadComposerDraft = useTryReadComposerDraft;
16
35
  //# sourceMappingURL=useReadComposerDraft.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReadComposerDraft.cjs","sources":["../../src/composer/useReadComposerDraft.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useAui } from '@assistant-ui/react';\n\n/**\n * Reads the composer's draft (its text) when called, for a host that hands the chat elsewhere and\n * carries what was not sent yet along (a launcher window's \"open in the app\"). An empty string\n * before the composer exists.\n */\nexport function useReadComposerDraft(): () => string {\n const aui = useAui();\n return useCallback(() => {\n try {\n return aui.composer.getState().text ?? '';\n } catch {\n return '';\n }\n }, [aui]);\n}\n"],"names":["useAui","useCallback"],"mappings":";;;;AAQO,SAAS,uBAAqC;AACnD,QAAM,MAAMA,MAAAA,OAAA;AACZ,SAAOC,QAAAA,YAAY,MAAM;AACvB,QAAI;AACF,aAAO,IAAI,SAAS,SAAA,EAAW,QAAQ;AAAA,IACzC,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AACV;;"}
1
+ {"version":3,"file":"useReadComposerDraft.cjs","sources":["../../src/composer/useReadComposerDraft.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useAui } from '@assistant-ui/react';\nimport { type ComposerHandoffStore, useComposerHandoffStore } from './composer-handoff';\n\n/**\n * The composer's text, or `null` when there is no draft to read. Inside `AthenaProvider` (a\n * `store`), the runtime's text is the person's draft only while the editor is mounted (it\n * registers `focusEnd`) and no write made before it mounted is still waiting: until then the\n * runtime holds an empty text that is not what the person sees. A read that throws (no composer\n * in scope) is `null` too.\n */\nexport function tryReadComposerText({\n read,\n store,\n}: {\n read: () => { text?: string | null };\n store: Pick<ComposerHandoffStore, 'focusEnd' | 'pending'> | null;\n}): string | null {\n if (store !== null && (store.focusEnd === null || store.pending.length > 0)) return null;\n try {\n return read().text ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * Reads the composer's draft (its text) when called, or `null` when there is no draft to read:\n * the editor has not mounted, a write is still waiting for it, or the read fails. For a host that\n * must tell a blank composer (`''`) from one it could not read, such as \"Continue on…\", where a\n * blank composer clears the draft of a reused handover ticket and an unread one must leave it as\n * it was.\n */\nexport function useTryReadComposerDraft(): () => string | null {\n const aui = useAui();\n const store = useComposerHandoffStore();\n return useCallback(\n () => tryReadComposerText({ read: () => aui.composer.getState(), store }),\n [aui, store]\n );\n}\n\n/**\n * Reads the composer's draft (its text) when called, for a host that hands the chat elsewhere and\n * carries what was not sent yet along (a launcher window's \"open in the app\"). An empty string\n * before the composer exists; {@link useTryReadComposerDraft} tells that case apart.\n */\nexport function useReadComposerDraft(): () => string {\n const aui = useAui();\n return useCallback(\n () => tryReadComposerText({ read: () => aui.composer.getState(), store: null }) ?? '',\n [aui]\n );\n}\n"],"names":["useAui","useComposerHandoffStore","useCallback"],"mappings":";;;;;AAWO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AACF,GAGkB;AAChB,MAAI,UAAU,SAAS,MAAM,aAAa,QAAQ,MAAM,QAAQ,SAAS,GAAI,QAAO;AACpF,MAAI;AACF,WAAO,KAAA,EAAO,QAAQ;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASO,SAAS,0BAA+C;AAC7D,QAAM,MAAMA,MAAAA,OAAA;AACZ,QAAM,QAAQC,gBAAAA,wBAAA;AACd,SAAOC,WAAAA;AAAAA,IACL,MAAM,oBAAoB,EAAE,MAAM,MAAM,IAAI,SAAS,SAAA,GAAY,OAAO;AAAA,IACxE,CAAC,KAAK,KAAK;AAAA,EAAA;AAEf;AAOO,SAAS,uBAAqC;AACnD,QAAM,MAAMF,MAAAA,OAAA;AACZ,SAAOE,WAAAA;AAAAA,IACL,MAAM,oBAAoB,EAAE,MAAM,MAAM,IAAI,SAAS,SAAA,GAAY,OAAO,KAAA,CAAM,KAAK;AAAA,IACnF,CAAC,GAAG;AAAA,EAAA;AAER;;;;"}
@@ -1,6 +1,28 @@
1
+ import { type ComposerHandoffStore } from './composer-handoff';
2
+ /**
3
+ * The composer's text, or `null` when there is no draft to read. Inside `AthenaProvider` (a
4
+ * `store`), the runtime's text is the person's draft only while the editor is mounted (it
5
+ * registers `focusEnd`) and no write made before it mounted is still waiting: until then the
6
+ * runtime holds an empty text that is not what the person sees. A read that throws (no composer
7
+ * in scope) is `null` too.
8
+ */
9
+ export declare function tryReadComposerText({ read, store, }: {
10
+ read: () => {
11
+ text?: string | null;
12
+ };
13
+ store: Pick<ComposerHandoffStore, 'focusEnd' | 'pending'> | null;
14
+ }): string | null;
15
+ /**
16
+ * Reads the composer's draft (its text) when called, or `null` when there is no draft to read:
17
+ * the editor has not mounted, a write is still waiting for it, or the read fails. For a host that
18
+ * must tell a blank composer (`''`) from one it could not read, such as "Continue on…", where a
19
+ * blank composer clears the draft of a reused handover ticket and an unread one must leave it as
20
+ * it was.
21
+ */
22
+ export declare function useTryReadComposerDraft(): () => string | null;
1
23
  /**
2
24
  * Reads the composer's draft (its text) when called, for a host that hands the chat elsewhere and
3
25
  * carries what was not sent yet along (a launcher window's "open in the app"). An empty string
4
- * before the composer exists.
26
+ * before the composer exists; {@link useTryReadComposerDraft} tells that case apart.
5
27
  */
6
28
  export declare function useReadComposerDraft(): () => string;
@@ -1,16 +1,35 @@
1
1
  import { useCallback } from "react";
2
2
  import { useAui } from "@assistant-ui/react";
3
+ import { useComposerHandoffStore } from "./composer-handoff.js";
4
+ function tryReadComposerText({
5
+ read,
6
+ store
7
+ }) {
8
+ if (store !== null && (store.focusEnd === null || store.pending.length > 0)) return null;
9
+ try {
10
+ return read().text ?? null;
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
15
+ function useTryReadComposerDraft() {
16
+ const aui = useAui();
17
+ const store = useComposerHandoffStore();
18
+ return useCallback(
19
+ () => tryReadComposerText({ read: () => aui.composer.getState(), store }),
20
+ [aui, store]
21
+ );
22
+ }
3
23
  function useReadComposerDraft() {
4
24
  const aui = useAui();
5
- return useCallback(() => {
6
- try {
7
- return aui.composer.getState().text ?? "";
8
- } catch {
9
- return "";
10
- }
11
- }, [aui]);
25
+ return useCallback(
26
+ () => tryReadComposerText({ read: () => aui.composer.getState(), store: null }) ?? "",
27
+ [aui]
28
+ );
12
29
  }
13
30
  export {
14
- useReadComposerDraft
31
+ tryReadComposerText,
32
+ useReadComposerDraft,
33
+ useTryReadComposerDraft
15
34
  };
16
35
  //# sourceMappingURL=useReadComposerDraft.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReadComposerDraft.js","sources":["../../src/composer/useReadComposerDraft.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useAui } from '@assistant-ui/react';\n\n/**\n * Reads the composer's draft (its text) when called, for a host that hands the chat elsewhere and\n * carries what was not sent yet along (a launcher window's \"open in the app\"). An empty string\n * before the composer exists.\n */\nexport function useReadComposerDraft(): () => string {\n const aui = useAui();\n return useCallback(() => {\n try {\n return aui.composer.getState().text ?? '';\n } catch {\n return '';\n }\n }, [aui]);\n}\n"],"names":[],"mappings":";;AAQO,SAAS,uBAAqC;AACnD,QAAM,MAAM,OAAA;AACZ,SAAO,YAAY,MAAM;AACvB,QAAI;AACF,aAAO,IAAI,SAAS,SAAA,EAAW,QAAQ;AAAA,IACzC,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AACV;"}
1
+ {"version":3,"file":"useReadComposerDraft.js","sources":["../../src/composer/useReadComposerDraft.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useAui } from '@assistant-ui/react';\nimport { type ComposerHandoffStore, useComposerHandoffStore } from './composer-handoff';\n\n/**\n * The composer's text, or `null` when there is no draft to read. Inside `AthenaProvider` (a\n * `store`), the runtime's text is the person's draft only while the editor is mounted (it\n * registers `focusEnd`) and no write made before it mounted is still waiting: until then the\n * runtime holds an empty text that is not what the person sees. A read that throws (no composer\n * in scope) is `null` too.\n */\nexport function tryReadComposerText({\n read,\n store,\n}: {\n read: () => { text?: string | null };\n store: Pick<ComposerHandoffStore, 'focusEnd' | 'pending'> | null;\n}): string | null {\n if (store !== null && (store.focusEnd === null || store.pending.length > 0)) return null;\n try {\n return read().text ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * Reads the composer's draft (its text) when called, or `null` when there is no draft to read:\n * the editor has not mounted, a write is still waiting for it, or the read fails. For a host that\n * must tell a blank composer (`''`) from one it could not read, such as \"Continue on…\", where a\n * blank composer clears the draft of a reused handover ticket and an unread one must leave it as\n * it was.\n */\nexport function useTryReadComposerDraft(): () => string | null {\n const aui = useAui();\n const store = useComposerHandoffStore();\n return useCallback(\n () => tryReadComposerText({ read: () => aui.composer.getState(), store }),\n [aui, store]\n );\n}\n\n/**\n * Reads the composer's draft (its text) when called, for a host that hands the chat elsewhere and\n * carries what was not sent yet along (a launcher window's \"open in the app\"). An empty string\n * before the composer exists; {@link useTryReadComposerDraft} tells that case apart.\n */\nexport function useReadComposerDraft(): () => string {\n const aui = useAui();\n return useCallback(\n () => tryReadComposerText({ read: () => aui.composer.getState(), store: null }) ?? '',\n [aui]\n );\n}\n"],"names":[],"mappings":";;;AAWO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AACF,GAGkB;AAChB,MAAI,UAAU,SAAS,MAAM,aAAa,QAAQ,MAAM,QAAQ,SAAS,GAAI,QAAO;AACpF,MAAI;AACF,WAAO,KAAA,EAAO,QAAQ;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASO,SAAS,0BAA+C;AAC7D,QAAM,MAAM,OAAA;AACZ,QAAM,QAAQ,wBAAA;AACd,SAAO;AAAA,IACL,MAAM,oBAAoB,EAAE,MAAM,MAAM,IAAI,SAAS,SAAA,GAAY,OAAO;AAAA,IACxE,CAAC,KAAK,KAAK;AAAA,EAAA;AAEf;AAOO,SAAS,uBAAqC;AACnD,QAAM,MAAM,OAAA;AACZ,SAAO;AAAA,IACL,MAAM,oBAAoB,EAAE,MAAM,MAAM,IAAI,SAAS,SAAA,GAAY,OAAO,KAAA,CAAM,KAAK;AAAA,IACnF,CAAC,GAAG;AAAA,EAAA;AAER;"}
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react$1 = require("react");
3
+ const require$$0 = require("react");
4
4
  const react = require("@assistant-ui/react");
5
5
  const threadIdContext = require("../threads/thread-id-context.cjs");
6
6
  const composerHandoff = require("./composer-handoff.cjs");
7
7
  function useSendMessage() {
8
8
  const aui = react.useAui();
9
9
  const store = composerHandoff.useComposerHandoffStore();
10
- const threadId = react$1.useContext(threadIdContext.AthenaStatewireThreadIdContext);
10
+ const threadId = require$$0.useContext(threadIdContext.AthenaStatewireThreadIdContext);
11
11
  const ready = composerHandoff.useComposerReady();
12
- const readyRef = react$1.useRef(ready);
12
+ const readyRef = require$$0.useRef(ready);
13
13
  readyRef.current = ready;
14
- return react$1.useCallback(
14
+ return require$$0.useCallback(
15
15
  async (text, options) => {
16
16
  if (!text.trim()) return;
17
17
  const write = {
@@ -1 +1 @@
1
- {"version":3,"file":"useSendMessage.cjs","sources":["../../src/composer/useSendMessage.ts"],"sourcesContent":["import { useCallback, useContext, useRef } from 'react';\nimport { useAui } from '@assistant-ui/react';\nimport { AthenaStatewireThreadIdContext } from '../threads/thread-id-context';\nimport {\n applyComposerWrite,\n queueComposerWrite,\n useComposerHandoffStore,\n useComposerReady,\n type ComposerWrite,\n} from './composer-handoff';\n\nexport interface SendMessageOptions {\n /**\n * Replace the current composer text before sending.\n * Defaults to `true`.\n */\n replace?: boolean;\n}\n\n/**\n * Hook to programmatically send a user message from anywhere inside AthenaProvider.\n *\n * This is intended for custom workflow buttons, sidebar shortcuts, or other UI\n * that lives outside the AthenaChat thread tree. Unlike `aui.thread().append()`,\n * this uses the provider-scoped composer runtime and does not depend on\n * ThreadPrimitive context.\n *\n * Safe to call at any time: a send made before the chat is ready (the thread\n * list still resolving the active thread, the thread's history still\n * loading, or a sign-in provider above still resolving who is signed in)\n * waits in the provider, in order with any other early sends, and goes out\n * once the composer is ready. The returned promise settles when\n * that send has been dispatched, and rejects with an `AthenaSdkError`\n * (`composer_write_dropped`) if it can no longer land — the user switched\n * threads, the identity changed, or the provider unmounted first.\n *\n * Usage:\n * const sendMessage = useSendMessage();\n * await sendMessage(\"Run the quarterly workflow\");\n * await sendMessage(\"Add this follow-up\", { replace: false });\n */\nexport function useSendMessage() {\n const aui = useAui();\n const store = useComposerHandoffStore();\n const threadId = useContext(AthenaStatewireThreadIdContext);\n const ready = useComposerReady();\n const readyRef = useRef(ready);\n readyRef.current = ready;\n\n return useCallback(\n async (text: string, options?: SendMessageOptions) => {\n if (!text.trim()) return;\n\n const write: ComposerWrite = {\n text,\n replace: options?.replace ?? true,\n send: true,\n focus: false,\n threadId,\n };\n if (store && !readyRef.current) {\n await new Promise<void>((resolve, reject) => {\n write.resolve = (outcome) => {\n Promise.resolve(outcome).then(() => resolve(), reject);\n };\n write.reject = reject;\n queueComposerWrite({ store, write });\n });\n return;\n }\n await applyComposerWrite({ target: aui, store, write });\n },\n [aui, store, threadId],\n );\n}\n"],"names":["useAui","useComposerHandoffStore","useContext","AthenaStatewireThreadIdContext","useComposerReady","useRef","useCallback","queueComposerWrite","applyComposerWrite"],"mappings":";;;;;;AAyCO,SAAS,iBAAiB;AAC/B,QAAM,MAAMA,MAAAA,OAAA;AACZ,QAAM,QAAQC,gBAAAA,wBAAA;AACd,QAAM,WAAWC,QAAAA,WAAWC,8CAA8B;AAC1D,QAAM,QAAQC,gBAAAA,iBAAA;AACd,QAAM,WAAWC,QAAAA,OAAO,KAAK;AAC7B,WAAS,UAAU;AAEnB,SAAOC,QAAAA;AAAAA,IACL,OAAO,MAAc,YAAiC;AACpD,UAAI,CAAC,KAAK,OAAQ;AAElB,YAAM,QAAuB;AAAA,QAC3B;AAAA,QACA,UAAS,mCAAS,YAAW;AAAA,QAC7B,MAAM;AAAA,QACN,OAAO;AAAA,QACP;AAAA,MAAA;AAEF,UAAI,SAAS,CAAC,SAAS,SAAS;AAC9B,cAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAC3C,gBAAM,UAAU,CAAC,YAAY;AAC3B,oBAAQ,QAAQ,OAAO,EAAE,KAAK,MAAM,QAAA,GAAW,MAAM;AAAA,UACvD;AACA,gBAAM,SAAS;AACfC,6CAAmB,EAAE,OAAO,OAAO;AAAA,QACrC,CAAC;AACD;AAAA,MACF;AACA,YAAMC,gBAAAA,mBAAmB,EAAE,QAAQ,KAAK,OAAO,OAAO;AAAA,IACxD;AAAA,IACA,CAAC,KAAK,OAAO,QAAQ;AAAA,EAAA;AAEzB;;"}
1
+ {"version":3,"file":"useSendMessage.cjs","sources":["../../src/composer/useSendMessage.ts"],"sourcesContent":["import { useCallback, useContext, useRef } from 'react';\nimport { useAui } from '@assistant-ui/react';\nimport { AthenaStatewireThreadIdContext } from '../threads/thread-id-context';\nimport {\n applyComposerWrite,\n queueComposerWrite,\n useComposerHandoffStore,\n useComposerReady,\n type ComposerWrite,\n} from './composer-handoff';\n\nexport interface SendMessageOptions {\n /**\n * Replace the current composer text before sending.\n * Defaults to `true`.\n */\n replace?: boolean;\n}\n\n/**\n * Hook to programmatically send a user message from anywhere inside AthenaProvider.\n *\n * This is intended for custom workflow buttons, sidebar shortcuts, or other UI\n * that lives outside the AthenaChat thread tree. Unlike `aui.thread().append()`,\n * this uses the provider-scoped composer runtime and does not depend on\n * ThreadPrimitive context.\n *\n * Safe to call at any time: a send made before the chat is ready (the thread\n * list still resolving the active thread, the thread's history still\n * loading, or a sign-in provider above still resolving who is signed in)\n * waits in the provider, in order with any other early sends, and goes out\n * once the composer is ready. The returned promise settles when\n * that send has been dispatched, and rejects with an `AthenaSdkError`\n * (`composer_write_dropped`) if it can no longer land — the user switched\n * threads, the identity changed, or the provider unmounted first.\n *\n * Usage:\n * const sendMessage = useSendMessage();\n * await sendMessage(\"Run the quarterly workflow\");\n * await sendMessage(\"Add this follow-up\", { replace: false });\n */\nexport function useSendMessage() {\n const aui = useAui();\n const store = useComposerHandoffStore();\n const threadId = useContext(AthenaStatewireThreadIdContext);\n const ready = useComposerReady();\n const readyRef = useRef(ready);\n readyRef.current = ready;\n\n return useCallback(\n async (text: string, options?: SendMessageOptions) => {\n if (!text.trim()) return;\n\n const write: ComposerWrite = {\n text,\n replace: options?.replace ?? true,\n send: true,\n focus: false,\n threadId,\n };\n if (store && !readyRef.current) {\n await new Promise<void>((resolve, reject) => {\n write.resolve = (outcome) => {\n Promise.resolve(outcome).then(() => resolve(), reject);\n };\n write.reject = reject;\n queueComposerWrite({ store, write });\n });\n return;\n }\n await applyComposerWrite({ target: aui, store, write });\n },\n [aui, store, threadId],\n );\n}\n"],"names":["useAui","useComposerHandoffStore","useContext","AthenaStatewireThreadIdContext","useComposerReady","useRef","useCallback","queueComposerWrite","applyComposerWrite"],"mappings":";;;;;;AAyCO,SAAS,iBAAiB;AAC/B,QAAM,MAAMA,MAAAA,OAAA;AACZ,QAAM,QAAQC,gBAAAA,wBAAA;AACd,QAAM,WAAWC,WAAAA,WAAWC,8CAA8B;AAC1D,QAAM,QAAQC,gBAAAA,iBAAA;AACd,QAAM,WAAWC,WAAAA,OAAO,KAAK;AAC7B,WAAS,UAAU;AAEnB,SAAOC,WAAAA;AAAAA,IACL,OAAO,MAAc,YAAiC;AACpD,UAAI,CAAC,KAAK,OAAQ;AAElB,YAAM,QAAuB;AAAA,QAC3B;AAAA,QACA,UAAS,mCAAS,YAAW;AAAA,QAC7B,MAAM;AAAA,QACN,OAAO;AAAA,QACP;AAAA,MAAA;AAEF,UAAI,SAAS,CAAC,SAAS,SAAS;AAC9B,cAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAC3C,gBAAM,UAAU,CAAC,YAAY;AAC3B,oBAAQ,QAAQ,OAAO,EAAE,KAAK,MAAM,QAAA,GAAW,MAAM;AAAA,UACvD;AACA,gBAAM,SAAS;AACfC,6CAAmB,EAAE,OAAO,OAAO;AAAA,QACrC,CAAC;AACD;AAAA,MACF;AACA,YAAMC,gBAAAA,mBAAmB,EAAE,QAAQ,KAAK,OAAO,OAAO;AAAA,IACxD;AAAA,IACA,CAAC,KAAK,OAAO,QAAQ;AAAA,EAAA;AAEzB;;"}
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react = require("react");
3
+ const require$$0 = require("react");
4
4
  const athenaDiagnostics = require("./athena-diagnostics.cjs");
5
5
  function useAthenaDiagnostics() {
6
- const snapshot = react.useSyncExternalStore(
6
+ const snapshot = require$$0.useSyncExternalStore(
7
7
  athenaDiagnostics.athenaDiagnostics.subscribeSnapshot.bind(athenaDiagnostics.athenaDiagnostics),
8
8
  athenaDiagnostics.athenaDiagnostics.snapshot.bind(athenaDiagnostics.athenaDiagnostics),
9
9
  athenaDiagnostics.athenaDiagnostics.snapshot.bind(athenaDiagnostics.athenaDiagnostics)
10
10
  );
11
- const clear = react.useCallback(() => athenaDiagnostics.athenaDiagnostics.clear(), []);
12
- const exportJson = react.useCallback(() => athenaDiagnostics.athenaDiagnostics.export(), []);
11
+ const clear = require$$0.useCallback(() => athenaDiagnostics.athenaDiagnostics.clear(), []);
12
+ const exportJson = require$$0.useCallback(() => athenaDiagnostics.athenaDiagnostics.export(), []);
13
13
  return { ...snapshot, clear, export: exportJson };
14
14
  }
15
15
  exports.useAthenaDiagnostics = useAthenaDiagnostics;
@@ -1 +1 @@
1
- {"version":3,"file":"useAthenaDiagnostics.cjs","sources":["../../src/diagnostics/useAthenaDiagnostics.ts"],"sourcesContent":["import { useCallback, useSyncExternalStore } from 'react';\nimport { athenaDiagnostics, type AthenaDiagnosticsSnapshot } from './athena-diagnostics';\n\n/**\n * Read the SDK diagnostics buffer reactively — events, gauges (connection\n * status, transport, auth mode), and the latest span timings (time to auth,\n * time to thread list, time to statewire snapshot, time to first token).\n *\n * Renders on every emitted event; mount it in a debug panel, not in the chat\n * transcript.\n */\nexport function useAthenaDiagnostics(): AthenaDiagnosticsSnapshot & {\n clear: () => void;\n export: () => string;\n} {\n const snapshot = useSyncExternalStore(\n athenaDiagnostics.subscribeSnapshot.bind(athenaDiagnostics),\n athenaDiagnostics.snapshot.bind(athenaDiagnostics),\n athenaDiagnostics.snapshot.bind(athenaDiagnostics),\n );\n const clear = useCallback(() => athenaDiagnostics.clear(), []);\n const exportJson = useCallback(() => athenaDiagnostics.export(), []);\n return { ...snapshot, clear, export: exportJson };\n}\n"],"names":["useSyncExternalStore","athenaDiagnostics","useCallback"],"mappings":";;;;AAWO,SAAS,uBAGd;AACA,QAAM,WAAWA,MAAAA;AAAAA,IACfC,oCAAkB,kBAAkB,KAAKA,mCAAiB;AAAA,IAC1DA,oCAAkB,SAAS,KAAKA,mCAAiB;AAAA,IACjDA,oCAAkB,SAAS,KAAKA,kBAAAA,iBAAiB;AAAA,EAAA;AAEnD,QAAM,QAAQC,MAAAA,YAAY,MAAMD,kBAAAA,kBAAkB,MAAA,GAAS,CAAA,CAAE;AAC7D,QAAM,aAAaC,MAAAA,YAAY,MAAMD,kBAAAA,kBAAkB,OAAA,GAAU,CAAA,CAAE;AACnE,SAAO,EAAE,GAAG,UAAU,OAAO,QAAQ,WAAA;AACvC;;"}
1
+ {"version":3,"file":"useAthenaDiagnostics.cjs","sources":["../../src/diagnostics/useAthenaDiagnostics.ts"],"sourcesContent":["import { useCallback, useSyncExternalStore } from 'react';\nimport { athenaDiagnostics, type AthenaDiagnosticsSnapshot } from './athena-diagnostics';\n\n/**\n * Read the SDK diagnostics buffer reactively — events, gauges (connection\n * status, transport, auth mode), and the latest span timings (time to auth,\n * time to thread list, time to statewire snapshot, time to first token).\n *\n * Renders on every emitted event; mount it in a debug panel, not in the chat\n * transcript.\n */\nexport function useAthenaDiagnostics(): AthenaDiagnosticsSnapshot & {\n clear: () => void;\n export: () => string;\n} {\n const snapshot = useSyncExternalStore(\n athenaDiagnostics.subscribeSnapshot.bind(athenaDiagnostics),\n athenaDiagnostics.snapshot.bind(athenaDiagnostics),\n athenaDiagnostics.snapshot.bind(athenaDiagnostics),\n );\n const clear = useCallback(() => athenaDiagnostics.clear(), []);\n const exportJson = useCallback(() => athenaDiagnostics.export(), []);\n return { ...snapshot, clear, export: exportJson };\n}\n"],"names":["useSyncExternalStore","athenaDiagnostics","useCallback"],"mappings":";;;;AAWO,SAAS,uBAGd;AACA,QAAM,WAAWA,WAAAA;AAAAA,IACfC,oCAAkB,kBAAkB,KAAKA,mCAAiB;AAAA,IAC1DA,oCAAkB,SAAS,KAAKA,mCAAiB;AAAA,IACjDA,oCAAkB,SAAS,KAAKA,kBAAAA,iBAAiB;AAAA,EAAA;AAEnD,QAAM,QAAQC,WAAAA,YAAY,MAAMD,kBAAAA,kBAAkB,MAAA,GAAS,CAAA,CAAE;AAC7D,QAAM,aAAaC,WAAAA,YAAY,MAAMD,kBAAAA,kBAAkB,OAAA,GAAU,CAAA,CAAE;AACnE,SAAO,EAAE,GAAG,UAAU,OAAO,QAAQ,WAAA;AACvC;;"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react = require("react");
3
+ const require$$0 = require("react");
4
4
  function emptyAudioLevelHistory(size) {
5
5
  return new Array(Math.max(0, size)).fill(null);
6
6
  }
@@ -20,8 +20,8 @@ function displayLevelFromSamples(samples, gain = 4) {
20
20
  return Math.min(1, rms * gain);
21
21
  }
22
22
  function useAudioLevelHistory(stream, { size, intervalMs = 50 }) {
23
- const [history, setHistory] = react.useState(() => emptyAudioLevelHistory(size));
24
- react.useEffect(() => {
23
+ const [history, setHistory] = require$$0.useState(() => emptyAudioLevelHistory(size));
24
+ require$$0.useEffect(() => {
25
25
  setHistory(emptyAudioLevelHistory(size));
26
26
  if (!stream || typeof window === "undefined") return;
27
27
  const AudioContextCtor = window.AudioContext ?? window.webkitAudioContext;
@@ -1 +1 @@
1
- {"version":3,"file":"audio-level-history.cjs","sources":["../../src/dictation/audio-level-history.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * A rolling window of microphone levels (0..1), newest last, for the\n * composer's waveform strip. `size` slots are always present: unfilled slots\n * are `null` so the strip can draw them as the resting dotted baseline.\n */\nexport type AudioLevelHistory = ReadonlyArray<number | null>;\n\nexport function emptyAudioLevelHistory(size: number): AudioLevelHistory {\n return new Array<number | null>(Math.max(0, size)).fill(null);\n}\n\n/** Append one level, dropping the oldest slot. Pure. */\nexport function pushAudioLevel(history: AudioLevelHistory, level: number): AudioLevelHistory {\n if (history.length === 0) return history;\n const clamped = Math.min(1, Math.max(0, level));\n return [...history.slice(1), clamped];\n}\n\n/**\n * RMS of a PCM sample window scaled to 0..1 for display. Speech peaks sit\n * around 0.1-0.3 RMS, so a gain lifts them into the visible range while the\n * noise floor (about 0.005) stays flat.\n */\nexport function displayLevelFromSamples(samples: ArrayLike<number>, gain = 4): number {\n if (samples.length === 0) return 0;\n let sum = 0;\n for (let i = 0; i < samples.length; i += 1) {\n const sample = samples[i] ?? 0;\n sum += sample * sample;\n }\n const rms = Math.sqrt(sum / samples.length);\n return Math.min(1, rms * gain);\n}\n\ninterface UseAudioLevelHistoryOptions {\n /** Number of bars in the strip. */\n size: number;\n /** Sample cadence in ms; 50ms gives ~20 bars per second. */\n intervalMs?: number;\n}\n\n/**\n * Sample a `MediaStream` through an `AnalyserNode` into a rolling level\n * history. Returns the resting baseline when `stream` is null.\n */\nexport function useAudioLevelHistory(\n stream: MediaStream | null,\n { size, intervalMs = 50 }: UseAudioLevelHistoryOptions,\n): AudioLevelHistory {\n const [history, setHistory] = useState<AudioLevelHistory>(() => emptyAudioLevelHistory(size));\n\n useEffect(() => {\n setHistory(emptyAudioLevelHistory(size));\n if (!stream || typeof window === 'undefined') return;\n const AudioContextCtor =\n window.AudioContext ??\n (window as typeof window & { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n if (!AudioContextCtor) return;\n\n let audioContext: AudioContext;\n try {\n audioContext = new AudioContextCtor();\n } catch {\n return;\n }\n const analyser = audioContext.createAnalyser();\n analyser.fftSize = 1024;\n analyser.smoothingTimeConstant = 0;\n let source: MediaStreamAudioSourceNode | null = null;\n try {\n source = audioContext.createMediaStreamSource(stream);\n source.connect(analyser);\n } catch {\n void audioContext.close();\n return;\n }\n const samples = new Float32Array(analyser.fftSize);\n const interval = window.setInterval(() => {\n analyser.getFloatTimeDomainData(samples);\n const level = displayLevelFromSamples(samples);\n setHistory((current) => pushAudioLevel(current, level));\n }, intervalMs);\n\n return () => {\n window.clearInterval(interval);\n try {\n source?.disconnect();\n analyser.disconnect();\n } catch {\n // Already disconnected.\n }\n void audioContext.close();\n };\n }, [stream, size, intervalMs]);\n\n return history;\n}\n"],"names":["useState","useEffect"],"mappings":";;;AASO,SAAS,uBAAuB,MAAiC;AACtE,SAAO,IAAI,MAAqB,KAAK,IAAI,GAAG,IAAI,CAAC,EAAE,KAAK,IAAI;AAC9D;AAGO,SAAS,eAAe,SAA4B,OAAkC;AAC3F,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG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Ac,QAAQ;AAC7B,UAAI;AACF,yCAAQ;AACR,iBAAS,WAAA;AAAA,MACX,QAAQ;AAAA,MAER;AACA,WAAK,aAAa,MAAA;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,QAAQ,MAAM,UAAU,CAAC;AAE7B,SAAO;AACT;;;;;"}
1
+ {"version":3,"file":"audio-level-history.cjs","sources":["../../src/dictation/audio-level-history.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * A rolling window of microphone levels (0..1), newest last, for the\n * composer's waveform strip. `size` slots are always present: unfilled slots\n * are `null` so the strip can draw them as the resting dotted baseline.\n */\nexport type AudioLevelHistory = ReadonlyArray<number | null>;\n\nexport function emptyAudioLevelHistory(size: number): AudioLevelHistory {\n return new Array<number | null>(Math.max(0, size)).fill(null);\n}\n\n/** Append one level, dropping the oldest slot. Pure. */\nexport function pushAudioLevel(history: AudioLevelHistory, level: number): AudioLevelHistory {\n if (history.length === 0) return history;\n const clamped = Math.min(1, Math.max(0, level));\n return [...history.slice(1), clamped];\n}\n\n/**\n * RMS of a PCM sample window scaled to 0..1 for display. Speech peaks sit\n * around 0.1-0.3 RMS, so a gain lifts them into the visible range while the\n * noise floor (about 0.005) stays flat.\n */\nexport function displayLevelFromSamples(samples: ArrayLike<number>, gain = 4): number {\n if (samples.length === 0) return 0;\n let sum = 0;\n for (let i = 0; i < samples.length; i += 1) {\n const sample = samples[i] ?? 0;\n sum += sample * sample;\n }\n const rms = Math.sqrt(sum / samples.length);\n return Math.min(1, rms * gain);\n}\n\ninterface UseAudioLevelHistoryOptions {\n /** Number of bars in the strip. */\n size: number;\n /** Sample cadence in ms; 50ms gives ~20 bars per second. */\n intervalMs?: number;\n}\n\n/**\n * Sample a `MediaStream` through an `AnalyserNode` into a rolling level\n * history. Returns the resting baseline when `stream` is null.\n */\nexport function useAudioLevelHistory(\n stream: MediaStream | null,\n { size, intervalMs = 50 }: UseAudioLevelHistoryOptions,\n): AudioLevelHistory {\n const [history, setHistory] = useState<AudioLevelHistory>(() => emptyAudioLevelHistory(size));\n\n useEffect(() => {\n setHistory(emptyAudioLevelHistory(size));\n if (!stream || typeof window === 'undefined') return;\n const AudioContextCtor =\n window.AudioContext ??\n (window as typeof window & { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n if (!AudioContextCtor) return;\n\n let audioContext: AudioContext;\n try {\n audioContext = new AudioContextCtor();\n } catch {\n return;\n }\n const analyser = audioContext.createAnalyser();\n analyser.fftSize = 1024;\n analyser.smoothingTimeConstant = 0;\n let source: MediaStreamAudioSourceNode | null = null;\n try {\n source = audioContext.createMediaStreamSource(stream);\n source.connect(analyser);\n } catch {\n void audioContext.close();\n return;\n }\n const samples = new Float32Array(analyser.fftSize);\n const interval = window.setInterval(() => {\n analyser.getFloatTimeDomainData(samples);\n const level = displayLevelFromSamples(samples);\n setHistory((current) => pushAudioLevel(current, level));\n }, intervalMs);\n\n return () => {\n window.clearInterval(interval);\n try {\n source?.disconnect();\n analyser.disconnect();\n } catch {\n // Already disconnected.\n }\n void audioContext.close();\n };\n }, [stream, size, intervalMs]);\n\n return history;\n}\n"],"names":["useState","useEffect"],"mappings":";;;AASO,SAAS,uBAAuB,MAAiC;AACtE,SAAO,IAAI,MAAqB,KAAK,IAAI,GAAG,IAAI,CAAC,EAAE,KAAK,IAAI;AAC9D;AAGO,SAAS,eAAe,SAA4B,OAAkC;AAC3F,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC;AAC9C,SAAO,CAAC,GAAG,QAAQ,MAAM,CAAC,GAAG,OAAO;AACtC;AAOO,SAAS,wBAAwB,SAA4B,OAAO,GAAW;AACpF,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,MAAI,MAAM;AACV,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK,GAAG;AAC1C,UAAM,SAAS,QAAQ,CAAC,KAAK;AAC7B,WAAO,SAAS;AAAA,EAClB;AACA,QAAM,MAAM,KAAK,KAAK,MAAM,QAAQ,MAAM;AAC1C,SAAO,KAAK,IAAI,GAAG,MAAM,IAAI;AAC/B;AAaO,SAAS,qBACd,QACA,EAAE,MAAM,aAAa,MACF;AACnB,QAAM,CAAC,SAAS,UAAU,IAAIA,WAAAA,SAA4B,MAAM,uBAAuB,IAAI,CAAC;AAE5FC,aAAAA,UAAU,MAAM;AACd,eAAW,uBAAuB,IAAI,CAAC;AACvC,QAAI,CAAC,UAAU,OAAO,WAAW,YAAa;AAC9C,UAAM,mBACJ,OAAO,gBACN,OAAwE;AAC3E,QAAI,CAAC,iBAAkB;AAEvB,QAAI;AACJ,QAAI;AACF,qBAAe,IAAI,iBAAA;AAAA,IACrB,QAAQ;AACN;AAAA,IACF;AACA,UAAM,WAAW,aAAa,eAAA;AAC9B,aAAS,UAAU;AACnB,aAAS,wBAAwB;AACjC,QAAI,SAA4C;AAChD,QAAI;AACF,eAAS,aAAa,wBAAwB,MAAM;AACpD,aAAO,QAAQ,QAAQ;AAAA,IACzB,QAAQ;AACN,WAAK,aAAa,MAAA;AAClB;AAAA,IACF;AACA,UAAM,UAAU,IAAI,aAAa,SAAS,OAAO;AACjD,UAAM,WAAW,OAAO,YAAY,MAAM;AACxC,eAAS,uBAAuB,OAAO;AACvC,YAAM,QAAQ,wBAAwB,OAAO;AAC7C,iBAAW,CAAC,YAAY,eAAe,SAAS,KAAK,CAAC;AAAA,IACxD,GAAG,UAAU;AAEb,WAAO,MAAM;AACX,aAAO,cAAc,QAAQ;AAC7B,UAAI;AACF,yCAAQ;AACR,iBAAS,WAAA;AAAA,MACX,QAAQ;AAAA,MAER;AACA,WAAK,aAAa,MAAA;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,QAAQ,MAAM,UAAU,CAAC;AAE7B,SAAO;AACT;;;;;"}
@@ -4,26 +4,30 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const lucideReact = require("lucide-react");
5
5
  const tooltipIconButton = require("../chat/tooltip-icon-button.cjs");
6
6
  const cnfast = require("cnfast");
7
- const DictationMicButton = ({
8
- onClick,
9
- disabled,
10
- className,
11
- title = "Dictate a message"
12
- }) => /* @__PURE__ */ jsxRuntime.jsx(
13
- tooltipIconButton.TooltipIconButton,
14
- {
15
- tooltip: title,
16
- side: "bottom",
17
- type: "button",
18
- variant: "ghost",
19
- size: "icon",
20
- className: cnfast.cn("aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground", className),
21
- "aria-label": title,
22
- onClick,
23
- disabled,
24
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MicIcon, { className: "aui-composer-dictate-icon size-4" })
25
- }
26
- );
7
+ const DictationMicButton = ({ onClick, disabled, className, title = "Dictate a message", disabledReason = null }) => {
8
+ const unavailable = Boolean(disabledReason);
9
+ return /* @__PURE__ */ jsxRuntime.jsx(
10
+ tooltipIconButton.TooltipIconButton,
11
+ {
12
+ tooltip: disabledReason || title,
13
+ side: "bottom",
14
+ type: "button",
15
+ variant: "ghost",
16
+ size: "icon",
17
+ className: cnfast.cn(
18
+ "aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground",
19
+ className,
20
+ unavailable && "cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground"
21
+ ),
22
+ "aria-label": title,
23
+ "aria-disabled": unavailable || void 0,
24
+ "data-unavailable": unavailable || void 0,
25
+ onClick: unavailable ? void 0 : onClick,
26
+ disabled: !unavailable && disabled,
27
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MicIcon, { className: "aui-composer-dictate-icon size-4" })
28
+ }
29
+ );
30
+ };
27
31
  const DictationCancelButton = ({ onClick, disabled, className }) => /* @__PURE__ */ jsxRuntime.jsx(
28
32
  tooltipIconButton.TooltipIconButton,
29
33
  {
@@ -1 +1 @@
1
- {"version":3,"file":"dictation-controls.cjs","sources":["../../src/dictation/dictation-controls.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { MicIcon, SquareIcon, XIcon } from 'lucide-react';\nimport { TooltipIconButton } from '../chat/tooltip-icon-button';\nimport { cn } from '../lib/utils';\n\ninterface DictationControlProps {\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n/** Toolbar mic: starts a dictation session. */\nexport const DictationMicButton: FC<DictationControlProps & { title?: string }> = ({\n onClick,\n disabled,\n className,\n title = 'Dictate a message',\n}) => (\n <TooltipIconButton\n tooltip={title}\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn('aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground', className)}\n aria-label={title}\n onClick={onClick}\n disabled={disabled}\n >\n <MicIcon className=\"aui-composer-dictate-icon size-4\" />\n </TooltipIconButton>\n);\n\n/** Recording mode, left side: discard the session. */\nexport const DictationCancelButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Cancel dictation\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-cancel size-8 rounded-full', className)}\n aria-label=\"Cancel dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <XIcon className=\"size-4\" />\n </TooltipIconButton>\n);\n\n/** Recording mode, right side: stop and put the words in the composer. */\nexport const DictationStopButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Stop and review\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-stop size-8 rounded-full', className)}\n aria-label=\"Stop dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <SquareIcon className=\"size-3 fill-current\" />\n </TooltipIconButton>\n);\n"],"names":["jsx","TooltipIconButton","cn","MicIcon","XIcon","SquareIcon"],"mappings":";;;;;;AAYO,MAAM,qBAAqE,CAAC;AAAA,EACjF;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AACV,MACEA,2BAAAA;AAAAA,EAACC,kBAAAA;AAAAA,EAAA;AAAA,IACC,SAAS;AAAA,IACT,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAWC,OAAAA,GAAG,wFAAwF,SAAS;AAAA,IAC/G,cAAY;AAAA,IACZ;AAAA,IACA;AAAA,IAEA,UAAAF,2BAAAA,IAACG,YAAAA,SAAA,EAAQ,WAAU,mCAAA,CAAmC;AAAA,EAAA;AACxD;AAIK,MAAM,wBAAmD,CAAC,EAAE,SAAS,UAAU,gBACpFH,2BAAAA;AAAAA,EAACC,kBAAAA;AAAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAWC,OAAAA,GAAG,mDAAmD,SAAS;AAAA,IAC1E,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAAF,2BAAAA,IAACI,YAAAA,OAAA,EAAM,WAAU,SAAA,CAAS;AAAA,EAAA;AAC5B;AAIK,MAAM,sBAAiD,CAAC,EAAE,SAAS,UAAU,gBAClFJ,2BAAAA;AAAAA,EAACC,kBAAAA;AAAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAWC,OAAAA,GAAG,iDAAiD,SAAS;AAAA,IACxE,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAAF,2BAAAA,IAACK,YAAAA,YAAA,EAAW,WAAU,sBAAA,CAAsB;AAAA,EAAA;AAC9C;;;;"}
1
+ {"version":3,"file":"dictation-controls.cjs","sources":["../../src/dictation/dictation-controls.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { MicIcon, SquareIcon, XIcon } from 'lucide-react';\nimport { TooltipIconButton } from '../chat/tooltip-icon-button';\nimport { cn } from '../lib/utils';\n\ninterface DictationControlProps {\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Toolbar mic: starts a dictation session. With a `disabledReason` (Athena can't be reached, so\n * nothing could transcribe) it shows off with the reason as its tooltip, keeping its pointer and\n * focus so the reason reads, and starts nothing.\n */\nexport const DictationMicButton: FC<\n DictationControlProps & { title?: string; disabledReason?: string | null }\n> = ({ onClick, disabled, className, title = 'Dictate a message', disabledReason = null }) => {\n const unavailable = Boolean(disabledReason);\n return (\n <TooltipIconButton\n tooltip={disabledReason || title}\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\n 'aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground',\n className,\n unavailable && 'cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground',\n )}\n aria-label={title}\n aria-disabled={unavailable || undefined}\n data-unavailable={unavailable || undefined}\n onClick={unavailable ? undefined : onClick}\n disabled={!unavailable && disabled}\n >\n <MicIcon className=\"aui-composer-dictate-icon size-4\" />\n </TooltipIconButton>\n );\n};\n\n/** Recording mode, left side: discard the session. */\nexport const DictationCancelButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Cancel dictation\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-cancel size-8 rounded-full', className)}\n aria-label=\"Cancel dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <XIcon className=\"size-4\" />\n </TooltipIconButton>\n);\n\n/** Recording mode, right side: stop and put the words in the composer. */\nexport const DictationStopButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Stop and review\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-stop size-8 rounded-full', className)}\n aria-label=\"Stop dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <SquareIcon className=\"size-3 fill-current\" />\n </TooltipIconButton>\n);\n"],"names":["jsx","TooltipIconButton","cn","MicIcon","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A,IACA;AAAA,IAEA,UAAAF,2BAAAA,IAACK,YAAAA,YAAA,EAAW,WAAU,sBAAA,CAAsB;AAAA,EAAA;AAC9C;;;;"}
@@ -4,9 +4,14 @@ interface DictationControlProps {
4
4
  disabled?: boolean;
5
5
  className?: string;
6
6
  }
7
- /** Toolbar mic: starts a dictation session. */
7
+ /**
8
+ * Toolbar mic: starts a dictation session. With a `disabledReason` (Athena can't be reached, so
9
+ * nothing could transcribe) it shows off with the reason as its tooltip, keeping its pointer and
10
+ * focus so the reason reads, and starts nothing.
11
+ */
8
12
  export declare const DictationMicButton: FC<DictationControlProps & {
9
13
  title?: string;
14
+ disabledReason?: string | null;
10
15
  }>;
11
16
  /** Recording mode, left side: discard the session. */
12
17
  export declare const DictationCancelButton: FC<DictationControlProps>;
@@ -2,26 +2,30 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { SquareIcon, MicIcon, XIcon } from "lucide-react";
3
3
  import { TooltipIconButton } from "../chat/tooltip-icon-button.js";
4
4
  import { cn } from "cnfast";
5
- const DictationMicButton = ({
6
- onClick,
7
- disabled,
8
- className,
9
- title = "Dictate a message"
10
- }) => /* @__PURE__ */ jsx(
11
- TooltipIconButton,
12
- {
13
- tooltip: title,
14
- side: "bottom",
15
- type: "button",
16
- variant: "ghost",
17
- size: "icon",
18
- className: cn("aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground", className),
19
- "aria-label": title,
20
- onClick,
21
- disabled,
22
- children: /* @__PURE__ */ jsx(MicIcon, { className: "aui-composer-dictate-icon size-4" })
23
- }
24
- );
5
+ const DictationMicButton = ({ onClick, disabled, className, title = "Dictate a message", disabledReason = null }) => {
6
+ const unavailable = Boolean(disabledReason);
7
+ return /* @__PURE__ */ jsx(
8
+ TooltipIconButton,
9
+ {
10
+ tooltip: disabledReason || title,
11
+ side: "bottom",
12
+ type: "button",
13
+ variant: "ghost",
14
+ size: "icon",
15
+ className: cn(
16
+ "aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground",
17
+ className,
18
+ unavailable && "cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground"
19
+ ),
20
+ "aria-label": title,
21
+ "aria-disabled": unavailable || void 0,
22
+ "data-unavailable": unavailable || void 0,
23
+ onClick: unavailable ? void 0 : onClick,
24
+ disabled: !unavailable && disabled,
25
+ children: /* @__PURE__ */ jsx(MicIcon, { className: "aui-composer-dictate-icon size-4" })
26
+ }
27
+ );
28
+ };
25
29
  const DictationCancelButton = ({ onClick, disabled, className }) => /* @__PURE__ */ jsx(
26
30
  TooltipIconButton,
27
31
  {
@@ -1 +1 @@
1
- {"version":3,"file":"dictation-controls.js","sources":["../../src/dictation/dictation-controls.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { MicIcon, SquareIcon, XIcon } from 'lucide-react';\nimport { TooltipIconButton } from '../chat/tooltip-icon-button';\nimport { cn } from '../lib/utils';\n\ninterface DictationControlProps {\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n/** Toolbar mic: starts a dictation session. */\nexport const DictationMicButton: FC<DictationControlProps & { title?: string }> = ({\n onClick,\n disabled,\n className,\n title = 'Dictate a message',\n}) => (\n <TooltipIconButton\n tooltip={title}\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn('aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground', className)}\n aria-label={title}\n onClick={onClick}\n disabled={disabled}\n >\n <MicIcon className=\"aui-composer-dictate-icon size-4\" />\n </TooltipIconButton>\n);\n\n/** Recording mode, left side: discard the session. */\nexport const DictationCancelButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Cancel dictation\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-cancel size-8 rounded-full', className)}\n aria-label=\"Cancel dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <XIcon className=\"size-4\" />\n </TooltipIconButton>\n);\n\n/** Recording mode, right side: stop and put the words in the composer. */\nexport const DictationStopButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Stop and review\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-stop size-8 rounded-full', className)}\n aria-label=\"Stop dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <SquareIcon className=\"size-3 fill-current\" />\n </TooltipIconButton>\n);\n"],"names":[],"mappings":";;;;AAYO,MAAM,qBAAqE,CAAC;AAAA,EACjF;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AACV,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAS;AAAA,IACT,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAW,GAAG,wFAAwF,SAAS;AAAA,IAC/G,cAAY;AAAA,IACZ;AAAA,IACA;AAAA,IAEA,UAAA,oBAAC,SAAA,EAAQ,WAAU,mCAAA,CAAmC;AAAA,EAAA;AACxD;AAIK,MAAM,wBAAmD,CAAC,EAAE,SAAS,UAAU,gBACpF;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAW,GAAG,mDAAmD,SAAS;AAAA,IAC1E,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAA,oBAAC,OAAA,EAAM,WAAU,SAAA,CAAS;AAAA,EAAA;AAC5B;AAIK,MAAM,sBAAiD,CAAC,EAAE,SAAS,UAAU,gBAClF;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAW,GAAG,iDAAiD,SAAS;AAAA,IACxE,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAA,oBAAC,YAAA,EAAW,WAAU,sBAAA,CAAsB;AAAA,EAAA;AAC9C;"}
1
+ {"version":3,"file":"dictation-controls.js","sources":["../../src/dictation/dictation-controls.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { MicIcon, SquareIcon, XIcon } from 'lucide-react';\nimport { TooltipIconButton } from '../chat/tooltip-icon-button';\nimport { cn } from '../lib/utils';\n\ninterface DictationControlProps {\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Toolbar mic: starts a dictation session. With a `disabledReason` (Athena can't be reached, so\n * nothing could transcribe) it shows off with the reason as its tooltip, keeping its pointer and\n * focus so the reason reads, and starts nothing.\n */\nexport const DictationMicButton: FC<\n DictationControlProps & { title?: string; disabledReason?: string | null }\n> = ({ onClick, disabled, className, title = 'Dictate a message', disabledReason = null }) => {\n const unavailable = Boolean(disabledReason);\n return (\n <TooltipIconButton\n tooltip={disabledReason || title}\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\n 'aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground',\n className,\n unavailable && 'cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground',\n )}\n aria-label={title}\n aria-disabled={unavailable || undefined}\n data-unavailable={unavailable || undefined}\n onClick={unavailable ? undefined : onClick}\n disabled={!unavailable && disabled}\n >\n <MicIcon className=\"aui-composer-dictate-icon size-4\" />\n </TooltipIconButton>\n );\n};\n\n/** Recording mode, left side: discard the session. */\nexport const DictationCancelButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Cancel dictation\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-cancel size-8 rounded-full', className)}\n aria-label=\"Cancel dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <XIcon className=\"size-4\" />\n </TooltipIconButton>\n);\n\n/** Recording mode, right side: stop and put the words in the composer. */\nexport const DictationStopButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Stop and review\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-stop size-8 rounded-full', className)}\n aria-label=\"Stop dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <SquareIcon className=\"size-3 fill-current\" />\n </TooltipIconButton>\n);\n"],"names":[],"mappings":";;;;AAgBO,MAAM,qBAET,CAAC,EAAE,SAAS,UAAU,WAAW,QAAQ,qBAAqB,iBAAiB,WAAW;AAC5F,QAAM,cAAc,QAAQ,cAAc;AAC1C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,kBAAkB;AAAA,MAC3B,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,MAEjB,cAAY;AAAA,MACZ,iBAAe,eAAe;AAAA,MAC9B,oBAAkB,eAAe;AAAA,MACjC,SAAS,cAAc,SAAY;AAAA,MACnC,UAAU,CAAC,eAAe;AAAA,MAE1B,UAAA,oBAAC,SAAA,EAAQ,WAAU,mCAAA,CAAmC;AAAA,IAAA;AAAA,EAAA;AAG5D;AAGO,MAAM,wBAAmD,CAAC,EAAE,SAAS,UAAU,gBACpF;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAW,GAAG,mDAAmD,SAAS;AAAA,IAC1E,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAA,oBAAC,OAAA,EAAM,WAAU,SAAA,CAAS;AAAA,EAAA;AAC5B;AAIK,MAAM,sBAAiD,CAAC,EAAE,SAAS,UAAU,gBAClF;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAW,GAAG,iDAAiD,SAAS;AAAA,IACxE,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAA,oBAAC,YAAA,EAAW,WAAU,sBAAA,CAAsB;AAAA,EAAA;AAC9C;"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react = require("react");
3
+ const require$$0 = require("react");
4
4
  const AthenaContext = require("../provider/AthenaContext.cjs");
5
5
  const credentialRenewal = require("../runtime/credential-renewal.cjs");
6
6
  const dictationEngine = require("./dictation-engine.cjs");
@@ -48,9 +48,9 @@ function createAthenaUploadTranscriber(getConfig) {
48
48
  }
49
49
  function useAthenaDictationEngine(override) {
50
50
  const config = AthenaContext.useAthenaConfig();
51
- const configRef = react.useRef(config);
51
+ const configRef = require$$0.useRef(config);
52
52
  configRef.current = config;
53
- return react.useMemo(() => {
53
+ return require$$0.useMemo(() => {
54
54
  if (override) return override;
55
55
  const recorded = recordedDictationEngine.createRecordedDictationEngine({
56
56
  transcribe: createAthenaUploadTranscriber(() => configRef.current)
@@ -1 +1 @@
1
- {"version":3,"file":"use-athena-dictation-engine.cjs","sources":["../../src/dictation/use-athena-dictation-engine.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { type AthenaConfig, useAthenaConfig } from '../provider/AthenaContext';\nimport { sendWithCredentialRenewal } from '../runtime/credential-renewal';\nimport { createWebSpeechDictationEngine, type DictationEngine } from './dictation-engine';\nimport { createRecordedDictationEngine, type DictationTranscriber } from './recorded-dictation-engine';\n\ninterface UploadTranscriptionResponse {\n transcript: string;\n}\n\n/** Agora's REST base from the configured backend URL (which may point at a nested endpoint). */\nexport function transcriptionUploadUrl(backendUrl: string): string {\n return `${backendUrl.replace(/\\/api\\/assistant-ui\\/?$/, '').replace(/\\/$/, '')}/api/transcription/upload`;\n}\n\n/**\n * One line for the composer per way `/transcription/upload` refuses a clip.\n * The copy lives here, apart from the fetch, so it can be pinned by a test.\n */\nexport function transcriptionUploadErrorMessage(status: number): string {\n switch (status) {\n case 401:\n case 403:\n return 'Dictation is not available for this sign-in. Reload and try again.';\n case 413:\n return 'That recording is too long to transcribe.';\n case 422:\n return 'The dictation language was rejected. Use a BCP-47 tag such as en-US.';\n case 429:\n return 'Too many dictations in a row. Wait a moment and try again.';\n case 503:\n return 'Dictation is not set up on this server.';\n default:\n return `Transcription failed (${status}).`;\n }\n}\n\n/**\n * Post a finished clip to agora's `/transcription/upload` route, which runs\n * it through Deepgram and returns the text. Credentials are read at call\n * time so a rotated token is picked up, and a `401` gets one forced renewal\n * (`getToken({ force: true })`) and a resend before it fails. The session\n * language (host `lang` or the document's) is forwarded so non-English speech\n * is recognised as such; the request is dropped when the engine aborts.\n */\nexport function createAthenaUploadTranscriber(\n getConfig: () => Pick<AthenaConfig, 'backendUrl' | 'apiKey' | 'token' | 'getToken'>,\n): DictationTranscriber {\n return async (clip, { lang, signal }) => {\n const config = getConfig();\n const extension = clip.type.includes('mp4') ? 'mp4' : clip.type.includes('ogg') ? 'ogg' : 'webm';\n const response = await sendWithCredentialRenewal(config, (headers) => {\n // A request body is single-use: every attempt builds its own form.\n const form = new FormData();\n form.append('file', clip, `dictation.${extension}`);\n if (lang) form.append('language', lang);\n return fetch(transcriptionUploadUrl(config.backendUrl), {\n method: 'POST',\n headers,\n body: form,\n credentials: 'include',\n signal,\n });\n });\n if (!response.ok) throw new Error(transcriptionUploadErrorMessage(response.status));\n const payload = (await response.json()) as UploadTranscriptionResponse;\n return typeof payload.transcript === 'string' ? payload.transcript : '';\n };\n}\n\n/**\n * The composer's default speech engine: record with `MediaRecorder`, then\n * transcribe the clip through agora (Deepgram). Falls back to the browser's\n * Web Speech API only where `MediaRecorder` is missing. A host-provided\n * `engine` always wins.\n */\nexport function useAthenaDictationEngine(override?: DictationEngine): DictationEngine {\n const config = useAthenaConfig();\n const configRef = useRef(config);\n configRef.current = config;\n return useMemo(() => {\n if (override) return override;\n const recorded = createRecordedDictationEngine({\n transcribe: createAthenaUploadTranscriber(() => configRef.current),\n });\n return recorded.isSupported() ? recorded : createWebSpeechDictationEngine();\n }, [override]);\n}\n"],"names":["sendWithCredentialRenewal","useAthenaConfig","useRef","useMemo","createRecordedDictationEngine","createWebSpeechDictationEngine"],"mappings":";;;;;;;AAWO,SAAS,uBAAuB,YAA4B;AACjE,SAAO,GAAG,WAAW,QAAQ,2BAA2B,EAAE,EAAE,QAAQ,OAAO,EAAE,CAAC;AAChF;AAMO,SAAS,gCAAgC,QAAwB;AACtE,UAAQ,QAAA;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO,yBAAyB,MAAM;AAAA,EAAA;AAE5C;AAUO,SAAS,8BACd,WACsB;AACtB,SAAO,OAAO,MAAM,EAAE,MAAM,aAAa;AACvC,UAAM,SAAS,UAAA;AACf,UAAM,YAAY,KAAK,KAAK,SAAS,KAAK,IAAI,QAAQ,KAAK,KAAK,SAAS,KAAK,IAAI,QAAQ;AAC1F,UAAM,WAAW,MAAMA,kBAAAA,0BAA0B,QAAQ,CAAC,YAAY;AAEpE,YAAM,OAAO,IAAI,SAAA;AACjB,WAAK,OAAO,QAAQ,MAAM,aAAa,SAAS,EAAE;AAClD,UAAI,KAAM,MAAK,OAAO,YAAY,IAAI;AACtC,aAAO,MAAM,uBAAuB,OAAO,UAAU,GAAG;AAAA,QACtD,QAAQ;AAAA,QACR;AAAA,QACA,MAAM;AAAA,QACN,aAAa;AAAA,QACb;AAAA,MAAA,CACD;AAAA,IACH,CAAC;AACD,QAAI,CAAC,SAAS,GAAI,OAAM,IAAI,MAAM,gCAAgC,SAAS,MAAM,CAAC;AAClF,UAAM,UAAW,MAAM,SAAS,KAAA;AAChC,WAAO,OAAO,QAAQ,eAAe,WAAW,QAAQ,aAAa;AAAA,EACvE;AACF;AAQO,SAAS,yBAAyB,UAA6C;AACpF,QAAM,SAASC,cAAAA,gBAAA;AACf,QAAM,YAAYC,MAAAA,OAAO,MAAM;AAC/B,YAAU,UAAU;AACpB,SAAOC,MAAAA,QAAQ,MAAM;AACnB,QAAI,SAAU,QAAO;AACrB,UAAM,WAAWC,wBAAAA,8BAA8B;AAAA,MAC7C,YAAY,8BAA8B,MAAM,UAAU,OAAO;AAAA,IAAA,CAClE;AACD,WAAO,SAAS,gBAAgB,WAAWC,gBAAAA,+BAAA;AAAA,EAC7C,GAAG,CAAC,QAAQ,CAAC;AACf;;;;;"}
1
+ {"version":3,"file":"use-athena-dictation-engine.cjs","sources":["../../src/dictation/use-athena-dictation-engine.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { type AthenaConfig, useAthenaConfig } from '../provider/AthenaContext';\nimport { sendWithCredentialRenewal } from '../runtime/credential-renewal';\nimport { createWebSpeechDictationEngine, type DictationEngine } from './dictation-engine';\nimport { createRecordedDictationEngine, type DictationTranscriber } from './recorded-dictation-engine';\n\ninterface UploadTranscriptionResponse {\n transcript: string;\n}\n\n/** Agora's REST base from the configured backend URL (which may point at a nested endpoint). */\nexport function transcriptionUploadUrl(backendUrl: string): string {\n return `${backendUrl.replace(/\\/api\\/assistant-ui\\/?$/, '').replace(/\\/$/, '')}/api/transcription/upload`;\n}\n\n/**\n * One line for the composer per way `/transcription/upload` refuses a clip.\n * The copy lives here, apart from the fetch, so it can be pinned by a test.\n */\nexport function transcriptionUploadErrorMessage(status: number): string {\n switch (status) {\n case 401:\n case 403:\n return 'Dictation is not available for this sign-in. Reload and try again.';\n case 413:\n return 'That recording is too long to transcribe.';\n case 422:\n return 'The dictation language was rejected. Use a BCP-47 tag such as en-US.';\n case 429:\n return 'Too many dictations in a row. Wait a moment and try again.';\n case 503:\n return 'Dictation is not set up on this server.';\n default:\n return `Transcription failed (${status}).`;\n }\n}\n\n/**\n * Post a finished clip to agora's `/transcription/upload` route, which runs\n * it through Deepgram and returns the text. Credentials are read at call\n * time so a rotated token is picked up, and a `401` gets one forced renewal\n * (`getToken({ force: true })`) and a resend before it fails. The session\n * language (host `lang` or the document's) is forwarded so non-English speech\n * is recognised as such; the request is dropped when the engine aborts.\n */\nexport function createAthenaUploadTranscriber(\n getConfig: () => Pick<AthenaConfig, 'backendUrl' | 'apiKey' | 'token' | 'getToken'>,\n): DictationTranscriber {\n return async (clip, { lang, signal }) => {\n const config = getConfig();\n const extension = clip.type.includes('mp4') ? 'mp4' : clip.type.includes('ogg') ? 'ogg' : 'webm';\n const response = await sendWithCredentialRenewal(config, (headers) => {\n // A request body is single-use: every attempt builds its own form.\n const form = new FormData();\n form.append('file', clip, `dictation.${extension}`);\n if (lang) form.append('language', lang);\n return fetch(transcriptionUploadUrl(config.backendUrl), {\n method: 'POST',\n headers,\n body: form,\n credentials: 'include',\n signal,\n });\n });\n if (!response.ok) throw new Error(transcriptionUploadErrorMessage(response.status));\n const payload = (await response.json()) as UploadTranscriptionResponse;\n return typeof payload.transcript === 'string' ? payload.transcript : '';\n };\n}\n\n/**\n * The composer's default speech engine: record with `MediaRecorder`, then\n * transcribe the clip through agora (Deepgram). Falls back to the browser's\n * Web Speech API only where `MediaRecorder` is missing. A host-provided\n * `engine` always wins.\n */\nexport function useAthenaDictationEngine(override?: DictationEngine): DictationEngine {\n const config = useAthenaConfig();\n const configRef = useRef(config);\n configRef.current = config;\n return useMemo(() => {\n if (override) return override;\n const recorded = createRecordedDictationEngine({\n transcribe: createAthenaUploadTranscriber(() => configRef.current),\n });\n return recorded.isSupported() ? recorded : createWebSpeechDictationEngine();\n }, [override]);\n}\n"],"names":["sendWithCredentialRenewal","useAthenaConfig","useRef","useMemo","createRecordedDictationEngine","createWebSpeechDictationEngine"],"mappings":";;;;;;;AAWO,SAAS,uBAAuB,YAA4B;AACjE,SAAO,GAA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