@athenaintel/react 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (857) hide show
  1. package/README.md +97 -11
  2. package/dist/assets/AssetPanel.cjs +277 -0
  3. package/dist/assets/AssetPanel.cjs.map +1 -0
  4. package/dist/assets/AssetPanel.js +277 -0
  5. package/dist/assets/AssetPanel.js.map +1 -0
  6. package/dist/assets/AthenaAssetEmbed.cjs +151 -0
  7. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -0
  8. package/dist/assets/AthenaAssetEmbed.js +151 -0
  9. package/dist/assets/AthenaAssetEmbed.js.map +1 -0
  10. package/dist/assets/AthenaLayout.cjs +69 -0
  11. package/dist/assets/AthenaLayout.cjs.map +1 -0
  12. package/dist/assets/AthenaLayout.js +69 -0
  13. package/dist/assets/AthenaLayout.js.map +1 -0
  14. package/dist/assets/asset-embed-messages.cjs +39 -0
  15. package/dist/assets/asset-embed-messages.cjs.map +1 -0
  16. package/dist/assets/asset-embed-messages.js +39 -0
  17. package/dist/assets/asset-embed-messages.js.map +1 -0
  18. package/dist/assets/asset-panel-store.cjs +124 -0
  19. package/dist/assets/asset-panel-store.cjs.map +1 -0
  20. package/dist/assets/asset-panel-store.js +124 -0
  21. package/dist/assets/asset-panel-store.js.map +1 -0
  22. package/dist/assets/asset-panel-url.cjs +40 -0
  23. package/dist/assets/asset-panel-url.cjs.map +1 -0
  24. package/dist/assets/asset-panel-url.js +40 -0
  25. package/dist/assets/asset-panel-url.js.map +1 -0
  26. package/dist/assets/use-asset-embed.cjs +362 -0
  27. package/dist/assets/use-asset-embed.cjs.map +1 -0
  28. package/dist/assets/use-asset-embed.js +362 -0
  29. package/dist/assets/use-asset-embed.js.map +1 -0
  30. package/dist/{AthenaAuthContext-B3AwLA5Z.cjs → auth/AthenaAuthContext.cjs} +5 -4
  31. package/dist/auth/AthenaAuthContext.cjs.map +1 -0
  32. package/dist/{AthenaAuthContext-DQsdayH2.js → auth/AthenaAuthContext.js} +3 -3
  33. package/dist/auth/AthenaAuthContext.js.map +1 -0
  34. package/dist/auth/AthenaAuthProvider.cjs +141 -0
  35. package/dist/auth/AthenaAuthProvider.cjs.map +1 -0
  36. package/dist/auth/AthenaAuthProvider.js +141 -0
  37. package/dist/auth/AthenaAuthProvider.js.map +1 -0
  38. package/dist/{auth.cjs → auth/AthenaSSOProvider.cjs} +14 -151
  39. package/dist/auth/AthenaSSOProvider.cjs.map +1 -0
  40. package/dist/{auth.js → auth/AthenaSSOProvider.js} +4 -142
  41. package/dist/auth/AthenaSSOProvider.js.map +1 -0
  42. package/dist/auth/index.cjs +10 -0
  43. package/dist/auth/index.cjs.map +1 -0
  44. package/dist/auth/index.js +10 -0
  45. package/dist/auth/index.js.map +1 -0
  46. package/dist/chat/AthenaChat.cjs +753 -0
  47. package/dist/chat/AthenaChat.cjs.map +1 -0
  48. package/dist/chat/AthenaChat.d.ts +3 -2
  49. package/dist/chat/AthenaChat.js +753 -0
  50. package/dist/chat/AthenaChat.js.map +1 -0
  51. package/dist/chat/AthenaChatErrorBoundary.cjs +53 -0
  52. package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -0
  53. package/dist/chat/AthenaChatErrorBoundary.js +53 -0
  54. package/dist/chat/AthenaChatErrorBoundary.js.map +1 -0
  55. package/dist/chat/StatewireApprovalCard.cjs +171 -0
  56. package/dist/chat/StatewireApprovalCard.cjs.map +1 -0
  57. package/dist/chat/StatewireApprovalCard.js +171 -0
  58. package/dist/chat/StatewireApprovalCard.js.map +1 -0
  59. package/dist/chat/StatewireClientToolBridge.cjs +50 -0
  60. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -0
  61. package/dist/chat/StatewireClientToolBridge.js +50 -0
  62. package/dist/chat/StatewireClientToolBridge.js.map +1 -0
  63. package/dist/chat/StatewireQueuedMessages.cjs +432 -0
  64. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -0
  65. package/dist/chat/StatewireQueuedMessages.d.ts +3 -4
  66. package/dist/chat/StatewireQueuedMessages.js +432 -0
  67. package/dist/chat/StatewireQueuedMessages.js.map +1 -0
  68. package/dist/chat/athena-citation-links.cjs +326 -0
  69. package/dist/chat/athena-citation-links.cjs.map +1 -0
  70. package/dist/chat/athena-citation-links.js +326 -0
  71. package/dist/chat/athena-citation-links.js.map +1 -0
  72. package/dist/chat/run-activity.cjs +28 -0
  73. package/dist/chat/run-activity.cjs.map +1 -0
  74. package/dist/chat/run-activity.js +28 -0
  75. package/dist/chat/run-activity.js.map +1 -0
  76. package/dist/chat/statewire-banners.cjs +83 -0
  77. package/dist/chat/statewire-banners.cjs.map +1 -0
  78. package/dist/chat/statewire-banners.js +83 -0
  79. package/dist/chat/statewire-banners.js.map +1 -0
  80. package/dist/chat/statewire-client-tools.cjs +73 -0
  81. package/dist/chat/statewire-client-tools.cjs.map +1 -0
  82. package/dist/chat/statewire-client-tools.js +73 -0
  83. package/dist/chat/statewire-client-tools.js.map +1 -0
  84. package/dist/chat/super-grouping/CollapsibleGroup.cjs +158 -0
  85. package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -0
  86. package/dist/chat/super-grouping/CollapsibleGroup.js +158 -0
  87. package/dist/chat/super-grouping/CollapsibleGroup.js.map +1 -0
  88. package/dist/chat/super-grouping/SuperGroupingCard.cjs +361 -0
  89. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -0
  90. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +4 -1
  91. package/dist/chat/super-grouping/SuperGroupingCard.js +361 -0
  92. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -0
  93. package/dist/chat/super-grouping/activity-timeline.cjs +151 -0
  94. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -0
  95. package/dist/chat/super-grouping/activity-timeline.d.ts +3 -3
  96. package/dist/chat/super-grouping/activity-timeline.js +151 -0
  97. package/dist/chat/super-grouping/activity-timeline.js.map +1 -0
  98. package/dist/chat/super-grouping/grouping-function.cjs +55 -0
  99. package/dist/chat/super-grouping/grouping-function.cjs.map +1 -0
  100. package/dist/chat/super-grouping/grouping-function.js +55 -0
  101. package/dist/chat/super-grouping/grouping-function.js.map +1 -0
  102. package/dist/chat/super-grouping/index.cjs +26 -0
  103. package/dist/chat/super-grouping/index.cjs.map +1 -0
  104. package/dist/chat/super-grouping/index.js +26 -0
  105. package/dist/chat/super-grouping/index.js.map +1 -0
  106. package/dist/chat/super-grouping/toolkit-map.cjs +96 -0
  107. package/dist/chat/super-grouping/toolkit-map.cjs.map +1 -0
  108. package/dist/chat/super-grouping/toolkit-map.js +96 -0
  109. package/dist/chat/super-grouping/toolkit-map.js.map +1 -0
  110. package/dist/chat/tiptap-text.cjs +101 -0
  111. package/dist/chat/tiptap-text.cjs.map +1 -0
  112. package/dist/chat/tiptap-text.js +101 -0
  113. package/dist/chat/tiptap-text.js.map +1 -0
  114. package/dist/chat/tooltip-icon-button.cjs +32 -0
  115. package/dist/chat/tooltip-icon-button.cjs.map +1 -0
  116. package/dist/chat/tooltip-icon-button.js +32 -0
  117. package/dist/chat/tooltip-icon-button.js.map +1 -0
  118. package/dist/chat/use-athena-run-live.cjs +23 -0
  119. package/dist/chat/use-athena-run-live.cjs.map +1 -0
  120. package/dist/chat/use-athena-run-live.d.ts +10 -0
  121. package/dist/chat/use-athena-run-live.js +23 -0
  122. package/dist/chat/use-athena-run-live.js.map +1 -0
  123. package/dist/chat/use-statewire-approval-request.cjs +46 -0
  124. package/dist/chat/use-statewire-approval-request.cjs.map +1 -0
  125. package/dist/chat/use-statewire-approval-request.js +46 -0
  126. package/dist/chat/use-statewire-approval-request.js.map +1 -0
  127. package/dist/chat-ui/auth/sign-in-card.cjs +128 -0
  128. package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -0
  129. package/dist/chat-ui/auth/sign-in-card.js +128 -0
  130. package/dist/chat-ui/auth/sign-in-card.js.map +1 -0
  131. package/dist/chat-ui/composer/composer-action.cjs +11 -0
  132. package/dist/chat-ui/composer/composer-action.cjs.map +1 -0
  133. package/dist/chat-ui/composer/composer-action.d.ts +5 -8
  134. package/dist/chat-ui/composer/composer-action.js +11 -0
  135. package/dist/chat-ui/composer/composer-action.js.map +1 -0
  136. package/dist/chat-ui/composer/pending-attachment-uploads.cjs +25 -0
  137. package/dist/chat-ui/composer/pending-attachment-uploads.cjs.map +1 -0
  138. package/dist/chat-ui/composer/pending-attachment-uploads.js +25 -0
  139. package/dist/chat-ui/composer/pending-attachment-uploads.js.map +1 -0
  140. package/dist/chat-ui/composer/tiptap-composer.cjs +590 -0
  141. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -0
  142. package/dist/chat-ui/composer/tiptap-composer.d.ts +44 -7
  143. package/dist/chat-ui/composer/tiptap-composer.js +590 -0
  144. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -0
  145. package/dist/chat-ui/header/chat-header.cjs +33 -0
  146. package/dist/chat-ui/header/chat-header.cjs.map +1 -0
  147. package/dist/chat-ui/header/chat-header.js +33 -0
  148. package/dist/chat-ui/header/chat-header.js.map +1 -0
  149. package/dist/chat-ui/header/conversation-history-panel.cjs +369 -0
  150. package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -0
  151. package/dist/chat-ui/header/conversation-history-panel.js +369 -0
  152. package/dist/chat-ui/header/conversation-history-panel.js.map +1 -0
  153. package/dist/chat-ui/index.cjs +139 -0
  154. package/dist/chat-ui/index.cjs.map +1 -0
  155. package/dist/chat-ui/index.d.ts +4 -3
  156. package/dist/chat-ui/index.js +139 -0
  157. package/dist/chat-ui/index.js.map +1 -0
  158. package/dist/chat-ui/lib/asset-urls.cjs +18 -0
  159. package/dist/chat-ui/lib/asset-urls.cjs.map +1 -0
  160. package/dist/chat-ui/lib/asset-urls.js +18 -0
  161. package/dist/chat-ui/lib/asset-urls.js.map +1 -0
  162. package/dist/chat-ui/mentions/mention-chip.cjs +208 -0
  163. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -0
  164. package/dist/chat-ui/mentions/mention-chip.js +208 -0
  165. package/dist/chat-ui/mentions/mention-chip.js.map +1 -0
  166. package/dist/chat-ui/mentions/mention-extension.cjs +184 -0
  167. package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -0
  168. package/dist/chat-ui/mentions/mention-extension.d.ts +24 -2
  169. package/dist/chat-ui/mentions/mention-extension.js +184 -0
  170. package/dist/chat-ui/mentions/mention-extension.js.map +1 -0
  171. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +35 -0
  172. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -0
  173. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +35 -0
  174. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -0
  175. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +95 -0
  176. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -0
  177. package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +5 -0
  178. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +95 -0
  179. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -0
  180. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +116 -0
  181. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -0
  182. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +116 -0
  183. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -0
  184. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +31 -0
  185. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -0
  186. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.js +31 -0
  187. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.js.map +1 -0
  188. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.cjs +27 -0
  189. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.cjs.map +1 -0
  190. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.js +27 -0
  191. package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.js.map +1 -0
  192. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +62 -0
  193. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -0
  194. package/dist/chat-ui/mentions/suggestions/components/menu-item.js +62 -0
  195. package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -0
  196. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +63 -0
  197. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -0
  198. package/dist/chat-ui/mentions/suggestions/components/menu-list.js +63 -0
  199. package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -0
  200. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.cjs +11 -0
  201. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.cjs.map +1 -0
  202. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.js +11 -0
  203. package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.js.map +1 -0
  204. package/dist/chat-ui/mentions/suggestions/components/menu-summary.cjs +33 -0
  205. package/dist/chat-ui/mentions/suggestions/components/menu-summary.cjs.map +1 -0
  206. package/dist/chat-ui/mentions/suggestions/components/menu-summary.js +33 -0
  207. package/dist/chat-ui/mentions/suggestions/components/menu-summary.js.map +1 -0
  208. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +58 -0
  209. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -0
  210. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.js +58 -0
  211. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.js.map +1 -0
  212. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +81 -0
  213. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -0
  214. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.js +81 -0
  215. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.js.map +1 -0
  216. package/dist/chat-ui/mentions/suggestions/components/utils.cjs +18 -0
  217. package/dist/chat-ui/mentions/suggestions/components/utils.cjs.map +1 -0
  218. package/dist/chat-ui/mentions/suggestions/components/utils.js +18 -0
  219. package/dist/chat-ui/mentions/suggestions/components/utils.js.map +1 -0
  220. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +123 -0
  221. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -0
  222. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +10 -0
  223. package/dist/chat-ui/mentions/suggestions/data/api-client.js +123 -0
  224. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -0
  225. package/dist/chat-ui/mentions/suggestions/data/item-cache.cjs +37 -0
  226. package/dist/chat-ui/mentions/suggestions/data/item-cache.cjs.map +1 -0
  227. package/dist/chat-ui/mentions/suggestions/data/item-cache.js +37 -0
  228. package/dist/chat-ui/mentions/suggestions/data/item-cache.js.map +1 -0
  229. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +134 -0
  230. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -0
  231. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +134 -0
  232. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -0
  233. package/dist/chat-ui/mentions/suggestions/data/scope-registry.cjs +91 -0
  234. package/dist/chat-ui/mentions/suggestions/data/scope-registry.cjs.map +1 -0
  235. package/dist/chat-ui/mentions/suggestions/data/scope-registry.js +91 -0
  236. package/dist/chat-ui/mentions/suggestions/data/scope-registry.js.map +1 -0
  237. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +137 -0
  238. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -0
  239. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +137 -0
  240. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -0
  241. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +375 -0
  242. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -0
  243. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +16 -1
  244. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +375 -0
  245. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -0
  246. package/dist/chat-ui/mentions/suggestions/data/types.cjs +9 -0
  247. package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -0
  248. package/dist/chat-ui/mentions/suggestions/data/types.d.ts +14 -0
  249. package/dist/chat-ui/mentions/suggestions/data/types.js +9 -0
  250. package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -0
  251. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +173 -0
  252. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -0
  253. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +14 -4
  254. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +173 -0
  255. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -0
  256. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +45 -0
  257. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -0
  258. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +45 -0
  259. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -0
  260. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.cjs +43 -0
  261. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.cjs.map +1 -0
  262. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.js +43 -0
  263. package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.js.map +1 -0
  264. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.cjs +14 -0
  265. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.cjs.map +1 -0
  266. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.js +14 -0
  267. package/dist/chat-ui/mentions/suggestions/data/utils/match-query.js.map +1 -0
  268. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.cjs +48 -0
  269. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.cjs.map +1 -0
  270. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.js +48 -0
  271. package/dist/chat-ui/mentions/suggestions/data/utils/score-match.js.map +1 -0
  272. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +71 -0
  273. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -0
  274. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +71 -0
  275. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -0
  276. package/dist/chat-ui/messages/continue-pill.cjs +54 -0
  277. package/dist/chat-ui/messages/continue-pill.cjs.map +1 -0
  278. package/dist/chat-ui/messages/continue-pill.js +54 -0
  279. package/dist/chat-ui/messages/continue-pill.js.map +1 -0
  280. package/dist/chat-ui/messages/message-actions-config.cjs +12 -0
  281. package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -0
  282. package/dist/chat-ui/messages/message-actions-config.js +12 -0
  283. package/dist/chat-ui/messages/message-actions-config.js.map +1 -0
  284. package/dist/chat-ui/messages/message-components.cjs +343 -0
  285. package/dist/chat-ui/messages/message-components.cjs.map +1 -0
  286. package/dist/chat-ui/messages/message-components.d.ts +13 -1
  287. package/dist/chat-ui/messages/message-components.js +343 -0
  288. package/dist/chat-ui/messages/message-components.js.map +1 -0
  289. package/dist/chat-ui/messages/running-indicator.cjs +49 -0
  290. package/dist/chat-ui/messages/running-indicator.cjs.map +1 -0
  291. package/dist/chat-ui/messages/running-indicator.js +49 -0
  292. package/dist/chat-ui/messages/running-indicator.js.map +1 -0
  293. package/dist/chat-ui/messages/runtime-message.cjs +65 -0
  294. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -0
  295. package/dist/chat-ui/messages/runtime-message.js +65 -0
  296. package/dist/chat-ui/messages/runtime-message.js.map +1 -0
  297. package/dist/{statewire-continue-run-nE9VCKUh.cjs → chat-ui/messages/statewire-continue-run.cjs} +39 -16
  298. package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -0
  299. package/dist/chat-ui/messages/statewire-continue-run.d.ts +5 -1
  300. package/dist/{statewire-continue-run-D34gS7_1.js → chat-ui/messages/statewire-continue-run.js} +29 -7
  301. package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -0
  302. package/dist/chat-ui/messages/user-edit-composer.cjs +61 -0
  303. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -0
  304. package/dist/chat-ui/messages/user-edit-composer.js +61 -0
  305. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -0
  306. package/dist/chat-ui/messages/voice-delegation-card.cjs +51 -0
  307. package/dist/chat-ui/messages/voice-delegation-card.cjs.map +1 -0
  308. package/dist/chat-ui/messages/voice-delegation-card.d.ts +26 -0
  309. package/dist/chat-ui/messages/voice-delegation-card.js +51 -0
  310. package/dist/chat-ui/messages/voice-delegation-card.js.map +1 -0
  311. package/dist/chat-ui/statewire.cjs +39 -0
  312. package/dist/chat-ui/statewire.cjs.map +1 -0
  313. package/dist/chat-ui/statewire.js +39 -0
  314. package/dist/chat-ui/statewire.js.map +1 -0
  315. package/dist/chat-ui/thread/chat-composer-dock.cjs +37 -0
  316. package/dist/chat-ui/thread/chat-composer-dock.cjs.map +1 -0
  317. package/dist/chat-ui/thread/chat-composer-dock.js +37 -0
  318. package/dist/chat-ui/thread/chat-composer-dock.js.map +1 -0
  319. package/dist/chat-ui/thread/chat-thread-shell.cjs +102 -0
  320. package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -0
  321. package/dist/chat-ui/thread/chat-thread-shell.js +102 -0
  322. package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -0
  323. package/dist/chat-ui/thread/composer-send-or-stop.cjs +75 -0
  324. package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -0
  325. package/dist/chat-ui/thread/composer-send-or-stop.d.ts +0 -6
  326. package/dist/chat-ui/thread/composer-send-or-stop.js +75 -0
  327. package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -0
  328. package/dist/chat-ui/thread/statewire-history-edge.cjs +134 -0
  329. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -0
  330. package/dist/chat-ui/thread/statewire-history-edge.js +134 -0
  331. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -0
  332. package/dist/{collab.cjs → collab/client.cjs} +6 -166
  333. package/dist/collab/client.cjs.map +1 -0
  334. package/dist/{collab.js → collab/client.js} +5 -164
  335. package/dist/collab/client.js.map +1 -0
  336. package/dist/collab/close-policy.cjs +14 -0
  337. package/dist/collab/close-policy.cjs.map +1 -0
  338. package/dist/collab/close-policy.js +14 -0
  339. package/dist/collab/close-policy.js.map +1 -0
  340. package/dist/collab/index.cjs +17 -0
  341. package/dist/collab/index.cjs.map +1 -0
  342. package/dist/collab/index.js +17 -0
  343. package/dist/collab/index.js.map +1 -0
  344. package/dist/collab/mint.cjs +59 -0
  345. package/dist/collab/mint.cjs.map +1 -0
  346. package/dist/collab/mint.js +59 -0
  347. package/dist/collab/mint.js.map +1 -0
  348. package/dist/collab/react.cjs +58 -0
  349. package/dist/collab/react.cjs.map +1 -0
  350. package/dist/collab/react.js +58 -0
  351. package/dist/collab/react.js.map +1 -0
  352. package/dist/collab/shape.cjs +45 -0
  353. package/dist/collab/shape.cjs.map +1 -0
  354. package/dist/collab/shape.js +45 -0
  355. package/dist/collab/shape.js.map +1 -0
  356. package/dist/composer/AttachmentContext.cjs +40 -0
  357. package/dist/composer/AttachmentContext.cjs.map +1 -0
  358. package/dist/composer/AttachmentContext.js +40 -0
  359. package/dist/composer/AttachmentContext.js.map +1 -0
  360. package/dist/composer/ComposerAttachmentPreview.cjs +39 -0
  361. package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -0
  362. package/dist/composer/ComposerAttachmentPreview.js +39 -0
  363. package/dist/composer/ComposerAttachmentPreview.js.map +1 -0
  364. package/dist/composer/ComposerDropZone.cjs +61 -0
  365. package/dist/composer/ComposerDropZone.cjs.map +1 -0
  366. package/dist/composer/ComposerDropZone.d.ts +1 -1
  367. package/dist/composer/ComposerDropZone.js +61 -0
  368. package/dist/composer/ComposerDropZone.js.map +1 -0
  369. package/dist/composer/ComposerQuotePreview.cjs +42 -0
  370. package/dist/composer/ComposerQuotePreview.cjs.map +1 -0
  371. package/dist/composer/ComposerQuotePreview.js +42 -0
  372. package/dist/composer/ComposerQuotePreview.js.map +1 -0
  373. package/dist/composer/FileUploadButton.cjs +65 -0
  374. package/dist/composer/FileUploadButton.cjs.map +1 -0
  375. package/dist/composer/FileUploadButton.d.ts +1 -1
  376. package/dist/composer/FileUploadButton.js +65 -0
  377. package/dist/composer/FileUploadButton.js.map +1 -0
  378. package/dist/composer/QuoteContext.cjs +68 -0
  379. package/dist/composer/QuoteContext.cjs.map +1 -0
  380. package/dist/composer/QuoteContext.js +68 -0
  381. package/dist/composer/QuoteContext.js.map +1 -0
  382. package/dist/composer/build-composed-message.cjs +25 -0
  383. package/dist/composer/build-composed-message.cjs.map +1 -0
  384. package/dist/composer/build-composed-message.js +25 -0
  385. package/dist/composer/build-composed-message.js.map +1 -0
  386. package/dist/composer/clipboard.cjs +62 -0
  387. package/dist/composer/clipboard.cjs.map +1 -0
  388. package/dist/composer/clipboard.d.ts +27 -3
  389. package/dist/composer/clipboard.js +62 -0
  390. package/dist/composer/clipboard.js.map +1 -0
  391. package/dist/composer/useAppendToComposer.cjs +21 -0
  392. package/dist/composer/useAppendToComposer.cjs.map +1 -0
  393. package/dist/composer/useAppendToComposer.js +21 -0
  394. package/dist/composer/useAppendToComposer.js.map +1 -0
  395. package/dist/composer/useAttachFiles.cjs +40 -0
  396. package/dist/composer/useAttachFiles.cjs.map +1 -0
  397. package/dist/composer/useAttachFiles.d.ts +24 -0
  398. package/dist/composer/useAttachFiles.js +40 -0
  399. package/dist/composer/useAttachFiles.js.map +1 -0
  400. package/dist/composer/useComposerAttachment.cjs +25 -0
  401. package/dist/composer/useComposerAttachment.cjs.map +1 -0
  402. package/dist/composer/useComposerAttachment.js +25 -0
  403. package/dist/composer/useComposerAttachment.js.map +1 -0
  404. package/dist/composer/useFileUpload.cjs +123 -0
  405. package/dist/composer/useFileUpload.cjs.map +1 -0
  406. package/dist/composer/useFileUpload.js +123 -0
  407. package/dist/composer/useFileUpload.js.map +1 -0
  408. package/dist/composer/useSendMessage.cjs +22 -0
  409. package/dist/composer/useSendMessage.cjs.map +1 -0
  410. package/dist/composer/useSendMessage.js +22 -0
  411. package/dist/composer/useSendMessage.js.map +1 -0
  412. package/dist/diagnostics/athena-diagnostics.cjs +329 -0
  413. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -0
  414. package/dist/diagnostics/athena-diagnostics.js +329 -0
  415. package/dist/diagnostics/athena-diagnostics.js.map +1 -0
  416. package/dist/diagnostics/errors.cjs +89 -0
  417. package/dist/diagnostics/errors.cjs.map +1 -0
  418. package/dist/diagnostics/errors.js +89 -0
  419. package/dist/diagnostics/errors.js.map +1 -0
  420. package/dist/diagnostics/useAthenaDiagnostics.cjs +16 -0
  421. package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -0
  422. package/dist/diagnostics/useAthenaDiagnostics.js +16 -0
  423. package/dist/diagnostics/useAthenaDiagnostics.js.map +1 -0
  424. package/dist/index.cjs +274 -27882
  425. package/dist/index.cjs.map +1 -1
  426. package/dist/index.d.ts +6 -4
  427. package/dist/index.js +161 -27759
  428. package/dist/index.js.map +1 -1
  429. package/dist/lib/athena-urls.cjs +194 -0
  430. package/dist/lib/athena-urls.cjs.map +1 -0
  431. package/dist/lib/athena-urls.d.ts +20 -5
  432. package/dist/lib/athena-urls.js +194 -0
  433. package/dist/lib/athena-urls.js.map +1 -0
  434. package/dist/lib/posthog/before-send.cjs +58 -0
  435. package/dist/lib/posthog/before-send.cjs.map +1 -0
  436. package/dist/lib/posthog/before-send.js +58 -0
  437. package/dist/lib/posthog/before-send.js.map +1 -0
  438. package/dist/lib/posthog/capture-gate.cjs +322 -0
  439. package/dist/lib/posthog/capture-gate.cjs.map +1 -0
  440. package/dist/lib/posthog/capture-gate.js +322 -0
  441. package/dist/lib/posthog/capture-gate.js.map +1 -0
  442. package/dist/lib/posthog/wrap-posthog-client.cjs +163 -0
  443. package/dist/lib/posthog/wrap-posthog-client.cjs.map +1 -0
  444. package/dist/lib/posthog/wrap-posthog-client.js +163 -0
  445. package/dist/lib/posthog/wrap-posthog-client.js.map +1 -0
  446. package/dist/lib/utils.cjs +12 -0
  447. package/dist/lib/utils.cjs.map +1 -0
  448. package/dist/lib/utils.js +9 -0
  449. package/dist/lib/utils.js.map +1 -0
  450. package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.cjs +77 -0
  451. package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.cjs.map +1 -0
  452. package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.js +77 -0
  453. package/dist/node_modules/@assistant-ui/react-langchain/dist/converter.js.map +1 -0
  454. package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.cjs +181 -0
  455. package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.cjs.map +1 -0
  456. package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.js +181 -0
  457. package/dist/node_modules/@assistant-ui/react-langgraph/dist/convertLangChainMessages.js.map +1 -0
  458. package/dist/packages/agent-runtime/src/asset-attachment.cjs +19 -0
  459. package/dist/packages/agent-runtime/src/asset-attachment.cjs.map +1 -0
  460. package/dist/packages/agent-runtime/src/asset-attachment.js +19 -0
  461. package/dist/packages/agent-runtime/src/asset-attachment.js.map +1 -0
  462. package/dist/packages/agent-runtime/src/auth-denial.cjs +28 -0
  463. package/dist/packages/agent-runtime/src/auth-denial.cjs.map +1 -0
  464. package/dist/packages/agent-runtime/src/auth-denial.js +28 -0
  465. package/dist/packages/agent-runtime/src/auth-denial.js.map +1 -0
  466. package/dist/packages/agent-runtime/src/client-tool-bridge.cjs +270 -0
  467. package/dist/packages/agent-runtime/src/client-tool-bridge.cjs.map +1 -0
  468. package/dist/packages/agent-runtime/src/client-tool-bridge.js +270 -0
  469. package/dist/packages/agent-runtime/src/client-tool-bridge.js.map +1 -0
  470. package/dist/packages/agent-runtime/src/client-tools.cjs +137 -0
  471. package/dist/packages/agent-runtime/src/client-tools.cjs.map +1 -0
  472. package/dist/packages/agent-runtime/src/client-tools.js +137 -0
  473. package/dist/packages/agent-runtime/src/client-tools.js.map +1 -0
  474. package/dist/packages/agent-runtime/src/conversation-index.cjs +80 -0
  475. package/dist/packages/agent-runtime/src/conversation-index.cjs.map +1 -0
  476. package/dist/packages/agent-runtime/src/conversation-index.js +80 -0
  477. package/dist/packages/agent-runtime/src/conversation-index.js.map +1 -0
  478. package/dist/packages/agent-runtime/src/conversation-list.cjs +86 -0
  479. package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -0
  480. package/dist/packages/agent-runtime/src/conversation-list.js +86 -0
  481. package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -0
  482. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs +55 -0
  483. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -0
  484. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js +55 -0
  485. package/dist/packages/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -0
  486. package/dist/packages/agent-runtime/src/edit-command.cjs +89 -0
  487. package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -0
  488. package/dist/packages/agent-runtime/src/edit-command.js +89 -0
  489. package/dist/packages/agent-runtime/src/edit-command.js.map +1 -0
  490. package/dist/packages/agent-runtime/src/errors.cjs +95 -0
  491. package/dist/packages/agent-runtime/src/errors.cjs.map +1 -0
  492. package/dist/packages/agent-runtime/src/errors.js +95 -0
  493. package/dist/packages/agent-runtime/src/errors.js.map +1 -0
  494. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +236 -0
  495. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -0
  496. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +236 -0
  497. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -0
  498. package/dist/packages/agent-runtime/src/interrupts.cjs +117 -0
  499. package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -0
  500. package/dist/packages/agent-runtime/src/interrupts.js +117 -0
  501. package/dist/packages/agent-runtime/src/interrupts.js.map +1 -0
  502. package/dist/packages/agent-runtime/src/message-author.cjs +31 -0
  503. package/dist/packages/agent-runtime/src/message-author.cjs.map +1 -0
  504. package/dist/packages/agent-runtime/src/message-author.js +31 -0
  505. package/dist/packages/agent-runtime/src/message-author.js.map +1 -0
  506. package/dist/packages/agent-runtime/src/message-window.cjs +85 -0
  507. package/dist/packages/agent-runtime/src/message-window.cjs.map +1 -0
  508. package/dist/packages/agent-runtime/src/message-window.js +85 -0
  509. package/dist/packages/agent-runtime/src/message-window.js.map +1 -0
  510. package/dist/packages/agent-runtime/src/messages.cjs +433 -0
  511. package/dist/packages/agent-runtime/src/messages.cjs.map +1 -0
  512. package/dist/packages/agent-runtime/src/messages.js +433 -0
  513. package/dist/packages/agent-runtime/src/messages.js.map +1 -0
  514. package/dist/packages/agent-runtime/src/model-context.cjs +13 -0
  515. package/dist/packages/agent-runtime/src/model-context.cjs.map +1 -0
  516. package/dist/packages/agent-runtime/src/model-context.js +13 -0
  517. package/dist/packages/agent-runtime/src/model-context.js.map +1 -0
  518. package/dist/packages/agent-runtime/src/optimistic-content.cjs +17 -0
  519. package/dist/packages/agent-runtime/src/optimistic-content.cjs.map +1 -0
  520. package/dist/packages/agent-runtime/src/optimistic-content.js +17 -0
  521. package/dist/packages/agent-runtime/src/optimistic-content.js.map +1 -0
  522. package/dist/packages/agent-runtime/src/protocol.cjs +33 -0
  523. package/dist/packages/agent-runtime/src/protocol.cjs.map +1 -0
  524. package/dist/packages/agent-runtime/src/protocol.js +33 -0
  525. package/dist/packages/agent-runtime/src/protocol.js.map +1 -0
  526. package/dist/packages/agent-runtime/src/queue.cjs +67 -0
  527. package/dist/packages/agent-runtime/src/queue.cjs.map +1 -0
  528. package/dist/packages/agent-runtime/src/queue.js +67 -0
  529. package/dist/packages/agent-runtime/src/queue.js.map +1 -0
  530. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +47 -0
  531. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -0
  532. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +47 -0
  533. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -0
  534. package/dist/packages/agent-runtime/src/runtime-messages.cjs +187 -0
  535. package/dist/packages/agent-runtime/src/runtime-messages.cjs.map +1 -0
  536. package/dist/packages/agent-runtime/src/runtime-messages.js +187 -0
  537. package/dist/packages/agent-runtime/src/runtime-messages.js.map +1 -0
  538. package/dist/packages/agent-runtime/src/send-recovery.cjs +128 -0
  539. package/dist/packages/agent-runtime/src/send-recovery.cjs.map +1 -0
  540. package/dist/packages/agent-runtime/src/send-recovery.js +128 -0
  541. package/dist/packages/agent-runtime/src/send-recovery.js.map +1 -0
  542. package/dist/packages/agent-runtime/src/statewire-attach-observer.cjs +249 -0
  543. package/dist/packages/agent-runtime/src/statewire-attach-observer.cjs.map +1 -0
  544. package/dist/packages/agent-runtime/src/statewire-attach-observer.js +249 -0
  545. package/dist/packages/agent-runtime/src/statewire-attach-observer.js.map +1 -0
  546. package/dist/packages/agent-runtime/src/statewire-state.cjs +16 -0
  547. package/dist/packages/agent-runtime/src/statewire-state.cjs.map +1 -0
  548. package/dist/packages/agent-runtime/src/statewire-state.js +16 -0
  549. package/dist/packages/agent-runtime/src/statewire-state.js.map +1 -0
  550. package/dist/packages/agent-runtime/src/statewire-suspended.cjs +41 -0
  551. package/dist/packages/agent-runtime/src/statewire-suspended.cjs.map +1 -0
  552. package/dist/packages/agent-runtime/src/statewire-suspended.js +41 -0
  553. package/dist/packages/agent-runtime/src/statewire-suspended.js.map +1 -0
  554. package/dist/packages/agent-runtime/src/statewire-transport.cjs +6 -0
  555. package/dist/packages/agent-runtime/src/statewire-transport.cjs.map +1 -0
  556. package/dist/packages/agent-runtime/src/statewire-transport.js +6 -0
  557. package/dist/packages/agent-runtime/src/statewire-transport.js.map +1 -0
  558. package/dist/packages/agent-runtime/src/streaming-markdown.cjs +214 -0
  559. package/dist/packages/agent-runtime/src/streaming-markdown.cjs.map +1 -0
  560. package/dist/packages/agent-runtime/src/streaming-markdown.js +214 -0
  561. package/dist/packages/agent-runtime/src/streaming-markdown.js.map +1 -0
  562. package/dist/packages/agent-runtime/src/thread-extras.cjs +38 -0
  563. package/dist/packages/agent-runtime/src/thread-extras.cjs.map +1 -0
  564. package/dist/packages/agent-runtime/src/thread-extras.js +38 -0
  565. package/dist/packages/agent-runtime/src/thread-extras.js.map +1 -0
  566. package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs +90 -0
  567. package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs.map +1 -0
  568. package/dist/packages/agent-runtime/src/thread-snapshot-cache.js +90 -0
  569. package/dist/packages/agent-runtime/src/thread-snapshot-cache.js.map +1 -0
  570. package/dist/packages/agent-runtime/src/thread-status.cjs +49 -0
  571. package/dist/packages/agent-runtime/src/thread-status.cjs.map +1 -0
  572. package/dist/packages/agent-runtime/src/thread-status.js +49 -0
  573. package/dist/packages/agent-runtime/src/thread-status.js.map +1 -0
  574. package/dist/packages/agent-runtime/src/tool-metadata.cjs +1802 -0
  575. package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -0
  576. package/dist/packages/agent-runtime/src/tool-metadata.js +1802 -0
  577. package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -0
  578. package/dist/packages/agent-runtime/src/tool-outputs.cjs +46 -0
  579. package/dist/packages/agent-runtime/src/tool-outputs.cjs.map +1 -0
  580. package/dist/packages/agent-runtime/src/tool-outputs.js +46 -0
  581. package/dist/packages/agent-runtime/src/tool-outputs.js.map +1 -0
  582. package/dist/packages/agent-runtime/src/tool-result.cjs +151 -0
  583. package/dist/packages/agent-runtime/src/tool-result.cjs.map +1 -0
  584. package/dist/packages/agent-runtime/src/tool-result.js +151 -0
  585. package/dist/packages/agent-runtime/src/tool-result.js.map +1 -0
  586. package/dist/packages/agent-runtime/src/use-conversation-list.cjs +139 -0
  587. package/dist/packages/agent-runtime/src/use-conversation-list.cjs.map +1 -0
  588. package/dist/packages/agent-runtime/src/use-conversation-list.js +139 -0
  589. package/dist/packages/agent-runtime/src/use-conversation-list.js.map +1 -0
  590. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs +28 -0
  591. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -0
  592. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js +28 -0
  593. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -0
  594. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs +138 -0
  595. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -0
  596. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js +138 -0
  597. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js.map +1 -0
  598. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs +387 -0
  599. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -0
  600. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js +387 -0
  601. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -0
  602. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs +133 -0
  603. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -0
  604. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js +133 -0
  605. package/dist/packages/agent-runtime/src/use-deep-agent-window-sync.js.map +1 -0
  606. package/dist/packages/agent-runtime/src/voice-presentation.cjs +37 -0
  607. package/dist/packages/agent-runtime/src/voice-presentation.cjs.map +1 -0
  608. package/dist/packages/agent-runtime/src/voice-presentation.js +37 -0
  609. package/dist/packages/agent-runtime/src/voice-presentation.js.map +1 -0
  610. package/dist/packages/react/package.json.cjs +9 -0
  611. package/dist/packages/react/package.json.cjs.map +1 -0
  612. package/dist/packages/react/package.json.js +9 -0
  613. package/dist/packages/react/package.json.js.map +1 -0
  614. package/dist/{AthenaContext-B1QMhIP-.cjs → provider/AthenaContext.cjs} +5 -4
  615. package/dist/provider/AthenaContext.cjs.map +1 -0
  616. package/dist/{AthenaContext-MOslgOmE.js → provider/AthenaContext.js} +3 -3
  617. package/dist/provider/AthenaContext.js.map +1 -0
  618. package/dist/provider/AthenaProvider.cjs +403 -0
  619. package/dist/provider/AthenaProvider.cjs.map +1 -0
  620. package/dist/provider/AthenaProvider.js +403 -0
  621. package/dist/provider/AthenaProvider.js.map +1 -0
  622. package/dist/provider/PostHogProvider.cjs +81 -0
  623. package/dist/provider/PostHogProvider.cjs.map +1 -0
  624. package/dist/provider/PostHogProvider.js +59 -0
  625. package/dist/provider/PostHogProvider.js.map +1 -0
  626. package/dist/provider/config.d.ts +8 -7
  627. package/dist/provider/statewire-lifecycle-context.cjs +10 -0
  628. package/dist/provider/statewire-lifecycle-context.cjs.map +1 -0
  629. package/dist/provider/statewire-lifecycle-context.js +10 -0
  630. package/dist/provider/statewire-lifecycle-context.js.map +1 -0
  631. package/dist/provider/statewire-window-context.cjs +10 -0
  632. package/dist/provider/statewire-window-context.cjs.map +1 -0
  633. package/dist/provider/statewire-window-context.js +10 -0
  634. package/dist/provider/statewire-window-context.js.map +1 -0
  635. package/dist/runtime/auth.cjs +309 -0
  636. package/dist/runtime/auth.cjs.map +1 -0
  637. package/dist/runtime/auth.d.ts +19 -18
  638. package/dist/runtime/auth.js +309 -0
  639. package/dist/runtime/auth.js.map +1 -0
  640. package/dist/runtime/statewire-auth-headers.cjs +18 -0
  641. package/dist/runtime/statewire-auth-headers.cjs.map +1 -0
  642. package/dist/runtime/statewire-auth-headers.js +18 -0
  643. package/dist/runtime/statewire-auth-headers.js.map +1 -0
  644. package/dist/runtime/statewire-lifecycle.cjs +67 -0
  645. package/dist/runtime/statewire-lifecycle.cjs.map +1 -0
  646. package/dist/runtime/statewire-lifecycle.js +67 -0
  647. package/dist/runtime/statewire-lifecycle.js.map +1 -0
  648. package/dist/runtime/statewire-run-config.cjs +68 -0
  649. package/dist/runtime/statewire-run-config.cjs.map +1 -0
  650. package/dist/runtime/statewire-run-config.js +68 -0
  651. package/dist/runtime/statewire-run-config.js.map +1 -0
  652. package/dist/runtime/statewire-session-key.cjs +11 -0
  653. package/dist/runtime/statewire-session-key.cjs.map +1 -0
  654. package/dist/runtime/statewire-session-key.js +11 -0
  655. package/dist/runtime/statewire-session-key.js.map +1 -0
  656. package/dist/runtime/useAthenaStatewireRuntime.cjs +179 -0
  657. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -0
  658. package/dist/runtime/useAthenaStatewireRuntime.js +180 -0
  659. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -0
  660. package/dist/styles.css +1 -1
  661. package/dist/theme/index.cjs +182 -0
  662. package/dist/theme/index.cjs.map +1 -0
  663. package/dist/theme/index.js +182 -0
  664. package/dist/theme/index.js.map +1 -0
  665. package/dist/threads/ThreadList.cjs +55 -0
  666. package/dist/threads/ThreadList.cjs.map +1 -0
  667. package/dist/threads/ThreadList.js +55 -0
  668. package/dist/threads/ThreadList.js.map +1 -0
  669. package/dist/threads/api.cjs +208 -0
  670. package/dist/threads/api.cjs.map +1 -0
  671. package/dist/threads/api.js +208 -0
  672. package/dist/threads/api.js.map +1 -0
  673. package/dist/threads/conversation-list-fetcher.cjs +70 -0
  674. package/dist/threads/conversation-list-fetcher.cjs.map +1 -0
  675. package/dist/threads/conversation-list-fetcher.js +70 -0
  676. package/dist/threads/conversation-list-fetcher.js.map +1 -0
  677. package/dist/threads/mint-thread-id.cjs +7 -0
  678. package/dist/threads/mint-thread-id.cjs.map +1 -0
  679. package/dist/threads/mint-thread-id.js +7 -0
  680. package/dist/threads/mint-thread-id.js.map +1 -0
  681. package/dist/threads/statewire-thread-list.cjs +231 -0
  682. package/dist/threads/statewire-thread-list.cjs.map +1 -0
  683. package/dist/threads/statewire-thread-list.js +231 -0
  684. package/dist/threads/statewire-thread-list.js.map +1 -0
  685. package/dist/threads/thread-id-context.cjs +22 -0
  686. package/dist/threads/thread-id-context.cjs.map +1 -0
  687. package/dist/threads/thread-id-context.d.ts +9 -0
  688. package/dist/threads/thread-id-context.js +22 -0
  689. package/dist/threads/thread-id-context.js.map +1 -0
  690. package/dist/threads/title.cjs +95 -0
  691. package/dist/threads/title.cjs.map +1 -0
  692. package/dist/threads/title.js +95 -0
  693. package/dist/threads/title.js.map +1 -0
  694. package/dist/threads/use-rest-conversation-history.cjs +79 -0
  695. package/dist/threads/use-rest-conversation-history.cjs.map +1 -0
  696. package/dist/threads/use-rest-conversation-history.js +79 -0
  697. package/dist/threads/use-rest-conversation-history.js.map +1 -0
  698. package/dist/threads/use-statewire-conversation-history.cjs +243 -0
  699. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -0
  700. package/dist/threads/use-statewire-conversation-history.js +243 -0
  701. package/dist/threads/use-statewire-conversation-history.js.map +1 -0
  702. package/dist/threads/useAthenaThreadManager.cjs +24 -0
  703. package/dist/threads/useAthenaThreadManager.cjs.map +1 -0
  704. package/dist/threads/useAthenaThreadManager.js +24 -0
  705. package/dist/threads/useAthenaThreadManager.js.map +1 -0
  706. package/dist/toolkits/index.cjs +279 -0
  707. package/dist/toolkits/index.cjs.map +1 -0
  708. package/dist/toolkits/index.js +279 -0
  709. package/dist/toolkits/index.js.map +1 -0
  710. package/dist/tools/NestedPtcMessages.cjs +46 -0
  711. package/dist/tools/NestedPtcMessages.cjs.map +1 -0
  712. package/dist/tools/NestedPtcMessages.js +46 -0
  713. package/dist/tools/NestedPtcMessages.js.map +1 -0
  714. package/dist/tools/append-document-tool-ui.cjs +145 -0
  715. package/dist/tools/append-document-tool-ui.cjs.map +1 -0
  716. package/dist/tools/append-document-tool-ui.js +145 -0
  717. package/dist/tools/append-document-tool-ui.js.map +1 -0
  718. package/dist/tools/asset-utils.cjs +16 -0
  719. package/dist/tools/asset-utils.cjs.map +1 -0
  720. package/dist/tools/asset-utils.js +16 -0
  721. package/dist/tools/asset-utils.js.map +1 -0
  722. package/dist/tools/auto-open-tools.cjs +121 -0
  723. package/dist/tools/auto-open-tools.cjs.map +1 -0
  724. package/dist/tools/auto-open-tools.js +121 -0
  725. package/dist/tools/auto-open-tools.js.map +1 -0
  726. package/dist/tools/file-tool-uis.cjs +108 -0
  727. package/dist/tools/file-tool-uis.cjs.map +1 -0
  728. package/dist/tools/file-tool-uis.js +108 -0
  729. package/dist/tools/file-tool-uis.js.map +1 -0
  730. package/dist/tools/index.cjs +56 -0
  731. package/dist/tools/index.cjs.map +1 -0
  732. package/dist/tools/index.d.ts +1 -0
  733. package/dist/tools/index.js +56 -0
  734. package/dist/tools/index.js.map +1 -0
  735. package/dist/tools/misc-tool-uis.cjs +54 -0
  736. package/dist/tools/misc-tool-uis.cjs.map +1 -0
  737. package/dist/{misc-tool-uis-gAiQw0Yl.js → tools/misc-tool-uis.js} +17 -7
  738. package/dist/tools/misc-tool-uis.js.map +1 -0
  739. package/dist/tools/primitives.cjs +166 -0
  740. package/dist/tools/primitives.cjs.map +1 -0
  741. package/dist/tools/primitives.js +166 -0
  742. package/dist/tools/primitives.js.map +1 -0
  743. package/dist/tools/read-asset-tool-ui.cjs +284 -0
  744. package/dist/tools/read-asset-tool-ui.cjs.map +1 -0
  745. package/dist/tools/read-asset-tool-ui.js +284 -0
  746. package/dist/tools/read-asset-tool-ui.js.map +1 -0
  747. package/dist/tools/todo-plan-store.cjs +88 -0
  748. package/dist/tools/todo-plan-store.cjs.map +1 -0
  749. package/dist/tools/todo-plan-store.js +88 -0
  750. package/dist/tools/todo-plan-store.js.map +1 -0
  751. package/dist/tools/tool-fallback.cjs +667 -0
  752. package/dist/tools/tool-fallback.cjs.map +1 -0
  753. package/dist/tools/tool-fallback.js +667 -0
  754. package/dist/tools/tool-fallback.js.map +1 -0
  755. package/dist/tools/tool-icons.cjs +61 -0
  756. package/dist/tools/tool-icons.cjs.map +1 -0
  757. package/dist/tools/tool-icons.js +61 -0
  758. package/dist/tools/tool-icons.js.map +1 -0
  759. package/dist/tools/tool-uis.cjs +3049 -0
  760. package/dist/tools/tool-uis.cjs.map +1 -0
  761. package/dist/tools/tool-uis.js +3049 -0
  762. package/dist/tools/tool-uis.js.map +1 -0
  763. package/dist/tools/voice-update-tool-ui.cjs +89 -0
  764. package/dist/tools/voice-update-tool-ui.cjs.map +1 -0
  765. package/dist/tools/voice-update-tool-ui.d.ts +27 -0
  766. package/dist/tools/voice-update-tool-ui.js +89 -0
  767. package/dist/tools/voice-update-tool-ui.js.map +1 -0
  768. package/dist/tools/write-todos-tool-ui.cjs +270 -0
  769. package/dist/tools/write-todos-tool-ui.cjs.map +1 -0
  770. package/dist/tools/write-todos-tool-ui.js +270 -0
  771. package/dist/tools/write-todos-tool-ui.js.map +1 -0
  772. package/dist/ui/button.cjs +57 -0
  773. package/dist/ui/button.cjs.map +1 -0
  774. package/dist/ui/button.js +57 -0
  775. package/dist/ui/button.js.map +1 -0
  776. package/dist/ui/collapsible.cjs +17 -0
  777. package/dist/ui/collapsible.cjs.map +1 -0
  778. package/dist/ui/collapsible.js +17 -0
  779. package/dist/ui/collapsible.js.map +1 -0
  780. package/dist/ui/tooltip.cjs +48 -0
  781. package/dist/ui/tooltip.cjs.map +1 -0
  782. package/dist/ui/tooltip.js +48 -0
  783. package/dist/ui/tooltip.js.map +1 -0
  784. package/dist/version.cjs +6 -0
  785. package/dist/version.cjs.map +1 -0
  786. package/dist/version.js +6 -0
  787. package/dist/version.js.map +1 -0
  788. package/package.json +18 -20
  789. package/dist/AthenaAuthContext-B3AwLA5Z.cjs.map +0 -1
  790. package/dist/AthenaAuthContext-DQsdayH2.js.map +0 -1
  791. package/dist/AthenaContext-B1QMhIP-.cjs.map +0 -1
  792. package/dist/AthenaContext-MOslgOmE.js.map +0 -1
  793. package/dist/SuperGroupingCard-BsWbHyV_.js +0 -795
  794. package/dist/SuperGroupingCard-BsWbHyV_.js.map +0 -1
  795. package/dist/SuperGroupingCard-CRRFUgjN.cjs +0 -794
  796. package/dist/SuperGroupingCard-CRRFUgjN.cjs.map +0 -1
  797. package/dist/auth.cjs.map +0 -1
  798. package/dist/auth.js.map +0 -1
  799. package/dist/chat/ComposerEditorContext.d.ts +0 -36
  800. package/dist/chat/tiptap-composer.d.ts +0 -7
  801. package/dist/chat-ui-statewire.cjs +0 -25
  802. package/dist/chat-ui-statewire.cjs.map +0 -1
  803. package/dist/chat-ui-statewire.js +0 -25
  804. package/dist/chat-ui-statewire.js.map +0 -1
  805. package/dist/chat-ui.cjs +0 -2484
  806. package/dist/chat-ui.cjs.map +0 -1
  807. package/dist/chat-ui.js +0 -2486
  808. package/dist/chat-ui.js.map +0 -1
  809. package/dist/collab.cjs.map +0 -1
  810. package/dist/collab.js.map +0 -1
  811. package/dist/mentions/composer-keybinds.d.ts +0 -5
  812. package/dist/mentions/mention-extension.d.ts +0 -6
  813. package/dist/mentions/mention-icons.d.ts +0 -4
  814. package/dist/mentions/mention-node-view.d.ts +0 -2
  815. package/dist/mentions/mention-suggestion-list.d.ts +0 -14
  816. package/dist/mentions/mention-suggestion-popup.d.ts +0 -15
  817. package/dist/mentions/mention-suggestions-extension.d.ts +0 -11
  818. package/dist/mentions/mention-types.d.ts +0 -21
  819. package/dist/mentions/mention-utils.d.ts +0 -23
  820. package/dist/mentions/use-mention-suggestions.d.ts +0 -29
  821. package/dist/misc-tool-uis-B2e0Okkn.cjs +0 -43
  822. package/dist/misc-tool-uis-B2e0Okkn.cjs.map +0 -1
  823. package/dist/misc-tool-uis-gAiQw0Yl.js.map +0 -1
  824. package/dist/statewire-continue-run-D34gS7_1.js.map +0 -1
  825. package/dist/statewire-continue-run-nE9VCKUh.cjs.map +0 -1
  826. package/dist/statewire-history-edge-C8uyTEjX.cjs +0 -1711
  827. package/dist/statewire-history-edge-C8uyTEjX.cjs.map +0 -1
  828. package/dist/statewire-history-edge-CPohUKMt.js +0 -1712
  829. package/dist/statewire-history-edge-CPohUKMt.js.map +0 -1
  830. package/dist/super-grouping.cjs +0 -22
  831. package/dist/super-grouping.cjs.map +0 -1
  832. package/dist/super-grouping.js +0 -22
  833. package/dist/super-grouping.js.map +0 -1
  834. package/dist/tool-fallback-DkQ3DLkn.js +0 -4281
  835. package/dist/tool-fallback-DkQ3DLkn.js.map +0 -1
  836. package/dist/tool-fallback-kfhpJQZa.cjs +0 -4297
  837. package/dist/tool-fallback-kfhpJQZa.cjs.map +0 -1
  838. package/dist/tools.cjs +0 -41
  839. package/dist/tools.cjs.map +0 -1
  840. package/dist/tools.js +0 -41
  841. package/dist/tools.js.map +0 -1
  842. package/dist/trash-2-B5OaNAL7.cjs +0 -5096
  843. package/dist/trash-2-B5OaNAL7.cjs.map +0 -1
  844. package/dist/trash-2-CCwSURL-.js +0 -5081
  845. package/dist/trash-2-CCwSURL-.js.map +0 -1
  846. package/dist/use-rest-conversation-history-Cm8qMRxp.cjs +0 -32397
  847. package/dist/use-rest-conversation-history-Cm8qMRxp.cjs.map +0 -1
  848. package/dist/use-rest-conversation-history-veDZS-oL.js +0 -32361
  849. package/dist/use-rest-conversation-history-veDZS-oL.js.map +0 -1
  850. package/dist/wrench-BEf72cyP.cjs +0 -417
  851. package/dist/wrench-BEf72cyP.cjs.map +0 -1
  852. package/dist/wrench-CbrOlVYm.js +0 -418
  853. package/dist/wrench-CbrOlVYm.js.map +0 -1
  854. package/dist/x-Dfd2NzK0.cjs +0 -42
  855. package/dist/x-Dfd2NzK0.cjs.map +0 -1
  856. package/dist/x-_DntAa_a.js +0 -43
  857. package/dist/x-_DntAa_a.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"statewire-history-edge-C8uyTEjX.cjs","sources":["../../agent-runtime/src/client-tools.ts","../../agent-runtime/src/errors.ts","../../agent-runtime/src/interrupts.ts","../../agent-runtime/src/queue.ts","../../agent-runtime/src/thread-extras.ts","../../agent-runtime/src/use-deep-agent-window-sync.ts","../../agent-runtime/src/thread-status.ts","../../agent-runtime/src/runtime-messages.ts","../src/provider/statewire-window-context.tsx","../../../node_modules/lucide-react/dist/esm/icons/loader-circle.js","../../../node_modules/lucide-react/dist/esm/icons/octagon-x.js","../../../node_modules/lucide-react/dist/esm/icons/pencil.js","../../../node_modules/lucide-react/dist/esm/icons/rotate-ccw.js","../../../node_modules/lucide-react/dist/esm/icons/send.js","../../../node_modules/lucide-react/dist/esm/icons/square.js","../../../node_modules/lucide-react/dist/esm/icons/triangle-alert.js","../../../node_modules/lucide-react/dist/esm/icons/zap.js","../../../node_modules/clsx/dist/clsx.mjs","../../../node_modules/class-variance-authority/dist/index.mjs","../src/ui/button.tsx","../src/chat/use-statewire-approval-request.ts","../src/chat/StatewireApprovalCard.tsx","../src/chat-ui/messages/continue-pill.tsx","../src/chat/StatewireQueuedMessages.tsx","../src/chat-ui/messages/runtime-message.tsx","../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["/**\n * Client-executed tools for statewire deep-agent threads.\n *\n * A client (the Office add-in, the Chrome extension, …) declares tools it can\n * execute locally by sending their JSON-schema definitions through\n * `runConfig.custom.client_tools`. The deep-agent runtime binds them as\n * interrupt-backed tools: when the model calls one, the run parks on a\n * LangGraph interrupt whose payload carries the tool name and arguments, the\n * statewire host publishes it as an `interrupt` input request, and the client\n * executes the tool and resumes the run with the result envelope.\n *\n * This module is transport-agnostic: it holds the wire contract (definitions,\n * interrupt payload shape, result envelopes) and a duplicate-execution guard.\n * The React hook that watches input requests lives with each client, next to\n * its host-specific tool handlers.\n */\n\nimport {\n CLIENT_TOOL_INTERRUPT_SOURCE,\n CLIENT_TOOL_RESULT_STATUS_ERROR,\n CLIENT_TOOL_RESULT_STATUS_SUCCESS,\n} from './generated/runconfig-contract';\n\n/** `source`/`type` stamped on the interrupt payload by the agora runtime. */\nexport { CLIENT_TOOL_INTERRUPT_SOURCE } from './generated/runconfig-contract';\n\n/** JSON-schema description of one client-executed tool. */\nexport interface ClientToolDefinition {\n /** Snake_case tool id the model calls (e.g. `update_sheet_range`). */\n name: string;\n description: string;\n /** JSON schema for the tool arguments (`{\"type\": \"object\", ...}`). */\n parameters: Record<string, unknown>;\n /** Mutating tools gate on the client's write-approval flow before running. */\n requiresWrite: boolean;\n}\n\n/** Per-call context the client-tool bridge hands a handler; absent when a host\n * invokes a handler outside a parked run. */\nexport interface ClientToolHandlerContext {\n /** The model's tool-call id, for handlers that correlate calls. */\n toolCallId: string;\n}\n\nexport type ClientToolHandler = (\n args: Record<string, unknown>,\n context?: ClientToolHandlerContext,\n) => Promise<unknown>;\n\nexport interface RegisteredClientTool {\n definition: ClientToolDefinition;\n handler: ClientToolHandler;\n}\n\n/** One parked tool call inside a batched client-tool input request. */\nexport interface ClientToolCallRequest {\n /** LangGraph interrupt id — the key the resume result map must use. */\n interrupt_id: string;\n tool_name: string;\n tool_args: Record<string, unknown>;\n requires_write?: boolean;\n}\n\n/**\n * The input-request payload the agora runtime publishes for parked client\n * tool calls. A parallel model turn parks several interrupts at once; the\n * runtime batches them into one payload and the client answers once with\n * `{ client_tool_results: { <interrupt_id>: <result envelope> } }`.\n */\nexport interface ClientToolInterruptPayload {\n source: typeof CLIENT_TOOL_INTERRUPT_SOURCE;\n type: typeof CLIENT_TOOL_INTERRUPT_SOURCE;\n message: string;\n context: {\n requests: ClientToolCallRequest[];\n };\n}\n\nfunction isClientToolCallRequest(value: unknown): value is ClientToolCallRequest {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return false;\n const candidate = value as Partial<ClientToolCallRequest>;\n return (\n typeof candidate.interrupt_id === 'string' &&\n candidate.interrupt_id.length > 0 &&\n typeof candidate.tool_name === 'string'\n );\n}\n\n/**\n * Loose source check for surfaces that must NOT handle a client-tool park\n * (e.g. the generic approval banner). Unlike `isClientToolInterrupt`, this\n * matches any payload stamped with the client-tool source — including shapes\n * from a mismatched client/server version — so a skewed deploy can never\n * surface a generic \"Continue\" resume that corrupts a parked tool call.\n */\nexport function hasClientToolInterruptSource(payload: unknown): boolean {\n return (\n !!payload &&\n typeof payload === 'object' &&\n !Array.isArray(payload) &&\n (payload as { source?: unknown }).source === CLIENT_TOOL_INTERRUPT_SOURCE\n );\n}\n\nexport function isClientToolInterrupt(\n payload: unknown,\n): payload is ClientToolInterruptPayload {\n if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {\n return false;\n }\n const candidate = payload as Partial<ClientToolInterruptPayload>;\n return (\n candidate.source === CLIENT_TOOL_INTERRUPT_SOURCE &&\n candidate.type === CLIENT_TOOL_INTERRUPT_SOURCE &&\n typeof candidate.context === 'object' &&\n candidate.context !== null &&\n Array.isArray(candidate.context.requests) &&\n candidate.context.requests.length > 0 &&\n candidate.context.requests.every(isClientToolCallRequest)\n );\n}\n\n/** Tool arguments from a call request, defaulting to an empty object. */\nexport function clientToolCallArgs(\n request: ClientToolCallRequest,\n): Record<string, unknown> {\n const args = request.tool_args;\n return args && typeof args === 'object' && !Array.isArray(args) ? args : {};\n}\n\n/** The `run/input` resume value answering a batched client-tool park. */\nexport function clientToolResultsResumeValue(\n results: Record<string, ClientToolResultEnvelope>,\n): Record<string, unknown> {\n return { client_tool_results: results };\n}\n\n/** Wire entries for `runConfig.custom.client_tools`. */\nexport function clientToolRunConfigEntries(\n tools: readonly RegisteredClientTool[],\n): Record<string, unknown>[] {\n return tools.map(({ definition }) => ({\n name: definition.name,\n description: definition.description,\n parameters: definition.parameters,\n requires_write: definition.requiresWrite,\n }));\n}\n\n/** Successful tool execution, resumed back into the parked run. */\nexport interface ClientToolSuccessEnvelope {\n status: typeof CLIENT_TOOL_RESULT_STATUS_SUCCESS;\n result: unknown;\n}\n\n/** Failed or declined tool execution, resumed back into the parked run. */\nexport interface ClientToolErrorEnvelope {\n status: typeof CLIENT_TOOL_RESULT_STATUS_ERROR;\n error: string;\n}\n\nexport type ClientToolResultEnvelope =\n | ClientToolSuccessEnvelope\n | ClientToolErrorEnvelope;\n\nexport function clientToolSuccessEnvelope(\n result: unknown,\n): ClientToolSuccessEnvelope {\n return {\n status: CLIENT_TOOL_RESULT_STATUS_SUCCESS,\n result: result === undefined ? null : result,\n };\n}\n\nexport function clientToolErrorEnvelope(error: unknown): ClientToolErrorEnvelope {\n const message =\n error instanceof Error\n ? error.message\n : typeof error === 'string'\n ? error\n : 'Client tool execution failed.';\n return { status: CLIENT_TOOL_RESULT_STATUS_ERROR, error: message };\n}\n\n/**\n * Once-per-request execution guard. Statewire re-emits the pending input\n * request on every state update, so an executor effect can observe the same\n * request many times; the tracker makes exactly one observation win.\n */\nexport interface ClientToolRequestTracker {\n /** True exactly once per request id; later calls return false. */\n claim(requestId: string): boolean;\n /** Un-claim a request that was NOT resumed (e.g. abandoned mid-approval),\n * so a re-emitted request can be executed instead of stranding the run. */\n release(requestId: string): void;\n has(requestId: string): boolean;\n /** Cache the completed, wire-safe resume value without releasing the\n * exactly-once execution claim. A reconnect may replay this value, but it\n * must never execute the local handler again. */\n cacheResume(requestId: string, value: Record<string, unknown>): void;\n getCachedResume(requestId: string): ClientToolCachedResume | undefined;\n /** Give one mounted bridge ownership of retrying a cached resume. */\n claimResumeReplay(requestId: string, owner: symbol): boolean;\n releaseResumeReplay(requestId: string, owner: symbol): void;\n /** Record authoritative host acceptance. The execution claim remains held\n * so a briefly stale request cannot execute its local side effects again. */\n settleResume(requestId: string): void;\n /** Atomically consume one bounded replay attempt for the current owner. */\n takeResumeAttempt(\n requestId: string,\n options: { owner: symbol; maxAttempts: number },\n ): ClientToolResumeAttempt | undefined;\n}\n\nexport interface ClientToolCachedResume {\n value: Record<string, unknown>;\n attemptCount: number;\n}\n\nexport interface ClientToolResumeAttempt {\n value: Record<string, unknown>;\n attemptNumber: number;\n}\n\nexport interface CreateClientToolRequestTrackerOptions {\n /** Maximum completed resume values retained for reconnect recovery. Active\n * executions are never evicted. */\n maxCachedResumes?: number;\n}\n\ninterface ClientToolRequestEntry {\n resumeValue?: Record<string, unknown>;\n resumeAttemptCount: number;\n resumeOwner?: symbol;\n settled?: boolean;\n}\n\nconst DEFAULT_MAX_CACHED_CLIENT_TOOL_RESUMES = 128;\n\nexport function createClientToolRequestTracker(\n options: CreateClientToolRequestTrackerOptions = {},\n): ClientToolRequestTracker {\n const maxCachedResumes = options.maxCachedResumes ?? DEFAULT_MAX_CACHED_CLIENT_TOOL_RESUMES;\n const requests = new Map<string, ClientToolRequestEntry>();\n\n const pruneCompletedRequests = (protectedRequestId?: string): void => {\n let completedCount = 0;\n for (const entry of requests.values()) {\n if (entry.resumeValue !== undefined || entry.settled === true) completedCount += 1;\n }\n if (completedCount <= maxCachedResumes) return;\n\n // Map iteration is insertion order. Only inactive, completed entries are\n // eligible: evicting an executing request could allow a document mutation\n // to run twice, evicting an active replay would split ownership, and the\n // newly completed request must survive long enough for its first dispatch.\n for (const [requestId, entry] of requests) {\n if (completedCount <= maxCachedResumes) break;\n if (\n requestId === protectedRequestId ||\n (entry.resumeValue === undefined && entry.settled !== true) ||\n entry.resumeOwner !== undefined\n ) {\n continue;\n }\n requests.delete(requestId);\n completedCount -= 1;\n }\n };\n\n return {\n claim(requestId: string): boolean {\n if (requests.has(requestId)) return false;\n requests.set(requestId, { resumeAttemptCount: 0 });\n return true;\n },\n release(requestId: string): void {\n requests.delete(requestId);\n },\n has(requestId: string): boolean {\n return requests.has(requestId);\n },\n cacheResume(requestId: string, value: Record<string, unknown>): void {\n const entry = requests.get(requestId) ?? { resumeAttemptCount: 0 };\n entry.resumeValue = value;\n entry.settled = false;\n requests.delete(requestId);\n requests.set(requestId, entry);\n pruneCompletedRequests(requestId);\n },\n getCachedResume(requestId: string): ClientToolCachedResume | undefined {\n const entry = requests.get(requestId);\n if (!entry || entry.resumeValue === undefined) return undefined;\n return {\n value: entry.resumeValue,\n attemptCount: entry.resumeAttemptCount,\n };\n },\n claimResumeReplay(requestId: string, owner: symbol): boolean {\n const entry = requests.get(requestId);\n if (!entry || entry.resumeValue === undefined) return false;\n if (entry.resumeOwner !== undefined && entry.resumeOwner !== owner) {\n return false;\n }\n entry.resumeOwner = owner;\n return true;\n },\n releaseResumeReplay(requestId: string, owner: symbol): void {\n const entry = requests.get(requestId);\n if (entry?.resumeOwner === owner) entry.resumeOwner = undefined;\n pruneCompletedRequests();\n },\n settleResume(requestId: string): void {\n const entry = requests.get(requestId);\n if (!entry) return;\n entry.resumeValue = undefined;\n entry.resumeOwner = undefined;\n entry.settled = true;\n requests.delete(requestId);\n requests.set(requestId, entry);\n pruneCompletedRequests(requestId);\n },\n takeResumeAttempt(\n requestId: string,\n attemptOptions: { owner: symbol; maxAttempts: number },\n ): ClientToolResumeAttempt | undefined {\n const entry = requests.get(requestId);\n if (\n !entry ||\n entry.resumeValue === undefined ||\n entry.resumeOwner !== attemptOptions.owner ||\n entry.resumeAttemptCount >= attemptOptions.maxAttempts\n ) {\n return undefined;\n }\n entry.resumeAttemptCount += 1;\n return {\n value: entry.resumeValue,\n attemptNumber: entry.resumeAttemptCount,\n };\n },\n };\n}\n","import type { StatewireClient } from 'statewire';\nimport type { DeepAgentConnectionState } from './types';\n\n/** Structured payload attached to a server-rejected Statewire command. */\nexport interface StatewireRejectionPayload {\n status: number;\n detail: unknown;\n}\n\n/** Return a rejected command's structured `{ status, detail }` payload. */\nexport function statewireRejectionPayload(error: unknown): StatewireRejectionPayload | null {\n const failure = (error as { failure?: { fate?: unknown; payload?: unknown } } | null)?.failure;\n if (failure?.fate !== 'rejected') return null;\n\n const payload = failure.payload as { status?: unknown; detail?: unknown } | undefined;\n if (typeof payload?.status !== 'number') return null;\n return { status: payload.status, detail: payload.detail };\n}\n\n/**\n * The server's human-readable reason for a rejected command — `detail.message`\n * (or a plain-string `detail`) — else `null`. Hosts surface it as send\n * feedback so the user sees the actionable cause instead of the generic\n * client-side `command rejected (<status>)`.\n */\nexport function statewireRejectionDetailMessage(error: unknown): string | null {\n const detail = statewireRejectionPayload(error)?.detail;\n if (typeof detail === 'string') return detail.length > 0 ? detail : null;\n if (detail === null || typeof detail !== 'object' || Array.isArray(detail)) return null;\n const message = (detail as { message?: unknown }).message;\n return typeof message === 'string' && message.length > 0 ? message : null;\n}\n\n/**\n * Whether a rejected command hit the legacy-thread dispatch fence: the\n * structured 409 the server answers when an out-of-band run is writing a\n * pre-cutover thread (or its adoption failed). A per-send failure — the\n * snapshot never carries a standing read-only flag.\n */\nexport function isLegacyThreadReadOnlyRejection(error: unknown): boolean {\n const payload = statewireRejectionPayload(error);\n if (payload?.status !== 409) return false;\n\n const detail = payload.detail as { code?: unknown } | undefined;\n return detail?.code === 'legacy_thread_read_only';\n}\n\n/**\n * Whether a rejected command was refused because its rewind anchor no longer\n * matches the host's parent for the edited message (`wrong-anchor`).\n *\n * A retry/edit resubmit is dispatched optimistically, so this rejection lands\n * after the UI already cleared its edit affordances: the turn simply never\n * re-runs. Callers use this to tell the user the resubmit was dropped instead\n * of leaving a console-only failure.\n */\nexport function isStatewireRewindAnchorRejection(error: unknown): boolean {\n const failure = (error as { failure?: { fate?: unknown; payload?: unknown } } | null | undefined)\n ?.failure;\n if (failure?.fate !== 'rejected') return false;\n return (failure.payload as { reason?: unknown } | undefined)?.reason === 'wrong-anchor';\n}\n\n/**\n * Whether a statewire send failure is a local channel death rather than a\n * command error.\n *\n * The library's contract for `SendFailure.cause`: `\"server\"` is the server's\n * own answer; every other cause is \"a channel death the client settled\n * locally\" — `unmount`, `stream-gone`, and `session-lost`. A thread switch\n * settles every in-flight command that way, so logging these at error level\n * reports two failures for an ordinary switch and buries the ones that mean\n * something.\n *\n * Channel health is already surfaced where it belongs: the connection\n * indicator renders the connection state. This\n * predicate only decides the log level.\n */\nexport function isStatewireChannelTeardown(error: unknown): boolean {\n const cause = (error as { failure?: { cause?: unknown } } | null | undefined)?.failure?.cause;\n return typeof cause === 'string' && cause !== 'server';\n}\n\nconst sanitizeConnectionMessage = (message: string): string | undefined => {\n const printable = Array.from(message, (character) => {\n const code = character.charCodeAt(0);\n return code < 32 || code === 127 ? ' ' : character;\n })\n .join('')\n .replace(/\\s+/g, ' ')\n .trim();\n return printable ? printable.slice(0, 200) : undefined;\n};\n\n/**\n * Project the raw statewire connection into the vocabulary every Athena\n * surface renders from ({@link DeepAgentConnectionState}), including sanitized\n * host detail for the connecting and disconnected states.\n *\n * This switch is the ONLY reader of the library's connection union\n * (`connecting | connected | disconnected` with its disconnect reason): the\n * auth-denial tracker, the diagnostics recorder, and every connection\n * indicator consume the projection instead, so a future redesign of that\n * vocabulary is absorbed here — the exhaustive `never` check fails the\n * typecheck the moment the union changes, rather than letting an unknown\n * status leak into the indicators as an unstyled string.\n */\nexport function projectDeepAgentConnection(\n connection: StatewireClient.ConnectionState\n): DeepAgentConnectionState {\n switch (connection.status) {\n case 'connected':\n return { status: 'connected', degraded: false };\n case 'connecting': {\n const message =\n connection.message === undefined\n ? undefined\n : sanitizeConnectionMessage(connection.message);\n return {\n status: 'connecting',\n attempt: connection.attempt,\n ...(connection.cause !== undefined && { cause: connection.cause }),\n ...(connection.lastError !== undefined && { lastError: connection.lastError }),\n ...(message !== undefined && { message }),\n // A first dial is expected; a retry means the channel dropped.\n degraded: connection.attempt > 0,\n };\n }\n case 'disconnected': {\n const message =\n connection.message === undefined\n ? undefined\n : sanitizeConnectionMessage(connection.message);\n return {\n status: 'disconnected',\n reason: connection.reason,\n ...(message !== undefined && { message }),\n // Parked (`deferred`) and quiet (`idle`) channels are healthy; only a\n // terminal loss is degraded.\n degraded: connection.reason === 'gone',\n };\n }\n default:\n return unknownConnectionStatus(connection);\n }\n}\n\n/** Compile-time exhaustiveness: reachable only when the library grows a status this build does not project. */\nfunction unknownConnectionStatus(connection: never): never {\n throw new Error(\n `statewire: unknown connection status ${JSON.stringify(\n (connection as { status?: unknown }).status\n )}`\n );\n}\n","/**\n * Human-in-the-loop interrupt primitives shared by every statewire chat\n * surface (Olympus, the React SDK, the Office add-in, the Chrome extension,\n * mobile).\n *\n * The agora deep-agent runtime parks a gated run on an `interrupt` input\n * request whose payload carries the Athena `hitl_approval` shape\n * (`athena_deep_agent/hitl_bridge.py`). A surface answers it with\n * `{ type: 'run/input', requestId, response: { type: 'resume', value } }` —\n * the exact command the backend's resume path consumes. This module holds the\n * payload contract (narrowing, resume values) and the shared resume-lock state\n * machine; rendering stays with each surface.\n *\n * Deliberately parameterized rather than self-wiring: these helpers never call\n * `useStatewireRuns`/`useAuiState` themselves. Each surface reads its own\n * statewire hooks (which its tests already mock) and passes the values in, so\n * the shared semantics cannot drift while per-surface wiring stays testable.\n */\n\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { hasClientToolInterruptSource } from './client-tools';\nimport { readDeepAgentStreamValues } from './statewire-state';\n\n/** Human-in-the-loop approval payload the agora deep-agent runtime parks a run\n * on (shaped by `athena_deep_agent/hitl_bridge.py`). */\nexport interface HitlApprovalPayload {\n source: string;\n type: string;\n message: string;\n /** Risk headline/facts/warnings, when the host includes them. */\n approval_context?: unknown;\n context?: {\n tool_name?: string;\n tool_id?: string;\n tool_call_id?: string;\n tool_args?: Record<string, unknown>;\n pending_action_count?: number;\n approval_context?: unknown;\n /**\n * Every pending gated call (name + args), in decision order. Absent on\n * older backends — fall back to the single `tool_name`/`tool_args` pair.\n * Per-dispatch payloads also carry each lane's `tool_call_id` (the lane\n * card key) and `interrupt_id` (the lane resume key).\n */\n action_requests?: {\n name?: string;\n args?: Record<string, unknown>;\n tool_call_id?: string;\n interrupt_id?: string;\n }[];\n /**\n * True when each dispatch parked on its own interrupt: decisions submit\n * per lane via `lane_decisions` and each approved lane starts immediately,\n * instead of the legacy batch where one resume must answer every lane.\n */\n per_dispatch?: boolean;\n };\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** A pending `interrupt` input request; a present `response` key marks it answered. */\nexport function isPendingInterrupt(\n request: StatewireThread.InputRequestState,\n): request is StatewireThread.CustomInputRequest {\n return request.type === 'interrupt' && !('response' in request);\n}\n\n/**\n * A pending interrupt an approval card may answer. Client-tool parks are\n * excluded — the client-tool bridge owns those, and a generic Continue resume\n * would corrupt the parked tool call. The source check is deliberately loose\n * (any payload stamped with the client-tool source) so a skewed deploy can\n * never route one here.\n */\nexport function isApprovalCardInterrupt(\n request: StatewireThread.InputRequestState,\n): request is StatewireThread.CustomInputRequest {\n if (!isPendingInterrupt(request)) return false;\n return !hasClientToolInterruptSource((request as { payload?: unknown }).payload);\n}\n\n/** Narrow an interrupt payload to the Athena HITL approval shape. */\nexport function asHitlApproval(value: unknown): HitlApprovalPayload | null {\n if (!isRecord(value)) return null;\n return value.type === 'hitl' &&\n value.source === 'hitl_approval' &&\n typeof value.message === 'string'\n ? (value as unknown as HitlApprovalPayload)\n : null;\n}\n\n/** Default paused-run copy when an interrupt payload carries no message. */\nexport const DEFAULT_INTERRUPT_PAUSED_MESSAGE =\n 'The agent is paused and waiting for input.';\n\n/** Best-effort human-readable message from any interrupt payload. */\nexport function readInterruptMessage(\n value: unknown,\n fallback: string = DEFAULT_INTERRUPT_PAUSED_MESSAGE,\n): string {\n if (isRecord(value) && typeof value.message === 'string' && value.message.length > 0) {\n return value.message;\n }\n return fallback;\n}\n\nexport interface PendingActionRequest {\n name: string;\n args: Record<string, unknown>;\n /** The lane's `task` tool-call id (present on per-dispatch payloads). */\n toolCallId?: string;\n /** The lane's langgraph interrupt id — the `lane_decisions` resume key. */\n interruptId?: string;\n}\n\n/**\n * Every gated call this approval covers, in decision order. One resume answers\n * ALL of them, so every entry must stay reviewable somewhere. Falls back to\n * the single first-call fields on older backends without `action_requests`.\n */\nexport function pendingActionRequests(hitl: HitlApprovalPayload | null): PendingActionRequest[] {\n const context = hitl?.context;\n if (!context) return [];\n // The payload crosses the wire with only its top-level shape narrowed\n // (`asHitlApproval`), so the nested collection must be validated before any\n // array/property access: a malformed host value must degrade to \"no\n // reviewable entries\", never crash the approval surface.\n const requests: Record<string, unknown>[] = Array.isArray(context.action_requests)\n ? context.action_requests.filter(isRecord)\n : context.tool_name && context.tool_args\n ? [{ name: context.tool_name, args: context.tool_args }]\n : [];\n return requests.map((request) => ({\n name: typeof request.name === 'string' ? request.name : 'tool',\n args: isRecord(request.args) ? request.args : {},\n ...(typeof request.tool_call_id === 'string' && { toolCallId: request.tool_call_id }),\n ...(typeof request.interrupt_id === 'string' && { interruptId: request.interrupt_id }),\n }));\n}\n\n/** An interrupt a non-resume dispatch dropped, published by the host. */\nexport interface AbandonedInputRequest {\n id: string;\n type: string;\n}\n\n/**\n * `useStatewireState` selector body for the host-published abandoned input\n * requests. Reads through {@link readDeepAgentStreamValues} so the selector is\n * safe on the pre-attach (`undefined`) wire state, and returns the raw array\n * reference so the subscription stays shallow-stable — derive (`.find`) on the\n * result, never inside the selector.\n */\nexport function readAbandonedInputRequests(\n state: unknown,\n): readonly AbandonedInputRequest[] | undefined {\n const abandoned = readDeepAgentStreamValues(state).abandonedInputRequests;\n // Wire value: anything non-array (including a malformed host publication)\n // reads as \"none\" rather than crashing the consuming surface. Identity-\n // preserving for the valid case, so it stays selector-safe.\n return Array.isArray(abandoned)\n ? (abandoned as readonly AbandonedInputRequest[])\n : undefined;\n}\n\n/** The abandoned `interrupt` entry, if any — the \"approval was cancelled\" notice. */\nexport function findAbandonedInterrupt(\n abandoned: readonly AbandonedInputRequest[] | undefined,\n): AbandonedInputRequest | undefined {\n return abandoned?.find(\n (request) => isRecord(request) && request.type === 'interrupt' && typeof request.id === 'string',\n );\n}\n\n/** Canonical reason string carried by a user rejection. */\nexport const HITL_REJECT_REASON = 'User rejected the action.';\n\n/**\n * Default {@link UseApprovalResumeLockOptions.pendingResumeGraceMs} for every\n * approval surface: how long a clicked decision waits for its resume run to\n * start before the actions unlock again. Covers a `run/input` the host\n * rejected or a disconnected transport swallowed before any run began — the\n * one failure neither identity-change nor observed-run recovery can detect.\n */\nexport const HITL_PENDING_RESUME_GRACE_MS = 15_000;\n\n/** `run/input` resume value approving the gated call(s). */\nexport function hitlResumeApprove(): Record<string, string> {\n return { action: 'approve' };\n}\n\n/** `run/input` resume value rejecting the gated call(s). */\nexport function hitlResumeReject(reason: string = HITL_REJECT_REASON): Record<string, string> {\n return { action: 'reject', reason };\n}\n\n/** `run/input` resume value for a non-HITL park (generic Continue). */\nexport function hitlResumeContinue(): Record<string, string> {\n return { action: 'continue' };\n}\n\nexport interface UseApprovalResumeLockOptions<TValue> {\n /** The pending interrupt's request id (`undefined` when nothing is parked). */\n requestId: string | undefined;\n /** The surface's thread `isRunning` read (mockable per surface). */\n isRunning: boolean;\n /** Dispatch the `run/input` resume for `requestId` on the surface's transport. */\n sendResume: (requestId: string, value: TValue) => void;\n /**\n * Re-enable the actions when no resume run started within this window —\n * covers a `run/input` that was rejected or lost before any run began, so\n * neither reset path below can fire. Omit to keep the pre-existing surface\n * behavior of staying locked until a resume run is observed.\n */\n pendingResumeGraceMs?: number;\n}\n\nexport interface ApprovalResumeLock<TValue> {\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /** Send the resume value, locking the actions. No-op while pending or unparked. */\n resume: (value: TValue) => void;\n}\n\n/**\n * Optimistic action lock shared by every approval surface: disable the\n * decision buttons the moment one is clicked, until the request identity\n * changes (it clears after the resume, or a fresh interrupt arrives). This\n * closes the double-click → duplicate-resume window.\n *\n * Recovery paths, in order of specificity:\n * 1. Identity change — the resume landed (or a new interrupt replaced the\n * request). Reset during render via React's \"previous value\" pattern.\n * 2. A resume run was observed starting and then settling with the request\n * still pending (failed/cancelled resume) — clear the lock so the user can\n * answer again.\n * 3. Optional grace window ({@link UseApprovalResumeLockOptions.pendingResumeGraceMs})\n * for a `run/input` that never started a run at all.\n */\nexport function useApprovalResumeLock<TValue = Record<string, string>>(\n options: UseApprovalResumeLockOptions<TValue>,\n): ApprovalResumeLock<TValue> {\n const { requestId, isRunning, sendResume, pendingResumeGraceMs } = options;\n\n const [pending, setPending] = useState(false);\n const prevRequestIdRef = useRef(requestId);\n if (prevRequestIdRef.current !== requestId) {\n prevRequestIdRef.current = requestId;\n if (pending) setPending(false);\n }\n\n // Track the resume run we kicked off (isRunning observed true→false while\n // pending) and clear `pending` when it ends with the request unresolved.\n const sawResumeRunRef = useRef(false);\n useEffect(() => {\n if (!pending) {\n sawResumeRunRef.current = false;\n return;\n }\n if (isRunning) {\n sawResumeRunRef.current = true;\n return;\n }\n if (sawResumeRunRef.current) {\n sawResumeRunRef.current = false;\n setPending(false);\n }\n }, [pending, isRunning]);\n\n // Pre-start failure recovery: re-enable after the grace window when no\n // resume run began; answering the still-parked request again is exactly\n // what the user needs to be able to do.\n useEffect(() => {\n if (!pending || pendingResumeGraceMs === undefined) return;\n const timer = setTimeout(() => {\n if (!sawResumeRunRef.current) setPending(false);\n }, pendingResumeGraceMs);\n return () => clearTimeout(timer);\n }, [pending, requestId, pendingResumeGraceMs]);\n\n const sendResumeRef = useRef(sendResume);\n sendResumeRef.current = sendResume;\n const pendingRef = useRef(pending);\n pendingRef.current = pending;\n\n const resume = useCallback(\n (value: TValue) => {\n if (requestId === undefined || pendingRef.current) return;\n setPending(true);\n pendingRef.current = true;\n sendResumeRef.current(requestId, value);\n },\n [requestId],\n );\n\n return { pending, resume };\n}\n","/**\n * Derivations for the server-owned statewire queue and steer lanes, shared by\n * every queued-messages tray (Olympus, the React SDK, the Chrome extension).\n *\n * The queue is SERVER-owned: statewire surfaces it on the runs projection.\n * \"Send now\" moves an item into the steer lane (`run/steer` — the host stops\n * the run and dispatches it once the run settles; on a stopped/errored thread\n * the same move dispatches immediately as a stop-/error-continue run) and\n * remove issues `run/dequeue`. While the thread rests stopped/errored,\n * stranded steer-lane entries list ahead of the queue — they dispatch first,\n * as one batch, so they carry Remove but no per-row Send now.\n *\n * Pure helpers only: the host component reads `useStatewireRuns()` and\n * `useDeepAgentThreadStatus()` itself (both mockable per surface) and passes\n * the values in.\n */\n\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { ATHENA_RUN_MARKER_CANCELLED, ATHENA_STOP_SOURCE_POD_DRAIN } from './messages';\nimport type { DeepAgentThreadStatus } from './thread-status';\n\n/** The text content of a queued entry (non-text parts render as fallbacks). */\nexport function queueEntryText(\n parts: readonly { type: string; text?: string }[],\n): string {\n return parts\n .flatMap((part) =>\n part.type === 'text' && typeof part.text === 'string' ? [part.text] : [],\n )\n .join('\\n\\n');\n}\n\n/**\n * Whether a lane entry is still awaiting its send's settle: the host stamps\n * `meta` on every entry it admits (`_op_meta` — submitter and contextSync\n * snapshot), so a meta-less entry is this client's own optimistic fold. The\n * send is still in flight and can still be refused (billing gate, auth,\n * reconnect), which the tray must not render as an accepted queue position.\n */\nexport function isQueueEntryUnsettled(entry: StatewireThread.RunsQueueEntry): boolean {\n return entry.meta === undefined;\n}\n\n/**\n * The ids of queued entries the user prioritized (⚡ — `run/prioritize`), as\n * the host records them in its durable `prioritizedQueueIds` state. A\n * prioritized entry heads the queue lane and the live run ends at its next\n * model-call boundary to deliver it, so trays render these rows lit and offer\n * \"Remove priority\" instead of \"Prioritize\". Tolerates the key being absent\n * (a thread that never prioritized, a pre-feature host) and ignores anything\n * that is not a string id.\n */\nexport function readPrioritizedQueueIds(raw: unknown): readonly string[] {\n return Array.isArray(raw)\n ? raw.filter((id): id is string => typeof id === 'string')\n : [];\n}\n\nexport interface QueueLaneFlags {\n isRunning: boolean;\n /** A stopped/errored thread can continue with its queued work. */\n isContinuable: boolean;\n}\n\n/** The thread-status split every queue tray keys its affordances on. */\nexport function queueLaneFlags(status: DeepAgentThreadStatus): QueueLaneFlags {\n return {\n isRunning: status === 'running',\n isContinuable: status === 'stopped' || status === 'error',\n };\n}\n\nexport interface StatewireQueueRow {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n}\n\n/**\n * The rows a queue tray renders, in dispatch order: stranded steer-lane\n * entries first (only while the thread rests continuable — during a run they\n * already render in the message list), then the queue lane.\n */\nexport function buildStatewireQueueRows(options: {\n queue: readonly StatewireThread.RunsQueueEntry[];\n steerQueue: readonly StatewireThread.RunsQueueEntry[];\n isContinuable: boolean;\n}): StatewireQueueRow[] {\n const { queue, steerQueue, isContinuable } = options;\n return [\n ...(isContinuable\n ? steerQueue.map((item) => ({ item, lane: 'steer' as const }))\n : []),\n ...queue.map((item) => ({ item, lane: 'queue' as const })),\n ];\n}\n\n/**\n * Whether a row offers \"Send now\": queue-lane rows only (steer entries already\n * dispatch first), every row while the thread rests continuable, and only the\n * head row while a run is live (later rows would jump the queue order).\n */\nexport function showQueueRowSendNow(options: {\n lane: 'queue' | 'steer';\n index: number;\n isRunning: boolean;\n isContinuable: boolean;\n}): boolean {\n const { lane, index, isRunning, isContinuable } = options;\n return lane === 'queue' && (isContinuable || (isRunning && index === 0));\n}\n\nexport type QueueEditCommand =\n | { type: 'run/steer'; runId: string; message: StatewireThread.UserMessage }\n | { type: 'run/enqueue'; runId: string; message: StatewireThread.UserMessage };\n\n/**\n * Re-send a queued entry under its own id on its own lane with edited text:\n * the host replaces the queued message's content in place, leaving its queue\n * position and lane untouched (a same-id send never dispatches). The built-in\n * queue client has no update command, so this goes straight to the runs\n * protocol. Returns `null` when there is nothing to send — blank or unchanged\n * text, or no live run entry to address.\n */\nexport function buildQueueEditCommand(options: {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n runId: string | null;\n text: string;\n}): QueueEditCommand | null {\n const { item, lane, runId, text } = options;\n if (!text.trim() || text === queueEntryText(item.parts) || runId === null) {\n return null;\n }\n const message: StatewireThread.UserMessage = {\n id: item.id,\n role: 'user',\n parts: [{ type: 'text', text }, ...item.parts.filter((part) => part.type !== 'text')],\n ...(item.metadata === undefined ? {} : { metadata: item.metadata }),\n };\n return lane === 'steer'\n ? { type: 'run/steer', runId, message }\n : { type: 'run/enqueue', runId, message };\n}\n\n/**\n * Grace between observing a stranded settle and auto-promoting the queue\n * head — long enough for the host's own settle bookkeeping (or a status flap\n * during reconnect) to resolve first, short enough to read as \"it just\n * continued\" rather than \"it hung\".\n */\nexport const QUEUE_AUTO_CONTINUE_DELAY_MS = 2_000;\n\n/**\n * Whether the transcript tail's run marker forbids auto-continuing a stranded\n * queue. An acknowledged user stop never auto-resumes; infrastructure does:\n * any cancellation marker other than a pod-drain pause (user stop, send-now\n * plumbing, transport cancel, unattributed) keeps the queue parked behind the\n * manual Continue pill. A failed marker or no marker at all — the first-run\n * dispatch that died before checkpointing anything — does not block.\n */\nexport function userStopBlocksQueueAutoContinue(options: {\n marker: string | undefined;\n source: string | undefined;\n}): boolean {\n return (\n options.marker === ATHENA_RUN_MARKER_CANCELLED &&\n options.source !== ATHENA_STOP_SOURCE_POD_DRAIN\n );\n}\n\n/** `fate (cause)[: message]` — the detail a failed-send row carries. */\nexport function describeQueueSendFailure(\n failure: StatewireThread.RunsFailedEntry['sendFailure'],\n): string {\n const message =\n 'message' in failure && failure.message !== undefined ? `: ${failure.message}` : '';\n return `${failure.fate} (${failure.cause})${message}`;\n}\n\n/**\n * Whether a `retryFailed` / `discardFailed` throw is the covered drop race:\n * statewire drops a failed entry on its own as soon as a canonical update\n * shows the message landed, and acting on a just-dropped entry throws. Both\n * the session record (\"unknown failed command\") and the adapter's projection\n * (\"unknown failed entry\") use this prefix. Nothing is lost in that race — the\n * message already made it and the row is about to disappear — so a tray\n * swallows it (keeping telemetry) instead of crashing the click handler.\n */\nexport function isFailedSendEntryRace(error: unknown): boolean {\n return error instanceof Error && error.message.startsWith('statewire: unknown failed');\n}\n","/**\n * The statewire hooks read the NEAREST aui thread's extras and throw when those\n * aren't statewire extras — which is the case inside nested read-only runtimes\n * (e.g. a transcript drawer) and on legacy (non-statewire) threads. Duck-type\n * the pieces the statewire components actually consume; a wider shape check\n * would silently hide live affordances if the library ever drops an unrelated\n * field.\n */\nexport function hasStatewireThreadExtras(extras: unknown): boolean {\n if (!extras || typeof extras !== 'object') return false;\n const candidate = extras as Record<string, unknown>;\n return (\n typeof candidate.sendCommand === 'function' &&\n Array.isArray(candidate.inputRequests) &&\n typeof candidate.runs === 'object' &&\n candidate.runs !== null\n );\n}\n\nexport interface StatewireFailedActions {\n retryFailed: (messageId: string) => void;\n discardFailed: (messageId: string) => void;\n}\n\n/** One projected failed run send: the message id plus the failure that\n * retained it (`runs.failed` entry, structurally). */\nexport interface StatewireFailedSendEntry {\n id: string;\n sendFailure: {\n fate: string;\n /**\n * Set on an `aborted` send that was never attempted because an earlier\n * send in the same detach batch WAS attempted and settled `lost`: the\n * library cannot know whether that predecessor ran, so the successor\n * must not be re-dispatched ahead of it (`StatewireClient.SendFailure`).\n */\n predecessorLost?: boolean;\n };\n}\n\n/** The failed-send lane surface the send-recovery controller consumes. */\nexport interface StatewireFailedSendLane {\n failed: readonly StatewireFailedSendEntry[];\n /** Re-dispatches the entry against the current thread — same message id,\n * re-anchored — and removes it from the lane. Throws for unknown ids. */\n retryFailed: (messageId: string) => void;\n}\n\nfunction isFailedSendEntry(value: unknown): value is StatewireFailedSendEntry {\n if (!value || typeof value !== 'object') return false;\n const entry = value as { id?: unknown; sendFailure?: { fate?: unknown } };\n return typeof entry.id === 'string' && typeof entry.sendFailure?.fate === 'string';\n}\n\n/**\n * The failed-send lane off a statewire thread's extras, or `null` when the\n * extras are not a statewire thread's (nested read-only runtimes, legacy\n * threads) — same duck-typing posture as {@link hasStatewireThreadExtras}.\n */\nexport function readStatewireFailedSendLane(extras: unknown): StatewireFailedSendLane | null {\n if (!extras || typeof extras !== 'object') return null;\n const candidate = extras as {\n runs?: { failed?: unknown };\n retryFailed?: unknown;\n };\n const failed = candidate.runs?.failed;\n if (!Array.isArray(failed) || typeof candidate.retryFailed !== 'function') return null;\n return {\n failed: failed.filter(isFailedSendEntry),\n retryFailed: candidate.retryFailed as StatewireFailedSendLane['retryFailed'],\n };\n}\n\n/** The failed-send lane actions off a statewire thread's extras, or throw. */\nexport function requireStatewireFailedActions(extras: unknown): StatewireFailedActions {\n if (!extras || typeof extras !== 'object') {\n throw new Error('Failed-send actions require a Statewire thread');\n }\n const candidate = extras as Record<string, unknown>;\n if (\n typeof candidate.retryFailed !== 'function' ||\n typeof candidate.discardFailed !== 'function'\n ) {\n throw new Error('Failed-send actions require a Statewire thread');\n }\n return candidate as unknown as StatewireFailedActions;\n}\n","import { useStatewireSendCommand, useStatewireState } from '@assistant-ui/react-statewire';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { DEEP_AGENT_MESSAGES_WINDOW_STATE_KEY } from './generated/runconfig-contract';\nimport {\n buildHistoryLoadCommand,\n buildToolOutputCommand,\n type DeepAgentMessagesWindow,\n type HistoryLoadResult,\n readDeepAgentMessagesWindow,\n readHistoryLoadResult,\n readToolOutputResult,\n readTruncatedToolOutputArtifact,\n} from './message-window';\nimport type { DeepAgentToolOutputStore } from './tool-outputs';\n\n/**\n * Pages of older history chained per approach to the top. A renderer lowers\n * its near-top level once prepended content has pushed the first message out\n * of its band; this bounds the case where it cannot (no viewport to scroll,\n * a list too short to overflow) so a 2,000-message thread never streams whole.\n */\nexport const DEEP_AGENT_MAX_CHAINED_HISTORY_LOADS = 3;\n\n/** The converted thread messages the tool-output half scans (web and native `ThreadMessage` both satisfy it). */\nexport interface DeepAgentWindowSyncMessage {\n readonly id: string;\n readonly content: readonly { readonly type: string; readonly artifact?: unknown }[];\n}\n\n/** One `history/load` round trip, for the host's telemetry. */\nexport interface DeepAgentHistoryLoadEvent {\n beforeIndex: number;\n limit: number;\n /** The host's answer, or `null` when it was not a history-load result. */\n result: HistoryLoadResult | null;\n durationMs: number;\n}\n\nexport interface UseDeepAgentWindowSyncOptions {\n /**\n * The converted thread messages — read by the host through its platform\n * `useAuiState((s) => s.thread.messages)`, so this hook imports neither\n * `@assistant-ui/react` nor `@assistant-ui/react-native`.\n */\n messages: readonly DeepAgentWindowSyncMessage[];\n /**\n * Full tool outputs fetched back for cut tool messages; the same store the\n * thread converts with (`useDeepAgentThread({ toolOutputs })`). Omitted, the\n * tool-output half is inert (a surface that never shows a cut output whole).\n */\n toolOutputs?: DeepAgentToolOutputStore | undefined;\n /**\n * The renderer's report that the top of the LOADED history is near — a\n * level, not an edge: while it holds and older messages exist, pages load\n * one after another (bounded by `maxChainedLoads` per approach). Omitted for\n * hosts with only a manual affordance (`loadOlder`).\n */\n nearTop?: boolean;\n /** Bumped on every rise of `nearTop` (and every explicit request), so the chain bound is per approach. */\n nearTopEpoch?: number;\n /**\n * Whether a message's content is mounted right now, so lazy fetches (cut\n * tool outputs) target what the user can see rather than the whole loaded\n * history. Omitted: every message counts as mounted (the flat renderers).\n */\n isMessageMounted?: ((messageId: string) => boolean) | undefined;\n maxChainedLoads?: number;\n /** A `history/load` settled (telemetry). */\n onHistoryLoad?: ((event: DeepAgentHistoryLoadEvent) => void) | undefined;\n /** A read command failed; the sync itself recovers (the pending marks are released). */\n onError?: ((error: unknown, command: 'history/load' | 'history/tool_output') => void) | undefined;\n now?: () => number;\n}\n\nexport interface DeepAgentWindowSyncState {\n /** The lane, or `null` on a wire that is not windowed (both halves are inert). */\n window: DeepAgentMessagesWindow | null;\n /** Messages older than the loaded window the server still holds. */\n olderCount: number;\n /** A page of older history is in flight. */\n loading: boolean;\n /** Ask for the next page of older history now (an edge row's button, a keypress). A no-op on a wire that is not windowed or at the beginning. */\n loadOlder: () => void;\n}\n\n/** The raw lane, selected without derivation (selectors compare by identity). */\nfunction selectMessagesWindowLane(state: unknown): unknown {\n return typeof state === 'object' && state !== null\n ? (state as Record<string, unknown>)[DEEP_AGENT_MESSAGES_WINDOW_STATE_KEY]\n : undefined;\n}\n\n/** The `messagesWindow` lane of the nearest statewire thread, or `null` when the wire is not windowed. */\nexport function useDeepAgentMessagesWindow(): DeepAgentMessagesWindow | null {\n const lane = useStatewireState(selectMessagesWindowLane);\n return useMemo(\n () => readDeepAgentMessagesWindow({ [DEEP_AGENT_MESSAGES_WINDOW_STATE_KEY]: lane }),\n [lane]\n );\n}\n\nconst everyMessageMounted = (): boolean => true;\nconst defaultNow = (): number => Date.now();\n\n/**\n * The client half of the windowed wire, shared by every surface that declares\n * a message window (`useDeepAgentThread({ messageWindow })`) — mounted once\n * per runtime, inside its aui provider.\n *\n * - **Older history.** While the host renderer reports the top of the loaded\n * history near (`nearTop`) and the `messagesWindow` lane says older\n * messages exist, this sends `history/load` for the next page — the host\n * prepends it as ops for this client alone — chaining at most\n * `maxChainedLoads` pages per approach; `loadOlder` asks for one page on\n * demand (an edge row's button). Never two loads in flight.\n * - **Cut tool outputs.** Tool cards whose output the wire carried cut\n * (`artifact._athena_content_truncated`) get it fetched whole through\n * `history/tool_output` once their message is mounted; the converter puts\n * it back (`toolOutputs`), so the card re-renders complete. An output the\n * host replaced since (the marker's `chars` changed) is fetched again.\n *\n * On a thread whose wire is not windowed (no lane) both halves are inert.\n */\nexport function useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop = false,\n nearTopEpoch = 0,\n isMessageMounted = everyMessageMounted,\n maxChainedLoads = DEEP_AGENT_MAX_CHAINED_HISTORY_LOADS,\n onHistoryLoad,\n onError,\n now = defaultNow,\n}: UseDeepAgentWindowSyncOptions): DeepAgentWindowSyncState {\n const sendCommand = useStatewireSendCommand();\n const window = useDeepAgentMessagesWindow();\n const [loading, setLoading] = useState(false);\n const [requests, setRequests] = useState(0);\n // Bumped when a page settled AFTER its ops moved the lane (the host's\n // order: prepend, then answer), so the chain re-evaluates against the moved\n // window instead of waiting for another signal.\n const [settledLoads, setSettledLoads] = useState(0);\n const servedRequestsRef = useRef(0);\n const inflightRef = useRef<number | null>(null);\n const chainRef = useRef({ epoch: 0, loads: 0 });\n const aliveRef = useRef(true);\n const windowRef = useRef(window);\n windowRef.current = window;\n // Outputs already asked for and answered by this mount — fetched, refused,\n // or failed — by the `chars` they were asked for. The converter re-runs on\n // every wire change, and the store is a bounded LRU: without this memory a\n // refused read would leave on every pass, and once a transcript holds more\n // cut outputs than the store retains, each fetch would evict a still-loaded\n // output and the next pass would fetch it again, forever. An evicted output\n // renders its cut text (the REST display limit) rather than re-entering the\n // loop; a marker whose `chars` moved (the host replaced the output) is asked\n // for again.\n const answeredRef = useRef(new Map<string, number>());\n const onHistoryLoadRef = useRef(onHistoryLoad);\n onHistoryLoadRef.current = onHistoryLoad;\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n const nowRef = useRef(now);\n nowRef.current = now;\n useEffect(() => {\n aliveRef.current = true;\n return () => {\n aliveRef.current = false;\n };\n }, []);\n\n useEffect(() => {\n if (window === null || window.start === 0 || inflightRef.current !== null) return;\n const requested = requests !== servedRequestsRef.current;\n if (requested) {\n // An explicit ask re-arms the chain for this approach.\n servedRequestsRef.current = requests;\n chainRef.current = { epoch: nearTopEpoch, loads: 1 };\n } else {\n if (!nearTop) return;\n if (chainRef.current.epoch !== nearTopEpoch) {\n chainRef.current = { epoch: nearTopEpoch, loads: 0 };\n }\n if (chainRef.current.loads >= maxChainedLoads) return;\n chainRef.current.loads += 1;\n }\n const command = buildHistoryLoadCommand({ window });\n if (command === null) return;\n inflightRef.current = command.beforeIndex;\n setLoading(true);\n const startedAt = nowRef.current();\n Promise.resolve(sendCommand(command))\n .then((payload) => {\n onHistoryLoadRef.current?.({\n beforeIndex: command.beforeIndex,\n limit: command.limit,\n result: readHistoryLoadResult(payload),\n durationMs: Math.max(0, Math.round(nowRef.current() - startedAt)),\n });\n })\n .catch((error: unknown) => {\n onErrorRef.current?.(error, 'history/load');\n })\n .finally(() => {\n inflightRef.current = null;\n if (!aliveRef.current) return;\n setLoading(false);\n if (windowRef.current?.start !== command.beforeIndex) {\n setSettledLoads((count) => count + 1);\n }\n });\n }, [nearTop, nearTopEpoch, requests, settledLoads, window, sendCommand, maxChainedLoads]);\n\n useEffect(() => {\n if (window === null || toolOutputs === undefined) return;\n for (const message of messages) {\n if (!isMessageMounted(message.id)) continue;\n for (const part of message.content) {\n if (part.type !== 'tool-call') continue;\n const marker = readTruncatedToolOutputArtifact(part.artifact);\n if (marker === null || toolOutputs.isPending(marker.messageId)) continue;\n // Fetched for this very length already; a different length means the\n // host replaced the output under the same id since.\n if (toolOutputs.entry(marker.messageId)?.chars === marker.chars) continue;\n if (answeredRef.current.get(marker.messageId) === marker.chars) continue;\n const { messageId, chars } = marker;\n toolOutputs.markPending(messageId);\n Promise.resolve(sendCommand(buildToolOutputCommand({ messageId })))\n .then((payload) => {\n answeredRef.current.set(messageId, chars);\n const result = readToolOutputResult(payload);\n if (result === null) {\n toolOutputs.clearPending(messageId);\n return;\n }\n toolOutputs.set(result.messageId, { content: result.content, chars });\n })\n .catch((error: unknown) => {\n answeredRef.current.set(messageId, chars);\n toolOutputs.clearPending(messageId);\n onErrorRef.current?.(error, 'history/tool_output');\n });\n }\n }\n }, [messages, isMessageMounted, window, sendCommand, toolOutputs]);\n\n const loadOlder = useCallback(() => {\n setRequests((count) => count + 1);\n }, []);\n\n return { window, olderCount: window?.start ?? 0, loading, loadOlder };\n}\n","import type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { useAuiState } from '@assistant-ui/store';\n\nexport type DeepAgentThreadStatus = StatewireThread.ThreadStatus;\n\n/**\n * Runtime-scoped thread status, as the library presents it: `\"loading\"` /\n * `\"ready\"` / the run's status replicated by the host, with a mid-run\n * connection loss presented as `\"evicted\"` (server-update pod drain) or\n * `\"disconnected\"` instead of `\"running\"`. Throws outside a statewire aui\n * provider, matching react-statewire 0.13's removed `useStatewireThreadStatus`.\n */\nexport function useDeepAgentThreadStatus(): DeepAgentThreadStatus {\n return useAuiState((s) => {\n const status = (s.thread.extras as Partial<StatewireThread.Extras> | undefined)?.status;\n if (status === undefined) {\n throw new Error('useDeepAgentThreadStatus requires a statewire thread');\n }\n return status;\n });\n}\n","/**\n * Typed runtime messages — the one description of \"the runtime ended this run\"\n * that every chat surface renders from.\n *\n * The deep-agent backend records how a run ended in two shapes that ride\n * ordinary `ai` messages (a new LangChain message type would crash the shipped\n * converter, whose convertible set is closed):\n *\n * - a **run-lifecycle marker** (`athena_run_marker`: `cancelled` / `failed`,\n * plus `athena_run_marker_source`) — see {@link readRunMarkerFromSourceMessages};\n * - a **handoff message** (`athena_handoff: true`) — the closing summary the\n * runtime asked the model to write when a guard or the step budget ended the\n * run, instead of fabricating an internal sentence.\n *\n * Both now carry the canonical `athena_termination_reason`\n * (`agora/graphs/athena_deep_agent/termination.py`). This module reads all of\n * that into one {@link AthenaRuntimeMessage} so Olympus, mobile, the Chrome\n * extension, and the Office add-in agree on kind, severity, copy, and the\n * sole-vs-grouped distinction — the last of which is load-bearing: a marker\n * appended after the assistant's own work is chunked into that message, and\n * replacing the whole row would hide completed prose and tool cards.\n */\n\nimport { getExternalStoreMessages } from '@assistant-ui/core';\nimport type { LangChainMessage } from '@assistant-ui/react-langgraph';\nimport {\n ATHENA_HANDOFF_KEY,\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n ATHENA_RUN_MARKER_KEY,\n ATHENA_RUN_MARKER_SOURCE_KEY,\n ATHENA_STOP_SOURCE_POD_DRAIN,\n ATHENA_STOP_SOURCE_SEND_NOW,\n ATHENA_TERMINATION_REASON_KEY,\n} from './messages';\n\n/** The backend's canonical reason vocabulary (`KNOWN_TERMINATION_REASONS`). */\nexport const TERMINATION_REASONS = [\n 'completed',\n 'user_stop',\n 'send_now',\n 'transport_cancel',\n 'pod_drain',\n 'fence_lost',\n 'instance_closed',\n 'unattributed_stop',\n 'recursion_limit',\n 'step_budget',\n 'duplicate_call_guard',\n 'synthetic_stop',\n 'ended_after_tools',\n 'error',\n 'model_refusal',\n 'abandoned',\n] as const;\n\nexport type AthenaTerminationReason = (typeof TERMINATION_REASONS)[number];\n\n/**\n * How a runtime ending renders:\n * - `stopped` — a cancellation the user (or a client action) asked for;\n * - `paused` — a pod-drain pause; the run resumes from its checkpoint;\n * - `failed` — the graph raised, hit the recursion limit, or was abandoned;\n * - `handoff` — the runtime ended the run and the model wrote a closing\n * summary (the message text), which renders as prose under a banner.\n */\nexport type AthenaRuntimeMessageKind = 'stopped' | 'paused' | 'failed' | 'handoff';\n\nexport type AthenaRuntimeMessageSeverity = 'info' | 'warning' | 'error';\n\nexport interface TerminationDescription {\n /** Short label for the banner / status row. */\n title: string;\n /** One sentence of reason-specific explanation, when it adds information. */\n detail: string | undefined;\n}\n\nexport interface AthenaRuntimeMessage {\n kind: AthenaRuntimeMessageKind;\n /** Canonical reason (may be a value newer than this client knows). */\n reason: string | undefined;\n severity: AthenaRuntimeMessageSeverity;\n title: string;\n detail: string | undefined;\n /** The message's own text: a marker's backend copy, or the handoff summary. */\n text: string | undefined;\n /**\n * A `send_now` promotion cancels the live run as plumbing, not as a\n * user-visible stop: keep it in the data, paint nothing.\n */\n silent: boolean;\n /**\n * True when the runtime message is the ONLY source message behind this\n * thread message (it owns the whole row). False when the chunk also holds\n * the assistant's own work, which must keep rendering.\n */\n isSoleSourceMessage: boolean;\n}\n\nconst MAX_STEPS_HINT = 'Raise “Max steps” in the agent settings for longer runs.';\n\n/**\n * Copy for a runtime ending. Reasons this client does not know fall back to\n * the kind's generic title, so a newer backend never renders as an empty row.\n */\nexport function describeTerminationReason(\n kind: AthenaRuntimeMessageKind,\n reason: string | undefined\n): TerminationDescription {\n switch (kind) {\n case 'paused':\n return {\n title: 'Paused by a server update',\n detail: 'Progress up to this point is saved — send a message to continue.',\n };\n case 'stopped':\n switch (reason) {\n case 'transport_cancel':\n return {\n title: 'Run cancelled',\n detail:\n 'Cancelled by a page reload, navigation, or closed view — not an explicit Stop. Send a follow-up to continue.',\n };\n case 'fence_lost':\n return {\n title: 'Run superseded',\n detail: 'Another activation took over this thread.',\n };\n case 'instance_closed':\n return {\n title: 'Run stopped',\n detail: 'The client that started it went away.',\n };\n default:\n return { title: 'Conversation stopped', detail: undefined };\n }\n case 'failed':\n switch (reason) {\n case 'recursion_limit':\n return {\n title: 'Step limit reached',\n detail: `The run was stopped before finishing; the work so far is saved. ${MAX_STEPS_HINT}`,\n };\n case 'abandoned':\n return {\n title: 'Run stopped unexpectedly',\n detail:\n 'The server handling it went away mid-run (a crash, restart, or deploy). The work so far is saved.',\n };\n default:\n return { title: 'Run failed', detail: undefined };\n }\n case 'handoff':\n switch (reason) {\n case 'duplicate_call_guard':\n return {\n title: 'Run ended by the runtime',\n detail:\n 'The same tool calls were repeating with identical arguments and no new progress, so the agent was asked to wrap up.',\n };\n case 'step_budget':\n return {\n title: 'Run ended by the runtime',\n detail: `The step budget ran out, so the agent was asked to wrap up. ${MAX_STEPS_HINT}`,\n };\n default:\n return {\n title: 'Run ended by the runtime',\n detail: 'The agent was asked to wrap up.',\n };\n }\n }\n}\n\nconst SEVERITY: Record<AthenaRuntimeMessageKind, AthenaRuntimeMessageSeverity> = {\n stopped: 'info',\n paused: 'info',\n failed: 'error',\n handoff: 'warning',\n};\n\ntype Kwargs = Record<string, unknown> | undefined;\n\nfunction metadataOf(kwargs: Kwargs): Record<string, unknown> | undefined {\n const metadata = kwargs?.metadata;\n return typeof metadata === 'object' && metadata !== null\n ? (metadata as Record<string, unknown>)\n : undefined;\n}\n\n/** The termination reason stamped on `additional_kwargs` (top-level or mirror). */\nexport function readTerminationReason(kwargs: Kwargs): string | undefined {\n const top = kwargs?.[ATHENA_TERMINATION_REASON_KEY];\n if (typeof top === 'string') return top;\n const mirrored = metadataOf(kwargs)?.[ATHENA_TERMINATION_REASON_KEY];\n return typeof mirrored === 'string' ? mirrored : undefined;\n}\n\nfunction readHandoff(kwargs: Kwargs): boolean {\n return kwargs?.[ATHENA_HANDOFF_KEY] === true || metadataOf(kwargs)?.[ATHENA_HANDOFF_KEY] === true;\n}\n\nfunction textOf(content: unknown): string | undefined {\n if (typeof content === 'string') return content;\n if (!Array.isArray(content)) return undefined;\n const texts = content\n .map((block) =>\n typeof block === 'string'\n ? block\n : block && typeof block === 'object' && (block as { type?: unknown }).type === 'text'\n ? (block as { text?: unknown }).text\n : undefined\n )\n .filter((text): text is string => typeof text === 'string' && text.length > 0);\n return texts.length > 0 ? texts.join('\\n') : undefined;\n}\n\nfunction fromMarker(\n marker: string,\n source: string | undefined,\n reason: string | undefined\n): Pick<AthenaRuntimeMessage, 'kind' | 'reason' | 'silent'> | undefined {\n if (marker === ATHENA_RUN_MARKER_CANCELLED) {\n const kind: AthenaRuntimeMessageKind = source === ATHENA_STOP_SOURCE_POD_DRAIN ? 'paused' : 'stopped';\n return {\n kind,\n reason: reason ?? (source === 'unattributed' ? 'unattributed_stop' : source),\n silent: source === ATHENA_STOP_SOURCE_SEND_NOW,\n };\n }\n if (marker === ATHENA_RUN_MARKER_FAILED) {\n return { kind: 'failed', reason: reason ?? 'error', silent: false };\n }\n return undefined;\n}\n\nfunction build(\n partial: Pick<AthenaRuntimeMessage, 'kind' | 'reason' | 'silent'>,\n text: string | undefined,\n isSoleSourceMessage: boolean\n): AthenaRuntimeMessage {\n const description = describeTerminationReason(partial.kind, partial.reason);\n return {\n kind: partial.kind,\n reason: partial.reason,\n severity: SEVERITY[partial.kind],\n title: description.title,\n detail: description.detail,\n text,\n silent: partial.silent,\n isSoleSourceMessage,\n };\n}\n\n/**\n * Read the runtime ending behind a thread message, from its bound source\n * messages first (a marker or handoff chunked after the assistant's own turn\n * is never the first source, so the joined `metadata.custom` would miss it —\n * see {@link readRunMarkerFromSourceMessages}), then from joined metadata for\n * surfaces without bound sources.\n */\nexport function readRuntimeMessageFromSourceMessages(\n message: Parameters<typeof getExternalStoreMessages>[0] & {\n metadata?: { custom?: Record<string, unknown> | undefined } | undefined;\n content?: unknown;\n }\n): AthenaRuntimeMessage | undefined {\n const sources = getExternalStoreMessages<LangChainMessage>(message);\n for (const source of sources) {\n if (source?.type !== 'ai') continue;\n const kwargs = source.additional_kwargs as Kwargs;\n const marker = kwargs?.[ATHENA_RUN_MARKER_KEY];\n const reason = readTerminationReason(kwargs);\n const text = textOf(source.content);\n if (typeof marker === 'string') {\n const markerSource = kwargs?.[ATHENA_RUN_MARKER_SOURCE_KEY];\n const partial = fromMarker(\n marker,\n typeof markerSource === 'string' ? markerSource : undefined,\n reason\n );\n if (partial) return build(partial, text, sources.length === 1);\n }\n if (readHandoff(kwargs)) {\n return build({ kind: 'handoff', reason, silent: false }, text, sources.length === 1);\n }\n }\n const custom = message.metadata?.custom;\n if (!custom) return undefined;\n const parts = message.content;\n const sole = Array.isArray(parts) ? parts.length <= 1 : true;\n const joinedMarker = custom[ATHENA_RUN_MARKER_KEY];\n const joinedReason = readTerminationReason({ metadata: custom });\n if (typeof joinedMarker === 'string') {\n const joinedSource = custom[ATHENA_RUN_MARKER_SOURCE_KEY];\n const partial = fromMarker(\n joinedMarker,\n typeof joinedSource === 'string' ? joinedSource : undefined,\n joinedReason\n );\n if (partial) return build(partial, undefined, sole);\n }\n if (custom[ATHENA_HANDOFF_KEY] === true) {\n return build({ kind: 'handoff', reason: joinedReason, silent: false }, undefined, sole);\n }\n return undefined;\n}\n\n/**\n * The backend marker copy worth showing under a runtime card, or `undefined`.\n *\n * A failure marker's text carries the specific error (\"The run failed:\n * provider returned 502\"), so it is shown when no reason-specific detail\n * exists. Stop/pause copy only restates the title, and a handoff's text is the\n * message body itself, so neither is repeated. Marker copy leads with an emoji\n * for raw-transcript readers; the card's icon plays that role, so it is\n * stripped. Shared by every presenter so mobile and DOM cannot drift.\n */\nexport function runtimeMessageMarkerText(message: AthenaRuntimeMessage): string | undefined {\n if (message.kind !== 'failed' || message.detail) return undefined;\n const text = message.text?.replace(/^(?:⏹️|⏸️|⚠️|\\s)+/u, '').trim();\n if (!text || text === message.title) return undefined;\n return text;\n}\n\n/**\n * The runtime message's kind when it owns the whole row, else `undefined`.\n *\n * Returns a primitive so it is safe as a `useAuiState` selector (the reader\n * above builds a fresh object per call; an object snapshot would loop the\n * render under `Object.is` comparison).\n */\nexport function readSoleRuntimeMessageKind(\n message: Parameters<typeof readRuntimeMessageFromSourceMessages>[0]\n): AthenaRuntimeMessageKind | undefined {\n const found = readRuntimeMessageFromSourceMessages(message);\n return found?.isSoleSourceMessage ? found.kind : undefined;\n}\n","import type { DeepAgentToolOutputStore } from '@athenaintel/agent-runtime';\nimport { createContext, useContext } from 'react';\n\n/**\n * The store of full tool outputs fetched back for a windowed wire's cut tool\n * messages — the SAME instance the thread converts with\n * (`useAthenaStatewireRuntime({ toolOutputs })`), so the edge row's lazy\n * fetch and the converter's substitution meet. Provided by `AthenaProvider`\n * (one per provider, cleared with the acting identity); hosts that mount the\n * runtime themselves pass the store to `StatewireHistoryEdge` directly.\n */\nexport const StatewireToolOutputsContext = createContext<DeepAgentToolOutputStore | null>(null);\n\n/** The provider's tool-output store, or `null` outside `AthenaProvider`. */\nexport function useStatewireToolOutputs(): DeepAgentToolOutputStore | null {\n return useContext(StatewireToolOutputsContext);\n}\n","/**\n * @license lucide-react v0.575.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [[\"path\", { d: \"M21 12a9 9 0 1 1-6.219-8.56\", key: \"13zald\" }]];\nconst LoaderCircle = createLucideIcon(\"loader-circle\", __iconNode);\n\nexport { __iconNode, LoaderCircle as default };\n//# sourceMappingURL=loader-circle.js.map\n","/**\n * @license lucide-react v0.575.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"m15 9-6 6\", key: \"1uzhvr\" }],\n [\n \"path\",\n {\n d: \"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\",\n key: \"2d38gg\"\n }\n ],\n [\"path\", { d: \"m9 9 6 6\", key: \"z0biqf\" }]\n];\nconst OctagonX = createLucideIcon(\"octagon-x\", __iconNode);\n\nexport { __iconNode, OctagonX as default };\n//# sourceMappingURL=octagon-x.js.map\n","/**\n * @license lucide-react v0.575.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\",\n key: \"1a8usu\"\n }\n ],\n [\"path\", { d: \"m15 5 4 4\", key: \"1mk7zo\" }]\n];\nconst Pencil = createLucideIcon(\"pencil\", __iconNode);\n\nexport { __iconNode, Pencil as default };\n//# sourceMappingURL=pencil.js.map\n","/**\n * @license lucide-react v0.575.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\", key: \"1357e3\" }],\n [\"path\", { d: \"M3 3v5h5\", key: \"1xhq8a\" }]\n];\nconst RotateCcw = createLucideIcon(\"rotate-ccw\", __iconNode);\n\nexport { __iconNode, RotateCcw as default };\n//# sourceMappingURL=rotate-ccw.js.map\n","/**\n * @license lucide-react v0.575.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z\",\n key: \"1ffxy3\"\n }\n ],\n [\"path\", { d: \"m21.854 2.147-10.94 10.939\", key: \"12cjpa\" }]\n];\nconst Send = createLucideIcon(\"send\", __iconNode);\n\nexport { __iconNode, Send as default };\n//# sourceMappingURL=send.js.map\n","/**\n * @license lucide-react v0.575.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", key: \"afitv7\" }]\n];\nconst Square = createLucideIcon(\"square\", __iconNode);\n\nexport { __iconNode, Square as default };\n//# sourceMappingURL=square.js.map\n","/**\n * @license lucide-react v0.575.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\",\n key: \"wmoenq\"\n }\n ],\n [\"path\", { d: \"M12 9v4\", key: \"juzpu7\" }],\n [\"path\", { d: \"M12 17h.01\", key: \"p32p05\" }]\n];\nconst TriangleAlert = createLucideIcon(\"triangle-alert\", __iconNode);\n\nexport { __iconNode, TriangleAlert as default };\n//# sourceMappingURL=triangle-alert.js.map\n","/**\n * @license lucide-react v0.575.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z\",\n key: \"1xq2db\"\n }\n ]\n];\nconst Zap = createLucideIcon(\"zap\", __iconNode);\n\nexport { __iconNode, Zap as default };\n//# sourceMappingURL=zap.js.map\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","/**\n * Copyright 2022 Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */ import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>(props)=>{\n var _config_compoundVariants;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants, defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{\n let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n\n","import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\nimport { cn } from \"../lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive: \"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60\",\n outline: \"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n xs: \"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n icon: \"size-9\",\n \"icon-xs\": \"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\": \"size-8\",\n \"icon-lg\": \"size-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction Button({\n className,\n variant = \"default\",\n size = \"default\",\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean\n }) {\n const Comp = asChild ? Slot.Root : \"button\"\n return (\n <Comp\n data-slot=\"button\"\n data-variant={variant}\n data-size={size}\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Button, buttonVariants }\n","import { useAuiState } from '@assistant-ui/react';\nimport 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 isApprovalCardInterrupt,\n type PendingActionRequest,\n pendingActionRequests,\n readAbandonedInputRequests,\n useApprovalResumeLock,\n} from '@athenaintel/agent-runtime';\nimport { useMemo } from 'react';\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\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 /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /** Answer the request with `{ type: 'run/input', requestId, response: { type: 'resume', value } }`. */\n resume: (value: TValue) => void;\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 } = 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 = useAuiState((s) => s.thread.isRunning);\n const { pending, resume } = useApprovalResumeLock<TValue>({\n requestId,\n isRunning,\n pendingResumeGraceMs,\n sendResume: (id, value) =>\n sendCommand({\n type: 'run/input',\n requestId: id,\n response: { type: 'resume', value },\n }),\n });\n\n return { request, requestId, hitl, actionRequests, abandonedInterrupt, pending, resume };\n}\n","import { useAuiState } from '@assistant-ui/react';\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n hasStatewireThreadExtras,\n type HitlApprovalPayload,\n hitlResumeApprove,\n hitlResumeContinue,\n hitlResumeReject,\n type PendingActionRequest,\n readInterruptMessage,\n} from '@athenaintel/agent-runtime';\nimport { CheckIcon, ChevronDownIcon, TriangleAlertIcon, XIcon } from 'lucide-react';\nimport { type FC, type ReactNode, useRef, useState } from 'react';\nimport { cn } from '../lib/utils';\nimport { Button } from '../ui/button';\nimport {\n type StatewireInterruptPredicate,\n useStatewireApprovalRequest,\n} from './use-statewire-approval-request';\n\n/**\n * Human-in-the-loop approval card for the statewire transport — the one\n * approval UI every Athena chat surface mounts (the SDK's `AthenaChat`, the\n * Chrome side panel, the Office task pane, Olympus).\n *\n * When the deep-agent runtime hits an approval-gated tool call, the backend\n * parks the run on an `interrupt` input request. This card reads that request\n * through `useStatewireApprovalRequest` and answers it with\n * `{ type: 'run/input', requestId, response: { type: 'resume', value } }` —\n * the exact command the backend's resume path consumes. Without an answer the\n * run stays parked forever, so this card must be mounted on every statewire\n * chat surface. On legacy (non-statewire) threads it renders nothing.\n *\n * Host-specific review UIs (subagent cards, email summaries) slot in through\n * `renderDetails`; requests another surface answers (typed interrupt\n * families, per-lane subagent approvals) stand down through\n * `isHandledElsewhere`; viewers without edit rights see `readOnlyNotice`.\n */\n\n/** The pending request a host slot renders or judges. */\nexport interface StatewireApprovalRequestContext {\n request: StatewireThread.CustomInputRequest;\n /** The payload narrowed to the Athena HITL approval shape, or `null` for a generic park. */\n hitl: HitlApprovalPayload | null;\n /** Every gated call the approval covers, in decision order (empty for non-HITL parks). */\n actionRequests: PendingActionRequest[];\n}\n\nexport interface StatewireApprovalCardProps {\n /** Surface-styling overrides merged onto the default classes. */\n classNames?: {\n /** The approval card container. */\n root?: string;\n /** The \"approval was cancelled\" notice container. */\n abandoned?: string;\n /** The disclosed details block. */\n details?: string;\n /** The decision row. */\n actions?: string;\n };\n /** Copy shown when an interrupt payload carries no message. */\n fallbackMessage?: string;\n /**\n * Which pending interrupt this card answers. Defaults to\n * `isApprovalCardInterrupt` (client-tool parks excluded — keep it that way\n * unless the surface handles those itself).\n */\n interruptPredicate?: StatewireInterruptPredicate;\n /**\n * How long a clicked decision keeps the buttons locked when no resume run\n * ever starts (a `run/input` the host rejected before any run began).\n * Defaults to `HITL_PENDING_RESUME_GRACE_MS`.\n */\n pendingResumeGraceMs?: number;\n /**\n * Return true when another surface answers this request (a typed Athena\n * interrupt family, per-lane subagent approval cards). The card renders\n * nothing for it — two surfaces must never answer the same input request.\n */\n isHandledElsewhere?: (context: StatewireApprovalRequestContext) => boolean;\n /**\n * Replace the default argument disclosure (one JSON block per gated call)\n * with a host-specific review UI. Rendered inside the collapsible details\n * region; the decision buttons stay with the card.\n */\n renderDetails?: (context: StatewireApprovalRequestContext) => ReactNode;\n /**\n * The viewer may see the request (it explains why the run is parked) but\n * cannot decide it — answering steers the shared run. Renders\n * `readOnlyNotice` in place of the buttons.\n */\n readOnly?: boolean;\n readOnlyNotice?: ReactNode;\n}\n\nexport const StatewireApprovalCard: FC<StatewireApprovalCardProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n if (!hasStatewireThreadExtras(extras)) return null;\n return <StatewireApprovalCardInner {...props} />;\n};\n\nconst StatewireApprovalCardInner: FC<StatewireApprovalCardProps> = ({\n classNames,\n fallbackMessage,\n interruptPredicate,\n pendingResumeGraceMs,\n isHandledElsewhere,\n renderDetails,\n readOnly = false,\n readOnlyNotice = 'Waiting for someone with edit access to respond.',\n}) => {\n const { request, requestId, hitl, actionRequests, abandonedInterrupt, pending, resume } =\n useStatewireApprovalRequest({ interruptPredicate, pendingResumeGraceMs });\n const [dismissedId, setDismissedId] = useState<string>();\n // The card shares the chat column with the thread. A lone gated call is\n // small enough to show inline, but a fan-out of a dozen calls would swallow\n // the conversation, so a batch starts collapsed until someone opens it.\n const [detailsOverride, setDetailsOverride] = useState<boolean>();\n\n // A fresh approval gets the default for ITS batch size, not the disclosure\n // the previous one was left in. Reset during render via React's \"previous\n // value\" pattern.\n const prevRequestIdRef = useRef(requestId);\n if (prevRequestIdRef.current !== requestId) {\n prevRequestIdRef.current = requestId;\n if (detailsOverride !== undefined) setDetailsOverride(undefined);\n }\n\n if (!request) {\n if (!abandonedInterrupt || abandonedInterrupt.id === dismissedId) return null;\n return (\n <div\n className={cn(\n 'aui-approval-abandoned flex w-full items-center justify-between gap-3 rounded-xl border border-amber-300 bg-amber-50 px-3 py-2 text-amber-800 text-xs',\n classNames?.abandoned,\n )}\n >\n <p>Approval was cancelled — the run moved on.</p>\n <button\n type=\"button\"\n aria-label=\"Dismiss cancelled approval\"\n onClick={() => setDismissedId(abandonedInterrupt.id)}\n className=\"shrink-0 rounded-md p-1 hover:bg-amber-100\"\n >\n <XIcon className=\"size-3.5\" />\n </button>\n </div>\n );\n }\n\n const context: StatewireApprovalRequestContext = { request, hitl, actionRequests };\n if (isHandledElsewhere?.(context)) return null;\n\n const message = readInterruptMessage(request.payload, fallbackMessage);\n const toolName = hitl?.context?.tool_name ?? hitl?.context?.tool_id;\n const pendingCount = hitl?.context?.pending_action_count ?? 1;\n const hasDetails = hitl !== null && actionRequests.length > 0;\n const showDetails = hasDetails && (detailsOverride ?? actionRequests.length <= 1);\n\n return (\n <section\n aria-label={hitl ? 'Approval required' : 'Input required'}\n className={cn(\n 'aui-approval-card w-full rounded-2xl border border-amber-300 bg-amber-50 px-4 py-3 text-amber-900',\n classNames?.root,\n )}\n >\n <div className=\"flex items-start gap-3\">\n <TriangleAlertIcon className=\"mt-0.5 size-4 shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"flex items-center gap-2 font-semibold text-sm\">\n <span>{hitl ? 'Approval required' : 'Waiting for input'}</span>\n {hitl && pendingCount > 1 ? (\n <span className=\"shrink-0 font-normal text-amber-800 text-xs\">\n {pendingCount} tool calls\n </span>\n ) : null}\n </p>\n <p className=\"pt-1 text-amber-800 text-sm leading-snug\">\n {hitl && pendingCount === 1 && toolName ? (\n <>\n <span className=\"font-mono\">{toolName}</span> requires approval before it runs.\n </>\n ) : (\n message\n )}\n </p>\n {hasDetails ? (\n <button\n type=\"button\"\n onClick={() => setDetailsOverride(!showDetails)}\n aria-expanded={showDetails}\n className=\"mt-2 flex items-center gap-1 rounded px-1 py-0.5 text-amber-800 text-xs transition-colors hover:text-amber-950\"\n >\n <ChevronDownIcon\n className={cn('size-3 transition-transform', showDetails && 'rotate-180')}\n />\n {showDetails ? 'Hide details' : 'Review details'}\n </button>\n ) : null}\n {/* EVERY pending gated call renders, in order — one decision\n authorizes the whole batch, so nothing may hide behind a host's\n richer cards. All read-only: this runtime resumes through\n `hitl_response_to_decisions`, which has no `tool_args` channel —\n an editable composer would let someone rewrite an email and then\n watch the original go out. */}\n {showDetails ? (\n <div className={cn('mt-2 flex flex-col gap-2', classNames?.details)}>\n {renderDetails ? (\n renderDetails(context)\n ) : (\n <DefaultApprovalDetails actionRequests={actionRequests} />\n )}\n </div>\n ) : null}\n </div>\n </div>\n <div className={cn('flex flex-wrap items-center gap-2 pt-3', classNames?.actions)}>\n {readOnly ? (\n <p className=\"text-amber-800 text-sm\" data-testid=\"statewire-approval-read-only\">\n {readOnlyNotice}\n </p>\n ) : hitl ? (\n <>\n <Button\n size=\"sm\"\n disabled={pending}\n onClick={() => resume(hitlResumeApprove())}\n className=\"bg-green-600 text-white hover:bg-green-700\"\n >\n <CheckIcon />\n Approve\n </Button>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={pending}\n onClick={() => resume(hitlResumeReject())}\n >\n <XIcon />\n Reject\n </Button>\n </>\n ) : (\n <Button size=\"sm\" disabled={pending} onClick={() => resume(hitlResumeContinue())}>\n Continue\n </Button>\n )}\n </div>\n </section>\n );\n};\n\n/** One block per gated call: its name (when the batch has several) and its arguments as JSON. */\nconst DefaultApprovalDetails: FC<{ actionRequests: PendingActionRequest[] }> = ({\n actionRequests,\n}) => (\n <>\n {actionRequests.map((action, index) => (\n <div\n key={`${action.name}-${index}`}\n className=\"rounded-lg bg-amber-100 p-2 text-amber-900 text-xs leading-relaxed\"\n >\n {actionRequests.length > 1 ? (\n <p className=\"font-mono font-semibold\">{action.name}</p>\n ) : null}\n {Object.keys(action.args).length > 0 ? (\n <pre className=\"mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words rounded bg-white/60 p-1.5 font-mono text-[11px]\">\n {JSON.stringify(action.args, null, 2)}\n </pre>\n ) : (\n <p className=\"text-amber-800\">No arguments.</p>\n )}\n </div>\n ))}\n </>\n);\n","import { Play } from \"lucide-react\";\nimport { type FC, useEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\nconst EXIT_ANIMATION_MS = 200;\nconst EXIT_RESET_MS = 2500;\n\n/**\n * Shared Continue action for recoverable chat states.\n *\n * The dispatch waits for the exit animation to paint. If the owning runtime\n * does not leave the recoverable state (for example, the command is rejected),\n * the control resets so the user can try again.\n */\nexport const ContinuePill: FC<{\n onClick: () => void;\n ariaLabel: string;\n dataTestId?: string;\n}> = ({ onClick, ariaLabel, dataTestId }) => {\n const [isExiting, setIsExiting] = useState(false);\n const onClickRef = useRef(onClick);\n const pendingOnClickRef = useRef(onClick);\n onClickRef.current = onClick;\n\n useEffect(() => {\n if (!isExiting) return;\n const dispatchTimer = setTimeout(\n () => pendingOnClickRef.current(),\n EXIT_ANIMATION_MS,\n );\n const resetTimer = setTimeout(() => setIsExiting(false), EXIT_RESET_MS);\n return () => {\n clearTimeout(dispatchTimer);\n clearTimeout(resetTimer);\n };\n }, [isExiting]);\n\n const handleClick = (): void => {\n if (isExiting) return;\n pendingOnClickRef.current = onClickRef.current;\n setIsExiting(true);\n };\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={isExiting}\n className={cn(\n \"group inline-flex items-center gap-1.5 rounded-full bg-primary px-3.5 py-1 text-xs font-medium text-primary-foreground shadow-sm\",\n \"transition-all duration-200 ease-out\",\n \"hover:bg-primary/90 hover:shadow-md active:scale-95\",\n \"animate-in fade-in slide-in-from-bottom-1\",\n isExiting && \"pointer-events-none scale-90 opacity-0\",\n )}\n aria-label={ariaLabel}\n data-testid={dataTestId}\n >\n <Play className=\"size-3 fill-current transition-transform duration-200 ease-out group-hover:translate-x-0.5\" />\n <span>Continue</span>\n </button>\n );\n};\n","import { useAui, useAuiState } from '@assistant-ui/react';\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n buildQueueEditCommand,\n buildStatewireQueueRows,\n type DeepAgentThreadStatus,\n describeQueueSendFailure,\n hasStatewireThreadExtras,\n isFailedSendEntryRace,\n isQueueEntryUnsettled,\n QUEUE_AUTO_CONTINUE_DELAY_MS,\n queueEntryText,\n queueLaneFlags,\n readDeepAgentStreamValues,\n readPrioritizedQueueIds,\n readRunMarkerFromSourceMessages,\n requireStatewireFailedActions,\n showQueueRowSendNow,\n type StatewireFailedActions,\n useDeepAgentThreadStatus,\n userStopBlocksQueueAutoContinue,\n} from '@athenaintel/agent-runtime';\nimport {\n AlertCircleIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CircleIcon,\n Loader2Icon,\n PencilIcon,\n RotateCcwIcon,\n SendIcon,\n Trash2Icon,\n XIcon,\n ZapIcon,\n} from 'lucide-react';\nimport {\n type FC,\n type KeyboardEvent,\n type MutableRefObject,\n type ReactNode,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { ContinuePill } from '../chat-ui/messages/continue-pill';\nimport { cn } from '../lib/utils';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * The ⚡ on a queued row (`DeepAgentThread.run_prioritize`). With\n * `priority: true` the host moves the entry to the head of the queue\n * lane (behind entries prioritized before it), records it durably, and\n * the live run ends at its next model-call boundary — after the\n * in-flight tool chain, never mid-tool — so the settle delivers the\n * entry on top of the finished tool results instead of after the whole\n * turn. `priority: false` withdraws the request and leaves the entry\n * where it is.\n */\n runPrioritize: {\n type: 'run/prioritize';\n runId: string;\n messageId: string;\n priority: boolean;\n };\n }\n }\n}\n\n/**\n * The one queued-messages tray for the server-owned statewire queue and steer\n * lanes, mounted by the SDK's `AthenaChat`, the Chrome side panel, the Office\n * task pane, and Olympus.\n *\n * A message sent mid-run queues behind the active run. Rows offer \"Send now\"\n * (a steer-lane move — the host stops the run and dispatches it once the run\n * settles; on a stopped/errored thread the same move dispatches immediately),\n * \"Prioritize\" (`run/prioritize`, the ⚡ — the non-interrupting analog: the\n * live run ends at its next model-call boundary so the entry lands on top of\n * the finished tool results), inline edit (re-sent under the entry's own id\n * on its own lane, which the host folds as an in-place content update), and\n * remove (`run/dequeue`). While the thread rests stopped/errored, stranded\n * steer-lane entries list ahead of the queue (they dispatch first, as one\n * batch, so they carry Remove but no per-row Send now) and a Continue pill\n * steer-promotes the queue head — a steer entry moved onto its own lane is a\n * no-op, so a steer-only rest state gets no dead button.\n *\n * A row whose send has not settled yet (`isQueueEntryUnsettled` — this\n * client's optimistic fold, not a host-admitted lane entry) renders as\n * \"Sending…\" with no acting affordances: admission is server-side and can\n * still refuse the message. Failed run sends (`runs.failed`) list after the\n * lanes with Retry (`retryFailed`) and Discard (`discardFailed`).\n *\n * With `autoContinue`, a stranded settle (a dispatch that died before its\n * first checkpoint, a pod drain, a failed run) steer-promotes the queue head\n * on its own after `QUEUE_AUTO_CONTINUE_DELAY_MS`, once per entry — except\n * past an acknowledged user stop, where the manual pill stays the only way on.\n *\n * Renders nothing on the legacy transport or when every lane is empty.\n */\n\nexport type StatewireQueueEvent =\n | {\n type: 'auto-continued';\n threadId: string | null;\n status: DeepAgentThreadStatus;\n headEntryId: string;\n }\n | {\n type: 'failed-send-action-raced';\n threadId: string | null;\n messageId: string;\n action: 'retry' | 'discard';\n error: string;\n };\n\nexport interface StatewireQueueRowContentContext {\n text: string;\n index: number;\n item: StatewireThread.RunsQueueEntry;\n}\n\nexport interface StatewireQueueEditorContext {\n value: string;\n onChange: (value: string) => void;\n /** Save the edit; a blank or unchanged text sends nothing but closes the editor. */\n onSave: (text: string) => void;\n onCancel: () => void;\n}\n\nexport interface StatewireQueuedMessagesProps {\n /** Surface-styling overrides merged onto the default classes. */\n classNames?: {\n /** The tray container. */\n root?: string;\n /** The row list. */\n list?: string;\n };\n /**\n * Steer-promote a stranded queue head automatically after a settle (see the\n * component docs). Off by default: a host opts in to dispatching runs on the\n * user's behalf. Pass `{ delayMs }` to tune the grace before the promotion\n * (defaults to `QUEUE_AUTO_CONTINUE_DELAY_MS`).\n */\n autoContinue?: boolean | { delayMs?: number };\n /** Identifies the thread for once-per-entry auto-continue attempts and events. */\n threadId?: string | null;\n /** Telemetry sink for the tray's notable moments. */\n onEvent?: (event: StatewireQueueEvent) => void;\n /** Replace the plain-text row body (e.g. a mention-aware renderer). */\n renderContent?: (context: StatewireQueueRowContentContext) => ReactNode;\n /** Replace the plain textarea inline editor (e.g. the host's composer editor). */\n renderEditor?: (context: StatewireQueueEditorContext) => ReactNode;\n}\n\nexport const StatewireQueuedMessages: FC<StatewireQueuedMessagesProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n if (!hasStatewireThreadExtras(extras)) return null;\n return <StatewireQueuedMessagesInner {...props} />;\n};\n\nconst StatewireQueuedMessagesInner: FC<StatewireQueuedMessagesProps> = ({\n classNames,\n autoContinue = false,\n threadId = null,\n onEvent,\n renderContent,\n renderEditor,\n}) => {\n // The QUEUE lane only: composer.queue prepends the steer lane, whose entries\n // already render in the message list. A non-empty queue implies a live run\n // entry (the host retires runId only once both lanes drain), so the row\n // controls can always send.\n const runs = useStatewireRuns();\n const { queue, steerQueue, runId } = runs;\n // `failed` joined the runs projection in react-statewire 0.24; a projection\n // without it (an older lib, a stubbed runs read) must not crash the tray.\n const failed = runs.failed ?? [];\n // The host's durable prioritized-id record: a raw path read (the selector\n // must return a stable reference), with the lookup set derived below.\n const rawPrioritizedQueueIds = useStatewireState(\n (state) => readDeepAgentStreamValues(state).prioritizedQueueIds,\n );\n const prioritizedQueueIds = useMemo(\n () => new Set(readPrioritizedQueueIds(rawPrioritizedQueueIds)),\n [rawPrioritizedQueueIds],\n );\n const status = useDeepAgentThreadStatus();\n const { isRunning, isContinuable } = queueLaneFlags(status);\n const aui = useAui();\n const sendCommand = useStatewireSendCommand();\n const listId = useId();\n const [expanded, setExpanded] = useState(true);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [editingText, setEditingText] = useState('');\n // Head entries already auto-promoted once on this mount: an attempt whose\n // continue run dies and re-strands the SAME entry must not loop — the manual\n // Continue pill is the fallback for a repeatedly failing dispatch. Kept on\n // the tray (not the auto-continue child) so it survives the empty-lane\n // renders between a promotion and its outcome.\n const autoContinueAttemptsRef = useRef<Set<string>>(new Set());\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n\n const rows = buildStatewireQueueRows({ queue, steerQueue, isContinuable });\n // Continue promotes the QUEUE head only: a queue→steer move dispatches the\n // stranded steer lane plus this entry, while a steer entry moved onto its\n // own lane is a no-op.\n const queueHeadId = queue[0]?.id ?? null;\n const autoContinueOptions = autoContinue === true ? {} : autoContinue || null;\n\n /**\n * Re-send the entry under its own id on its own lane: the host replaces the\n * queued message's content in place, leaving its queue position and lane\n * untouched (a same-id send never dispatches).\n */\n const saveEdit = (\n item: StatewireThread.RunsQueueEntry,\n lane: 'queue' | 'steer',\n text: string,\n ): void => {\n setEditingId(null);\n setEditingText('');\n const command = buildQueueEditCommand({ item, lane, runId, text });\n if (command !== null) sendCommand(command);\n };\n\n /**\n * Retry/Discard act on a rendered lane snapshot that can trail the session\n * record; acting on an entry statewire already dropped throws. Nothing is\n * lost in that race, so it is recorded instead of crashing the click.\n */\n const runFailedSendAction = ({\n action,\n messageId,\n run,\n }: {\n action: 'retry' | 'discard';\n messageId: string;\n run: (actions: StatewireFailedActions) => void;\n }): void => {\n try {\n run(requireStatewireFailedActions(aui.thread().getState().extras));\n } catch (error) {\n if (!(error instanceof Error) || !isFailedSendEntryRace(error)) throw error;\n onEvent?.({\n type: 'failed-send-action-raced',\n threadId,\n messageId,\n action,\n error: error.message,\n });\n }\n };\n\n if (rows.length === 0 && failed.length === 0) return null;\n\n const renderRowContent = (context: StatewireQueueRowContentContext): ReactNode =>\n renderContent ? (\n renderContent(context)\n ) : (\n <p className=\"min-w-0 flex-1 whitespace-pre-wrap break-words text-foreground text-xs\">\n {context.text || 'Queued attachment'}\n </p>\n );\n\n return (\n <section\n aria-label=\"Queued messages\"\n className={cn(\n 'aui-statewire-queue w-full rounded-xl border border-border/70 bg-muted/30 px-2 py-1.5',\n classNames?.root,\n )}\n >\n {autoContinueOptions ? (\n <QueueAutoContinue\n delayMs={autoContinueOptions.delayMs ?? QUEUE_AUTO_CONTINUE_DELAY_MS}\n queueHeadId={queueHeadId}\n isContinuable={isContinuable}\n status={status}\n threadId={threadId}\n editing={editingId !== null}\n attemptsRef={autoContinueAttemptsRef}\n onEventRef={onEventRef}\n />\n ) : null}\n <div className=\"flex items-center gap-1.5\">\n <button\n type=\"button\"\n onClick={() => setExpanded((value) => !value)}\n aria-expanded={expanded}\n aria-controls={listId}\n className=\"flex items-center gap-1 rounded px-1 py-1 font-medium text-muted-foreground text-xs hover:text-foreground\"\n >\n {expanded ? (\n <ChevronDownIcon className=\"size-3.5\" />\n ) : (\n <ChevronRightIcon className=\"size-3.5\" />\n )}\n {rows.length + failed.length} queued\n </button>\n {isContinuable && queueHeadId !== null ? (\n <ContinuePill\n ariaLabel=\"Continue with queued messages\"\n onClick={() => aui.composer.queueItem({ id: queueHeadId }).move({ lane: 'steer' })}\n />\n ) : null}\n </div>\n {expanded ? (\n <ul\n id={listId}\n className={cn('max-h-40 overflow-y-auto', classNames?.list)}\n data-testid=\"athena-statewire-queue\"\n >\n {rows.map(({ item, lane }, index) => {\n const text = queueEntryText(item.parts);\n const isUnsettled = isQueueEntryUnsettled(item);\n const isEditing = editingId === item.id;\n const showSendNow =\n !isUnsettled && showQueueRowSendNow({ lane, index, isRunning, isContinuable });\n const showPrioritize = !isUnsettled && lane === 'queue' && isRunning && runId !== null;\n const isPrioritized = prioritizedQueueIds.has(item.id);\n const editorContext: StatewireQueueEditorContext = {\n value: editingText,\n onChange: setEditingText,\n onSave: (next) => saveEdit(item, lane, next),\n onCancel: () => {\n setEditingId(null);\n setEditingText('');\n },\n };\n return (\n <li\n key={item.id}\n className=\"group flex items-start gap-2 rounded-md px-1 py-1.5 hover:bg-background\"\n >\n {isUnsettled ? (\n <Loader2Icon className=\"mt-0.5 size-3.5 shrink-0 animate-spin text-muted-foreground/60\" />\n ) : (\n <CircleIcon className=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground/40\" />\n )}\n {isEditing ? (\n renderEditor ? (\n renderEditor(editorContext)\n ) : (\n <DefaultQueueEditor {...editorContext} />\n )\n ) : (\n renderRowContent({ text, index, item })\n )}\n <div\n className={cn('flex shrink-0 items-center gap-1', isEditing && 'hidden')}\n data-testid=\"statewire-queue-row-actions\"\n >\n {isUnsettled ? (\n <span\n className=\"px-1 text-[10px] text-muted-foreground\"\n data-testid=\"statewire-queued-message-sending\"\n >\n Sending…\n </span>\n ) : null}\n {showSendNow ? (\n <button\n type=\"button\"\n aria-label=\"Send now\"\n onClick={() =>\n aui.composer.queueItem({ id: item.id }).move({ lane: 'steer' })\n }\n className=\"inline-flex items-center gap-1 rounded-full border border-primary/30 px-2 py-1 font-medium text-[10px] text-primary hover:bg-primary/5\"\n >\n <SendIcon className=\"size-2.5\" />\n Send now\n </button>\n ) : null}\n {showPrioritize ? (\n <button\n type=\"button\"\n aria-label={isPrioritized ? 'Remove priority' : 'Prioritize'}\n aria-pressed={isPrioritized}\n title={\n isPrioritized\n ? 'Remove priority'\n : 'Prioritize this message. Delivered as soon as the current step ends.'\n }\n onClick={() => {\n if (runId === null) return;\n sendCommand({\n type: 'run/prioritize',\n runId,\n messageId: item.id,\n priority: !isPrioritized,\n });\n }}\n className={cn(\n 'rounded p-1 transition-colors',\n isPrioritized\n ? 'text-amber-500 hover:text-amber-600'\n : 'text-muted-foreground hover:text-amber-500',\n )}\n >\n <ZapIcon className=\"size-3\" />\n </button>\n ) : null}\n {!isUnsettled ? (\n <button\n type=\"button\"\n aria-label=\"Edit queued message\"\n onClick={() => {\n setEditingId(item.id);\n setEditingText(text);\n }}\n className=\"rounded p-1 text-muted-foreground transition-colors hover:text-primary\"\n >\n <PencilIcon className=\"size-3\" />\n </button>\n ) : null}\n <button\n type=\"button\"\n aria-label=\"Remove queued message\"\n onClick={() => aui.composer.queueItem({ id: item.id }).remove()}\n className={cn(\n 'rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive',\n !showSendNow &&\n 'opacity-0 focus-visible:opacity-100 group-hover:opacity-100',\n )}\n >\n <Trash2Icon className=\"size-3\" />\n </button>\n </div>\n </li>\n );\n })}\n {failed.map((item, index) => (\n <li\n key={item.id}\n className=\"group flex items-start gap-2 rounded-md px-1 py-1.5 hover:bg-background\"\n >\n <AlertCircleIcon className=\"mt-0.5 size-3.5 shrink-0 text-destructive\" />\n {renderRowContent({\n text: queueEntryText(item.parts),\n index: rows.length + index,\n item,\n })}\n <div\n className=\"flex shrink-0 items-center gap-1\"\n data-testid=\"statewire-queue-row-actions\"\n >\n <span\n className=\"px-1 text-[10px] text-destructive\"\n title={describeQueueSendFailure(item.sendFailure)}\n >\n Failed to send\n </span>\n <button\n type=\"button\"\n aria-label=\"Retry failed message\"\n onClick={() =>\n runFailedSendAction({\n action: 'retry',\n messageId: item.id,\n run: (actions) => actions.retryFailed(item.id),\n })\n }\n className=\"inline-flex items-center gap-1 rounded-full border border-primary/30 px-2 py-1 font-medium text-[10px] text-primary hover:bg-primary/5\"\n >\n <RotateCcwIcon className=\"size-2.5\" />\n Retry\n </button>\n <button\n type=\"button\"\n aria-label=\"Discard failed message\"\n onClick={() =>\n runFailedSendAction({\n action: 'discard',\n messageId: item.id,\n run: (actions) => actions.discardFailed(item.id),\n })\n }\n className=\"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive\"\n >\n <Trash2Icon className=\"size-3\" />\n </button>\n </div>\n </li>\n ))}\n </ul>\n ) : null}\n </section>\n );\n};\n\n/**\n * Stranded-entry auto-continue: when the thread settles stopped/errored with\n * queued work the run never consumed, steer-promote the queue head (the exact\n * action of the Continue pill) after a grace period, once per entry. The one\n * settle that must NOT auto-resume is an acknowledged user stop, read off the\n * last message's run marker — so only this opt-in child subscribes to the\n * thread's messages, and the default tray never re-renders per token for it.\n */\nconst QueueAutoContinue: FC<{\n delayMs: number;\n queueHeadId: string | null;\n isContinuable: boolean;\n status: DeepAgentThreadStatus;\n threadId: string | null;\n editing: boolean;\n attemptsRef: MutableRefObject<Set<string>>;\n onEventRef: MutableRefObject<((event: StatewireQueueEvent) => void) | undefined>;\n}> = ({ delayMs, queueHeadId, isContinuable, status, threadId, editing, attemptsRef, onEventRef }) => {\n const aui = useAui();\n // The settle that stranded the queue is described by the LAST message's run\n // marker (a marker deeper in history was superseded by a later send). The\n // selectors return primitives so the subscriptions stay shallow-stable.\n const lastMessageMarker = useAuiState((s) => {\n const last = s.thread.messages.at(-1);\n return last ? readRunMarkerFromSourceMessages(last)?.marker : undefined;\n });\n const lastMessageMarkerSource = useAuiState((s) => {\n const last = s.thread.messages.at(-1);\n return last ? readRunMarkerFromSourceMessages(last)?.source : undefined;\n });\n const userStopBlocks = userStopBlocksQueueAutoContinue({\n marker: lastMessageMarker,\n source: lastMessageMarkerSource,\n });\n\n useEffect(() => {\n if (!isContinuable || queueHeadId === null || userStopBlocks) return;\n // An open inline edit means the user is mid-revision on some row —\n // dispatching underneath them could send text they are about to change.\n if (editing) return;\n const attemptKey = `${threadId ?? 'unknown'}:${queueHeadId}`;\n if (attemptsRef.current.has(attemptKey)) return;\n const timeoutId = setTimeout(() => {\n attemptsRef.current.add(attemptKey);\n onEventRef.current?.({ type: 'auto-continued', threadId, status, headEntryId: queueHeadId });\n aui.composer.queueItem({ id: queueHeadId }).move({ lane: 'steer' });\n }, delayMs);\n return () => clearTimeout(timeoutId);\n }, [\n attemptsRef,\n aui,\n delayMs,\n editing,\n isContinuable,\n onEventRef,\n queueHeadId,\n status,\n threadId,\n userStopBlocks,\n ]);\n\n return null;\n};\n\n/** Plain textarea editor: Enter saves, Shift+Enter breaks a line, Escape cancels. */\nconst DefaultQueueEditor: FC<StatewireQueueEditorContext> = ({\n value,\n onChange,\n onSave,\n onCancel,\n}) => {\n const canSave = value.trim().length > 0;\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>): void => {\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault();\n if (canSave) onSave(value);\n } else if (event.key === 'Escape') {\n event.preventDefault();\n onCancel();\n }\n };\n return (\n <div className=\"flex min-w-0 flex-1 items-start gap-1\">\n <textarea\n autoFocus\n aria-label=\"Edit message\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n onKeyDown={handleKeyDown}\n rows={Math.min(6, Math.max(1, value.split('\\n').length))}\n className=\"min-w-0 flex-1 resize-none rounded-md border border-border bg-background px-2 py-1 text-foreground text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50\"\n />\n <button\n type=\"button\"\n aria-label=\"Save edit\"\n disabled={!canSave}\n onClick={() => onSave(value)}\n className={cn(\n 'rounded p-1 text-primary transition-colors hover:bg-primary/10',\n !canSave && 'cursor-not-allowed opacity-40',\n )}\n >\n <CheckIcon className=\"size-3.5\" />\n </button>\n <button\n type=\"button\"\n aria-label=\"Cancel edit\"\n onClick={onCancel}\n className=\"rounded p-1 text-muted-foreground transition-colors hover:bg-muted\"\n >\n <XIcon className=\"size-3.5\" />\n </button>\n </div>\n );\n};\n","/**\n * Shared DOM rendering for a runtime ending (see\n * `@athenaintel/agent-runtime`'s `runtime-messages.ts`): the status row for a\n * stop / pause / failure, and the banner that frames a handoff summary. Hosts\n * that build their assistant row with `createAssistantMessage` get these for\n * free; hosts with their own row (Olympus, mobile) render their own presenter\n * from the same {@link AthenaRuntimeMessage} so the taxonomy cannot drift.\n */\nimport {\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageSeverity,\n runtimeMessageMarkerText,\n} from \"@athenaintel/agent-runtime\";\nimport { AlertTriangleIcon, OctagonXIcon, PauseIcon, SquareIcon } from \"lucide-react\";\nimport type { ComponentPropsWithoutRef, FC, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\nconst SEVERITY_CLASS: Record<AthenaRuntimeMessageSeverity, string> = {\n info: \"border-border bg-muted/40 text-muted-foreground\",\n warning: \"border-amber-200 bg-amber-50 text-amber-900\",\n error: \"border-red-200 bg-red-50 text-red-800\",\n};\n\nconst KIND_ICON: Record<AthenaRuntimeMessage[\"kind\"], FC<{ className?: string }>> = {\n stopped: SquareIcon,\n paused: PauseIcon,\n failed: OctagonXIcon,\n handoff: AlertTriangleIcon,\n};\n\nexport interface RuntimeMessageCardProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"role\"> {\n message: AthenaRuntimeMessage;\n /** An inline affordance (e.g. a Continue button) rendered inside the card. */\n action?: ReactNode;\n}\n\n/**\n * The status row for a runtime ending. For `stopped` / `paused` / `failed` it\n * replaces the assistant bubble; for `handoff` it sits above the closing\n * summary, which keeps rendering as ordinary prose.\n */\nexport const RuntimeMessageCard: FC<RuntimeMessageCardProps> = ({\n message,\n action,\n className,\n ...rest\n}) => {\n if (message.silent) return null;\n const Icon = KIND_ICON[message.kind];\n const markerText = runtimeMessageMarkerText(message);\n return (\n <div\n {...rest}\n role=\"status\"\n data-runtime-message-kind={message.kind}\n data-runtime-message-reason={message.reason}\n className={cn(\n \"my-2 flex w-full items-start gap-2 rounded-lg border px-3 py-2 text-sm\",\n SEVERITY_CLASS[message.severity],\n className,\n )}\n >\n <Icon className=\"mt-0.5 size-4 shrink-0\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"font-medium\">{message.title}</span>\n {message.detail ? <span className=\"text-xs opacity-90\">{message.detail}</span> : null}\n {markerText ? <span className=\"text-xs opacity-90\">{markerText}</span> : null}\n </div>\n {action}\n </div>\n );\n};\n","import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Messages older than the loaded window the server still holds. */\n olderCount: number;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history on a windowed wire: how many older\n * messages the server still holds, a manual way to load the next page, and\n * the in-flight state. Renders nothing when the whole transcript is loaded\n * (or the wire is not windowed).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n olderCount,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (olderCount <= 0) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n {olderCount.toLocaleString()} earlier {olderCount === 1 ? \"message\" : \"messages\"}\n </button>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A `history/load` settled (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the windowed wire for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"N earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert on a wire that is not windowed: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { olderCount, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || olderCount <= 0 || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, olderCount]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n olderCount={olderCount}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n"],"names":["CLIENT_TOOL_INTERRUPT_SOURCE","CLIENT_TOOL_RESULT_STATUS_SUCCESS","CLIENT_TOOL_RESULT_STATUS_ERROR","readDeepAgentStreamValues","useState","useRef","useEffect","useCallback","ATHENA_RUN_MARKER_CANCELLED","ATHENA_STOP_SOURCE_POD_DRAIN","DEEP_AGENT_MESSAGES_WINDOW_STATE_KEY","useStatewireState","useMemo","readDeepAgentMessagesWindow","useStatewireSendCommand","buildHistoryLoadCommand","readHistoryLoadResult","readTruncatedToolOutputArtifact","buildToolOutputCommand","readToolOutputResult","_a","useAuiState","ATHENA_TERMINATION_REASON_KEY","ATHENA_HANDOFF_KEY","ATHENA_STOP_SOURCE_SEND_NOW","ATHENA_RUN_MARKER_FAILED","getExternalStoreMessages","ATHENA_RUN_MARKER_KEY","ATHENA_RUN_MARKER_SOURCE_KEY","createContext","useContext","__iconNode","createLucideIcon","param","Slot.Root","jsx","cn","useStatewireRuns","jsxs","XIcon","TriangleAlertIcon","Fragment","ChevronDownIcon","CheckIcon","Play","useAui","useId","ChevronRightIcon","Loader2Icon","CircleIcon","SendIcon","ZapIcon","PencilIcon","Trash2Icon","AlertCircleIcon","RotateCcwIcon","readRunMarkerFromSourceMessages","SquareIcon","PauseIcon","OctagonXIcon","AlertTriangleIcon","useLayoutEffect"],"mappings":";;;;;;;;;;;AA8EA,SAAS,wBAAwB,OAAgD;AAC/E,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,EAAG,QAAO;AACxE,QAAM,YAAY;AAClB,SACE,OAAO,UAAU,iBAAiB,YAClC,UAAU,aAAa,SAAS,KAChC,OAAO,UAAU,cAAc;AAEnC;AASO,SAAS,6BAA6B,SAA2B;AACtE,SACE,CAAC,CAAC,WACF,OAAO,YAAY,YACnB,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