@athenaintel/react 0.22.4 → 0.23.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 (350) hide show
  1. package/README.md +390 -4
  2. package/dist/chat/AthenaChat.cjs +346 -244
  3. package/dist/chat/AthenaChat.cjs.map +1 -1
  4. package/dist/chat/AthenaChat.d.ts +19 -8
  5. package/dist/chat/AthenaChat.js +350 -248
  6. package/dist/chat/AthenaChat.js.map +1 -1
  7. package/dist/chat/StatewireApprovalCard.cjs +2 -1
  8. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  9. package/dist/chat/StatewireApprovalCard.js +2 -1
  10. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  11. package/dist/chat/StatewireClientToolBridge.cjs +1 -0
  12. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
  13. package/dist/chat/StatewireClientToolBridge.js +1 -0
  14. package/dist/chat/StatewireClientToolBridge.js.map +1 -1
  15. package/dist/chat/StatewireQueuedMessages.cjs +1 -0
  16. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  17. package/dist/chat/StatewireQueuedMessages.js +1 -0
  18. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  19. package/dist/chat/WaitingOnYouBanner.cjs +100 -0
  20. package/dist/chat/WaitingOnYouBanner.cjs.map +1 -0
  21. package/dist/chat/WaitingOnYouBanner.d.ts +29 -0
  22. package/dist/chat/WaitingOnYouBanner.js +100 -0
  23. package/dist/chat/WaitingOnYouBanner.js.map +1 -0
  24. package/dist/chat/athena-chat-welcome.cjs +148 -0
  25. package/dist/chat/athena-chat-welcome.cjs.map +1 -0
  26. package/dist/chat/athena-chat-welcome.d.ts +54 -0
  27. package/dist/chat/athena-chat-welcome.js +148 -0
  28. package/dist/chat/athena-chat-welcome.js.map +1 -0
  29. package/dist/chat/athena-composer-controls.cjs +76 -0
  30. package/dist/chat/athena-composer-controls.cjs.map +1 -0
  31. package/dist/chat/athena-composer-controls.d.ts +21 -0
  32. package/dist/chat/athena-composer-controls.js +76 -0
  33. package/dist/chat/athena-composer-controls.js.map +1 -0
  34. package/dist/chat/composer-keyboard-hint.cjs +61 -0
  35. package/dist/chat/composer-keyboard-hint.cjs.map +1 -0
  36. package/dist/chat/composer-keyboard-hint.d.ts +33 -0
  37. package/dist/chat/composer-keyboard-hint.js +61 -0
  38. package/dist/chat/composer-keyboard-hint.js.map +1 -0
  39. package/dist/chat/message-time.cjs +64 -0
  40. package/dist/chat/message-time.cjs.map +1 -0
  41. package/dist/chat/message-time.d.ts +45 -0
  42. package/dist/chat/message-time.js +64 -0
  43. package/dist/chat/message-time.js.map +1 -0
  44. package/dist/chat/run-activity.cjs +38 -7
  45. package/dist/chat/run-activity.cjs.map +1 -1
  46. package/dist/chat/run-activity.d.ts +14 -3
  47. package/dist/chat/run-activity.js +39 -8
  48. package/dist/chat/run-activity.js.map +1 -1
  49. package/dist/chat/statewire-client-tools.cjs +2 -1
  50. package/dist/chat/statewire-client-tools.cjs.map +1 -1
  51. package/dist/chat/statewire-client-tools.js +2 -1
  52. package/dist/chat/statewire-client-tools.js.map +1 -1
  53. package/dist/chat/super-grouping/activity-timeline.cjs +2 -1
  54. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  55. package/dist/chat/super-grouping/activity-timeline.js +2 -1
  56. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  57. package/dist/chat/thread-scroll-to-bottom.cjs +24 -0
  58. package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -0
  59. package/dist/chat/thread-scroll-to-bottom.d.ts +11 -0
  60. package/dist/chat/thread-scroll-to-bottom.js +24 -0
  61. package/dist/chat/thread-scroll-to-bottom.js.map +1 -0
  62. package/dist/chat/tiptap-text.cjs +26 -95
  63. package/dist/chat/tiptap-text.cjs.map +1 -1
  64. package/dist/chat/tiptap-text.d.ts +13 -0
  65. package/dist/chat/tiptap-text.js +26 -95
  66. package/dist/chat/tiptap-text.js.map +1 -1
  67. package/dist/chat/use-athena-run-live.cjs +2 -1
  68. package/dist/chat/use-athena-run-live.cjs.map +1 -1
  69. package/dist/chat/use-athena-run-live.js +2 -1
  70. package/dist/chat/use-athena-run-live.js.map +1 -1
  71. package/dist/chat/use-statewire-approval-request.cjs +1 -0
  72. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  73. package/dist/chat/use-statewire-approval-request.js +1 -0
  74. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  75. package/dist/chat-ui/composer/tiptap-composer.cjs +39 -4
  76. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  77. package/dist/chat-ui/composer/tiptap-composer.d.ts +21 -0
  78. package/dist/chat-ui/composer/tiptap-composer.js +39 -4
  79. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  80. package/dist/chat-ui/index.cjs +15 -1
  81. package/dist/chat-ui/index.cjs.map +1 -1
  82. package/dist/chat-ui/index.d.ts +6 -3
  83. package/dist/chat-ui/index.js +16 -2
  84. package/dist/chat-ui/index.js.map +1 -1
  85. package/dist/chat-ui/mentions/mention-chip.cjs +31 -4
  86. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  87. package/dist/chat-ui/mentions/mention-chip.js +31 -4
  88. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  89. package/dist/chat-ui/messages/message-components.cjs +19 -1
  90. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  91. package/dist/chat-ui/messages/message-components.d.ts +13 -0
  92. package/dist/chat-ui/messages/message-components.js +19 -1
  93. package/dist/chat-ui/messages/message-components.js.map +1 -1
  94. package/dist/chat-ui/messages/runtime-message.cjs +2 -1
  95. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
  96. package/dist/chat-ui/messages/runtime-message.js +2 -1
  97. package/dist/chat-ui/messages/runtime-message.js.map +1 -1
  98. package/dist/chat-ui/messages/statewire-continue-run.cjs +1 -0
  99. package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
  100. package/dist/chat-ui/messages/statewire-continue-run.js +1 -0
  101. package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
  102. package/dist/chat-ui/messages/user-edit-composer.cjs +3 -1
  103. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  104. package/dist/chat-ui/messages/user-edit-composer.js +3 -1
  105. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  106. package/dist/chat-ui/messages/wake-marker.cjs +84 -0
  107. package/dist/chat-ui/messages/wake-marker.cjs.map +1 -0
  108. package/dist/chat-ui/messages/wake-marker.d.ts +16 -0
  109. package/dist/chat-ui/messages/wake-marker.js +84 -0
  110. package/dist/chat-ui/messages/wake-marker.js.map +1 -0
  111. package/dist/chat-ui/rich-text/chat-blocks.cjs +177 -0
  112. package/dist/chat-ui/rich-text/chat-blocks.cjs.map +1 -0
  113. package/dist/chat-ui/rich-text/chat-blocks.d.ts +58 -0
  114. package/dist/chat-ui/rich-text/chat-blocks.js +177 -0
  115. package/dist/chat-ui/rich-text/chat-blocks.js.map +1 -0
  116. package/dist/chat-ui/rich-text/chat-link.cjs +69 -0
  117. package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -0
  118. package/dist/chat-ui/rich-text/chat-link.d.ts +24 -0
  119. package/dist/chat-ui/rich-text/chat-link.js +69 -0
  120. package/dist/chat-ui/rich-text/chat-link.js.map +1 -0
  121. package/dist/chat-ui/rich-text/chat-message-body.cjs +144 -18
  122. package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
  123. package/dist/chat-ui/rich-text/chat-message-body.d.ts +10 -1
  124. package/dist/chat-ui/rich-text/chat-message-body.js +149 -23
  125. package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -1
  126. package/dist/chat-ui/rich-text/chat-node-views.cjs +38 -5
  127. package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
  128. package/dist/chat-ui/rich-text/chat-node-views.d.ts +11 -0
  129. package/dist/chat-ui/rich-text/chat-node-views.js +39 -6
  130. package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -1
  131. package/dist/chat-ui/rich-text/chat-text-schema.cjs +20 -3
  132. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  133. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +15 -2
  134. package/dist/chat-ui/rich-text/chat-text-schema.js +20 -3
  135. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  136. package/dist/chat-ui/rich-text/citation-anchors.cjs +139 -0
  137. package/dist/chat-ui/rich-text/citation-anchors.cjs.map +1 -0
  138. package/dist/chat-ui/rich-text/citation-anchors.d.ts +74 -0
  139. package/dist/chat-ui/rich-text/citation-anchors.js +139 -0
  140. package/dist/chat-ui/rich-text/citation-anchors.js.map +1 -0
  141. package/dist/chat-ui/statewire.cjs +8 -1
  142. package/dist/chat-ui/statewire.cjs.map +1 -1
  143. package/dist/chat-ui/statewire.d.ts +2 -0
  144. package/dist/chat-ui/statewire.js +8 -1
  145. package/dist/chat-ui/statewire.js.map +1 -1
  146. package/dist/chat-ui/thread/chat-composer-dock.cjs +27 -6
  147. package/dist/chat-ui/thread/chat-composer-dock.cjs.map +1 -1
  148. package/dist/chat-ui/thread/chat-composer-dock.d.ts +21 -1
  149. package/dist/chat-ui/thread/chat-composer-dock.js +28 -7
  150. package/dist/chat-ui/thread/chat-composer-dock.js.map +1 -1
  151. package/dist/chat-ui/thread/statewire-history-edge.cjs +12 -13
  152. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  153. package/dist/chat-ui/thread/statewire-history-edge.d.ts +11 -10
  154. package/dist/chat-ui/thread/statewire-history-edge.js +13 -14
  155. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  156. package/dist/chat-ui/thread/thread-loading-overlay.cjs +31 -0
  157. package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -0
  158. package/dist/chat-ui/thread/thread-loading-overlay.d.ts +14 -0
  159. package/dist/chat-ui/thread/thread-loading-overlay.js +31 -0
  160. package/dist/chat-ui/thread/thread-loading-overlay.js.map +1 -0
  161. package/dist/composer/ComposerDropZone.cjs +8 -1
  162. package/dist/composer/ComposerDropZone.cjs.map +1 -1
  163. package/dist/composer/ComposerDropZone.d.ts +6 -0
  164. package/dist/composer/ComposerDropZone.js +9 -2
  165. package/dist/composer/ComposerDropZone.js.map +1 -1
  166. package/dist/diagnostics/errors.cjs +20 -0
  167. package/dist/diagnostics/errors.cjs.map +1 -1
  168. package/dist/diagnostics/errors.d.ts +20 -0
  169. package/dist/diagnostics/errors.js +20 -0
  170. package/dist/diagnostics/errors.js.map +1 -1
  171. package/dist/index.cjs +47 -1
  172. package/dist/index.cjs.map +1 -1
  173. package/dist/index.d.ts +26 -7
  174. package/dist/index.js +51 -5
  175. package/dist/index.js.map +1 -1
  176. package/dist/lib/use-prefers-reduced-motion.cjs +29 -0
  177. package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -0
  178. package/dist/lib/use-prefers-reduced-motion.d.ts +6 -0
  179. package/dist/lib/use-prefers-reduced-motion.js +29 -0
  180. package/dist/lib/use-prefers-reduced-motion.js.map +1 -0
  181. package/dist/packages/agent-runtime/src/conversation-index.cjs.map +1 -1
  182. package/dist/packages/agent-runtime/src/conversation-index.js.map +1 -1
  183. package/dist/packages/agent-runtime/src/conversation-list.cjs +59 -0
  184. package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -1
  185. package/dist/packages/agent-runtime/src/conversation-list.js +60 -1
  186. package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -1
  187. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs +5 -3
  188. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  189. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js +5 -3
  190. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  191. package/dist/packages/agent-runtime/src/edit-command.cjs +21 -17
  192. package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
  193. package/dist/packages/agent-runtime/src/edit-command.js +22 -18
  194. package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
  195. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +9 -11
  196. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  197. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +9 -11
  198. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  199. package/dist/packages/agent-runtime/src/github-wake-event.cjs +86 -0
  200. package/dist/packages/agent-runtime/src/github-wake-event.cjs.map +1 -0
  201. package/dist/packages/agent-runtime/src/github-wake-event.js +86 -0
  202. package/dist/packages/agent-runtime/src/github-wake-event.js.map +1 -0
  203. package/dist/packages/agent-runtime/src/message-window.cjs +150 -42
  204. package/dist/packages/agent-runtime/src/message-window.cjs.map +1 -1
  205. package/dist/packages/agent-runtime/src/message-window.js +151 -43
  206. package/dist/packages/agent-runtime/src/message-window.js.map +1 -1
  207. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +13 -9
  208. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  209. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +13 -9
  210. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  211. package/dist/packages/agent-runtime/src/statewire-suspended.cjs +1 -3
  212. package/dist/packages/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  213. package/dist/packages/agent-runtime/src/statewire-suspended.js +1 -3
  214. package/dist/packages/agent-runtime/src/statewire-suspended.js.map +1 -1
  215. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  216. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  217. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs +61 -30
  218. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  219. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js +59 -28
  220. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  221. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs +56 -36
  222. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
  223. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js +59 -39
  224. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -1
  225. package/dist/packages/react/package.json.cjs +1 -1
  226. package/dist/packages/react/package.json.js +1 -1
  227. package/dist/provider/AthenaContext.cjs.map +1 -1
  228. package/dist/provider/AthenaContext.d.ts +3 -0
  229. package/dist/provider/AthenaContext.js.map +1 -1
  230. package/dist/provider/AthenaProvider.cjs +93 -45
  231. package/dist/provider/AthenaProvider.cjs.map +1 -1
  232. package/dist/provider/AthenaProvider.d.ts +6 -1
  233. package/dist/provider/AthenaProvider.js +97 -49
  234. package/dist/provider/AthenaProvider.js.map +1 -1
  235. package/dist/runtime/statewire-lifecycle.cjs +2 -1
  236. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  237. package/dist/runtime/statewire-lifecycle.js +2 -1
  238. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  239. package/dist/runtime/useAthenaStatewireRuntime.cjs +3 -2
  240. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  241. package/dist/runtime/useAthenaStatewireRuntime.d.ts +8 -12
  242. package/dist/runtime/useAthenaStatewireRuntime.js +3 -2
  243. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  244. package/dist/search/useAthenaRepoSearch.cjs +94 -0
  245. package/dist/search/useAthenaRepoSearch.cjs.map +1 -0
  246. package/dist/search/useAthenaRepoSearch.d.ts +95 -0
  247. package/dist/search/useAthenaRepoSearch.js +94 -0
  248. package/dist/search/useAthenaRepoSearch.js.map +1 -0
  249. package/dist/styles.css +1 -1
  250. package/dist/threads/SessionList.cjs +486 -0
  251. package/dist/threads/SessionList.cjs.map +1 -0
  252. package/dist/threads/SessionList.d.ts +60 -0
  253. package/dist/threads/SessionList.js +486 -0
  254. package/dist/threads/SessionList.js.map +1 -0
  255. package/dist/threads/api.cjs +112 -4
  256. package/dist/threads/api.cjs.map +1 -1
  257. package/dist/threads/api.d.ts +128 -1
  258. package/dist/threads/api.js +113 -5
  259. package/dist/threads/api.js.map +1 -1
  260. package/dist/threads/conversation-list-fetcher.cjs +27 -3
  261. package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
  262. package/dist/threads/conversation-list-fetcher.d.ts +16 -3
  263. package/dist/threads/conversation-list-fetcher.js +27 -3
  264. package/dist/threads/conversation-list-fetcher.js.map +1 -1
  265. package/dist/threads/index.d.ts +5 -1
  266. package/dist/threads/session-list-model.cjs +130 -0
  267. package/dist/threads/session-list-model.cjs.map +1 -0
  268. package/dist/threads/session-list-model.d.ts +62 -0
  269. package/dist/threads/session-list-model.js +130 -0
  270. package/dist/threads/session-list-model.js.map +1 -0
  271. package/dist/threads/statewire-thread-list.cjs +220 -38
  272. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  273. package/dist/threads/statewire-thread-list.d.ts +152 -2
  274. package/dist/threads/statewire-thread-list.js +222 -40
  275. package/dist/threads/statewire-thread-list.js.map +1 -1
  276. package/dist/threads/thread-prefetcher.cjs +63 -0
  277. package/dist/threads/thread-prefetcher.cjs.map +1 -0
  278. package/dist/threads/thread-prefetcher.d.ts +54 -0
  279. package/dist/threads/thread-prefetcher.js +63 -0
  280. package/dist/threads/thread-prefetcher.js.map +1 -0
  281. package/dist/threads/use-athena-session-attention.cjs +22 -0
  282. package/dist/threads/use-athena-session-attention.cjs.map +1 -0
  283. package/dist/threads/use-athena-session-attention.d.ts +24 -0
  284. package/dist/threads/use-athena-session-attention.js +22 -0
  285. package/dist/threads/use-athena-session-attention.js.map +1 -0
  286. package/dist/threads/use-rest-conversation-history.cjs +25 -2
  287. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  288. package/dist/threads/use-rest-conversation-history.d.ts +8 -1
  289. package/dist/threads/use-rest-conversation-history.js +25 -2
  290. package/dist/threads/use-rest-conversation-history.js.map +1 -1
  291. package/dist/threads/use-statewire-conversation-history.cjs +40 -16
  292. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  293. package/dist/threads/use-statewire-conversation-history.d.ts +13 -0
  294. package/dist/threads/use-statewire-conversation-history.js +40 -16
  295. package/dist/threads/use-statewire-conversation-history.js.map +1 -1
  296. package/dist/threads/use-thread-archive.cjs +128 -0
  297. package/dist/threads/use-thread-archive.cjs.map +1 -0
  298. package/dist/threads/use-thread-archive.d.ts +26 -0
  299. package/dist/threads/use-thread-archive.js +128 -0
  300. package/dist/threads/use-thread-archive.js.map +1 -0
  301. package/dist/threads/use-thread-favorite.cjs +53 -0
  302. package/dist/threads/use-thread-favorite.cjs.map +1 -0
  303. package/dist/threads/use-thread-favorite.d.ts +49 -0
  304. package/dist/threads/use-thread-favorite.js +53 -0
  305. package/dist/threads/use-thread-favorite.js.map +1 -0
  306. package/dist/threads/use-thread-field-override.cjs +184 -0
  307. package/dist/threads/use-thread-field-override.cjs.map +1 -0
  308. package/dist/threads/use-thread-field-override.d.ts +55 -0
  309. package/dist/threads/use-thread-field-override.js +184 -0
  310. package/dist/threads/use-thread-field-override.js.map +1 -0
  311. package/dist/threads/use-thread-rename.cjs +53 -0
  312. package/dist/threads/use-thread-rename.cjs.map +1 -0
  313. package/dist/threads/use-thread-rename.d.ts +48 -0
  314. package/dist/threads/use-thread-rename.js +53 -0
  315. package/dist/threads/use-thread-rename.js.map +1 -0
  316. package/dist/tools/index.cjs +5 -1
  317. package/dist/tools/index.cjs.map +1 -1
  318. package/dist/tools/index.d.ts +1 -1
  319. package/dist/tools/index.js +7 -3
  320. package/dist/tools/index.js.map +1 -1
  321. package/dist/tools/misc-tool-uis.cjs +2 -1
  322. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  323. package/dist/tools/misc-tool-uis.js +2 -1
  324. package/dist/tools/misc-tool-uis.js.map +1 -1
  325. package/dist/tools/primitives.cjs +25 -2
  326. package/dist/tools/primitives.cjs.map +1 -1
  327. package/dist/tools/primitives.d.ts +9 -2
  328. package/dist/tools/primitives.js +26 -3
  329. package/dist/tools/primitives.js.map +1 -1
  330. package/dist/tools/tool-appearance.cjs +11 -0
  331. package/dist/tools/tool-appearance.cjs.map +1 -0
  332. package/dist/tools/tool-appearance.d.ts +29 -0
  333. package/dist/tools/tool-appearance.js +11 -0
  334. package/dist/tools/tool-appearance.js.map +1 -0
  335. package/dist/tools/tool-fallback.cjs +211 -13
  336. package/dist/tools/tool-fallback.cjs.map +1 -1
  337. package/dist/tools/tool-fallback.d.ts +31 -4
  338. package/dist/tools/tool-fallback.js +214 -16
  339. package/dist/tools/tool-fallback.js.map +1 -1
  340. package/dist/tools/use-elapsed-seconds.cjs +24 -0
  341. package/dist/tools/use-elapsed-seconds.cjs.map +1 -0
  342. package/dist/tools/use-elapsed-seconds.d.ts +10 -0
  343. package/dist/tools/use-elapsed-seconds.js +24 -0
  344. package/dist/tools/use-elapsed-seconds.js.map +1 -0
  345. package/dist/tools/voice-update-tool-ui.cjs +2 -1
  346. package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
  347. package/dist/tools/voice-update-tool-ui.js +2 -1
  348. package/dist/tools/voice-update-tool-ui.js.map +1 -1
  349. package/package.json +1 -1
  350. package/src/chat-ui/tailwind-preset.js +14 -1
