@athenaintel/react 0.22.4 → 0.23.1

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 +394 -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 +3 -3
  350. package/src/chat-ui/tailwind-preset.js +14 -1
@@ -5,21 +5,24 @@ import { HistoryEdgeRow, StatewireHistoryEdge } from "./thread/statewire-history
5
5
  import { StatewireToolOutputsContext, useStatewireToolOutputs } from "../provider/statewire-window-context.js";
6
6
  import { ContinuePill } from "./messages/continue-pill.js";
7
7
  import { RuntimeMessageCard } from "./messages/runtime-message.js";
8
+ import { WakeMarkerCard, WakeMarkerMessage } from "./messages/wake-marker.js";
9
+ import { WaitingOnYouBanner, WaitingOnYouBannerView } from "../chat/WaitingOnYouBanner.js";
8
10
  import { StatewireContinueRunAffordance, StatewireContinueRunButton, StatewireRunEndedFooter } from "./messages/statewire-continue-run.js";
9
11
  import "../packages/agent-runtime/src/generated/runconfig-contract.js";
10
12
  import "react";
11
13
  import "@assistant-ui/tap";
12
14
  import "statewire";
13
15
  import "../packages/agent-runtime/src/statewire-suspended.js";
16
+ import "../packages/agent-runtime/src/conversation-list.js";
14
17
  import "@tanstack/react-query";
15
18
  import { HITL_PENDING_RESUME_GRACE_MS } from "../packages/agent-runtime/src/interrupts.js";
16
19
  import "../packages/agent-runtime/src/messages.js";
17
20
  import "../packages/agent-runtime/src/statewire-state.js";
18
- import "@assistant-ui/react-statewire";
19
21
  import "@assistant-ui/store";
20
22
  import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
21
23
  import "../packages/agent-runtime/src/statewire-attach-observer.js";
22
24
  import "../packages/agent-runtime/src/thread-status.js";
25
+ import "@assistant-ui/react-statewire";
23
26
  import "@assistant-ui/core";
24
27
  import "../packages/agent-runtime/src/thread-handoff.js";
25
28
  export {
@@ -34,6 +37,10 @@ export {
34
37
  StatewireQueuedMessages,
35
38
  StatewireRunEndedFooter,
36
39
  StatewireToolOutputsContext,
40
+ WaitingOnYouBanner,
41
+ WaitingOnYouBannerView,
42
+ WakeMarkerCard,
43
+ WakeMarkerMessage,
37
44
  useStatewireApprovalRequest,
38
45
  useStatewireToolOutputs
39
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"statewire.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"statewire.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,34 +3,55 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("@assistant-ui/react");
5
5
  const messageComponents = require("../messages/message-components.cjs");
6
+ const CHROME = {
7
+ default: {
8
+ dock: messageComponents.COMPOSER_DOCK_CLASS,
9
+ surface: messageComponents.COMPOSER_SURFACE_CLASS,
10
+ editorRow: messageComponents.COMPOSER_EDITOR_ROW_CLASS,
11
+ toolbar: messageComponents.COMPOSER_TOOLBAR_CLASS
12
+ },
13
+ paper: {
14
+ dock: messageComponents.COMPOSER_PAPER_DOCK_CLASS,
15
+ surface: messageComponents.COMPOSER_PAPER_SURFACE_CLASS,
16
+ editorRow: messageComponents.COMPOSER_PAPER_EDITOR_ROW_CLASS,
17
+ toolbar: messageComponents.COMPOSER_PAPER_TOOLBAR_CLASS
18
+ }
19
+ };
6
20
  function ChatComposerDock({
21
+ appearance = "default",
7
22
  className,
8
23
  surfaceClassName,
9
24
  editorRowClassName,
10
25
  toolbarClassName,
26
+ dragActive = false,
11
27
  aboveSurface,
12
28
  beforeEditor,
13
29
  editor,
14
30
  toolbarStart,
15
- toolbarEnd
31
+ toolbarEnd,
32
+ belowSurface
16
33
  }) {
17
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className ?? messageComponents.COMPOSER_DOCK_CLASS, children: [
34
+ const chrome = CHROME[appearance];
35
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className ?? chrome.dock, children: [
18
36
  aboveSurface,
19
37
  /* @__PURE__ */ jsxRuntime.jsxs(
20
38
  react.ComposerPrimitive.Root,
21
39
  {
22
- className: surfaceClassName ?? messageComponents.COMPOSER_SURFACE_CLASS,
40
+ className: surfaceClassName ?? chrome.surface,
41
+ "data-appearance": appearance === "paper" ? "paper" : void 0,
42
+ "data-drag-active": dragActive ? "true" : void 0,
23
43
  children: [
24
44
  beforeEditor,
25
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: editorRowClassName ?? messageComponents.COMPOSER_EDITOR_ROW_CLASS, children: editor }),
26
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: toolbarClassName ?? messageComponents.COMPOSER_TOOLBAR_CLASS, children: [
45
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: editorRowClassName ?? chrome.editorRow, children: editor }),
46
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: toolbarClassName ?? chrome.toolbar, children: [
27
47
  toolbarStart,
28
48
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
29
49
  toolbarEnd
30
50
  ] })
31
51
  ]
32
52
  }
33
- )
53
+ ),
54
+ belowSurface
34
55
  ] });
35
56
  }
