@athenaintel/react 0.18.0 → 0.20.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 (848) hide show
  1. package/README.md +195 -7
  2. package/dist/assets/AssetPanel.cjs +277 -0
  3. package/dist/assets/AssetPanel.cjs.map +1 -0
  4. package/dist/assets/AssetPanel.js +277 -0
  5. package/dist/assets/AssetPanel.js.map +1 -0
  6. package/dist/assets/AthenaAssetEmbed.cjs +151 -0
  7. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -0
  8. package/dist/assets/AthenaAssetEmbed.js +151 -0
  9. package/dist/assets/AthenaAssetEmbed.js.map +1 -0
  10. package/dist/assets/AthenaLayout.cjs +69 -0
  11. package/dist/assets/AthenaLayout.cjs.map +1 -0
  12. package/dist/assets/AthenaLayout.js +69 -0
  13. package/dist/assets/AthenaLayout.js.map +1 -0
  14. package/dist/assets/asset-embed-messages.cjs +39 -0
  15. package/dist/assets/asset-embed-messages.cjs.map +1 -0
  16. package/dist/assets/asset-embed-messages.js +39 -0
  17. package/dist/assets/asset-embed-messages.js.map +1 -0
  18. package/dist/assets/asset-panel-store.cjs +124 -0
  19. package/dist/assets/asset-panel-store.cjs.map +1 -0
  20. package/dist/assets/asset-panel-store.js +124 -0
  21. package/dist/assets/asset-panel-store.js.map +1 -0
  22. package/dist/assets/asset-panel-url.cjs +40 -0
  23. package/dist/assets/asset-panel-url.cjs.map +1 -0
  24. package/dist/assets/asset-panel-url.js +40 -0
  25. package/dist/assets/asset-panel-url.js.map +1 -0
  26. package/dist/assets/use-asset-embed.cjs +362 -0
  27. package/dist/assets/use-asset-embed.cjs.map +1 -0
  28. package/dist/assets/use-asset-embed.js +362 -0
  29. package/dist/assets/use-asset-embed.js.map +1 -0
  30. package/dist/{AthenaAuthContext-B3AwLA5Z.cjs → auth/AthenaAuthContext.cjs} +5 -4
  31. package/dist/auth/AthenaAuthContext.cjs.map +1 -0
  32. package/dist/{AthenaAuthContext-DQsdayH2.js → auth/AthenaAuthContext.js} +3 -3
  33. package/dist/auth/AthenaAuthContext.js.map +1 -0
  34. package/dist/auth/AthenaAuthProvider.cjs +141 -0
  35. package/dist/auth/AthenaAuthProvider.cjs.map +1 -0
  36. package/dist/auth/AthenaAuthProvider.js +141 -0
  37. package/dist/auth/AthenaAuthProvider.js.map +1 -0
  38. package/dist/{auth.cjs → auth/AthenaSSOProvider.cjs} +14 -151
  39. package/dist/auth/AthenaSSOProvider.cjs.map +1 -0
  40. package/dist/{auth.js → auth/AthenaSSOProvider.js} +4 -142
  41. package/dist/auth/AthenaSSOProvider.js.map +1 -0
  42. package/dist/auth/index.cjs +10 -0
  43. package/dist/auth/index.cjs.map +1 -0
  44. package/dist/auth/index.js +10 -0
  45. package/dist/auth/index.js.map +1 -0
  46. package/dist/chat/AthenaChat.cjs +753 -0
  47. package/dist/chat/AthenaChat.cjs.map +1 -0
  48. package/dist/chat/AthenaChat.d.ts +3 -2
  49. package/dist/chat/AthenaChat.js +753 -0
  50. package/dist/chat/AthenaChat.js.map +1 -0
  51. package/dist/chat/AthenaChatErrorBoundary.cjs +53 -0
  52. package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -0
  53. package/dist/chat/AthenaChatErrorBoundary.js +53 -0
  54. package/dist/chat/AthenaChatErrorBoundary.js.map +1 -0
  55. package/dist/chat/StatewireApprovalCard.cjs +171 -0
  56. package/dist/chat/StatewireApprovalCard.cjs.map +1 -0
  57. package/dist/chat/StatewireApprovalCard.d.ts +59 -2
  58. package/dist/chat/StatewireApprovalCard.js +171 -0
  59. package/dist/chat/StatewireApprovalCard.js.map +1 -0
  60. package/dist/chat/StatewireClientToolBridge.cjs +50 -0
  61. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -0
  62. package/dist/chat/StatewireClientToolBridge.d.ts +3 -3
  63. package/dist/chat/StatewireClientToolBridge.js +50 -0
  64. package/dist/chat/StatewireClientToolBridge.js.map +1 -0
  65. package/dist/chat/StatewireQueuedMessages.cjs +432 -0
  66. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -0
  67. package/dist/chat/StatewireQueuedMessages.d.ts +104 -6
  68. package/dist/chat/StatewireQueuedMessages.js +432 -0
  69. package/dist/chat/StatewireQueuedMessages.js.map +1 -0
  70. package/dist/chat/athena-citation-links.cjs +326 -0
  71. package/dist/chat/athena-citation-links.cjs.map +1 -0
  72. package/dist/chat/athena-citation-links.js +326 -0
  73. package/dist/chat/athena-citation-links.js.map +1 -0
  74. package/dist/chat/run-activity.cjs +28 -0
  75. package/dist/chat/run-activity.cjs.map +1 -0
  76. package/dist/chat/run-activity.js +28 -0
  77. package/dist/chat/run-activity.js.map +1 -0
  78. package/dist/chat/statewire-approval.d.ts +1 -1
  79. package/dist/chat/statewire-banners.cjs +83 -0
  80. package/dist/chat/statewire-banners.cjs.map +1 -0
  81. package/dist/chat/statewire-banners.js +83 -0
  82. package/dist/chat/statewire-banners.js.map +1 -0
  83. package/dist/chat/statewire-client-tools.cjs +73 -0
  84. package/dist/chat/statewire-client-tools.cjs.map +1 -0
  85. package/dist/chat/statewire-client-tools.d.ts +15 -21
  86. package/dist/chat/statewire-client-tools.js +73 -0
  87. package/dist/chat/statewire-client-tools.js.map +1 -0
  88. package/dist/chat/super-grouping/CollapsibleGroup.cjs +158 -0
  89. package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -0
  90. package/dist/chat/super-grouping/CollapsibleGroup.d.ts +52 -11
  91. package/dist/chat/super-grouping/CollapsibleGroup.js +158 -0
  92. package/dist/chat/super-grouping/CollapsibleGroup.js.map +1 -0
  93. package/dist/chat/super-grouping/SuperGroupingCard.cjs +361 -0
  94. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -0
  95. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +81 -21
  96. package/dist/chat/super-grouping/SuperGroupingCard.js +361 -0
  97. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -0
  98. package/dist/chat/super-grouping/activity-timeline.cjs +151 -0
  99. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -0
  100. package/dist/chat/super-grouping/activity-timeline.d.ts +91 -0
  101. package/dist/chat/super-grouping/activity-timeline.js +151 -0
  102. package/dist/chat/super-grouping/activity-timeline.js.map +1 -0
  103. package/dist/chat/super-grouping/grouping-function.cjs +55 -0
  104. package/dist/chat/super-grouping/grouping-function.cjs.map +1 -0
  105. package/dist/chat/super-grouping/grouping-function.d.ts +13 -10
  106. package/dist/chat/super-grouping/grouping-function.js +55 -0
  107. package/dist/chat/super-grouping/grouping-function.js.map +1 -0
  108. package/dist/chat/super-grouping/index.cjs +26 -0
  109. package/dist/chat/super-grouping/index.cjs.map +1 -0
  110. package/dist/chat/super-grouping/index.d.ts +12 -0
  111. package/dist/chat/super-grouping/index.js +26 -0
  112. package/dist/chat/super-grouping/index.js.map +1 -0
  113. package/dist/chat/super-grouping/toolkit-map.cjs +96 -0
  114. package/dist/chat/super-grouping/toolkit-map.cjs.map +1 -0
  115. package/dist/chat/super-grouping/toolkit-map.d.ts +8 -1
  116. package/dist/chat/super-grouping/toolkit-map.js +96 -0
  117. package/dist/chat/super-grouping/toolkit-map.js.map +1 -0
  118. package/dist/chat/tiptap-text.cjs +101 -0
  119. package/dist/chat/tiptap-text.cjs.map +1 -0
  120. package/dist/chat/tiptap-text.js +101 -0
  121. package/dist/chat/tiptap-text.js.map +1 -0
  122. package/dist/chat/tooltip-icon-button.cjs +32 -0
  123. package/dist/chat/tooltip-icon-button.cjs.map +1 -0
  124. package/dist/chat/tooltip-icon-button.js +32 -0
  125. package/dist/chat/tooltip-icon-button.js.map +1 -0
  126. package/dist/chat/use-athena-run-live.cjs +23 -0
  127. package/dist/chat/use-athena-run-live.cjs.map +1 -0
  128. package/dist/chat/use-athena-run-live.d.ts +10 -0
  129. package/dist/chat/use-athena-run-live.js +23 -0
  130. package/dist/chat/use-athena-run-live.js.map +1 -0
  131. package/dist/chat/use-statewire-approval-request.cjs +46 -0
  132. package/dist/chat/use-statewire-approval-request.cjs.map +1 -0
  133. package/dist/chat/use-statewire-approval-request.d.ts +44 -0
  134. package/dist/chat/use-statewire-approval-request.js +46 -0
  135. package/dist/chat/use-statewire-approval-request.js.map +1 -0
  136. package/dist/chat-ui/auth/sign-in-card.cjs +128 -0
  137. package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -0
  138. package/dist/chat-ui/auth/sign-in-card.js +128 -0
  139. package/dist/chat-ui/auth/sign-in-card.js.map +1 -0
  140. package/dist/chat-ui/composer/composer-action.cjs +11 -0
  141. package/dist/chat-ui/composer/composer-action.cjs.map +1 -0
  142. package/dist/chat-ui/composer/composer-action.d.ts +5 -8
  143. package/dist/chat-ui/composer/composer-action.js +11 -0
  144. package/dist/chat-ui/composer/composer-action.js.map +1 -0
  145. package/dist/chat-ui/composer/pending-attachment-uploads.cjs +25 -0
  146. package/dist/chat-ui/composer/pending-attachment-uploads.cjs.map +1 -0
  147. package/dist/chat-ui/composer/pending-attachment-uploads.js +25 -0
  148. package/dist/chat-ui/composer/pending-attachment-uploads.js.map +1 -0
  149. package/dist/chat-ui/composer/tiptap-composer.cjs +590 -0
  150. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -0
  151. package/dist/chat-ui/composer/tiptap-composer.d.ts +44 -7
  152. package/dist/chat-ui/composer/tiptap-composer.js +590 -0
  153. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -0
  154. package/dist/chat-ui/header/chat-header.cjs +33 -0
  155. package/dist/chat-ui/header/chat-header.cjs.map +1 -0
  156. package/dist/chat-ui/header/chat-header.js +33 -0
  157. package/dist/chat-ui/header/chat-header.js.map +1 -0
  158. package/dist/chat-ui/header/conversation-history-panel.cjs +369 -0
  159. package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -0
  160. package/dist/chat-ui/header/conversation-history-panel.d.ts +11 -1
  161. package/dist/chat-ui/header/conversation-history-panel.js +369 -0
  162. package/dist/chat-ui/header/conversation-history-panel.js.map +1 -0
  163. package/dist/chat-ui/index.cjs +139 -0
  164. package/dist/chat-ui/index.cjs.map +1 -0
  165. package/dist/chat-ui/index.d.ts +11 -4
  166. package/dist/chat-ui/index.js +139 -0
  167. package/dist/chat-ui/index.js.map +1 -0
  168. package/dist/chat-ui/lib/asset-urls.cjs +18 -0
  169. package/dist/chat-ui/lib/asset-urls.cjs.map +1 -0
  170. package/dist/chat-ui/lib/asset-urls.js +18 -0
  171. package/dist/chat-ui/lib/asset-urls.js.map +1 -0
  172. package/dist/chat-ui/mentions/mention-chip.cjs +208 -0
  173. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -0
  174. package/dist/chat-ui/mentions/mention-chip.js +208 -0
  175. package/dist/chat-ui/mentions/mention-chip.js.map +1 -0
  176. package/dist/chat-ui/mentions/mention-extension.cjs +184 -0
  177. package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -0
  178. package/dist/chat-ui/mentions/mention-extension.d.ts +24 -2
  179. package/dist/chat-ui/mentions/mention-extension.js +184 -0
  180. package/dist/chat-ui/mentions/mention-extension.js.map +1 -0
  181. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +35 -0
  182. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -0
  183. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +35 -0
  184. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -0
  185. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +95 -0
  186. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -0
  187. package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +5 -0
  188. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +95 -0
  189. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -0
  190. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +116 -0
  191. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -0
  192. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +116 -0
  193. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -0
  194. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +31 -0
  195. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -0
  196. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.js +31 -0
  197. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.js.map +1 -0
  198. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.cjs +27 -0
  199. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.cjs.map +1 -0
  200. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.js +27 -0
  201. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.js.map +1 -0
  202. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +62 -0
  203. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -0
  204. package/dist/chat-ui/mentions/suggestions/components/menu-item.js +62 -0
  205. package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -0
  206. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +63 -0
  207. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -0
  208. package/dist/chat-ui/mentions/suggestions/components/menu-list.js +63 -0
  209. package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -0
  210. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.cjs +11 -0
  211. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.cjs.map +1 -0
  212. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.js +11 -0
  213. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.js.map +1 -0
  214. package/dist/chat-ui/mentions/suggestions/components/menu-summary.cjs +33 -0
  215. package/dist/chat-ui/mentions/suggestions/components/menu-summary.cjs.map +1 -0
  216. package/dist/chat-ui/mentions/suggestions/components/menu-summary.js +33 -0
  217. package/dist/chat-ui/mentions/suggestions/components/menu-summary.js.map +1 -0
  218. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +58 -0
  219. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -0
  220. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.js +58 -0
  221. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.js.map +1 -0
  222. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +81 -0
  223. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -0
  224. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.js +81 -0
  225. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.js.map +1 -0
  226. package/dist/chat-ui/mentions/suggestions/components/utils.cjs +18 -0
  227. package/dist/chat-ui/mentions/suggestions/components/utils.cjs.map +1 -0
  228. package/dist/chat-ui/mentions/suggestions/components/utils.js +18 -0
  229. package/dist/chat-ui/mentions/suggestions/components/utils.js.map +1 -0
  230. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +123 -0
  231. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -0
  232. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +10 -0
  233. package/dist/chat-ui/mentions/suggestions/data/api-client.js +123 -0
  234. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -0
  235. package/dist/chat-ui/mentions/suggestions/data/item-cache.cjs +37 -0
  236. package/dist/chat-ui/mentions/suggestions/data/item-cache.cjs.map +1 -0
  237. package/dist/chat-ui/mentions/suggestions/data/item-cache.js +37 -0
  238. package/dist/chat-ui/mentions/suggestions/data/item-cache.js.map +1 -0
  239. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +134 -0
  240. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -0
  241. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +134 -0
  242. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -0
  243. package/dist/chat-ui/mentions/suggestions/data/scope-registry.cjs +91 -0
  244. package/dist/chat-ui/mentions/suggestions/data/scope-registry.cjs.map +1 -0
  245. package/dist/chat-ui/mentions/suggestions/data/scope-registry.js +91 -0
  246. package/dist/chat-ui/mentions/suggestions/data/scope-registry.js.map +1 -0
  247. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +137 -0
  248. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -0
  249. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +137 -0
  250. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -0
  251. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +375 -0
  252. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -0
  253. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +16 -1
  254. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +375 -0
  255. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -0
  256. package/dist/chat-ui/mentions/suggestions/data/types.cjs +9 -0
  257. package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -0
  258. package/dist/chat-ui/mentions/suggestions/data/types.d.ts +14 -0
  259. package/dist/chat-ui/mentions/suggestions/data/types.js +9 -0
  260. package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -0
  261. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +173 -0
  262. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -0
  263. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +14 -4
  264. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +173 -0
  265. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -0
  266. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +45 -0
  267. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -0
  268. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +45 -0
  269. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -0
  270. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.cjs +43 -0
  271. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.cjs.map +1 -0
  272. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.js +43 -0
  273. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.js.map +1 -0
  274. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.cjs +14 -0
  275. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.cjs.map +1 -0
  276. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.js +14 -0
  277. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.js.map +1 -0
  278. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.cjs +48 -0
  279. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.cjs.map +1 -0
  280. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.js +48 -0
  281. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.js.map +1 -0
  282. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +71 -0
  283. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -0
  284. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +71 -0
  285. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -0
  286. package/dist/chat-ui/mentions/suggestions/shims.d.ts +0 -4
  287. package/dist/chat-ui/messages/continue-pill.cjs +54 -0
  288. package/dist/chat-ui/messages/continue-pill.cjs.map +1 -0
  289. package/dist/chat-ui/messages/continue-pill.js +54 -0
  290. package/dist/chat-ui/messages/continue-pill.js.map +1 -0
  291. package/dist/chat-ui/messages/message-actions-config.cjs +12 -0
  292. package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -0
  293. package/dist/chat-ui/messages/message-actions-config.js +12 -0
  294. package/dist/chat-ui/messages/message-actions-config.js.map +1 -0
  295. package/dist/chat-ui/messages/message-components.cjs +343 -0
  296. package/dist/chat-ui/messages/message-components.cjs.map +1 -0
  297. package/dist/chat-ui/messages/message-components.d.ts +13 -1
  298. package/dist/chat-ui/messages/message-components.js +343 -0
  299. package/dist/chat-ui/messages/message-components.js.map +1 -0
  300. package/dist/chat-ui/messages/running-indicator.cjs +49 -0
  301. package/dist/chat-ui/messages/running-indicator.cjs.map +1 -0
  302. package/dist/chat-ui/messages/running-indicator.js +49 -0
  303. package/dist/chat-ui/messages/running-indicator.js.map +1 -0
  304. package/dist/chat-ui/messages/runtime-message.cjs +65 -0
  305. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -0
  306. package/dist/chat-ui/messages/runtime-message.d.ts +2 -3
  307. package/dist/chat-ui/messages/runtime-message.js +65 -0
  308. package/dist/chat-ui/messages/runtime-message.js.map +1 -0
  309. package/dist/chat-ui/messages/statewire-continue-run.cjs +154 -0
  310. package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -0
  311. package/dist/chat-ui/messages/statewire-continue-run.d.ts +52 -7
  312. package/dist/chat-ui/messages/statewire-continue-run.js +154 -0
  313. package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -0
  314. package/dist/chat-ui/messages/user-edit-composer.cjs +61 -0
  315. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -0
  316. package/dist/chat-ui/messages/user-edit-composer.d.ts +5 -2
  317. package/dist/chat-ui/messages/user-edit-composer.js +61 -0
  318. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -0
  319. package/dist/chat-ui/messages/voice-delegation-card.cjs +51 -0
  320. package/dist/chat-ui/messages/voice-delegation-card.cjs.map +1 -0
  321. package/dist/chat-ui/messages/voice-delegation-card.d.ts +26 -0
  322. package/dist/chat-ui/messages/voice-delegation-card.js +51 -0
  323. package/dist/chat-ui/messages/voice-delegation-card.js.map +1 -0
  324. package/dist/chat-ui/statewire.cjs +39 -0
  325. package/dist/chat-ui/statewire.cjs.map +1 -0
  326. package/dist/chat-ui/statewire.d.ts +19 -0
  327. package/dist/chat-ui/statewire.js +39 -0
  328. package/dist/chat-ui/statewire.js.map +1 -0
  329. package/dist/chat-ui/thread/chat-composer-dock.cjs +37 -0
  330. package/dist/chat-ui/thread/chat-composer-dock.cjs.map +1 -0
  331. package/dist/chat-ui/thread/chat-composer-dock.js +37 -0
  332. package/dist/chat-ui/thread/chat-composer-dock.js.map +1 -0
  333. package/dist/chat-ui/thread/chat-thread-shell.cjs +102 -0
  334. package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -0
  335. package/dist/chat-ui/thread/chat-thread-shell.d.ts +7 -1
  336. package/dist/chat-ui/thread/chat-thread-shell.js +102 -0
  337. package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -0
  338. package/dist/chat-ui/thread/composer-send-or-stop.cjs +75 -0
  339. package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -0
  340. package/dist/chat-ui/thread/composer-send-or-stop.d.ts +0 -6
  341. package/dist/chat-ui/thread/composer-send-or-stop.js +75 -0
  342. package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -0
  343. package/dist/chat-ui/thread/statewire-history-edge.cjs +134 -0
  344. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -0
  345. package/dist/chat-ui/thread/statewire-history-edge.d.ts +52 -0
  346. package/dist/chat-ui/thread/statewire-history-edge.js +134 -0
  347. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -0
  348. package/dist/{collab.cjs → collab/client.cjs} +6 -166
  349. package/dist/collab/client.cjs.map +1 -0
  350. package/dist/{collab.js → collab/client.js} +5 -164
  351. package/dist/collab/client.js.map +1 -0
  352. package/dist/collab/close-policy.cjs +14 -0
  353. package/dist/collab/close-policy.cjs.map +1 -0
  354. package/dist/collab/close-policy.js +14 -0
  355. package/dist/collab/close-policy.js.map +1 -0
  356. package/dist/collab/index.cjs +17 -0
  357. package/dist/collab/index.cjs.map +1 -0
  358. package/dist/collab/index.js +17 -0
  359. package/dist/collab/index.js.map +1 -0
  360. package/dist/collab/mint.cjs +59 -0
  361. package/dist/collab/mint.cjs.map +1 -0
  362. package/dist/collab/mint.js +59 -0
  363. package/dist/collab/mint.js.map +1 -0
  364. package/dist/collab/react.cjs +58 -0
  365. package/dist/collab/react.cjs.map +1 -0
  366. package/dist/collab/react.js +58 -0
  367. package/dist/collab/react.js.map +1 -0
  368. package/dist/collab/shape.cjs +45 -0
  369. package/dist/collab/shape.cjs.map +1 -0
  370. package/dist/collab/shape.js +45 -0
  371. package/dist/collab/shape.js.map +1 -0
  372. package/dist/composer/AttachmentContext.cjs +40 -0
  373. package/dist/composer/AttachmentContext.cjs.map +1 -0
  374. package/dist/composer/AttachmentContext.js +40 -0
  375. package/dist/composer/AttachmentContext.js.map +1 -0
  376. package/dist/composer/ComposerAttachmentPreview.cjs +39 -0
  377. package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -0
  378. package/dist/composer/ComposerAttachmentPreview.js +39 -0
  379. package/dist/composer/ComposerAttachmentPreview.js.map +1 -0
  380. package/dist/composer/ComposerDropZone.cjs +61 -0
  381. package/dist/composer/ComposerDropZone.cjs.map +1 -0
  382. package/dist/composer/ComposerDropZone.d.ts +1 -1
  383. package/dist/composer/ComposerDropZone.js +61 -0
  384. package/dist/composer/ComposerDropZone.js.map +1 -0
  385. package/dist/composer/ComposerQuotePreview.cjs +42 -0
  386. package/dist/composer/ComposerQuotePreview.cjs.map +1 -0
  387. package/dist/composer/ComposerQuotePreview.js +42 -0
  388. package/dist/composer/ComposerQuotePreview.js.map +1 -0
  389. package/dist/composer/FileUploadButton.cjs +65 -0
  390. package/dist/composer/FileUploadButton.cjs.map +1 -0
  391. package/dist/composer/FileUploadButton.d.ts +1 -1
  392. package/dist/composer/FileUploadButton.js +65 -0
  393. package/dist/composer/FileUploadButton.js.map +1 -0
  394. package/dist/composer/QuoteContext.cjs +68 -0
  395. package/dist/composer/QuoteContext.cjs.map +1 -0
  396. package/dist/composer/QuoteContext.js +68 -0
  397. package/dist/composer/QuoteContext.js.map +1 -0
  398. package/dist/composer/build-composed-message.cjs +25 -0
  399. package/dist/composer/build-composed-message.cjs.map +1 -0
  400. package/dist/composer/build-composed-message.js +25 -0
  401. package/dist/composer/build-composed-message.js.map +1 -0
  402. package/dist/composer/clipboard.cjs +62 -0
  403. package/dist/composer/clipboard.cjs.map +1 -0
  404. package/dist/composer/clipboard.d.ts +27 -3
  405. package/dist/composer/clipboard.js +62 -0
  406. package/dist/composer/clipboard.js.map +1 -0
  407. package/dist/composer/useAppendToComposer.cjs +21 -0
  408. package/dist/composer/useAppendToComposer.cjs.map +1 -0
  409. package/dist/composer/useAppendToComposer.js +21 -0
  410. package/dist/composer/useAppendToComposer.js.map +1 -0
  411. package/dist/composer/useAttachFiles.cjs +40 -0
  412. package/dist/composer/useAttachFiles.cjs.map +1 -0
  413. package/dist/composer/useAttachFiles.d.ts +24 -0
  414. package/dist/composer/useAttachFiles.js +40 -0
  415. package/dist/composer/useAttachFiles.js.map +1 -0
  416. package/dist/composer/useComposerAttachment.cjs +25 -0
  417. package/dist/composer/useComposerAttachment.cjs.map +1 -0
  418. package/dist/composer/useComposerAttachment.js +25 -0
  419. package/dist/composer/useComposerAttachment.js.map +1 -0
  420. package/dist/composer/useFileUpload.cjs +123 -0
  421. package/dist/composer/useFileUpload.cjs.map +1 -0
  422. package/dist/composer/useFileUpload.js +123 -0
  423. package/dist/composer/useFileUpload.js.map +1 -0
  424. package/dist/composer/useSendMessage.cjs +22 -0
  425. package/dist/composer/useSendMessage.cjs.map +1 -0
  426. package/dist/composer/useSendMessage.js +22 -0
  427. package/dist/composer/useSendMessage.js.map +1 -0
  428. package/dist/diagnostics/athena-diagnostics.cjs +329 -0
  429. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -0
  430. package/dist/diagnostics/athena-diagnostics.d.ts +1 -1
  431. package/dist/diagnostics/athena-diagnostics.js +329 -0
  432. package/dist/diagnostics/athena-diagnostics.js.map +1 -0
  433. package/dist/diagnostics/errors.cjs +89 -0
  434. package/dist/diagnostics/errors.cjs.map +1 -0
  435. package/dist/diagnostics/errors.d.ts +4 -0
  436. package/dist/diagnostics/errors.js +89 -0
  437. package/dist/diagnostics/errors.js.map +1 -0
  438. package/dist/diagnostics/useAthenaDiagnostics.cjs +16 -0
  439. package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -0
  440. package/dist/diagnostics/useAthenaDiagnostics.js +16 -0
  441. package/dist/diagnostics/useAthenaDiagnostics.js.map +1 -0
  442. package/dist/index.cjs +283 -30852
  443. package/dist/index.cjs.map +1 -1
  444. package/dist/index.d.ts +27 -10
  445. package/dist/index.js +155 -30711
  446. package/dist/index.js.map +1 -1
  447. package/dist/lib/athena-urls.cjs +194 -0
  448. package/dist/lib/athena-urls.cjs.map +1 -0
  449. package/dist/lib/athena-urls.d.ts +20 -5
  450. package/dist/lib/athena-urls.js +194 -0
  451. package/dist/lib/athena-urls.js.map +1 -0
  452. package/dist/lib/posthog/before-send.cjs +58 -0
  453. package/dist/lib/posthog/before-send.cjs.map +1 -0
  454. package/dist/lib/posthog/before-send.js +58 -0
  455. package/dist/lib/posthog/before-send.js.map +1 -0
  456. package/dist/lib/posthog/capture-gate.cjs +322 -0
  457. package/dist/lib/posthog/capture-gate.cjs.map +1 -0
  458. package/dist/lib/posthog/capture-gate.js +322 -0
  459. package/dist/lib/posthog/capture-gate.js.map +1 -0
  460. package/dist/lib/posthog/wrap-posthog-client.cjs +163 -0
  461. package/dist/lib/posthog/wrap-posthog-client.cjs.map +1 -0
  462. package/dist/lib/posthog/wrap-posthog-client.js +163 -0
  463. package/dist/lib/posthog/wrap-posthog-client.js.map +1 -0
  464. package/dist/lib/utils.cjs +12 -0
  465. package/dist/lib/utils.cjs.map +1 -0
  466. package/dist/lib/utils.js +9 -0
  467. package/dist/lib/utils.js.map +1 -0
  468. package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.cjs +77 -0
  469. package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.cjs.map +1 -0
  470. package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.js +77 -0
  471. package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.js.map +1 -0
  472. package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.cjs +181 -0
  473. package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.cjs.map +1 -0
  474. package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.js +181 -0
  475. package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.js.map +1 -0
  476. package/dist/packages/agent-runtime/src/asset-attachment.cjs +19 -0
  477. package/dist/packages/agent-runtime/src/asset-attachment.cjs.map +1 -0
  478. package/dist/packages/agent-runtime/src/asset-attachment.js +19 -0
  479. package/dist/packages/agent-runtime/src/asset-attachment.js.map +1 -0
  480. package/dist/packages/agent-runtime/src/auth-denial.cjs +28 -0
  481. package/dist/packages/agent-runtime/src/auth-denial.cjs.map +1 -0
  482. package/dist/packages/agent-runtime/src/auth-denial.js +28 -0
  483. package/dist/packages/agent-runtime/src/auth-denial.js.map +1 -0
  484. package/dist/packages/agent-runtime/src/client-tool-bridge.cjs +270 -0
  485. package/dist/packages/agent-runtime/src/client-tool-bridge.cjs.map +1 -0
  486. package/dist/packages/agent-runtime/src/client-tool-bridge.js +270 -0
  487. package/dist/packages/agent-runtime/src/client-tool-bridge.js.map +1 -0
  488. package/dist/packages/agent-runtime/src/client-tools.cjs +137 -0
  489. package/dist/packages/agent-runtime/src/client-tools.cjs.map +1 -0
  490. package/dist/packages/agent-runtime/src/client-tools.js +137 -0
  491. package/dist/packages/agent-runtime/src/client-tools.js.map +1 -0
  492. package/dist/packages/agent-runtime/src/conversation-index.cjs +80 -0
  493. package/dist/packages/agent-runtime/src/conversation-index.cjs.map +1 -0
  494. package/dist/packages/agent-runtime/src/conversation-index.js +80 -0
  495. package/dist/packages/agent-runtime/src/conversation-index.js.map +1 -0
  496. package/dist/packages/agent-runtime/src/conversation-list.cjs +86 -0
  497. package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -0
  498. package/dist/packages/agent-runtime/src/conversation-list.js +86 -0
  499. package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -0
  500. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs +55 -0
  501. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -0
  502. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js +55 -0
  503. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -0
  504. package/dist/packages/agent-runtime/src/edit-command.cjs +89 -0
  505. package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -0
  506. package/dist/packages/agent-runtime/src/edit-command.js +89 -0
  507. package/dist/packages/agent-runtime/src/edit-command.js.map +1 -0
  508. package/dist/packages/agent-runtime/src/errors.cjs +95 -0
  509. package/dist/packages/agent-runtime/src/errors.cjs.map +1 -0
  510. package/dist/packages/agent-runtime/src/errors.js +95 -0
  511. package/dist/packages/agent-runtime/src/errors.js.map +1 -0
  512. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +236 -0
  513. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -0
  514. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +236 -0
  515. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -0
  516. package/dist/packages/agent-runtime/src/interrupts.cjs +117 -0
  517. package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -0
  518. package/dist/packages/agent-runtime/src/interrupts.js +117 -0
  519. package/dist/packages/agent-runtime/src/interrupts.js.map +1 -0
  520. package/dist/packages/agent-runtime/src/message-author.cjs +31 -0
  521. package/dist/packages/agent-runtime/src/message-author.cjs.map +1 -0
  522. package/dist/packages/agent-runtime/src/message-author.js +31 -0
  523. package/dist/packages/agent-runtime/src/message-author.js.map +1 -0
  524. package/dist/packages/agent-runtime/src/message-window.cjs +85 -0
  525. package/dist/packages/agent-runtime/src/message-window.cjs.map +1 -0
  526. package/dist/packages/agent-runtime/src/message-window.js +85 -0
  527. package/dist/packages/agent-runtime/src/message-window.js.map +1 -0
  528. package/dist/packages/agent-runtime/src/messages.cjs +433 -0
  529. package/dist/packages/agent-runtime/src/messages.cjs.map +1 -0
  530. package/dist/packages/agent-runtime/src/messages.js +433 -0
  531. package/dist/packages/agent-runtime/src/messages.js.map +1 -0
  532. package/dist/packages/agent-runtime/src/model-context.cjs +13 -0
  533. package/dist/packages/agent-runtime/src/model-context.cjs.map +1 -0
  534. package/dist/packages/agent-runtime/src/model-context.js +13 -0
  535. package/dist/packages/agent-runtime/src/model-context.js.map +1 -0
  536. package/dist/packages/agent-runtime/src/optimistic-content.cjs +17 -0
  537. package/dist/packages/agent-runtime/src/optimistic-content.cjs.map +1 -0
  538. package/dist/packages/agent-runtime/src/optimistic-content.js +17 -0
  539. package/dist/packages/agent-runtime/src/optimistic-content.js.map +1 -0
  540. package/dist/packages/agent-runtime/src/protocol.cjs +33 -0
  541. package/dist/packages/agent-runtime/src/protocol.cjs.map +1 -0
  542. package/dist/packages/agent-runtime/src/protocol.js +33 -0
  543. package/dist/packages/agent-runtime/src/protocol.js.map +1 -0
  544. package/dist/packages/agent-runtime/src/queue.cjs +67 -0
  545. package/dist/packages/agent-runtime/src/queue.cjs.map +1 -0
  546. package/dist/packages/agent-runtime/src/queue.js +67 -0
  547. package/dist/packages/agent-runtime/src/queue.js.map +1 -0
  548. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +47 -0
  549. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -0
  550. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +47 -0
  551. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -0
  552. package/dist/packages/agent-runtime/src/runtime-messages.cjs +187 -0
  553. package/dist/packages/agent-runtime/src/runtime-messages.cjs.map +1 -0
  554. package/dist/packages/agent-runtime/src/runtime-messages.js +187 -0
  555. package/dist/packages/agent-runtime/src/runtime-messages.js.map +1 -0
  556. package/dist/packages/agent-runtime/src/send-recovery.cjs +128 -0
  557. package/dist/packages/agent-runtime/src/send-recovery.cjs.map +1 -0
  558. package/dist/packages/agent-runtime/src/send-recovery.js +128 -0
  559. package/dist/packages/agent-runtime/src/send-recovery.js.map +1 -0
  560. package/dist/packages/agent-runtime/src/statewire-attach-observer.cjs +249 -0
  561. package/dist/packages/agent-runtime/src/statewire-attach-observer.cjs.map +1 -0
  562. package/dist/packages/agent-runtime/src/statewire-attach-observer.js +249 -0
  563. package/dist/packages/agent-runtime/src/statewire-attach-observer.js.map +1 -0
  564. package/dist/packages/agent-runtime/src/statewire-state.cjs +16 -0
  565. package/dist/packages/agent-runtime/src/statewire-state.cjs.map +1 -0
  566. package/dist/packages/agent-runtime/src/statewire-state.js +16 -0
  567. package/dist/packages/agent-runtime/src/statewire-state.js.map +1 -0
  568. package/dist/packages/agent-runtime/src/statewire-suspended.cjs +41 -0
  569. package/dist/packages/agent-runtime/src/statewire-suspended.cjs.map +1 -0
  570. package/dist/packages/agent-runtime/src/statewire-suspended.js +41 -0
  571. package/dist/packages/agent-runtime/src/statewire-suspended.js.map +1 -0
  572. package/dist/packages/agent-runtime/src/statewire-transport.cjs +6 -0
  573. package/dist/packages/agent-runtime/src/statewire-transport.cjs.map +1 -0
  574. package/dist/packages/agent-runtime/src/statewire-transport.js +6 -0
  575. package/dist/packages/agent-runtime/src/statewire-transport.js.map +1 -0
  576. package/dist/packages/agent-runtime/src/streaming-markdown.cjs +214 -0
  577. package/dist/packages/agent-runtime/src/streaming-markdown.cjs.map +1 -0
  578. package/dist/packages/agent-runtime/src/streaming-markdown.js +214 -0
  579. package/dist/packages/agent-runtime/src/streaming-markdown.js.map +1 -0
  580. package/dist/packages/agent-runtime/src/thread-extras.cjs +38 -0
  581. package/dist/packages/agent-runtime/src/thread-extras.cjs.map +1 -0
  582. package/dist/packages/agent-runtime/src/thread-extras.js +38 -0
  583. package/dist/packages/agent-runtime/src/thread-extras.js.map +1 -0
  584. package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs +90 -0
  585. package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs.map +1 -0
  586. package/dist/packages/agent-runtime/src/thread-snapshot-cache.js +90 -0
  587. package/dist/packages/agent-runtime/src/thread-snapshot-cache.js.map +1 -0
  588. package/dist/packages/agent-runtime/src/thread-status.cjs +49 -0
  589. package/dist/packages/agent-runtime/src/thread-status.cjs.map +1 -0
  590. package/dist/packages/agent-runtime/src/thread-status.js +49 -0
  591. package/dist/packages/agent-runtime/src/thread-status.js.map +1 -0
  592. package/dist/packages/agent-runtime/src/tool-metadata.cjs +1802 -0
  593. package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -0
  594. package/dist/packages/agent-runtime/src/tool-metadata.js +1802 -0
  595. package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -0
  596. package/dist/packages/agent-runtime/src/tool-outputs.cjs +46 -0
  597. package/dist/packages/agent-runtime/src/tool-outputs.cjs.map +1 -0
  598. package/dist/packages/agent-runtime/src/tool-outputs.js +46 -0
  599. package/dist/packages/agent-runtime/src/tool-outputs.js.map +1 -0
  600. package/dist/packages/agent-runtime/src/tool-result.cjs +151 -0
  601. package/dist/packages/agent-runtime/src/tool-result.cjs.map +1 -0
  602. package/dist/packages/agent-runtime/src/tool-result.js +151 -0
  603. package/dist/packages/agent-runtime/src/tool-result.js.map +1 -0
  604. package/dist/packages/agent-runtime/src/use-conversation-list.cjs +139 -0
  605. package/dist/packages/agent-runtime/src/use-conversation-list.cjs.map +1 -0
  606. package/dist/packages/agent-runtime/src/use-conversation-list.js +139 -0
  607. package/dist/packages/agent-runtime/src/use-conversation-list.js.map +1 -0
  608. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs +28 -0
  609. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -0
  610. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js +28 -0
  611. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -0
  612. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs +138 -0
  613. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -0
  614. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js +138 -0
  615. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js.map +1 -0
  616. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs +387 -0
  617. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -0
  618. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js +387 -0
  619. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -0
  620. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs +133 -0
  621. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -0
  622. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js +133 -0
  623. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -0
  624. package/dist/packages/agent-runtime/src/voice-presentation.cjs +37 -0
  625. package/dist/packages/agent-runtime/src/voice-presentation.cjs.map +1 -0
  626. package/dist/packages/agent-runtime/src/voice-presentation.js +37 -0
  627. package/dist/packages/agent-runtime/src/voice-presentation.js.map +1 -0
  628. package/dist/packages/react/package.json.cjs +9 -0
  629. package/dist/packages/react/package.json.cjs.map +1 -0
  630. package/dist/packages/react/package.json.js +9 -0
  631. package/dist/packages/react/package.json.js.map +1 -0
  632. package/dist/{AthenaContext-B1QMhIP-.cjs → provider/AthenaContext.cjs} +5 -4
  633. package/dist/provider/AthenaContext.cjs.map +1 -0
  634. package/dist/{AthenaContext-MOslgOmE.js → provider/AthenaContext.js} +3 -3
  635. package/dist/provider/AthenaContext.js.map +1 -0
  636. package/dist/provider/AthenaProvider.cjs +403 -0
  637. package/dist/provider/AthenaProvider.cjs.map +1 -0
  638. package/dist/provider/AthenaProvider.d.ts +4 -2
  639. package/dist/provider/AthenaProvider.js +403 -0
  640. package/dist/provider/AthenaProvider.js.map +1 -0
  641. package/dist/provider/PostHogProvider.cjs +81 -0
  642. package/dist/provider/PostHogProvider.cjs.map +1 -0
  643. package/dist/provider/PostHogProvider.js +59 -0
  644. package/dist/provider/PostHogProvider.js.map +1 -0
  645. package/dist/provider/config.d.ts +17 -9
  646. package/dist/provider/statewire-lifecycle-context.cjs +10 -0
  647. package/dist/provider/statewire-lifecycle-context.cjs.map +1 -0
  648. package/dist/provider/statewire-lifecycle-context.js +10 -0
  649. package/dist/provider/statewire-lifecycle-context.js.map +1 -0
  650. package/dist/provider/statewire-window-context.cjs +10 -0
  651. package/dist/provider/statewire-window-context.cjs.map +1 -0
  652. package/dist/provider/statewire-window-context.d.ts +12 -0
  653. package/dist/provider/statewire-window-context.js +10 -0
  654. package/dist/provider/statewire-window-context.js.map +1 -0
  655. package/dist/runtime/auth.cjs +309 -0
  656. package/dist/runtime/auth.cjs.map +1 -0
  657. package/dist/runtime/auth.d.ts +19 -18
  658. package/dist/runtime/auth.js +309 -0
  659. package/dist/runtime/auth.js.map +1 -0
  660. package/dist/runtime/statewire-auth-headers.cjs +18 -0
  661. package/dist/runtime/statewire-auth-headers.cjs.map +1 -0
  662. package/dist/runtime/statewire-auth-headers.d.ts +38 -0
  663. package/dist/runtime/statewire-auth-headers.js +18 -0
  664. package/dist/runtime/statewire-auth-headers.js.map +1 -0
  665. package/dist/runtime/statewire-lifecycle.cjs +67 -0
  666. package/dist/runtime/statewire-lifecycle.cjs.map +1 -0
  667. package/dist/runtime/statewire-lifecycle.d.ts +25 -0
  668. package/dist/runtime/statewire-lifecycle.js +67 -0
  669. package/dist/runtime/statewire-lifecycle.js.map +1 -0
  670. package/dist/runtime/statewire-run-config.cjs +68 -0
  671. package/dist/runtime/statewire-run-config.cjs.map +1 -0
  672. package/dist/runtime/statewire-run-config.js +68 -0
  673. package/dist/runtime/statewire-run-config.js.map +1 -0
  674. package/dist/runtime/statewire-session-key.cjs +11 -0
  675. package/dist/runtime/statewire-session-key.cjs.map +1 -0
  676. package/dist/runtime/statewire-session-key.d.ts +13 -0
  677. package/dist/runtime/statewire-session-key.js +11 -0
  678. package/dist/runtime/statewire-session-key.js.map +1 -0
  679. package/dist/runtime/useAthenaStatewireRuntime.cjs +179 -0
  680. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -0
  681. package/dist/runtime/useAthenaStatewireRuntime.d.ts +36 -5
  682. package/dist/runtime/useAthenaStatewireRuntime.js +180 -0
  683. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -0
  684. package/dist/styles.css +1 -1
  685. package/dist/theme/index.cjs +182 -0
  686. package/dist/theme/index.cjs.map +1 -0
  687. package/dist/theme/index.js +182 -0
  688. package/dist/theme/index.js.map +1 -0
  689. package/dist/threads/ThreadList.cjs +55 -0
  690. package/dist/threads/ThreadList.cjs.map +1 -0
  691. package/dist/threads/ThreadList.js +55 -0
  692. package/dist/threads/ThreadList.js.map +1 -0
  693. package/dist/threads/api.cjs +208 -0
  694. package/dist/threads/api.cjs.map +1 -0
  695. package/dist/threads/api.js +208 -0
  696. package/dist/threads/api.js.map +1 -0
  697. package/dist/threads/conversation-list-fetcher.cjs +70 -0
  698. package/dist/threads/conversation-list-fetcher.cjs.map +1 -0
  699. package/dist/threads/conversation-list-fetcher.js +70 -0
  700. package/dist/threads/conversation-list-fetcher.js.map +1 -0
  701. package/dist/threads/mint-thread-id.cjs +7 -0
  702. package/dist/threads/mint-thread-id.cjs.map +1 -0
  703. package/dist/threads/mint-thread-id.d.ts +8 -0
  704. package/dist/threads/mint-thread-id.js +7 -0
  705. package/dist/threads/mint-thread-id.js.map +1 -0
  706. package/dist/threads/statewire-thread-list.cjs +231 -0
  707. package/dist/threads/statewire-thread-list.cjs.map +1 -0
  708. package/dist/threads/statewire-thread-list.d.ts +20 -4
  709. package/dist/threads/statewire-thread-list.js +231 -0
  710. package/dist/threads/statewire-thread-list.js.map +1 -0
  711. package/dist/threads/thread-id-context.cjs +22 -0
  712. package/dist/threads/thread-id-context.cjs.map +1 -0
  713. package/dist/threads/thread-id-context.d.ts +9 -0
  714. package/dist/threads/thread-id-context.js +22 -0
  715. package/dist/threads/thread-id-context.js.map +1 -0
  716. package/dist/threads/title.cjs +95 -0
  717. package/dist/threads/title.cjs.map +1 -0
  718. package/dist/threads/title.js +95 -0
  719. package/dist/threads/title.js.map +1 -0
  720. package/dist/threads/use-rest-conversation-history.cjs +79 -0
  721. package/dist/threads/use-rest-conversation-history.cjs.map +1 -0
  722. package/dist/threads/use-rest-conversation-history.js +79 -0
  723. package/dist/threads/use-rest-conversation-history.js.map +1 -0
  724. package/dist/threads/use-statewire-conversation-history.cjs +243 -0
  725. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -0
  726. package/dist/threads/use-statewire-conversation-history.js +243 -0
  727. package/dist/threads/use-statewire-conversation-history.js.map +1 -0
  728. package/dist/threads/useAthenaThreadManager.cjs +24 -0
  729. package/dist/threads/useAthenaThreadManager.cjs.map +1 -0
  730. package/dist/threads/useAthenaThreadManager.js +24 -0
  731. package/dist/threads/useAthenaThreadManager.js.map +1 -0
  732. package/dist/toolkits/index.cjs +279 -0
  733. package/dist/toolkits/index.cjs.map +1 -0
  734. package/dist/toolkits/index.js +279 -0
  735. package/dist/toolkits/index.js.map +1 -0
  736. package/dist/tools/NestedPtcMessages.cjs +46 -0
  737. package/dist/tools/NestedPtcMessages.cjs.map +1 -0
  738. package/dist/tools/NestedPtcMessages.js +46 -0
  739. package/dist/tools/NestedPtcMessages.js.map +1 -0
  740. package/dist/tools/append-document-tool-ui.cjs +145 -0
  741. package/dist/tools/append-document-tool-ui.cjs.map +1 -0
  742. package/dist/tools/append-document-tool-ui.js +145 -0
  743. package/dist/tools/append-document-tool-ui.js.map +1 -0
  744. package/dist/tools/asset-utils.cjs +16 -0
  745. package/dist/tools/asset-utils.cjs.map +1 -0
  746. package/dist/tools/asset-utils.js +16 -0
  747. package/dist/tools/asset-utils.js.map +1 -0
  748. package/dist/tools/auto-open-tools.cjs +121 -0
  749. package/dist/tools/auto-open-tools.cjs.map +1 -0
  750. package/dist/tools/auto-open-tools.js +121 -0
  751. package/dist/tools/auto-open-tools.js.map +1 -0
  752. package/dist/tools/file-tool-uis.cjs +108 -0
  753. package/dist/tools/file-tool-uis.cjs.map +1 -0
  754. package/dist/tools/file-tool-uis.js +108 -0
  755. package/dist/tools/file-tool-uis.js.map +1 -0
  756. package/dist/tools/index.cjs +56 -0
  757. package/dist/tools/index.cjs.map +1 -0
  758. package/dist/tools/index.d.ts +15 -0
  759. package/dist/tools/index.js +56 -0
  760. package/dist/tools/index.js.map +1 -0
  761. package/dist/tools/misc-tool-uis.cjs +54 -0
  762. package/dist/tools/misc-tool-uis.cjs.map +1 -0
  763. package/dist/tools/misc-tool-uis.d.ts +2 -0
  764. package/dist/tools/misc-tool-uis.js +54 -0
  765. package/dist/tools/misc-tool-uis.js.map +1 -0
  766. package/dist/tools/primitives.cjs +166 -0
  767. package/dist/tools/primitives.cjs.map +1 -0
  768. package/dist/tools/primitives.d.ts +41 -0
  769. package/dist/tools/primitives.js +166 -0
  770. package/dist/tools/primitives.js.map +1 -0
  771. package/dist/tools/read-asset-tool-ui.cjs +284 -0
  772. package/dist/tools/read-asset-tool-ui.cjs.map +1 -0
  773. package/dist/tools/read-asset-tool-ui.js +284 -0
  774. package/dist/tools/read-asset-tool-ui.js.map +1 -0
  775. package/dist/tools/todo-plan-store.cjs +88 -0
  776. package/dist/tools/todo-plan-store.cjs.map +1 -0
  777. package/dist/tools/todo-plan-store.js +88 -0
  778. package/dist/tools/todo-plan-store.js.map +1 -0
  779. package/dist/tools/tool-fallback.cjs +667 -0
  780. package/dist/tools/tool-fallback.cjs.map +1 -0
  781. package/dist/tools/tool-fallback.d.ts +78 -6
  782. package/dist/tools/tool-fallback.js +667 -0
  783. package/dist/tools/tool-fallback.js.map +1 -0
  784. package/dist/tools/tool-icons.cjs +61 -0
  785. package/dist/tools/tool-icons.cjs.map +1 -0
  786. package/dist/tools/tool-icons.d.ts +10 -0
  787. package/dist/tools/tool-icons.js +61 -0
  788. package/dist/tools/tool-icons.js.map +1 -0
  789. package/dist/tools/tool-uis.cjs +3049 -0
  790. package/dist/tools/tool-uis.cjs.map +1 -0
  791. package/dist/tools/tool-uis.d.ts +1 -23
  792. package/dist/tools/tool-uis.js +3049 -0
  793. package/dist/tools/tool-uis.js.map +1 -0
  794. package/dist/tools/voice-update-tool-ui.cjs +89 -0
  795. package/dist/tools/voice-update-tool-ui.cjs.map +1 -0
  796. package/dist/tools/voice-update-tool-ui.d.ts +27 -0
  797. package/dist/tools/voice-update-tool-ui.js +89 -0
  798. package/dist/tools/voice-update-tool-ui.js.map +1 -0
  799. package/dist/tools/write-todos-tool-ui.cjs +270 -0
  800. package/dist/tools/write-todos-tool-ui.cjs.map +1 -0
  801. package/dist/tools/write-todos-tool-ui.js +270 -0
  802. package/dist/tools/write-todos-tool-ui.js.map +1 -0
  803. package/dist/ui/button.cjs +57 -0
  804. package/dist/ui/button.cjs.map +1 -0
  805. package/dist/ui/button.js +57 -0
  806. package/dist/ui/button.js.map +1 -0
  807. package/dist/ui/collapsible.cjs +17 -0
  808. package/dist/ui/collapsible.cjs.map +1 -0
  809. package/dist/ui/collapsible.js +17 -0
  810. package/dist/ui/collapsible.js.map +1 -0
  811. package/dist/ui/tooltip.cjs +48 -0
  812. package/dist/ui/tooltip.cjs.map +1 -0
  813. package/dist/ui/tooltip.js +48 -0
  814. package/dist/ui/tooltip.js.map +1 -0
  815. package/dist/version.cjs +6 -0
  816. package/dist/version.cjs.map +1 -0
  817. package/dist/version.js +6 -0
  818. package/dist/version.js.map +1 -0
  819. package/package.json +35 -19
  820. package/dist/AthenaAuthContext-B3AwLA5Z.cjs.map +0 -1
  821. package/dist/AthenaAuthContext-DQsdayH2.js.map +0 -1
  822. package/dist/AthenaContext-B1QMhIP-.cjs.map +0 -1
  823. package/dist/AthenaContext-MOslgOmE.js.map +0 -1
  824. package/dist/auth.cjs.map +0 -1
  825. package/dist/auth.js.map +0 -1
  826. package/dist/chat/ComposerEditorContext.d.ts +0 -36
  827. package/dist/chat/super-grouping/tool-status-labels.d.ts +0 -1
  828. package/dist/chat/tiptap-composer.d.ts +0 -7
  829. package/dist/chat-ui.cjs +0 -2667
  830. package/dist/chat-ui.cjs.map +0 -1
  831. package/dist/chat-ui.js +0 -2668
  832. package/dist/chat-ui.js.map +0 -1
  833. package/dist/collab.cjs.map +0 -1
  834. package/dist/collab.js.map +0 -1
  835. package/dist/mentions/composer-keybinds.d.ts +0 -5
  836. package/dist/mentions/mention-extension.d.ts +0 -6
  837. package/dist/mentions/mention-icons.d.ts +0 -4
  838. package/dist/mentions/mention-node-view.d.ts +0 -2
  839. package/dist/mentions/mention-suggestion-list.d.ts +0 -14
  840. package/dist/mentions/mention-suggestion-popup.d.ts +0 -15
  841. package/dist/mentions/mention-suggestions-extension.d.ts +0 -11
  842. package/dist/mentions/mention-types.d.ts +0 -21
  843. package/dist/mentions/mention-utils.d.ts +0 -23
  844. package/dist/mentions/use-mention-suggestions.d.ts +0 -29
  845. package/dist/use-rest-conversation-history-Bs5qn5G3.js +0 -37322
  846. package/dist/use-rest-conversation-history-Bs5qn5G3.js.map +0 -1
  847. package/dist/use-rest-conversation-history-Dm0rdQgT.cjs +0 -37358
  848. package/dist/use-rest-conversation-history-Dm0rdQgT.cjs.map +0 -1
