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