36
57
  exports.ChatComposerDock = ChatComposerDock;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-composer-dock.cjs","sources":["../../../src/chat-ui/thread/chat-composer-dock.tsx"],"sourcesContent":["import { ComposerPrimitive } from \"@assistant-ui/react\";\nimport type { ReactNode } from \"react\";\nimport {\n COMPOSER_DOCK_CLASS,\n COMPOSER_EDITOR_ROW_CLASS,\n COMPOSER_SURFACE_CLASS,\n COMPOSER_TOOLBAR_CLASS,\n} from \"../messages/message-components\";\n\nexport interface ChatComposerDockProps {\n /**\n * Replaces the dock chrome (padding + background around the surface).\n * Hosts with their own composer chrome system (AthenaChat's `aui-*`\n * classes) pass their chrome here; the scaffolding structure stays shared.\n */\n className?: string;\n /** Replaces the bordered composer-surface chrome. */\n surfaceClassName?: string;\n /** Replaces the editor-row chrome. */\n editorRowClassName?: string;\n /** Replaces the toolbar-row chrome. */\n toolbarClassName?: string;\n /** Rendered inside the dock, above the composer surface (error banners). */\n aboveSurface?: ReactNode;\n /**\n * Rendered inside the surface above the editor row: context chips,\n * restore notices, attachment strips.\n */\n beforeEditor?: ReactNode;\n /** The editor element (a TiptapComposer, typically ref-held by the host). */\n editor: ReactNode;\n /** Toolbar contents before the spacer (attach buttons, pickers). */\n toolbarStart?: ReactNode;\n /** Toolbar contents after the spacer (voice and send/stop controls). */\n toolbarEnd: ReactNode;\n}\n\n/**\n * The shared composer scaffolding: dock padding, the bordered surface, the\n * editor row, and the toolbar with its start/end slots around a flexible\n * spacer. Hosts supply the editor element and toolbar controls.\n */\nexport function ChatComposerDock({\n className,\n surfaceClassName,\n editorRowClassName,\n toolbarClassName,\n aboveSurface,\n beforeEditor,\n editor,\n toolbarStart,\n toolbarEnd,\n}: ChatComposerDockProps) {\n return (\n <div className={className ?? COMPOSER_DOCK_CLASS}>\n {aboveSurface}\n <ComposerPrimitive.Root\n className={surfaceClassName ?? COMPOSER_SURFACE_CLASS}\n >\n {beforeEditor}\n <div className={editorRowClassName ?? COMPOSER_EDITOR_ROW_CLASS}>\n {editor}\n </div>\n <div className={toolbarClassName ?? COMPOSER_TOOLBAR_CLASS}>\n {toolbarStart}\n <div className=\"flex-1\" />\n {toolbarEnd}\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n}\n"],"names":["jsxs","COMPOSER_DOCK_CLASS","ComposerPrimitive","COMPOSER_SURFACE_CLASS","jsx","COMPOSER_EDITOR_ROW_CLASS","COMPOSER_TOOLBAR_CLASS"],"mappings":";;;;;AA0CO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0B;AACxB,SACEA,2BAAAA,KAAC,OAAA,EAAI,WAAW,aAAaC,kBAAAA,qBAC1B,UAAA;AAAA,IAAA;AAAA,IACDD,2BAAAA;AAAAA,MAACE,MAAAA,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAW,oBAAoBC,kBAAAA;AAAAA,QAE9B,UAAA;AAAA,UAAA;AAAA,UACDC,2BAAAA,IAAC,OAAA,EAAI,WAAW,sBAAsBC,6CACnC,UAAA,QACH;AAAA,UACAL,2BAAAA,KAAC,OAAA,EAAI,WAAW,oBAAoBM,kBAAAA,wBACjC,UAAA;AAAA,YAAA;AAAA,YACDF,2BAAAA,IAAC,OAAA,EAAI,WAAU,SAAA,CAAS;AAAA,YACvB;AAAA,UAAA,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;"}
