@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
@@ -1,102 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const react$1 = require("@tiptap/react");
5
- const StarterKit = require("@tiptap/starter-kit");
6
- const Link = require("@tiptap/extension-link");
7
- const Table = require("@tiptap/extension-table");
8
- const TableRow = require("@tiptap/extension-table-row");
9
- const TableCell = require("@tiptap/extension-table-cell");
10
- const TableHeader = require("@tiptap/extension-table-header");
11
- const tiptapMarkdown = require("tiptap-markdown");
12
- const react = require("react");
13
- const mentionExtension = require("../chat-ui/mentions/mention-extension.cjs");
14
- const chatTextSchema = require("../chat-ui/rich-text/chat-text-schema.cjs");
15
- const athenaCitationLinks = require("./athena-citation-links.cjs");
16
- const extensions = [
17
- StarterKit.configure({ codeBlock: false }),
18
- chatTextSchema.ChatCodeBlockExtension,
19
- Link.configure({
20
- openOnClick: false,
21
- autolink: true,
22
- HTMLAttributes: {
23
- class: "text-primary underline",
24
- target: "_blank",
25
- rel: "noopener noreferrer"
4
+ require("../packages/agent-runtime/src/generated/runconfig-contract.cjs");
5
+ require("react");
6
+ require("@assistant-ui/tap");
7
+ require("statewire");
8
+ require("../packages/agent-runtime/src/statewire-suspended.cjs");
9
+ require("../packages/agent-runtime/src/conversation-list.cjs");
10
+ require("@tanstack/react-query");
11
+ require("../packages/agent-runtime/src/statewire-state.cjs");
12
+ require("../packages/agent-runtime/src/messages.cjs");
13
+ require("@assistant-ui/store");
14
+ const streamingMarkdown = require("../packages/agent-runtime/src/streaming-markdown.cjs");
15
+ require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
16
+ require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
17
+ require("../packages/agent-runtime/src/thread-status.cjs");
18
+ require("@assistant-ui/react-statewire");
19
+ require("@assistant-ui/core");
20
+ require("../packages/agent-runtime/src/thread-handoff.cjs");
21
+ const chatMessageBody = require("../chat-ui/rich-text/chat-message-body.cjs");
22
+ const TiptapText = ({ text, status }) => {
23
+ const isRunning = (status == null ? void 0 : status.type) === "running";
24
+ return /* @__PURE__ */ jsxRuntime.jsx(
25
+ chatMessageBody.ChatMessageBody,
26
+ {
27
+ text: isRunning ? streamingMarkdown.hideUnterminatedMarkdownLink(text) : text,
28
+ isRunning
26
29
  }
27
- }),
28
- Table.Table.configure({
29
- resizable: false,
30
- HTMLAttributes: {
31
- class: "aui-table"
32
- }
33
- }),
34
- TableRow.TableRow,
35
- TableCell.TableCell,
36
- TableHeader.TableHeader,
37
- tiptapMarkdown.Markdown.configure({
38
- html: true,
39
- tightLists: true,
40
- linkify: true,
41
- breaks: true,
42
- transformPastedText: false,
43
- transformCopiedText: false
44
- }),
45
- mentionExtension.MentionExtension
46
- ];
47
- const TiptapText = ({ text }) => {
48
- const handleLinkClick = athenaCitationLinks.useAthenaLinkClickHandler();
49
- const handleLinkClickRef = react.useRef(handleLinkClick);
50
- handleLinkClickRef.current = handleLinkClick;
51
- const editor = react$1.useEditor({
52
- immediatelyRender: true,
53
- extensions,
54
- content: text,
55
- editable: false,
56
- editorProps: {
57
- attributes: {
58
- class: "prose prose-sm dark:prose-invert max-w-none focus:outline-none"
59
- },
60
- // ProseMirror's `handleClick` fires on `mouseup`, where `preventDefault`
61
- // cannot cancel the anchor's navigation; the native `click` event can.
62
- handleDOMEvents: {
63
- click: (_view, event) => {
64
- var _a;
65
- if (event.button !== 0 || event.defaultPrevented) {
66
- return false;
67
- }
68
- const target = event.target;
69
- const targetElement = target instanceof HTMLElement ? target : target instanceof Node ? target.parentElement : null;
70
- if (!targetElement) {
71
- return false;
72
- }
73
- const link = targetElement.closest("a[href]");
74
- if (!(link instanceof HTMLAnchorElement)) {
75
- return false;
76
- }
77
- if (handleLinkClickRef.current({
78
- href: link.getAttribute("href") ?? link.href,
79
- linkText: link.textContent,
80
- target: link.target,
81
- nativeEvent: event
82
- })) {
83
- event.preventDefault();
84
- return true;
85
- }
86
- event.preventDefault();
87
- (_a = window.open(link.href, link.target || "_blank")) == null ? void 0 : _a.focus();
88
- return true;
89
- }
90
- }
91
- }
92
- });
93
- react.useEffect(() => {
94
- var _a;
95
- if (editor && text !== ((_a = editor.storage.markdown) == null ? void 0 : _a.getMarkdown())) {
96
- editor.commands.setContent(text);
97
- }
98
- }, [text, editor]);
99
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.EditorContent, { editor });
30
+ );
100
31
  };
101
32
  exports.TiptapText = TiptapText;
102
33
  //# sourceMappingURL=tiptap-text.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-text.cjs","sources":["../../src/chat/tiptap-text.tsx"],"sourcesContent":["import { useEditor, EditorContent } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport Link from \"@tiptap/extension-link\";\nimport { Table } from \"@tiptap/extension-table\";\nimport { TableRow } from \"@tiptap/extension-table-row\";\nimport { TableCell } from \"@tiptap/extension-table-cell\";\nimport { TableHeader } from \"@tiptap/extension-table-header\";\nimport { Markdown } from \"tiptap-markdown\";\nimport type { FC } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport { MentionExtension } from \"../chat-ui/mentions/mention-extension\";\nimport { ChatCodeBlockExtension } from \"../chat-ui/rich-text/chat-text-schema\";\nimport { useAthenaLinkClickHandler } from \"./athena-citation-links\";\n\nconst extensions = [\n StarterKit.configure({ codeBlock: false }),\n ChatCodeBlockExtension,\n Link.configure({\n openOnClick: false,\n autolink: true,\n HTMLAttributes: {\n class: \"text-primary underline\",\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n },\n }),\n Table.configure({\n resizable: false,\n HTMLAttributes: {\n class: \"aui-table\",\n },\n }),\n TableRow,\n TableCell,\n TableHeader,\n Markdown.configure({\n html: true,\n tightLists: true,\n linkify: true,\n breaks: true,\n transformPastedText: false,\n transformCopiedText: false,\n }),\n MentionExtension,\n];\n\nexport const TiptapText: FC<{ text: string }> = ({ text }) => {\n const handleLinkClick = useAthenaLinkClickHandler();\n const handleLinkClickRef = useRef(handleLinkClick);\n handleLinkClickRef.current = handleLinkClick;\n\n const editor = useEditor({\n immediatelyRender: true,\n extensions,\n content: text,\n editable: false,\n editorProps: {\n attributes: {\n class: \"prose prose-sm dark:prose-invert max-w-none focus:outline-none\",\n },\n // ProseMirror's `handleClick` fires on `mouseup`, where `preventDefault`\n // cannot cancel the anchor's navigation; the native `click` event can.\n handleDOMEvents: {\n click: (_view, event) => {\n if (event.button !== 0 || event.defaultPrevented) {\n return false;\n }\n\n const target = event.target;\n const targetElement =\n target instanceof HTMLElement\n ? target\n : target instanceof Node\n ? target.parentElement\n : null;\n if (!targetElement) {\n return false;\n }\n\n const link = targetElement.closest(\"a[href]\");\n if (!(link instanceof HTMLAnchorElement)) {\n return false;\n }\n\n if (\n handleLinkClickRef.current({\n href: link.getAttribute(\"href\") ?? link.href,\n linkText: link.textContent,\n target: link.target,\n nativeEvent: event,\n })\n ) {\n event.preventDefault();\n return true;\n }\n\n event.preventDefault();\n window.open(link.href, link.target || \"_blank\")?.focus();\n return true;\n },\n },\n },\n });\n\n useEffect(() => {\n if (editor && text !== (editor.storage as any).markdown?.getMarkdown()) {\n editor.commands.setContent(text);\n }\n }, [text, editor]);\n\n return <EditorContent editor={editor} />;\n};\n"],"names":["ChatCodeBlockExtension","Table","TableRow","TableCell","TableHeader","Markdown","MentionExtension","useAthenaLinkClickHandler","useRef","useEditor","useEffect","jsx","EditorContent"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,aAAa;AAAA,EACjB,WAAW,UAAU,EAAE,WAAW,OAAO;AAAA,EACzCA,eAAAA;AAAAA,EACA,KAAK,UAAU;AAAA,IACb,aAAa;AAAA,IACb,UAAU;AAAA,IACV,gBAAgB;AAAA,MACd,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,KAAK;AAAA,IAAA;AAAA,EACP,CACD;AAAA,EACDC,MAAAA,MAAM,UAAU;AAAA,IACd,WAAW;AAAA,IACX,gBAAgB;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,EACT,CACD;AAAA,EACDC,SAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,YAAAA;AAAAA,EACAC,eAAAA,SAAS,UAAU;AAAA,IACjB,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,EAAA,CACtB;AAAA,EACDC,iBAAAA;AACF;AAEO,MAAM,aAAmC,CAAC,EAAE,WAAW;AAC5D,QAAM,kBAAkBC,oBAAAA,0BAAA;AACxB,QAAM,qBAAqBC,MAAAA,OAAO,eAAe;AACjD,qBAAmB,UAAU;AAE7B,QAAM,SAASC,QAAAA,UAAU;AAAA,IACvB,mBAAmB;AAAA,IACnB;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,aAAa;AAAA,MACX,YAAY;AAAA,QACV,OAAO;AAAA,MAAA;AAAA;AAAA;AAAA,MAIT,iBAAiB;AAAA,QACf,OAAO,CAAC,OAAO,UAAU;;AACvB,cAAI,MAAM,WAAW,KAAK,MAAM,kBAAkB;AAChD,mBAAO;AAAA,UACT;AAEA,gBAAM,SAAS,MAAM;AACrB,gBAAM,gBACJ,kBAAkB,cACd,SACA,kBAAkB,OAChB,OAAO,gBACP;AACR,cAAI,CAAC,eAAe;AAClB,mBAAO;AAAA,UACT;AAEA,gBAAM,OAAO,cAAc,QAAQ,SAAS;AAC5C,cAAI,EAAE,gBAAgB,oBAAoB;AACxC,mBAAO;AAAA,UACT;AAEA,cACE,mBAAmB,QAAQ;AAAA,YACzB,MAAM,KAAK,aAAa,MAAM,KAAK,KAAK;AAAA,YACxC,UAAU,KAAK;AAAA,YACf,QAAQ,KAAK;AAAA,YACb,aAAa;AAAA,UAAA,CACd,GACD;AACA,kBAAM,eAAA;AACN,mBAAO;AAAA,UACT;AAEA,gBAAM,eAAA;AACN,uBAAO,KAAK,KAAK,MAAM,KAAK,UAAU,QAAQ,MAA9C,mBAAiD;AACjD,iBAAO;AAAA,QACT;AAAA,MAAA;AAAA,IACF;AAAA,EACF,CACD;AAEDC,QAAAA,UAAU,MAAM;;AACd,QAAI,UAAU,WAAU,YAAO,QAAgB,aAAvB,mBAAiC,gBAAe;AACtE,aAAO,SAAS,WAAW,IAAI;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SAAOC,+BAACC,QAAAA,iBAAc,QAAgB;AACxC;;"}
1
+ {"version":3,"file":"tiptap-text.cjs","sources":["../../src/chat/tiptap-text.tsx"],"sourcesContent":["import type { TextMessagePartProps } from \"@assistant-ui/react\";\nimport { hideUnterminatedMarkdownLink } from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { ChatMessageBody } from \"../chat-ui/rich-text/chat-message-body\";\n\n/**\n * The text part renderer `AthenaChat` mounts by default (and the one a host\n * that overrides `messageParts.Text` replaces). It is the shared static\n * message body every SDK surface renders — one document parse per message\n * instead of a live Tiptap editor per part — so links, source chips and asset\n * citations render identically here, in the Chrome extension and in the\n * Office add-in, and every click on them goes through the SDK's link-click\n * path (`useAthenaLinkClickHandler`: the provider's `linkClicks`, then the\n * asset panel for an Athena citation). While the part streams, a markdown\n * link whose destination has not closed is held back, as `MarkdownText` does.\n */\nexport const TiptapText: FC<{\n text: string;\n status?: TextMessagePartProps[\"status\"];\n}> = ({ text, status }) => {\n const isRunning = status?.type === \"running\";\n return (\n <ChatMessageBody\n text={isRunning ? hideUnterminatedMarkdownLink(text) : text}\n isRunning={isRunning}\n />\n );\n};\n"],"names":["jsx","ChatMessageBody","hideUnterminatedMarkdownLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgBO,MAAM,aAGR,CAAC,EAAE,MAAM,aAAa;AACzB,QAAM,aAAY,iCAAQ,UAAS;AACnC,SACEA,2BAAAA;AAAAA,IAACC,gBAAAA;AAAAA,IAAA;AAAA,MACC,MAAM,YAAYC,+CAA6B,IAAI,IAAI;AAAA,MACvD;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
@@ -1,4 +1,17 @@
1
+ import type { TextMessagePartProps } from "@assistant-ui/react";
1
2
  import type { FC } from "react";
3
+ /**
4
+ * The text part renderer `AthenaChat` mounts by default (and the one a host
5
+ * that overrides `messageParts.Text` replaces). It is the shared static
6
+ * message body every SDK surface renders — one document parse per message
7
+ * instead of a live Tiptap editor per part — so links, source chips and asset
8
+ * citations render identically here, in the Chrome extension and in the
9
+ * Office add-in, and every click on them goes through the SDK's link-click
10
+ * path (`useAthenaLinkClickHandler`: the provider's `linkClicks`, then the
11
+ * asset panel for an Athena citation). While the part streams, a markdown
12
+ * link whose destination has not closed is held back, as `MarkdownText` does.
13
+ */
2
14
  export declare const TiptapText: FC<{
3
15
  text: string;
16
+ status?: TextMessagePartProps["status"];
4
17
  }>;
@@ -1,100 +1,31 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useEditor, EditorContent } from "@tiptap/react";
3
- import StarterKit from "@tiptap/starter-kit";
4
- import Link from "@tiptap/extension-link";
5
- import { Table } from "@tiptap/extension-table";
6
- import { TableRow } from "@tiptap/extension-table-row";
7
- import { TableCell } from "@tiptap/extension-table-cell";
8
- import { TableHeader } from "@tiptap/extension-table-header";
9
- import { Markdown } from "tiptap-markdown";
10
- import { useRef, useEffect } from "react";
11
- import { MentionExtension } from "../chat-ui/mentions/mention-extension.js";
12
- import { ChatCodeBlockExtension } from "../chat-ui/rich-text/chat-text-schema.js";
13
- import { useAthenaLinkClickHandler } from "./athena-citation-links.js";
14
- const extensions = [
15
- StarterKit.configure({ codeBlock: false }),
16
- ChatCodeBlockExtension,
17
- Link.configure({
18
- openOnClick: false,
19
- autolink: true,
20
- HTMLAttributes: {
21
- class: "text-primary underline",
22
- target: "_blank",
23
- rel: "noopener noreferrer"
2
+ import "../packages/agent-runtime/src/generated/runconfig-contract.js";
3
+ import "react";
4
+ import "@assistant-ui/tap";
5
+ import "statewire";
6
+ import "../packages/agent-runtime/src/statewire-suspended.js";
7
+ import "../packages/agent-runtime/src/conversation-list.js";
8
+ import "@tanstack/react-query";
9
+ import "../packages/agent-runtime/src/statewire-state.js";
10
+ import "../packages/agent-runtime/src/messages.js";
11
+ import "@assistant-ui/store";
12
+ import { hideUnterminatedMarkdownLink } from "../packages/agent-runtime/src/streaming-markdown.js";
13
+ import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
14
+ import "../packages/agent-runtime/src/statewire-attach-observer.js";
15
+ import "../packages/agent-runtime/src/thread-status.js";
16
+ import "@assistant-ui/react-statewire";
17
+ import "@assistant-ui/core";
18
+ import "../packages/agent-runtime/src/thread-handoff.js";
19
+ import { ChatMessageBody } from "../chat-ui/rich-text/chat-message-body.js";
20
+ const TiptapText = ({ text, status }) => {
21
+ const isRunning = (status == null ? void 0 : status.type) === "running";
22
+ return /* @__PURE__ */ jsx(
23
+ ChatMessageBody,
24
+ {
25
+ text: isRunning ? hideUnterminatedMarkdownLink(text) : text,
26
+ isRunning
24
27
  }
25
- }),
26
- Table.configure({
27
- resizable: false,
28
- HTMLAttributes: {
29
- class: "aui-table"
30
- }
31
- }),
32
- TableRow,
33
- TableCell,
34
- TableHeader,
35
- Markdown.configure({
36
- html: true,
37
- tightLists: true,
38
- linkify: true,
39
- breaks: true,
40
- transformPastedText: false,
41
- transformCopiedText: false
42
- }),
43
- MentionExtension
44
- ];
45
- const TiptapText = ({ text }) => {
46
- const handleLinkClick = useAthenaLinkClickHandler();
47
- const handleLinkClickRef = useRef(handleLinkClick);
48
- handleLinkClickRef.current = handleLinkClick;
49
- const editor = useEditor({
50
- immediatelyRender: true,
51
- extensions,
52
- content: text,
53
- editable: false,
54
- editorProps: {
55
- attributes: {
56
- class: "prose prose-sm dark:prose-invert max-w-none focus:outline-none"
57
- },
58
- // ProseMirror's `handleClick` fires on `mouseup`, where `preventDefault`
59
- // cannot cancel the anchor's navigation; the native `click` event can.
60
- handleDOMEvents: {
61
- click: (_view, event) => {
62
- var _a;
63
- if (event.button !== 0 || event.defaultPrevented) {
64
- return false;
65
- }
66
- const target = event.target;
67
- const targetElement = target instanceof HTMLElement ? target : target instanceof Node ? target.parentElement : null;
68
- if (!targetElement) {
69
- return false;
70
- }
71
- const link = targetElement.closest("a[href]");
72
- if (!(link instanceof HTMLAnchorElement)) {
73
- return false;
74
- }
75
- if (handleLinkClickRef.current({
76
- href: link.getAttribute("href") ?? link.href,
77
- linkText: link.textContent,
78
- target: link.target,
79
- nativeEvent: event
80
- })) {
81
- event.preventDefault();
82
- return true;
83
- }
84
- event.preventDefault();
85
- (_a = window.open(link.href, link.target || "_blank")) == null ? void 0 : _a.focus();
86
- return true;
87
- }
88
- }
89
- }
90
- });
91
- useEffect(() => {
92
- var _a;
93
- if (editor && text !== ((_a = editor.storage.markdown) == null ? void 0 : _a.getMarkdown())) {
94
- editor.commands.setContent(text);
95
- }
96
- }, [text, editor]);
97
- return /* @__PURE__ */ jsx(EditorContent, { editor });
28
+ );
98
29
  };
99
30
  export {
100
31
  TiptapText
@@ -1 +1 @@
1
- {"version":3,"file":"tiptap-text.js","sources":["../../src/chat/tiptap-text.tsx"],"sourcesContent":["import { useEditor, EditorContent } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport Link from \"@tiptap/extension-link\";\nimport { Table } from \"@tiptap/extension-table\";\nimport { TableRow } from \"@tiptap/extension-table-row\";\nimport { TableCell } from \"@tiptap/extension-table-cell\";\nimport { TableHeader } from \"@tiptap/extension-table-header\";\nimport { Markdown } from \"tiptap-markdown\";\nimport type { FC } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport { MentionExtension } from \"../chat-ui/mentions/mention-extension\";\nimport { ChatCodeBlockExtension } from \"../chat-ui/rich-text/chat-text-schema\";\nimport { useAthenaLinkClickHandler } from \"./athena-citation-links\";\n\nconst extensions = [\n StarterKit.configure({ codeBlock: false }),\n ChatCodeBlockExtension,\n Link.configure({\n openOnClick: false,\n autolink: true,\n HTMLAttributes: {\n class: \"text-primary underline\",\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n },\n }),\n Table.configure({\n resizable: false,\n HTMLAttributes: {\n class: \"aui-table\",\n },\n }),\n TableRow,\n TableCell,\n TableHeader,\n Markdown.configure({\n html: true,\n tightLists: true,\n linkify: true,\n breaks: true,\n transformPastedText: false,\n transformCopiedText: false,\n }),\n MentionExtension,\n];\n\nexport const TiptapText: FC<{ text: string }> = ({ text }) => {\n const handleLinkClick = useAthenaLinkClickHandler();\n const handleLinkClickRef = useRef(handleLinkClick);\n handleLinkClickRef.current = handleLinkClick;\n\n const editor = useEditor({\n immediatelyRender: true,\n extensions,\n content: text,\n editable: false,\n editorProps: {\n attributes: {\n class: \"prose prose-sm dark:prose-invert max-w-none focus:outline-none\",\n },\n // ProseMirror's `handleClick` fires on `mouseup`, where `preventDefault`\n // cannot cancel the anchor's navigation; the native `click` event can.\n handleDOMEvents: {\n click: (_view, event) => {\n if (event.button !== 0 || event.defaultPrevented) {\n return false;\n }\n\n const target = event.target;\n const targetElement =\n target instanceof HTMLElement\n ? target\n : target instanceof Node\n ? target.parentElement\n : null;\n if (!targetElement) {\n return false;\n }\n\n const link = targetElement.closest(\"a[href]\");\n if (!(link instanceof HTMLAnchorElement)) {\n return false;\n }\n\n if (\n handleLinkClickRef.current({\n href: link.getAttribute(\"href\") ?? link.href,\n linkText: link.textContent,\n target: link.target,\n nativeEvent: event,\n })\n ) {\n event.preventDefault();\n return true;\n }\n\n event.preventDefault();\n window.open(link.href, link.target || \"_blank\")?.focus();\n return true;\n },\n },\n },\n });\n\n useEffect(() => {\n if (editor && text !== (editor.storage as any).markdown?.getMarkdown()) {\n editor.commands.setContent(text);\n }\n }, [text, editor]);\n\n return <EditorContent editor={editor} />;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAcA,MAAM,aAAa;AAAA,EACjB,WAAW,UAAU,EAAE,WAAW,OAAO;AAAA,EACzC;AAAA,EACA,KAAK,UAAU;AAAA,IACb,aAAa;AAAA,IACb,UAAU;AAAA,IACV,gBAAgB;AAAA,MACd,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,KAAK;AAAA,IAAA;AAAA,EACP,CACD;AAAA,EACD,MAAM,UAAU;AAAA,IACd,WAAW;AAAA,IACX,gBAAgB;AAAA,MACd,OAAO;AAAA,IAAA;AAAA,EACT,CACD;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,UAAU;AAAA,IACjB,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,EAAA,CACtB;AAAA,EACD;AACF;AAEO,MAAM,aAAmC,CAAC,EAAE,WAAW;AAC5D,QAAM,kBAAkB,0BAAA;AACxB,QAAM,qBAAqB,OAAO,eAAe;AACjD,qBAAmB,UAAU;AAE7B,QAAM,SAAS,UAAU;AAAA,IACvB,mBAAmB;AAAA,IACnB;AAAA,IACA,SAAS;AAAA,IACT,UAAU;AAAA,IACV,aAAa;AAAA,MACX,YAAY;AAAA,QACV,OAAO;AAAA,MAAA;AAAA;AAAA;AAAA,MAIT,iBAAiB;AAAA,QACf,OAAO,CAAC,OAAO,UAAU;;AACvB,cAAI,MAAM,WAAW,KAAK,MAAM,kBAAkB;AAChD,mBAAO;AAAA,UACT;AAEA,gBAAM,SAAS,MAAM;AACrB,gBAAM,gBACJ,kBAAkB,cACd,SACA,kBAAkB,OAChB,OAAO,gBACP;AACR,cAAI,CAAC,eAAe;AAClB,mBAAO;AAAA,UACT;AAEA,gBAAM,OAAO,cAAc,QAAQ,SAAS;AAC5C,cAAI,EAAE,gBAAgB,oBAAoB;AACxC,mBAAO;AAAA,UACT;AAEA,cACE,mBAAmB,QAAQ;AAAA,YACzB,MAAM,KAAK,aAAa,MAAM,KAAK,KAAK;AAAA,YACxC,UAAU,KAAK;AAAA,YACf,QAAQ,KAAK;AAAA,YACb,aAAa;AAAA,UAAA,CACd,GACD;AACA,kBAAM,eAAA;AACN,mBAAO;AAAA,UACT;AAEA,gBAAM,eAAA;AACN,uBAAO,KAAK,KAAK,MAAM,KAAK,UAAU,QAAQ,MAA9C,mBAAiD;AACjD,iBAAO;AAAA,QACT;AAAA,MAAA;AAAA,IACF;AAAA,EACF,CACD;AAED,YAAU,MAAM;;AACd,QAAI,UAAU,WAAU,YAAO,QAAgB,aAAvB,mBAAiC,gBAAe;AACtE,aAAO,SAAS,WAAW,IAAI;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,MAAM,MAAM,CAAC;AAEjB,SAAO,oBAAC,iBAAc,QAAgB;AACxC;"}
1
+ {"version":3,"file":"tiptap-text.js","sources":["../../src/chat/tiptap-text.tsx"],"sourcesContent":["import type { TextMessagePartProps } from \"@assistant-ui/react\";\nimport { hideUnterminatedMarkdownLink } from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { ChatMessageBody } from \"../chat-ui/rich-text/chat-message-body\";\n\n/**\n * The text part renderer `AthenaChat` mounts by default (and the one a host\n * that overrides `messageParts.Text` replaces). It is the shared static\n * message body every SDK surface renders — one document parse per message\n * instead of a live Tiptap editor per part — so links, source chips and asset\n * citations render identically here, in the Chrome extension and in the\n * Office add-in, and every click on them goes through the SDK's link-click\n * path (`useAthenaLinkClickHandler`: the provider's `linkClicks`, then the\n * asset panel for an Athena citation). While the part streams, a markdown\n * link whose destination has not closed is held back, as `MarkdownText` does.\n */\nexport const TiptapText: FC<{\n text: string;\n status?: TextMessagePartProps[\"status\"];\n}> = ({ text, status }) => {\n const isRunning = status?.type === \"running\";\n return (\n <ChatMessageBody\n text={isRunning ? hideUnterminatedMarkdownLink(text) : text}\n isRunning={isRunning}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAgBO,MAAM,aAGR,CAAC,EAAE,MAAM,aAAa;AACzB,QAAM,aAAY,iCAAQ,UAAS;AACnC,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM,YAAY,6BAA6B,IAAI,IAAI;AAAA,MACvD;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -6,14 +6,15 @@ require("react");
6
6
  require("@assistant-ui/tap");
7
7
  require("statewire");
8
8
  require("../packages/agent-runtime/src/statewire-suspended.cjs");
9
+ require("../packages/agent-runtime/src/conversation-list.cjs");
9
10
  require("@tanstack/react-query");
10
11
  require("../packages/agent-runtime/src/statewire-state.cjs");
11
12
  require("../packages/agent-runtime/src/messages.cjs");
12
- require("@assistant-ui/react-statewire");
13
13
  require("@assistant-ui/store");
14
14
  require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
15
15
  require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
16
16
  const threadStatus = require("../packages/agent-runtime/src/thread-status.cjs");
17
+ require("@assistant-ui/react-statewire");
17
18
  require("@assistant-ui/core");
18
19
  require("../packages/agent-runtime/src/thread-handoff.cjs");
19
20
  function useAthenaRunLive() {
@@ -1 +1 @@
1
- {"version":3,"file":"use-athena-run-live.cjs","sources":["../../src/chat/use-athena-run-live.ts"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { readRunLive, useDeepAgentConnection } from '@athenaintel/agent-runtime';\n\n/**\n * Whether the thread has a live run — `thread.isRunning` folded through the\n * host's channel state, so a run behind a first dial (a new chat's first\n * send, switching back to a thread that was running) still reads as live\n * while a run behind a genuine reconnect or eviction does not. Surfaces\n * that gate on a live run (message edit, the voice card's live state, the\n * approval resume lock) read this instead of `thread.isRunning`, which\n * follows the presented status and blinks off for the attach round-trip.\n */\nexport function useAthenaRunLive(): boolean {\n const connection = useDeepAgentConnection();\n return useAuiState((s) => readRunLive(s.thread, connection));\n}\n"],"names":["useDeepAgentConnection","useAuiState","readRunLive"],"mappings":";;;;;;;;;;;;;;;;;;AAYO,SAAS,mBAA4B;AAC1C,QAAM,aAAaA,aAAAA,uBAAA;AACnB,SAAOC,MAAAA,YAAY,CAAC,MAAMC,aAAAA,YAAY,EAAE,QAAQ,UAAU,CAAC;AAC7D;;"}
1
+ {"version":3,"file":"use-athena-run-live.cjs","sources":["../../src/chat/use-athena-run-live.ts"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { readRunLive, useDeepAgentConnection } from '@athenaintel/agent-runtime';\n\n/**\n * Whether the thread has a live run — `thread.isRunning` folded through the\n * host's channel state, so a run behind a first dial (a new chat's first\n * send, switching back to a thread that was running) still reads as live\n * while a run behind a genuine reconnect or eviction does not. Surfaces\n * that gate on a live run (message edit, the voice card's live state, the\n * approval resume lock) read this instead of `thread.isRunning`, which\n * follows the presented status and blinks off for the attach round-trip.\n */\nexport function useAthenaRunLive(): boolean {\n const connection = useDeepAgentConnection();\n return useAuiState((s) => readRunLive(s.thread, connection));\n}\n"],"names":["useDeepAgentConnection","useAuiState","readRunLive"],"mappings":";;;;;;;;;;;;;;;;;;;AAYO,SAAS,mBAA4B;AAC1C,QAAM,aAAaA,aAAAA,uBAAA;AACnB,SAAOC,MAAAA,YAAY,CAAC,MAAMC,aAAAA,YAAY,EAAE,QAAQ,UAAU,CAAC;AAC7D;;"}
@@ -4,14 +4,15 @@ import "react";
4
4
  import "@assistant-ui/tap";
5
5
  import "statewire";
6
6
  import "../packages/agent-runtime/src/statewire-suspended.js";
7
+ import "../packages/agent-runtime/src/conversation-list.js";
7
8
  import "@tanstack/react-query";
8
9
  import "../packages/agent-runtime/src/statewire-state.js";
9
10
  import "../packages/agent-runtime/src/messages.js";
10
- import "@assistant-ui/react-statewire";
11
11
  import "@assistant-ui/store";
12
12
  import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
13
13
  import "../packages/agent-runtime/src/statewire-attach-observer.js";
14
14
  import { useDeepAgentConnection, readRunLive } from "../packages/agent-runtime/src/thread-status.js";
15
+ import "@assistant-ui/react-statewire";
15
16
  import "@assistant-ui/core";
16
17
  import "../packages/agent-runtime/src/thread-handoff.js";
17
18
  function useAthenaRunLive() {
@@ -1 +1 @@
1
- {"version":3,"file":"use-athena-run-live.js","sources":["../../src/chat/use-athena-run-live.ts"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { readRunLive, useDeepAgentConnection } from '@athenaintel/agent-runtime';\n\n/**\n * Whether the thread has a live run — `thread.isRunning` folded through the\n * host's channel state, so a run behind a first dial (a new chat's first\n * send, switching back to a thread that was running) still reads as live\n * while a run behind a genuine reconnect or eviction does not. Surfaces\n * that gate on a live run (message edit, the voice card's live state, the\n * approval resume lock) read this instead of `thread.isRunning`, which\n * follows the presented status and blinks off for the attach round-trip.\n */\nexport function useAthenaRunLive(): boolean {\n const connection = useDeepAgentConnection();\n return useAuiState((s) => readRunLive(s.thread, connection));\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAYO,SAAS,mBAA4B;AAC1C,QAAM,aAAa,uBAAA;AACnB,SAAO,YAAY,CAAC,MAAM,YAAY,EAAE,QAAQ,UAAU,CAAC;AAC7D;"}
1
+ {"version":3,"file":"use-athena-run-live.js","sources":["../../src/chat/use-athena-run-live.ts"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { readRunLive, useDeepAgentConnection } from '@athenaintel/agent-runtime';\n\n/**\n * Whether the thread has a live run — `thread.isRunning` folded through the\n * host's channel state, so a run behind a first dial (a new chat's first\n * send, switching back to a thread that was running) still reads as live\n * while a run behind a genuine reconnect or eviction does not. Surfaces\n * that gate on a live run (message edit, the voice card's live state, the\n * approval resume lock) read this instead of `thread.isRunning`, which\n * follows the presented status and blinks off for the attach round-trip.\n */\nexport function useAthenaRunLive(): boolean {\n const connection = useDeepAgentConnection();\n return useAuiState((s) => readRunLive(s.thread, connection));\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAYO,SAAS,mBAA4B;AAC1C,QAAM,aAAa,uBAAA;AACnB,SAAO,YAAY,CAAC,MAAM,YAAY,EAAE,QAAQ,UAAU,CAAC;AAC7D;"}
@@ -6,6 +6,7 @@ const react = require("react");
6
6
  require("@assistant-ui/tap");
7
7
  require("statewire");
8
8
  require("../packages/agent-runtime/src/statewire-suspended.cjs");
9
+ require("../packages/agent-runtime/src/conversation-list.cjs");
9
10
  require("@tanstack/react-query");
10
11
  const interrupts = require("../packages/agent-runtime/src/interrupts.cjs");
11
12
  require("../packages/agent-runtime/src/messages.cjs");
@@ -1 +1 @@
1
- {"version":3,"file":"use-statewire-approval-request.cjs","sources":["../../src/chat/use-statewire-approval-request.ts"],"sourcesContent":["import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n type AbandonedInputRequest,\n asHitlApproval,\n findAbandonedInterrupt,\n HITL_PENDING_RESUME_GRACE_MS,\n type HitlApprovalPayload,\n interruptMirrorPayload,\n isApprovalCardInterrupt,\n type PendingActionRequest,\n pendingActionRequests,\n readAbandonedInputRequests,\n readInterruptMirror,\n readQueuedLaneDecisions,\n useApprovalResumeLock,\n} from '@athenaintel/agent-runtime';\nimport { useCallback, useMemo } from 'react';\nimport { useAthenaRunLive } from './use-athena-run-live';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * Decide per-dispatch subagent lanes while the parent run is still\n * streaming (`DeepAgentThread.run_lane_input`). Keys are the lanes'\n * langgraph interrupt ids; the host matches them against the lanes its\n * mirrored interrupt currently parks, answers at once when the run is\n * already parked, and otherwise holds them until it parks — stale or\n * unknown ids are ignored, never carried to a later interrupt.\n */\n runLaneInput: {\n readonly type: 'run/lane-input';\n readonly laneDecisions: Readonly<Record<string, StatewireThread.InputResponse>>;\n };\n }\n }\n}\n\nconst NO_QUEUED_LANE_DECISIONS: Readonly<Record<string, unknown>> = Object.freeze({});\n\n/** Selects which pending interrupt an approval surface answers. */\nexport type StatewireInterruptPredicate = (\n request: StatewireThread.InputRequestState,\n) => request is StatewireThread.CustomInputRequest;\n\nexport interface UseStatewireApprovalRequestOptions {\n /**\n * Which pending interrupt to answer. Defaults to `isApprovalCardInterrupt`\n * (client-tool parks excluded — the client-tool bridge owns those, and a\n * generic resume would corrupt the parked tool call).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a sent decision keeps the actions locked when no resume run ever\n * starts. Defaults to {@link HITL_PENDING_RESUME_GRACE_MS}.\n */\n pendingResumeGraceMs?: number;\n /**\n * The host refused the `run/input` (or the transport lost it): the\n * optimistic fold rolls back, the request is on screen again with its\n * actions re-enabled, and this is the surface's one chance to say why.\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n}\n\nexport interface StatewireApprovalRequest<TValue> {\n /** The pending interrupt this surface answers, if any. */\n request: StatewireThread.CustomInputRequest | undefined;\n requestId: string | undefined;\n /** The payload narrowed to the Athena HITL approval shape, or `null`. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n /** An interrupt a non-resume dispatch dropped — the \"approval was cancelled\" notice. */\n abandonedInterrupt: AbandonedInputRequest | undefined;\n /**\n * The mirrored interrupt's HITL payload while the run is still live and no\n * input request is answerable: per-dispatch `task` lanes parked on their\n * gates while sibling lanes stream. `null` once the run parks (the same\n * lanes are then `hitl` / `actionRequests`) and when nothing is parked.\n */\n liveHitl: HitlApprovalPayload | null;\n /** Every gated call `liveHitl` covers (empty when it is `null`). */\n liveActionRequests: PendingActionRequest[];\n /**\n * The decisions the host already holds from a `run/lane-input`, keyed by\n * langgraph interrupt id, to be answered when the run parks — a queued lane\n * reads as decided on every attached client, not just the one that sent it.\n */\n queuedLaneDecisions: Readonly<Record<string, unknown>>;\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /**\n * Answer the request with `{ type: 'run/input', requestId, response: { type: 'resume', value } }`.\n * Returns the dispatch promise (settles when the host accepts, rejects when\n * it refuses), or `undefined` when the lock dropped the send.\n */\n resume: (value: TValue) => Promise<unknown> | undefined;\n /**\n * Decide per-dispatch lanes by langgraph interrupt id. With a pending\n * request this is the native `lane_decisions` resume through the lock;\n * without one (the run is still streaming siblings) it is `run/lane-input`,\n * which the host queues and answers on the park. Returns the dispatch\n * promise, or `undefined` when the lock dropped a resume.\n */\n sendLaneDecisions: (\n lanes: Readonly<Record<string, StatewireThread.InputResponse>>,\n ) => Promise<unknown> | undefined;\n}\n\n/**\n * The headless half of every statewire approval surface: selects the pending\n * interrupt from the runs projection, narrows its payload, reads the\n * host-published abandoned interrupts, and wires the shared optimistic resume\n * lock to the thread's `run/input` command. `StatewireApprovalCard` renders\n * over it; hosts with their own decision UI (per-lane subagent cards) build\n * on it directly so the selection and lock semantics cannot drift.\n *\n * Requires a statewire aui scope (throws outside one, like every\n * `useStatewire*` hook) — gate the mount with `hasStatewireThreadExtras`.\n */\nexport function useStatewireApprovalRequest<\n TValue extends StatewireThread.InputResponse = Record<string, string>,\n>(options: UseStatewireApprovalRequestOptions = {}): StatewireApprovalRequest<TValue> {\n const {\n interruptPredicate = isApprovalCardInterrupt,\n pendingResumeGraceMs = HITL_PENDING_RESUME_GRACE_MS,\n onResumeRejected,\n } = options;\n const sendCommand = useStatewireSendCommand();\n // The runs projection is memoized by the lib, so this derivation is\n // reference-stable between state updates.\n const request = useStatewireRuns().inputRequests?.find(interruptPredicate);\n const requestId = request?.id;\n\n // The host publishes the interrupts a non-resume dispatch dropped. Select\n // the raw array reference (pre-stream-safe) and derive inline; a `.find`\n // selector would return a fresh object every update.\n const abandoned = useStatewireState(readAbandonedInputRequests);\n const abandonedInterrupt = findAbandonedInterrupt(abandoned);\n\n const hitl = asHitlApproval(request?.payload);\n const actionRequests = useMemo(() => pendingActionRequests(hitl), [hitl]);\n\n const isRunning = useAthenaRunLive();\n // The host mirrors the interrupt into state as soon as a lane parks — while\n // the run manager still reports `running` (siblings streaming) and has no\n // request to answer. Raw reference selectors; derive inline.\n const mirror = useStatewireState(readInterruptMirror);\n const liveHitl =\n request === undefined && isRunning ? asHitlApproval(interruptMirrorPayload(mirror)) : null;\n const liveActionRequests = useMemo(() => pendingActionRequests(liveHitl), [liveHitl]);\n const queuedLaneDecisions =\n useStatewireState(readQueuedLaneDecisions) ?? NO_QUEUED_LANE_DECISIONS;\n\n const { pending, resume } = useApprovalResumeLock<TValue>({\n requestId,\n isRunning,\n pendingResumeGraceMs,\n onResumeRejected,\n // The dispatch promise is handed to the lock: a refusal releases it and\n // reaches `onResumeRejected`.\n sendResume: (id, value) =>\n sendCommand({\n type: 'run/input',\n requestId: id,\n response: { type: 'resume', value },\n }),\n });\n\n const sendLaneDecisions = useCallback(\n (lanes: Readonly<Record<string, StatewireThread.InputResponse>>) =>\n requestId !== undefined\n ? resume({ lane_decisions: lanes } as unknown as TValue)\n : sendCommand({ type: 'run/lane-input', laneDecisions: lanes }),\n [requestId, resume, sendCommand],\n );\n\n return {\n request,\n requestId,\n hitl,\n actionRequests,\n liveHitl,\n liveActionRequests,\n queuedLaneDecisions,\n abandonedInterrupt,\n pending,\n resume,\n sendLaneDecisions,\n };\n}\n"],"names":["isApprovalCardInterrupt","HITL_PENDING_RESUME_GRACE_MS","useStatewireSendCommand","useStatewireRuns","useStatewireState","readAbandonedInputRequests","findAbandonedInterrupt","asHitlApproval","useMemo","pendingActionRequests","useAthenaRunLive","readInterruptMirror","interruptMirrorPayload","readQueuedLaneDecisions","useApprovalResumeLock","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;AA2CA,MAAM,2BAA8D,OAAO,OAAO,EAAE;AAmF7E,SAAS,4BAEd,UAA8C,IAAsC;;AACpF,QAAM;AAAA,IACJ,qBAAqBA,WAAAA;AAAAA,IACrB,uBAAuBC,WAAAA;AAAAA,IACvB;AAAA,EAAA,IACE;AACJ,QAAM,cAAcC,eAAAA,wBAAA;AAGpB,QAAM,WAAUC,oBAAAA,iBAAA,EAAmB,kBAAnBA,mBAAkC,KAAK;AACvD,QAAM,YAAY,mCAAS;AAK3B,QAAM,YAAYC,eAAAA,kBAAkBC,qCAA0B;AAC9D,QAAM,qBAAqBC,WAAAA,uBAAuB,SAAS;AAE3D,QAAM,OAAOC,WAAAA,eAAe,mCAAS,OAAO;AAC5C,QAAM,iBAAiBC,MAAAA,QAAQ,MAAMC,WAAAA,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;AAExE,QAAM,YAAYC,iBAAAA,iBAAA;AAIlB,QAAM,SAASN,eAAAA,kBAAkBO,8BAAmB;AACpD,QAAM,WACJ,YAAY,UAAa,YAAYJ,WAAAA,eAAeK,WAAAA,uBAAuB,MAAM,CAAC,IAAI;AACxF,QAAM,qBAAqBJ,MAAAA,QAAQ,MAAMC,WAAAA,sBAAsB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AACpF,QAAM,sBACJL,eAAAA,kBAAkBS,WAAAA,uBAAuB,KAAK;AAEhD,QAAM,EAAE,SAAS,OAAA,IAAWC,iCAA8B;AAAA,IACxD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,YAAY,CAAC,IAAI,UACf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU,EAAE,MAAM,UAAU,MAAA;AAAA,IAAM,CACnC;AAAA,EAAA,CACJ;AAED,QAAM,oBAAoBC,MAAAA;AAAAA,IACxB,CAAC,UACC,cAAc,SACV,OAAO,EAAE,gBAAgB,MAAA,CAA4B,IACrD,YAAY,EAAE,MAAM,kBAAkB,eAAe,OAAO;AAAA,IAClE,CAAC,WAAW,QAAQ,WAAW;AAAA,EAAA;AAGjC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;"}
1
+ {"version":3,"file":"use-statewire-approval-request.cjs","sources":["../../src/chat/use-statewire-approval-request.ts"],"sourcesContent":["import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n type AbandonedInputRequest,\n asHitlApproval,\n findAbandonedInterrupt,\n HITL_PENDING_RESUME_GRACE_MS,\n type HitlApprovalPayload,\n interruptMirrorPayload,\n isApprovalCardInterrupt,\n type PendingActionRequest,\n pendingActionRequests,\n readAbandonedInputRequests,\n readInterruptMirror,\n readQueuedLaneDecisions,\n useApprovalResumeLock,\n} from '@athenaintel/agent-runtime';\nimport { useCallback, useMemo } from 'react';\nimport { useAthenaRunLive } from './use-athena-run-live';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * Decide per-dispatch subagent lanes while the parent run is still\n * streaming (`DeepAgentThread.run_lane_input`). Keys are the lanes'\n * langgraph interrupt ids; the host matches them against the lanes its\n * mirrored interrupt currently parks, answers at once when the run is\n * already parked, and otherwise holds them until it parks — stale or\n * unknown ids are ignored, never carried to a later interrupt.\n */\n runLaneInput: {\n readonly type: 'run/lane-input';\n readonly laneDecisions: Readonly<Record<string, StatewireThread.InputResponse>>;\n };\n }\n }\n}\n\nconst NO_QUEUED_LANE_DECISIONS: Readonly<Record<string, unknown>> = Object.freeze({});\n\n/** Selects which pending interrupt an approval surface answers. */\nexport type StatewireInterruptPredicate = (\n request: StatewireThread.InputRequestState,\n) => request is StatewireThread.CustomInputRequest;\n\nexport interface UseStatewireApprovalRequestOptions {\n /**\n * Which pending interrupt to answer. Defaults to `isApprovalCardInterrupt`\n * (client-tool parks excluded — the client-tool bridge owns those, and a\n * generic resume would corrupt the parked tool call).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a sent decision keeps the actions locked when no resume run ever\n * starts. Defaults to {@link HITL_PENDING_RESUME_GRACE_MS}.\n */\n pendingResumeGraceMs?: number;\n /**\n * The host refused the `run/input` (or the transport lost it): the\n * optimistic fold rolls back, the request is on screen again with its\n * actions re-enabled, and this is the surface's one chance to say why.\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n}\n\nexport interface StatewireApprovalRequest<TValue> {\n /** The pending interrupt this surface answers, if any. */\n request: StatewireThread.CustomInputRequest | undefined;\n requestId: string | undefined;\n /** The payload narrowed to the Athena HITL approval shape, or `null`. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n /** An interrupt a non-resume dispatch dropped — the \"approval was cancelled\" notice. */\n abandonedInterrupt: AbandonedInputRequest | undefined;\n /**\n * The mirrored interrupt's HITL payload while the run is still live and no\n * input request is answerable: per-dispatch `task` lanes parked on their\n * gates while sibling lanes stream. `null` once the run parks (the same\n * lanes are then `hitl` / `actionRequests`) and when nothing is parked.\n */\n liveHitl: HitlApprovalPayload | null;\n /** Every gated call `liveHitl` covers (empty when it is `null`). */\n liveActionRequests: PendingActionRequest[];\n /**\n * The decisions the host already holds from a `run/lane-input`, keyed by\n * langgraph interrupt id, to be answered when the run parks — a queued lane\n * reads as decided on every attached client, not just the one that sent it.\n */\n queuedLaneDecisions: Readonly<Record<string, unknown>>;\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /**\n * Answer the request with `{ type: 'run/input', requestId, response: { type: 'resume', value } }`.\n * Returns the dispatch promise (settles when the host accepts, rejects when\n * it refuses), or `undefined` when the lock dropped the send.\n */\n resume: (value: TValue) => Promise<unknown> | undefined;\n /**\n * Decide per-dispatch lanes by langgraph interrupt id. With a pending\n * request this is the native `lane_decisions` resume through the lock;\n * without one (the run is still streaming siblings) it is `run/lane-input`,\n * which the host queues and answers on the park. Returns the dispatch\n * promise, or `undefined` when the lock dropped a resume.\n */\n sendLaneDecisions: (\n lanes: Readonly<Record<string, StatewireThread.InputResponse>>,\n ) => Promise<unknown> | undefined;\n}\n\n/**\n * The headless half of every statewire approval surface: selects the pending\n * interrupt from the runs projection, narrows its payload, reads the\n * host-published abandoned interrupts, and wires the shared optimistic resume\n * lock to the thread's `run/input` command. `StatewireApprovalCard` renders\n * over it; hosts with their own decision UI (per-lane subagent cards) build\n * on it directly so the selection and lock semantics cannot drift.\n *\n * Requires a statewire aui scope (throws outside one, like every\n * `useStatewire*` hook) — gate the mount with `hasStatewireThreadExtras`.\n */\nexport function useStatewireApprovalRequest<\n TValue extends StatewireThread.InputResponse = Record<string, string>,\n>(options: UseStatewireApprovalRequestOptions = {}): StatewireApprovalRequest<TValue> {\n const {\n interruptPredicate = isApprovalCardInterrupt,\n pendingResumeGraceMs = HITL_PENDING_RESUME_GRACE_MS,\n onResumeRejected,\n } = options;\n const sendCommand = useStatewireSendCommand();\n // The runs projection is memoized by the lib, so this derivation is\n // reference-stable between state updates.\n const request = useStatewireRuns().inputRequests?.find(interruptPredicate);\n const requestId = request?.id;\n\n // The host publishes the interrupts a non-resume dispatch dropped. Select\n // the raw array reference (pre-stream-safe) and derive inline; a `.find`\n // selector would return a fresh object every update.\n const abandoned = useStatewireState(readAbandonedInputRequests);\n const abandonedInterrupt = findAbandonedInterrupt(abandoned);\n\n const hitl = asHitlApproval(request?.payload);\n const actionRequests = useMemo(() => pendingActionRequests(hitl), [hitl]);\n\n const isRunning = useAthenaRunLive();\n // The host mirrors the interrupt into state as soon as a lane parks — while\n // the run manager still reports `running` (siblings streaming) and has no\n // request to answer. Raw reference selectors; derive inline.\n const mirror = useStatewireState(readInterruptMirror);\n const liveHitl =\n request === undefined && isRunning ? asHitlApproval(interruptMirrorPayload(mirror)) : null;\n const liveActionRequests = useMemo(() => pendingActionRequests(liveHitl), [liveHitl]);\n const queuedLaneDecisions =\n useStatewireState(readQueuedLaneDecisions) ?? NO_QUEUED_LANE_DECISIONS;\n\n const { pending, resume } = useApprovalResumeLock<TValue>({\n requestId,\n isRunning,\n pendingResumeGraceMs,\n onResumeRejected,\n // The dispatch promise is handed to the lock: a refusal releases it and\n // reaches `onResumeRejected`.\n sendResume: (id, value) =>\n sendCommand({\n type: 'run/input',\n requestId: id,\n response: { type: 'resume', value },\n }),\n });\n\n const sendLaneDecisions = useCallback(\n (lanes: Readonly<Record<string, StatewireThread.InputResponse>>) =>\n requestId !== undefined\n ? resume({ lane_decisions: lanes } as unknown as TValue)\n : sendCommand({ type: 'run/lane-input', laneDecisions: lanes }),\n [requestId, resume, sendCommand],\n );\n\n return {\n request,\n requestId,\n hitl,\n actionRequests,\n liveHitl,\n liveActionRequests,\n queuedLaneDecisions,\n abandonedInterrupt,\n pending,\n resume,\n sendLaneDecisions,\n };\n}\n"],"names":["isApprovalCardInterrupt","HITL_PENDING_RESUME_GRACE_MS","useStatewireSendCommand","useStatewireRuns","useStatewireState","readAbandonedInputRequests","findAbandonedInterrupt","asHitlApproval","useMemo","pendingActionRequests","useAthenaRunLive","readInterruptMirror","interruptMirrorPayload","readQueuedLaneDecisions","useApprovalResumeLock","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,2BAA8D,OAAO,OAAO,EAAE;AAmF7E,SAAS,4BAEd,UAA8C,IAAsC;;AACpF,QAAM;AAAA,IACJ,qBAAqBA,WAAAA;AAAAA,IACrB,uBAAuBC,WAAAA;AAAAA,IACvB;AAAA,EAAA,IACE;AACJ,QAAM,cAAcC,eAAAA,wBAAA;AAGpB,QAAM,WAAUC,oBAAAA,iBAAA,EAAmB,kBAAnBA,mBAAkC,KAAK;AACvD,QAAM,YAAY,mCAAS;AAK3B,QAAM,YAAYC,eAAAA,kBAAkBC,qCAA0B;AAC9D,QAAM,qBAAqBC,WAAAA,uBAAuB,SAAS;AAE3D,QAAM,OAAOC,WAAAA,eAAe,mCAAS,OAAO;AAC5C,QAAM,iBAAiBC,MAAAA,QAAQ,MAAMC,WAAAA,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;AAExE,QAAM,YAAYC,iBAAAA,iBAAA;AAIlB,QAAM,SAASN,eAAAA,kBAAkBO,8BAAmB;AACpD,QAAM,WACJ,YAAY,UAAa,YAAYJ,WAAAA,eAAeK,WAAAA,uBAAuB,MAAM,CAAC,IAAI;AACxF,QAAM,qBAAqBJ,MAAAA,QAAQ,MAAMC,WAAAA,sBAAsB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AACpF,QAAM,sBACJL,eAAAA,kBAAkBS,WAAAA,uBAAuB,KAAK;AAEhD,QAAM,EAAE,SAAS,OAAA,IAAWC,iCAA8B;AAAA,IACxD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,YAAY,CAAC,IAAI,UACf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU,EAAE,MAAM,UAAU,MAAA;AAAA,IAAM,CACnC;AAAA,EAAA,CACJ;AAED,QAAM,oBAAoBC,MAAAA;AAAAA,IACxB,CAAC,UACC,cAAc,SACV,OAAO,EAAE,gBAAgB,MAAA,CAA4B,IACrD,YAAY,EAAE,MAAM,kBAAkB,eAAe,OAAO;AAAA,IAClE,CAAC,WAAW,QAAQ,WAAW;AAAA,EAAA;AAGjC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;"}
@@ -4,6 +4,7 @@ import { useMemo, useCallback } from "react";
4
4
  import "@assistant-ui/tap";
5
5
  import "statewire";
6
6
  import "../packages/agent-runtime/src/statewire-suspended.js";
7
+ import "../packages/agent-runtime/src/conversation-list.js";
7
8
  import "@tanstack/react-query";
8
9
  import { isApprovalCardInterrupt, HITL_PENDING_RESUME_GRACE_MS, readAbandonedInputRequests, findAbandonedInterrupt, asHitlApproval, pendingActionRequests, readInterruptMirror, interruptMirrorPayload, readQueuedLaneDecisions, useApprovalResumeLock } from "../packages/agent-runtime/src/interrupts.js";
9
10
  import "../packages/agent-runtime/src/messages.js";
@@ -1 +1 @@
1
- {"version":3,"file":"use-statewire-approval-request.js","sources":["../../src/chat/use-statewire-approval-request.ts"],"sourcesContent":["import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n type AbandonedInputRequest,\n asHitlApproval,\n findAbandonedInterrupt,\n HITL_PENDING_RESUME_GRACE_MS,\n type HitlApprovalPayload,\n interruptMirrorPayload,\n isApprovalCardInterrupt,\n type PendingActionRequest,\n pendingActionRequests,\n readAbandonedInputRequests,\n readInterruptMirror,\n readQueuedLaneDecisions,\n useApprovalResumeLock,\n} from '@athenaintel/agent-runtime';\nimport { useCallback, useMemo } from 'react';\nimport { useAthenaRunLive } from './use-athena-run-live';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * Decide per-dispatch subagent lanes while the parent run is still\n * streaming (`DeepAgentThread.run_lane_input`). Keys are the lanes'\n * langgraph interrupt ids; the host matches them against the lanes its\n * mirrored interrupt currently parks, answers at once when the run is\n * already parked, and otherwise holds them until it parks — stale or\n * unknown ids are ignored, never carried to a later interrupt.\n */\n runLaneInput: {\n readonly type: 'run/lane-input';\n readonly laneDecisions: Readonly<Record<string, StatewireThread.InputResponse>>;\n };\n }\n }\n}\n\nconst NO_QUEUED_LANE_DECISIONS: Readonly<Record<string, unknown>> = Object.freeze({});\n\n/** Selects which pending interrupt an approval surface answers. */\nexport type StatewireInterruptPredicate = (\n request: StatewireThread.InputRequestState,\n) => request is StatewireThread.CustomInputRequest;\n\nexport interface UseStatewireApprovalRequestOptions {\n /**\n * Which pending interrupt to answer. Defaults to `isApprovalCardInterrupt`\n * (client-tool parks excluded — the client-tool bridge owns those, and a\n * generic resume would corrupt the parked tool call).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a sent decision keeps the actions locked when no resume run ever\n * starts. Defaults to {@link HITL_PENDING_RESUME_GRACE_MS}.\n */\n pendingResumeGraceMs?: number;\n /**\n * The host refused the `run/input` (or the transport lost it): the\n * optimistic fold rolls back, the request is on screen again with its\n * actions re-enabled, and this is the surface's one chance to say why.\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n}\n\nexport interface StatewireApprovalRequest<TValue> {\n /** The pending interrupt this surface answers, if any. */\n request: StatewireThread.CustomInputRequest | undefined;\n requestId: string | undefined;\n /** The payload narrowed to the Athena HITL approval shape, or `null`. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n /** An interrupt a non-resume dispatch dropped — the \"approval was cancelled\" notice. */\n abandonedInterrupt: AbandonedInputRequest | undefined;\n /**\n * The mirrored interrupt's HITL payload while the run is still live and no\n * input request is answerable: per-dispatch `task` lanes parked on their\n * gates while sibling lanes stream. `null` once the run parks (the same\n * lanes are then `hitl` / `actionRequests`) and when nothing is parked.\n */\n liveHitl: HitlApprovalPayload | null;\n /** Every gated call `liveHitl` covers (empty when it is `null`). */\n liveActionRequests: PendingActionRequest[];\n /**\n * The decisions the host already holds from a `run/lane-input`, keyed by\n * langgraph interrupt id, to be answered when the run parks — a queued lane\n * reads as decided on every attached client, not just the one that sent it.\n */\n queuedLaneDecisions: Readonly<Record<string, unknown>>;\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /**\n * Answer the request with `{ type: 'run/input', requestId, response: { type: 'resume', value } }`.\n * Returns the dispatch promise (settles when the host accepts, rejects when\n * it refuses), or `undefined` when the lock dropped the send.\n */\n resume: (value: TValue) => Promise<unknown> | undefined;\n /**\n * Decide per-dispatch lanes by langgraph interrupt id. With a pending\n * request this is the native `lane_decisions` resume through the lock;\n * without one (the run is still streaming siblings) it is `run/lane-input`,\n * which the host queues and answers on the park. Returns the dispatch\n * promise, or `undefined` when the lock dropped a resume.\n */\n sendLaneDecisions: (\n lanes: Readonly<Record<string, StatewireThread.InputResponse>>,\n ) => Promise<unknown> | undefined;\n}\n\n/**\n * The headless half of every statewire approval surface: selects the pending\n * interrupt from the runs projection, narrows its payload, reads the\n * host-published abandoned interrupts, and wires the shared optimistic resume\n * lock to the thread's `run/input` command. `StatewireApprovalCard` renders\n * over it; hosts with their own decision UI (per-lane subagent cards) build\n * on it directly so the selection and lock semantics cannot drift.\n *\n * Requires a statewire aui scope (throws outside one, like every\n * `useStatewire*` hook) — gate the mount with `hasStatewireThreadExtras`.\n */\nexport function useStatewireApprovalRequest<\n TValue extends StatewireThread.InputResponse = Record<string, string>,\n>(options: UseStatewireApprovalRequestOptions = {}): StatewireApprovalRequest<TValue> {\n const {\n interruptPredicate = isApprovalCardInterrupt,\n pendingResumeGraceMs = HITL_PENDING_RESUME_GRACE_MS,\n onResumeRejected,\n } = options;\n const sendCommand = useStatewireSendCommand();\n // The runs projection is memoized by the lib, so this derivation is\n // reference-stable between state updates.\n const request = useStatewireRuns().inputRequests?.find(interruptPredicate);\n const requestId = request?.id;\n\n // The host publishes the interrupts a non-resume dispatch dropped. Select\n // the raw array reference (pre-stream-safe) and derive inline; a `.find`\n // selector would return a fresh object every update.\n const abandoned = useStatewireState(readAbandonedInputRequests);\n const abandonedInterrupt = findAbandonedInterrupt(abandoned);\n\n const hitl = asHitlApproval(request?.payload);\n const actionRequests = useMemo(() => pendingActionRequests(hitl), [hitl]);\n\n const isRunning = useAthenaRunLive();\n // The host mirrors the interrupt into state as soon as a lane parks — while\n // the run manager still reports `running` (siblings streaming) and has no\n // request to answer. Raw reference selectors; derive inline.\n const mirror = useStatewireState(readInterruptMirror);\n const liveHitl =\n request === undefined && isRunning ? asHitlApproval(interruptMirrorPayload(mirror)) : null;\n const liveActionRequests = useMemo(() => pendingActionRequests(liveHitl), [liveHitl]);\n const queuedLaneDecisions =\n useStatewireState(readQueuedLaneDecisions) ?? NO_QUEUED_LANE_DECISIONS;\n\n const { pending, resume } = useApprovalResumeLock<TValue>({\n requestId,\n isRunning,\n pendingResumeGraceMs,\n onResumeRejected,\n // The dispatch promise is handed to the lock: a refusal releases it and\n // reaches `onResumeRejected`.\n sendResume: (id, value) =>\n sendCommand({\n type: 'run/input',\n requestId: id,\n response: { type: 'resume', value },\n }),\n });\n\n const sendLaneDecisions = useCallback(\n (lanes: Readonly<Record<string, StatewireThread.InputResponse>>) =>\n requestId !== undefined\n ? resume({ lane_decisions: lanes } as unknown as TValue)\n : sendCommand({ type: 'run/lane-input', laneDecisions: lanes }),\n [requestId, resume, sendCommand],\n );\n\n return {\n request,\n requestId,\n hitl,\n actionRequests,\n liveHitl,\n liveActionRequests,\n queuedLaneDecisions,\n abandonedInterrupt,\n pending,\n resume,\n sendLaneDecisions,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA2CA,MAAM,2BAA8D,OAAO,OAAO,EAAE;AAmF7E,SAAS,4BAEd,UAA8C,IAAsC;;AACpF,QAAM;AAAA,IACJ,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,IACvB;AAAA,EAAA,IACE;AACJ,QAAM,cAAc,wBAAA;AAGpB,QAAM,WAAU,sBAAA,EAAmB,kBAAnB,mBAAkC,KAAK;AACvD,QAAM,YAAY,mCAAS;AAK3B,QAAM,YAAY,kBAAkB,0BAA0B;AAC9D,QAAM,qBAAqB,uBAAuB,SAAS;AAE3D,QAAM,OAAO,eAAe,mCAAS,OAAO;AAC5C,QAAM,iBAAiB,QAAQ,MAAM,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;AAExE,QAAM,YAAY,iBAAA;AAIlB,QAAM,SAAS,kBAAkB,mBAAmB;AACpD,QAAM,WACJ,YAAY,UAAa,YAAY,eAAe,uBAAuB,MAAM,CAAC,IAAI;AACxF,QAAM,qBAAqB,QAAQ,MAAM,sBAAsB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AACpF,QAAM,sBACJ,kBAAkB,uBAAuB,KAAK;AAEhD,QAAM,EAAE,SAAS,OAAA,IAAW,sBAA8B;AAAA,IACxD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,YAAY,CAAC,IAAI,UACf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU,EAAE,MAAM,UAAU,MAAA;AAAA,IAAM,CACnC;AAAA,EAAA,CACJ;AAED,QAAM,oBAAoB;AAAA,IACxB,CAAC,UACC,cAAc,SACV,OAAO,EAAE,gBAAgB,MAAA,CAA4B,IACrD,YAAY,EAAE,MAAM,kBAAkB,eAAe,OAAO;AAAA,IAClE,CAAC,WAAW,QAAQ,WAAW;AAAA,EAAA;AAGjC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"use-statewire-approval-request.js","sources":["../../src/chat/use-statewire-approval-request.ts"],"sourcesContent":["import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n type AbandonedInputRequest,\n asHitlApproval,\n findAbandonedInterrupt,\n HITL_PENDING_RESUME_GRACE_MS,\n type HitlApprovalPayload,\n interruptMirrorPayload,\n isApprovalCardInterrupt,\n type PendingActionRequest,\n pendingActionRequests,\n readAbandonedInputRequests,\n readInterruptMirror,\n readQueuedLaneDecisions,\n useApprovalResumeLock,\n} from '@athenaintel/agent-runtime';\nimport { useCallback, useMemo } from 'react';\nimport { useAthenaRunLive } from './use-athena-run-live';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * Decide per-dispatch subagent lanes while the parent run is still\n * streaming (`DeepAgentThread.run_lane_input`). Keys are the lanes'\n * langgraph interrupt ids; the host matches them against the lanes its\n * mirrored interrupt currently parks, answers at once when the run is\n * already parked, and otherwise holds them until it parks — stale or\n * unknown ids are ignored, never carried to a later interrupt.\n */\n runLaneInput: {\n readonly type: 'run/lane-input';\n readonly laneDecisions: Readonly<Record<string, StatewireThread.InputResponse>>;\n };\n }\n }\n}\n\nconst NO_QUEUED_LANE_DECISIONS: Readonly<Record<string, unknown>> = Object.freeze({});\n\n/** Selects which pending interrupt an approval surface answers. */\nexport type StatewireInterruptPredicate = (\n request: StatewireThread.InputRequestState,\n) => request is StatewireThread.CustomInputRequest;\n\nexport interface UseStatewireApprovalRequestOptions {\n /**\n * Which pending interrupt to answer. Defaults to `isApprovalCardInterrupt`\n * (client-tool parks excluded — the client-tool bridge owns those, and a\n * generic resume would corrupt the parked tool call).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a sent decision keeps the actions locked when no resume run ever\n * starts. Defaults to {@link HITL_PENDING_RESUME_GRACE_MS}.\n */\n pendingResumeGraceMs?: number;\n /**\n * The host refused the `run/input` (or the transport lost it): the\n * optimistic fold rolls back, the request is on screen again with its\n * actions re-enabled, and this is the surface's one chance to say why.\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n}\n\nexport interface StatewireApprovalRequest<TValue> {\n /** The pending interrupt this surface answers, if any. */\n request: StatewireThread.CustomInputRequest | undefined;\n requestId: string | undefined;\n /** The payload narrowed to the Athena HITL approval shape, or `null`. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n /** An interrupt a non-resume dispatch dropped — the \"approval was cancelled\" notice. */\n abandonedInterrupt: AbandonedInputRequest | undefined;\n /**\n * The mirrored interrupt's HITL payload while the run is still live and no\n * input request is answerable: per-dispatch `task` lanes parked on their\n * gates while sibling lanes stream. `null` once the run parks (the same\n * lanes are then `hitl` / `actionRequests`) and when nothing is parked.\n */\n liveHitl: HitlApprovalPayload | null;\n /** Every gated call `liveHitl` covers (empty when it is `null`). */\n liveActionRequests: PendingActionRequest[];\n /**\n * The decisions the host already holds from a `run/lane-input`, keyed by\n * langgraph interrupt id, to be answered when the run parks — a queued lane\n * reads as decided on every attached client, not just the one that sent it.\n */\n queuedLaneDecisions: Readonly<Record<string, unknown>>;\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /**\n * Answer the request with `{ type: 'run/input', requestId, response: { type: 'resume', value } }`.\n * Returns the dispatch promise (settles when the host accepts, rejects when\n * it refuses), or `undefined` when the lock dropped the send.\n */\n resume: (value: TValue) => Promise<unknown> | undefined;\n /**\n * Decide per-dispatch lanes by langgraph interrupt id. With a pending\n * request this is the native `lane_decisions` resume through the lock;\n * without one (the run is still streaming siblings) it is `run/lane-input`,\n * which the host queues and answers on the park. Returns the dispatch\n * promise, or `undefined` when the lock dropped a resume.\n */\n sendLaneDecisions: (\n lanes: Readonly<Record<string, StatewireThread.InputResponse>>,\n ) => Promise<unknown> | undefined;\n}\n\n/**\n * The headless half of every statewire approval surface: selects the pending\n * interrupt from the runs projection, narrows its payload, reads the\n * host-published abandoned interrupts, and wires the shared optimistic resume\n * lock to the thread's `run/input` command. `StatewireApprovalCard` renders\n * over it; hosts with their own decision UI (per-lane subagent cards) build\n * on it directly so the selection and lock semantics cannot drift.\n *\n * Requires a statewire aui scope (throws outside one, like every\n * `useStatewire*` hook) — gate the mount with `hasStatewireThreadExtras`.\n */\nexport function useStatewireApprovalRequest<\n TValue extends StatewireThread.InputResponse = Record<string, string>,\n>(options: UseStatewireApprovalRequestOptions = {}): StatewireApprovalRequest<TValue> {\n const {\n interruptPredicate = isApprovalCardInterrupt,\n pendingResumeGraceMs = HITL_PENDING_RESUME_GRACE_MS,\n onResumeRejected,\n } = options;\n const sendCommand = useStatewireSendCommand();\n // The runs projection is memoized by the lib, so this derivation is\n // reference-stable between state updates.\n const request = useStatewireRuns().inputRequests?.find(interruptPredicate);\n const requestId = request?.id;\n\n // The host publishes the interrupts a non-resume dispatch dropped. Select\n // the raw array reference (pre-stream-safe) and derive inline; a `.find`\n // selector would return a fresh object every update.\n const abandoned = useStatewireState(readAbandonedInputRequests);\n const abandonedInterrupt = findAbandonedInterrupt(abandoned);\n\n const hitl = asHitlApproval(request?.payload);\n const actionRequests = useMemo(() => pendingActionRequests(hitl), [hitl]);\n\n const isRunning = useAthenaRunLive();\n // The host mirrors the interrupt into state as soon as a lane parks — while\n // the run manager still reports `running` (siblings streaming) and has no\n // request to answer. Raw reference selectors; derive inline.\n const mirror = useStatewireState(readInterruptMirror);\n const liveHitl =\n request === undefined && isRunning ? asHitlApproval(interruptMirrorPayload(mirror)) : null;\n const liveActionRequests = useMemo(() => pendingActionRequests(liveHitl), [liveHitl]);\n const queuedLaneDecisions =\n useStatewireState(readQueuedLaneDecisions) ?? NO_QUEUED_LANE_DECISIONS;\n\n const { pending, resume } = useApprovalResumeLock<TValue>({\n requestId,\n isRunning,\n pendingResumeGraceMs,\n onResumeRejected,\n // The dispatch promise is handed to the lock: a refusal releases it and\n // reaches `onResumeRejected`.\n sendResume: (id, value) =>\n sendCommand({\n type: 'run/input',\n requestId: id,\n response: { type: 'resume', value },\n }),\n });\n\n const sendLaneDecisions = useCallback(\n (lanes: Readonly<Record<string, StatewireThread.InputResponse>>) =>\n requestId !== undefined\n ? resume({ lane_decisions: lanes } as unknown as TValue)\n : sendCommand({ type: 'run/lane-input', laneDecisions: lanes }),\n [requestId, resume, sendCommand],\n );\n\n return {\n request,\n requestId,\n hitl,\n actionRequests,\n liveHitl,\n liveActionRequests,\n queuedLaneDecisions,\n abandonedInterrupt,\n pending,\n resume,\n sendLaneDecisions,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAM,2BAA8D,OAAO,OAAO,EAAE;AAmF7E,SAAS,4BAEd,UAA8C,IAAsC;;AACpF,QAAM;AAAA,IACJ,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,IACvB;AAAA,EAAA,IACE;AACJ,QAAM,cAAc,wBAAA;AAGpB,QAAM,WAAU,sBAAA,EAAmB,kBAAnB,mBAAkC,KAAK;AACvD,QAAM,YAAY,mCAAS;AAK3B,QAAM,YAAY,kBAAkB,0BAA0B;AAC9D,QAAM,qBAAqB,uBAAuB,SAAS;AAE3D,QAAM,OAAO,eAAe,mCAAS,OAAO;AAC5C,QAAM,iBAAiB,QAAQ,MAAM,sBAAsB,IAAI,GAAG,CAAC,IAAI,CAAC;AAExE,QAAM,YAAY,iBAAA;AAIlB,QAAM,SAAS,kBAAkB,mBAAmB;AACpD,QAAM,WACJ,YAAY,UAAa,YAAY,eAAe,uBAAuB,MAAM,CAAC,IAAI;AACxF,QAAM,qBAAqB,QAAQ,MAAM,sBAAsB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AACpF,QAAM,sBACJ,kBAAkB,uBAAuB,KAAK;AAEhD,QAAM,EAAE,SAAS,OAAA,IAAW,sBAA8B;AAAA,IACxD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,YAAY,CAAC,IAAI,UACf,YAAY;AAAA,MACV,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU,EAAE,MAAM,UAAU,MAAA;AAAA,IAAM,CACnC;AAAA,EAAA,CACJ;AAED,QAAM,oBAAoB;AAAA,IACxB,CAAC,UACC,cAAc,SACV,OAAO,EAAE,gBAAgB,MAAA,CAA4B,IACrD,YAAY,EAAE,MAAM,kBAAkB,eAAe,OAAO;AAAA,IAClE,CAAC,WAAW,QAAQ,WAAW;AAAA,EAAA;AAGjC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
@@ -19,14 +19,15 @@ require("../../packages/agent-runtime/src/generated/runconfig-contract.cjs");
19
19
  require("@assistant-ui/tap");
20
20
  require("statewire");
21
21
  require("../../packages/agent-runtime/src/statewire-suspended.cjs");
22
+ require("../../packages/agent-runtime/src/conversation-list.cjs");
22
23
  require("@tanstack/react-query");
23
24
  require("../../packages/agent-runtime/src/statewire-state.cjs");
24
25
  require("../../packages/agent-runtime/src/messages.cjs");
25
- require("@assistant-ui/react-statewire");
26
26
  require("@assistant-ui/store");
27
27
  require("../../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
28
28
  require("../../packages/agent-runtime/src/statewire-attach-observer.cjs");
29
29
  require("../../packages/agent-runtime/src/thread-status.cjs");
30
+ require("@assistant-ui/react-statewire");
30
31
  require("@assistant-ui/core");
31
32
  require("../../packages/agent-runtime/src/thread-handoff.cjs");
32
33
  const pendingAttachmentUploads = require("./pending-attachment-uploads.cjs");
@@ -74,6 +75,16 @@ const MENTION_STYLES = `
74
75
  pointer-events: none;
75
76
  height: 0;
76
77
  }
78
+ /* The paper appearance (the SDK thread): a taller resting height, room for
79
+ about eight lines before the draft scrolls, and a placeholder at 35% of
80
+ the text colour. Same specificity as the rules above, so order decides. */
81
+ .athena-chat-composer--paper .ProseMirror {
82
+ min-height: 44px;
83
+ max-height: 12rem;
84
+ }
85
+ .athena-chat-composer--paper .ProseMirror p.is-editor-empty:first-child::before {
86
+ color: color-mix(in srgb, currentColor 35%, transparent);
87
+ }
77
88
  `;
78
89
  function serializeDraft(editor) {
79
90
  return editor.storage.markdown.getMarkdown();
@@ -141,6 +152,7 @@ const TiptapComposer = react.forwardRef(
141
152
  placeholder = "Message Athena... (type @ to mention)",
142
153
  threadId,
143
154
  disabled = false,
155
+ appearance = "default",
144
156
  webpages = NO_WEBPAGES,
145
157
  tools,
146
158
  rootCategories,
@@ -149,7 +161,8 @@ const TiptapComposer = react.forwardRef(
149
161
  onAttachmentError,
150
162
  fileIntake,
151
163
  waitForHostUploads,
152
- interceptSubmit
164
+ interceptSubmit,
165
+ onSubmitted
153
166
  }, outerRef) => {
154
167
  const aui = react$1.useAui();
155
168
  const composerInput = react$1.unstable_useComposerInput();
@@ -232,6 +245,7 @@ const TiptapComposer = react.forwardRef(
232
245
  ed.commands.clearContent();
233
246
  clearImagePreviews();
234
247
  onDraftStateChange == null ? void 0 : onDraftStateChange(false);
248
+ onSubmitted == null ? void 0 : onSubmitted();
235
249
  return;
236
250
  }
237
251
  }
@@ -242,6 +256,7 @@ const TiptapComposer = react.forwardRef(
242
256
  ed.commands.clearContent();
243
257
  clearImagePreviews();
244
258
  onDraftStateChange == null ? void 0 : onDraftStateChange(false);
259
+ onSubmitted == null ? void 0 : onSubmitted();
245
260
  } finally {
246
261
  submitInFlightRef.current = false;
247
262
  }
@@ -251,6 +266,7 @@ const TiptapComposer = react.forwardRef(
251
266
  disabled,
252
267
  interceptSubmit,
253
268
  onDraftStateChange,
269
+ onSubmitted,
254
270
  waitForHostUploads
255
271
  ]);
256
272
  const handleSubmitRef = react.useRef(handleSubmit);
@@ -491,10 +507,28 @@ const TiptapComposer = react.forwardRef(
491
507
  () => assetAttachment.registerChatAssetMentionHandler(threadId, insertAssetMention),
492
508
  [insertAssetMention, threadId]
493
509
  );
510
+ const openMentionMenu = react.useCallback(() => {
511
+ if (disabled) return;
512
+ const currentEditor = editorRef.current;
513
+ if (!currentEditor || currentEditor.isDestroyed) return;
514
+ if (popupOpenRef.current) {
515
+ currentEditor.commands.focus();
516
+ return;
517
+ }
518
+ const { from } = currentEditor.state.selection;
519
+ const before = from > 0 ? currentEditor.state.doc.textBetween(from - 1, from, "\0", "\0") : "";
520
+ const needsSpace = before.length > 0 && !/[\s([{"']/.test(before);
521
+ currentEditor.chain().focus().insertContent({ type: "text", text: needsSpace ? " @" : "@" }).run();
522
+ }, [disabled]);
494
523
  react.useImperativeHandle(
495
524
  outerRef,
496
- () => ({ submit: handleSubmit, addAttachment, insertAssetMention }),
497
- [addAttachment, handleSubmit, insertAssetMention]
525
+ () => ({
526
+ submit: handleSubmit,
527
+ addAttachment,
528
+ insertAssetMention,
529
+ openMentionMenu
530
+ }),
531
+ [addAttachment, handleSubmit, insertAssetMention, openMentionMenu]
498
532
  );
499
533
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
500
534
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: MENTION_STYLES }),
@@ -503,6 +537,7 @@ const TiptapComposer = react.forwardRef(
503
537
  {
504
538
  className: cnfast.cn(
505
539
  "athena-chat-composer flex-1 min-w-0",
540
+ appearance === "paper" && "athena-chat-composer--paper",
506
541
  showImagePreviews && "image-preview-composer"
507
542
  ),
508
543
  "aria-label": "Message composer",