@athenaintel/react 0.42.2 → 0.48.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 (685) hide show
  1. package/README.md +225 -3
  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/client-tool-bridge.cjs +15 -15
  13. package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
  14. package/dist/agent-runtime/src/conversation-index.cjs +8 -8
  15. package/dist/agent-runtime/src/conversation-index.cjs.map +1 -1
  16. package/dist/agent-runtime/src/conversation-list-groups.d.ts +74 -0
  17. package/dist/agent-runtime/src/decision-checks.cjs +207 -0
  18. package/dist/agent-runtime/src/decision-checks.cjs.map +1 -0
  19. package/dist/agent-runtime/src/decision-checks.d.ts +142 -0
  20. package/dist/agent-runtime/src/decision-checks.js +207 -0
  21. package/dist/agent-runtime/src/decision-checks.js.map +1 -0
  22. package/dist/agent-runtime/src/desktop-handoff.d.ts +12 -0
  23. package/dist/agent-runtime/src/errors.cjs +18 -0
  24. package/dist/agent-runtime/src/errors.cjs.map +1 -1
  25. package/dist/agent-runtime/src/errors.d.ts +7 -0
  26. package/dist/agent-runtime/src/errors.js +18 -0
  27. package/dist/agent-runtime/src/errors.js.map +1 -1
  28. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +12 -0
  29. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  30. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +6 -6
  31. package/dist/agent-runtime/src/generated/runconfig-contract.js +12 -0
  32. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  33. package/dist/agent-runtime/src/handoff-arrival.cjs +60 -0
  34. package/dist/agent-runtime/src/handoff-arrival.cjs.map +1 -0
  35. package/dist/agent-runtime/src/handoff-arrival.d.ts +46 -0
  36. package/dist/agent-runtime/src/handoff-arrival.js +60 -0
  37. package/dist/agent-runtime/src/handoff-arrival.js.map +1 -0
  38. package/dist/agent-runtime/src/index.d.ts +15 -8
  39. package/dist/agent-runtime/src/interrupts.cjs +43 -18
  40. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  41. package/dist/agent-runtime/src/interrupts.d.ts +19 -2
  42. package/dist/agent-runtime/src/interrupts.js +28 -3
  43. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  44. package/dist/agent-runtime/src/lane-history.cjs +8 -8
  45. package/dist/agent-runtime/src/lane-history.cjs.map +1 -1
  46. package/dist/agent-runtime/src/messages.cjs +43 -8
  47. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  48. package/dist/agent-runtime/src/messages.d.ts +25 -3
  49. package/dist/agent-runtime/src/messages.js +43 -8
  50. package/dist/agent-runtime/src/messages.js.map +1 -1
  51. package/dist/agent-runtime/src/offline-status.cjs +36 -0
  52. package/dist/agent-runtime/src/offline-status.cjs.map +1 -0
  53. package/dist/agent-runtime/src/offline-status.d.ts +118 -3
  54. package/dist/agent-runtime/src/offline-status.js +36 -0
  55. package/dist/agent-runtime/src/offline-status.js.map +1 -0
  56. package/dist/agent-runtime/src/queue.cjs +0 -9
  57. package/dist/agent-runtime/src/queue.cjs.map +1 -1
  58. package/dist/agent-runtime/src/queue.js +0 -9
  59. package/dist/agent-runtime/src/queue.js.map +1 -1
  60. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +9 -9
  61. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  62. package/dist/agent-runtime/src/runtime-catalog.cjs +42 -0
  63. package/dist/agent-runtime/src/runtime-catalog.cjs.map +1 -0
  64. package/dist/agent-runtime/src/runtime-catalog.d.ts +35 -0
  65. package/dist/agent-runtime/src/runtime-catalog.js +42 -0
  66. package/dist/agent-runtime/src/runtime-catalog.js.map +1 -0
  67. package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -1
  68. package/dist/agent-runtime/src/runtime-messages.d.ts +1 -1
  69. package/dist/agent-runtime/src/runtime-messages.js.map +1 -1
  70. package/dist/agent-runtime/src/runtime.d.ts +40 -0
  71. package/dist/agent-runtime/src/statewire-suspended.cjs +3 -3
  72. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  73. package/dist/agent-runtime/src/subagents.cjs +32 -2
  74. package/dist/agent-runtime/src/subagents.cjs.map +1 -1
  75. package/dist/agent-runtime/src/subagents.d.ts +9 -0
  76. package/dist/agent-runtime/src/subagents.js +30 -0
  77. package/dist/agent-runtime/src/subagents.js.map +1 -1
  78. package/dist/agent-runtime/src/thread-driver.cjs +67 -0
  79. package/dist/agent-runtime/src/thread-driver.cjs.map +1 -0
  80. package/dist/agent-runtime/src/thread-driver.d.ts +49 -0
  81. package/dist/agent-runtime/src/thread-driver.js +67 -0
  82. package/dist/agent-runtime/src/thread-driver.js.map +1 -0
  83. package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +172 -0
  84. package/dist/agent-runtime/src/thread-handoff-protocol.d.ts +756 -0
  85. package/dist/agent-runtime/src/thread-handoff-qr.d.ts +11 -0
  86. package/dist/agent-runtime/src/thread-handoff.d.ts +3 -364
  87. package/dist/agent-runtime/src/thread-status.cjs +3 -3
  88. package/dist/agent-runtime/src/thread-status.cjs.map +1 -1
  89. package/dist/agent-runtime/src/tool-metadata.cjs +210 -33
  90. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  91. package/dist/agent-runtime/src/tool-metadata.d.ts +12 -0
  92. package/dist/agent-runtime/src/tool-metadata.js +210 -33
  93. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  94. package/dist/agent-runtime/src/tool-names.cjs +2 -0
  95. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  96. package/dist/agent-runtime/src/tool-names.d.ts +2 -0
  97. package/dist/agent-runtime/src/tool-names.js +2 -0
  98. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  99. package/dist/agent-runtime/src/types.d.ts +10 -2
  100. package/dist/agent-runtime/src/use-conversation-list.cjs +11 -11
  101. package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
  102. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +24 -19
  103. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
  104. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +2 -1
  105. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +6 -1
  106. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
  107. package/dist/agent-runtime/src/use-deep-agent-config.cjs +14 -14
  108. package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
  109. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +6 -6
  110. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  111. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +16 -16
  112. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  113. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +45 -45
  114. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  115. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +572 -134
  116. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
  117. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +137 -10
  118. package/dist/agent-runtime/src/use-deep-agent-voice.js +514 -76
  119. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
  120. package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +26 -26
  121. package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
  122. package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +4 -4
  123. package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -1
  124. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +28 -26
  125. package/dist/agent-runtime/src/voice-media.cjs +117 -0
  126. package/dist/agent-runtime/src/voice-media.cjs.map +1 -0
  127. package/dist/agent-runtime/src/voice-media.d.ts +49 -0
  128. package/dist/agent-runtime/src/voice-media.js +117 -0
  129. package/dist/agent-runtime/src/voice-media.js.map +1 -0
  130. package/dist/agent-runtime/src/voice-wire-types.d.ts +32 -0
  131. package/dist/assets/AssetPanel.cjs +11 -11
  132. package/dist/assets/AssetPanel.cjs.map +1 -1
  133. package/dist/assets/AthenaAssetEmbed.cjs +11 -9
  134. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  135. package/dist/assets/AthenaAssetEmbed.d.ts +7 -0
  136. package/dist/assets/AthenaAssetEmbed.js +4 -2
  137. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  138. package/dist/assets/AthenaLayout.cjs +16 -16
  139. package/dist/assets/AthenaLayout.cjs.map +1 -1
  140. package/dist/assets/use-asset-content.cjs +4 -4
  141. package/dist/assets/use-asset-content.cjs.map +1 -1
  142. package/dist/assets/use-asset-embed.cjs +14 -7
  143. package/dist/assets/use-asset-embed.cjs.map +1 -1
  144. package/dist/assets/use-asset-embed.d.ts +11 -1
  145. package/dist/assets/use-asset-embed.js +10 -3
  146. package/dist/assets/use-asset-embed.js.map +1 -1
  147. package/dist/auth/AthenaAuthContext.cjs +3 -3
  148. package/dist/auth/AthenaAuthContext.cjs.map +1 -1
  149. package/dist/auth/AthenaAuthProvider.cjs +8 -8
  150. package/dist/auth/AthenaAuthProvider.cjs.map +1 -1
  151. package/dist/auth/AthenaCredentialSourceContext.cjs +5 -5
  152. package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
  153. package/dist/auth/AthenaSSOProvider.cjs +14 -14
  154. package/dist/auth/AthenaSSOProvider.cjs.map +1 -1
  155. package/dist/auth/credential-source.cjs +26 -13
  156. package/dist/auth/credential-source.cjs.map +1 -1
  157. package/dist/auth/credential-source.d.ts +8 -0
  158. package/dist/auth/credential-source.js +26 -13
  159. package/dist/auth/credential-source.js.map +1 -1
  160. package/dist/catalog/agent-model-options.cjs +25 -17
  161. package/dist/catalog/agent-model-options.cjs.map +1 -1
  162. package/dist/catalog/agent-model-options.d.ts +38 -5
  163. package/dist/catalog/agent-model-options.js +25 -17
  164. package/dist/catalog/agent-model-options.js.map +1 -1
  165. package/dist/catalog/channel-refusal.cjs +36 -0
  166. package/dist/catalog/channel-refusal.cjs.map +1 -0
  167. package/dist/catalog/channel-refusal.d.ts +29 -0
  168. package/dist/catalog/channel-refusal.js +36 -0
  169. package/dist/catalog/channel-refusal.js.map +1 -0
  170. package/dist/catalog/chat-pickers.cjs +60 -24
  171. package/dist/catalog/chat-pickers.cjs.map +1 -1
  172. package/dist/catalog/chat-pickers.d.ts +12 -2
  173. package/dist/catalog/chat-pickers.js +56 -20
  174. package/dist/catalog/chat-pickers.js.map +1 -1
  175. package/dist/catalog/runtime-catalog.cjs +89 -23
  176. package/dist/catalog/runtime-catalog.cjs.map +1 -1
  177. package/dist/catalog/runtime-catalog.d.ts +8 -2
  178. package/dist/catalog/runtime-catalog.js +83 -17
  179. package/dist/catalog/runtime-catalog.js.map +1 -1
  180. package/dist/catalog/use-athena-chat-mode.cjs +12 -12
  181. package/dist/catalog/use-athena-chat-mode.cjs.map +1 -1
  182. package/dist/chat/AthenaChat.cjs +155 -67
  183. package/dist/chat/AthenaChat.cjs.map +1 -1
  184. package/dist/chat/AthenaChat.d.ts +42 -2
  185. package/dist/chat/AthenaChat.js +106 -18
  186. package/dist/chat/AthenaChat.js.map +1 -1
  187. package/dist/chat/AthenaChatErrorBoundary.cjs +3 -3
  188. package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -1
  189. package/dist/chat/DrivingOnChip.cjs +23 -0
  190. package/dist/chat/DrivingOnChip.cjs.map +1 -0
  191. package/dist/chat/DrivingOnChip.d.ts +17 -0
  192. package/dist/chat/DrivingOnChip.js +23 -0
  193. package/dist/chat/DrivingOnChip.js.map +1 -0
  194. package/dist/chat/StatewireApprovalCard.cjs +125 -31
  195. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  196. package/dist/chat/StatewireApprovalCard.d.ts +73 -1
  197. package/dist/chat/StatewireApprovalCard.js +115 -21
  198. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  199. package/dist/chat/StatewireClientToolBridge.cjs +2 -2
  200. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
  201. package/dist/chat/StatewireQueuedMessages.cjs +25 -63
  202. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  203. package/dist/chat/StatewireQueuedMessages.d.ts +11 -13
  204. package/dist/chat/StatewireQueuedMessages.js +16 -54
  205. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  206. package/dist/chat/WaitingOnYouBanner.cjs +3 -3
  207. package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
  208. package/dist/chat/athena-chat-welcome.cjs +2 -2
  209. package/dist/chat/athena-chat-welcome.cjs.map +1 -1
  210. package/dist/chat/athena-citation-links.cjs +5 -5
  211. package/dist/chat/athena-citation-links.cjs.map +1 -1
  212. package/dist/chat/athena-composer-controls.cjs +26 -16
  213. package/dist/chat/athena-composer-controls.cjs.map +1 -1
  214. package/dist/chat/athena-composer-controls.d.ts +6 -0
  215. package/dist/chat/athena-composer-controls.js +26 -16
  216. package/dist/chat/athena-composer-controls.js.map +1 -1
  217. package/dist/chat/athena-turn-end-status.cjs +42 -0
  218. package/dist/chat/athena-turn-end-status.cjs.map +1 -0
  219. package/dist/chat/athena-turn-end-status.d.ts +24 -0
  220. package/dist/chat/athena-turn-end-status.js +42 -0
  221. package/dist/chat/athena-turn-end-status.js.map +1 -0
  222. package/dist/chat/browser-decision-check.cjs +131 -0
  223. package/dist/chat/browser-decision-check.cjs.map +1 -0
  224. package/dist/chat/browser-decision-check.d.ts +61 -0
  225. package/dist/chat/browser-decision-check.js +131 -0
  226. package/dist/chat/browser-decision-check.js.map +1 -0
  227. package/dist/chat/chat-outbox-rows.cjs +3 -3
  228. package/dist/chat/chat-outbox-rows.cjs.map +1 -1
  229. package/dist/chat/chat-voice-controls.cjs +93 -28
  230. package/dist/chat/chat-voice-controls.cjs.map +1 -1
  231. package/dist/chat/chat-voice-controls.d.ts +36 -2
  232. package/dist/chat/chat-voice-controls.js +89 -24
  233. package/dist/chat/chat-voice-controls.js.map +1 -1
  234. package/dist/chat/composer-keyboard-hint.cjs +5 -5
  235. package/dist/chat/composer-keyboard-hint.cjs.map +1 -1
  236. package/dist/chat/device-operation.cjs +29 -0
  237. package/dist/chat/device-operation.cjs.map +1 -0
  238. package/dist/chat/device-operation.d.ts +34 -0
  239. package/dist/chat/device-operation.js +29 -0
  240. package/dist/chat/device-operation.js.map +1 -0
  241. package/dist/chat/super-grouping/CollapsibleGroup.cjs +14 -14
  242. package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
  243. package/dist/chat/super-grouping/GroupedMessageParts.cjs +4 -4
  244. package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -1
  245. package/dist/chat/super-grouping/SuperGroupingCard.cjs +60 -38
  246. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  247. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +24 -4
  248. package/dist/chat/super-grouping/SuperGroupingCard.js +37 -15
  249. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  250. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +32 -32
  251. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  252. package/dist/chat/super-grouping/SuperGroupingTranscript.js +3 -3
  253. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  254. package/dist/chat/super-grouping/ToolTimeline.cjs +97 -37
  255. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
  256. package/dist/chat/super-grouping/ToolTimeline.d.ts +14 -2
  257. package/dist/chat/super-grouping/ToolTimeline.js +94 -34
  258. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
  259. package/dist/chat/super-grouping/activity-timeline.cjs +47 -12
  260. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  261. package/dist/chat/super-grouping/activity-timeline.d.ts +21 -0
  262. package/dist/chat/super-grouping/activity-timeline.js +47 -12
  263. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  264. package/dist/chat/super-grouping/grouping-function.cjs +4 -0
  265. package/dist/chat/super-grouping/grouping-function.cjs.map +1 -1
  266. package/dist/chat/super-grouping/grouping-function.d.ts +7 -0
  267. package/dist/chat/super-grouping/grouping-function.js +5 -1
  268. package/dist/chat/super-grouping/grouping-function.js.map +1 -1
  269. package/dist/chat/super-grouping/index.cjs +6 -0
  270. package/dist/chat/super-grouping/index.cjs.map +1 -1
  271. package/dist/chat/super-grouping/index.d.ts +6 -2
  272. package/dist/chat/super-grouping/index.js +7 -1
  273. package/dist/chat/super-grouping/index.js.map +1 -1
  274. package/dist/chat/super-grouping/timeline-step.cjs +61 -2
  275. package/dist/chat/super-grouping/timeline-step.cjs.map +1 -1
  276. package/dist/chat/super-grouping/timeline-step.d.ts +13 -1
  277. package/dist/chat/super-grouping/timeline-step.js +61 -2
  278. package/dist/chat/super-grouping/timeline-step.js.map +1 -1
  279. package/dist/chat/super-grouping/tool-part-placement.cjs +17 -0
  280. package/dist/chat/super-grouping/tool-part-placement.cjs.map +1 -0
  281. package/dist/chat/super-grouping/tool-part-placement.d.ts +22 -0
  282. package/dist/chat/super-grouping/tool-part-placement.js +17 -0
  283. package/dist/chat/super-grouping/tool-part-placement.js.map +1 -0
  284. package/dist/chat/thread-scroll-to-bottom.cjs +2 -2
  285. package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -1
  286. package/dist/chat/thread-scroll-to-bottom.d.ts +10 -7
  287. package/dist/chat/thread-scroll-to-bottom.js +2 -2
  288. package/dist/chat/thread-scroll-to-bottom.js.map +1 -1
  289. package/dist/chat/tooltip-icon-button.cjs +2 -2
  290. package/dist/chat/tooltip-icon-button.cjs.map +1 -1
  291. package/dist/chat/use-athena-voice-live.cjs +11 -0
  292. package/dist/chat/use-athena-voice-live.cjs.map +1 -0
  293. package/dist/chat/use-athena-voice-live.d.ts +11 -0
  294. package/dist/chat/use-athena-voice-live.js +11 -0
  295. package/dist/chat/use-athena-voice-live.js.map +1 -0
  296. package/dist/chat/use-statewire-approval-request.cjs +56 -24
  297. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  298. package/dist/chat/use-statewire-approval-request.d.ts +33 -4
  299. package/dist/chat/use-statewire-approval-request.js +41 -9
  300. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  301. package/dist/chat-ui/auth/sign-in-card.cjs +2 -2
  302. package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -1
  303. package/dist/chat-ui/composer/tiptap-composer.cjs +138 -107
  304. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  305. package/dist/chat-ui/composer/tiptap-composer.d.ts +20 -4
  306. package/dist/chat-ui/composer/tiptap-composer.js +85 -54
  307. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  308. package/dist/chat-ui/header/conversation-history-panel.cjs +49 -23
  309. package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -1
  310. package/dist/chat-ui/header/conversation-history-panel.d.ts +12 -1
  311. package/dist/chat-ui/header/conversation-history-panel.js +38 -12
  312. package/dist/chat-ui/header/conversation-history-panel.js.map +1 -1
  313. package/dist/chat-ui/index.cjs +18 -0
  314. package/dist/chat-ui/index.cjs.map +1 -1
  315. package/dist/chat-ui/index.d.ts +7 -1
  316. package/dist/chat-ui/index.js +18 -0
  317. package/dist/chat-ui/index.js.map +1 -1
  318. package/dist/chat-ui/mentions/mention-chip.cjs +147 -38
  319. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  320. package/dist/chat-ui/mentions/mention-chip.d.ts +17 -1
  321. package/dist/chat-ui/mentions/mention-chip.js +146 -37
  322. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  323. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +10 -9
  324. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
  325. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +3 -2
  326. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
  327. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +2 -2
  328. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
  329. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +29 -6
  330. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
  331. package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +7 -1
  332. package/dist/chat-ui/mentions/suggestions/components/menu-list.js +25 -2
  333. package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
  334. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +2 -2
  335. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -1
  336. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +2 -2
  337. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -1
  338. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +3 -3
  339. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  340. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +56 -2
  341. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -1
  342. package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +12 -0
  343. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +56 -2
  344. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -1
  345. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +24 -3
  346. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  347. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +7 -0
  348. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +24 -3
  349. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  350. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +35 -13
  351. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
  352. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +15 -1
  353. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +28 -6
  354. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
  355. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +9 -6
  356. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -1
  357. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +3 -0
  358. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +5 -2
  359. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -1
  360. package/dist/chat-ui/mentions/use-account-workspace-id.cjs +45 -10
  361. package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
  362. package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +24 -1
  363. package/dist/chat-ui/mentions/use-account-workspace-id.js +46 -11
  364. package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
  365. package/dist/chat-ui/mentions/use-member-avatar.cjs +4 -4
  366. package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -1
  367. package/dist/chat-ui/mentions/use-mention-asset.cjs +140 -0
  368. package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -0
  369. package/dist/chat-ui/mentions/use-mention-asset.d.ts +16 -0
  370. package/dist/chat-ui/mentions/use-mention-asset.js +140 -0
  371. package/dist/chat-ui/mentions/use-mention-asset.js.map +1 -0
  372. package/dist/chat-ui/messages/answer-label.cjs +42 -0
  373. package/dist/chat-ui/messages/answer-label.cjs.map +1 -0
  374. package/dist/chat-ui/messages/answer-label.d.ts +33 -0
  375. package/dist/chat-ui/messages/answer-label.js +42 -0
  376. package/dist/chat-ui/messages/answer-label.js.map +1 -0
  377. package/dist/chat-ui/messages/arrival-animation.cjs +13 -0
  378. package/dist/chat-ui/messages/arrival-animation.cjs.map +1 -0
  379. package/dist/chat-ui/messages/arrival-animation.d.ts +14 -0
  380. package/dist/chat-ui/messages/arrival-animation.js +13 -0
  381. package/dist/chat-ui/messages/arrival-animation.js.map +1 -0
  382. package/dist/chat-ui/messages/continue-pill.cjs +5 -5
  383. package/dist/chat-ui/messages/continue-pill.cjs.map +1 -1
  384. package/dist/chat-ui/messages/handoff-arrival-divider.cjs +44 -0
  385. package/dist/chat-ui/messages/handoff-arrival-divider.cjs.map +1 -0
  386. package/dist/chat-ui/messages/handoff-arrival-divider.d.ts +17 -0
  387. package/dist/chat-ui/messages/handoff-arrival-divider.js +44 -0
  388. package/dist/chat-ui/messages/handoff-arrival-divider.js.map +1 -0
  389. package/dist/chat-ui/messages/message-actions-config.cjs +3 -3
  390. package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -1
  391. package/dist/chat-ui/messages/message-components.cjs +8 -4
  392. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  393. package/dist/chat-ui/messages/message-components.js +5 -1
  394. package/dist/chat-ui/messages/message-components.js.map +1 -1
  395. package/dist/chat-ui/messages/message-images.cjs +66 -0
  396. package/dist/chat-ui/messages/message-images.cjs.map +1 -0
  397. package/dist/chat-ui/messages/message-images.d.ts +16 -0
  398. package/dist/chat-ui/messages/message-images.js +66 -0
  399. package/dist/chat-ui/messages/message-images.js.map +1 -0
  400. package/dist/chat-ui/messages/user-edit-composer.cjs +2 -2
  401. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  402. package/dist/chat-ui/messages/wake-marker.cjs +3 -3
  403. package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
  404. package/dist/chat-ui/rich-text/chat-link.cjs +7 -6
  405. package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
  406. package/dist/chat-ui/rich-text/chat-link.d.ts +2 -3
  407. package/dist/chat-ui/rich-text/chat-link.js +6 -5
  408. package/dist/chat-ui/rich-text/chat-link.js.map +1 -1
  409. package/dist/chat-ui/rich-text/chat-message-body.cjs +8 -8
  410. package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
  411. package/dist/chat-ui/rich-text/chat-node-views.cjs +7 -6
  412. package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
  413. package/dist/chat-ui/rich-text/chat-node-views.js +1 -0
  414. package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -1
  415. package/dist/chat-ui/rich-text/dom-output-spec.cjs +2 -2
  416. package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -1
  417. package/dist/chat-ui/statewire.cjs +3 -0
  418. package/dist/chat-ui/statewire.cjs.map +1 -1
  419. package/dist/chat-ui/statewire.d.ts +2 -1
  420. package/dist/chat-ui/statewire.js +3 -0
  421. package/dist/chat-ui/statewire.js.map +1 -1
  422. package/dist/chat-ui/thread/chat-thread-shell.cjs +43 -14
  423. package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
  424. package/dist/chat-ui/thread/chat-thread-shell.d.ts +16 -2
  425. package/dist/chat-ui/thread/chat-thread-shell.js +35 -6
  426. package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
  427. package/dist/chat-ui/thread/composer-send-or-stop.cjs +30 -20
  428. package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
  429. package/dist/chat-ui/thread/composer-send-or-stop.d.ts +8 -0
  430. package/dist/chat-ui/thread/composer-send-or-stop.js +29 -19
  431. package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
  432. package/dist/chat-ui/thread/statewire-history-edge.cjs +20 -21
  433. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  434. package/dist/chat-ui/thread/statewire-history-edge.js +3 -4
  435. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  436. package/dist/chat-ui/thread/thread-loading-overlay.cjs +5 -5
  437. package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -1
  438. package/dist/collab/client.cjs +40 -3
  439. package/dist/collab/client.cjs.map +1 -1
  440. package/dist/collab/client.d.ts +25 -0
  441. package/dist/collab/client.js +40 -3
  442. package/dist/collab/client.js.map +1 -1
  443. package/dist/collab/document-status.cjs +150 -0
  444. package/dist/collab/document-status.cjs.map +1 -0
  445. package/dist/collab/document-status.d.ts +68 -0
  446. package/dist/collab/document-status.js +150 -0
  447. package/dist/collab/document-status.js.map +1 -0
  448. package/dist/collab/index.cjs +7 -0
  449. package/dist/collab/index.cjs.map +1 -1
  450. package/dist/collab/index.d.ts +6 -1
  451. package/dist/collab/index.js +7 -0
  452. package/dist/collab/index.js.map +1 -1
  453. package/dist/collab/presence-react.cjs +11 -11
  454. package/dist/collab/presence-react.cjs.map +1 -1
  455. package/dist/collab/react.cjs +6 -6
  456. package/dist/collab/react.cjs.map +1 -1
  457. package/dist/composer/AttachmentContext.cjs +24 -11
  458. package/dist/composer/AttachmentContext.cjs.map +1 -1
  459. package/dist/composer/AttachmentContext.js +18 -5
  460. package/dist/composer/AttachmentContext.js.map +1 -1
  461. package/dist/composer/ComposerAttachmentPreview.cjs +78 -23
  462. package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -1
  463. package/dist/composer/ComposerAttachmentPreview.d.ts +5 -3
  464. package/dist/composer/ComposerAttachmentPreview.js +79 -24
  465. package/dist/composer/ComposerAttachmentPreview.js.map +1 -1
  466. package/dist/composer/ComposerDropZone.cjs +7 -7
  467. package/dist/composer/ComposerDropZone.cjs.map +1 -1
  468. package/dist/composer/FileUploadButton.cjs +37 -22
  469. package/dist/composer/FileUploadButton.cjs.map +1 -1
  470. package/dist/composer/FileUploadButton.d.ts +6 -0
  471. package/dist/composer/FileUploadButton.js +34 -19
  472. package/dist/composer/FileUploadButton.js.map +1 -1
  473. package/dist/composer/QuoteContext.cjs +8 -8
  474. package/dist/composer/QuoteContext.cjs.map +1 -1
  475. package/dist/composer/composer-handoff.cjs +4 -4
  476. package/dist/composer/composer-handoff.cjs.map +1 -1
  477. package/dist/composer/useAppendToComposer.cjs +4 -4
  478. package/dist/composer/useAppendToComposer.cjs.map +1 -1
  479. package/dist/composer/useAttachFiles.cjs +23 -6
  480. package/dist/composer/useAttachFiles.cjs.map +1 -1
  481. package/dist/composer/useAttachFiles.d.ts +15 -7
  482. package/dist/composer/useAttachFiles.js +22 -5
  483. package/dist/composer/useAttachFiles.js.map +1 -1
  484. package/dist/composer/useComposerAttachment.cjs +4 -4
  485. package/dist/composer/useComposerAttachment.cjs.map +1 -1
  486. package/dist/composer/useFileUpload.cjs +21 -16
  487. package/dist/composer/useFileUpload.cjs.map +1 -1
  488. package/dist/composer/useFileUpload.d.ts +12 -0
  489. package/dist/composer/useFileUpload.js +12 -7
  490. package/dist/composer/useFileUpload.js.map +1 -1
  491. package/dist/composer/useReadComposerDraft.cjs +2 -2
  492. package/dist/composer/useReadComposerDraft.cjs.map +1 -1
  493. package/dist/composer/useSendMessage.cjs +4 -4
  494. package/dist/composer/useSendMessage.cjs.map +1 -1
  495. package/dist/diagnostics/useAthenaDiagnostics.cjs +4 -4
  496. package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -1
  497. package/dist/dictation/audio-level-history.cjs +3 -3
  498. package/dist/dictation/audio-level-history.cjs.map +1 -1
  499. package/dist/dictation/dictation-controls.cjs +24 -20
  500. package/dist/dictation/dictation-controls.cjs.map +1 -1
  501. package/dist/dictation/dictation-controls.d.ts +6 -1
  502. package/dist/dictation/dictation-controls.js +24 -20
  503. package/dist/dictation/dictation-controls.js.map +1 -1
  504. package/dist/dictation/use-athena-dictation-engine.cjs +3 -3
  505. package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -1
  506. package/dist/dictation/use-dictation.cjs +22 -22
  507. package/dist/dictation/use-dictation.cjs.map +1 -1
  508. package/dist/index.cjs +26 -2
  509. package/dist/index.cjs.map +1 -1
  510. package/dist/index.d.ts +15 -3
  511. package/dist/index.js +26 -2
  512. package/dist/index.js.map +1 -1
  513. package/dist/keryx-http/src/receive-only-socket.cjs +40 -0
  514. package/dist/keryx-http/src/receive-only-socket.cjs.map +1 -0
  515. package/dist/keryx-http/src/receive-only-socket.d.ts +27 -0
  516. package/dist/keryx-http/src/receive-only-socket.js +40 -0
  517. package/dist/keryx-http/src/receive-only-socket.js.map +1 -0
  518. package/dist/keryx-http/src/update-attributions.cjs +111 -0
  519. package/dist/keryx-http/src/update-attributions.cjs.map +1 -0
  520. package/dist/keryx-http/src/update-attributions.d.ts +75 -0
  521. package/dist/keryx-http/src/update-attributions.js +111 -0
  522. package/dist/keryx-http/src/update-attributions.js.map +1 -0
  523. package/dist/lib/owner-document.cjs +6 -6
  524. package/dist/lib/owner-document.cjs.map +1 -1
  525. package/dist/lib/use-athena-rest-query.cjs +4 -4
  526. package/dist/lib/use-athena-rest-query.cjs.map +1 -1
  527. package/dist/lib/use-document-active.cjs +4 -4
  528. package/dist/lib/use-document-active.cjs.map +1 -1
  529. package/dist/lib/use-prefers-reduced-motion.cjs +2 -2
  530. package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -1
  531. package/dist/offline/offline-history.cjs +7 -7
  532. package/dist/offline/offline-history.cjs.map +1 -1
  533. package/dist/provider/AthenaContext.cjs +3 -3
  534. package/dist/provider/AthenaContext.cjs.map +1 -1
  535. package/dist/provider/AthenaProvider.cjs +116 -79
  536. package/dist/provider/AthenaProvider.cjs.map +1 -1
  537. package/dist/provider/AthenaProvider.js +40 -3
  538. package/dist/provider/AthenaProvider.js.map +1 -1
  539. package/dist/provider/PostHogProvider.cjs +2 -2
  540. package/dist/provider/PostHogProvider.cjs.map +1 -1
  541. package/dist/provider/agent-selection-context.cjs +2 -2
  542. package/dist/provider/agent-selection-context.cjs.map +1 -1
  543. package/dist/provider/chat-mode-context.cjs +2 -2
  544. package/dist/provider/chat-mode-context.cjs.map +1 -1
  545. package/dist/provider/session-persistence-context.cjs +10 -0
  546. package/dist/provider/session-persistence-context.cjs.map +1 -0
  547. package/dist/provider/session-persistence-context.d.ts +15 -0
  548. package/dist/provider/session-persistence-context.js +10 -0
  549. package/dist/provider/session-persistence-context.js.map +1 -0
  550. package/dist/provider/statewire-history-context.cjs +4 -4
  551. package/dist/provider/statewire-history-context.cjs.map +1 -1
  552. package/dist/provider/statewire-lifecycle-context.cjs +3 -3
  553. package/dist/provider/statewire-lifecycle-context.cjs.map +1 -1
  554. package/dist/provider/statewire-window-context.cjs +3 -3
  555. package/dist/provider/statewire-window-context.cjs.map +1 -1
  556. package/dist/provider/theme-style-context.cjs +3 -3
  557. package/dist/provider/theme-style-context.cjs.map +1 -1
  558. package/dist/react/package.json.cjs +1 -1
  559. package/dist/react/package.json.js +1 -1
  560. package/dist/references/src/tool-option-schemas.d.ts +0 -34
  561. package/dist/runtime/StatewireThreadConfigLaneSync.cjs +10 -10
  562. package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
  563. package/dist/runtime/auth-refusal-restart.cjs +7 -7
  564. package/dist/runtime/auth-refusal-restart.cjs.map +1 -1
  565. package/dist/runtime/auth.cjs +13 -13
  566. package/dist/runtime/auth.cjs.map +1 -1
  567. package/dist/runtime/statewire-lifecycle.cjs +1 -0
  568. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  569. package/dist/runtime/statewire-lifecycle.d.ts +3 -1
  570. package/dist/runtime/statewire-lifecycle.js +2 -1
  571. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  572. package/dist/runtime/statewire-server-lane-context.cjs +2 -2
  573. package/dist/runtime/statewire-server-lane-context.cjs.map +1 -1
  574. package/dist/runtime/statewire-session-lane.cjs +4 -4
  575. package/dist/runtime/statewire-session-lane.cjs.map +1 -1
  576. package/dist/runtime/useAthenaStatewireRuntime.cjs +10 -8
  577. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  578. package/dist/runtime/useAthenaStatewireRuntime.d.ts +2 -0
  579. package/dist/runtime/useAthenaStatewireRuntime.js +2 -0
  580. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  581. package/dist/styles.css +1 -1
  582. package/dist/threads/Inbox.cjs +8 -8
  583. package/dist/threads/Inbox.cjs.map +1 -1
  584. package/dist/threads/SessionList.cjs +9 -9
  585. package/dist/threads/SessionList.cjs.map +1 -1
  586. package/dist/threads/SessionsPage.cjs +11 -11
  587. package/dist/threads/SessionsPage.cjs.map +1 -1
  588. package/dist/threads/index-triggered-refresh.cjs +10 -10
  589. package/dist/threads/index-triggered-refresh.cjs.map +1 -1
  590. package/dist/threads/mark-viewed-thread-read.cjs +12 -12
  591. package/dist/threads/mark-viewed-thread-read.cjs.map +1 -1
  592. package/dist/threads/offline-session-list.cjs +3 -3
  593. package/dist/threads/offline-session-list.cjs.map +1 -1
  594. package/dist/threads/session-list-tab-share.cjs +5 -5
  595. package/dist/threads/session-list-tab-share.cjs.map +1 -1
  596. package/dist/threads/statewire-thread-list.cjs +55 -51
  597. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  598. package/dist/threads/statewire-thread-list.js +6 -2
  599. package/dist/threads/statewire-thread-list.js.map +1 -1
  600. package/dist/threads/thread-id-context.cjs +5 -5
  601. package/dist/threads/thread-id-context.cjs.map +1 -1
  602. package/dist/threads/use-athena-session-attention.cjs +2 -2
  603. package/dist/threads/use-athena-session-attention.cjs.map +1 -1
  604. package/dist/threads/use-athena-sessions.cjs +10 -10
  605. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  606. package/dist/threads/use-athena-thread-model.cjs +3 -3
  607. package/dist/threads/use-athena-thread-model.cjs.map +1 -1
  608. package/dist/threads/use-rest-conversation-history.cjs +3 -3
  609. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  610. package/dist/threads/use-statewire-conversation-history.cjs +8 -8
  611. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  612. package/dist/threads/use-thread-archive.cjs +9 -9
  613. package/dist/threads/use-thread-archive.cjs.map +1 -1
  614. package/dist/threads/use-thread-favorite.cjs +2 -2
  615. package/dist/threads/use-thread-favorite.cjs.map +1 -1
  616. package/dist/threads/use-thread-field-override.cjs +20 -20
  617. package/dist/threads/use-thread-field-override.cjs.map +1 -1
  618. package/dist/threads/use-thread-read-state.cjs +4 -4
  619. package/dist/threads/use-thread-read-state.cjs.map +1 -1
  620. package/dist/threads/use-thread-rename.cjs +2 -2
  621. package/dist/threads/use-thread-rename.cjs.map +1 -1
  622. package/dist/threads/useAthenaThreadManager.cjs +2 -2
  623. package/dist/threads/useAthenaThreadManager.cjs.map +1 -1
  624. package/dist/tools/NestedPtcMessages.cjs +6 -6
  625. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  626. package/dist/tools/append-document-tool-ui.cjs +7 -7
  627. package/dist/tools/append-document-tool-ui.cjs.map +1 -1
  628. package/dist/tools/file-tool-uis.cjs +2 -2
  629. package/dist/tools/file-tool-uis.cjs.map +1 -1
  630. package/dist/tools/misc-tool-uis.cjs +2 -2
  631. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  632. package/dist/tools/primitives.cjs +6 -6
  633. package/dist/tools/primitives.cjs.map +1 -1
  634. package/dist/tools/read-asset-tool-ui.cjs +6 -6
  635. package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
  636. package/dist/tools/subagent-task-tool-ui.cjs +21 -21
  637. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
  638. package/dist/tools/test-recording-tool-uis.cjs +16 -16
  639. package/dist/tools/test-recording-tool-uis.cjs.map +1 -1
  640. package/dist/tools/todo-plan-store.cjs +4 -4
  641. package/dist/tools/todo-plan-store.cjs.map +1 -1
  642. package/dist/tools/tool-appearance.cjs +3 -3
  643. package/dist/tools/tool-appearance.cjs.map +1 -1
  644. package/dist/tools/tool-fallback.cjs +14 -14
  645. package/dist/tools/tool-fallback.cjs.map +1 -1
  646. package/dist/tools/tool-summary.cjs +0 -2
  647. package/dist/tools/tool-summary.cjs.map +1 -1
  648. package/dist/tools/tool-summary.js +0 -2
  649. package/dist/tools/tool-summary.js.map +1 -1
  650. package/dist/tools/tool-uis.cjs +74 -74
  651. package/dist/tools/tool-uis.cjs.map +1 -1
  652. package/dist/tools/use-elapsed-seconds.cjs +3 -3
  653. package/dist/tools/use-elapsed-seconds.cjs.map +1 -1
  654. package/dist/tools/write-todos-tool-ui.cjs +9 -9
  655. package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
  656. package/dist/ui/image-viewer.cjs +382 -0
  657. package/dist/ui/image-viewer.cjs.map +1 -0
  658. package/dist/ui/image-viewer.d.ts +50 -0
  659. package/dist/ui/image-viewer.js +382 -0
  660. package/dist/ui/image-viewer.js.map +1 -0
  661. package/dist/voice/chat.cjs +6 -0
  662. package/dist/voice/chat.cjs.map +1 -1
  663. package/dist/voice/chat.d.ts +1 -1
  664. package/dist/voice/chat.js +8 -2
  665. package/dist/voice/livekit-join.cjs +52 -101
  666. package/dist/voice/livekit-join.cjs.map +1 -1
  667. package/dist/voice/livekit-join.d.ts +1 -6
  668. package/dist/voice/livekit-join.js +52 -101
  669. package/dist/voice/livekit-join.js.map +1 -1
  670. package/dist/voice/livekit.cjs.map +1 -1
  671. package/dist/voice/livekit.d.ts +11 -1
  672. package/dist/voice/livekit.js.map +1 -1
  673. package/dist/voice/use-athena-voice-session.cjs +34 -34
  674. package/dist/voice/use-athena-voice-session.cjs.map +1 -1
  675. package/dist/workbench/ComputerLiveDesktop.cjs +13 -13
  676. package/dist/workbench/ComputerLiveDesktop.cjs.map +1 -1
  677. package/dist/workbench/SessionWorkbench.cjs +22 -22
  678. package/dist/workbench/SessionWorkbench.cjs.map +1 -1
  679. package/dist/workbench/session-workbench-context.cjs +3 -3
  680. package/dist/workbench/session-workbench-context.cjs.map +1 -1
  681. package/dist/workbench/session-workbench-panes.cjs +8 -8
  682. package/dist/workbench/session-workbench-panes.cjs.map +1 -1
  683. package/dist/workbench/workbench-layout-context.cjs +3 -3
  684. package/dist/workbench/workbench-layout-context.cjs.map +1 -1
  685. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"WaitingOnYouBanner.cjs","sources":["../../src/chat/WaitingOnYouBanner.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { hasStatewireThreadExtras, readInterruptMessage } from '@athenaintel/agent-runtime';\nimport { HandIcon } from 'lucide-react';\nimport { type FC, useCallback, useRef } from 'react';\nimport { THREAD_VIEWPORT_ATTR } from '../chat-ui/thread/statewire-history-edge';\nimport { cn } from '../lib/utils';\nimport {\n type AthenaSessionAttention,\n useAthenaSessionAttention,\n} from '../threads/use-athena-session-attention';\nimport { useStatewireApprovalRequest } from './use-statewire-approval-request';\n\n/** The CSS class `StatewireApprovalCard` puts on its section; the banner scrolls to it. */\nconst APPROVAL_CARD_SELECTOR = '.aui-approval-card';\n\nexport interface WaitingOnYouBannerProps {\n /** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */\n className?: string;\n /** Copy shown when a parked interrupt carries no message. */\n fallbackMessage?: string;\n}\n\n/**\n * Persistent top-of-thread banner for a session that is waiting on the\n * viewer: shown while the active thread's attention is `needs_you` (from the\n * thread list) or while the approval hook reports a pending request. The text\n * is the server's next action, else a summary of the pending request; a\n * click scrolls to the approval card (or to the composer when there is no\n * card). It never duplicates the card's decision buttons — the card stays the\n * one place a request is answered. Renders nothing otherwise.\n */\nexport const WaitingOnYouBanner: FC<WaitingOnYouBannerProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n const attention = useAthenaSessionAttention();\n // `useStatewireApprovalRequest` needs a statewire aui scope (it throws\n // outside one), so the approval leg mounts only once the thread extras are.\n if (!hasStatewireThreadExtras(extras)) {\n return <WaitingOnYouBannerView attention={attention} approvalSummary={null} {...props} />;\n }\n return <WaitingOnYouBannerWithApproval attention={attention} {...props} />;\n};\n\nconst WaitingOnYouBannerWithApproval: FC<\n WaitingOnYouBannerProps & { attention: AthenaSessionAttention | null }\n> = ({ attention, fallbackMessage, ...props }) => {\n const { request, hitl, liveHitl } = useStatewireApprovalRequest();\n const pending = request !== undefined || liveHitl !== null;\n const payload = hitl ?? liveHitl;\n const toolName = payload?.context?.tool_name ?? payload?.context?.tool_id;\n const pendingCount = payload?.context?.pending_action_count ?? 1;\n const approvalSummary = !pending\n ? null\n : payload && pendingCount === 1 && toolName\n ? `${toolName} requires approval before it runs.`\n : readInterruptMessage(request ? request.payload : liveHitl, fallbackMessage);\n return <WaitingOnYouBannerView attention={attention} approvalSummary={approvalSummary} {...props} />;\n};\n\nexport interface WaitingOnYouBannerViewProps {\n attention: Pick<AthenaSessionAttention, 'attention' | 'nextAction'> | null;\n /** Summary of the pending approval, or `null` when nothing is parked. */\n approvalSummary: string | null;\n className?: string;\n}\n\n/**\n * The banner itself, over already-resolved inputs — the pure presenter\n * `WaitingOnYouBanner` binds to the thread list and the approval hook.\n */\nexport const WaitingOnYouBannerView: FC<WaitingOnYouBannerViewProps> = ({\n attention,\n approvalSummary,\n className,\n}) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const scrollToApproval = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n // The nearest ancestor that holds the thread viewport is the chat panel;\n // the card lives in that viewport's sticky footer.\n let scope: HTMLElement | null = root.parentElement;\n while (scope && scope.querySelector(`[${THREAD_VIEWPORT_ATTR}]`) === null) {\n scope = scope.parentElement;\n }\n const container: ParentNode = scope ?? root.ownerDocument;\n const card = container.querySelector<HTMLElement>(APPROVAL_CARD_SELECTOR);\n if (card) {\n card.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n return;\n }\n const viewport = container.querySelector<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`);\n viewport?.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });\n }, []);\n\n const needsYou = attention?.attention === 'needs_you';\n const pending = approvalSummary !== null;\n if (!needsYou && !pending) return null;\n const text =\n attention?.nextAction?.trim() || approvalSummary || 'This session is waiting on you.';\n\n return (\n <div ref={rootRef} className={cn('aui-waiting-on-you', className)}>\n <div\n role=\"status\"\n data-testid=\"waiting-on-you-banner\"\n data-pending-approval={pending || undefined}\n className=\"mx-auto w-full max-w-(--thread-max-width) rounded-xl border border-amber-300 bg-amber-50 text-amber-900\"\n >\n <button\n type=\"button\"\n onClick={scrollToApproval}\n className=\"flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-amber-100/70\"\n >\n <HandIcon className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span className=\"shrink-0 font-semibold\">Waiting on you</span>\n <span className=\"min-w-0 flex-1 truncate text-amber-800\">{text}</span>\n {pending ? (\n <span className=\"shrink-0 font-medium underline-offset-2 hover:underline\">\n Review\n </span>\n ) : null}\n </button>\n </div>\n </div>\n );\n};\n"],"names":["useAuiState","useAthenaSessionAttention","hasStatewireThreadExtras","jsx","useStatewireApprovalRequest","readInterruptMessage","useRef","useCallback","THREAD_VIEWPORT_ATTR","cn","jsxs","HandIcon"],"mappings":";;;;;;;;;;;;AAaA,MAAM,yBAAyB;AAkBxB,MAAM,qBAAkD,CAAC,UAAU;AACxE,QAAM,SAASA,MAAAA,YAAY,CAAC,MAAM,EAAE,OAAO,MAAM;AACjD,QAAM,YAAYC,0BAAAA,0BAAA;AAGlB,MAAI,CAACC,aAAAA,yBAAyB,MAAM,GAAG;AACrC,0CAAQ,wBAAA,EAAuB,WAAsB,iBAAiB,MAAO,GAAG,OAAO;AAAA,EACzF;AACA,SAAOC,2BAAAA,IAAC,gCAAA,EAA+B,WAAuB,GAAG,MAAA,CAAO;AAC1E;AAEA,MAAM,iCAEF,CAAC,EAAE,WAAW,iBAAiB,GAAG,YAAY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AAI,KAAK,SAAS,WAAWM,OAAAA,GAAG,sBAAsB,SAAS,GAC9D,UAAAN,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,yBAAuB,WAAW;AAAA,MAClC,WAAU;AAAA,MAEV,UAAAO,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,WAAU;AAAA,UAEV,UAAA;AAAA,YAAAP,2BAAAA,IAACQ,YAAAA,UAAA,EAAS,WAAU,mBAAkB,eAAY,QAAO;AAAA,YACzDR,2BAAAA,IAAC,QAAA,EAAK,WAAU,0BAAyB,UAAA,kBAAc;AAAA,YACvDA,2BAAAA,IAAC,QAAA,EAAK,WAAU,0CAA0C,UAAA,MAAK;AAAA,YAC9D,UACCA,2BAAAA,IAAC,QAAA,EAAK,WAAU,2DAA0D,oBAE1E,IACE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA,GAEJ;AAEJ;;;"}