package/dist/chat-ui.cjs DELETED
@@ -1,2667 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
- const useRestConversationHistory = require("./use-rest-conversation-history-Dm0rdQgT.cjs");
7
- const jsxRuntime = require("react/jsx-runtime");
8
- const React = require("react");
9
- const react = require("@assistant-ui/react");
10
- require("@assistant-ui/tap");
11
- require("statewire");
12
- require("@assistant-ui/store");
13
- const reactStatewire = require("@assistant-ui/react-statewire");
14
- require("@assistant-ui/core");
15
- const mentionHandlersByThread = /* @__PURE__ */ new Map();
16
- function registerChatAssetMentionHandler(threadId, handler) {
17
- mentionHandlersByThread.set(threadId, handler);
18
- return () => {
19
- if (mentionHandlersByThread.get(threadId) === handler) {
20
- mentionHandlersByThread.delete(threadId);
21
- }
22
- };
23
- }
24
- /**
25
- * @license lucide-react v0.575.0 - ISC
26
- *
27
- * This source code is licensed under the ISC license.
28
- * See the LICENSE file in the root directory of this source tree.
29
- */
30
- const __iconNode$m = [
31
- ["rect", { width: "20", height: "5", x: "2", y: "3", rx: "1", key: "1wp1u1" }],
32
- ["path", { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8", key: "1s80jp" }],
33
- ["path", { d: "M10 12h4", key: "a56b0p" }]
34
- ];
35
- const Archive = useRestConversationHistory.createLucideIcon("archive", __iconNode$m);
36
- /**
37
- * @license lucide-react v0.575.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */
42
- const __iconNode$l = [
43
- ["path", { d: "M12 8V4H8", key: "hb8ula" }],
44
- ["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2", key: "enze0r" }],
45
- ["path", { d: "M2 14h2", key: "vft8re" }],
46
- ["path", { d: "M20 14h2", key: "4cs60a" }],
47
- ["path", { d: "M15 13v2", key: "1xurst" }],
48
- ["path", { d: "M9 13v2", key: "rq6x2g" }]
49
- ];
50
- const Bot = useRestConversationHistory.createLucideIcon("bot", __iconNode$l);
51
- /**
52
- * @license lucide-react v0.575.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */
57
- const __iconNode$k = [
58
- ["path", { d: "M10 12h4", key: "a56b0p" }],
59
- ["path", { d: "M10 8h4", key: "1sr2af" }],
60
- ["path", { d: "M14 21v-3a2 2 0 0 0-4 0v3", key: "1rgiei" }],
61
- [
62
- "path",
63
- {
64
- d: "M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",
65
- key: "secmi2"
66
- }
67
- ],
68
- ["path", { d: "M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16", key: "16ra0t" }]
69
- ];
70
- const Building2 = useRestConversationHistory.createLucideIcon("building-2", __iconNode$k);
71
- /**
72
- * @license lucide-react v0.575.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */
77
- const __iconNode$j = [
78
- ["path", { d: "M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z", key: "p7xjir" }]
79
- ];
80
- const Cloud = useRestConversationHistory.createLucideIcon("cloud", __iconNode$j);
81
- /**
82
- * @license lucide-react v0.575.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */
87
- const __iconNode$i = [
88
- [
89
- "path",
90
- {
91
- d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
92
- key: "1nclc0"
93
- }
94
- ],
95
- ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
96
- ];
97
- const Eye = useRestConversationHistory.createLucideIcon("eye", __iconNode$i);
98
- /**
99
- * @license lucide-react v0.575.0 - ISC
100
- *
101
- * This source code is licensed under the ISC license.
102
- * See the LICENSE file in the root directory of this source tree.
103
- */
104
- const __iconNode$h = [
105
- [
106
- "path",
107
- {
108
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
109
- key: "1oefj6"
110
- }
111
- ],
112
- ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
113
- ["path", { d: "M10 12.5 8 15l2 2.5", key: "1tg20x" }],
114
- ["path", { d: "m14 12.5 2 2.5-2 2.5", key: "yinavb" }]
115
- ];
116
- const FileCode = useRestConversationHistory.createLucideIcon("file-code", __iconNode$h);
117
- /**
118
- * @license lucide-react v0.575.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */
123
- const __iconNode$g = [
124
- [
125
- "path",
126
- {
127
- d: "M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",
128
- key: "1xhozi"
129
- }
130
- ]
131
- ];
132
- const Headphones = useRestConversationHistory.createLucideIcon("headphones", __iconNode$g);
133
- /**
134
- * @license lucide-react v0.575.0 - ISC
135
- *
136
- * This source code is licensed under the ISC license.
137
- * See the LICENSE file in the root directory of this source tree.
138
- */
139
- const __iconNode$f = [
140
- ["path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4", key: "g0fldk" }],
141
- ["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
142
- ["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }]
143
- ];
144
- const Key = useRestConversationHistory.createLucideIcon("key", __iconNode$f);
145
- /**
146
- * @license lucide-react v0.575.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */
151
- const __iconNode$e = [
152
- ["path", { d: "M10 8h.01", key: "1r9ogq" }],
153
- ["path", { d: "M12 12h.01", key: "1mp3jc" }],
154
- ["path", { d: "M14 8h.01", key: "1primd" }],
155
- ["path", { d: "M16 12h.01", key: "1l6xoz" }],
156
- ["path", { d: "M18 8h.01", key: "emo2bl" }],
157
- ["path", { d: "M6 8h.01", key: "x9i8wu" }],
158
- ["path", { d: "M7 16h10", key: "wp8him" }],
159
- ["path", { d: "M8 12h.01", key: "czm47f" }],
160
- ["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }]
161
- ];
162
- const Keyboard = useRestConversationHistory.createLucideIcon("keyboard", __iconNode$e);
163
- /**
164
- * @license lucide-react v0.575.0 - ISC
165
- *
166
- * This source code is licensed under the ISC license.
167
- * See the LICENSE file in the root directory of this source tree.
168
- */
169
- const __iconNode$d = [
170
- ["rect", { width: "7", height: "9", x: "3", y: "3", rx: "1", key: "10lvy0" }],
171
- ["rect", { width: "7", height: "5", x: "14", y: "3", rx: "1", key: "16une8" }],
172
- ["rect", { width: "7", height: "9", x: "14", y: "12", rx: "1", key: "1hutg5" }],
173
- ["rect", { width: "7", height: "5", x: "3", y: "16", rx: "1", key: "ldoo1y" }]
174
- ];
175
- const LayoutDashboard = useRestConversationHistory.createLucideIcon("layout-dashboard", __iconNode$d);
176
- /**
177
- * @license lucide-react v0.575.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */
182
- const __iconNode$c = [
183
- ["path", { d: "m16 6 4 14", key: "ji33uf" }],
184
- ["path", { d: "M12 6v14", key: "1n7gus" }],
185
- ["path", { d: "M8 8v12", key: "1gg7y9" }],
186
- ["path", { d: "M4 4v16", key: "6qkkli" }]
187
- ];
188
- const Library = useRestConversationHistory.createLucideIcon("library", __iconNode$c);
189
- /**
190
- * @license lucide-react v0.575.0 - ISC
191
- *
192
- * This source code is licensed under the ISC license.
193
- * See the LICENSE file in the root directory of this source tree.
194
- */
195
- const __iconNode$b = [
196
- ["path", { d: "M12 19v3", key: "npa21l" }],
197
- ["path", { d: "M19 10v2a7 7 0 0 1-14 0v-2", key: "1vc78b" }],
198
- ["rect", { x: "9", y: "2", width: "6", height: "13", rx: "3", key: "s6n7sd" }]
199
- ];
200
- const Mic = useRestConversationHistory.createLucideIcon("mic", __iconNode$b);
201
- /**
202
- * @license lucide-react v0.575.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */
207
- const __iconNode$a = [
208
- [
209
- "path",
210
- {
211
- d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
212
- key: "e79jfc"
213
- }
214
- ],
215
- ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
216
- ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
217
- ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
218
- ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
219
- ];
220
- const Palette = useRestConversationHistory.createLucideIcon("palette", __iconNode$a);
221
- /**
222
- * @license lucide-react v0.575.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */
227
- const __iconNode$9 = [
228
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
229
- ["path", { d: "M3 9h18", key: "1pudct" }],
230
- ["path", { d: "M9 21V9", key: "1oto5p" }]
231
- ];
232
- const PanelsTopLeft = useRestConversationHistory.createLucideIcon("panels-top-left", __iconNode$9);
233
- /**
234
- * @license lucide-react v0.575.0 - ISC
235
- *
236
- * This source code is licensed under the ISC license.
237
- * See the LICENSE file in the root directory of this source tree.
238
- */
239
- const __iconNode$8 = [
240
- [
241
- "path",
242
- {
243
- d: "M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",
244
- key: "nt11vn"
245
- }
246
- ],
247
- [
248
- "path",
249
- {
250
- d: "m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",
251
- key: "15qc1e"
252
- }
253
- ],
254
- ["path", { d: "m2.3 2.3 7.286 7.286", key: "1wuzzi" }],
255
- ["circle", { cx: "11", cy: "11", r: "2", key: "xmgehs" }]
256
- ];
257
- const PenTool = useRestConversationHistory.createLucideIcon("pen-tool", __iconNode$8);
258
- /**
259
- * @license lucide-react v0.575.0 - ISC
260
- *
261
- * This source code is licensed under the ISC license.
262
- * See the LICENSE file in the root directory of this source tree.
263
- */
264
- const __iconNode$7 = [
265
- [
266
- "path",
267
- {
268
- d: "M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",
269
- key: "9njp5v"
270
- }
271
- ]
272
- ];
273
- const Phone = useRestConversationHistory.createLucideIcon("phone", __iconNode$7);
274
- /**
275
- * @license lucide-react v0.575.0 - ISC
276
- *
277
- * This source code is licensed under the ISC license.
278
- * See the LICENSE file in the root directory of this source tree.
279
- */
280
- const __iconNode$6 = [
281
- ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
282
- ["path", { d: "M12 18h.01", key: "mhygvu" }]
283
- ];
284
- const Smartphone = useRestConversationHistory.createLucideIcon("smartphone", __iconNode$6);
285
- /**
286
- * @license lucide-react v0.575.0 - ISC
287
- *
288
- * This source code is licensed under the ISC license.
289
- * See the LICENSE file in the root directory of this source tree.
290
- */
291
- const __iconNode$5 = [
292
- [
293
- "path",
294
- {
295
- d: "M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",
296
- key: "1s2grr"
297
- }
298
- ],
299
- ["path", { d: "M20 2v4", key: "1rf3ol" }],
300
- ["path", { d: "M22 4h-4", key: "gwowj6" }],
301
- ["circle", { cx: "4", cy: "20", r: "2", key: "6kqj1y" }]
302
- ];
303
- const Sparkles = useRestConversationHistory.createLucideIcon("sparkles", __iconNode$5);
304
- /**
305
- * @license lucide-react v0.575.0 - ISC
306
- *
307
- * This source code is licensed under the ISC license.
308
- * See the LICENSE file in the root directory of this source tree.
309
- */
310
- const __iconNode$4 = [
311
- [
312
- "path",
313
- { d: "M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344", key: "2acyp4" }
314
- ],
315
- ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
316
- ];
317
- const SquareCheckBig = useRestConversationHistory.createLucideIcon("square-check-big", __iconNode$4);
318
- /**
319
- * @license lucide-react v0.575.0 - ISC
320
- *
321
- * This source code is licensed under the ISC license.
322
- * See the LICENSE file in the root directory of this source tree.
323
- */
324
- const __iconNode$3 = [
325
- [
326
- "path",
327
- {
328
- d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
329
- key: "r04s7s"
330
- }
331
- ]
332
- ];
333
- const Star = useRestConversationHistory.createLucideIcon("star", __iconNode$3);
334
- /**
335
- * @license lucide-react v0.575.0 - ISC
336
- *
337
- * This source code is licensed under the ISC license.
338
- * See the LICENSE file in the root directory of this source tree.
339
- */
340
- const __iconNode$2 = [
341
- ["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
342
- ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
343
- ];
344
- const User = useRestConversationHistory.createLucideIcon("user", __iconNode$2);
345
- /**
346
- * @license lucide-react v0.575.0 - ISC
347
- *
348
- * This source code is licensed under the ISC license.
349
- * See the LICENSE file in the root directory of this source tree.
350
- */
351
- const __iconNode$1 = [
352
- [
353
- "path",
354
- {
355
- d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
356
- key: "ftymec"
357
- }
358
- ],
359
- ["rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", key: "158x01" }]
360
- ];
361
- const Video = useRestConversationHistory.createLucideIcon("video", __iconNode$1);
362
- /**
363
- * @license lucide-react v0.575.0 - ISC
364
- *
365
- * This source code is licensed under the ISC license.
366
- * See the LICENSE file in the root directory of this source tree.
367
- */
368
- const __iconNode = [
369
- [
370
- "path",
371
- {
372
- d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",
373
- key: "1xq2db"
374
- }
375
- ]
376
- ];
377
- const Zap = useRestConversationHistory.createLucideIcon("zap", __iconNode);
378
- function ChatHeaderRoot({
379
- children,
380
- className
381
- }) {
382
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: useRestConversationHistory.cn(useRestConversationHistory.THREAD_HEADER_CLASS, className), children });
383
- }
384
- function ChatHeaderIdentity({
385
- children,
386
- className
387
- }) {
388
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: useRestConversationHistory.cn(useRestConversationHistory.THREAD_HEADER_PILL_CLASS, className), children });
389
- }
390
- function ChatHeaderActions({
391
- children,
392
- className
393
- }) {
394
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: useRestConversationHistory.cn(useRestConversationHistory.THREAD_HEADER_ACTIONS_CLASS, className), children });
395
- }
396
- const ChatHeader = {
397
- Root: ChatHeaderRoot,
398
- Identity: ChatHeaderIdentity,
399
- Actions: ChatHeaderActions
400
- };
401
- const TIME_GROUPS = [
402
- "Today",
403
- "Yesterday",
404
- "This Week",
405
- "This Month",
406
- "Older"
407
- ];
408
- const AUTOMATED_SOURCE_CHANNELS = /* @__PURE__ */ new Set([
409
- "api",
410
- "email",
411
- "orchestration",
412
- "slack",
413
- "sms",
414
- "task",
415
- "teams"
416
- ]);
417
- function isAutomatedConversation(conversation) {
418
- var _a, _b;
419
- const sourceChannel = (_a = conversation.sourceChannel) == null ? void 0 : _a.trim().toLowerCase();
420
- if (sourceChannel && AUTOMATED_SOURCE_CHANNELS.has(sourceChannel))
421
- return true;
422
- const triggerType = (_b = conversation.triggerType) == null ? void 0 : _b.trim().toLowerCase();
423
- return Boolean(triggerType && triggerType !== "manual");
424
- }
425
- function conversationTimeGroup(value, now = /* @__PURE__ */ new Date()) {
426
- const date = new Date(value);
427
- if (Number.isNaN(date.getTime())) return "Older";
428
- const startOfToday = new Date(
429
- now.getFullYear(),
430
- now.getMonth(),
431
- now.getDate()
432
- );
433
- const startOfYesterday = new Date(startOfToday.getTime() - 864e5);
434
- const startOfWeek = new Date(
435
- startOfToday.getTime() - startOfToday.getDay() * 864e5
436
- );
437
- const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
438
- if (date >= startOfToday) return "Today";
439
- if (date >= startOfYesterday) return "Yesterday";
440
- if (date >= startOfWeek) return "This Week";
441
- if (date >= startOfMonth) return "This Month";
442
- return "Older";
443
- }
444
- function originKey(conversation) {
445
- return conversation.appId ?? conversation.sourceChannel ?? "unknown";
446
- }
447
- function originLabel(value) {
448
- const normalized = value.toLowerCase();
449
- if (normalized.includes("chrome")) return "Chrome";
450
- if (normalized.includes("powerpoint")) return "PowerPoint";
451
- if (normalized.includes("word")) return "Word";
452
- if (normalized.includes("excel")) return "Excel";
453
- if (normalized.includes("office")) return "Office";
454
- if (normalized === "web" || normalized.includes("olympus")) return "Athena";
455
- if (normalized.includes("mobile")) return "Mobile";
456
- if (value === "unknown") return "Legacy";
457
- return value.replace(/^athena[-_]/, "").replaceAll("_", " ");
458
- }
459
- function relativeTime(value) {
460
- const timestamp = Date.parse(value);
461
- if (!Number.isFinite(timestamp)) return "";
462
- const elapsed = Math.max(0, Date.now() - timestamp);
463
- const minutes = Math.floor(elapsed / 6e4);
464
- if (minutes < 1) return "<1m ago";
465
- if (minutes < 60) return `${minutes}m ago`;
466
- const hours = Math.floor(minutes / 60);
467
- if (hours < 24) return `${hours}h ${minutes % 60}m ago`;
468
- const days = Math.floor(hours / 24);
469
- return days < 7 ? `${days}d ago` : new Date(timestamp).toLocaleDateString();
470
- }
471
- function ConversationTypeIcon({
472
- conversation,
473
- automated
474
- }) {
475
- if (conversation.state === "running") {
476
- return /* @__PURE__ */ jsxRuntime.jsx(
477
- useRestConversationHistory.LoaderCircle,
478
- {
479
- "aria-label": "Conversation running",
480
- className: "mt-0.5 size-4 shrink-0 animate-spin text-primary"
481
- }
482
- );
483
- }
484
- const thumbnail = useRestConversationHistory.assetTypeToThumb(conversation.assetType ?? "session");
485
- if (thumbnail) {
486
- return /* @__PURE__ */ jsxRuntime.jsx("img", { src: thumbnail, alt: "", className: "mt-0.5 size-4 shrink-0" });
487
- }
488
- return automated ? /* @__PURE__ */ jsxRuntime.jsx(Bot, { className: "mt-0.5 size-4 shrink-0 text-primary" }) : /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.MessageSquare, { className: "mt-0.5 size-4 shrink-0 text-emerald-500" });
489
- }
490
- function ConversationHistoryPanel({
491
- conversations,
492
- activeThreadId,
493
- search,
494
- onSearchChange,
495
- activityFilter,
496
- onActivityFilterChange,
497
- originFilter,
498
- onOriginFilterChange,
499
- onSelect,
500
- onNewChat,
501
- onRefresh,
502
- onArchive,
503
- onSetReadState,
504
- isLoading = false,
505
- isRefreshing = false,
506
- hasNextPage = false,
507
- isFetchingNextPage = false,
508
- onLoadMore
509
- }) {
510
- const origins = React.useMemo(
511
- () => [...new Set(conversations.map(originKey))].sort(),
512
- [conversations]
513
- );
514
- const grouped = React.useMemo(() => {
515
- const visible = conversations.filter((conversation) => {
516
- const automated = isAutomatedConversation(conversation);
517
- if (activityFilter === "chat" && automated) return false;
518
- if (activityFilter === "automated" && !automated) return false;
519
- return originFilter === "all" || originKey(conversation) === originFilter;
520
- });
521
- const byGroup = /* @__PURE__ */ new Map();
522
- for (const conversation of visible) {
523
- const group = conversationTimeGroup(conversation.updatedAt);
524
- const items = byGroup.get(group) ?? [];
525
- items.push(conversation);
526
- byGroup.set(group, items);
527
- }
528
- return TIME_GROUPS.flatMap((group) => {
529
- const items = byGroup.get(group);
530
- return items ? [{ group, items }] : [];
531
- });
532
- }, [activityFilter, conversations, originFilter]);
533
- const visibleCount = grouped.reduce(
534
- (count, group) => count + group.items.length,
535
- 0
536
- );
537
- const handleSearch = (event) => onSearchChange(event.target.value);
538
- return /* @__PURE__ */ jsxRuntime.jsxs(
539
- "section",
540
- {
541
- "aria-label": "Conversation history",
542
- className: "border-b border-border bg-background px-2 pb-2",
543
- "data-testid": "conversation-history-panel",
544
- children: [
545
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-10 items-center gap-1.5 px-1", children: [
546
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground", children: "Sessions" }),
547
- /* @__PURE__ */ jsxRuntime.jsx(
548
- "button",
549
- {
550
- type: "button",
551
- "aria-label": "Refresh sessions",
552
- title: "Refresh sessions",
553
- disabled: isRefreshing,
554
- onClick: onRefresh,
555
- className: "ml-auto rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50",
556
- children: /* @__PURE__ */ jsxRuntime.jsx(
557
- useRestConversationHistory.RefreshCw,
558
- {
559
- className: useRestConversationHistory.cn("size-3.5", isRefreshing && "animate-spin")
560
- }
561
- )
562
- }
563
- ),
564
- /* @__PURE__ */ jsxRuntime.jsxs(
565
- "button",
566
- {
567
- type: "button",
568
- onClick: onNewChat,
569
- className: "flex h-7 shrink-0 items-center gap-1 rounded-md bg-primary px-2 text-[11px] font-medium text-primary-foreground",
570
- children: [
571
- /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.Plus, { className: "size-3" }),
572
- " New"
573
- ]
574
- }
575
- )
576
- ] }),
577
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "relative block min-w-0 px-1 pb-2", children: [
578
- /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.Search, { className: "pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-[calc(50%+0.25rem)] text-muted-foreground" }),
579
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Search sessions" }),
580
- /* @__PURE__ */ jsxRuntime.jsx(
581
- "input",
582
- {
583
- value: search,
584
- onChange: handleSearch,
585
- placeholder: "Search sessions...",
586
- className: "h-8 w-full rounded-md border border-border bg-muted/40 pl-7 pr-2 text-xs outline-none focus:border-primary focus:bg-background"
587
- }
588
- )
589
- ] }),
590
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 overflow-x-auto px-1 pb-2 text-[11px]", children: [
591
- ["all", "chat", "automated"].map((filter) => /* @__PURE__ */ jsxRuntime.jsx(
592
- "button",
593
- {
594
- type: "button",
595
- onClick: () => onActivityFilterChange(filter),
596
- className: useRestConversationHistory.cn(
597
- "rounded-full border px-2 py-1 capitalize",
598
- activityFilter === filter ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground"
599
- ),
600
- children: filter === "chat" ? "Chats" : filter === "automated" ? "Automations" : "All"
601
- },
602
- filter
603
- )),
604
- /* @__PURE__ */ jsxRuntime.jsxs(
605
- "select",
606
- {
607
- "aria-label": "Filter by origin",
608
- value: originFilter,
609
- onChange: (event) => onOriginFilterChange(event.target.value),
610
- className: "ml-auto rounded-full border border-border bg-background px-2 text-[11px] text-muted-foreground",
611
- children: [
612
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All origins" }),
613
- origins.map((origin) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: origin, children: originLabel(origin) }, origin))
614
- ]
615
- }
616
- )
617
- ] }),
618
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-[min(60vh,28rem)] overflow-y-auto px-0.5", children: [
619
- isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-2 py-4 text-xs text-muted-foreground", children: [
620
- /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.LoaderCircle, { className: "size-3.5 animate-spin" }),
621
- " Loading sessions…"
622
- ] }) : visibleCount === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-4 text-xs text-muted-foreground", children: "No matching sessions." }) : grouped.map(({ group, items }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
623
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "px-2 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/75", children: group }),
624
- items.map((conversation) => {
625
- const automated = isAutomatedConversation(conversation);
626
- return /* @__PURE__ */ jsxRuntime.jsxs(
627
- "div",
628
- {
629
- className: useRestConversationHistory.cn(
630
- "group flex items-start gap-2 rounded-md px-2 py-2 hover:bg-accent",
631
- conversation.threadId === activeThreadId && "bg-primary/10 text-primary"
632
- ),
633
- children: [
634
- /* @__PURE__ */ jsxRuntime.jsxs(
635
- "button",
636
- {
637
- type: "button",
638
- onClick: () => {
639
- onSelect(conversation.threadId);
640
- if (conversation.isUnread) {
641
- onSetReadState(conversation.threadId, false);
642
- }
643
- },
644
- className: "flex min-w-0 flex-1 items-start gap-2 text-left",
645
- children: [
646
- /* @__PURE__ */ jsxRuntime.jsx(
647
- ConversationTypeIcon,
648
- {
649
- conversation,
650
- automated
651
- }
652
- ),
653
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
654
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-start gap-1", children: [
655
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "line-clamp-2 flex-1 text-xs font-medium leading-snug", children: useRestConversationHistory.conversationDisplayTitle(conversation) }),
656
- conversation.isUnread ? /* @__PURE__ */ jsxRuntime.jsx(
657
- "span",
658
- {
659
- "aria-label": "Unread",
660
- className: "mt-1 size-1.5 shrink-0 rounded-full bg-primary"
661
- }
662
- ) : null
663
- ] }),
664
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "mt-0.5 flex items-center gap-1.5 text-[10px] text-muted-foreground", children: [
665
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: relativeTime(conversation.updatedAt) }),
666
- /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "·" }),
667
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: originLabel(originKey(conversation)) })
668
- ] })
669
- ] })
670
- ]
671
- }
672
- ),
673
- /* @__PURE__ */ jsxRuntime.jsx(
674
- "button",
675
- {
676
- type: "button",
677
- "aria-label": `Archive ${useRestConversationHistory.conversationDisplayTitle(conversation)}`,
678
- title: "Archive conversation",
679
- onClick: () => onArchive(conversation.threadId),
680
- className: "invisible rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground group-hover:visible focus:visible",
681
- children: /* @__PURE__ */ jsxRuntime.jsx(Archive, { className: "size-3.5" })
682
- }
683
- )
684
- ]
685
- },
686
- conversation.threadId
687
- );
688
- })
689
- ] }, group)),
690
- hasNextPage ? /* @__PURE__ */ jsxRuntime.jsx(
691
- "button",
692
- {
693
- type: "button",
694
- disabled: isFetchingNextPage,
695
- onClick: onLoadMore,
696
- className: "mt-1 w-full rounded-lg py-2 text-xs text-muted-foreground hover:bg-accent disabled:opacity-50",
697
- children: isFetchingNextPage ? "Loading…" : "Load older sessions"
698
- }
699
- ) : visibleCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "py-2 text-center text-[10px] text-muted-foreground/70", children: "No more sessions" }) : null
700
- ] })
701
- ]
702
- }
703
- );
704
- }
705
- function makeMentionUrl(attrs) {
706
- if (attrs.type === "tool" || attrs.type === "toolkit") {
707
- return `mention://${attrs.type}?name=${encodeURIComponent(attrs.id)}&description=${encodeURIComponent(attrs.description ?? "")}`;
708
- }
709
- if (attrs.type === "asset") {
710
- const params2 = new URLSearchParams({ asset_ids: attrs.id });
711
- if (attrs.assetType) params2.set("assetType", attrs.assetType);
712
- return `/dashboard/spaces?${params2.toString()}`;
713
- }
714
- if (attrs.type === "tab") {
715
- const params2 = new URLSearchParams({
716
- tab_id: attrs.id,
717
- url: attrs.url ?? "",
718
- title: attrs.title ?? attrs.name
719
- });
720
- return `mention://webpage?${params2.toString()}`;
721
- }
722
- const params = new URLSearchParams();
723
- params.set("id", attrs.id);
724
- if (attrs.assetType) params.set("assetType", attrs.assetType);
725
- if (attrs.thumbnailUrl) params.set("thumb", attrs.thumbnailUrl);
726
- return `mention://${encodeURIComponent(attrs.type)}?${params.toString()}`;
727
- }
728
- function parseMentionAnchorAttributes({
729
- href,
730
- textContent
731
- }) {
732
- const url = new URL(href);
733
- const isWebpage = url.hostname === "webpage";
734
- return {
735
- type: isWebpage ? "tab" : url.hostname || "tool",
736
- name: (textContent == null ? void 0 : textContent.replace(/^@/, "")) || "",
737
- id: isWebpage ? url.searchParams.get("tab_id") || "" : url.searchParams.get("name") || url.searchParams.get("id") || "",
738
- title: url.searchParams.get("title") || "",
739
- url: url.searchParams.get("url") || "",
740
- description: url.searchParams.get("description") || "",
741
- thumbnailUrl: url.searchParams.get("thumb") || "",
742
- fallbackIcon: "",
743
- assetType: url.searchParams.get("assetType") || ""
744
- };
745
- }
746
- const MentionExtension = useRestConversationHistory.Node.create({
747
- name: "mention",
748
- group: "inline",
749
- inline: true,
750
- selectable: false,
751
- atom: true,
752
- addAttributes() {
753
- return {
754
- type: { default: "tool" },
755
- name: { default: "" },
756
- id: { default: "" },
757
- title: { default: "" },
758
- url: { default: "" },
759
- description: { default: "" },
760
- thumbnailUrl: { default: "" },
761
- fallbackIcon: { default: "" },
762
- assetType: { default: "" }
763
- };
764
- },
765
- parseHTML() {
766
- return [
767
- {
768
- tag: "span[data-mention]",
769
- getAttrs: (dom) => {
770
- var _a;
771
- const el = dom;
772
- return {
773
- type: el.getAttribute("data-type") || "tool",
774
- name: el.getAttribute("data-name") || ((_a = el.textContent) == null ? void 0 : _a.replace(/^@/, "")) || "",
775
- id: el.getAttribute("data-id") || "",
776
- title: el.getAttribute("data-title") || "",
777
- url: el.getAttribute("data-url") || "",
778
- description: el.getAttribute("data-description") || "",
779
- thumbnailUrl: el.getAttribute("data-thumbnail-url") || "",
780
- fallbackIcon: el.getAttribute("data-fallback-icon") || "",
781
- assetType: el.getAttribute("data-asset-type") || ""
782
- };
783
- }
784
- },
785
- {
786
- tag: "a[href^='mention://']",
787
- getAttrs: (dom) => {
788
- const el = dom;
789
- return parseMentionAnchorAttributes({
790
- href: el.href,
791
- textContent: el.textContent
792
- });
793
- }
794
- }
795
- ];
796
- },
797
- renderHTML({ node, HTMLAttributes }) {
798
- const thumbnailUrl = node.attrs.thumbnailUrl;
799
- const children = [];
800
- if (thumbnailUrl) {
801
- children.push([
802
- "img",
803
- {
804
- src: thumbnailUrl,
805
- alt: "",
806
- class: "mention-chip-icon",
807
- draggable: "false"
808
- }
809
- ]);
810
- }
811
- children.push(["span", { class: "mention-chip-text" }, node.attrs.name]);
812
- return [
813
- "span",
814
- useRestConversationHistory.mergeAttributes(HTMLAttributes, {
815
- "data-mention": "",
816
- "data-type": node.attrs.type,
817
- "data-name": node.attrs.name,
818
- "data-id": node.attrs.id,
819
- "data-title": node.attrs.title || "",
820
- "data-url": node.attrs.url || "",
821
- "data-thumbnail-url": node.attrs.thumbnailUrl || "",
822
- "data-asset-type": node.attrs.assetType || "",
823
- class: "mention-chip"
824
- }),
825
- ...children
826
- ];
827
- },
828
- renderText({ node }) {
829
- const url = makeMentionUrl({
830
- id: node.attrs.id,
831
- type: node.attrs.type,
832
- name: node.attrs.name,
833
- title: node.attrs.title,
834
- url: node.attrs.url,
835
- description: node.attrs.description,
836
- thumbnailUrl: node.attrs.thumbnailUrl,
837
- assetType: node.attrs.assetType
838
- });
839
- return `[@${node.attrs.name}](${url})`;
840
- }
841
- });
842
- const MentionSuggestionsExtension = useRestConversationHistory.Extension.create({
843
- name: "mentionSuggestions",
844
- addOptions() {
845
- return {
846
- store: null,
847
- callbacks: null
848
- };
849
- },
850
- addProseMirrorPlugins() {
851
- const callbacks = this.options.callbacks;
852
- return [
853
- useRestConversationHistory.Suggestion({
854
- editor: this.editor,
855
- char: "@",
856
- allowSpaces: false,
857
- startOfLine: false,
858
- allowedPrefixes: [" ", " ", "\n", "\r", "(", "[", "{", '"', "'", " "],
859
- items: () => [],
860
- command: ({ editor, range, props }) => {
861
- var _a, _b, _c;
862
- const item = props;
863
- if (item.navigatesToScope || item.isNavigationOnly) return;
864
- editor.chain().focus().deleteRange(range).insertContent({
865
- type: "mention",
866
- attrs: {
867
- type: item.type,
868
- name: item.name,
869
- id: item.type === "tab" && typeof ((_a = item.extra) == null ? void 0 : _a.tabId) === "number" ? String(item.extra.tabId) : item.id,
870
- title: item.type === "tab" && typeof ((_b = item.extra) == null ? void 0 : _b.title) === "string" ? item.extra.title : item.name,
871
- url: item.url ?? "",
872
- description: item.description ?? "",
873
- thumbnailUrl: item.thumbnailUrl ?? "",
874
- fallbackIcon: item.fallbackIcon ?? "",
875
- assetType: typeof ((_c = item.extra) == null ? void 0 : _c.athenaOriginalType) === "string" ? item.extra.athenaOriginalType : ""
876
- }
877
- }).insertContent(" ").run();
878
- },
879
- render: () => ({
880
- onStart: (props) => {
881
- callbacks == null ? void 0 : callbacks.onStart({
882
- query: props.query,
883
- command: (item) => props.command(item),
884
- clientRect: props.clientRect ?? null,
885
- editor: props.editor
886
- });
887
- },
888
- onUpdate: (props) => {
889
- callbacks == null ? void 0 : callbacks.onUpdate({
890
- query: props.query,
891
- command: (item) => props.command(item),
892
- clientRect: props.clientRect ?? null,
893
- editor: props.editor
894
- });
895
- },
896
- onKeyDown: ({ event }) => {
897
- return (callbacks == null ? void 0 : callbacks.onKeyDown(event)) ?? false;
898
- },
899
- onExit: () => {
900
- callbacks == null ? void 0 : callbacks.onExit();
901
- }
902
- })
903
- })
904
- ];
905
- }
906
- });
907
- const MentionSuggestionPopup = ({ clientRect, children }) => {
908
- const { refs, floatingStyles } = useRestConversationHistory.useFloating$1({
909
- placement: "bottom-start",
910
- middleware: [useRestConversationHistory.offset(10), useRestConversationHistory.flip(), useRestConversationHistory.shift({ padding: 8 })],
911
- whileElementsMounted: useRestConversationHistory.autoUpdate
912
- });
913
- React.useEffect(() => {
914
- if (clientRect) {
915
- refs.setPositionReference({
916
- getBoundingClientRect: () => clientRect() ?? new DOMRect()
917
- });
918
- }
919
- }, [clientRect, refs]);
920
- return /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
921
- "div",
922
- {
923
- ref: refs.setFloating,
924
- style: floatingStyles,
925
- className: "z-[9999]",
926
- onMouseDown: (e) => e.preventDefault(),
927
- children
928
- }
929
- ) });
930
- };
931
- const MAX_ERROR_RETRIES = 3;
932
- function selectItems(store, scope, query, _targetCount, parentScope) {
933
- const state = store.state;
934
- const scopeId = typeof scope === "string" ? scope : scope.id;
935
- const parentScopeId = parentScope ? typeof parentScope === "string" ? parentScope : parentScope.id : void 0;
936
- const items = useRestConversationHistory.getFilteredItems(state.cache, scopeId, query);
937
- let isFetching = false;
938
- let hasMore = true;
939
- try {
940
- const fetchState = useRestConversationHistory.getFetchState(state.registry, scopeId, query, parentScopeId);
941
- isFetching = fetchState.isFetching;
942
- hasMore = fetchState.hasNextPage;
943
- } catch {
944
- hasMore = false;
945
- }
946
- return { items, isFetching, hasMore };
947
- }
948
- function triggerFetchIfNeeded(store, scope, query, _targetCount, parentScope) {
949
- const scopeId = typeof scope === "string" ? scope : scope.id;
950
- const parentScopeId = parentScope ? typeof parentScope === "string" ? parentScope : parentScope.id : void 0;
951
- const state = store.state;
952
- let entry;
953
- try {
954
- entry = useRestConversationHistory.getEntry(state.registry, scopeId, parentScopeId);
955
- } catch {
956
- return;
957
- }
958
- const fetchState = useRestConversationHistory.getFetchState(state.registry, scopeId, query, parentScopeId);
959
- if (fetchState.isFetching || !fetchState.hasNextPage || fetchState.error) {
960
- return;
961
- }
962
- const meta = fetchState.meta || {};
963
- if ((meta.fetchAttempts || 0) >= 10) return;
964
- useRestConversationHistory.updateFetchState(state.registry, scopeId, query, { isFetching: true }, parentScopeId);
965
- store.setState((prev) => ({ ...prev }));
966
- const sourceFn = entry.sourceFn;
967
- const sourceConfig = entry.sourceConfig;
968
- sourceFn({
969
- scope: scopeId,
970
- query,
971
- fetchState,
972
- sourceConfig
973
- }).then((result) => {
974
- var _a, _b;
975
- const currentState = store.state;
976
- useRestConversationHistory.addItems(currentState.cache, result.items, scopeId);
977
- if (result.sources) {
978
- for (const src of result.sources) {
979
- try {
980
- useRestConversationHistory.getEntry(currentState.registry, src.scope);
981
- } catch {
982
- useRestConversationHistory.registerSource(
983
- currentState.registry,
984
- src.scope,
985
- src.sourceFn,
986
- src.sourceConfig,
987
- src.isFlat
988
- );
989
- }
990
- }
991
- }
992
- if (result.bindings) {
993
- for (const binding of result.bindings) {
994
- useRestConversationHistory.bindScopes(currentState.registry, binding.browseScope, binding.searchScope);
995
- }
996
- }
997
- const currentMeta = fetchState.meta || {};
998
- const consumed = ((_a = result.pagination) == null ? void 0 : _a.consumedCount) ?? result.items.length;
999
- const newValidated = (currentMeta.validatedCount || 0) + consumed;
1000
- useRestConversationHistory.updateFetchState(
1001
- currentState.registry,
1002
- scopeId,
1003
- query,
1004
- {
1005
- isFetching: false,
1006
- hasNextPage: ((_b = result.pagination) == null ? void 0 : _b.hasMore) ?? false,
1007
- error: null,
1008
- meta: {
1009
- ...currentMeta,
1010
- ...result.meta,
1011
- validatedCount: newValidated,
1012
- fetchAttempts: (currentMeta.fetchAttempts || 0) + 1,
1013
- errorAttempts: 0
1014
- }
1015
- },
1016
- parentScopeId
1017
- );
1018
- store.setState((prev) => ({ ...prev }));
1019
- }).catch((error) => {
1020
- console.error(`[orchestrator] Fetch error for scope ${scopeId}:`, error);
1021
- const currentState = store.state;
1022
- const currentMeta = fetchState.meta || {};
1023
- const errorAttempts = (currentMeta.errorAttempts || 0) + 1;
1024
- const retriable = errorAttempts < MAX_ERROR_RETRIES;
1025
- useRestConversationHistory.updateFetchState(
1026
- currentState.registry,
1027
- scopeId,
1028
- query,
1029
- {
1030
- isFetching: false,
1031
- hasNextPage: retriable,
1032
- error: retriable ? null : error instanceof Error ? error : new Error(String(error)),
1033
- meta: { ...currentMeta, errorAttempts }
1034
- },
1035
- parentScopeId
1036
- );
1037
- store.setState((prev) => ({ ...prev }));
1038
- });
1039
- }
1040
- function useMenuItems(store, options) {
1041
- const { scope, query = "", minItems = 50, parentScope } = options;
1042
- const [targetCount, setTargetCount] = React.useState(minItems);
1043
- React.useEffect(() => {
1044
- setTargetCount(minItems);
1045
- }, [scope, query, minItems]);
1046
- const snapshot = useRestConversationHistory.useStore(
1047
- store,
1048
- () => selectItems(store, scope, query, targetCount, parentScope)
1049
- );
1050
- React.useEffect(() => {
1051
- if (snapshot.items.length < targetCount && snapshot.hasMore && !snapshot.isFetching) {
1052
- triggerFetchIfNeeded(store, scope, query, targetCount, parentScope);
1053
- }
1054
- }, [
1055
- store,
1056
- scope,
1057
- query,
1058
- targetCount,
1059
- parentScope,
1060
- snapshot.items.length,
1061
- snapshot.hasMore,
1062
- snapshot.isFetching
1063
- ]);
1064
- const loadMore = () => {
1065
- if (snapshot.hasMore && !snapshot.isFetching) {
1066
- setTargetCount((prev) => prev + 50);
1067
- }
1068
- };
1069
- return {
1070
- items: snapshot.items,
1071
- isFetching: snapshot.isFetching,
1072
- hasMore: snapshot.hasMore,
1073
- loadMore,
1074
- targetCount
1075
- // Expose for debugging
1076
- };
1077
- }
1078
- const KNOWN_SCOPE_NAMES = {
1079
- root: "All",
1080
- global_search: "Search",
1081
- // Legacy order: my_spaces, favorites, assets, folders, tools, toolkits, team, workspace, drives
1082
- my_spaces: "My Spaces",
1083
- favorites: "Favorites",
1084
- athena_assets: "Assets",
1085
- athena_folders: "Folders",
1086
- tools: "Tools",
1087
- toolkits: "Toolkits",
1088
- team: "Team",
1089
- workspace: "Workspace",
1090
- drive_catalogs: "Drives",
1091
- athena_projects: "Projects",
1092
- athena_browse_profiles: "Browse Profiles",
1093
- // Additional scopes
1094
- asset_search: "Search"
1095
- };
1096
- function getScopeName(scope, store) {
1097
- const knownName = KNOWN_SCOPE_NAMES[scope];
1098
- if (knownName) {
1099
- return knownName;
1100
- }
1101
- const { cache } = store.state;
1102
- const allItems = Object.values(cache.items);
1103
- const item = allItems.find((item2) => item2.navigatesToScope === scope);
1104
- if (item) {
1105
- return item.name;
1106
- }
1107
- return scope.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
1108
- }
1109
- const MentionMenuSection = {
1110
- CURRENT_WEBPAGE: "current-webpage",
1111
- OTHER_WEBPAGES: "other-webpages",
1112
- LIBRARY: "library"
1113
- };
1114
- const ICON_MAP = {
1115
- // General
1116
- file: useRestConversationHistory.File,
1117
- "file-text": useRestConversationHistory.FileText,
1118
- "file-code": FileCode,
1119
- folder: useRestConversationHistory.Folder,
1120
- "folder-kanban": useRestConversationHistory.FolderKanban,
1121
- globe: useRestConversationHistory.Globe,
1122
- search: useRestConversationHistory.Search,
1123
- star: Star,
1124
- users: useRestConversationHistory.Users,
1125
- user: User,
1126
- wrench: useRestConversationHistory.Wrench,
1127
- package: useRestConversationHistory.Package,
1128
- "building-2": Building2,
1129
- "hard-drive": useRestConversationHistory.HardDrive,
1130
- "layout-grid": useRestConversationHistory.LayoutGrid,
1131
- zap: Zap,
1132
- eye: Eye,
1133
- // Chrome tools
1134
- camera: useRestConversationHistory.Camera,
1135
- keyboard: Keyboard,
1136
- code: useRestConversationHistory.Code,
1137
- monitor: useRestConversationHistory.Monitor,
1138
- // Asset types
1139
- image: useRestConversationHistory.Image,
1140
- video: Video,
1141
- headphones: Headphones,
1142
- mic: Mic,
1143
- mail: useRestConversationHistory.Mail,
1144
- calendar: useRestConversationHistory.Calendar,
1145
- phone: Phone,
1146
- database: useRestConversationHistory.Database,
1147
- table: useRestConversationHistory.Table,
1148
- sheet: useRestConversationHistory.Sheet,
1149
- palette: Palette,
1150
- "pen-tool": PenTool,
1151
- layout: PanelsTopLeft,
1152
- "layout-dashboard": LayoutDashboard,
1153
- library: Library,
1154
- "book-open": useRestConversationHistory.BookOpen,
1155
- sparkles: Sparkles,
1156
- "check-square": SquareCheckBig,
1157
- key: Key,
1158
- smartphone: Smartphone,
1159
- cloud: Cloud,
1160
- workflow: useRestConversationHistory.Workflow,
1161
- presentation: useRestConversationHistory.FileText
1162
- // Fallback for presentation type
1163
- };
1164
- function toKebabIconName(name) {
1165
- return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
1166
- }
1167
- function resolveIcon(name) {
1168
- return ICON_MAP[name] ?? ICON_MAP[toKebabIconName(name)];
1169
- }
1170
- const ICON_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9-]*$/;
1171
- function MentionIcon({
1172
- fallbackIcon,
1173
- thumbnailUrl,
1174
- alt,
1175
- className = "w-4 h-4 flex-shrink-0"
1176
- }) {
1177
- if (thumbnailUrl) {
1178
- return /* @__PURE__ */ jsxRuntime.jsx("img", { src: thumbnailUrl, alt: alt ?? "", className });
1179
- }
1180
- const Icon = fallbackIcon ? resolveIcon(fallbackIcon) : void 0;
1181
- if (Icon) return /* @__PURE__ */ jsxRuntime.jsx(Icon, { className });
1182
- if (fallbackIcon && !ICON_NAME_PATTERN.test(fallbackIcon)) {
1183
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm flex-shrink-0", children: fallbackIcon });
1184
- }
1185
- return /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.File, { className });
1186
- }
1187
- function MenuItemRow({
1188
- item,
1189
- isSelected,
1190
- onMouseEnter,
1191
- onClick,
1192
- showArrow
1193
- }) {
1194
- var _a, _b, _c, _d;
1195
- const hasTwoLines = item.type === "tool" && item.description || item.type === "user" && item.email || item.type === "workspace_item" && item.description || item.type === "tab" && item.description;
1196
- return /* @__PURE__ */ jsxRuntime.jsxs(
1197
- "div",
1198
- {
1199
- role: "button",
1200
- tabIndex: -1,
1201
- onClick,
1202
- onMouseEnter,
1203
- className: useRestConversationHistory.cn(
1204
- "mention-item flex items-center justify-between gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors",
1205
- "hover:bg-gray-100",
1206
- item.menuSection === MentionMenuSection.CURRENT_WEBPAGE && !isSelected && "bg-sky-50/70",
1207
- isSelected && "bg-gray-100 is-selected"
1208
- ),
1209
- children: [
1210
- /* @__PURE__ */ jsxRuntime.jsx(
1211
- "span",
1212
- {
1213
- className: `flex items-center flex-shrink-0 ${hasTwoLines ? "self-start mt-0.5" : ""}`,
1214
- children: /* @__PURE__ */ jsxRuntime.jsx(
1215
- MentionIcon,
1216
- {
1217
- fallbackIcon: item.fallbackIcon,
1218
- thumbnailUrl: item.thumbnailUrl,
1219
- alt: item.name
1220
- }
1221
- )
1222
- }
1223
- ),
1224
- hasTwoLines ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 flex flex-col gap-0 min-w-0 -mt-0.5", children: [
1225
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm leading-tight flex items-center gap-1.5", children: [
1226
- item.name,
1227
- ((_a = item.extra) == null ? void 0 : _a.isAdminOnly) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-purple-400 flex-shrink-0" }),
1228
- ((_b = item.extra) == null ? void 0 : _b.isExperimental) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-blue-50 px-1.5 py-0.5 text-[9px] font-medium text-blue-700", children: "Experimental" })
1229
- ] }),
1230
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-500 leading-tight mt-0.5 truncate", children: item.type === "user" ? item.email : item.description })
1231
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex-1 text-sm truncate min-w-0 flex items-center gap-1.5", children: [
1232
- item.name,
1233
- ((_c = item.extra) == null ? void 0 : _c.isAdminOnly) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-purple-400 flex-shrink-0" }),
1234
- ((_d = item.extra) == null ? void 0 : _d.isExperimental) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-blue-50 px-1.5 py-0.5 text-[9px] font-medium text-blue-700", children: "Experimental" })
1235
- ] }),
1236
- showArrow && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 text-sm px-1 rounded transition-all cursor-pointer hover:text-gray-600 hover:bg-gray-200", children: "→" }) })
1237
- ]
1238
- }
1239
- );
1240
- }
1241
- function MenuSkeleton() {
1242
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-1 py-1", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-2 py-1.5 rounded animate-pulse", children: [
1243
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-4 h-4 bg-gray-200 rounded flex-shrink-0" }),
1244
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3.5 bg-gray-200 rounded flex-1", style: { maxWidth: `${50 + i * 10}%` } })
1245
- ] }, i)) });
1246
- }
1247
- function MenuList({
1248
- items,
1249
- selectedIndex,
1250
- isLoading,
1251
- hasMore,
1252
- onSelect,
1253
- onMouseEnter,
1254
- onLoadMore
1255
- }) {
1256
- const selectedRef = React.useRef(null);
1257
- React.useEffect(() => {
1258
- var _a;
1259
- (_a = selectedRef.current) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
1260
- }, [selectedIndex]);
1261
- if (isLoading && items.length === 0) return /* @__PURE__ */ jsxRuntime.jsx(MenuSkeleton, {});
1262
- if (items.length === 0) {
1263
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-1 py-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-2 py-9 text-center text-sm text-gray-500", children: [
1264
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1", children: "No results found" }),
1265
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-gray-400", children: "Try a different search or go back" })
1266
- ] }) });
1267
- }
1268
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-1 py-1", children: [
1269
- items.map((item, index) => {
1270
- var _a;
1271
- const previousSection = (_a = items[index - 1]) == null ? void 0 : _a.menuSection;
1272
- const startsOtherWebpages = item.menuSection === MentionMenuSection.OTHER_WEBPAGES && previousSection !== MentionMenuSection.OTHER_WEBPAGES;
1273
- const startsLibrary = item.menuSection === MentionMenuSection.LIBRARY && (previousSection === MentionMenuSection.CURRENT_WEBPAGE || previousSection === MentionMenuSection.OTHER_WEBPAGES);
1274
- return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
1275
- startsOtherWebpages && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wide text-gray-400", children: "Other webpages in this group" }),
1276
- startsLibrary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-2 my-1 border-t border-gray-100" }),
1277
- /* @__PURE__ */ jsxRuntime.jsx("div", { ref: index === selectedIndex ? selectedRef : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
1278
- MenuItemRow,
1279
- {
1280
- item,
1281
- isSelected: index === selectedIndex,
1282
- onMouseEnter: () => onMouseEnter(index),
1283
- onClick: () => onSelect(item),
1284
- showArrow: !!item.navigatesToScope
1285
- }
1286
- ) })
1287
- ] }, item.id);
1288
- }),
1289
- isLoading && items.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-2 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-400", children: "Loading more..." }) }),
1290
- hasMore && !isLoading && onLoadMore && /* @__PURE__ */ jsxRuntime.jsx(
1291
- "button",
1292
- {
1293
- type: "button",
1294
- onClick: onLoadMore,
1295
- className: "w-full px-2 py-1.5 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-50 rounded transition-colors text-center",
1296
- children: "··· Load more"
1297
- }
1298
- )
1299
- ] });
1300
- }
1301
- function MenuBreadcrumbs({
1302
- scopePath,
1303
- onNavigate
1304
- }) {
1305
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 text-xs text-gray-600 min-w-0", children: scopePath.map((item, index) => {
1306
- const isLast = index === scopePath.length - 1;
1307
- const isClickable = !isLast;
1308
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 min-w-0", children: [
1309
- isClickable ? /* @__PURE__ */ jsxRuntime.jsx(
1310
- "button",
1311
- {
1312
- type: "button",
1313
- onClick: () => onNavigate(item.id),
1314
- className: "truncate hover:underline cursor-pointer transition-all hover:text-gray-800",
1315
- title: `Go to ${item.name}`,
1316
- children: item.name
1317
- }
1318
- ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium text-gray-800", children: item.name }),
1319
- !isLast && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-400 flex-shrink-0", children: "→" })
1320
- ] }, item.id);
1321
- }) });
1322
- }
1323
- function MenuSummary({
1324
- scopePath,
1325
- onNavigate,
1326
- onBackClick,
1327
- isFetching
1328
- }) {
1329
- if (scopePath.length <= 1 && !isFetching) return null;
1330
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-gray-200 px-2 py-2 bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
1331
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
1332
- scopePath.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(MenuBreadcrumbs, { scopePath, onNavigate }),
1333
- isFetching && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 inline-block w-3 h-3 border border-gray-400 border-t-transparent rounded-full animate-spin" })
1334
- ] }),
1335
- onBackClick && /* @__PURE__ */ jsxRuntime.jsxs(
1336
- "button",
1337
- {
1338
- type: "button",
1339
- onClick: onBackClick,
1340
- className: "text-xs text-gray-600 hover:text-gray-800 px-2 py-1 rounded hover:bg-gray-200 transition-colors flex items-center gap-1 flex-shrink-0",
1341
- title: "Go back (or press ←)",
1342
- children: [
1343
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "←" }),
1344
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Back" })
1345
- ]
1346
- }
1347
- )
1348
- ] }) });
1349
- }
1350
- function useKeyboardNavigation(ref, opts) {
1351
- const { items, selectedIndex, setSelectedIndex, onSelect, onBack, onClose } = opts;
1352
- React.useImperativeHandle(
1353
- ref,
1354
- () => ({
1355
- onKeyDown: (event) => {
1356
- if (items.length === 0 && event.key !== "Escape") return false;
1357
- switch (event.key) {
1358
- case "ArrowDown": {
1359
- const next = (selectedIndex + 1) % items.length;
1360
- setSelectedIndex(next);
1361
- return true;
1362
- }
1363
- case "ArrowUp": {
1364
- const prev = (selectedIndex - 1 + items.length) % items.length;
1365
- setSelectedIndex(prev);
1366
- return true;
1367
- }
1368
- case "Enter": {
1369
- const item = items[selectedIndex];
1370
- if (item) onSelect(item);
1371
- return true;
1372
- }
1373
- case "ArrowLeft": {
1374
- if (onBack) {
1375
- onBack();
1376
- return true;
1377
- }
1378
- return false;
1379
- }
1380
- case "Backspace": {
1381
- return false;
1382
- }
1383
- case "ArrowRight": {
1384
- const item = items[selectedIndex];
1385
- if (item == null ? void 0 : item.navigatesToScope) {
1386
- onSelect(item);
1387
- return true;
1388
- }
1389
- return false;
1390
- }
1391
- case "Escape": {
1392
- onClose();
1393
- return true;
1394
- }
1395
- default:
1396
- return false;
1397
- }
1398
- }
1399
- }),
1400
- [items, selectedIndex, setSelectedIndex, onSelect, onBack, onClose]
1401
- );
1402
- }
1403
- function getCurrentScope(state) {
1404
- const lastEntry = state.scopeStack[state.scopeStack.length - 1];
1405
- return (lastEntry == null ? void 0 : lastEntry.scope) ?? "root";
1406
- }
1407
- function getSelectedIndex(state) {
1408
- const lastEntry = state.scopeStack[state.scopeStack.length - 1];
1409
- return (lastEntry == null ? void 0 : lastEntry.selectedIndex) ?? 0;
1410
- }
1411
- function useMenuNavigation() {
1412
- const [store] = React.useState(() => {
1413
- const baseStore = new useRestConversationHistory.Store({
1414
- scopeStack: [{ scope: "root", selectedIndex: 0 }],
1415
- query: "",
1416
- isActive: false
1417
- });
1418
- const navigationStore = baseStore;
1419
- navigationStore.navigateTo = (scope, currentSelectedIndex, options) => {
1420
- const state = baseStore.state;
1421
- const updatedStack = [...state.scopeStack];
1422
- if (updatedStack.length > 0) {
1423
- updatedStack[updatedStack.length - 1] = {
1424
- ...updatedStack[updatedStack.length - 1],
1425
- selectedIndex: currentSelectedIndex
1426
- };
1427
- }
1428
- const newStack = [
1429
- ...updatedStack,
1430
- {
1431
- scope,
1432
- selectedIndex: 0,
1433
- breadcrumbLabel: options == null ? void 0 : options.breadcrumbLabel,
1434
- parentScope: options == null ? void 0 : options.parentScope
1435
- }
1436
- ];
1437
- baseStore.setState((prev) => ({
1438
- ...prev,
1439
- scopeStack: newStack,
1440
- query: ""
1441
- }));
1442
- };
1443
- navigationStore.navigateBack = () => {
1444
- const state = baseStore.state;
1445
- if (state.scopeStack.length <= 1) {
1446
- return;
1447
- }
1448
- const newStack = state.scopeStack.slice(0, -1);
1449
- baseStore.setState((prev) => ({
1450
- ...prev,
1451
- scopeStack: newStack,
1452
- query: ""
1453
- }));
1454
- };
1455
- navigationStore.setQuery = (query) => {
1456
- baseStore.setState((prev) => ({ ...prev, query }));
1457
- };
1458
- navigationStore.open = () => {
1459
- baseStore.setState(() => ({
1460
- scopeStack: [{ scope: "root", selectedIndex: 0 }],
1461
- query: "",
1462
- isActive: true
1463
- }));
1464
- };
1465
- navigationStore.close = () => {
1466
- baseStore.setState(() => ({
1467
- scopeStack: [{ scope: "root", selectedIndex: 0 }],
1468
- query: "",
1469
- isActive: false
1470
- }));
1471
- };
1472
- return navigationStore;
1473
- });
1474
- return store;
1475
- }
1476
- function clearTextAfterTrigger(editor) {
1477
- const { state } = editor;
1478
- const { from: cursorPos } = state.selection;
1479
- const backwardText = state.doc.textBetween(0, cursorPos, void 0, "");
1480
- const triggerIndex = backwardText.lastIndexOf("@");
1481
- if (triggerIndex === -1) return;
1482
- const offset = backwardText.length - triggerIndex;
1483
- const from = cursorPos - offset + 1;
1484
- const to = cursorPos;
1485
- if (from < to) {
1486
- const tr = state.tr.deleteRange(from, to);
1487
- editor.view.dispatch(tr);
1488
- }
1489
- }
1490
- const MentionSuggestionList = React.forwardRef(({ store, editor, query, command, closeMenu }, ref) => {
1491
- const [selectedIndexOverride, setSelectedIndexOverride] = React.useState(null);
1492
- const navStore = useMenuNavigation();
1493
- const currentScopeId = useRestConversationHistory.useStore(navStore, (s) => getCurrentScope(s));
1494
- const navSelectedIndex = useRestConversationHistory.useStore(navStore, (s) => getSelectedIndex(s));
1495
- const selectedIndex = selectedIndexOverride ?? navSelectedIndex;
1496
- const scopeStack = useRestConversationHistory.useStore(navStore, (s) => s.scopeStack);
1497
- let effectiveScopeId = currentScopeId;
1498
- if (query) {
1499
- try {
1500
- const searchScope = useRestConversationHistory.getSearchScope(store.state.registry, currentScopeId);
1501
- if (searchScope) {
1502
- effectiveScopeId = searchScope;
1503
- }
1504
- } catch {
1505
- }
1506
- }
1507
- const { items, isFetching, hasMore, loadMore } = useMenuItems(store, {
1508
- scope: effectiveScopeId,
1509
- query,
1510
- minItems: 50,
1511
- parentScope: currentScopeId !== effectiveScopeId ? currentScopeId : void 0
1512
- });
1513
- React.useEffect(() => {
1514
- setSelectedIndexOverride(null);
1515
- }, [query, effectiveScopeId]);
1516
- const scopePath = scopeStack.map((entry) => ({
1517
- id: entry.scope,
1518
- name: entry.breadcrumbLabel ?? getScopeName(entry.scope, store)
1519
- }));
1520
- const handleSelect = React.useCallback(
1521
- (item) => {
1522
- if (item.navigatesToScope) {
1523
- navStore.navigateTo(item.navigatesToScope, selectedIndex, {
1524
- breadcrumbLabel: item.name,
1525
- parentScope: currentScopeId
1526
- });
1527
- clearTextAfterTrigger(editor);
1528
- setSelectedIndexOverride(null);
1529
- return;
1530
- }
1531
- command(item);
1532
- },
1533
- [command, editor, navStore, selectedIndex, currentScopeId]
1534
- );
1535
- const handleBack = React.useCallback(() => {
1536
- navStore.navigateBack();
1537
- clearTextAfterTrigger(editor);
1538
- setSelectedIndexOverride(null);
1539
- }, [editor, navStore]);
1540
- const handleBreadcrumbNavigate = React.useCallback(
1541
- (targetScopeId) => {
1542
- const targetIdx = scopeStack.findIndex((entry) => entry.scope === targetScopeId);
1543
- if (targetIdx >= 0) {
1544
- const popsNeeded = scopeStack.length - 1 - targetIdx;
1545
- for (let i = 0; i < popsNeeded; i++) {
1546
- navStore.navigateBack();
1547
- }
1548
- clearTextAfterTrigger(editor);
1549
- setSelectedIndexOverride(null);
1550
- }
1551
- },
1552
- [editor, navStore, scopeStack]
1553
- );
1554
- useKeyboardNavigation(ref, {
1555
- items,
1556
- selectedIndex,
1557
- onSelect: handleSelect,
1558
- onBack: currentScopeId !== "root" ? handleBack : void 0,
1559
- onClose: () => closeMenu(true),
1560
- setSelectedIndex: (idx) => {
1561
- setSelectedIndexOverride(idx);
1562
- }
1563
- });
1564
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white border border-gray-300 rounded shadow-lg min-w-[280px] max-w-[380px] max-h-[320px] flex flex-col", children: [
1565
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
1566
- MenuList,
1567
- {
1568
- items,
1569
- selectedIndex,
1570
- isLoading: isFetching,
1571
- hasMore,
1572
- onSelect: handleSelect,
1573
- onMouseEnter: (idx) => {
1574
- setSelectedIndexOverride(idx);
1575
- },
1576
- onLoadMore: loadMore
1577
- }
1578
- ) }),
1579
- /* @__PURE__ */ jsxRuntime.jsx(
1580
- MenuSummary,
1581
- {
1582
- scopePath,
1583
- onNavigate: handleBreadcrumbNavigate,
1584
- onBackClick: currentScopeId !== "root" ? handleBack : void 0,
1585
- isFetching
1586
- }
1587
- )
1588
- ] });
1589
- });
1590
- MentionSuggestionList.displayName = "MentionSuggestionList";
1591
- function assetToMenuItem(asset) {
1592
- const isFolder = asset.athenaOriginalType === "folder";
1593
- const displayType = asset.athenaConvertedType || asset.athenaOriginalType;
1594
- return {
1595
- id: asset.id,
1596
- name: asset.title || "Untitled",
1597
- type: isFolder ? "folder" : "asset",
1598
- thumbnailUrl: useRestConversationHistory.assetTypeToThumb(displayType),
1599
- fallbackIcon: useRestConversationHistory.assetTypeToIcon(displayType),
1600
- navigatesToScope: isFolder ? asset.id : void 0,
1601
- visibleInScopes: /* @__PURE__ */ new Set(),
1602
- updatedAt: asset.updatedAt ?? void 0,
1603
- extra: {
1604
- athenaOriginalType: asset.athenaOriginalType,
1605
- athenaConvertedType: asset.athenaConvertedType,
1606
- parentFolderId: asset.parentFolderId
1607
- }
1608
- };
1609
- }
1610
- async function querySimpleSearch(auth, opts) {
1611
- var _a, _b;
1612
- const searchRequest = {
1613
- query: ((_a = opts.query) == null ? void 0 : _a.trim()) || "",
1614
- type: opts.includeTypes || [],
1615
- notType: opts.excludeTypes || [],
1616
- limit: opts.limit,
1617
- offset: opts.offset
1618
- };
1619
- const input = {
1620
- searchRequest,
1621
- returnFullAsset: true,
1622
- shouldCalculateTotal: false,
1623
- sort: { field: "UPDATED_AT", direction: "DESC" },
1624
- filterColumns: { isArchived: false, isHidden: false }
1625
- };
1626
- const data = await useRestConversationHistory.fetchGraphQL(auth, useRestConversationHistory.SIMPLE_SEARCH_QUERY, { input });
1627
- const assets = ((_b = data.simpleSearch) == null ? void 0 : _b.assets) || [];
1628
- return {
1629
- items: assets.map(assetToMenuItem),
1630
- hasMore: assets.length === opts.limit
1631
- };
1632
- }
1633
- const CATEGORY_DEFS = {
1634
- favorites: { name: "Favorites", icon: "star", scope: "favorites" },
1635
- assets: { name: "Assets", icon: "file-text", scope: "athena_assets" },
1636
- projects: {
1637
- name: "Projects",
1638
- icon: "folder-kanban",
1639
- scope: "athena_projects"
1640
- },
1641
- browse_profiles: {
1642
- name: "Browse Profiles",
1643
- icon: "globe",
1644
- scope: "athena_browse_profiles"
1645
- },
1646
- folders: { name: "Folders", icon: "folder", scope: "athena_folders" },
1647
- tools: { name: "Tools", icon: "wrench", scope: "tools" },
1648
- toolkits: { name: "Toolkits", icon: "package", scope: "toolkits" },
1649
- team: { name: "Team", icon: "users", scope: "team" },
1650
- drives: { name: "Drives", icon: "hard-drive", scope: "drive_catalogs" }
1651
- };
1652
- function webpageDescription(webpage) {
1653
- try {
1654
- const hostname = new URL(webpage.url).hostname;
1655
- return webpage.isCurrent ? `${webpage.title} · ${hostname}` : hostname;
1656
- } catch {
1657
- return webpage.title;
1658
- }
1659
- }
1660
- function webpageToMenuItem(webpage) {
1661
- return {
1662
- id: `webpage-tab-${webpage.tabId}`,
1663
- name: webpage.isCurrent ? "This webpage" : webpage.title,
1664
- type: "tab",
1665
- thumbnailUrl: useRestConversationHistory.assetTypeToThumb("web_page"),
1666
- fallbackIcon: "globe",
1667
- visibleInScopes: /* @__PURE__ */ new Set(["root"]),
1668
- description: webpageDescription(webpage),
1669
- url: webpage.url,
1670
- menuSection: webpage.isCurrent ? MentionMenuSection.CURRENT_WEBPAGE : MentionMenuSection.OTHER_WEBPAGES,
1671
- extra: {
1672
- tabId: webpage.tabId,
1673
- title: webpage.title,
1674
- isCurrent: webpage.isCurrent
1675
- }
1676
- };
1677
- }
1678
- function buildRootMenuItems({
1679
- categories,
1680
- webpages
1681
- }) {
1682
- const webpageItems = webpages.map(webpageToMenuItem);
1683
- const categoryItems = categories.filter((cat) => CATEGORY_DEFS[cat]).map((cat) => {
1684
- const def = CATEGORY_DEFS[cat];
1685
- return {
1686
- id: cat,
1687
- name: def.name,
1688
- type: "menu",
1689
- fallbackIcon: def.icon,
1690
- visibleInScopes: /* @__PURE__ */ new Set(["root"]),
1691
- navigatesToScope: def.scope,
1692
- isNavigationOnly: true,
1693
- menuSection: MentionMenuSection.LIBRARY
1694
- };
1695
- });
1696
- return [...webpageItems, ...categoryItems];
1697
- }
1698
- const transformRootCategories = async (context) => {
1699
- const { sourceConfig } = context;
1700
- const items = buildRootMenuItems({
1701
- categories: sourceConfig.categories,
1702
- webpages: sourceConfig.getWebpages()
1703
- });
1704
- return { items, pagination: { hasMore: false } };
1705
- };
1706
- const fetchAssets = async (context) => {
1707
- const { query, fetchState, sourceConfig } = context;
1708
- const limit = sourceConfig.limit ?? 50;
1709
- const meta = fetchState.meta || {};
1710
- const offset = meta.validatedCount || 0;
1711
- const result = await querySimpleSearch(sourceConfig.auth, {
1712
- query,
1713
- limit,
1714
- offset,
1715
- excludeTypes: [
1716
- "folder",
1717
- "catalog",
1718
- "spaces",
1719
- "session",
1720
- "table",
1721
- "task_item"
1722
- ]
1723
- });
1724
- return {
1725
- items: result.items,
1726
- pagination: { hasMore: result.hasMore }
1727
- };
1728
- };
1729
- const fetchFavorites = async (context) => {
1730
- const { query, fetchState, sourceConfig } = context;
1731
- const limit = sourceConfig.limit ?? 50;
1732
- const meta = fetchState.meta || {};
1733
- const offset = meta.validatedCount || 0;
1734
- const data = await useRestConversationHistory.fetchGraphQL(sourceConfig.auth, useRestConversationHistory.PAGINATED_ASSETS_QUERY, {
1735
- limit,
1736
- offset,
1737
- parentFolderId: null,
1738
- filterTypes: null,
1739
- filterColumns: {
1740
- isFavorited: true,
1741
- isArchived: false,
1742
- isHidden: false
1743
- }
1744
- });
1745
- const assets = data.getPaginatedAssetsForWorkspace || [];
1746
- const items = assets.map(assetToMenuItem);
1747
- return {
1748
- items,
1749
- pagination: { hasMore: assets.length === limit }
1750
- };
1751
- };
1752
- const fetchFolders = async (context) => {
1753
- const { query, fetchState, sourceConfig } = context;
1754
- const limit = sourceConfig.limit ?? 50;
1755
- const meta = fetchState.meta || {};
1756
- const offset = meta.validatedCount || 0;
1757
- const result = await querySimpleSearch(sourceConfig.auth, {
1758
- query,
1759
- limit,
1760
- offset,
1761
- includeTypes: ["folder"]
1762
- });
1763
- return {
1764
- items: result.items,
1765
- pagination: { hasMore: result.hasMore }
1766
- };
1767
- };
1768
- const fetchFolderContents = async (context) => {
1769
- const { scope, query, fetchState, sourceConfig } = context;
1770
- const limit = sourceConfig.limit ?? 50;
1771
- const meta = fetchState.meta || {};
1772
- const offset = meta.validatedCount || 0;
1773
- const parentFolderId = scope === "internal_drive" ? null : scope;
1774
- const data = await useRestConversationHistory.fetchGraphQL(sourceConfig.auth, useRestConversationHistory.PAGINATED_ASSETS_QUERY, {
1775
- limit,
1776
- offset,
1777
- parentFolderId,
1778
- filterTypes: null,
1779
- filterColumns: {
1780
- isArchived: false,
1781
- isHidden: false,
1782
- ...query ? { title: [{ op: "LIKE", value: `%${query}%` }] } : {}
1783
- }
1784
- });
1785
- const rawAssets = data.getPaginatedAssetsForWorkspace || [];
1786
- const assets = rawAssets.filter(
1787
- (a) => a.athenaConvertedType !== "catalog" && a.athenaOriginalType !== "catalog"
1788
- );
1789
- const items = assets.map(assetToMenuItem);
1790
- return {
1791
- items,
1792
- pagination: {
1793
- hasMore: rawAssets.length === limit,
1794
- consumedCount: rawAssets.length
1795
- }
1796
- };
1797
- };
1798
- const fetchTypedAssets = async (context) => {
1799
- const { query, fetchState, sourceConfig } = context;
1800
- const limit = sourceConfig.limit ?? 50;
1801
- const meta = fetchState.meta || {};
1802
- const offset = meta.validatedCount || 0;
1803
- const result = await querySimpleSearch(sourceConfig.auth, {
1804
- query,
1805
- limit,
1806
- offset,
1807
- includeTypes: sourceConfig.includeOnlyTypes
1808
- });
1809
- return {
1810
- items: result.items,
1811
- pagination: { hasMore: result.hasMore }
1812
- };
1813
- };
1814
- const fetchTeam = async (context) => {
1815
- const { sourceConfig } = context;
1816
- const { auth } = sourceConfig;
1817
- if (!auth.workspaceId) {
1818
- return { items: [], pagination: { hasMore: false } };
1819
- }
1820
- const data = await useRestConversationHistory.fetchGraphQL(
1821
- auth,
1822
- useRestConversationHistory.WORKSPACE_MEMBERS_QUERY,
1823
- { workspaceId: auth.workspaceId }
1824
- );
1825
- const members = data.getUsersInWorkspace || [];
1826
- const items = members.map((member) => {
1827
- const displayName = [member.firstName, member.lastName].filter(Boolean).join(" ").trim() || member.email || "Unknown User";
1828
- return {
1829
- id: member.email || member.id,
1830
- name: displayName,
1831
- type: "user",
1832
- fallbackIcon: "user",
1833
- visibleInScopes: /* @__PURE__ */ new Set(),
1834
- email: member.email ?? void 0,
1835
- extra: { isAdmin: member.isAdmin }
1836
- };
1837
- });
1838
- return { items, pagination: { hasMore: false } };
1839
- };
1840
- async function queryToolCatalog(auth) {
1841
- const data = await useRestConversationHistory.fetchGraphQL(auth, useRestConversationHistory.TOOL_CATALOG_QUERY);
1842
- return data.getToolkitToToolsMapping;
1843
- }
1844
- const fetchTools = async (context) => {
1845
- const catalog = await queryToolCatalog(context.sourceConfig.auth);
1846
- const items = catalog.tools.filter((tool) => tool.isMentionable).map((tool) => ({
1847
- id: tool.id,
1848
- name: tool.name,
1849
- type: "tool",
1850
- fallbackIcon: tool.icon,
1851
- description: tool.description ?? void 0,
1852
- visibleInScopes: /* @__PURE__ */ new Set(),
1853
- ...tool.adminOnly ? { extra: { isAdminOnly: true } } : {}
1854
- }));
1855
- return { items, pagination: { hasMore: false } };
1856
- };
1857
- const fetchToolkits = async (context) => {
1858
- const catalog = await queryToolCatalog(context.sourceConfig.auth);
1859
- const items = catalog.toolkits.filter((toolkit) => toolkit.isMentionable && !toolkit.hideFromMenu).map((toolkit) => ({
1860
- id: toolkit.name,
1861
- name: toolkit.displayName,
1862
- type: "toolkit",
1863
- fallbackIcon: toolkit.icon,
1864
- description: toolkit.description || void 0,
1865
- visibleInScopes: /* @__PURE__ */ new Set(),
1866
- ...toolkit.onlyAdmin ? { extra: { isAdminOnly: true } } : {}
1867
- }));
1868
- return { items, pagination: { hasMore: false } };
1869
- };
1870
- const fetchDrives = async (context) => {
1871
- const { fetchState, sourceConfig } = context;
1872
- const meta = fetchState.meta || {};
1873
- const offset = meta.validatedCount || 0;
1874
- const result = await querySimpleSearch(sourceConfig.auth, {
1875
- limit: 50,
1876
- offset,
1877
- includeTypes: ["catalog"]
1878
- });
1879
- const items = result.items.map((item) => ({
1880
- ...item,
1881
- type: "drive_catalog",
1882
- fallbackIcon: "hard-drive",
1883
- isNavigationOnly: true,
1884
- navigatesToScope: item.id
1885
- }));
1886
- const sources = items.map((item) => ({
1887
- scope: item.id,
1888
- sourceFn: fetchFolderContents,
1889
- sourceConfig: { auth: sourceConfig.auth, limit: 50 }
1890
- }));
1891
- return {
1892
- items,
1893
- pagination: { hasMore: result.hasMore },
1894
- sources
1895
- };
1896
- };
1897
- const fetchGlobalSearch = async (context) => {
1898
- const { query, fetchState, sourceConfig } = context;
1899
- if (!(query == null ? void 0 : query.trim())) return { items: [], pagination: { hasMore: false } };
1900
- const meta = fetchState.meta || {};
1901
- const offset = meta.validatedCount || 0;
1902
- const result = await querySimpleSearch(sourceConfig.auth, {
1903
- query,
1904
- limit: 50,
1905
- offset,
1906
- excludeTypes: ["table", "catalog", "spaces", "task_item", "session"]
1907
- });
1908
- return {
1909
- items: result.items,
1910
- pagination: { hasMore: result.hasMore }
1911
- };
1912
- };
1913
- function webpageMentionFingerprint(webpages) {
1914
- return JSON.stringify(
1915
- webpages.map(({ tabId, title, url, isCurrent }) => [
1916
- tabId,
1917
- title,
1918
- url,
1919
- isCurrent
1920
- ])
1921
- );
1922
- }
1923
- const ROOT_MENTION_CATEGORIES = [
1924
- "favorites",
1925
- "assets",
1926
- "projects",
1927
- "browse_profiles",
1928
- "folders",
1929
- "tools",
1930
- "toolkits",
1931
- "team",
1932
- "drives"
1933
- ];
1934
- function buildStore({
1935
- auth,
1936
- getWebpages,
1937
- rootCategories
1938
- }) {
1939
- const registry = useRestConversationHistory.createScopeRegistry();
1940
- const cache = useRestConversationHistory.createItemCache();
1941
- useRestConversationHistory.registerSource(registry, "root", transformRootCategories, {
1942
- categories: [...rootCategories],
1943
- getWebpages
1944
- });
1945
- useRestConversationHistory.registerSource(registry, "global_search", fetchGlobalSearch, { auth });
1946
- useRestConversationHistory.bindScopes(registry, "root", "global_search");
1947
- useRestConversationHistory.registerSource(registry, "athena_assets", fetchAssets, { auth, limit: 50 });
1948
- useRestConversationHistory.registerSource(registry, "favorites", fetchFavorites, { auth, limit: 50 });
1949
- useRestConversationHistory.registerSource(
1950
- registry,
1951
- "athena_folders",
1952
- fetchFolders,
1953
- { auth, limit: 50 },
1954
- true
1955
- );
1956
- useRestConversationHistory.registerSource(registry, "internal_drive", fetchFolderContents, {
1957
- auth,
1958
- limit: 50
1959
- });
1960
- useRestConversationHistory.registerSource(registry, "athena_projects", fetchTypedAssets, {
1961
- auth,
1962
- includeOnlyTypes: ["project"],
1963
- limit: 50
1964
- });
1965
- useRestConversationHistory.registerSource(registry, "athena_browse_profiles", fetchTypedAssets, {
1966
- auth,
1967
- includeOnlyTypes: ["browse_profile"],
1968
- limit: 50
1969
- });
1970
- useRestConversationHistory.registerSource(registry, "tools", fetchTools, { auth });
1971
- useRestConversationHistory.registerSource(registry, "toolkits", fetchToolkits, { auth });
1972
- useRestConversationHistory.registerSource(registry, "team", fetchTeam, { auth });
1973
- useRestConversationHistory.registerSource(registry, "drive_catalogs", fetchDrives, { auth });
1974
- return new useRestConversationHistory.Store({ registry, cache });
1975
- }
1976
- function useMentionSuggestions({
1977
- webpages,
1978
- rootCategories = ROOT_MENTION_CATEGORIES
1979
- }) {
1980
- const auth = useRestConversationHistory.useMentionAuth();
1981
- const webpagesRef = React.useRef(webpages);
1982
- webpagesRef.current = webpages;
1983
- const store = React.useMemo(
1984
- () => buildStore({
1985
- auth,
1986
- getWebpages: () => webpagesRef.current,
1987
- rootCategories
1988
- }),
1989
- // eslint-disable-next-line react-hooks/exhaustive-deps
1990
- [
1991
- auth.backendUrl,
1992
- auth.accessToken,
1993
- auth.apiKey,
1994
- auth.workspaceId,
1995
- auth.userId,
1996
- rootCategories.join(",")
1997
- ]
1998
- );
1999
- const invalidate = React.useMemo(
2000
- () => (scope) => {
2001
- const state = store.state;
2002
- const { registry, cache } = state;
2003
- if (cache.items) {
2004
- for (const item of Object.values(cache.items)) {
2005
- item.visibleInScopes.delete(scope);
2006
- }
2007
- for (const [id, item] of Object.entries(cache.items)) {
2008
- if (item.visibleInScopes.size === 0) {
2009
- delete cache.items[id];
2010
- }
2011
- }
2012
- }
2013
- if (registry.entries[scope]) {
2014
- registry.entries[scope].fetchStates = {};
2015
- }
2016
- store.setState((prev) => ({ ...prev }));
2017
- },
2018
- [store]
2019
- );
2020
- const webpageFingerprint = webpageMentionFingerprint(webpages);
2021
- const previousWebpageFingerprintRef = React.useRef(null);
2022
- React.useEffect(() => {
2023
- if (previousWebpageFingerprintRef.current === webpageFingerprint) return;
2024
- previousWebpageFingerprintRef.current = webpageFingerprint;
2025
- invalidate("root");
2026
- }, [invalidate, webpageFingerprint]);
2027
- return { store, invalidate };
2028
- }
2029
- class PendingAttachmentUploads {
2030
- constructor() {
2031
- __publicField(this, "pending", /* @__PURE__ */ new Set());
2032
- }
2033
- track(upload) {
2034
- this.pending.add(upload);
2035
- void upload.then(
2036
- () => this.pending.delete(upload),
2037
- () => this.pending.delete(upload)
2038
- );
2039
- return upload;
2040
- }
2041
- async waitForIdle() {
2042
- while (this.pending.size > 0) {
2043
- await Promise.allSettled([...this.pending]);
2044
- }
2045
- }
2046
- }
2047
- const SubmitKeybind = useRestConversationHistory.Extension.create({
2048
- name: "submitKeybind",
2049
- priority: 1e3,
2050
- addOptions() {
2051
- return { onSubmit: () => {
2052
- }, isMentionOpen: () => false };
2053
- },
2054
- addKeyboardShortcuts() {
2055
- return {
2056
- Enter: () => {
2057
- if (this.options.isMentionOpen()) return false;
2058
- this.options.onSubmit();
2059
- return true;
2060
- },
2061
- "Shift-Enter": () => {
2062
- this.editor.commands.setHardBreak();
2063
- return true;
2064
- }
2065
- };
2066
- }
2067
- });
2068
- const MENTION_STYLES = `
2069
- .mention-chip {
2070
- display: inline-flex;
2071
- align-items: center;
2072
- gap: 4px;
2073
- background: rgba(148, 163, 184, 0.1);
2074
- color: #475569;
2075
- border: 1px solid #cbd5e1;
2076
- border-radius: 6px;
2077
- padding: 1px 6px;
2078
- font-size: 0.85em;
2079
- font-weight: 500;
2080
- white-space: nowrap;
2081
- user-select: all;
2082
- vertical-align: middle;
2083
- height: 20px;
2084
- line-height: 1;
2085
- }
2086
- .mention-chip-icon {
2087
- width: 14px;
2088
- height: 14px;
2089
- flex-shrink: 0;
2090
- }
2091
- .mention-chip-text {
2092
- white-space: nowrap;
2093
- overflow: hidden;
2094
- text-overflow: ellipsis;
2095
- max-width: 180px;
2096
- }
2097
- .ProseMirror {
2098
- outline: none;
2099
- min-height: 36px;
2100
- max-height: 120px;
2101
- overflow-y: auto;
2102
- }
2103
- .ProseMirror p {
2104
- margin: 0;
2105
- }
2106
- .ProseMirror p.is-editor-empty:first-child::before {
2107
- content: attr(data-placeholder);
2108
- float: left;
2109
- color: #9ca3af;
2110
- pointer-events: none;
2111
- height: 0;
2112
- }
2113
- `;
2114
- function plainTextToTiptapContent(text) {
2115
- return {
2116
- type: "doc",
2117
- content: text.split("\n").map((line) => ({
2118
- type: "paragraph",
2119
- ...line.length > 0 ? { content: [{ type: "text", text: line }] } : {}
2120
- }))
2121
- };
2122
- }
2123
- const NO_WEBPAGES = [];
2124
- const TiptapComposer = React.forwardRef(({ placeholder = "Message Athena... (type @ to mention)", threadId, disabled = false, webpages = NO_WEBPAGES, rootCategories, onDraftStateChange, interceptSubmit }, outerRef) => {
2125
- const aui = react.useAui();
2126
- const composerInput = react.unstable_useComposerInput();
2127
- const applyingRuntimeTextRef = React.useRef(false);
2128
- const listRef = React.useRef(null);
2129
- const pendingUploadsRef = React.useRef(new PendingAttachmentUploads());
2130
- const submitInFlightRef = React.useRef(false);
2131
- const { store } = useMentionSuggestions({ webpages, rootCategories });
2132
- const [popupOpen, setPopupOpen] = React.useState(false);
2133
- const popupOpenRef = React.useRef(false);
2134
- const [popupProps, setPopupProps] = React.useState(null);
2135
- const callbacksRef = React.useRef({
2136
- onStart: (props) => {
2137
- setPopupOpen(true);
2138
- popupOpenRef.current = true;
2139
- setPopupProps(props);
2140
- },
2141
- onUpdate: (props) => {
2142
- setPopupProps(props);
2143
- },
2144
- onKeyDown: (event) => {
2145
- var _a;
2146
- return ((_a = listRef.current) == null ? void 0 : _a.onKeyDown(event)) ?? false;
2147
- },
2148
- onExit: () => {
2149
- setPopupOpen(false);
2150
- popupOpenRef.current = false;
2151
- setPopupProps(null);
2152
- }
2153
- });
2154
- const editorRef = React.useRef(null);
2155
- const handleSubmit = React.useCallback(async () => {
2156
- var _a;
2157
- if (disabled) return;
2158
- if (submitInFlightRef.current) return;
2159
- submitInFlightRef.current = true;
2160
- try {
2161
- await pendingUploadsRef.current.waitForIdle();
2162
- const ed = editorRef.current;
2163
- if (!ed) return;
2164
- const text = ed.getText({ blockSeparator: "\n" }).trim();
2165
- if (!text) return;
2166
- if (!composerInput.canSend) return;
2167
- if (interceptSubmit) {
2168
- const hasAttachments = (((_a = aui.composer.getState().attachments) == null ? void 0 : _a.length) ?? 0) > 0;
2169
- if (!hasAttachments && await interceptSubmit(text)) {
2170
- ed.commands.clearContent();
2171
- onDraftStateChange == null ? void 0 : onDraftStateChange(false);
2172
- return;
2173
- }
2174
- }
2175
- composerInput.setText(text);
2176
- composerInput.send({ steer: false });
2177
- ed.commands.clearContent();
2178
- onDraftStateChange == null ? void 0 : onDraftStateChange(false);
2179
- } finally {
2180
- submitInFlightRef.current = false;
2181
- }
2182
- }, [composerInput, disabled, interceptSubmit, onDraftStateChange]);
2183
- const handleSubmitRef = React.useRef(handleSubmit);
2184
- handleSubmitRef.current = handleSubmit;
2185
- const addAttachment = React.useCallback(
2186
- (file) => pendingUploadsRef.current.track(aui.composer.addAttachment(file)),
2187
- [aui]
2188
- );
2189
- const handlePaste = React.useCallback(
2190
- (_view, event) => {
2191
- var _a;
2192
- const items = (_a = event.clipboardData) == null ? void 0 : _a.items;
2193
- if (!items) return false;
2194
- let handled = false;
2195
- for (const item of items) {
2196
- if (item.type.startsWith("image/")) {
2197
- event.preventDefault();
2198
- const blob = item.getAsFile();
2199
- if (blob) {
2200
- const ext = item.type.split("/")[1] || "png";
2201
- const file = new File([blob], `pasted-image-${Date.now()}.${ext}`, { type: item.type });
2202
- void addAttachment(file).catch((error) => {
2203
- console.error("[attach] Pasted image upload failed:", error);
2204
- });
2205
- }
2206
- handled = true;
2207
- }
2208
- }
2209
- return handled;
2210
- },
2211
- [addAttachment]
2212
- );
2213
- const handleDrop = React.useCallback(
2214
- (_view, event) => {
2215
- var _a;
2216
- const files = (_a = event.dataTransfer) == null ? void 0 : _a.files;
2217
- if (!(files == null ? void 0 : files.length)) return false;
2218
- let handled = false;
2219
- for (const file of files) {
2220
- if (file.type.startsWith("image/")) {
2221
- event.preventDefault();
2222
- void addAttachment(file).catch((error) => {
2223
- console.error("[attach] Dropped image upload failed:", error);
2224
- });
2225
- handled = true;
2226
- }
2227
- }
2228
- return handled;
2229
- },
2230
- [addAttachment]
2231
- );
2232
- const editor = useRestConversationHistory.useEditor({
2233
- editable: !disabled,
2234
- extensions: [
2235
- useRestConversationHistory.StarterKit.configure({
2236
- heading: false,
2237
- blockquote: false,
2238
- bulletList: false,
2239
- orderedList: false,
2240
- codeBlock: false,
2241
- horizontalRule: false
2242
- }),
2243
- useRestConversationHistory.Placeholder.configure({ placeholder }),
2244
- MentionExtension,
2245
- MentionSuggestionsExtension.configure({
2246
- store,
2247
- callbacks: callbacksRef.current
2248
- }),
2249
- SubmitKeybind.configure({
2250
- onSubmit: () => void handleSubmitRef.current(),
2251
- isMentionOpen: () => popupOpenRef.current
2252
- })
2253
- ],
2254
- editorProps: {
2255
- attributes: {
2256
- class: "w-full resize-none bg-transparent px-1.5 py-2 text-sm leading-snug outline-none",
2257
- "data-testid": "athena-chat-composer"
2258
- },
2259
- handlePaste,
2260
- handleDrop
2261
- },
2262
- onUpdate: ({ editor: updatedEditor }) => {
2263
- const nextText = updatedEditor.getText({ blockSeparator: "\n" });
2264
- if (!applyingRuntimeTextRef.current) {
2265
- composerInput.setText(nextText);
2266
- }
2267
- onDraftStateChange == null ? void 0 : onDraftStateChange(nextText.trim().length > 0);
2268
- },
2269
- immediatelyRender: false
2270
- });
2271
- editorRef.current = editor;
2272
- React.useEffect(() => {
2273
- editor == null ? void 0 : editor.setEditable(!disabled);
2274
- }, [disabled, editor]);
2275
- React.useEffect(() => {
2276
- if (!editor) return;
2277
- const editorText = editor.getText({ blockSeparator: "\n" });
2278
- if (editorText === composerInput.value) return;
2279
- applyingRuntimeTextRef.current = true;
2280
- editor.commands.setContent(plainTextToTiptapContent(composerInput.value));
2281
- applyingRuntimeTextRef.current = false;
2282
- onDraftStateChange == null ? void 0 : onDraftStateChange(composerInput.value.trim().length > 0);
2283
- }, [composerInput.value, editor, onDraftStateChange]);
2284
- const insertAssetMention = React.useCallback((asset) => {
2285
- const currentEditor = editorRef.current;
2286
- if (!currentEditor) throw new Error("The chat composer is not ready.");
2287
- currentEditor.chain().focus().insertContent({
2288
- type: "mention",
2289
- attrs: {
2290
- type: "asset",
2291
- name: asset.title,
2292
- id: asset.id,
2293
- assetType: asset.assetType
2294
- }
2295
- }).insertContent(" ").run();
2296
- }, []);
2297
- React.useEffect(
2298
- () => registerChatAssetMentionHandler(threadId, insertAssetMention),
2299
- [insertAssetMention, threadId]
2300
- );
2301
- React.useImperativeHandle(
2302
- outerRef,
2303
- () => ({ submit: handleSubmit, addAttachment, insertAssetMention }),
2304
- [addAttachment, handleSubmit, insertAssetMention]
2305
- );
2306
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2307
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: MENTION_STYLES }),
2308
- /* @__PURE__ */ jsxRuntime.jsx(
2309
- "div",
2310
- {
2311
- className: "flex-1 min-w-0",
2312
- "aria-label": "Message composer",
2313
- "aria-disabled": disabled,
2314
- children: /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.EditorContent, { editor })
2315
- }
2316
- ),
2317
- popupOpen && popupProps && editor && /* @__PURE__ */ jsxRuntime.jsx(MentionSuggestionPopup, { clientRect: popupProps.clientRect, children: /* @__PURE__ */ jsxRuntime.jsx(
2318
- MentionSuggestionList,
2319
- {
2320
- ref: listRef,
2321
- store,
2322
- editor,
2323
- query: popupProps.query,
2324
- command: (item) => popupProps.command(item),
2325
- closeMenu: () => {
2326
- setPopupOpen(false);
2327
- editor.commands.focus();
2328
- }
2329
- }
2330
- ) })
2331
- ] });
2332
- });
2333
- TiptapComposer.displayName = "TiptapComposer";
2334
- const SignInCard = ({
2335
- buildLabel,
2336
- subtitle,
2337
- children,
2338
- error,
2339
- notice,
2340
- primaryLabel,
2341
- primaryPendingLabel,
2342
- isPending,
2343
- disabled = false,
2344
- onPrimary,
2345
- footer
2346
- }) => (
2347
- // `min-h-full` centers the card in hosts whose root is not a flex container.
2348
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-full flex-1 flex-col items-center justify-center bg-muted/20 p-5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-sm space-y-5 rounded-2xl border bg-background/95 p-5 shadow-sm", children: [
2349
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
2350
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-base font-semibold tracking-tight text-foreground", children: "Sign in to Athena" }),
2351
- buildLabel ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: buildLabel }) : null,
2352
- subtitle ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1.5 text-xs leading-relaxed text-muted-foreground", children: subtitle }) : null
2353
- ] }),
2354
- children ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children }) : null,
2355
- notice ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: notice }) : null,
2356
- /* @__PURE__ */ jsxRuntime.jsx("div", { role: "status", "aria-live": "polite", children: error ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: error }) : null }),
2357
- /* @__PURE__ */ jsxRuntime.jsx(
2358
- "button",
2359
- {
2360
- type: "button",
2361
- className: "h-10 w-full rounded-lg bg-primary px-4 text-sm font-semibold text-primary-foreground shadow-sm transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40",
2362
- onClick: onPrimary,
2363
- disabled: isPending || disabled,
2364
- children: isPending ? primaryPendingLabel : primaryLabel
2365
- }
2366
- ),
2367
- footer
2368
- ] }) })
2369
- );
2370
- const SignInSelect = ({ id, label, value, options, onChange, hint }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
2371
- /* @__PURE__ */ jsxRuntime.jsx(
2372
- "label",
2373
- {
2374
- htmlFor: id,
2375
- className: "text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",
2376
- children: label
2377
- }
2378
- ),
2379
- /* @__PURE__ */ jsxRuntime.jsx(
2380
- "select",
2381
- {
2382
- id,
2383
- className: "h-10 w-full rounded-lg border bg-background px-3 text-sm outline-none transition-shadow focus:ring-2 focus:ring-ring/20",
2384
- value,
2385
- onChange: (event) => onChange(event.target.value),
2386
- children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
2387
- }
2388
- ),
2389
- hint ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-1 text-[10px] text-muted-foreground", children: hint }) : null
2390
- ] });
2391
- const SignInTextField = ({ label, placeholder, value, onChange, type = "text", className }) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "block space-y-1", children: [
2392
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
2393
- /* @__PURE__ */ jsxRuntime.jsx(
2394
- "input",
2395
- {
2396
- className: useRestConversationHistory.cn(
2397
- "h-9 w-full rounded-md border bg-background px-2.5 text-xs outline-none focus:ring-2 focus:ring-ring/20",
2398
- className
2399
- ),
2400
- type,
2401
- placeholder,
2402
- value,
2403
- onChange: (event) => onChange(event.target.value)
2404
- }
2405
- )
2406
- ] });
2407
- const SignInFallbackSection = ({ isOpen, onToggle, label, children }) => {
2408
- const contentId = React.useId();
2409
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t pt-3", children: [
2410
- /* @__PURE__ */ jsxRuntime.jsxs(
2411
- "button",
2412
- {
2413
- type: "button",
2414
- "aria-expanded": isOpen,
2415
- "aria-controls": contentId,
2416
- className: "w-full text-left text-[11px] font-medium text-muted-foreground hover:text-foreground",
2417
- onClick: onToggle,
2418
- children: [
2419
- isOpen ? "Hide" : "Show",
2420
- " ",
2421
- label
2422
- ]
2423
- }
2424
- ),
2425
- isOpen ? /* @__PURE__ */ jsxRuntime.jsx("div", { id: contentId, className: "mt-3 space-y-2", children }) : null
2426
- ] });
2427
- };
2428
- const SignInSecondaryButton = ({ onClick, disabled = false, children }) => /* @__PURE__ */ jsxRuntime.jsx(
2429
- "button",
2430
- {
2431
- type: "button",
2432
- className: "h-9 w-full rounded-lg border bg-background text-xs font-medium hover:bg-muted disabled:opacity-40",
2433
- disabled,
2434
- onClick,
2435
- children
2436
- }
2437
- );
2438
- const SignInConsent = ({ checked, onChange, children }) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex cursor-pointer items-start gap-2.5 rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed text-muted-foreground", children: [
2439
- /* @__PURE__ */ jsxRuntime.jsx(
2440
- "input",
2441
- {
2442
- type: "checkbox",
2443
- className: "mt-0.5 h-4 w-4 shrink-0 accent-primary",
2444
- checked,
2445
- onChange: (event) => onChange(event.target.checked)
2446
- }
2447
- ),
2448
- /* @__PURE__ */ jsxRuntime.jsx("span", { children })
2449
- ] });
2450
- const EXIT_ANIMATION_MS = 200;
2451
- const EXIT_RESET_MS = 2500;
2452
- const ContinuePill = ({ onClick, ariaLabel, dataTestId }) => {
2453
- const [isExiting, setIsExiting] = React.useState(false);
2454
- const onClickRef = React.useRef(onClick);
2455
- const pendingOnClickRef = React.useRef(onClick);
2456
- onClickRef.current = onClick;
2457
- React.useEffect(() => {
2458
- if (!isExiting) return;
2459
- const dispatchTimer = setTimeout(
2460
- () => pendingOnClickRef.current(),
2461
- EXIT_ANIMATION_MS
2462
- );
2463
- const resetTimer = setTimeout(() => setIsExiting(false), EXIT_RESET_MS);
2464
- return () => {
2465
- clearTimeout(dispatchTimer);
2466
- clearTimeout(resetTimer);
2467
- };
2468
- }, [isExiting]);
2469
- const handleClick = () => {
2470
- if (isExiting) return;
2471
- pendingOnClickRef.current = onClickRef.current;
2472
- setIsExiting(true);
2473
- };
2474
- return /* @__PURE__ */ jsxRuntime.jsxs(
2475
- "button",
2476
- {
2477
- type: "button",
2478
- onClick: handleClick,
2479
- disabled: isExiting,
2480
- className: useRestConversationHistory.cn(
2481
- "group inline-flex items-center gap-1.5 rounded-full bg-primary px-3.5 py-1 text-xs font-medium text-primary-foreground shadow-sm",
2482
- "transition-all duration-200 ease-out",
2483
- "hover:bg-primary/90 hover:shadow-md active:scale-95",
2484
- "animate-in fade-in slide-in-from-bottom-1",
2485
- isExiting && "pointer-events-none scale-90 opacity-0"
2486
- ),
2487
- "aria-label": ariaLabel,
2488
- "data-testid": dataTestId,
2489
- children: [
2490
- /* @__PURE__ */ jsxRuntime.jsx(useRestConversationHistory.Play, { className: "size-3 fill-current transition-transform duration-200 ease-out group-hover:translate-x-0.5" }),
2491
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Continue" })
2492
- ]
2493
- }
2494
- );
2495
- };
2496
- function StatewireContinueRunButton({
2497
- allowReadyFallback = false
2498
- } = {}) {
2499
- const status = useRestConversationHistory.useDeepAgentThreadStatus();
2500
- const { runId } = reactStatewire.useStatewireRuns();
2501
- const sendCommand = reactStatewire.useStatewireSendCommand();
2502
- const isSettled = status === "stopped" || status === "error";
2503
- if (!isSettled && !(allowReadyFallback && status === "ready")) return null;
2504
- return /* @__PURE__ */ jsxRuntime.jsx(
2505
- ContinuePill,
2506
- {
2507
- ariaLabel: "Continue this run from where it stopped",
2508
- dataTestId: "statewire-continue-run",
2509
- onClick: () => {
2510
- sendCommand({
2511
- type: "run/continue",
2512
- ...runId !== null && { runId }
2513
- });
2514
- }
2515
- }
2516
- );
2517
- }
2518
- function StatewireContinueRunAffordance() {
2519
- const messageId = react.useAuiState((state) => state.message.id);
2520
- const lastMessageId = react.useAuiState(
2521
- (state) => {
2522
- var _a;
2523
- return (_a = state.thread.messages.at(-1)) == null ? void 0 : _a.id;
2524
- }
2525
- );
2526
- const runMarker = react.useAuiState(
2527
- (state) => {
2528
- var _a;
2529
- return (_a = useRestConversationHistory.readRunMarkerFromSourceMessages(state.message)) == null ? void 0 : _a.marker;
2530
- }
2531
- );
2532
- const threadExtras = react.useAuiState((state) => state.thread.extras);
2533
- const isContinuableMarker = runMarker === useRestConversationHistory.ATHENA_RUN_MARKER_CANCELLED || runMarker === useRestConversationHistory.ATHENA_RUN_MARKER_FAILED;
2534
- if (messageId !== lastMessageId || !isContinuableMarker) return null;
2535
- if (!useRestConversationHistory.hasStatewireThreadExtras(threadExtras)) return null;
2536
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-center py-1", children: /* @__PURE__ */ jsxRuntime.jsx(StatewireContinueRunButton, { allowReadyFallback: true }) });
2537
- }
2538
- function StatewireRunEndedFooter({
2539
- className
2540
- } = {}) {
2541
- const threadExtras = react.useAuiState((state) => state.thread.extras);
2542
- if (!useRestConversationHistory.hasStatewireThreadExtras(threadExtras)) return null;
2543
- return /* @__PURE__ */ jsxRuntime.jsx(StatewireRunEndedFooterContent, { className });
2544
- }
2545
- function StatewireRunEndedFooterContent({
2546
- className
2547
- }) {
2548
- const status = useRestConversationHistory.useDeepAgentThreadStatus();
2549
- const { error } = reactStatewire.useStatewireRuns();
2550
- const tailEndingKind = react.useAuiState((state) => {
2551
- var _a;
2552
- const last = state.thread.messages.at(-1);
2553
- return last ? ((_a = useRestConversationHistory.readRuntimeMessageFromSourceMessages(last)) == null ? void 0 : _a.kind) ?? null : null;
2554
- });
2555
- const tailEndingSilent = react.useAuiState((state) => {
2556
- var _a;
2557
- const last = state.thread.messages.at(-1);
2558
- return last ? ((_a = useRestConversationHistory.readRuntimeMessageFromSourceMessages(last)) == null ? void 0 : _a.silent) ?? false : false;
2559
- });
2560
- if (status !== "stopped" && status !== "error") return null;
2561
- if (status === "stopped" && tailEndingSilent) return null;
2562
- const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;
2563
- const tailMatchesStatus = status === "error" ? tailEndingKind === "failed" : tailEndingKind === "stopped" || tailEndingKind === "paused";
2564
- if (tailRendersEnding && tailMatchesStatus) return null;
2565
- const tailOwnsContinue = tailRendersEnding && (tailEndingKind === "stopped" || tailEndingKind === "paused" || tailEndingKind === "failed");
2566
- const action = tailOwnsContinue ? void 0 : /* @__PURE__ */ jsxRuntime.jsx(StatewireContinueRunButton, {});
2567
- const message = status === "error" ? {
2568
- kind: "failed",
2569
- reason: "error",
2570
- severity: "error",
2571
- title: "Run failed",
2572
- detail: void 0,
2573
- text: (error == null ? void 0 : error.message) ? `⚠️ The run failed: ${error.message}` : void 0,
2574
- silent: false,
2575
- isSoleSourceMessage: true
2576
- } : {
2577
- kind: "stopped",
2578
- reason: void 0,
2579
- severity: "info",
2580
- title: "Conversation stopped",
2581
- detail: void 0,
2582
- text: void 0,
2583
- silent: false,
2584
- isSoleSourceMessage: true
2585
- };
2586
- return /* @__PURE__ */ jsxRuntime.jsx(
2587
- useRestConversationHistory.RuntimeMessageCard,
2588
- {
2589
- message,
2590
- action,
2591
- className: useRestConversationHistory.cn("mx-auto max-w-[95%]", className)
2592
- }
2593
- );
2594
- }
2595
- exports.BranchPicker = useRestConversationHistory.BranchPicker;
2596
- exports.COMPOSER_DOCK_CLASS = useRestConversationHistory.COMPOSER_DOCK_CLASS;
2597
- exports.COMPOSER_EDITOR_ROW_CLASS = useRestConversationHistory.COMPOSER_EDITOR_ROW_CLASS;
2598
- exports.COMPOSER_SURFACE_CLASS = useRestConversationHistory.COMPOSER_SURFACE_CLASS;
2599
- exports.COMPOSER_TOOLBAR_CLASS = useRestConversationHistory.COMPOSER_TOOLBAR_CLASS;
2600
- exports.ChatComposerDock = useRestConversationHistory.ChatComposerDock;
2601
- exports.ChatThreadShell = useRestConversationHistory.ChatThreadShell;
2602
- exports.ComposerSendButton = useRestConversationHistory.ComposerSendButton;
2603
- exports.ComposerSendOrStop = useRestConversationHistory.ComposerSendOrStop;
2604
- exports.ComposerStopButton = useRestConversationHistory.ComposerStopButton;
2605
- exports.IconButton = useRestConversationHistory.IconButton;
2606
- exports.MarkdownText = useRestConversationHistory.MarkdownText;
2607
- exports.MentionAuthCtx = useRestConversationHistory.MentionAuthCtx;
2608
- exports.MentionChip = useRestConversationHistory.MentionChip;
2609
- exports.MentionLink = useRestConversationHistory.MentionLink;
2610
- exports.MessageActionsReadOnlyProvider = useRestConversationHistory.MessageActionsReadOnlyProvider;
2611
- exports.RuntimeMessageCard = useRestConversationHistory.RuntimeMessageCard;
2612
- exports.SIMPLE_SEARCH_QUERY = useRestConversationHistory.SIMPLE_SEARCH_QUERY;
2613
- exports.SmallIconButton = useRestConversationHistory.SmallIconButton;
2614
- exports.THREAD_HEADER_ACTIONS_CLASS = useRestConversationHistory.THREAD_HEADER_ACTIONS_CLASS;
2615
- exports.THREAD_HEADER_CLASS = useRestConversationHistory.THREAD_HEADER_CLASS;
2616
- exports.THREAD_HEADER_ICON_CLASS = useRestConversationHistory.THREAD_HEADER_ICON_CLASS;
2617
- exports.THREAD_HEADER_PILL_CLASS = useRestConversationHistory.THREAD_HEADER_PILL_CLASS;
2618
- exports.THREAD_PANEL_CLASS = useRestConversationHistory.THREAD_PANEL_CLASS;
2619
- exports.THREAD_SCROLL_TO_BOTTOM_CLASS = useRestConversationHistory.THREAD_SCROLL_TO_BOTTOM_CLASS;
2620
- exports.TextShimmerLoader = useRestConversationHistory.TextShimmerLoader;
2621
- exports.ThreadRunningIndicator = useRestConversationHistory.ThreadRunningIndicator;
2622
- exports.UserEditComposer = useRestConversationHistory.UserEditComposer;
2623
- exports.UserMessage = useRestConversationHistory.UserMessage;
2624
- exports.assetTypeToIcon = useRestConversationHistory.assetTypeToIcon;
2625
- exports.assetTypeToThumb = useRestConversationHistory.assetTypeToThumb;
2626
- exports.configureAssetIconBasePath = useRestConversationHistory.configureAssetIconBasePath;
2627
- exports.createAssistantMessage = useRestConversationHistory.createAssistantMessage;
2628
- exports.createOlympusAssetUrl = useRestConversationHistory.createOlympusAssetUrl;
2629
- exports.fetchGraphQL = useRestConversationHistory.fetchGraphQL;
2630
- exports.normalizeAthenaMentionHtml = useRestConversationHistory.normalizeAthenaMentionHtml;
2631
- exports.parseMentionUrl = useRestConversationHistory.parseMentionUrl;
2632
- exports.parseMentionsInText = useRestConversationHistory.parseMentionsInText;
2633
- exports.resolveComposerAction = useRestConversationHistory.resolveComposerAction;
2634
- exports.useMentionAuth = useRestConversationHistory.useMentionAuth;
2635
- exports.useMessageActionsReadOnly = useRestConversationHistory.useMessageActionsReadOnly;
2636
- exports.ChatHeader = ChatHeader;
2637
- exports.ChatHeaderActions = ChatHeaderActions;
2638
- exports.ChatHeaderIdentity = ChatHeaderIdentity;
2639
- exports.ChatHeaderRoot = ChatHeaderRoot;
2640
- exports.ContinuePill = ContinuePill;
2641
- exports.ConversationHistoryPanel = ConversationHistoryPanel;
2642
- exports.MentionExtension = MentionExtension;
2643
- exports.MentionIcon = MentionIcon;
2644
- exports.MentionMenuSection = MentionMenuSection;
2645
- exports.MentionSuggestionList = MentionSuggestionList;
2646
- exports.MentionSuggestionPopup = MentionSuggestionPopup;
2647
- exports.MentionSuggestionsExtension = MentionSuggestionsExtension;
2648
- exports.MenuList = MenuList;
2649
- exports.PendingAttachmentUploads = PendingAttachmentUploads;
2650
- exports.ROOT_MENTION_CATEGORIES = ROOT_MENTION_CATEGORIES;
2651
- exports.SignInCard = SignInCard;
2652
- exports.SignInConsent = SignInConsent;
2653
- exports.SignInFallbackSection = SignInFallbackSection;
2654
- exports.SignInSecondaryButton = SignInSecondaryButton;
2655
- exports.SignInSelect = SignInSelect;
2656
- exports.SignInTextField = SignInTextField;
2657
- exports.StatewireContinueRunAffordance = StatewireContinueRunAffordance;
2658
- exports.StatewireContinueRunButton = StatewireContinueRunButton;
2659
- exports.StatewireRunEndedFooter = StatewireRunEndedFooter;
2660
- exports.TiptapComposer = TiptapComposer;
2661
- exports.buildRootMenuItems = buildRootMenuItems;
2662
- exports.makeMentionUrl = makeMentionUrl;
2663
- exports.parseMentionAnchorAttributes = parseMentionAnchorAttributes;
2664
- exports.plainTextToTiptapContent = plainTextToTiptapContent;
2665
- exports.useMentionSuggestions = useMentionSuggestions;
2666
- exports.webpageMentionFingerprint = webpageMentionFingerprint;
2667
- //# sourceMappingURL=chat-ui.cjs.map