@@ -0,0 +1,130 @@
1
+ const SESSION_LIST_GROUPS = [
2
+ "Needs you",
3
+ "Working",
4
+ "Pinned",
5
+ "Recent"
6
+ ];
7
+ function sessionListGroupOf(thread) {
8
+ if (thread.attention === "needs_you") return "Needs you";
9
+ if (thread.attention === "working") return "Working";
10
+ if (thread.isFavorited) return "Pinned";
11
+ return "Recent";
12
+ }
13
+ function groupSessions(threads, grouped) {
14
+ if (!grouped) return threads.length > 0 ? [{ group: null, items: [...threads] }] : [];
15
+ const byGroup = /* @__PURE__ */ new Map();
16
+ for (const thread of threads) {
17
+ const group = sessionListGroupOf(thread);
18
+ const items = byGroup.get(group) ?? [];
19
+ items.push(thread);
20
+ byGroup.set(group, items);
21
+ }
22
+ return SESSION_LIST_GROUPS.flatMap((group) => {
23
+ const items = byGroup.get(group);
24
+ return items ? [{ group, items }] : [];
25
+ });
26
+ }
27
+ function sessionIndicator(thread) {
28
+ if (thread.attention === "needs_you") return "needs_you";
29
+ if (thread.attention === "working") return "working";
30
+ if (thread.isUnread) return "unread";
31
+ if (thread.attention === "watching") return "watching";
32
+ return null;
33
+ }
34
+ function relativeTime(value, now = Date.now()) {
35
+ const timestamp = Date.parse(value);
36
+ if (!Number.isFinite(timestamp)) return "";
37
+ const minutes = Math.floor(Math.max(0, now - timestamp) / 6e4);
38
+ if (minutes < 1) return "just now";
39
+ if (minutes < 60) return `${minutes}m ago`;
40
+ const hours = Math.floor(minutes / 60);
41
+ if (hours < 24) return `${hours}h ago`;
42
+ const days = Math.floor(hours / 24);
43
+ return days < 7 ? `${days}d ago` : new Date(timestamp).toLocaleDateString();
44
+ }
45
+ function sessionSecondaryLine(thread, now = Date.now()) {
46
+ var _a;
47
+ const nextAction = (_a = thread.nextAction) == null ? void 0 : _a.trim();
48
+ if (nextAction) {
49
+ const tone = thread.attention === "needs_you" ? "needs_you" : thread.attention === "ready" ? "ready" : thread.attention === "error" ? "error" : "muted";
50
+ return { kind: "next_action", text: nextAction, tone };
51
+ }
52
+ return { kind: "updated", text: relativeTime(thread.updatedAt, now), tone: "muted" };
53
+ }
54
+ function pullRequestChipState(pullRequest) {
55
+ if (pullRequest.state === "MERGED") return "merged";
56
+ if (pullRequest.state === "CLOSED") return "closed";
57
+ return pullRequest.isDraft ? "draft" : "open";
58
+ }
59
+ function primaryPullRequest(pullRequests) {
60
+ const rank = (pullRequest) => pullRequest.state === "OPEN" ? pullRequest.isDraft ? 1 : 0 : 2;
61
+ return [...pullRequests].sort(
62
+ (a, b) => rank(a) - rank(b) || Date.parse(b.updatedAt) - Date.parse(a.updatedAt)
63
+ )[0];
64
+ }
65
+ function pullRequestChip(pullRequests) {
66
+ if (!pullRequests || pullRequests.length === 0) return null;
67
+ const primary = primaryPullRequest(pullRequests);
68
+ if (!primary) return null;
69
+ return {
70
+ state: pullRequestChipState(primary),
71
+ count: pullRequests.length,
72
+ label: pullRequests.length === 1 ? `#${primary.number}` : `${pullRequests.length} PRs`,
73
+ url: primary.url,
74
+ title: primary.title,
75
+ checksState: primary.checksState,
76
+ reviewDecision: primary.reviewDecision
77
+ };
78
+ }
79
+ const CHANNEL_LABELS = {
80
+ web: "Athena",
81
+ olympus: "Athena",
82
+ github: "GitHub",
83
+ api: "API",
84
+ email: "Email",
85
+ agent_email: "Email",
86
+ slack: "Slack",
87
+ sms: "SMS",
88
+ teams: "Teams",
89
+ task: "Task",
90
+ orchestration: "Orchestration",
91
+ computer: "Computer",
92
+ voice: "Voice",
93
+ mobile: "Mobile"
94
+ };
95
+ function humanize(value) {
96
+ const words = value.replace(/^athena[-_]/, "").replace(/[-_.]+/g, " ").trim();
97
+ return words ? words.charAt(0).toUpperCase() + words.slice(1) : "";
98
+ }
99
+ function sessionOriginLabel(thread) {
100
+ var _a, _b, _c;
101
+ const appId = ((_a = thread.appId) == null ? void 0 : _a.trim().toLowerCase()) ?? "";
102
+ if (appId) {
103
+ if (appId.includes("chrome")) return "Chrome";
104
+ if (appId.includes("powerpoint")) return "PowerPoint";
105
+ if (appId.includes("word")) return "Word";
106
+ if (appId.includes("excel")) return "Excel";
107
+ if (appId.includes("office")) return "Office";
108
+ if (appId.includes("mobile")) return "Mobile";
109
+ if (appId.startsWith("asset_")) return "Computer";
110
+ if (CHANNEL_LABELS[appId]) return CHANNEL_LABELS[appId];
111
+ }
112
+ const channel = ((_b = thread.startChannel) == null ? void 0 : _b.trim().toLowerCase()) ?? "";
113
+ if (channel) return CHANNEL_LABELS[channel] ?? humanize(channel);
114
+ if (appId) return humanize(appId) || null;
115
+ const trigger = ((_c = thread.triggerType) == null ? void 0 : _c.trim().toLowerCase()) ?? "";
116
+ if (trigger && trigger !== "manual") return humanize(trigger) || null;
117
+ return null;
118
+ }
119
+ export {
120
+ SESSION_LIST_GROUPS,
121
+ groupSessions,
122
+ pullRequestChip,
123
+ pullRequestChipState,
124
+ relativeTime,
125
+ sessionIndicator,
126
+ sessionListGroupOf,
127
+ sessionOriginLabel,
128
+ sessionSecondaryLine
129
+ };
130
+ //# sourceMappingURL=session-list-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-list-model.js","sources":["../../src/threads/session-list-model.ts"],"sourcesContent":["/**\n * Pure derivations behind `SessionList`: which group a session lands in,\n * which status indicator it shows, what its second line says, how its pull\n * requests collapse into one chip, and how its origin is labelled. Kept\n * React-free so the render tests stay thin and hosts that draw their own rows\n * (`useAthenaSessionAttention`) can reuse the same rules.\n */\nimport type { ConversationPullRequest } from '@athenaintel/agent-runtime';\nimport type { AthenaStatewireThreadSummary } from './statewire-thread-list';\n\nexport type SessionListGroup = 'Needs you' | 'Working' | 'Pinned' | 'Recent';\n\n/** Display order; a session appears once, in the FIRST group that applies. */\nexport const SESSION_LIST_GROUPS: readonly SessionListGroup[] = [\n 'Needs you',\n 'Working',\n 'Pinned',\n 'Recent',\n];\n\nexport function sessionListGroupOf(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isFavorited'>,\n): SessionListGroup {\n if (thread.attention === 'needs_you') return 'Needs you';\n if (thread.attention === 'working') return 'Working';\n if (thread.isFavorited) return 'Pinned';\n return 'Recent';\n}\n\nexport interface SessionListSection {\n /** `null` for the single ungrouped section. */\n group: SessionListGroup | null;\n items: AthenaStatewireThreadSummary[];\n}\n\n/** Sections in display order; empty groups are omitted and row order is kept within a group. */\nexport function groupSessions(\n threads: readonly AthenaStatewireThreadSummary[],\n grouped: boolean,\n): SessionListSection[] {\n if (!grouped) return threads.length > 0 ? [{ group: null, items: [...threads] }] : [];\n const byGroup = new Map<SessionListGroup, AthenaStatewireThreadSummary[]>();\n for (const thread of threads) {\n const group = sessionListGroupOf(thread);\n const items = byGroup.get(group) ?? [];\n items.push(thread);\n byGroup.set(group, items);\n }\n return SESSION_LIST_GROUPS.flatMap((group) => {\n const items = byGroup.get(group);\n return items ? [{ group, items }] : [];\n });\n}\n\n/**\n * The status indicator at the head of a row: `needs_you` an orange dot,\n * `working` a spinner, `unread` (and not needs-you) a blue dot, `watching` a\n * clock, otherwise none. One indicator per row, in that precedence.\n */\nexport type SessionIndicator = 'needs_you' | 'working' | 'unread' | 'watching' | null;\n\nexport function sessionIndicator(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'isUnread'>,\n): SessionIndicator {\n if (thread.attention === 'needs_you') return 'needs_you';\n if (thread.attention === 'working') return 'working';\n if (thread.isUnread) return 'unread';\n if (thread.attention === 'watching') return 'watching';\n return null;\n}\n\nexport type SessionLineTone = 'needs_you' | 'ready' | 'error' | 'muted';\n\nexport interface SessionSecondaryLine {\n kind: 'next_action' | 'updated';\n text: string;\n tone: SessionLineTone;\n}\n\n/** \"5m ago\" / \"3h ago\" / \"2d ago\"; a locale date past a week; empty for an unparseable value. */\nexport function relativeTime(value: string, now: number = Date.now()): string {\n const timestamp = Date.parse(value);\n if (!Number.isFinite(timestamp)) return '';\n const minutes = Math.floor(Math.max(0, now - timestamp) / 60_000);\n if (minutes < 1) return 'just now';\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return days < 7 ? `${days}d ago` : new Date(timestamp).toLocaleDateString();\n}\n\n/**\n * The row's second line: the server's next action coloured by attention\n * (needs-you orange, ready green, error red), else the muted relative time\n * of the last update.\n */\nexport function sessionSecondaryLine(\n thread: Pick<AthenaStatewireThreadSummary, 'attention' | 'nextAction' | 'updatedAt'>,\n now: number = Date.now(),\n): SessionSecondaryLine {\n const nextAction = thread.nextAction?.trim();\n if (nextAction) {\n const tone: SessionLineTone =\n thread.attention === 'needs_you'\n ? 'needs_you'\n : thread.attention === 'ready'\n ? 'ready'\n : thread.attention === 'error'\n ? 'error'\n : 'muted';\n return { kind: 'next_action', text: nextAction, tone };\n }\n return { kind: 'updated', text: relativeTime(thread.updatedAt, now), tone: 'muted' };\n}\n\nexport type PullRequestChipState = 'open' | 'draft' | 'merged' | 'closed';\n\nexport function pullRequestChipState(\n pullRequest: Pick<ConversationPullRequest, 'state' | 'isDraft'>,\n): PullRequestChipState {\n if (pullRequest.state === 'MERGED') return 'merged';\n if (pullRequest.state === 'CLOSED') return 'closed';\n return pullRequest.isDraft ? 'draft' : 'open';\n}\n\nexport interface PullRequestChip {\n /** State of the primary pull request (the one the chip links to). */\n state: PullRequestChipState;\n count: number;\n /** `#123` for one pull request, `3 PRs` for several. */\n label: string;\n url: string;\n title: string;\n checksState: ConversationPullRequest['checksState'];\n reviewDecision: string | null;\n}\n\n/**\n * The pull request a chip stands for when a session opened several: the one\n * still in flight (open before draft), then the most recently updated.\n */\nfunction primaryPullRequest(\n pullRequests: readonly ConversationPullRequest[],\n): ConversationPullRequest | undefined {\n const rank = (pullRequest: ConversationPullRequest): number =>\n pullRequest.state === 'OPEN' ? (pullRequest.isDraft ? 1 : 0) : 2;\n return [...pullRequests].sort(\n (a, b) => rank(a) - rank(b) || Date.parse(b.updatedAt) - Date.parse(a.updatedAt),\n )[0];\n}\n\n/** One chip per row, or `null` when the session opened no pull request (or none is known). */\nexport function pullRequestChip(\n pullRequests: readonly ConversationPullRequest[] | null | undefined,\n): PullRequestChip | null {\n if (!pullRequests || pullRequests.length === 0) return null;\n const primary = primaryPullRequest(pullRequests);\n if (!primary) return null;\n return {\n state: pullRequestChipState(primary),\n count: pullRequests.length,\n label: pullRequests.length === 1 ? `#${primary.number}` : `${pullRequests.length} PRs`,\n url: primary.url,\n title: primary.title,\n checksState: primary.checksState,\n reviewDecision: primary.reviewDecision,\n };\n}\n\nconst CHANNEL_LABELS: Record<string, string> = {\n web: 'Athena',\n olympus: 'Athena',\n github: 'GitHub',\n api: 'API',\n email: 'Email',\n agent_email: 'Email',\n slack: 'Slack',\n sms: 'SMS',\n teams: 'Teams',\n task: 'Task',\n orchestration: 'Orchestration',\n computer: 'Computer',\n voice: 'Voice',\n mobile: 'Mobile',\n};\n\nfunction humanize(value: string): string {\n const words = value.replace(/^athena[-_]/, '').replace(/[-_.]+/g, ' ').trim();\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : '';\n}\n\n/**\n * The origin badge: the client app when it is a recognizable surface\n * (Chrome, an Office host, mobile, a computer asset), else the start channel,\n * else a non-manual trigger; `null` when nothing is known.\n */\nexport function sessionOriginLabel(\n thread: Pick<AthenaStatewireThreadSummary, 'startChannel' | 'appId' | 'triggerType'>,\n): string | null {\n const appId = thread.appId?.trim().toLowerCase() ?? '';\n if (appId) {\n if (appId.includes('chrome')) return 'Chrome';\n if (appId.includes('powerpoint')) return 'PowerPoint';\n if (appId.includes('word')) return 'Word';\n if (appId.includes('excel')) return 'Excel';\n if (appId.includes('office')) return 'Office';\n if (appId.includes('mobile')) return 'Mobile';\n if (appId.startsWith('asset_')) return 'Computer';\n if (CHANNEL_LABELS[appId]) return CHANNEL_LABELS[appId];\n }\n const channel = thread.startChannel?.trim().toLowerCase() ?? '';\n if (channel) return CHANNEL_LABELS[channel] ?? humanize(channel);\n if (appId) return humanize(appId) || null;\n const trigger = thread.triggerType?.trim().toLowerCase() ?? '';\n if (trigger && trigger !== 'manual') return humanize(trigger) || null;\n return null;\n}\n"],"names":[],"mappings":"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"}
@@ -4,17 +4,18 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  require("../packages/agent-runtime/src/generated/runconfig-contract.cjs");
5
5
  const react = require("react");