1
+ {"version":3,"file":"chat-composer-dock.cjs","sources":["../../../src/chat-ui/thread/chat-composer-dock.tsx"],"sourcesContent":["import { ComposerPrimitive } from \"@assistant-ui/react\";\nimport type { ReactNode } from \"react\";\nimport {\n COMPOSER_DOCK_CLASS,\n COMPOSER_EDITOR_ROW_CLASS,\n COMPOSER_PAPER_DOCK_CLASS,\n COMPOSER_PAPER_EDITOR_ROW_CLASS,\n COMPOSER_PAPER_SURFACE_CLASS,\n COMPOSER_PAPER_TOOLBAR_CLASS,\n COMPOSER_SURFACE_CLASS,\n COMPOSER_TOOLBAR_CLASS,\n} from \"../messages/message-components\";\n\n/**\n * Which chrome the dock renders when a host supplies no class names of its\n * own. `default` is the side-panel / task-pane card (Chrome extension, Office\n * add-in); `paper` is the SDK thread's card-toned surface with the larger\n * radius, focus ring and drag-over tint.\n */\nexport type ChatComposerAppearance = \"default\" | \"paper\";\n\ninterface ComposerChrome {\n dock: string;\n surface: string;\n editorRow: string;\n toolbar: string;\n}\n\nconst CHROME: Record<ChatComposerAppearance, ComposerChrome> = {\n default: {\n dock: COMPOSER_DOCK_CLASS,\n surface: COMPOSER_SURFACE_CLASS,\n editorRow: COMPOSER_EDITOR_ROW_CLASS,\n toolbar: COMPOSER_TOOLBAR_CLASS,\n },\n paper: {\n dock: COMPOSER_PAPER_DOCK_CLASS,\n surface: COMPOSER_PAPER_SURFACE_CLASS,\n editorRow: COMPOSER_PAPER_EDITOR_ROW_CLASS,\n toolbar: COMPOSER_PAPER_TOOLBAR_CLASS,\n },\n};\n\nexport interface ChatComposerDockProps {\n /**\n * The chrome set used for every class a host leaves unset. Defaults to\n * `default`, so existing hosts render exactly what they rendered before.\n */\n appearance?: ChatComposerAppearance;\n /**\n * Replaces the dock chrome (padding + background around the surface).\n * Hosts with their own composer chrome system (AthenaChat's `aui-*`\n * classes) pass their chrome here; the scaffolding structure stays shared.\n */\n className?: string;\n /** Replaces the bordered composer-surface chrome. */\n surfaceClassName?: string;\n /** Replaces the editor-row chrome. */\n editorRowClassName?: string;\n /** Replaces the toolbar-row chrome. */\n toolbarClassName?: string;\n /**\n * Files are being dragged over the composer: sets `data-drag-active=\"true\"`\n * on the surface, which the paper chrome tints. The host's drop zone owns\n * the drag state (`ComposerDropZone onDragActiveChange`).\n */\n dragActive?: boolean;\n /** Rendered inside the dock, above the composer surface (error banners). */\n aboveSurface?: ReactNode;\n /**\n * Rendered inside the surface above the editor row: context chips,\n * restore notices, attachment strips.\n */\n beforeEditor?: ReactNode;\n /** The editor element (a TiptapComposer, typically ref-held by the host). */\n editor: ReactNode;\n /** Toolbar contents before the spacer (attach buttons, pickers). */\n toolbarStart?: ReactNode;\n /** Toolbar contents after the spacer (voice and send/stop controls). */\n toolbarEnd: ReactNode;\n /** Rendered inside the dock, under the composer surface (keyboard hints). */\n belowSurface?: ReactNode;\n}\n\n/**\n * The shared composer scaffolding: dock padding, the bordered surface, the\n * editor row, and the toolbar with its start/end slots around a flexible\n * spacer. Hosts supply the editor element and toolbar controls.\n */\nexport function ChatComposerDock({\n appearance = \"default\",\n className,\n surfaceClassName,\n editorRowClassName,\n toolbarClassName,\n dragActive = false,\n aboveSurface,\n beforeEditor,\n editor,\n toolbarStart,\n toolbarEnd,\n belowSurface,\n}: ChatComposerDockProps) {\n const chrome = CHROME[appearance];\n return (\n <div className={className ?? chrome.dock}>\n {aboveSurface}\n <ComposerPrimitive.Root\n className={surfaceClassName ?? chrome.surface}\n // Only the paper chrome is keyed off these attributes; the default\n // chrome's DOM stays byte-for-byte what its hosts snapshot.\n data-appearance={appearance === \"paper\" ? \"paper\" : undefined}\n data-drag-active={dragActive ? \"true\" : undefined}\n >\n {beforeEditor}\n <div className={editorRowClassName ?? chrome.editorRow}>\n {editor}\n </div>\n <div className={toolbarClassName ?? chrome.toolbar}>\n {toolbarStart}\n <div className=\"flex-1\" />\n {toolbarEnd}\n </div>\n </ComposerPrimitive.Root>\n {belowSurface}\n </div>\n );\n}\n"],"names":["COMPOSER_DOCK_CLASS","COMPOSER_SURFACE_CLASS","COMPOSER_EDITOR_ROW_CLASS","COMPOSER_TOOLBAR_CLASS","COMPOSER_PAPER_DOCK_CLASS","COMPOSER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+1,17 @@
1
1
  import type { ReactNode } from "react";
2
+ /**
3
+ * Which chrome the dock renders when a host supplies no class names of its
4
+ * own. `default` is the side-panel / task-pane card (Chrome extension, Office
5
+ * add-in); `paper` is the SDK thread's card-toned surface with the larger
6
+ * radius, focus ring and drag-over tint.
7
+ */
8
+ export type ChatComposerAppearance = "default" | "paper";
2
9
  export interface ChatComposerDockProps {
10
+ /**
11
+ * The chrome set used for every class a host leaves unset. Defaults to
12
+ * `default`, so existing hosts render exactly what they rendered before.
13
+ */
14
+ appearance?: ChatComposerAppearance;
3
15
  /**
4
16
  * Replaces the dock chrome (padding + background around the surface).
5
17
  * Hosts with their own composer chrome system (AthenaChat's `aui-*`
@@ -12,6 +24,12 @@ export interface ChatComposerDockProps {
12
24
  editorRowClassName?: string;
13
25
  /** Replaces the toolbar-row chrome. */
14
26
  toolbarClassName?: string;
27
+ /**
28
+ * Files are being dragged over the composer: sets `data-drag-active="true"`
29
+ * on the surface, which the paper chrome tints. The host's drop zone owns
30
+ * the drag state (`ComposerDropZone onDragActiveChange`).
31
+ */
32
+ dragActive?: boolean;
15
33
  /** Rendered inside the dock, above the composer surface (error banners). */
16
34
  aboveSurface?: ReactNode;
17
35
  /**
@@ -25,10 +43,12 @@ export interface ChatComposerDockProps {
25
43
  toolbarStart?: ReactNode;
26
44
  /** Toolbar contents after the spacer (voice and send/stop controls). */
27
45
  toolbarEnd: ReactNode;
46
+ /** Rendered inside the dock, under the composer surface (keyboard hints). */
47
+ belowSurface?: ReactNode;
28
48
  }
29
49
  /**
30
50
  * The shared composer scaffolding: dock padding, the bordered surface, the
31
51
  * editor row, and the toolbar with its start/end slots around a flexible
32
52
  * spacer. Hosts supply the editor element and toolbar controls.
33
53
  */
34
- export declare function ChatComposerDock({ className, surfaceClassName, editorRowClassName, toolbarClassName, aboveSurface, beforeEditor, editor, toolbarStart, toolbarEnd, }: ChatComposerDockProps): import("react/jsx-runtime").JSX.Element;
54
+ export declare function ChatComposerDock({ appearance, className, surfaceClassName, editorRowClassName, toolbarClassName, dragActive, aboveSurface, beforeEditor, editor, toolbarStart, toolbarEnd, belowSurface, }: ChatComposerDockProps): import("react/jsx-runtime").JSX.Element;
@@ -1,34 +1,55 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { ComposerPrimitive } from "@assistant-ui/react";
3
- import { COMPOSER_DOCK_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_TOOLBAR_CLASS } from "../messages/message-components.js";
3
+ import { COMPOSER_PAPER_TOOLBAR_CLASS, COMPOSER_PAPER_EDITOR_ROW_CLASS, COMPOSER_PAPER_SURFACE_CLASS, COMPOSER_PAPER_DOCK_CLASS, COMPOSER_TOOLBAR_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_DOCK_CLASS } from "../messages/message-components.js";
4
+ const CHROME = {
5
+ default: {
6
+ dock: COMPOSER_DOCK_CLASS,
7
+ surface: COMPOSER_SURFACE_CLASS,
8
+ editorRow: COMPOSER_EDITOR_ROW_CLASS,
9
+ toolbar: COMPOSER_TOOLBAR_CLASS
10
+ },
11
+ paper: {
12
+ dock: COMPOSER_PAPER_DOCK_CLASS,
13
+ surface: COMPOSER_PAPER_SURFACE_CLASS,
14
+ editorRow: COMPOSER_PAPER_EDITOR_ROW_CLASS,
15
+ toolbar: COMPOSER_PAPER_TOOLBAR_CLASS
16
+ }
17
+ };
4
18
  function ChatComposerDock({
19
+ appearance = "default",
5
20
  className,
6
21
  surfaceClassName,
7
22
  editorRowClassName,
8
23
  toolbarClassName,
24
+ dragActive = false,
9
25
  aboveSurface,
10
26
  beforeEditor,
11
27
  editor,
12
28
  toolbarStart,
13
- toolbarEnd
29
+ toolbarEnd,
30
+ belowSurface
14
31
  }) {
15
- return /* @__PURE__ */ jsxs("div", { className: className ?? COMPOSER_DOCK_CLASS, children: [
32
+ const chrome = CHROME[appearance];
33
+ return /* @__PURE__ */ jsxs("div", { className: className ?? chrome.dock, children: [
16
34
  aboveSurface,
17
35
  /* @__PURE__ */ jsxs(
18
36
  ComposerPrimitive.Root,
19
37
  {
20
- className: surfaceClassName ?? COMPOSER_SURFACE_CLASS,
38
+ className: surfaceClassName ?? chrome.surface,
39
+ "data-appearance": appearance === "paper" ? "paper" : void 0,
40
+ "data-drag-active": dragActive ? "true" : void 0,
21
41
  children: [
22
42
  beforeEditor,
23
- /* @__PURE__ */ jsx("div", { className: editorRowClassName ?? COMPOSER_EDITOR_ROW_CLASS, children: editor }),
24
- /* @__PURE__ */ jsxs("div", { className: toolbarClassName ?? COMPOSER_TOOLBAR_CLASS, children: [
43
+ /* @__PURE__ */ jsx("div", { className: editorRowClassName ?? chrome.editorRow, children: editor }),
44
+ /* @__PURE__ */ jsxs("div", { className: toolbarClassName ?? chrome.toolbar, children: [
25
45
  toolbarStart,
26
46
  /* @__PURE__ */ jsx("div", { className: "flex-1" }),
27
47
  toolbarEnd
28
48
  ] })
29
49
  ]
30
50
  }
31
- )
51
+ ),
52
+ belowSurface
32
53
  ] });
33
54
  }
34
55
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"chat-composer-dock.js","sources":["../../../src/chat-ui/thread/chat-composer-dock.tsx"],"sourcesContent":["import { ComposerPrimitive } from \"@assistant-ui/react\";\nimport type { ReactNode } from \"react\";\nimport {\n COMPOSER_DOCK_CLASS,\n COMPOSER_EDITOR_ROW_CLASS,\n COMPOSER_SURFACE_CLASS,\n COMPOSER_TOOLBAR_CLASS,\n} from \"../messages/message-components\";\n\nexport interface ChatComposerDockProps {\n /**\n * Replaces the dock chrome (padding + background around the surface).\n * Hosts with their own composer chrome system (AthenaChat's `aui-*`\n * classes) pass their chrome here; the scaffolding structure stays shared.\n */\n className?: string;\n /** Replaces the bordered composer-surface chrome. */\n surfaceClassName?: string;\n /** Replaces the editor-row chrome. */\n editorRowClassName?: string;\n /** Replaces the toolbar-row chrome. */\n toolbarClassName?: string;\n /** Rendered inside the dock, above the composer surface (error banners). */\n aboveSurface?: ReactNode;\n /**\n * Rendered inside the surface above the editor row: context chips,\n * restore notices, attachment strips.\n */\n beforeEditor?: ReactNode;\n /** The editor element (a TiptapComposer, typically ref-held by the host). */\n editor: ReactNode;\n /** Toolbar contents before the spacer (attach buttons, pickers). */\n toolbarStart?: ReactNode;\n /** Toolbar contents after the spacer (voice and send/stop controls). */\n toolbarEnd: ReactNode;\n}\n\n/**\n * The shared composer scaffolding: dock padding, the bordered surface, the\n * editor row, and the toolbar with its start/end slots around a flexible\n * spacer. Hosts supply the editor element and toolbar controls.\n */\nexport function ChatComposerDock({\n className,\n surfaceClassName,\n editorRowClassName,\n toolbarClassName,\n aboveSurface,\n beforeEditor,\n editor,\n toolbarStart,\n toolbarEnd,\n}: ChatComposerDockProps) {\n return (\n <div className={className ?? COMPOSER_DOCK_CLASS}>\n {aboveSurface}\n <ComposerPrimitive.Root\n className={surfaceClassName ?? COMPOSER_SURFACE_CLASS}\n >\n {beforeEditor}\n <div className={editorRowClassName ?? COMPOSER_EDITOR_ROW_CLASS}>\n {editor}\n </div>\n <div className={toolbarClassName ?? COMPOSER_TOOLBAR_CLASS}>\n {toolbarStart}\n <div className=\"flex-1\" />\n {toolbarEnd}\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n}\n"],"names":[],"mappings":";;;AA0CO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0B;AACxB,SACE,qBAAC,OAAA,EAAI,WAAW,aAAa,qBAC1B,UAAA;AAAA,IAAA;AAAA,IACD;AAAA,MAAC,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAW,oBAAoB;AAAA,QAE9B,UAAA;AAAA,UAAA;AAAA,UACD,oBAAC,OAAA,EAAI,WAAW,sBAAsB,2BACnC,UAAA,QACH;AAAA,UACA,qBAAC,OAAA,EAAI,WAAW,oBAAoB,wBACjC,UAAA;AAAA,YAAA;AAAA,YACD,oBAAC,OAAA,EAAI,WAAU,SAAA,CAAS;AAAA,YACvB;AAAA,UAAA,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"chat-composer-dock.js","sources":["../../../src/chat-ui/thread/chat-composer-dock.tsx"],"sourcesContent":["import { ComposerPrimitive } from \"@assistant-ui/react\";\nimport type { ReactNode } from \"react\";\nimport {\n COMPOSER_DOCK_CLASS,\n COMPOSER_EDITOR_ROW_CLASS,\n COMPOSER_PAPER_DOCK_CLASS,\n COMPOSER_PAPER_EDITOR_ROW_CLASS,\n COMPOSER_PAPER_SURFACE_CLASS,\n COMPOSER_PAPER_TOOLBAR_CLASS,\n COMPOSER_SURFACE_CLASS,\n COMPOSER_TOOLBAR_CLASS,\n} from \"../messages/message-components\";\n\n/**\n * Which chrome the dock renders when a host supplies no class names of its\n * own. `default` is the side-panel / task-pane card (Chrome extension, Office\n * add-in); `paper` is the SDK thread's card-toned surface with the larger\n * radius, focus ring and drag-over tint.\n */\nexport type ChatComposerAppearance = \"default\" | \"paper\";\n\ninterface ComposerChrome {\n dock: string;\n surface: string;\n editorRow: string;\n toolbar: string;\n}\n\nconst CHROME: Record<ChatComposerAppearance, ComposerChrome> = {\n default: {\n dock: COMPOSER_DOCK_CLASS,\n surface: COMPOSER_SURFACE_CLASS,\n editorRow: COMPOSER_EDITOR_ROW_CLASS,\n toolbar: COMPOSER_TOOLBAR_CLASS,\n },\n paper: {\n dock: COMPOSER_PAPER_DOCK_CLASS,\n surface: COMPOSER_PAPER_SURFACE_CLASS,\n editorRow: COMPOSER_PAPER_EDITOR_ROW_CLASS,\n toolbar: COMPOSER_PAPER_TOOLBAR_CLASS,\n },\n};\n\nexport interface ChatComposerDockProps {\n /**\n * The chrome set used for every class a host leaves unset. Defaults to\n * `default`, so existing hosts render exactly what they rendered before.\n */\n appearance?: ChatComposerAppearance;\n /**\n * Replaces the dock chrome (padding + background around the surface).\n * Hosts with their own composer chrome system (AthenaChat's `aui-*`\n * classes) pass their chrome here; the scaffolding structure stays shared.\n */\n className?: string;\n /** Replaces the bordered composer-surface chrome. */\n surfaceClassName?: string;\n /** Replaces the editor-row chrome. */\n editorRowClassName?: string;\n /** Replaces the toolbar-row chrome. */\n toolbarClassName?: string;\n /**\n * Files are being dragged over the composer: sets `data-drag-active=\"true\"`\n * on the surface, which the paper chrome tints. The host's drop zone owns\n * the drag state (`ComposerDropZone onDragActiveChange`).\n */\n dragActive?: boolean;\n /** Rendered inside the dock, above the composer surface (error banners). */\n aboveSurface?: ReactNode;\n /**\n * Rendered inside the surface above the editor row: context chips,\n * restore notices, attachment strips.\n */\n beforeEditor?: ReactNode;\n /** The editor element (a TiptapComposer, typically ref-held by the host). */\n editor: ReactNode;\n /** Toolbar contents before the spacer (attach buttons, pickers). */\n toolbarStart?: ReactNode;\n /** Toolbar contents after the spacer (voice and send/stop controls). */\n toolbarEnd: ReactNode;\n /** Rendered inside the dock, under the composer surface (keyboard hints). */\n belowSurface?: ReactNode;\n}\n\n/**\n * The shared composer scaffolding: dock padding, the bordered surface, the\n * editor row, and the toolbar with its start/end slots around a flexible\n * spacer. Hosts supply the editor element and toolbar controls.\n */\nexport function ChatComposerDock({\n appearance = \"default\",\n className,\n surfaceClassName,\n editorRowClassName,\n toolbarClassName,\n dragActive = false,\n aboveSurface,\n beforeEditor,\n editor,\n toolbarStart,\n toolbarEnd,\n belowSurface,\n}: ChatComposerDockProps) {\n const chrome = CHROME[appearance];\n return (\n <div className={className ?? chrome.dock}>\n {aboveSurface}\n <ComposerPrimitive.Root\n className={surfaceClassName ?? chrome.surface}\n // Only the paper chrome is keyed off these attributes; the default\n // chrome's DOM stays byte-for-byte what its hosts snapshot.\n data-appearance={appearance === \"paper\" ? \"paper\" : undefined}\n data-drag-active={dragActive ? \"true\" : undefined}\n >\n {beforeEditor}\n <div className={editorRowClassName ?? chrome.editorRow}>\n {editor}\n </div>\n <div className={toolbarClassName ?? chrome.toolbar}>\n {toolbarStart}\n <div className=\"flex-1\" />\n {toolbarEnd}\n </div>\n </ComposerPrimitive.Root>\n {belowSurface}\n </div>\n );\n}\n"],"names":[],"mappings":";;;AA4BA,MAAM,SAAyD;AAAA,EAC7D,SAAS;AAAA,IACP,MAAM;AAAA,IACN,SAAS;AAAA,IACT,WAAW;AAAA,IACX,SAAS;AAAA,EAAA;AAAA,EAEX,OAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,WAAW;AAAA,IACX,SAAS;AAAA,EAAA;AAEb;AAgDO,SAAS,iBAAiB;AAAA,EAC/B,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA0B;AACxB,QAAM,SAAS,OAAO,UAAU;AAChC,SACE,qBAAC,OAAA,EAAI,WAAW,aAAa,OAAO,MACjC,UAAA;AAAA,IAAA;AAAA,IACD;AAAA,MAAC,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAW,oBAAoB,OAAO;AAAA,QAGtC,mBAAiB,eAAe,UAAU,UAAU;AAAA,QACpD,oBAAkB,aAAa,SAAS;AAAA,QAEvC,UAAA;AAAA,UAAA;AAAA,8BACA,OAAA,EAAI,WAAW,sBAAsB,OAAO,WAC1C,UAAA,QACH;AAAA,UACA,qBAAC,OAAA,EAAI,WAAW,oBAAoB,OAAO,SACxC,UAAA;AAAA,YAAA;AAAA,YACD,oBAAC,OAAA,EAAI,WAAU,SAAA,CAAS;AAAA,YACvB;AAAA,UAAA,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAED;AAAA,EAAA,GACH;AAEJ;"}
@@ -8,6 +8,7 @@ require("@assistant-ui/tap");
8
8
  require("statewire");
9
9
  const errors = require("../../packages/agent-runtime/src/errors.cjs");
10
10
  require("../../packages/agent-runtime/src/statewire-suspended.cjs");
11
+ require("../../packages/agent-runtime/src/conversation-list.cjs");
11
12
  require("@tanstack/react-query");
12
13
  require("../../packages/agent-runtime/src/statewire-state.cjs");
13
14
  require("../../packages/agent-runtime/src/messages.cjs");
@@ -24,13 +25,14 @@ const cnfast = require("cnfast");
24
25
  const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
25
26
  const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;
26
27
  const HistoryEdgeRow = ({
27
- olderCount,
28
+ hasOlder,
29
+ canLoadOlder = hasOlder,
28
30
  loading,
29
31
  onLoadOlder,
30
32
  className,
31
33
  rowRef
32
34
  }) => {
33
- if (olderCount <= 0) return null;
35
+ if (!hasOlder) return null;
34
36
  return /* @__PURE__ */ jsxRuntime.jsx(
35
37
  "div",
36
38
  {
@@ -40,20 +42,16 @@ const HistoryEdgeRow = ({
40
42
  "flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground",
41
43
  className
42
44
  ),
43
- children: loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "thread-history-edge-loading", children: "Loading earlier messages…" }) : /* @__PURE__ */ jsxRuntime.jsxs(
45
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "thread-history-edge-loading", children: "Loading earlier messages…" }) : canLoadOlder ? /* @__PURE__ */ jsxRuntime.jsx(
44
46
  "button",
45
47
  {
46
48
  type: "button",
47
49
  "data-testid": "thread-history-edge-load",
48
50
  onClick: onLoadOlder,
49
51
  className: "rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
50
- children: [
51
- olderCount.toLocaleString(),
52
- " earlier ",
53
- olderCount === 1 ? "message" : "messages"
54
- ]
52
+ children: "Load earlier messages"
55
53
  }
56
- )
54
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "thread-history-edge-limit", children: "Earlier messages can't be loaded here" })
57
55
  }
58
56
  );
59
57
  };
@@ -70,7 +68,7 @@ const StatewireHistoryEdge = ({
70
68
  const [nearTopEpoch, setNearTopEpoch] = react$1.useState(0);
71
69
  const nearTopRef = react$1.useRef(false);
72
70
  const [rowEl, setRowEl] = react$1.useState(null);
73
- const { olderCount, loading, loadOlder } = useDeepAgentWindowSync.useDeepAgentWindowSync({
71
+ const { hasOlder, canLoadOlder, loading, loadOlder } = useDeepAgentWindowSync.useDeepAgentWindowSync({
74
72
  messages,
75
73
  toolOutputs,
76
74
  nearTop,
@@ -82,7 +80,7 @@ const StatewireHistoryEdge = ({
82
80
  }
83
81
  });
84
82
  react$1.useEffect(() => {
85
- if (!rowEl || olderCount <= 0 || typeof IntersectionObserver === "undefined") return;
83
+ if (!rowEl || !hasOlder || typeof IntersectionObserver === "undefined") return;
86
84
  const observer = new IntersectionObserver(
87
85
  (entries) => {
88
86
  for (const entry of entries) {
@@ -104,7 +102,7 @@ const StatewireHistoryEdge = ({
104
102
  nearTopRef.current = false;
105
103
  setNearTop(false);
106
104
  };
107
- }, [rowEl, olderCount]);
105
+ }, [rowEl, hasOlder]);
108
106
  const shapeRef = react$1.useRef(
109
107
  null
110
108
  );
@@ -121,7 +119,8 @@ const StatewireHistoryEdge = ({
121
119
  HistoryEdgeRow,
122
120
  {
123
121
  rowRef: setRowEl,
124
- olderCount,
122
+ hasOlder,
123
+ canLoadOlder,
125
124
  loading,
126
125
  onLoadOlder: loadOlder,
127
126
  className
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-history-edge.cjs","sources":["../../../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Messages older than the loaded window the server still holds. */\n olderCount: number;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history on a windowed wire: how many older\n * messages the server still holds, a manual way to load the next page, and\n * the in-flight state. Renders nothing when the whole transcript is loaded\n * (or the wire is not windowed).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n olderCount,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (olderCount <= 0) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {olderCount.toLocaleString()} earlier {olderCount === 1 ? \"message\" : \"messages\"}\n </button>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A `history/load` settled (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the windowed wire for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"N earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert on a wire that is not windowed: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { olderCount, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || olderCount <= 0 || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, olderCount]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n olderCount={olderCount}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n"],"names":["jsx","cn","jsxs","useStatewireToolOutputs","useAuiState","useState","useRef","useDeepAgentWindowSync","isStatewireChannelTeardown","useEffect","useLayoutEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,uBAAuB;AAO7B,MAAM,8BAA8B;AAmBpC,MAAM,iBAA0C,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,MAAI,cAAc,EAAG,QAAO;AAC5B,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,eAAY;AAAA,MACZ,WAAWC,OAAAA;AAAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGD,oBACCD,2BAAAA,IAAC,QAAA,EA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rB,qBAAW,IAAI;AACf,cAAI,KAAM,iBAAgB,CAAC,UAAU,QAAQ,CAAC;AAAA,QAChD;AAAA,MACF;AAAA,MACA;AAAA,QACE,MAAM,MAAM,QAAqB,IAAI,oBAAoB,GAAG;AAAA,QAC5D,YAAY,GAAG,2BAA2B;AAAA,MAAA;AAAA,IAC5C;AAEF,aAAS,QAAQ,KAAK;AACtB,WAAO,MAAM;AACX,eAAS,WAAA;AACT,iBAAW,UAAU;AACrB,iBAAW,KAAK;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,OAAO,UAAU,CAAC;AAOtB,QAAM,WAAWH,QAAAA;AAAAA,IACf;AAAA,EAAA;AAEF,QAAM,WAAU,cAAS,CAAC,MAAV,mBAAa;AAC7B,QAAM,SAAS,SAAS;AACxBI,UAAAA,gBAAgB,MAAM;AACpB,UAAM,YAAW,+BAAO,QAAqB,IAAI,oBAAoB,SAAQ;AAC7E,UAAM,OAAO,SAAS;AACtB,UAAM,YACJ,aAAa,QACb,SAAS,QACT,KAAK,YAAY,UACjB,YAAY,KAAK,WACjB,SAAS,KAAK;AAChB,QAAI,UAAW,UAAS,aAAa,SAAS,eAAe,KAAK;AAClE,aAAS,UACP,WAAW,aAAa,SAAS,OAC7B,EAAE,SAAS,QAAQ,eAAc,qCAAU,iBAAgB,MAC3D,EAAE,SAAS,QAAQ,cAAc,KAAK,aAAA;AAAA,EAC9C,CAAC;AAED,SACEV,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;"}
1
+ {"version":3,"file":"statewire-history-edge.cjs","sources":["../../../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Whether the server holds messages older than the loaded window. */\n hasOlder: boolean;\n /** Whether the next page can be asked for; `false` with `hasOlder` is the connection's loading depth spent. Defaults to `hasOlder`. */\n canLoadOlder?: boolean;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history: a manual way to load the next page of\n * older messages, and the in-flight state. Renders nothing when the whole\n * transcript is loaded (or the head interest has not resolved).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n hasOlder,\n canLoadOlder = hasOlder,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (!hasOlder) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : canLoadOlder ? (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Load earlier messages\n </button>\n ) : (\n <span data-testid=\"thread-history-edge-limit\">Earlier messages can't be loaded here</span>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A page interest resolved (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the interest window for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"Load earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert until the head interest resolves: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { hasOlder, canLoadOlder, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || !hasOlder || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, hasOlder]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n hasOlder={hasOlder}\n canLoadOlder={canLoadOlder}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n"],"names":["jsx","cn","useStatewireToolOutputs","useAuiState","useState","useRef","useDeepAgentWindowSync","isStatewireChannelTeardown","useEffect","useLayoutEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,uBAAuB;AAO7B,MAAM,8BAA8B;AAoBpC,MAAM,iBAA0C,CAAC;AAAA,EACtD;AAAA,EACA,eA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MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;"}
@@ -9,8 +9,10 @@ export declare const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
9
9
  */
10
10
  export declare const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;
11
11
  export interface HistoryEdgeRowProps {
12
- /** Messages older than the loaded window the server still holds. */
13
- olderCount: number;
12
+ /** Whether the server holds messages older than the loaded window. */
13
+ hasOlder: boolean;
14
+ /** Whether the next page can be asked for; `false` with `hasOlder` is the connection's loading depth spent. Defaults to `hasOlder`. */
15
+ canLoadOlder?: boolean;
14
16
  /** A page of older history is in flight. */
15
17
  loading: boolean;
16
18
  onLoadOlder: () => void;
@@ -19,10 +21,9 @@ export interface HistoryEdgeRowProps {
19
21
  rowRef?: (element: HTMLElement | null) => void;
20
22
  }
21
23
  /**
22
- * The top edge of the LOADED history on a windowed wire: how many older
23
- * messages the server still holds, a manual way to load the next page, and
24
- * the in-flight state. Renders nothing when the whole transcript is loaded
25
- * (or the wire is not windowed).
24
+ * The top edge of the LOADED history: a manual way to load the next page of
25
+ * older messages, and the in-flight state. Renders nothing when the whole
26
+ * transcript is loaded (or the head interest has not resolved).
26
27
  */
27
28
  export declare const HistoryEdgeRow: FC<HistoryEdgeRowProps>;
28
29
  export interface StatewireHistoryEdgeProps {
@@ -33,20 +34,20 @@ export interface StatewireHistoryEdgeProps {
33
34
  */
34
35
  toolOutputs?: DeepAgentToolOutputStore;
35
36
  className?: string;
36
- /** A `history/load` settled (telemetry). */
37
+ /** A page interest resolved (telemetry). */
37
38
  onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;
38
39
  }
39
40
  /**
40
- * The client half of the windowed wire for a DOM thread — mounted once per
41
+ * The client half of the interest window for a DOM thread — mounted once per
41
42
  * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s
42
43
  * `beforeMessages` slot):
43
44
  *
44
- * - renders the "N earlier messages" edge row and loads the next page when
45
+ * - renders the "Load earlier messages" edge row and loads the next page when
45
46
  * the row comes near the viewport (scrolling up) or on its button, keeping
46
47
  * the reading position when the page lands above the view;
47
48
  * - fetches cut tool outputs whole for the rendered cards, so they re-render
48
49
  * complete through the converter (`toolOutputs`).
49
50
  *
50
- * Inert on a wire that is not windowed: no row, no reads.
51
+ * Inert until the head interest resolves: no row, no reads.
51
52
  */
52
53
  export declare const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps>;
@@ -1,4 +1,4 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { useAuiState } from "@assistant-ui/react";
3
3
  import "../../packages/agent-runtime/src/generated/runconfig-contract.js";
4
4
  import { useState, useRef, useEffect, useLayoutEffect } from "react";
@@ -6,6 +6,7 @@ import "@assistant-ui/tap";
6
6
  import "statewire";
7
7
  import { isStatewireChannelTeardown } from "../../packages/agent-runtime/src/errors.js";
8
8
  import "../../packages/agent-runtime/src/statewire-suspended.js";
9
+ import "../../packages/agent-runtime/src/conversation-list.js";
9
10
  import "@tanstack/react-query";
10
11
  import "../../packages/agent-runtime/src/statewire-state.js";
11
12
  import "../../packages/agent-runtime/src/messages.js";
@@ -22,13 +23,14 @@ import { cn } from "cnfast";
22
23
  const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
23
24
  const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;
24
25
  const HistoryEdgeRow = ({
25
- olderCount,
26
+ hasOlder,
27
+ canLoadOlder = hasOlder,
26
28
  loading,
27
29
  onLoadOlder,
28
30
  className,
29
31
  rowRef
30
32
  }) => {
31
- if (olderCount <= 0) return null;
33
+ if (!hasOlder) return null;
32
34
  return /* @__PURE__ */ jsx(
33
35
  "div",
34
36
  {
@@ -38,20 +40,16 @@ const HistoryEdgeRow = ({
38
40
  "flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground",
39
41
  className
40
42
  ),
41
- children: loading ? /* @__PURE__ */ jsx("span", { "data-testid": "thread-history-edge-loading", children: "Loading earlier messages…" }) : /* @__PURE__ */ jsxs(
43
+ children: loading ? /* @__PURE__ */ jsx("span", { "data-testid": "thread-history-edge-loading", children: "Loading earlier messages…" }) : canLoadOlder ? /* @__PURE__ */ jsx(
42
44
  "button",
43
45
  {
44
46
  type: "button",
45
47
  "data-testid": "thread-history-edge-load",
46
48
  onClick: onLoadOlder,
47
49
  className: "rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
48
- children: [
49
- olderCount.toLocaleString(),
50
- " earlier ",
51
- olderCount === 1 ? "message" : "messages"
52
- ]
50
+ children: "Load earlier messages"
53
51
  }
54
- )
52
+ ) : /* @__PURE__ */ jsx("span", { "data-testid": "thread-history-edge-limit", children: "Earlier messages can't be loaded here" })
55
53
  }
56
54
  );
57
55
  };
@@ -68,7 +66,7 @@ const StatewireHistoryEdge = ({
68
66
  const [nearTopEpoch, setNearTopEpoch] = useState(0);
69
67
  const nearTopRef = useRef(false);
70
68
  const [rowEl, setRowEl] = useState(null);
71
- const { olderCount, loading, loadOlder } = useDeepAgentWindowSync({
69
+ const { hasOlder, canLoadOlder, loading, loadOlder } = useDeepAgentWindowSync({
72
70
  messages,
73
71
  toolOutputs,
74
72
  nearTop,
@@ -80,7 +78,7 @@ const StatewireHistoryEdge = ({
80
78
  }
81
79
  });
82
80
  useEffect(() => {
83
- if (!rowEl || olderCount <= 0 || typeof IntersectionObserver === "undefined") return;
81
+ if (!rowEl || !hasOlder || typeof IntersectionObserver === "undefined") return;
84
82
  const observer = new IntersectionObserver(
85
83
  (entries) => {
86
84
  for (const entry of entries) {
@@ -102,7 +100,7 @@ const StatewireHistoryEdge = ({
102
100
  nearTopRef.current = false;
103
101
  setNearTop(false);
104
102
  };
105
- }, [rowEl, olderCount]);
103
+ }, [rowEl, hasOlder]);
106
104
  const shapeRef = useRef(
107
105
  null
108
106
  );
@@ -119,7 +117,8 @@ const StatewireHistoryEdge = ({
119
117
  HistoryEdgeRow,
120
118
  {
121
119
  rowRef: setRowEl,
122
- olderCount,
120
+ hasOlder,
121
+ canLoadOlder,
123
122
  loading,
124
123
  onLoadOlder: loadOlder,
125
124
  className
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-history-edge.js","sources":["../../../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Messages older than the loaded window the server still holds. */\n olderCount: number;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history on a windowed wire: how many older\n * messages the server still holds, a manual way to load the next page, and\n * the in-flight state. Renders nothing when the whole transcript is loaded\n * (or the wire is not windowed).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n olderCount,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (olderCount <= 0) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {olderCount.toLocaleString()} earlier {olderCount === 1 ? \"message\" : \"messages\"}\n </button>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A `history/load` settled (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the windowed wire for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"N earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert on a wire that is not windowed: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { olderCount, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || olderCount <= 0 || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, olderCount]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n olderCount={olderCount}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n"],"names":[],"mappings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AA,EAAA;AAGN;"}
1
+ {"version":3,"file":"statewire-history-edge.js","sources":["../../../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Whether the server holds messages older than the loaded window. */\n hasOlder: boolean;\n /** Whether the next page can be asked for; `false` with `hasOlder` is the connection's loading depth spent. Defaults to `hasOlder`. */\n canLoadOlder?: boolean;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history: a manual way to load the next page of\n * older messages, and the in-flight state. Renders nothing when the whole\n * transcript is loaded (or the head interest has not resolved).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n hasOlder,\n canLoadOlder = hasOlder,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (!hasOlder) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : canLoadOlder ? (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Load earlier messages\n </button>\n ) : (\n <span data-testid=\"thread-history-edge-limit\">Earlier messages can't be loaded here</span>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A page interest resolved (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the interest window for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"Load earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert until the head interest resolves: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { hasOlder, canLoadOlder, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || !hasOlder || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, hasOlder]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n hasOlder={hasOlder}\n canLoadOlder={canLoadOlder}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n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A,MACA,aAAa;AAAA,MACb;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const react$1 = require("@assistant-ui/react");
5
+ const react = require("react");
6
+ const threadIdContext = require("../../threads/thread-id-context.cjs");
7
+ const THREAD_LOADING_OVERLAY_TIMEOUT_MS = 15e3;
8
+ const ThreadLoadingOverlay = () => {
9
+ const remoteId = threadIdContext.useAthenaThreadId();
10
+ const [timedOut, setTimedOut] = react.useState(false);
11
+ react.useEffect(() => {
12
+ if (!remoteId) return;
13
+ setTimedOut(false);
14
+ const timer = setTimeout(() => setTimedOut(true), THREAD_LOADING_OVERLAY_TIMEOUT_MS);
15
+ return () => clearTimeout(timer);
16
+ }, [remoteId]);
17
+ if (!remoteId || timedOut) return null;
18
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.AuiIf, { condition: (s) => s.thread.isEmpty, children: /* @__PURE__ */ jsxRuntime.jsx(
19
+ "div",
20
+ {
21
+ "data-testid": "thread-loading-overlay",
22
+ role: "status",
23
+ "aria-label": "Loading conversation",
24
+ className: "absolute inset-0 z-10 flex items-center justify-center bg-background/80",
25
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent" })
26
+ }
27
+ ) });
28
+ };
29
+ exports.THREAD_LOADING_OVERLAY_TIMEOUT_MS = THREAD_LOADING_OVERLAY_TIMEOUT_MS;
30
+ exports.ThreadLoadingOverlay = ThreadLoadingOverlay;
31
+ //# sourceMappingURL=thread-loading-overlay.cjs.map