1
+ {"version":3,"file":"WaitingOnYouBanner.cjs","sources":["../../src/chat/WaitingOnYouBanner.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { hasStatewireThreadExtras, readInterruptMessage } from '@athenaintel/agent-runtime';\nimport { HandIcon } from 'lucide-react';\nimport { type FC, useCallback, useRef } from 'react';\nimport { THREAD_VIEWPORT_ATTR } from '../chat-ui/thread/statewire-history-edge';\nimport { cn } from '../lib/utils';\nimport {\n type AthenaSessionAttention,\n useAthenaSessionAttention,\n} from '../threads/use-athena-session-attention';\nimport { useStatewireApprovalRequest } from './use-statewire-approval-request';\n\n/** The CSS class `StatewireApprovalCard` puts on its section; the banner scrolls to it. */\nconst APPROVAL_CARD_SELECTOR = '.aui-approval-card';\n\nexport interface WaitingOnYouBannerProps {\n /** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */\n className?: string;\n /** Copy shown when a parked interrupt carries no message. */\n fallbackMessage?: string;\n}\n\n/**\n * Persistent top-of-thread banner for a session that is waiting on the\n * viewer: shown while the active thread's attention is `needs_you` (from the\n * thread list) or while the approval hook reports a pending request. The text\n * is the server's next action, else a summary of the pending request; a\n * click scrolls to the approval card (or to the composer when there is no\n * card). It never duplicates the card's decision buttons — the card stays the\n * one place a request is answered. Renders nothing otherwise.\n */\nexport const WaitingOnYouBanner: FC<WaitingOnYouBannerProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n const attention = useAthenaSessionAttention();\n // `useStatewireApprovalRequest` needs a statewire aui scope (it throws\n // outside one), so the approval leg mounts only once the thread extras are.\n if (!hasStatewireThreadExtras(extras)) {\n return <WaitingOnYouBannerView attention={attention} approvalSummary={null} {...props} />;\n }\n return <WaitingOnYouBannerWithApproval attention={attention} {...props} />;\n};\n\nconst WaitingOnYouBannerWithApproval: FC<\n WaitingOnYouBannerProps & { attention: AthenaSessionAttention | null }\n> = ({ attention, fallbackMessage, ...props }) => {\n const { request, hitl, liveHitl } = useStatewireApprovalRequest();\n const pending = request !== undefined || liveHitl !== null;\n const payload = hitl ?? liveHitl;\n const toolName = payload?.context?.tool_name ?? payload?.context?.tool_id;\n const pendingCount = payload?.context?.pending_action_count ?? 1;\n const approvalSummary = !pending\n ? null\n : payload && pendingCount === 1 && toolName\n ? `${toolName} requires approval before it runs.`\n : readInterruptMessage(request ? request.payload : liveHitl, fallbackMessage);\n return <WaitingOnYouBannerView attention={attention} approvalSummary={approvalSummary} {...props} />;\n};\n\nexport interface WaitingOnYouBannerViewProps {\n attention: Pick<AthenaSessionAttention, 'attention' | 'nextAction'> | null;\n /** Summary of the pending approval, or `null` when nothing is parked. */\n approvalSummary: string | null;\n className?: string;\n}\n\n/**\n * The banner itself, over already-resolved inputs — the pure presenter\n * `WaitingOnYouBanner` binds to the thread list and the approval hook.\n */\nexport const WaitingOnYouBannerView: FC<WaitingOnYouBannerViewProps> = ({\n attention,\n approvalSummary,\n className,\n}) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const scrollToApproval = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n // The nearest ancestor that holds the thread viewport is the chat panel;\n // the card lives in that viewport's sticky footer.\n let scope: HTMLElement | null = root.parentElement;\n while (scope && scope.querySelector(`[${THREAD_VIEWPORT_ATTR}]`) === null) {\n scope = scope.parentElement;\n }\n const container: ParentNode = scope ?? root.ownerDocument;\n const card = container.querySelector<HTMLElement>(APPROVAL_CARD_SELECTOR);\n if (card) {\n card.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n return;\n }\n const viewport = container.querySelector<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`);\n viewport?.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });\n }, []);\n\n const needsYou = attention?.attention === 'needs_you';\n const pending = approvalSummary !== null;\n if (!needsYou && !pending) return null;\n const text =\n attention?.nextAction?.trim() || approvalSummary || 'This session is waiting on you.';\n\n return (\n <div ref={rootRef} className={cn('aui-waiting-on-you', className)}>\n <div\n role=\"status\"\n data-testid=\"waiting-on-you-banner\"\n data-pending-approval={pending || undefined}\n className=\"mx-auto w-full max-w-(--thread-max-width) rounded-xl border border-amber-300 bg-amber-50 text-amber-900\"\n >\n <button\n type=\"button\"\n onClick={scrollToApproval}\n className=\"flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-amber-100/70\"\n >\n <HandIcon className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span className=\"shrink-0 font-semibold\">Waiting on you</span>\n <span className=\"min-w-0 flex-1 truncate text-amber-800\">{text}</span>\n {pending ? (\n <span className=\"shrink-0 font-medium underline-offset-2 hover:underline\">\n Review\n </span>\n ) : null}\n </button>\n </div>\n </div>\n );\n};\n"],"names":["useAuiState","useAthenaSessionAttention","hasStatewireThreadExtras","jsx","useStatewireApprovalRequest","readInterruptMessage","useRef","useCallback","THREAD_VIEWPORT_ATTR","cn","jsxs","HandIcon"],"mappings":";;;;;;;;;;;;AAaA,MAA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ACxE,QAAI,MAAM;AACR,WAAK,eAAe,EAAE,UAAU,UAAU,OAAO,WAAW;AAC5D;AAAA,IACF;AACA,UAAM,WAAW,UAAU,cAA2B,IAAIA,qBAAAA,oBAAoB,GAAG;AACjF,yCAAU,SAAS,EAAE,KAAK,SAAS,cAAc,UAAU;EAC7D,GAAG,CAAA,CAAE;AAEL,QAAM,YAAW,uCAAW,eAAc;AAC1C,QAAM,UAAU,oBAAoB;AACpC,MAAI,CAAC,YAAY,CAAC,QAAS,QAAO;AAClC,QAAM,SACJ,4CAAW,eAAX,mBAAuB,WAAU,mBAAmB;AAEtD,SACEL,+BAAC,SAAI,KAAK,SAAS,WAAWM,OAAAA,GAAG,sBAAsB,SAAS,GAC9D,UAAAN,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,yBAAuB,WAAW;AAAA,MAClC,WAAU;AAAA,MAEV,UAAAO,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,WAAU;AAAA,UAEV,UAAA;AAAA,YAAAP,2BAAAA,IAACQ,YAAAA,UAAA,EAAS,WAAU,mBAAkB,eAAY,QAAO;AAAA,YACzDR,2BAAAA,IAAC,QAAA,EAAK,WAAU,0BAAyB,UAAA,kBAAc;AAAA,YACvDA,2BAAAA,IAAC,QAAA,EAAK,WAAU,0CAA0C,UAAA,MAAK;AAAA,YAC9D,UACCA,2BAAAA,IAAC,QAAA,EAAK,WAAU,2DAA0D,oBAE1E,IACE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA,GAEJ;AAEJ;;;"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const lucideReact = require("lucide-react");
5
- const react = require("react");
5
+ const require$$0 = require("react");
6
6
  const useSendMessage = require("../composer/useSendMessage.cjs");
7
7
  const usePrefersReducedMotion = require("../lib/use-prefers-reduced-motion.cjs");
8
8
  const cnfast = require("cnfast");
@@ -52,7 +52,7 @@ const SuggestionCard = ({ suggestion, index, reducedMotion }) => {
52
52
  const Icon = suggestion.icon;
53
53
  const sendMessage = useSendMessage.useSendMessage();
54
54
  const entrance = welcomeEntrance(welcomeSuggestionDelayMs(index), reducedMotion);
55
- const handleClick = react.useCallback(() => {
55
+ const handleClick = require$$0.useCallback(() => {
56
56
  void sendMessage(suggestion.prompt);
57
57
  }, [sendMessage, suggestion.prompt]);
58
58
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1 +1 @@
1
- {"version":3,"file":"athena-chat-welcome.cjs","sources":["../../src/chat/athena-chat-welcome.tsx"],"sourcesContent":["import { ArrowRightIcon, FileTextIcon, PresentationIcon, SearchIcon } from 'lucide-react';\nimport { useCallback, type CSSProperties, type FC } from 'react';\nimport { useSendMessage } from '../composer/useSendMessage';\nimport { cn } from '../lib/utils';\nimport { usePrefersReducedMotion } from '../lib/use-prefers-reduced-motion';\n\nexport interface WelcomeSuggestion {\n icon: React.ElementType;\n title: string;\n prompt: string;\n}\n\nexport const DEFAULT_WELCOME_SUGGESTIONS: WelcomeSuggestion[] = [\n {\n icon: SearchIcon,\n title: 'Research a topic and draft a report',\n prompt:\n 'Search the web for the latest developments in enterprise AI adoption, then create a document summarizing the key trends, market data, and strategic implications.',\n },\n {\n icon: SearchIcon,\n title: 'Compare recent AI model launches',\n prompt:\n 'Search the web for the latest major AI model launches from OpenAI, Anthropic, and Google, then summarize the release dates, standout capabilities, and practical tradeoffs in a concise comparison table.',\n },\n {\n icon: PresentationIcon,\n title: 'Build a presentation from scratch',\n prompt:\n 'Create a 5-slide investor update presentation covering market opportunity, product traction, key metrics, competitive positioning, and next steps.',\n },\n {\n icon: FileTextIcon,\n title: 'Set up a structured spreadsheet',\n prompt:\n 'Create a project tracking spreadsheet with columns for task name, owner, priority, status, start date, due date, and completion percentage.',\n },\n];\n\n/**\n * The empty state's entrance schedule: the greeting first, the suggestion\n * cards staggered behind it, the composer last. Every value is an inline\n * `animation-delay`, so a host reading the DOM sees the schedule as-is.\n */\nexport const WELCOME_GREETING_SUBTEXT_DELAY_MS = 60;\nexport const WELCOME_SUGGESTION_STAGGER_BASE_MS = 120;\nexport const WELCOME_SUGGESTION_STAGGER_STEP_MS = 70;\nexport const WELCOME_COMPOSER_ENTER_DELAY_MS = 360;\n\nexport function welcomeSuggestionDelayMs(index: number): number {\n return WELCOME_SUGGESTION_STAGGER_BASE_MS + index * WELCOME_SUGGESTION_STAGGER_STEP_MS;\n}\n\n/** Gap between the last card and the composer, which always arrives last. */\nconst WELCOME_COMPOSER_AFTER_LAST_CARD_MS = 30;\n\n/**\n * When the composer enters: 360 ms behind the default four cards, and behind\n * the last card whenever a host supplies more (`welcomeSuggestions` is\n * unbounded), so the composer is always the final element to arrive.\n */\nexport function welcomeComposerDelayMs(suggestionCount: number): number {\n if (suggestionCount <= 0) return WELCOME_COMPOSER_ENTER_DELAY_MS;\n return Math.max(\n WELCOME_COMPOSER_ENTER_DELAY_MS,\n welcomeSuggestionDelayMs(suggestionCount - 1) + WELCOME_COMPOSER_AFTER_LAST_CARD_MS,\n );\n}\n\n/** Fade + short rise; `fill-mode-both` holds the hidden start through a delay. */\nexport const WELCOME_ENTER_CLASS =\n 'animate-in fade-in slide-in-from-bottom-2 fill-mode-both animation-duration-300';\n\n/**\n * Inline entrance schedule for one element, or nothing under reduced motion\n * (no classes, no delay — the element is simply there).\n */\nexport function welcomeEntrance(\n delayMs: number,\n reducedMotion: boolean,\n): { className: string | undefined; style: CSSProperties | undefined } {\n if (reducedMotion) return { className: undefined, style: undefined };\n return { className: WELCOME_ENTER_CLASS, style: { animationDelay: `${delayMs}ms` } };\n}\n\nconst SuggestionCard: FC<{\n suggestion: WelcomeSuggestion;\n index: number;\n reducedMotion: boolean;\n}> = ({ suggestion, index, reducedMotion }) => {\n const Icon = suggestion.icon;\n const sendMessage = useSendMessage();\n const entrance = welcomeEntrance(welcomeSuggestionDelayMs(index), reducedMotion);\n\n const handleClick = useCallback(() => {\n void sendMessage(suggestion.prompt);\n }, [sendMessage, suggestion.prompt]);\n\n // Icon row above the title: the card reads the same at a 2-column width\n // and in the one-row layout, where each card is about a quarter of the\n // thread and a side-by-side icon would leave the title a few words wide.\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n className={cn(\n 'aui-thread-welcome-suggestion group flex flex-col items-start gap-2.5 rounded-xl border border-border/60 bg-card p-3.5 text-left shadow-sm transition-all duration-150 hover:border-border hover:bg-muted/40 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40',\n entrance.className,\n )}\n style={entrance.style}\n data-welcome-suggestion={index}\n >\n <span className=\"flex w-full items-center justify-between\">\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary\">\n <Icon className=\"size-4\" />\n </span>\n <ArrowRightIcon className=\"size-3.5 shrink-0 text-muted-foreground/0 transition-all group-hover:text-muted-foreground\" />\n </span>\n <span className=\"text-[13px] font-medium leading-snug text-foreground\">\n {suggestion.title}\n </span>\n </button>\n );\n};\n\nexport interface AthenaChatWelcomeSuggestionsProps {\n suggestions: readonly WelcomeSuggestion[];\n className?: string;\n}\n\n/**\n * The suggestion cards, docked directly above the composer in the empty\n * state: equal-width in one row once the thread is 40rem wide, a two-column\n * grid below that (a container query on the thread root, so a chat embedded\n * in a narrow pane of a wide window wraps too). Cards stagger in at\n * 120 ms + 70 ms × index; none of it moves under reduced motion.\n */\nexport const AthenaChatWelcomeSuggestions: FC<AthenaChatWelcomeSuggestionsProps> = ({\n suggestions,\n className,\n}) => {\n const reducedMotion = usePrefersReducedMotion();\n if (suggestions.length === 0) return null;\n return (\n <div\n className={cn(\n 'aui-thread-welcome-suggestions grid w-full auto-rows-fr grid-cols-2 gap-2.5 @min-[40rem]:grid-flow-col @min-[40rem]:auto-cols-fr',\n className,\n )}\n data-testid=\"athena-welcome-suggestions\"\n >\n {suggestions.map((suggestion, index) => (\n <SuggestionCard\n key={suggestion.title}\n suggestion={suggestion}\n index={index}\n reducedMotion={reducedMotion}\n />\n ))}\n </div>\n );\n};\n\nexport interface AthenaChatWelcomeProps {\n welcomeMessage: string;\n welcomeSubtext?: string;\n}\n\n/**\n * The greeting, centred in the viewport's free space while the thread is\n * empty. Fades and rises in; the subtext follows a beat later.\n */\nexport const AthenaChatWelcome: FC<AthenaChatWelcomeProps> = ({\n welcomeMessage,\n welcomeSubtext,\n}) => {\n const reducedMotion = usePrefersReducedMotion();\n const greeting = welcomeEntrance(0, reducedMotion);\n const subtext = welcomeEntrance(WELCOME_GREETING_SUBTEXT_DELAY_MS, reducedMotion);\n return (\n <div className=\"aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col\">\n <div className=\"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center\">\n <div className=\"aui-thread-welcome-message flex size-full flex-col justify-center px-4\">\n <h2\n className={cn(\n 'aui-thread-welcome-message-inner text-2xl font-semibold text-foreground',\n greeting.className,\n )}\n style={greeting.style}\n >\n {welcomeMessage}\n </h2>\n {welcomeSubtext && (\n <p\n className={cn(\n 'aui-thread-welcome-message-inner text-lg text-muted-foreground',\n subtext.className,\n )}\n style={subtext.style}\n >\n {welcomeSubtext}\n </p>\n )}\n </div>\n </div>\n </div>\n );\n};\n"],"names":["SearchIcon","PresentationIcon","FileTextIcon","useSendMessage","useCallback","jsxs","cn","jsx","ArrowRightIcon","usePrefersReducedMotion"],"mappings":";;;;;;;;AAYO,MAAM,8BAAmD;AAAA,EAC9D;AAAA,IACE,MAAMA,YAAAA;AAAAA,IACN,OAAO;AAAA,IACP,QACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,MAAMA,YAAAA;AAAAA,IACN,OAAO;AAAA,IACP,QACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,MAAMC,YA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A,MAAC;AAAA,MAAA;AAAA,QACC,WAAWD,OAAAA;AAAAA,UACT;AAAA,UACA,QAAQ;AAAA,QAAA;AAAA,QAEV,OAAO,QAAQ;AAAA,QAEd,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,EAAA,CAEJ,GACF,GACF;AAEJ;;;;;;;;;;;;"}
1
+ {"version":3,"file":"athena-chat-welcome.cjs","sources":["../../src/chat/athena-chat-welcome.tsx"],"sourcesContent":["import { ArrowRightIcon, FileTextIcon, PresentationIcon, SearchIcon } from 'lucide-react';\nimport { useCallback, type CSSProperties, type FC } from 'react';\nimport { useSendMessage } from '../composer/useSendMessage';\nimport { cn } from '../lib/utils';\nimport { usePrefersReducedMotion } from '../lib/use-prefers-reduced-motion';\n\nexport interface WelcomeSuggestion {\n icon: React.ElementType;\n title: string;\n prompt: string;\n}\n\nexport const DEFAULT_WELCOME_SUGGESTIONS: WelcomeSuggestion[] = [\n {\n icon: SearchIcon,\n title: 'Research a topic and draft a report',\n prompt:\n 'Search the web for the latest developments in enterprise AI adoption, then create a document summarizing the key trends, market data, and strategic implications.',\n },\n {\n icon: SearchIcon,\n title: 'Compare recent AI model launches',\n prompt:\n 'Search the web for the latest major AI model launches from OpenAI, Anthropic, and Google, then summarize the release dates, standout capabilities, and practical tradeoffs in a concise comparison table.',\n },\n {\n icon: PresentationIcon,\n title: 'Build a presentation from scratch',\n prompt:\n 'Create a 5-slide investor update presentation covering market opportunity, product traction, key metrics, competitive positioning, and next steps.',\n },\n {\n icon: FileTextIcon,\n title: 'Set up a structured spreadsheet',\n prompt:\n 'Create a project tracking spreadsheet with columns for task name, owner, priority, status, start date, due date, and completion percentage.',\n },\n];\n\n/**\n * The empty state's entrance schedule: the greeting first, the suggestion\n * cards staggered behind it, the composer last. Every value is an inline\n * `animation-delay`, so a host reading the DOM sees the schedule as-is.\n */\nexport const WELCOME_GREETING_SUBTEXT_DELAY_MS = 60;\nexport const WELCOME_SUGGESTION_STAGGER_BASE_MS = 120;\nexport const WELCOME_SUGGESTION_STAGGER_STEP_MS = 70;\nexport const WELCOME_COMPOSER_ENTER_DELAY_MS = 360;\n\nexport function welcomeSuggestionDelayMs(index: number): number {\n return WELCOME_SUGGESTION_STAGGER_BASE_MS + index * WELCOME_SUGGESTION_STAGGER_STEP_MS;\n}\n\n/** Gap between the last card and the composer, which always arrives last. */\nconst WELCOME_COMPOSER_AFTER_LAST_CARD_MS = 30;\n\n/**\n * When the composer enters: 360 ms behind the default four cards, and behind\n * the last card whenever a host supplies more (`welcomeSuggestions` is\n * unbounded), so the composer is always the final element to arrive.\n */\nexport function welcomeComposerDelayMs(suggestionCount: number): number {\n if (suggestionCount <= 0) return WELCOME_COMPOSER_ENTER_DELAY_MS;\n return Math.max(\n WELCOME_COMPOSER_ENTER_DELAY_MS,\n welcomeSuggestionDelayMs(suggestionCount - 1) + WELCOME_COMPOSER_AFTER_LAST_CARD_MS,\n );\n}\n\n/** Fade + short rise; `fill-mode-both` holds the hidden start through a delay. */\nexport const WELCOME_ENTER_CLASS =\n 'animate-in fade-in slide-in-from-bottom-2 fill-mode-both animation-duration-300';\n\n/**\n * Inline entrance schedule for one element, or nothing under reduced motion\n * (no classes, no delay — the element is simply there).\n */\nexport function welcomeEntrance(\n delayMs: number,\n reducedMotion: boolean,\n): { className: string | undefined; style: CSSProperties | undefined } {\n if (reducedMotion) return { className: undefined, style: undefined };\n return { className: WELCOME_ENTER_CLASS, style: { animationDelay: `${delayMs}ms` } };\n}\n\nconst SuggestionCard: FC<{\n suggestion: WelcomeSuggestion;\n index: number;\n reducedMotion: boolean;\n}> = ({ suggestion, index, reducedMotion }) => {\n const Icon = suggestion.icon;\n const sendMessage = useSendMessage();\n const entrance = welcomeEntrance(welcomeSuggestionDelayMs(index), reducedMotion);\n\n const handleClick = useCallback(() => {\n void sendMessage(suggestion.prompt);\n }, [sendMessage, suggestion.prompt]);\n\n // Icon row above the title: the card reads the same at a 2-column width\n // and in the one-row layout, where each card is about a quarter of the\n // thread and a side-by-side icon would leave the title a few words wide.\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n className={cn(\n 'aui-thread-welcome-suggestion group flex flex-col items-start gap-2.5 rounded-xl border border-border/60 bg-card p-3.5 text-left shadow-sm transition-all duration-150 hover:border-border hover:bg-muted/40 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40',\n entrance.className,\n )}\n style={entrance.style}\n data-welcome-suggestion={index}\n >\n <span className=\"flex w-full items-center justify-between\">\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary\">\n <Icon className=\"size-4\" />\n </span>\n <ArrowRightIcon className=\"size-3.5 shrink-0 text-muted-foreground/0 transition-all group-hover:text-muted-foreground\" />\n </span>\n <span className=\"text-[13px] font-medium leading-snug text-foreground\">\n {suggestion.title}\n </span>\n </button>\n );\n};\n\nexport interface AthenaChatWelcomeSuggestionsProps {\n suggestions: readonly WelcomeSuggestion[];\n className?: string;\n}\n\n/**\n * The suggestion cards, docked directly above the composer in the empty\n * state: equal-width in one row once the thread is 40rem wide, a two-column\n * grid below that (a container query on the thread root, so a chat embedded\n * in a narrow pane of a wide window wraps too). Cards stagger in at\n * 120 ms + 70 ms × index; none of it moves under reduced motion.\n */\nexport const AthenaChatWelcomeSuggestions: FC<AthenaChatWelcomeSuggestionsProps> = ({\n suggestions,\n className,\n}) => {\n const reducedMotion = usePrefersReducedMotion();\n if (suggestions.length === 0) return null;\n return (\n <div\n className={cn(\n 'aui-thread-welcome-suggestions grid w-full auto-rows-fr grid-cols-2 gap-2.5 @min-[40rem]:grid-flow-col @min-[40rem]:auto-cols-fr',\n className,\n )}\n data-testid=\"athena-welcome-suggestions\"\n >\n {suggestions.map((suggestion, index) => (\n <SuggestionCard\n key={suggestion.title}\n suggestion={suggestion}\n index={index}\n reducedMotion={reducedMotion}\n />\n ))}\n </div>\n );\n};\n\nexport interface AthenaChatWelcomeProps {\n welcomeMessage: string;\n welcomeSubtext?: string;\n}\n\n/**\n * The greeting, centred in the viewport's free space while the thread is\n * empty. Fades and rises in; the subtext follows a beat later.\n */\nexport const AthenaChatWelcome: FC<AthenaChatWelcomeProps> = ({\n welcomeMessage,\n welcomeSubtext,\n}) => {\n const reducedMotion = usePrefersReducedMotion();\n const greeting = welcomeEntrance(0, reducedMotion);\n const subtext = welcomeEntrance(WELCOME_GREETING_SUBTEXT_DELAY_MS, reducedMotion);\n return (\n <div className=\"aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col\">\n <div className=\"aui-thread-welcome-center flex w-full grow flex-col items-center justify-center\">\n <div className=\"aui-thread-welcome-message flex size-full flex-col justify-center px-4\">\n <h2\n className={cn(\n 'aui-thread-welcome-message-inner text-2xl font-semibold text-foreground',\n greeting.className,\n )}\n style={greeting.style}\n >\n {welcomeMessage}\n </h2>\n {welcomeSubtext && (\n <p\n className={cn(\n 'aui-thread-welcome-message-inner text-lg text-muted-foreground',\n subtext.className,\n )}\n style={subtext.style}\n >\n {welcomeSubtext}\n </p>\n )}\n </div>\n </div>\n </div>\n );\n};\n"],"names":["SearchIcon","PresentationIcon","FileTextIcon","useSendMessage","useCallback","jsxs","cn","jsx","ArrowRightIcon","usePrefersReducedMotion"],"mappings":";;;;;;;;AAYO,MAAM,8BAAmD;AAAA,EAC9D;AAAA,IACE,MAAMA,YAAAA;AAAAA,IACN,OAAO;AAAA,IACP,QACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,MAAMA,YAAAA;AAAAA,IACN,OAAO;AAAA,IACP,QACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,MAAMC,YAAAA;AAAAA,IACN,OAAO;AAAA,IACP,QACE;AAAA,EAAA;AAAA,EAEJ;AAAA,IACE,MAAMC,YAAAA;AAAAA,IACN,OAAO;AAAA,IACP,QACE;AAAA,EAAA;AAEN;AAOO,MAAM,oCAAoC;AAC1C,MAAM,qCAAqC;AAC3C,MAAM,q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;;;;;;;;;;"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const serialize = require("../references/src/anchors/serialize.cjs");
4
4
  const assetSpacesUrl = require("../references/src/formats/uri/asset-spaces-url.cjs");
5
- const react = require("react");
5
+ const require$$0 = require("react");
6
6
  const assetPanelStore = require("../assets/asset-panel-store.cjs");
7
7
  const AthenaContext = require("../provider/AthenaContext.cjs");
8
8
  const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
@@ -265,9 +265,9 @@ const useAthenaLinkClickHandler = () => {
265
265
  const isAssetPanelAvailable = assetPanelStore.useAssetPanelStore(
266
266
  (state) => state.assetPanelHostCount > 0 || state.assetOpeners.length > 0
267
267
  );
268
- const athenaConfig = react.useContext(AthenaContext.AthenaContext);
268
+ const athenaConfig = require$$0.useContext(AthenaContext.AthenaContext);
269
269
  const appUrl = athenaConfig == null ? void 0 : athenaConfig.appUrl;
270
- return react.useCallback(
270
+ return require$$0.useCallback(
271
271
  ({ href, linkText, target, nativeEvent }) => {
272
272
  var _a, _b;
273
273
  const resolvedLink = resolveAthenaLink({ href, appUrl });
@@ -347,10 +347,10 @@ const useAthenaLinkClickHandler = () => {
347
347
  );
348
348
  };
349
349
  const useAthenaCitationLinkHandler = () => {
350
- const athenaConfig = react.useContext(AthenaContext.AthenaContext);
350
+ const athenaConfig = require$$0.useContext(AthenaContext.AthenaContext);
351
351
  const appUrl = athenaConfig == null ? void 0 : athenaConfig.appUrl;
352
352
  const handleLinkClick = useAthenaLinkClickHandler();
353
- return react.useCallback(
353
+ return require$$0.useCallback(
354
354
  (input) => {
355
355
  if (!parseAthenaCitationLink({ href: input.href, appUrl })) {
356
356
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"athena-citation-links.cjs","sources":["../../src/chat/athena-citation-links.ts"],"sourcesContent":["import { decodeFromAssetSpacesUrl, serializeAnchorToParams } from '@athenaintel/references/asset-links';\nimport { useCallback, useContext } from 'react';\nimport type { AthenaAssetCitationReference } from '../assets/asset-embed-messages';\nimport { type AssetType, useAssetPanelStore } from '../assets/asset-panel-store';\nimport { AthenaContext } from '../provider/AthenaContext';\nimport type {\n AthenaCitationLinkMetadata,\n AthenaCitationLinkClickContext,\n AthenaCitationLinkHandleInput,\n AthenaCitationLinkHandler,\n AthenaLinkClickContext,\n AthenaLinkClickHandler,\n AthenaLinkClickHandleInput,\n AthenaLinkKind,\n} from '../provider/citation-links';\n\nconst ATHENA_APP_HOSTNAMES = new Set(['app.athenaintel.com', 'staging-app.athenaintel.com']);\nconst ATHENA_PREVIEW_HOSTNAME_SUFFIX = '.previews.athenaintel.com';\nconst ATHENA_WORKSPACE_HOSTNAME_SUFFIXES = ['.app.athenaintel.com', '.staging-app.athenaintel.com'];\n\nconst ASSET_TYPE_ALIASES: Record<string, AssetType> = {\n document: 'document',\n notebook: 'notebook',\n pdf: 'document',\n powerpoint: 'presentation',\n presentation: 'presentation',\n sheet: 'spreadsheet',\n spreadsheet: 'spreadsheet',\n word_document: 'document',\n};\n\nconst isAthenaSpacesPath = (url: URL): boolean => url.pathname.replace(/\\/+$/, '') === '/dashboard/spaces';\n\n/**\n * Asset types no embed viewer renders: agora refuses their embed token (422,\n * `agora/agora/web/api/embed/embed_viewer_asset_types.json`), so the asset\n * panel could only show an error for them.\n */\nconst NON_EMBEDDABLE_ASSET_TYPES: ReadonlySet<string> = new Set(['catalog']);\n\n/**\n * Anchors only a non-embeddable asset holds: a repository file's lines live in\n * a GitHub catalog (`ASSET_ANCHOR_REGISTRY`), which Athena on the web opens at\n * the file with the lines highlighted. Read from the anchor too, so a citation\n * whose `type=` names the wrong type still opens where it can be shown.\n */\nconst NON_EMBEDDABLE_ANCHOR_TYPES: ReadonlySet<string> = new Set(['file_line_range']);\n\n/** Whether the asset panel can show the cited asset, or only Athena on the web can. */\nconst isEmbeddableCitation = (url: URL): boolean => {\n const rawType = (url.searchParams.get('asset_type') ?? url.searchParams.get('type') ?? '')\n .trim()\n .replace(/^athena\\//, '')\n .toLowerCase();\n const anchorType = url.searchParams.get('anchor') ?? '';\n return !NON_EMBEDDABLE_ASSET_TYPES.has(rawType) && !NON_EMBEDDABLE_ANCHOR_TYPES.has(anchorType);\n};\n\nexport interface ParsedAthenaCitationLink {\n url: URL;\n assetId: string;\n assetIds: string[];\n assetType: AssetType | null;\n /** Complete target that can be passed directly to AthenaAssetEmbed.reference. */\n reference: AthenaAssetCitationReference;\n /**\n * Whether the asset panel can show the cited asset. A citation it cannot (a repository file's\n * lines, any catalog) opens as the link it is, in Athena on the web.\n */\n embeddable: boolean;\n}\n\nconst getFiniteNumber = (url: URL, key: string): number | null => {\n const value = url.searchParams.get(key);\n if (value === null || value.trim() === '') return null;\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : null;\n};\n\nconst getNonEmptyString = (url: URL, key: string): string | null => {\n const value = url.searchParams.get(key);\n return value === null || value === '' ? null : value;\n};\n\n/** The link's anchor as the shared reference parser reads it, or null when it names none it can read. */\nconst readSharedAnchor = (url: URL) => {\n try {\n return decodeFromAssetSpacesUrl(url).anchor ?? null;\n } catch {\n return null;\n }\n};\n\nconst parseCitationReference = ({\n url,\n assetId,\n}: {\n url: URL;\n assetId: string;\n}): AthenaAssetCitationReference => {\n const reference: AthenaAssetCitationReference = { id: assetId };\n const anchorType = url.searchParams.get('anchor');\n const page = getFiniteNumber(url, 'page');\n\n switch (anchorType) {\n case 'page':\n if (page !== null) reference.anchor = { type: anchorType, page };\n break;\n case 'page_range': {\n const startPage = getFiniteNumber(url, 'start_page');\n const endPage = getFiniteNumber(url, 'end_page');\n if (startPage !== null && endPage !== null) {\n reference.anchor = { type: anchorType, startPage, endPage };\n }\n break;\n }\n case 'page_rect': {\n const x = getFiniteNumber(url, 'x');\n const y = getFiniteNumber(url, 'y');\n const width = getFiniteNumber(url, 'width');\n const height = getFiniteNumber(url, 'height');\n if (page !== null && x !== null && y !== null && width !== null && height !== null) {\n const unit = url.searchParams.get('unit');\n reference.anchor = {\n type: anchorType,\n page,\n x,\n y,\n width,\n height,\n ...(unit === 'percent' || unit === 'point' ? { unit } : {}),\n };\n }\n break;\n }\n case 'page_text': {\n const text = url.searchParams.get('text');\n if (page !== null && text) {\n // Optional context that disambiguates a repeated phrase, and the hash\n // of the cited unit's normalized text (Clio C-23).\n const prefix = getNonEmptyString(url, 'prefix');\n const suffix = getNonEmptyString(url, 'suffix');\n const hash = getNonEmptyString(url, 'hash');\n reference.anchor = {\n type: anchorType,\n page,\n text,\n ...(prefix ? { prefix } : {}),\n ...(suffix ? { suffix } : {}),\n ...(hash ? { hash } : {}),\n };\n }\n break;\n }\n // Sheet anchors: the embed's spreadsheet view navigates + flashes the\n // target range (Olympus `useSheetAnchors`). `sheet_id` is the engine's\n // numeric sheet id, NOT a tab index.\n case 'sheet_cell': {\n const sheetId = getFiniteNumber(url, 'sheet_id');\n const cell = url.searchParams.get('cell');\n if (sheetId !== null && cell) reference.anchor = { type: anchorType, sheetId, cell };\n break;\n }\n case 'sheet_range': {\n const sheetId = getFiniteNumber(url, 'sheet_id');\n const range = url.searchParams.get('range');\n if (sheetId !== null && range) reference.anchor = { type: anchorType, sheetId, range };\n break;\n }\n case 'sheet_tab': {\n const sheetId = getFiniteNumber(url, 'sheet_id');\n if (sheetId !== null) reference.anchor = { type: anchorType, sheetId };\n break;\n }\n case 'sheet_table': {\n const sheetId = getFiniteNumber(url, 'sheet_id');\n const tableName = url.searchParams.get('table_name');\n const fallbackRange = url.searchParams.get('fallback_range');\n if (sheetId !== null && tableName) {\n reference.anchor = {\n type: anchorType,\n sheetId,\n tableName,\n ...(fallbackRange ? { fallbackRange } : {}),\n };\n }\n break;\n }\n }\n\n // Every other place (a slide, a time, a document block, a transcript message, …) goes to the\n // embed as the canonical query string `@athenaintel/references` writes, which the embed reads\n // back with the same parser, so the panel opens at it instead of at the top.\n if (reference.anchor === undefined) {\n const anchor = readSharedAnchor(url);\n if (anchor) reference.anchor = serializeAnchorToParams(anchor).toString();\n }\n\n const excerpt = url.searchParams.get('excerpt');\n if (excerpt) reference.meta = { excerpt };\n return reference;\n};\n\nconst normalizeAssetType = (value: string | null): AssetType | null => {\n if (!value) {\n return null;\n }\n\n const normalizedValue = value.trim().replace(/^athena\\//, '').toLowerCase().replace(/-/g, '_');\n return ASSET_TYPE_ALIASES[normalizedValue] ?? null;\n};\n\nconst getOrigin = (value?: string | null): string | null => {\n if (!value) {\n return null;\n }\n\n try {\n return new URL(value).origin;\n } catch {\n return null;\n }\n};\n\nconst getHostname = (value?: string | null): string | null => {\n if (!value) {\n return null;\n }\n\n try {\n return new URL(value).hostname.toLowerCase();\n } catch {\n return null;\n }\n};\n\nconst matchesHostnameOrSubdomain = ({\n hostname,\n candidateHostname,\n}: {\n hostname: string;\n candidateHostname: string;\n}): boolean => hostname === candidateHostname || hostname.endsWith(`.${candidateHostname}`);\n\nconst getCurrentOrigin = (): string | null => {\n if (typeof window === 'undefined') {\n return null;\n }\n\n return window.location.origin;\n};\n\nconst parseUrl = ({\n href,\n appUrl,\n}: {\n href: string;\n appUrl?: string | null;\n}): URL | null => {\n const fallbackBase = appUrl ?? getCurrentOrigin() ?? 'https://app.athenaintel.com';\n\n try {\n return new URL(href, fallbackBase);\n } catch {\n return null;\n }\n};\n\nconst isAthenaAppUrl = ({\n url,\n appUrl,\n}: {\n url: URL;\n appUrl?: string | null;\n}): boolean => {\n const hostname = url.hostname.toLowerCase();\n\n if (\n ATHENA_APP_HOSTNAMES.has(hostname)\n || hostname.endsWith(ATHENA_PREVIEW_HOSTNAME_SUFFIX)\n || ATHENA_WORKSPACE_HOSTNAME_SUFFIXES.some((suffix) => hostname.endsWith(suffix))\n ) {\n return true;\n }\n\n const configuredHostname = getHostname(appUrl);\n if (configuredHostname && matchesHostnameOrSubdomain({ hostname, candidateHostname: configuredHostname })) {\n return true;\n }\n\n const configuredOrigin = getOrigin(appUrl);\n if (configuredOrigin && url.origin === configuredOrigin) {\n return true;\n }\n\n // Fallback: treat same-origin `/dashboard/spaces?asset_ids=...` links as Athena\n // citations so local dev and private-cloud embeds still work without appUrl.\n // Consumers can disable the default interception with\n // linkClicks={{ interceptAthenaCitations: false }} or the legacy citationLinks alias.\n const currentOrigin = getCurrentOrigin();\n return !!currentOrigin && url.origin === currentOrigin;\n};\n\nexport const parseAthenaCitationLink = ({\n href,\n appUrl,\n}: {\n href: string;\n appUrl?: string | null;\n}): ParsedAthenaCitationLink | null => {\n const url = parseUrl({ href, appUrl });\n if (!url || !isAthenaAppUrl({ url, appUrl }) || !isAthenaSpacesPath(url)) {\n return null;\n }\n\n const assetIdsParam = url.searchParams.get('asset_ids');\n if (!assetIdsParam) {\n return null;\n }\n\n const assetIds = assetIdsParam\n .split(',')\n .map((value) => value.trim())\n .filter((value) => value.length > 0);\n const assetId = assetIds[0];\n\n if (!assetId) {\n return null;\n }\n\n return {\n url,\n assetId,\n assetIds,\n assetType: normalizeAssetType(url.searchParams.get('asset_type') ?? url.searchParams.get('type')),\n reference: parseCitationReference({ url, assetId }),\n embeddable: isEmbeddableCitation(url),\n };\n};\n\nexport const isAthenaCitationUrl = ({\n href,\n appUrl,\n}: {\n href: string;\n appUrl?: string | null;\n}): boolean => parseAthenaCitationLink({ href, appUrl }) !== null;\n\ninterface ResolvedAthenaLink {\n url: URL;\n kind: AthenaLinkKind;\n citation: ParsedAthenaCitationLink | null;\n}\n\nconst resolveAthenaLink = ({\n href,\n appUrl,\n}: AthenaLinkClickHandleInput & {\n appUrl?: string | null;\n}): ResolvedAthenaLink | null => {\n const url = parseUrl({ href, appUrl });\n if (!url) {\n return null;\n }\n\n const citation = parseAthenaCitationLink({ href, appUrl });\n if (citation) {\n return {\n url: citation.url,\n kind: 'athena-citation',\n citation,\n };\n }\n\n return {\n url,\n kind: isAthenaAppUrl({ url, appUrl }) ? 'athena-app' : 'external',\n citation: null,\n };\n};\n\nexport const useAthenaLinkClickHandler = (): AthenaLinkClickHandler => {\n const openAsset = useAssetPanelStore((state) => state.openAsset);\n // A host that opens assets its own way (`AthenaProvider onOpenAsset`) counts as a panel: the\n // citation goes to it instead of to the browser.\n const isAssetPanelAvailable = useAssetPanelStore(\n (state) => state.assetPanelHostCount > 0 || state.assetOpeners.length > 0,\n );\n const athenaConfig = useContext(AthenaContext);\n const appUrl = athenaConfig?.appUrl;\n\n return useCallback<AthenaLinkClickHandler>(\n ({ href, linkText, target, nativeEvent }: AthenaLinkClickHandleInput) => {\n const resolvedLink = resolveAthenaLink({ href, appUrl });\n if (!resolvedLink) {\n return false;\n }\n\n const linkClicks = athenaConfig?.linkClicks;\n const citationLinks = athenaConfig?.citationLinks;\n const trimmedLinkText = linkText?.trim() || null;\n const citationLink = resolvedLink.citation;\n const citationMetadata: AthenaCitationLinkMetadata | null = citationLink\n ? {\n assetId: citationLink.assetId,\n assetIds: citationLink.assetIds,\n assetType: citationLink.assetType,\n }\n : null;\n // A citation the panel cannot show (a catalog's file lines) is left to the link itself.\n const openInAssetPanel = citationLink?.embeddable\n ? () =>\n openAsset(citationLink.assetId, {\n name: trimmedLinkText ?? undefined,\n type: citationLink.assetType ?? undefined,\n // Carry the citation target so the panel's iframe navigates to\n // the cited range/page instead of opening at the top.\n reference: citationLink.reference,\n // Reading references is one preview surface: a citation to a\n // different asset swaps the active tab rather than stacking a\n // tab per cited document.\n replaceActiveTab: true,\n // A host's own opener that opens it on the web keeps the link as written.\n href: resolvedLink.url.toString(),\n })\n : undefined;\n const context: AthenaLinkClickContext = {\n href,\n url: resolvedLink.url,\n target: target ?? null,\n linkText: trimmedLinkText,\n isAssetPanelAvailable,\n kind: resolvedLink.kind,\n citation: citationMetadata,\n nativeEvent: nativeEvent ?? null,\n openInAssetPanel,\n openInBrowser: (nextTarget) => {\n window.open(resolvedLink.url.toString(), nextTarget ?? target ?? '_blank')?.focus();\n },\n };\n\n if (linkClicks?.onClick?.(context) === true) {\n nativeEvent?.preventDefault();\n return true;\n }\n\n if (!citationLink || !openInAssetPanel || !citationMetadata) {\n return false;\n }\n\n const citationContext: AthenaCitationLinkClickContext = {\n ...context,\n kind: 'athena-citation',\n citation: citationMetadata,\n assetId: citationMetadata.assetId,\n assetIds: citationMetadata.assetIds,\n assetType: citationMetadata.assetType,\n openInAssetPanel,\n };\n\n if (citationLinks?.onClick?.(citationContext) === true) {\n nativeEvent?.preventDefault();\n return true;\n }\n\n if ((linkClicks?.interceptAthenaCitations ?? citationLinks?.interceptAthenaCitations) === false) {\n return false;\n }\n\n if (!isAssetPanelAvailable) {\n return false;\n }\n\n // Nothing showed it (the host's opener declined and no panel is mounted): the link opens as\n // a link.\n if (!citationContext.openInAssetPanel()) {\n return false;\n }\n nativeEvent?.preventDefault();\n return true;\n },\n [appUrl, athenaConfig, isAssetPanelAvailable, openAsset],\n );\n};\n\nexport const useAthenaCitationLinkHandler = (): AthenaCitationLinkHandler => {\n const athenaConfig = useContext(AthenaContext);\n const appUrl = athenaConfig?.appUrl;\n const handleLinkClick = useAthenaLinkClickHandler();\n\n return useCallback<AthenaCitationLinkHandler>(\n (input: AthenaCitationLinkHandleInput) => {\n if (!parseAthenaCitationLink({ href: input.href, appUrl })) {\n return false;\n }\n\n return handleLinkClick(input);\n },\n [appUrl, handleLinkClick],\n );\n};\n"],"names":["decodeFromAssetSpacesUrl","serializeAnchorToParams","useAssetPanelStore","useContext","AthenaContext","useCallback","_a"],"mappings":";;;;;;;AAgBA,MAAM,uBAAuB,oBAAI,IAAI,CAAC,uBAAuB,6BAA6B,CAAC;AAC3F,MAAM,iCAAiC;AACvC,MAAM,qCAAqC,CAAC,wBAAwB,8BAA8B;AAElG,MAAM,qBAAgD;AAAA,EACpD,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,OAAO;AAAA,EACP,aAAa;AAAA,EACb,eAAe;AACjB;AAEA,MAAM,qBAAqB,CAAC,QAAsB,IAAI,SAAS,QAAQ,QAAQ,EAAE,MAAM;AAOvF,MAAM,6BA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decodeFromAssetSpacesUrl, serializeAnchorToParams } from '@athenaintel/references/asset-links';\nimport { useCallback, useContext } from 'react';\nimport type { AthenaAssetCitationReference } from '../assets/asset-embed-messages';\nimport { type AssetType, useAssetPanelStore } from '../assets/asset-panel-store';\nimport { AthenaContext } from '../provider/AthenaContext';\nimport type {\n AthenaCitationLinkMetadata,\n AthenaCitationLinkClickContext,\n AthenaCitationLinkHandleInput,\n AthenaCitationLinkHandler,\n AthenaLinkClickContext,\n AthenaLinkClickHandler,\n AthenaLinkClickHandleInput,\n AthenaLinkKind,\n} from '../provider/citation-links';\n\nconst ATHENA_APP_HOSTNAMES = new Set(['app.athenaintel.com', 'staging-app.athenaintel.com']);\nconst ATHENA_PREVIEW_HOSTNAME_SUFFIX = '.previews.athenaintel.com';\nconst ATHENA_WORKSPACE_HOSTNAME_SUFFIXES = ['.app.athenaintel.com', '.staging-app.athenaintel.com'];\n\nconst ASSET_TYPE_ALIASES: Record<string, AssetType> = {\n document: 'document',\n notebook: 'notebook',\n pdf: 'document',\n powerpoint: 'presentation',\n presentation: 'presentation',\n sheet: 'spreadsheet',\n spreadsheet: 'spreadsheet',\n word_document: 'document',\n};\n\nconst isAthenaSpacesPath = (url: URL): boolean => url.pathname.replace(/\\/+$/, '') === '/dashboard/spaces';\n\n/**\n * Asset types no embed viewer renders: agora refuses their embed token (422,\n * `agora/agora/web/api/embed/embed_viewer_asset_types.json`), so the asset\n * panel could only show an error for them.\n */\nconst NON_EMBEDDABLE_ASSET_TYPES: ReadonlySet<string> = new Set(['catalog']);\n\n/**\n * Anchors only a non-embeddable asset holds: a repository file's lines live in\n * a GitHub catalog (`ASSET_ANCHOR_REGISTRY`), which Athena on the web opens at\n * the file with the lines highlighted. Read from the anchor too, so a citation\n * whose `type=` names the wrong type still opens where it can be shown.\n */\nconst NON_EMBEDDABLE_ANCHOR_TYPES: ReadonlySet<string> = new Set(['file_line_range']);\n\n/** Whether the asset panel can show the cited asset, or only Athena on the web can. */\nconst isEmbeddableCitation = (url: URL): boolean => {\n const rawType = (url.searchParams.get('asset_type') ?? url.searchParams.get('type') ?? '')\n .trim()\n .replace(/^athena\\//, '')\n .toLowerCase();\n const anchorType = url.searchParams.get('anchor') ?? '';\n return !NON_EMBEDDABLE_ASSET_TYPES.has(rawType) && !NON_EMBEDDABLE_ANCHOR_TYPES.has(anchorType);\n};\n\nexport interface ParsedAthenaCitationLink {\n url: URL;\n assetId: string;\n assetIds: string[];\n assetType: AssetType | null;\n /** Complete target that can be passed directly to AthenaAssetEmbed.reference. */\n reference: AthenaAssetCitationReference;\n /**\n * Whether the asset panel can show the cited asset. A citation it cannot (a repository file's\n * lines, any catalog) opens as the link it is, in Athena on the web.\n */\n embeddable: boolean;\n}\n\nconst getFiniteNumber = (url: URL, key: string): number | null => {\n const value = url.searchParams.get(key);\n if (value === null || value.trim() === '') return null;\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : null;\n};\n\nconst getNonEmptyString = (url: URL, key: string): string | null => {\n const value = url.searchParams.get(key);\n return value === null || value === '' ? null : value;\n};\n\n/** The link's anchor as the shared reference parser reads it, or null when it names none it can read. */\nconst readSharedAnchor = (url: URL) => {\n try {\n return decodeFromAssetSpacesUrl(url).anchor ?? null;\n } catch {\n return null;\n }\n};\n\nconst parseCitationReference = ({\n url,\n assetId,\n}: {\n url: URL;\n assetId: string;\n}): AthenaAssetCitationReference => {\n const reference: AthenaAssetCitationReference = { id: assetId };\n const anchorType = url.searchParams.get('anchor');\n const page = getFiniteNumber(url, 'page');\n\n switch (anchorType) {\n case 'page':\n if (page !== null) reference.anchor = { type: anchorType, page };\n break;\n case 'page_range': {\n const startPage = getFiniteNumber(url, 'start_page');\n const endPage = getFiniteNumber(url, 'end_page');\n if (startPage !== null && endPage !== null) {\n reference.anchor = { type: anchorType, startPage, endPage };\n }\n break;\n }\n case 'page_rect': {\n const x = getFiniteNumber(url, 'x');\n const y = getFiniteNumber(url, 'y');\n const width = getFiniteNumber(url, 'width');\n const height = getFiniteNumber(url, 'height');\n if (page !== null && x !== null && y !== null && width !== null && height !== null) {\n const unit = url.searchParams.get('unit');\n reference.anchor = {\n type: anchorType,\n page,\n x,\n y,\n width,\n height,\n ...(unit === 'percent' || unit === 'point' ? { unit } : {}),\n };\n }\n break;\n }\n case 'page_text': {\n const text = url.searchParams.get('text');\n if (page !== null && text) {\n // Optional context that disambiguates a repeated phrase, and the hash\n // of the cited unit's normalized text (Clio C-23).\n const prefix = getNonEmptyString(url, 'prefix');\n const suffix = getNonEmptyString(url, 'suffix');\n const hash = getNonEmptyString(url, 'hash');\n reference.anchor = {\n type: anchorType,\n page,\n text,\n ...(prefix ? { prefix } : {}),\n ...(suffix ? { suffix } : {}),\n ...(hash ? { hash } : {}),\n };\n }\n break;\n }\n // Sheet anchors: the embed's spreadsheet view navigates + flashes the\n // target range (Olympus `useSheetAnchors`). `sheet_id` is the engine's\n // numeric sheet id, NOT a tab index.\n case 'sheet_cell': {\n const sheetId = getFiniteNumber(url, 'sheet_id');\n const cell = url.searchParams.get('cell');\n if (sheetId !== null && cell) reference.anchor = { type: anchorType, sheetId, cell };\n break;\n }\n case 'sheet_range': {\n const sheetId = getFiniteNumber(url, 'sheet_id');\n const range = url.searchParams.get('range');\n if (sheetId !== null && range) reference.anchor = { type: anchorType, sheetId, range };\n break;\n }\n case 'sheet_tab': {\n const sheetId = getFiniteNumber(url, 'sheet_id');\n if (sheetId !== null) reference.anchor = { type: anchorType, sheetId };\n break;\n }\n case 'sheet_table': {\n const sheetId = getFiniteNumber(url, 'sheet_id');\n const tableName = url.searchParams.get('table_name');\n const fallbackRange = url.searchParams.get('fallback_range');\n if (sheetId !== null && tableName) {\n reference.anchor = {\n type: anchorType,\n sheetId,\n tableName,\n ...(fallbackRange ? { fallbackRange } : {}),\n };\n }\n break;\n }\n }\n\n // Every other place (a slide, a time, a document block, a transcript message, …) goes to the\n // embed as the canonical query string `@athenaintel/references` writes, which the embed reads\n // back with the same parser, so the panel opens at it instead of at the top.\n if (reference.anchor === undefined) {\n const anchor = readSharedAnchor(url);\n if (anchor) reference.anchor = serializeAnchorToParams(anchor).toString();\n }\n\n const excerpt = url.searchParams.get('excerpt');\n if (excerpt) reference.meta = { excerpt };\n return reference;\n};\n\nconst normalizeAssetType = (value: string | null): AssetType | null => {\n if (!value) {\n return null;\n }\n\n const normalizedValue = value.trim().replace(/^athena\\//, '').toLowerCase().replace(/-/g, '_');\n return ASSET_TYPE_ALIASES[normalizedValue] ?? null;\n};\n\nconst getOrigin = (value?: string | null): string | null => {\n if (!value) {\n return null;\n }\n\n try {\n return new URL(value).origin;\n } catch {\n return null;\n }\n};\n\nconst getHostname = (value?: string | null): string | null => {\n if (!value) {\n return null;\n }\n\n try {\n return new URL(value).hostname.toLowerCase();\n } catch {\n return null;\n }\n};\n\nconst matchesHostnameOrSubdomain = ({\n hostname,\n candidateHostname,\n}: {\n hostname: string;\n candidateHostname: string;\n}): boolean => hostname === candidateHostname || hostname.endsWith(`.${candidateHostname}`);\n\nconst getCurrentOrigin = (): string | null => {\n if (typeof window === 'undefined') {\n return null;\n }\n\n return window.location.origin;\n};\n\nconst parseUrl = ({\n href,\n appUrl,\n}: {\n href: string;\n appUrl?: string | null;\n}): URL | null => {\n const fallbackBase = appUrl ?? getCurrentOrigin() ?? 'https://app.athenaintel.com';\n\n try {\n return new URL(href, fallbackBase);\n } catch {\n return null;\n }\n};\n\nconst isAthenaAppUrl = ({\n url,\n appUrl,\n}: {\n url: URL;\n appUrl?: string | null;\n}): boolean => {\n const hostname = url.hostname.toLowerCase();\n\n if (\n ATHENA_APP_HOSTNAMES.has(hostname)\n || hostname.endsWith(ATHENA_PREVIEW_HOSTNAME_SUFFIX)\n || ATHENA_WORKSPACE_HOSTNAME_SUFFIXES.some((suffix) => hostname.endsWith(suffix))\n ) {\n return true;\n }\n\n const configuredHostname = getHostname(appUrl);\n if (configuredHostname && matchesHostnameOrSubdomain({ hostname, candidateHostname: configuredHostname })) {\n return true;\n }\n\n const configuredOrigin = getOrigin(appUrl);\n if (configuredOrigin && url.origin === configuredOrigin) {\n return true;\n }\n\n // Fallback: treat same-origin `/dashboard/spaces?asset_ids=...` links as Athena\n // citations so local dev and private-cloud embeds still work without appUrl.\n // Consumers can disable the default interception with\n // linkClicks={{ interceptAthenaCitations: false }} or the legacy citationLinks alias.\n const currentOrigin = getCurrentOrigin();\n return !!currentOrigin && url.origin === currentOrigin;\n};\n\nexport const parseAthenaCitationLink = ({\n href,\n appUrl,\n}: {\n href: string;\n appUrl?: string | null;\n}): ParsedAthenaCitationLink | null => {\n const url = parseUrl({ href, appUrl });\n if (!url || !isAthenaAppUrl({ url, appUrl }) || !isAthenaSpacesPath(url)) {\n return null;\n }\n\n const assetIdsParam = url.searchParams.get('asset_ids');\n if (!assetIdsParam) {\n return null;\n }\n\n const assetIds = assetIdsParam\n .split(',')\n .map((value) => value.trim())\n .filter((value) => value.length > 0);\n const assetId = assetIds[0];\n\n if (!assetId) {\n return null;\n }\n\n return {\n url,\n assetId,\n assetIds,\n assetType: normalizeAssetType(url.searchParams.get('asset_type') ?? url.searchParams.get('type')),\n reference: parseCitationReference({ url, assetId }),\n embeddable: isEmbeddableCitation(url),\n };\n};\n\nexport const isAthenaCitationUrl = ({\n href,\n appUrl,\n}: {\n href: string;\n appUrl?: string | null;\n}): boolean => parseAthenaCitationLink({ href, appUrl }) !== null;\n\ninterface ResolvedAthenaLink {\n url: URL;\n kind: AthenaLinkKind;\n citation: ParsedAthenaCitationLink | null;\n}\n\nconst resolveAthenaLink = ({\n href,\n appUrl,\n}: AthenaLinkClickHandleInput & {\n appUrl?: string | null;\n}): ResolvedAthenaLink | null => {\n const url = parseUrl({ href, appUrl });\n if (!url) {\n return null;\n }\n\n const citation = parseAthenaCitationLink({ href, appUrl });\n if (citation) {\n return {\n url: citation.url,\n kind: 'athena-citation',\n citation,\n };\n }\n\n return {\n url,\n kind: isAthenaAppUrl({ url, appUrl }) ? 'athena-app' : 'external',\n citation: null,\n };\n};\n\nexport const useAthenaLinkClickHandler = (): AthenaLinkClickHandler => {\n const openAsset = useAssetPanelStore((state) => state.openAsset);\n // A host that opens assets its own way (`AthenaProvider onOpenAsset`) counts as a panel: the\n // citation goes to it instead of to the browser.\n const isAssetPanelAvailable = useAssetPanelStore(\n (state) => state.assetPanelHostCount > 0 || state.assetOpeners.length > 0,\n );\n const athenaConfig = useContext(AthenaContext);\n const appUrl = athenaConfig?.appUrl;\n\n return useCallback<AthenaLinkClickHandler>(\n ({ href, linkText, target, nativeEvent }: AthenaLinkClickHandleInput) => {\n const resolvedLink = resolveAthenaLink({ href, appUrl });\n if (!resolvedLink) {\n return false;\n }\n\n const linkClicks = athenaConfig?.linkClicks;\n const citationLinks = athenaConfig?.citationLinks;\n const trimmedLinkText = linkText?.trim() || null;\n const citationLink = resolvedLink.citation;\n const citationMetadata: AthenaCitationLinkMetadata | null = citationLink\n ? {\n assetId: citationLink.assetId,\n assetIds: citationLink.assetIds,\n assetType: citationLink.assetType,\n }\n : null;\n // A citation the panel cannot show (a catalog's file lines) is left to the link itself.\n const openInAssetPanel = citationLink?.embeddable\n ? () =>\n openAsset(citationLink.assetId, {\n name: trimmedLinkText ?? undefined,\n type: citationLink.assetType ?? undefined,\n // Carry the citation target so the panel's iframe navigates to\n // the cited range/page instead of opening at the top.\n reference: citationLink.reference,\n // Reading references is one preview surface: a citation to a\n // different asset swaps the active tab rather than stacking a\n // tab per cited document.\n replaceActiveTab: true,\n // A host's own opener that opens it on the web keeps the link as written.\n href: resolvedLink.url.toString(),\n })\n : undefined;\n const context: AthenaLinkClickContext = {\n href,\n url: resolvedLink.url,\n target: target ?? null,\n linkText: trimmedLinkText,\n isAssetPanelAvailable,\n kind: resolvedLink.kind,\n citation: citationMetadata,\n nativeEvent: nativeEvent ?? null,\n openInAssetPanel,\n openInBrowser: (nextTarget) => {\n window.open(resolvedLink.url.toString(), nextTarget ?? target ?? '_blank')?.focus();\n },\n };\n\n if (linkClicks?.onClick?.(context) === true) {\n nativeEvent?.preventDefault();\n return true;\n }\n\n if (!citationLink || !openInAssetPanel || !citationMetadata) {\n return false;\n }\n\n const citationContext: AthenaCitationLinkClickContext = {\n ...context,\n kind: 'athena-citation',\n citation: citationMetadata,\n assetId: citationMetadata.assetId,\n assetIds: citationMetadata.assetIds,\n assetType: citationMetadata.assetType,\n openInAssetPanel,\n };\n\n if (citationLinks?.onClick?.(citationContext) === true) {\n nativeEvent?.preventDefault();\n return true;\n }\n\n if ((linkClicks?.interceptAthenaCitations ?? citationLinks?.interceptAthenaCitations) === false) {\n return false;\n }\n\n if (!isAssetPanelAvailable) {\n return false;\n }\n\n // Nothing showed it (the host's opener declined and no panel is mounted): the link opens as\n // a link.\n if (!citationContext.openInAssetPanel()) {\n return false;\n }\n nativeEvent?.preventDefault();\n return true;\n },\n [appUrl, athenaConfig, isAssetPanelAvailable, openAsset],\n );\n};\n\nexport const useAthenaCitationLinkHandler = (): AthenaCitationLinkHandler => {\n const athenaConfig = useContext(AthenaContext);\n const appUrl = athenaConfig?.appUrl;\n const handleLinkClick = useAthenaLinkClickHandler();\n\n return useCallback<AthenaCitationLinkHandler>(\n (input: AthenaCitationLinkHandleInput) => {\n if (!parseAthenaCitationLink({ href: input.href, appUrl })) {\n return false;\n }\n\n return handleLinkClick(input);\n },\n [appUrl, handleLinkClick],\n );\n};\n"],"names":["decodeFromAssetSpacesUrl","serializeAnchorToParams","useAssetPanelStore","useContext","AthenaContext","useCallback","_a"],"mappings":";;;;;;;AAgBA,MAAM,uBAAuB,oBAAI,IAAI,CAAC,uBAAuB,6BAA6B,CAAC;AAC3F,MAAM,iCAAiC;AACvC,MAAM,qCAAqC,CAAC,wBAAwB,8BAA8B;AAElG,MAAM,qBAAgD;AAAA,EACpD,UAAU;AAAA,EACV,UAAU;AAAA,EACV,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,OAAO;AAAA,EACP,aAAa;AAAA,EACb,eAAe;AACjB;AAEA,MAAM,qBAAqB,CAAC,QAAsB,IAAI,SAA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ntime = require("react/jsx-runtime");
4
4
  const lucideReact = require("lucide-react");
5
5
  const tooltipIconButton = require("./tooltip-icon-button.cjs");
6
6
  const button = require("../ui/button.cjs");
7
+ const cnfast = require("cnfast");
7
8
  const AthenaComposerSendButton = ({
8
9
  action,
9
10
  onSend,
@@ -49,22 +50,31 @@ const AthenaComposerStopButton = ({
49
50
  );
50
51
  const AthenaComposerMentionButton = ({
51
52
  onClick,
52
- disabled
53
- }) => /* @__PURE__ */ jsxRuntime.jsx(
54
- tooltipIconButton.TooltipIconButton,
55
- {
56
- tooltip: "Mention an asset or tool",
57
- side: "bottom",
58
- type: "button",
59
- variant: "ghost",
60
- size: "icon",
61
- className: "aui-composer-mention size-8 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-30",
62
- "aria-label": "Mention an asset or tool",
63
- onClick,
64
- disabled,
65
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AtSignIcon, { className: "size-4" })
66
- }
67
- );
53
+ disabled,
54
+ disabledReason = null
55
+ }) => {
56
+ const unavailable = Boolean(disabledReason) && !disabled;
57
+ return /* @__PURE__ */ jsxRuntime.jsx(
58
+ tooltipIconButton.TooltipIconButton,
59
+ {
60
+ tooltip: unavailable && disabledReason || "Mention an asset or tool",
61
+ side: "bottom",
62
+ type: "button",
63
+ variant: "ghost",
64
+ size: "icon",
65
+ className: cnfast.cn(
66
+ "aui-composer-mention size-8 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-30",
67
+ unavailable && "cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground"
68
+ ),
69
+ "aria-label": "Mention an asset or tool",
70
+ "aria-disabled": unavailable || void 0,
71
+ "data-unavailable": unavailable || void 0,
72
+ onClick: unavailable ? void 0 : onClick,
73
+ disabled,
74
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AtSignIcon, { className: "size-4" })
75
+ }
76
+ );
77
+ };
68
78
  const ATHENA_COMPOSER_COMPONENTS = {
69
79
  SendButton: AthenaComposerSendButton,
70
80
  StopButton: AthenaComposerStopButton
@@ -1 +1 @@
1
- {"version":3,"file":"athena-composer-controls.cjs","sources":["../../src/chat/athena-composer-controls.tsx"],"sourcesContent":["import { ArrowUpIcon, AtSignIcon, ListPlusIcon, SquareIcon } from 'lucide-react';\nimport type { FC } from 'react';\nimport type {\n ComposerSendButtonProps,\n ComposerStopButtonProps,\n} from '../chat-ui/messages/message-components';\nimport { TooltipIconButton } from './tooltip-icon-button';\nimport { Button } from '../ui/button';\n\n/**\n * AthenaChat's composer rail controls, on the SDK's `aui-*` theming contract.\n *\n * Send is an ink circle with the arrow (a list-plus while a run is live and\n * the draft would queue); it reads as inert at 30% while there is nothing to\n * send. Stop is the same circle carrying a filled square. The `@` button\n * types the mention trigger for people who do not know the shortcut.\n */\nexport const AthenaComposerSendButton: FC<ComposerSendButtonProps> = ({\n action,\n onSend,\n disabled,\n title,\n}) => {\n const label = action === 'queue' ? 'Queue message' : 'Send message';\n return (\n <TooltipIconButton\n tooltip={title ?? label}\n side=\"bottom\"\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-send size-8 rounded-full disabled:opacity-30\"\n aria-label={label}\n data-composer-action={action}\n onClick={onSend}\n disabled={disabled}\n >\n {action === 'queue' ? (\n <ListPlusIcon className=\"aui-composer-send-icon size-4\" />\n ) : (\n <ArrowUpIcon className=\"aui-composer-send-icon size-4\" />\n )}\n </TooltipIconButton>\n );\n};\n\nexport const AthenaComposerStopButton: FC<ComposerStopButtonProps> = ({\n onStop,\n disabled,\n title,\n}) => (\n <Button\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-cancel size-8 rounded-full disabled:opacity-30\"\n aria-label=\"Stop generating\"\n data-composer-action=\"stop\"\n title={title}\n onClick={onStop}\n disabled={disabled}\n >\n <SquareIcon className=\"aui-composer-cancel-icon size-3 fill-current\" />\n </Button>\n);\n\nexport interface AthenaComposerMentionButtonProps {\n onClick: () => void;\n disabled?: boolean;\n}\n\nexport const AthenaComposerMentionButton: FC<AthenaComposerMentionButtonProps> = ({\n onClick,\n disabled,\n}) => (\n <TooltipIconButton\n tooltip=\"Mention an asset or tool\"\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"aui-composer-mention size-8 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-30\"\n aria-label=\"Mention an asset or tool\"\n onClick={onClick}\n disabled={disabled}\n >\n <AtSignIcon className=\"size-4\" />\n </TooltipIconButton>\n);\n\nexport const ATHENA_COMPOSER_COMPONENTS = {\n SendButton: AthenaComposerSendButton,\n StopButton: AthenaComposerStopButton,\n};\n"],"names":["jsx","TooltipIconButton","ListPlusIcon","ArrowUpIcon","Button","SquareIcon","AtSignIcon"],"mappings":";;;;;;AAiBO,MAAM,2BAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,QAAQ,WAAW,UAAU,kBAAkB;AACrD,SACEA,2BAAAA;AAAAA,IAACC,kBAAAA;AAAAA,IAAA;AAAA,MACC,SAAS,SAAS;AAAA,MAClB,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAU;AAAA,MACV,cAAY;AAAA,MACZ,wBAAsB;AAAA,MACtB,SAAS;AAAA,MACT;AAAA,MAEC,UAAA,WAAW,UACVD,2BAAAA,IAACE,YAAAA,cAAA,EAAa,WAAU,iCAAgC,IAExDF,2BAAAA,IAACG,YAAAA,aAAA,EAAY,WAAU,gCAAA,CAAgC;AAAA,IAAA;AAAA,EAAA;AAI/D;AAEO,MAAM,2BAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AACF,MACEH,2BAAAA;AAAAA,EAACI,OAAAA;AAAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAU;AAAA,IACV,cAAW;AAAA,IACX,wBAAqB;AAAA,IACrB;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IAEA,UAAAJ,2BAAAA,IAACK,YAAAA,YAAA,EAAW,WAAU,+CAAA,CAA+C;AAAA,EAAA;AACvE;AAQK,MAAM,8BAAoE,CAAC;AAAA,EAChF;AAAA,EACA;AACF,MACEL,2BAAAA;AAAAA,EAACC,kBAAAA;AAAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAU;AAAA,IACV,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAAD,2BAAAA,IAACM,YAAAA,YAAA,EAAW,WAAU,SAAA,CAAS;AAAA,EAAA;AACjC;AAGK,MAAM,6BAA6B;AAAA,EACxC,YAAY;AAAA,EACZ,YAAY;AACd;;;;;"}
1
+ {"version":3,"file":"athena-composer-controls.cjs","sources":["../../src/chat/athena-composer-controls.tsx"],"sourcesContent":["import { ArrowUpIcon, AtSignIcon, ListPlusIcon, SquareIcon } from 'lucide-react';\nimport type { FC } from 'react';\nimport type {\n ComposerSendButtonProps,\n ComposerStopButtonProps,\n} from '../chat-ui/messages/message-components';\nimport { TooltipIconButton } from './tooltip-icon-button';\nimport { Button } from '../ui/button';\nimport { cn } from '../lib/utils';\n\n/**\n * AthenaChat's composer rail controls, on the SDK's `aui-*` theming contract.\n *\n * Send is an ink circle with the arrow (a list-plus while a run is live and\n * the draft would queue); it reads as inert at 30% while there is nothing to\n * send. Stop is the same circle carrying a filled square. The `@` button\n * types the mention trigger for people who do not know the shortcut.\n */\nexport const AthenaComposerSendButton: FC<ComposerSendButtonProps> = ({\n action,\n onSend,\n disabled,\n title,\n}) => {\n const label = action === 'queue' ? 'Queue message' : 'Send message';\n return (\n <TooltipIconButton\n tooltip={title ?? label}\n side=\"bottom\"\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-send size-8 rounded-full disabled:opacity-30\"\n aria-label={label}\n data-composer-action={action}\n onClick={onSend}\n disabled={disabled}\n >\n {action === 'queue' ? (\n <ListPlusIcon className=\"aui-composer-send-icon size-4\" />\n ) : (\n <ArrowUpIcon className=\"aui-composer-send-icon size-4\" />\n )}\n </TooltipIconButton>\n );\n};\n\nexport const AthenaComposerStopButton: FC<ComposerStopButtonProps> = ({\n onStop,\n disabled,\n title,\n}) => (\n <Button\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-cancel size-8 rounded-full disabled:opacity-30\"\n aria-label=\"Stop generating\"\n data-composer-action=\"stop\"\n title={title}\n onClick={onStop}\n disabled={disabled}\n >\n <SquareIcon className=\"aui-composer-cancel-icon size-3 fill-current\" />\n </Button>\n);\n\nexport interface AthenaComposerMentionButtonProps {\n onClick: () => void;\n disabled?: boolean;\n /**\n * Why the `@` menu can't be opened from here now (Athena can't be reached, so nothing it lists\n * could load): shown in the tooltip of a control that stays focusable and opens nothing. A\n * control the host turned off (`disabled`) stays natively disabled: its own reason wins.\n */\n disabledReason?: string | null;\n}\n\nexport const AthenaComposerMentionButton: FC<AthenaComposerMentionButtonProps> = ({\n onClick,\n disabled,\n disabledReason = null,\n}) => {\n const unavailable = Boolean(disabledReason) && !disabled;\n return (\n <TooltipIconButton\n tooltip={(unavailable && disabledReason) || 'Mention an asset or tool'}\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\n 'aui-composer-mention size-8 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-30',\n unavailable && 'cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground',\n )}\n aria-label=\"Mention an asset or tool\"\n aria-disabled={unavailable || undefined}\n data-unavailable={unavailable || undefined}\n onClick={unavailable ? undefined : onClick}\n disabled={disabled}\n >\n <AtSignIcon className=\"size-4\" />\n </TooltipIconButton>\n );\n};\n\nexport const ATHENA_COMPOSER_COMPONENTS = {\n SendButton: AthenaComposerSendButton,\n StopButton: AthenaComposerStopButton,\n};\n"],"names":["jsx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AAAA,MACL,WAAWK,OAAAA;AAAAA,QACT;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,MAEjB,cAAW;AAAA,MACX,iBAAe,eAAe;AAAA,MAC9B,oBAAkB,eAAe;AAAA,MACjC,SAAS,cAAc,SAAY;AAAA,MACnC;AAAA,MAEA,UAAAN,2BAAAA,IAACO,YAAAA,YAAA,EAAW,WAAU,SAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAGrC;AAEO,MAAM,6BAA6B;AAAA,EACxC,YAAY;AAAA,EACZ,YAAY;AACd;;;;;"}
@@ -13,6 +13,12 @@ export declare const AthenaComposerStopButton: FC<ComposerStopButtonProps>;
13
13
  export interface AthenaComposerMentionButtonProps {
14
14
  onClick: () => void;
15
15
  disabled?: boolean;
16
+ /**
17
+ * Why the `@` menu can't be opened from here now (Athena can't be reached, so nothing it lists
18
+ * could load): shown in the tooltip of a control that stays focusable and opens nothing. A
19
+ * control the host turned off (`disabled`) stays natively disabled: its own reason wins.
20
+ */
21
+ disabledReason?: string | null;
16
22
  }
17
23
  export declare const AthenaComposerMentionButton: FC<AthenaComposerMentionButtonProps>;
18
24
  export declare const ATHENA_COMPOSER_COMPONENTS: {
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { ListPlusIcon, ArrowUpIcon, SquareIcon, AtSignIcon } from "lucide-react";
3
3
  import { TooltipIconButton } from "./tooltip-icon-button.js";
4
4
  import { Button } from "../ui/button.js";
5
+ import { cn } from "cnfast";
5
6
  const AthenaComposerSendButton = ({
6
7
  action,
7
8
  onSend,
@@ -47,22 +48,31 @@ const AthenaComposerStopButton = ({
47
48
  );
48
49
  const AthenaComposerMentionButton = ({
49
50
  onClick,
50
- disabled
51
- }) => /* @__PURE__ */ jsx(
52
- TooltipIconButton,
53
- {
54
- tooltip: "Mention an asset or tool",
55
- side: "bottom",
56
- type: "button",
57
- variant: "ghost",
58
- size: "icon",
59
- className: "aui-composer-mention size-8 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-30",
60
- "aria-label": "Mention an asset or tool",
61
- onClick,
62
- disabled,
63
- children: /* @__PURE__ */ jsx(AtSignIcon, { className: "size-4" })
64
- }
65
- );
51
+ disabled,
52
+ disabledReason = null
53
+ }) => {
54
+ const unavailable = Boolean(disabledReason) && !disabled;
55
+ return /* @__PURE__ */ jsx(
56
+ TooltipIconButton,
57
+ {
58
+ tooltip: unavailable && disabledReason || "Mention an asset or tool",
59
+ side: "bottom",
60
+ type: "button",
61
+ variant: "ghost",
62
+ size: "icon",
63
+ className: cn(
64
+ "aui-composer-mention size-8 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-30",
65
+ unavailable && "cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground"
66
+ ),
67
+ "aria-label": "Mention an asset or tool",
68
+ "aria-disabled": unavailable || void 0,
69
+ "data-unavailable": unavailable || void 0,
70
+ onClick: unavailable ? void 0 : onClick,
71
+ disabled,
72
+ children: /* @__PURE__ */ jsx(AtSignIcon, { className: "size-4" })
73
+ }
74
+ );
75
+ };
66
76
  const ATHENA_COMPOSER_COMPONENTS = {
67
77
  SendButton: AthenaComposerSendButton,
68
78
  StopButton: AthenaComposerStopButton
@@ -1 +1 @@
1
- {"version":3,"file":"athena-composer-controls.js","sources":["../../src/chat/athena-composer-controls.tsx"],"sourcesContent":["import { ArrowUpIcon, AtSignIcon, ListPlusIcon, SquareIcon } from 'lucide-react';\nimport type { FC } from 'react';\nimport type {\n ComposerSendButtonProps,\n ComposerStopButtonProps,\n} from '../chat-ui/messages/message-components';\nimport { TooltipIconButton } from './tooltip-icon-button';\nimport { Button } from '../ui/button';\n\n/**\n * AthenaChat's composer rail controls, on the SDK's `aui-*` theming contract.\n *\n * Send is an ink circle with the arrow (a list-plus while a run is live and\n * the draft would queue); it reads as inert at 30% while there is nothing to\n * send. Stop is the same circle carrying a filled square. The `@` button\n * types the mention trigger for people who do not know the shortcut.\n */\nexport const AthenaComposerSendButton: FC<ComposerSendButtonProps> = ({\n action,\n onSend,\n disabled,\n title,\n}) => {\n const label = action === 'queue' ? 'Queue message' : 'Send message';\n return (\n <TooltipIconButton\n tooltip={title ?? label}\n side=\"bottom\"\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-send size-8 rounded-full disabled:opacity-30\"\n aria-label={label}\n data-composer-action={action}\n onClick={onSend}\n disabled={disabled}\n >\n {action === 'queue' ? (\n <ListPlusIcon className=\"aui-composer-send-icon size-4\" />\n ) : (\n <ArrowUpIcon className=\"aui-composer-send-icon size-4\" />\n )}\n </TooltipIconButton>\n );\n};\n\nexport const AthenaComposerStopButton: FC<ComposerStopButtonProps> = ({\n onStop,\n disabled,\n title,\n}) => (\n <Button\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-cancel size-8 rounded-full disabled:opacity-30\"\n aria-label=\"Stop generating\"\n data-composer-action=\"stop\"\n title={title}\n onClick={onStop}\n disabled={disabled}\n >\n <SquareIcon className=\"aui-composer-cancel-icon size-3 fill-current\" />\n </Button>\n);\n\nexport interface AthenaComposerMentionButtonProps {\n onClick: () => void;\n disabled?: boolean;\n}\n\nexport const AthenaComposerMentionButton: FC<AthenaComposerMentionButtonProps> = ({\n onClick,\n disabled,\n}) => (\n <TooltipIconButton\n tooltip=\"Mention an asset or tool\"\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"aui-composer-mention size-8 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-30\"\n aria-label=\"Mention an asset or tool\"\n onClick={onClick}\n disabled={disabled}\n >\n <AtSignIcon className=\"size-4\" />\n </TooltipIconButton>\n);\n\nexport const ATHENA_COMPOSER_COMPONENTS = {\n SendButton: AthenaComposerSendButton,\n StopButton: AthenaComposerStopButton,\n};\n"],"names":[],"mappings":";;;;AAiBO,MAAM,2BAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,QAAQ,WAAW,UAAU,kBAAkB;AACrD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,SAAS;AAAA,MAClB,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAU;AAAA,MACV,cAAY;AAAA,MACZ,wBAAsB;AAAA,MACtB,SAAS;AAAA,MACT;AAAA,MAEC,UAAA,WAAW,UACV,oBAAC,cAAA,EAAa,WAAU,iCAAgC,IAExD,oBAAC,aAAA,EAAY,WAAU,gCAAA,CAAgC;AAAA,IAAA;AAAA,EAAA;AAI/D;AAEO,MAAM,2BAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAU;AAAA,IACV,cAAW;AAAA,IACX,wBAAqB;AAAA,IACrB;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IAEA,UAAA,oBAAC,YAAA,EAAW,WAAU,+CAAA,CAA+C;AAAA,EAAA;AACvE;AAQK,MAAM,8BAAoE,CAAC;AAAA,EAChF;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAU;AAAA,IACV,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAA,oBAAC,YAAA,EAAW,WAAU,SAAA,CAAS;AAAA,EAAA;AACjC;AAGK,MAAM,6BAA6B;AAAA,EACxC,YAAY;AAAA,EACZ,YAAY;AACd;"}
1
+ {"version":3,"file":"athena-composer-controls.js","sources":["../../src/chat/athena-composer-controls.tsx"],"sourcesContent":["import { ArrowUpIcon, AtSignIcon, ListPlusIcon, SquareIcon } from 'lucide-react';\nimport type { FC } from 'react';\nimport type {\n ComposerSendButtonProps,\n ComposerStopButtonProps,\n} from '../chat-ui/messages/message-components';\nimport { TooltipIconButton } from './tooltip-icon-button';\nimport { Button } from '../ui/button';\nimport { cn } from '../lib/utils';\n\n/**\n * AthenaChat's composer rail controls, on the SDK's `aui-*` theming contract.\n *\n * Send is an ink circle with the arrow (a list-plus while a run is live and\n * the draft would queue); it reads as inert at 30% while there is nothing to\n * send. Stop is the same circle carrying a filled square. The `@` button\n * types the mention trigger for people who do not know the shortcut.\n */\nexport const AthenaComposerSendButton: FC<ComposerSendButtonProps> = ({\n action,\n onSend,\n disabled,\n title,\n}) => {\n const label = action === 'queue' ? 'Queue message' : 'Send message';\n return (\n <TooltipIconButton\n tooltip={title ?? label}\n side=\"bottom\"\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-send size-8 rounded-full disabled:opacity-30\"\n aria-label={label}\n data-composer-action={action}\n onClick={onSend}\n disabled={disabled}\n >\n {action === 'queue' ? (\n <ListPlusIcon className=\"aui-composer-send-icon size-4\" />\n ) : (\n <ArrowUpIcon className=\"aui-composer-send-icon size-4\" />\n )}\n </TooltipIconButton>\n );\n};\n\nexport const AthenaComposerStopButton: FC<ComposerStopButtonProps> = ({\n onStop,\n disabled,\n title,\n}) => (\n <Button\n type=\"button\"\n variant=\"default\"\n size=\"icon\"\n className=\"aui-composer-cancel size-8 rounded-full disabled:opacity-30\"\n aria-label=\"Stop generating\"\n data-composer-action=\"stop\"\n title={title}\n onClick={onStop}\n disabled={disabled}\n >\n <SquareIcon className=\"aui-composer-cancel-icon size-3 fill-current\" />\n </Button>\n);\n\nexport interface AthenaComposerMentionButtonProps {\n onClick: () => void;\n disabled?: boolean;\n /**\n * Why the `@` menu can't be opened from here now (Athena can't be reached, so nothing it lists\n * could load): shown in the tooltip of a control that stays focusable and opens nothing. A\n * control the host turned off (`disabled`) stays natively disabled: its own reason wins.\n */\n disabledReason?: string | null;\n}\n\nexport const AthenaComposerMentionButton: FC<AthenaComposerMentionButtonProps> = ({\n onClick,\n disabled,\n disabledReason = null,\n}) => {\n const unavailable = Boolean(disabledReason) && !disabled;\n return (\n <TooltipIconButton\n tooltip={(unavailable && disabledReason) || 'Mention an asset or tool'}\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\n 'aui-composer-mention size-8 rounded-full text-muted-foreground hover:text-foreground disabled:opacity-30',\n unavailable && 'cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground',\n )}\n aria-label=\"Mention an asset or tool\"\n aria-disabled={unavailable || undefined}\n data-unavailable={unavailable || undefined}\n onClick={unavailable ? undefined : onClick}\n disabled={disabled}\n >\n <AtSignIcon className=\"size-4\" />\n </TooltipIconButton>\n );\n};\n\nexport const ATHENA_COMPOSER_COMPONENTS = {\n SendButton: AthenaComposerSendButton,\n StopButton: AthenaComposerStopButton,\n};\n"],"names":[],"mappings":";;;;;AAkBO,MAAM,2BAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,QAAQ,WAAW,UAAU,kBAAkB;AACrD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,SAAS;AAAA,MAClB,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAU;AAAA,MACV,cAAY;AAAA,MACZ,wBAAsB;AAAA,MACtB,SAAS;AAAA,MACT;AAAA,MAEC,UAAA,WAAW,UACV,oBAAC,cAAA,EAAa,WAAU,iCAAgC,IAExD,oBAAC,aAAA,EAAY,WAAU,gCAAA,CAAgC;AAAA,IAAA;AAAA,EAAA;AAI/D;AAEO,MAAM,2BAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAU;AAAA,IACV,cAAW;AAAA,IACX,wBAAqB;AAAA,IACrB;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IAEA,UAAA,oBAAC,YAAA,EAAW,WAAU,+CAAA,CAA+C;AAAA,EAAA;AACvE;AAcK,MAAM,8BAAoE,CAAC;AAAA,EAChF;AAAA,EACA;AAAA,EACA,iBAAiB;AACnB,MAAM;AACJ,QAAM,cAAc,QAAQ,cAAc,KAAK,CAAC;AAChD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAU,eAAe,kBAAmB;AAAA,MAC5C,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAW;AAAA,QACT;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,MAEjB,cAAW;AAAA,MACX,iBAAe,eAAe;AAAA,MAC9B,oBAAkB,eAAe;AAAA,MACjC,SAAS,cAAc,SAAY;AAAA,MACnC;AAAA,MAEA,UAAA,oBAAC,YAAA,EAAW,WAAU,SAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAGrC;AAEO,MAAM,6BAA6B;AAAA,EACxC,YAAY;AAAA,EACZ,YAAY;AACd;"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react = require("@assistant-ui/react");
5
+ const useAthenaRunLive = require("./use-athena-run-live.cjs");
6
+ const useAthenaVoiceLive = require("./use-athena-voice-live.cjs");
7
+ const cnfast = require("cnfast");
8
+ function useAthenaTurnEnded() {
9
+ const lastAndComplete = react.useAuiState(
10
+ (s) => {
11
+ var _a;
12
+ return s.message.isLast && ((_a = s.message.status) == null ? void 0 : _a.type) === "complete";
13
+ }
14
+ );
15
+ const runLive = useAthenaRunLive.useAthenaRunLive();
16
+ const voiceLive = useAthenaVoiceLive.useAthenaVoiceLive();
17
+ return lastAndComplete && !runLive && !voiceLive;
18
+ }
19
+ const AthenaTurnEndStatus = ({
20
+ children = "Athena went to sleep",
21
+ className
22
+ }) => {
23
+ const ended = useAthenaTurnEnded();
24
+ if (!ended) return null;
25
+ return /* @__PURE__ */ jsxRuntime.jsxs(
26
+ "div",
27
+ {
28
+ className: cnfast.cn(
29
+ "aui-turn-end-status flex items-center gap-2 text-[13px] leading-[18px] text-muted-foreground",
30
+ className
31
+ ),
32
+ role: "status",
33
+ children: [
34
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "size-1.5 rounded-full bg-current opacity-50" }),
35
+ children
36
+ ]
37
+ }
38
+ );
39
+ };
40
+ exports.AthenaTurnEndStatus = AthenaTurnEndStatus;
41
+ exports.useAthenaTurnEnded = useAthenaTurnEnded;
42
+ //# sourceMappingURL=athena-turn-end-status.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"athena-turn-end-status.cjs","sources":["../../src/chat/athena-turn-end-status.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport type { FC, ReactNode } from 'react';\nimport { cn } from '../lib/utils';\nimport { useAthenaRunLive } from './use-athena-run-live';\nimport { useAthenaVoiceLive } from './use-athena-voice-live';\n\n/**\n * Whether the conversation has gone quiet under this assistant message: it\n * is the thread's last message, it finished cleanly, no run is live (behind a\n * reconnect or not), and no voice session is live. A live voice session is a\n * conversation still under way even between runs, so it never reads as\n * quiet.\n *\n * Call it inside an assistant message rendered by `AthenaChat` (an\n * `AssistantActionBar` override, a message part).\n */\nexport function useAthenaTurnEnded(): boolean {\n const lastAndComplete = useAuiState(\n (s) => s.message.isLast && s.message.status?.type === 'complete',\n );\n const runLive = useAthenaRunLive();\n const voiceLive = useAthenaVoiceLive();\n return lastAndComplete && !runLive && !voiceLive;\n}\n\nexport interface AthenaTurnEndStatusProps {\n /** The line's words. Default: \"Athena went to sleep\". */\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * A quiet line under the last reply once the conversation has gone quiet\n * ({@link useAthenaTurnEnded}): the way Devin ends a session. Mount it in an\n * `AssistantActionBar` override; it renders nothing while a run or a voice\n * session is live.\n */\nexport const AthenaTurnEndStatus: FC<AthenaTurnEndStatusProps> = ({\n children = 'Athena went to sleep',\n className,\n}) => {\n const ended = useAthenaTurnEnded();\n if (!ended) return null;\n return (\n <div\n className={cn(\n 'aui-turn-end-status flex items-center gap-2 text-[13px] leading-[18px] text-muted-foreground',\n className,\n )}\n role=\"status\"\n >\n <span aria-hidden className=\"size-1.5 rounded-full bg-current opacity-50\" />\n {children}\n </div>\n );\n};\n"],"names":["useAuiState","useAthenaRunLive","useAthenaVoiceLive","jsxs","cn","jsx"],"mappings":";;;;;;;AAgBO,SAAS,qBAA8B;AAC5C,QAAM,kBAAkBA,MAAAA;AAAAA,IACtB,CAAC;;AAAM,eAAE,QAAQ,YAAU,OAAE,QAAQ,WAAV,mBAAkB,UAAS;AAAA;AAAA,EAAA;AAExD,QAAM,UAAUC,iBAAAA,iBAAA;AAChB,QAAM,YAAYC,mBAAAA,mBAAA;AAClB,SAAO,mBAAmB,CAAC,WAAW,CAAC;AACzC;AAcO,MAAM,sBAAoD,CAAC;AAAA,EAChE,WAAW;AAAA,EACX;AACF,MAAM;AACJ,QAAM,QAAQ,mBAAA;AACd,MAAI,CAAC,MAAO,QAAO;AACnB,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,OAAAA;AAAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,MAAK;AAAA,MAEL,UAAA;AAAA,QAAAC,2BAAAA,IAAC,QAAA,EAAK,eAAW,MAAC,WAAU,+CAA8C;AAAA,QACzE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;;;"}
@@ -0,0 +1,24 @@
1
+ import type { FC, ReactNode } from 'react';
2
+ /**
3
+ * Whether the conversation has gone quiet under this assistant message: it
4
+ * is the thread's last message, it finished cleanly, no run is live (behind a
5
+ * reconnect or not), and no voice session is live. A live voice session is a
6
+ * conversation still under way even between runs, so it never reads as
7
+ * quiet.
8
+ *
9
+ * Call it inside an assistant message rendered by `AthenaChat` (an
10
+ * `AssistantActionBar` override, a message part).
11
+ */
12
+ export declare function useAthenaTurnEnded(): boolean;
13
+ export interface AthenaTurnEndStatusProps {
14
+ /** The line's words. Default: "Athena went to sleep". */
15
+ children?: ReactNode;
16
+ className?: string;
17
+ }
18
+ /**
19
+ * A quiet line under the last reply once the conversation has gone quiet
20
+ * ({@link useAthenaTurnEnded}): the way Devin ends a session. Mount it in an
21
+ * `AssistantActionBar` override; it renders nothing while a run or a voice
22
+ * session is live.
23
+ */
24
+ export declare const AthenaTurnEndStatus: FC<AthenaTurnEndStatusProps>;
@@ -0,0 +1,42 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useAuiState } from "@assistant-ui/react";
3
+ import { useAthenaRunLive } from "./use-athena-run-live.js";
4
+ import { useAthenaVoiceLive } from "./use-athena-voice-live.js";
5
+ import { cn } from "cnfast";
6
+ function useAthenaTurnEnded() {
7
+ const lastAndComplete = useAuiState(
8
+ (s) => {
9
+ var _a;
10
+ return s.message.isLast && ((_a = s.message.status) == null ? void 0 : _a.type) === "complete";
11
+ }
12
+ );
13
+ const runLive = useAthenaRunLive();
14
+ const voiceLive = useAthenaVoiceLive();
15
+ return lastAndComplete && !runLive && !voiceLive;
16
+ }
17
+ const AthenaTurnEndStatus = ({
18
+ children = "Athena went to sleep",
19
+ className
20
+ }) => {
21
+ const ended = useAthenaTurnEnded();
22
+ if (!ended) return null;
23
+ return /* @__PURE__ */ jsxs(
24
+ "div",
25
+ {
26
+ className: cn(
27
+ "aui-turn-end-status flex items-center gap-2 text-[13px] leading-[18px] text-muted-foreground",
28
+ className
29
+ ),
30
+ role: "status",
31
+ children: [
32
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "size-1.5 rounded-full bg-current opacity-50" }),
33
+ children
34
+ ]
35
+ }
36
+ );
37
+ };
38
+ export {
39
+ AthenaTurnEndStatus,
40
+ useAthenaTurnEnded
41
+ };
42
+ //# sourceMappingURL=athena-turn-end-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"athena-turn-end-status.js","sources":["../../src/chat/athena-turn-end-status.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport type { FC, ReactNode } from 'react';\nimport { cn } from '../lib/utils';\nimport { useAthenaRunLive } from './use-athena-run-live';\nimport { useAthenaVoiceLive } from './use-athena-voice-live';\n\n/**\n * Whether the conversation has gone quiet under this assistant message: it\n * is the thread's last message, it finished cleanly, no run is live (behind a\n * reconnect or not), and no voice session is live. A live voice session is a\n * conversation still under way even between runs, so it never reads as\n * quiet.\n *\n * Call it inside an assistant message rendered by `AthenaChat` (an\n * `AssistantActionBar` override, a message part).\n */\nexport function useAthenaTurnEnded(): boolean {\n const lastAndComplete = useAuiState(\n (s) => s.message.isLast && s.message.status?.type === 'complete',\n );\n const runLive = useAthenaRunLive();\n const voiceLive = useAthenaVoiceLive();\n return lastAndComplete && !runLive && !voiceLive;\n}\n\nexport interface AthenaTurnEndStatusProps {\n /** The line's words. Default: \"Athena went to sleep\". */\n children?: ReactNode;\n className?: string;\n}\n\n/**\n * A quiet line under the last reply once the conversation has gone quiet\n * ({@link useAthenaTurnEnded}): the way Devin ends a session. Mount it in an\n * `AssistantActionBar` override; it renders nothing while a run or a voice\n * session is live.\n */\nexport const AthenaTurnEndStatus: FC<AthenaTurnEndStatusProps> = ({\n children = 'Athena went to sleep',\n className,\n}) => {\n const ended = useAthenaTurnEnded();\n if (!ended) return null;\n return (\n <div\n className={cn(\n 'aui-turn-end-status flex items-center gap-2 text-[13px] leading-[18px] text-muted-foreground',\n className,\n )}\n role=\"status\"\n >\n <span aria-hidden className=\"size-1.5 rounded-full bg-current opacity-50\" />\n {children}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAgBO,SAAS,qBAA8B;AAC5C,QAAM,kBAAkB;AAAA,IACtB,CAAC;;AAAM,eAAE,QAAQ,YAAU,OAAE,QAAQ,WAAV,mBAAkB,UAAS;AAAA;AAAA,EAAA;AAExD,QAAM,UAAU,iBAAA;AAChB,QAAM,YAAY,mBAAA;AAClB,SAAO,mBAAmB,CAAC,WAAW,CAAC;AACzC;AAcO,MAAM,sBAAoD,CAAC;AAAA,EAChE,WAAW;AAAA,EACX;AACF,MAAM;AACJ,QAAM,QAAQ,mBAAA;AACd,MAAI,CAAC,MAAO,QAAO;AACnB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,MAAK;AAAA,MAEL,UAAA;AAAA,QAAA,oBAAC,QAAA,EAAK,eAAW,MAAC,WAAU,+CAA8C;AAAA,QACzE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}