6
6
  const conversationIndex = require("../packages/agent-runtime/src/conversation-index.cjs");
7
+ const conversationList = require("../packages/agent-runtime/src/conversation-list.cjs");
7
8
  const useConversationList = require("../packages/agent-runtime/src/use-conversation-list.cjs");
8
9
  require("../packages/agent-runtime/src/statewire-state.cjs");
9
10
  require("../packages/agent-runtime/src/messages.cjs");
10
- require("@assistant-ui/react-statewire");
11
+ require("statewire");
11
12
  require("@assistant-ui/store");
12
13
  require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
13
14
  require("../packages/agent-runtime/src/statewire-suspended.cjs");
14
15
  require("@assistant-ui/tap");
15
16
  require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
16
- require("statewire");
17
17
  require("../packages/agent-runtime/src/thread-status.cjs");
18
+ require("@assistant-ui/react-statewire");
18
19
  require("@assistant-ui/core");
19
20
  require("../packages/agent-runtime/src/thread-handoff.cjs");
20
21
  const reactQuery = require("@tanstack/react-query");
@@ -25,7 +26,12 @@ const api = require("./api.cjs");
25
26
  const conversationListFetcher = require("./conversation-list-fetcher.cjs");
26
27
  const credentialShape = require("./credential-shape.cjs");
27
28
  const mintThreadId = require("./mint-thread-id.cjs");
29
+ const threadIdContext = require("./thread-id-context.cjs");
30
+ const threadPrefetcher = require("./thread-prefetcher.cjs");
28
31
  const title = require("./title.cjs");
32
+ const useThreadArchive = require("./use-thread-archive.cjs");
33
+ const useThreadFavorite = require("./use-thread-favorite.cjs");
34
+ const useThreadRename = require("./use-thread-rename.cjs");
29
35
  const AthenaStatewireThreadListContext = react.createContext(null);
30
36
  function useAthenaStatewireThreadList() {
31
37
  return react.useContext(AthenaStatewireThreadListContext);
@@ -34,6 +40,25 @@ function useRefreshThreadList() {
34
40
  var _a;
35
41
  return ((_a = useAthenaStatewireThreadList()) == null ? void 0 : _a.refresh) ?? null;
36
42
  }
43
+ function threadSummaryFromConversation(conversation) {
44
+ return {
45
+ id: conversation.threadId,
46
+ title: title.normalizeThreadTitle(conversation.title) ?? null,
47
+ attention: conversationList.deriveConversationAttention(conversation),
48
+ nextAction: conversation.nextAction ?? null,
49
+ attentionSource: conversation.attentionSource ?? null,
50
+ isFavorited: conversation.isFavorited ?? false,
51
+ isUnread: conversation.isUnread,
52
+ sessionStatus: conversation.sessionStatus,
53
+ runStatus: conversation.runStatus,
54
+ startChannel: conversation.sourceChannel,
55
+ appId: conversation.appId,
56
+ triggerType: conversation.triggerType,
57
+ pullRequests: conversation.pullRequests ?? null,
58
+ lastWake: conversation.lastWake ?? null,
59
+ updatedAt: conversation.updatedAt
60
+ };
61
+ }
37
62
  const THREAD_LIST_PAGE_SIZE = 50;
38
63
  function StatewireThreadListState({
39
64
  backendUrl,
@@ -43,12 +68,15 @@ function StatewireThreadListState({
43
68
  getToken,
44
69
  appId,
45
70
  initialThreadId,
71
+ includePullRequests,
72
+ snapshotCache,
46
73
  children
47
74
  }) {
48
75
  var _a, _b, _c;
49
76
  const [active, setActive] = react.useState(
50
77
  () => initialThreadId ? { id: initialThreadId, isNew: false } : { id: mintThreadId.mintThreadId(), isNew: true }
51
78
  );
79
+ const [search, setSearch] = react.useState("");
52
80
  const tokenRef = react.useRef(token);
53
81
  tokenRef.current = token;
54
82
  const apiKeyRef = react.useRef(apiKey);
@@ -58,30 +86,35 @@ function StatewireThreadListState({
58
86
  const authContext = react.useContext(AthenaAuthContext.AthenaAuthContext);
59
87
  const principal = ((_a = authContext == null ? void 0 : authContext.user) == null ? void 0 : _a.userId) ?? "";
60
88
  const hasAuth = !!(apiKey || token || getToken);
61
- const fetchPage = react.useMemo(
62
- () => conversationListFetcher.createRestConversationListFetcher({
63
- backendUrl,
64
- // Resolved per request with the attach's token semantics (getter first,
65
- // host-held token as the fallback) so a rotated token is never stale.
66
- getAuth: async () => ({
67
- apiKey: apiKeyRef.current,
68
- token: await statewireAuthHeaders.resolveStatewireAuthToken(
69
- { apiKey: apiKeyRef.current, token: tokenRef.current, getToken: getTokenRef.current },
70
- { staleAuth: false }
71
- )
72
- })
89
+ const getAuth = react.useCallback(
90
+ async () => ({
91
+ apiKey: apiKeyRef.current,
92
+ token: await statewireAuthHeaders.resolveStatewireAuthToken(
93
+ { apiKey: apiKeyRef.current, token: tokenRef.current, getToken: getTokenRef.current },
94
+ { staleAuth: false }
95
+ )
73
96
  }),
74
- [backendUrl]
97
+ []
75
98
  );
99
+ const fetchPage = react.useMemo(
100
+ () => conversationListFetcher.createRestConversationListFetcher({ backendUrl, includePullRequests, getAuth }),
101
+ [backendUrl, includePullRequests, getAuth]
102
+ );
103
+ const trimmedSearch = search.trim();
76
104
  const filter = react.useMemo(
77
- () => appId ? { appId } : {},
78
- [appId]
105
+ () => ({
106
+ ...appId ? { appId } : {},
107
+ ...trimmedSearch ? { search: trimmedSearch } : {}
108
+ }),
109
+ [appId, trimmedSearch]
79
110
  );
80
111
  const list = useConversationList.useConversationList({
81
112
  fetchPage,
82
113
  filter,
83
114
  pageSize: THREAD_LIST_PAGE_SIZE,
84
- scopeKey: `${backendUrl}::${principal}::${hasAuth ? "auth" : "anon"}`,
115
+ // Pull-request opt-in changes what a cached row holds, so it is part of
116
+ // the cache identity.
117
+ scopeKey: `${backendUrl}::${principal}::${hasAuth ? "auth" : "anon"}::${includePullRequests ? "prs" : "no-prs"}`,
85
118
  enabled: hasAuth
86
119
  });
87
120
  const indexHeaders = react.useCallback(
@@ -128,25 +161,94 @@ function StatewireThreadListState({
128
161
  headers: indexHeaders,
129
162
  enabled: indexEnabled
130
163
  });
131
- const indexTitles = react.useMemo(() => {
132
- const titles = /* @__PURE__ */ new Map();
133
- for (const entry of index.entries ?? []) {
134
- titles.set(entry.thread_id, title.normalizeThreadTitle(entry.title) ?? null);
135
- }
136
- return titles;
164
+ const indexByThread = react.useMemo(() => {
165
+ const entries = /* @__PURE__ */ new Map();
166
+ for (const entry of index.entries ?? []) entries.set(entry.thread_id, entry);
167
+ return entries;
137
168
  }, [index.entries]);
169
+ const mergedConversations = react.useMemo(
170
+ () => list.conversations.map((conversation) => {
171
+ const entry = indexByThread.get(conversation.threadId);
172
+ if (!entry) return conversation;
173
+ const merged = conversationList.summaryFromConversationIndexEntry(entry, conversation);
174
+ return title.normalizeThreadTitle(merged.title) === void 0 ? { ...merged, title: conversation.title } : merged;
175
+ }),
176
+ [list.conversations, indexByThread]
177
+ );
178
+ const listPatchConversation = list.patchConversation;
179
+ const favorite = useThreadFavorite.useThreadFavorite({
180
+ backendUrl,
181
+ principalId: principal,
182
+ getAuth,
183
+ rows: mergedConversations,
184
+ onServerTruth: ({ threadId, isFavorited }) => listPatchConversation(threadId, { isFavorited })
185
+ });
186
+ const favoriteOverrides = favorite.overrides;
187
+ const rename = useThreadRename.useThreadRename({
188
+ backendUrl,
189
+ principalId: principal,
190
+ getAuth,
191
+ rows: mergedConversations,
192
+ onServerTruth: ({ threadId, title: title2 }) => listPatchConversation(threadId, { title: title2 })
193
+ });
194
+ const titleOverrides = rename.overrides;
195
+ const listRemoveConversation = list.removeConversation;
196
+ const archive = useThreadArchive.useThreadArchive({
197
+ backendUrl,
198
+ principalId: principal,
199
+ getAuth,
200
+ onArchived: (threadId) => {
201
+ listRemoveConversation(threadId);
202
+ setActive(
203
+ (current) => current.id === threadId ? { id: mintThreadId.mintThreadId(), isNew: true } : current
204
+ );
205
+ }
206
+ });
207
+ const hiddenThreadIds = archive.hiddenThreadIds;
208
+ const archiveRelease = archive.release;
209
+ react.useEffect(() => {
210
+ if (hiddenThreadIds.size === 0) return;
211
+ const forgotten = [...hiddenThreadIds].filter(
212
+ (threadId) => !mergedConversations.some((conversation) => conversation.threadId === threadId) && !indexByThread.has(threadId)
213
+ );
214
+ if (forgotten.length > 0) archiveRelease(forgotten);
215
+ }, [hiddenThreadIds, mergedConversations, indexByThread, archiveRelease]);
138
216
  const data = react.useMemo(
139
- () => list.conversations.map((conversation) => ({
140
- id: conversation.threadId,
141
- title: indexTitles.get(conversation.threadId) ?? title.normalizeThreadTitle(conversation.title) ?? null
142
- })),
143
- [list.conversations, indexTitles]
217
+ () => useThreadRename.withTitleOverrides(
218
+ useThreadFavorite.withFavoriteOverrides(mergedConversations, favoriteOverrides),
219
+ titleOverrides
220
+ ).filter((conversation) => !hiddenThreadIds.has(conversation.threadId)).map(threadSummaryFromConversation),
221
+ [mergedConversations, favoriteOverrides, titleOverrides, hiddenThreadIds]
144
222
  );
145
223
  const isLoading = list.isLoading;
224
+ const lastActiveConversationRef = react.useRef(null);
225
+ const activeConversation = react.useMemo(() => {
226
+ var _a2;
227
+ const listed = mergedConversations.find((conversation) => conversation.threadId === active.id);
228
+ if (listed) return listed;
229
+ const remembered = ((_a2 = lastActiveConversationRef.current) == null ? void 0 : _a2.threadId) === active.id ? lastActiveConversationRef.current : void 0;
230
+ const entry = indexByThread.get(active.id);
231
+ if (entry) return conversationList.summaryFromConversationIndexEntry(entry, remembered);
232
+ return remembered ?? null;
233
+ }, [mergedConversations, indexByThread, active.id]);
234
+ if (activeConversation !== null) lastActiveConversationRef.current = activeConversation;
235
+ const activeThread = react.useMemo(
236
+ () => activeConversation ? threadSummaryFromConversation(
237
+ useThreadRename.withTitleOverride(
238
+ useThreadFavorite.withFavoriteOverride(activeConversation, favoriteOverrides),
239
+ titleOverrides
240
+ )
241
+ ) : null,
242
+ [activeConversation, favoriteOverrides, titleOverrides]
243
+ );
146
244
  const listRefresh = list.refresh;
147
245
  const refresh = react.useCallback(() => {
148
246
  void listRefresh();
149
247
  }, [listRefresh]);
248
+ const listFetchNextPage = list.fetchNextPage;
249
+ const fetchNextPage = react.useCallback(() => {
250
+ void listFetchNextPage();
251
+ }, [listFetchNextPage]);
150
252
  const refreshedForRef = react.useRef(/* @__PURE__ */ new Set());
151
253
  react.useEffect(() => {
152
254
  if (index.entries === null) return;
@@ -166,10 +268,31 @@ function StatewireThreadListState({
166
268
  (current) => current.id === threadId ? current : { id: threadId, isNew: false }
167
269
  );
168
270
  }, []);
271
+ const prefetchScope = `${backendUrl}::${principal}::${credentialGeneration}`;
272
+ const prefetchScopeRef = react.useRef(prefetchScope);
273
+ prefetchScopeRef.current = prefetchScope;
274
+ const prefetcher = react.useMemo(() => {
275
+ if (!snapshotCache) return null;
276
+ const scope = prefetchScope;
277
+ return threadPrefetcher.createThreadPrefetcher({
278
+ cache: snapshotCache,
279
+ fetchState: async (threadId) => api.getThreadState(backendUrl, await getAuth(), threadId, { skipCache: false }),
280
+ isCurrent: () => prefetchScopeRef.current === scope
281
+ });
282
+ }, [snapshotCache, prefetchScope, backendUrl, getAuth]);
283
+ const activeIdRef = react.useRef(active.id);
284
+ activeIdRef.current = active.id;
285
+ const prefetchThread = react.useCallback(
286
+ (threadId) => {
287
+ if (!prefetcher || !threadId || threadId === activeIdRef.current) return;
288
+ prefetcher.prefetch(threadId);
289
+ },
290
+ [prefetcher]
291
+ );
169
292
  const newThread = react.useCallback(() => {
170
293
  setActive({ id: mintThreadId.mintThreadId(), isNew: true });
171
294
  }, []);
172
- const isPersisted = data.some((thread) => thread.id === active.id);
295
+ const isPersisted = data.some((thread) => thread.id === active.id) || indexByThread.has(active.id);
173
296
  react.useEffect(() => {
174
297
  if (isPersisted) {
175
298
  setActive((current) => current.isNew ? { ...current, isNew: false } : current);
@@ -180,14 +303,62 @@ function StatewireThreadListState({
180
303
  () => ({
181
304
  threads: data,
182
305
  isLoading,
306
+ isFetching: list.isFetching,
307
+ hasResolvedFirstPage: list.hasResolvedFirstPage,
183
308
  activeThreadId: active.id,
309
+ activeThread,
184
310
  isNewChat: active.isNew,
185
311
  selectThread,
312
+ prefetchThread,
186
313
  newThread,
187
314
  refresh,
315
+ search,
316
+ setSearch,
317
+ hasNextPage: list.hasNextPage,
318
+ isFetchingNextPage: list.isFetchingNextPage,
319
+ fetchNextPage,
320
+ setFavorited: favorite.setFavorited,
321
+ favoritePending: favorite.isPending,
322
+ favoritePendingThreadIds: favorite.pendingThreadIds,
323
+ favoriteToggleAvailable: favorite.isAvailable,
324
+ renameThread: rename.rename,
325
+ renamePendingThreadIds: rename.pendingThreadIds,
326
+ renameAvailable: rename.isAvailable,
327
+ archiveThread: archive.archive,
328
+ archivePendingThreadIds: archive.pendingThreadIds,
329
+ archivePending: archive.isPending,
330
+ archiveAvailable: archive.isAvailable,
188
331
  titleSource
189
332
  }),
190
- [data, isLoading, active.id, active.isNew, selectThread, newThread, refresh, titleSource]
333
+ [
334
+ data,
335
+ isLoading,
336
+ list.isFetching,
337
+ list.hasResolvedFirstPage,
338
+ active.id,
339
+ activeThread,
340
+ active.isNew,
341
+ selectThread,
342
+ prefetchThread,
343
+ newThread,
344
+ refresh,
345
+ search,
346
+ list.hasNextPage,
347
+ list.isFetchingNextPage,
348
+ fetchNextPage,
349
+ favorite.setFavorited,
350
+ favorite.isPending,
351
+ favorite.pendingThreadIds,
352
+ favorite.isAvailable,
353
+ rename.rename,
354
+ rename.pendingThreadIds,
355
+ rename.isAvailable,
356
+ archive.archive,
357
+ archive.pendingThreadIds,
358
+ archive.isPending,
359
+ archive.isAvailable,
360
+ titleSource
361
+ ]
191
362
  );
192
363
  return /* @__PURE__ */ jsxRuntime.jsx(AthenaStatewireThreadListContext.Provider, { value, children });
193
364
  }
@@ -199,6 +370,8 @@ function AthenaStatewireThreadListProvider({
199
370
  getToken,
200
371
  appId,
201
372
  initialThreadId,
373
+ includePullRequests = true,
374
+ snapshotCache,
202
375
  children
203
376
  }) {
204
377
  const [queryClient] = react.useState(() => new reactQuery.QueryClient());
@@ -212,6 +385,8 @@ function AthenaStatewireThreadListProvider({
212
385
  getToken,
213
386
  appId,
214
387
  initialThreadId,
388
+ includePullRequests,
389
+ snapshotCache,
215
390
  children
216
391
  }
217
392
  ) });
@@ -222,27 +397,32 @@ const TITLE_POLL_MAX_DURATION_MS = 6e4;
222
397
  function StatewireThreadTitlePoller() {
223
398
  var _a;
224
399
  const list = useAthenaStatewireThreadList();
400
+ const activeThreadId = threadIdContext.useAthenaStatewireThreadId();
225
401
  const hasMessages = react$1.useAuiState((s) => {
226
402
  var _a2;
227
403
  return (((_a2 = s.optional.thread) == null ? void 0 : _a2.messages.length) ?? 0) > 0;
228
404
  });
229
- const activeThreadId = (list == null ? void 0 : list.activeThreadId) ?? null;
230
405
  const titleSource = (list == null ? void 0 : list.titleSource) ?? "poll";
231
406
  const entry = list == null ? void 0 : list.threads.find((thread) => thread.id === activeThreadId);
232
407
  const title$1 = ((_a = entry == null ? void 0 : entry.title) == null ? void 0 : _a.trim()) ?? "";
233
408
  const hasTitle = title$1.length > 0 && !title.isSerializedContentPartsTitle(title$1);
234
- const polledThreadsRef = react.useRef(/* @__PURE__ */ new Set());
409
+ const visitRef = react.useRef(null);
235
410
  const refreshRef = react.useRef(list == null ? void 0 : list.refresh);
236
411
  refreshRef.current = list == null ? void 0 : list.refresh;
237
412
  react.useEffect(() => {
238
- if (!activeThreadId || !hasMessages || hasTitle || titleSource === "index") return;
239
- if (polledThreadsRef.current.has(activeThreadId)) return;
240
- polledThreadsRef.current.add(activeThreadId);
413
+ var _a2;
414
+ if (((_a2 = visitRef.current) == null ? void 0 : _a2.threadId) !== activeThreadId) {
415
+ visitRef.current = { threadId: activeThreadId, polled: false };
416
+ }
417
+ const visit = visitRef.current;
418
+ if (!hasMessages || hasTitle || titleSource === "index") return;
419
+ if (visit.polled) return;
420
+ visit.polled = true;
241
421
  let intervalId = null;
242
422
  const startId = setTimeout(() => {
243
423
  intervalId = setInterval(() => {
244
- var _a2;
245
- return (_a2 = refreshRef.current) == null ? void 0 : _a2.call(refreshRef);
424
+ var _a3;
425
+ return (_a3 = refreshRef.current) == null ? void 0 : _a3.call(refreshRef);
246
426
  }, TITLE_POLL_INTERVAL_MS);
247
427
  }, TITLE_POLL_DELAY_MS);
248
428
  const stopId = setTimeout(() => {
@@ -259,6 +439,8 @@ function StatewireThreadTitlePoller() {
259
439
  exports.AthenaStatewireThreadListContext = AthenaStatewireThreadListContext;
260
440
  exports.AthenaStatewireThreadListProvider = AthenaStatewireThreadListProvider;
261
441
  exports.StatewireThreadTitlePoller = StatewireThreadTitlePoller;
442
+ exports.TITLE_POLL_DELAY_MS = TITLE_POLL_DELAY_MS;
443
+ exports.threadSummaryFromConversation = threadSummaryFromConversation;
262
444
  exports.useAthenaStatewireThreadList = useAthenaStatewireThreadList;
263
445
  exports.useRefreshThreadList = useRefreshThreadList;
264
446
  //# sourceMappingURL=statewire-thread-list.cjs.map