@athenaintel/react 0.41.2 → 0.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/README.md +108 -9
  2. package/dist/agent-runtime/src/asset-attachment.d.ts +98 -0
  3. package/dist/agent-runtime/src/athena-asset-drag.d.ts +32 -0
  4. package/dist/agent-runtime/src/auth-denial.d.ts +29 -0
  5. package/dist/agent-runtime/src/chat-outbox-attachments.cjs +41 -0
  6. package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -0
  7. package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +38 -0
  8. package/dist/agent-runtime/src/chat-outbox-attachments.js +41 -0
  9. package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -0
  10. package/dist/agent-runtime/src/chat-outbox-signals.cjs +63 -0
  11. package/dist/agent-runtime/src/chat-outbox-signals.cjs.map +1 -0
  12. package/dist/agent-runtime/src/chat-outbox-signals.d.ts +12 -0
  13. package/dist/agent-runtime/src/chat-outbox-signals.js +63 -0
  14. package/dist/agent-runtime/src/chat-outbox-signals.js.map +1 -0
  15. package/dist/agent-runtime/src/chat-outbox-store.cjs +509 -0
  16. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-store.d.ts +203 -0
  18. package/dist/agent-runtime/src/chat-outbox-store.js +509 -0
  19. package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -0
  20. package/dist/agent-runtime/src/chat-outbox-thread.cjs +136 -0
  21. package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -0
  22. package/dist/agent-runtime/src/chat-outbox-thread.d.ts +118 -0
  23. package/dist/agent-runtime/src/chat-outbox-thread.js +136 -0
  24. package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -0
  25. package/dist/agent-runtime/src/chat-outbox.cjs +696 -0
  26. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -0
  27. package/dist/agent-runtime/src/chat-outbox.d.ts +285 -0
  28. package/dist/agent-runtime/src/chat-outbox.js +696 -0
  29. package/dist/agent-runtime/src/chat-outbox.js.map +1 -0
  30. package/dist/agent-runtime/src/chat-socket-reachability.d.ts +45 -0
  31. package/dist/agent-runtime/src/client-tool-bridge.d.ts +152 -0
  32. package/dist/agent-runtime/src/client-tools.d.ts +133 -0
  33. package/dist/agent-runtime/src/composer-markdown.cjs +10 -0
  34. package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
  35. package/dist/agent-runtime/src/composer-markdown.d.ts +108 -0
  36. package/dist/agent-runtime/src/composer-markdown.js +10 -0
  37. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  38. package/dist/agent-runtime/src/config-mutations.d.ts +51 -0
  39. package/dist/agent-runtime/src/conversation-index.d.ts +110 -0
  40. package/dist/agent-runtime/src/conversation-list.d.ts +343 -0
  41. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -2
  42. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  43. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +166 -0
  44. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -2
  45. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  46. package/dist/agent-runtime/src/desktop-handoff.d.ts +139 -0
  47. package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs +158 -0
  48. package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs.map +1 -0
  49. package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
  50. package/dist/agent-runtime/src/durable-thread-snapshot-cache.js +158 -0
  51. package/dist/agent-runtime/src/durable-thread-snapshot-cache.js.map +1 -0
  52. package/dist/agent-runtime/src/edit-command.d.ts +156 -0
  53. package/dist/agent-runtime/src/errors.d.ts +174 -0
  54. package/dist/agent-runtime/src/execute-output.d.ts +31 -0
  55. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
  56. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  57. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
  58. package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
  59. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  60. package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
  61. package/dist/agent-runtime/src/index.d.ts +74 -0
  62. package/dist/agent-runtime/src/interrupts.cjs +17 -0
  63. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  64. package/dist/agent-runtime/src/interrupts.d.ts +348 -0
  65. package/dist/agent-runtime/src/interrupts.js +17 -0
  66. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  67. package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
  68. package/dist/agent-runtime/src/lane-history.cjs +209 -0
  69. package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
  70. package/dist/agent-runtime/src/lane-history.d.ts +175 -0
  71. package/dist/agent-runtime/src/lane-history.js +209 -0
  72. package/dist/agent-runtime/src/lane-history.js.map +1 -0
  73. package/dist/agent-runtime/src/lane-images.d.ts +184 -0
  74. package/dist/agent-runtime/src/message-author.d.ts +43 -0
  75. package/dist/agent-runtime/src/message-text.cjs +15 -0
  76. package/dist/agent-runtime/src/message-text.cjs.map +1 -0
  77. package/dist/agent-runtime/src/message-text.d.ts +47 -0
  78. package/dist/agent-runtime/src/message-text.js +15 -0
  79. package/dist/agent-runtime/src/message-text.js.map +1 -0
  80. package/dist/agent-runtime/src/message-window.cjs +15 -1
  81. package/dist/agent-runtime/src/message-window.cjs.map +1 -1
  82. package/dist/agent-runtime/src/message-window.d.ts +159 -0
  83. package/dist/agent-runtime/src/message-window.js +16 -2
  84. package/dist/agent-runtime/src/message-window.js.map +1 -1
  85. package/dist/agent-runtime/src/messages.cjs +88 -4
  86. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  87. package/dist/agent-runtime/src/messages.d.ts +603 -0
  88. package/dist/agent-runtime/src/messages.js +88 -4
  89. package/dist/agent-runtime/src/messages.js.map +1 -1
  90. package/dist/agent-runtime/src/model-context.d.ts +22 -0
  91. package/dist/agent-runtime/src/offline-status.d.ts +157 -0
  92. package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
  93. package/dist/agent-runtime/src/protocol.cjs +12 -4
  94. package/dist/agent-runtime/src/protocol.cjs.map +1 -1
  95. package/dist/agent-runtime/src/protocol.d.ts +119 -0
  96. package/dist/agent-runtime/src/protocol.js +13 -5
  97. package/dist/agent-runtime/src/protocol.js.map +1 -1
  98. package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
  99. package/dist/agent-runtime/src/queue.d.ts +138 -0
  100. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +154 -0
  101. package/dist/agent-runtime/src/running-tool-placeholder.cjs +11 -0
  102. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -0
  103. package/dist/agent-runtime/src/running-tool-placeholder.d.ts +25 -0
  104. package/dist/agent-runtime/src/running-tool-placeholder.js +11 -0
  105. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -0
  106. package/dist/agent-runtime/src/runtime-messages.d.ts +104 -0
  107. package/dist/agent-runtime/src/screen-point.d.ts +151 -0
  108. package/dist/agent-runtime/src/sealed-idb.cjs +112 -0
  109. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -0
  110. package/dist/agent-runtime/src/sealed-idb.d.ts +106 -0
  111. package/dist/agent-runtime/src/sealed-idb.js +112 -0
  112. package/dist/agent-runtime/src/sealed-idb.js.map +1 -0
  113. package/dist/agent-runtime/src/send-recovery.d.ts +40 -0
  114. package/dist/agent-runtime/src/statewire-attach-observer.d.ts +194 -0
  115. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
  116. package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
  117. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  118. package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
  119. package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
  120. package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
  121. package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
  122. package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
  123. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
  124. package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
  125. package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
  126. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
  127. package/dist/agent-runtime/src/subagents.cjs +253 -0
  128. package/dist/agent-runtime/src/subagents.cjs.map +1 -0
  129. package/dist/agent-runtime/src/subagents.d.ts +311 -0
  130. package/dist/agent-runtime/src/subagents.js +253 -0
  131. package/dist/agent-runtime/src/subagents.js.map +1 -0
  132. package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
  133. package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
  134. package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
  135. package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
  136. package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
  137. package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
  138. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +329 -0
  139. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -0
  140. package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
  141. package/dist/agent-runtime/src/thread-snapshot-mirror.js +329 -0
  142. package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -0
  143. package/dist/agent-runtime/src/thread-status.d.ts +53 -0
  144. package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
  145. package/dist/agent-runtime/src/tool-names.cjs +67 -0
  146. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  147. package/dist/agent-runtime/src/tool-names.d.ts +60 -0
  148. package/dist/agent-runtime/src/tool-names.js +68 -1
  149. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  150. package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
  151. package/dist/agent-runtime/src/tool-result.cjs +1 -0
  152. package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
  153. package/dist/agent-runtime/src/tool-result.d.ts +126 -0
  154. package/dist/agent-runtime/src/tool-result.js +1 -0
  155. package/dist/agent-runtime/src/tool-result.js.map +1 -1
  156. package/dist/agent-runtime/src/types.d.ts +159 -0
  157. package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
  158. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
  159. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
  160. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
  161. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
  162. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
  163. package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
  164. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
  165. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  166. package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
  167. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
  168. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  169. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +20 -2
  170. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  171. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +168 -0
  172. package/dist/agent-runtime/src/use-deep-agent-runtime.js +20 -2
  173. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  174. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +12 -4
  175. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  176. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +320 -0
  177. package/dist/agent-runtime/src/use-deep-agent-thread.js +12 -4
  178. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  179. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +999 -0
  180. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
  181. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
  182. package/dist/agent-runtime/src/use-deep-agent-voice.js +999 -0
  183. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
  184. package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
  185. package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
  186. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
  187. package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
  188. package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
  189. package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
  190. package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
  191. package/dist/chat/AthenaChat.cjs +77 -6
  192. package/dist/chat/AthenaChat.cjs.map +1 -1
  193. package/dist/chat/AthenaChat.js +78 -7
  194. package/dist/chat/AthenaChat.js.map +1 -1
  195. package/dist/chat/StatewireApprovalCard.d.ts +1 -1
  196. package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
  197. package/dist/chat/StatewireQueuedMessages.cjs +11 -4
  198. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  199. package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
  200. package/dist/chat/StatewireQueuedMessages.js +11 -4
  201. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  202. package/dist/chat/chat-outbox-rows.cjs +223 -0
  203. package/dist/chat/chat-outbox-rows.cjs.map +1 -0
  204. package/dist/chat/chat-outbox-rows.d.ts +29 -0
  205. package/dist/chat/chat-outbox-rows.js +223 -0
  206. package/dist/chat/chat-outbox-rows.js.map +1 -0
  207. package/dist/chat/statewire-approval.d.ts +1 -1
  208. package/dist/chat/statewire-client-tools.d.ts +1 -1
  209. package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
  210. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  211. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
  212. package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
  213. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  214. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
  215. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  216. package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
  217. package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
  218. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  219. package/dist/chat/super-grouping/activity-timeline.cjs +19 -11
  220. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  221. package/dist/chat/super-grouping/activity-timeline.d.ts +25 -9
  222. package/dist/chat/super-grouping/activity-timeline.js +19 -11
  223. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  224. package/dist/chat/use-statewire-approval-request.cjs +36 -0
  225. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  226. package/dist/chat/use-statewire-approval-request.d.ts +49 -1
  227. package/dist/chat/use-statewire-approval-request.js +39 -3
  228. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  229. package/dist/chat-ui/composer/tiptap-composer.cjs +102 -3
  230. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  231. package/dist/chat-ui/composer/tiptap-composer.d.ts +32 -1
  232. package/dist/chat-ui/composer/tiptap-composer.js +103 -4
  233. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  234. package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
  235. package/dist/chat-ui/index.d.ts +1 -1
  236. package/dist/chat-ui/messages/message-components.cjs +15 -0
  237. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  238. package/dist/chat-ui/messages/message-components.js +15 -0
  239. package/dist/chat-ui/messages/message-components.js.map +1 -1
  240. package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
  241. package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
  242. package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
  243. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  244. package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
  245. package/dist/chat-ui/messages/user-edit-composer.js +15 -2
  246. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  247. package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
  248. package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
  249. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  250. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
  251. package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
  252. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  253. package/dist/chat-ui/statewire.cjs +1 -0
  254. package/dist/chat-ui/statewire.cjs.map +1 -1
  255. package/dist/chat-ui/statewire.d.ts +2 -2
  256. package/dist/chat-ui/statewire.js +2 -1
  257. package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
  258. package/dist/composer/AttachmentContext.cjs +8 -4
  259. package/dist/composer/AttachmentContext.cjs.map +1 -1
  260. package/dist/composer/AttachmentContext.d.ts +7 -0
  261. package/dist/composer/AttachmentContext.js +8 -4
  262. package/dist/composer/AttachmentContext.js.map +1 -1
  263. package/dist/composer/build-composed-message.cjs +34 -0
  264. package/dist/composer/build-composed-message.cjs.map +1 -1
  265. package/dist/composer/build-composed-message.d.ts +20 -0
  266. package/dist/composer/build-composed-message.js +35 -1
  267. package/dist/composer/build-composed-message.js.map +1 -1
  268. package/dist/composer/composer-handoff.cjs +39 -2
  269. package/dist/composer/composer-handoff.cjs.map +1 -1
  270. package/dist/composer/composer-handoff.d.ts +28 -3
  271. package/dist/composer/composer-handoff.js +39 -2
  272. package/dist/composer/composer-handoff.js.map +1 -1
  273. package/dist/composer/useAttachFiles.cjs +15 -2
  274. package/dist/composer/useAttachFiles.cjs.map +1 -1
  275. package/dist/composer/useAttachFiles.d.ts +11 -0
  276. package/dist/composer/useAttachFiles.js +15 -2
  277. package/dist/composer/useAttachFiles.js.map +1 -1
  278. package/dist/composer/useSendMessage.cjs.map +1 -1
  279. package/dist/composer/useSendMessage.d.ts +4 -3
  280. package/dist/composer/useSendMessage.js.map +1 -1
  281. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  282. package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
  283. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  284. package/dist/index.cjs +18 -0
  285. package/dist/index.cjs.map +1 -1
  286. package/dist/index.d.ts +15 -6
  287. package/dist/index.js +19 -1
  288. package/dist/index.js.map +1 -1
  289. package/dist/offline/chat-outbox.cjs +57 -0
  290. package/dist/offline/chat-outbox.cjs.map +1 -0
  291. package/dist/offline/chat-outbox.d.ts +80 -0
  292. package/dist/offline/chat-outbox.js +57 -0
  293. package/dist/offline/chat-outbox.js.map +1 -0
  294. package/dist/offline/offline-history.cjs +77 -0
  295. package/dist/offline/offline-history.cjs.map +1 -0
  296. package/dist/offline/offline-history.d.ts +60 -0
  297. package/dist/offline/offline-history.js +77 -0
  298. package/dist/offline/offline-history.js.map +1 -0
  299. package/dist/provider/AthenaProvider.cjs +206 -9
  300. package/dist/provider/AthenaProvider.cjs.map +1 -1
  301. package/dist/provider/AthenaProvider.d.ts +22 -1
  302. package/dist/provider/AthenaProvider.js +207 -10
  303. package/dist/provider/AthenaProvider.js.map +1 -1
  304. package/dist/provider/statewire-window-context.d.ts +1 -1
  305. package/dist/react/package.json.cjs +1 -1
  306. package/dist/react/package.json.js +1 -1
  307. package/dist/references/src/anchors/file-line-range.d.ts +58 -0
  308. package/dist/references/src/anchors/format.d.ts +21 -0
  309. package/dist/references/src/anchors/message-anchors.d.ts +71 -0
  310. package/dist/references/src/anchors/parse.d.ts +8 -0
  311. package/dist/references/src/anchors/registry-contract.d.ts +24 -0
  312. package/dist/references/src/anchors/registry.d.ts +19 -0
  313. package/dist/references/src/anchors/schemas.d.ts +194 -0
  314. package/dist/references/src/anchors/serialize.d.ts +8 -0
  315. package/dist/references/src/anchors/time.d.ts +78 -0
  316. package/dist/references/src/anchors/types.d.ts +474 -0
  317. package/dist/references/src/asset-bounds.d.ts +27 -0
  318. package/dist/references/src/asset-links.d.ts +23 -0
  319. package/dist/references/src/asset-reference.d.ts +16 -0
  320. package/dist/references/src/formats/format-catalog.d.ts +79 -0
  321. package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
  322. package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
  323. package/dist/references/src/formats/object/asset-object.d.ts +9 -0
  324. package/dist/references/src/formats/object/callable-object.d.ts +6 -0
  325. package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
  326. package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
  327. package/dist/references/src/formats/object/group-object.d.ts +9 -0
  328. package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
  329. package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
  330. package/dist/references/src/formats/object/person-object.d.ts +9 -0
  331. package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
  332. package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
  333. package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
  334. package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
  335. package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
  336. package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
  337. package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
  338. package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
  339. package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
  340. package/dist/references/src/index.d.ts +47 -0
  341. package/dist/references/src/legacy/index.d.ts +14 -0
  342. package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
  343. package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
  344. package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
  345. package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
  346. package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
  347. package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
  348. package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
  349. package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
  350. package/dist/references/src/legacy.d.ts +2 -0
  351. package/dist/references/src/mention-href-patterns.d.ts +19 -0
  352. package/dist/references/src/mention-node/index.d.ts +5 -0
  353. package/dist/references/src/mention-node/mention-node.d.ts +31 -0
  354. package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
  355. package/dist/references/src/parse-reference.d.ts +23 -0
  356. package/dist/references/src/schemas.d.ts +463 -0
  357. package/dist/references/src/serialize-reference.d.ts +50 -0
  358. package/dist/references/src/sheet-name.d.ts +10 -0
  359. package/dist/references/src/tool-option-schemas.d.ts +597 -0
  360. package/dist/references/src/types.d.ts +125 -0
  361. package/dist/references/src/version-ref.d.ts +30 -0
  362. package/dist/runtime/statewire-lifecycle.d.ts +1 -1
  363. package/dist/runtime/statewire-model-lane.d.ts +1 -1
  364. package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
  365. package/dist/runtime/statewire-session-key.cjs +7 -0
  366. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  367. package/dist/runtime/statewire-session-key.d.ts +16 -0
  368. package/dist/runtime/statewire-session-key.js +8 -1
  369. package/dist/runtime/statewire-session-key.js.map +1 -1
  370. package/dist/runtime/statewire-session-lane.cjs +48 -0
  371. package/dist/runtime/statewire-session-lane.cjs.map +1 -0
  372. package/dist/runtime/statewire-session-lane.d.ts +29 -0
  373. package/dist/runtime/statewire-session-lane.js +48 -0
  374. package/dist/runtime/statewire-session-lane.js.map +1 -0
  375. package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
  376. package/dist/runtime/useAthenaStatewireRuntime.cjs +16 -5
  377. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  378. package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
  379. package/dist/runtime/useAthenaStatewireRuntime.js +17 -6
  380. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  381. package/dist/styles.css +1 -1
  382. package/dist/threads/api.d.ts +1 -1
  383. package/dist/threads/conversation-list-fetcher.d.ts +1 -1
  384. package/dist/threads/index-triggered-refresh.cjs +164 -0
  385. package/dist/threads/index-triggered-refresh.cjs.map +1 -0
  386. package/dist/threads/index-triggered-refresh.d.ts +70 -0
  387. package/dist/threads/index-triggered-refresh.js +164 -0
  388. package/dist/threads/index-triggered-refresh.js.map +1 -0
  389. package/dist/threads/offline-session-list.cjs +75 -0
  390. package/dist/threads/offline-session-list.cjs.map +1 -0
  391. package/dist/threads/offline-session-list.d.ts +27 -0
  392. package/dist/threads/offline-session-list.js +75 -0
  393. package/dist/threads/offline-session-list.js.map +1 -0
  394. package/dist/threads/pull-request-display.d.ts +1 -1
  395. package/dist/threads/session-list-model.d.ts +1 -1
  396. package/dist/threads/session-list-tab-share.cjs +150 -0
  397. package/dist/threads/session-list-tab-share.cjs.map +1 -0
  398. package/dist/threads/session-list-tab-share.d.ts +73 -0
  399. package/dist/threads/session-list-tab-share.js +150 -0
  400. package/dist/threads/session-list-tab-share.js.map +1 -0
  401. package/dist/threads/session-row-parts.d.ts +1 -1
  402. package/dist/threads/sessions-query.d.ts +1 -1
  403. package/dist/threads/statewire-thread-list.cjs +105 -20
  404. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  405. package/dist/threads/statewire-thread-list.d.ts +31 -3
  406. package/dist/threads/statewire-thread-list.js +107 -22
  407. package/dist/threads/statewire-thread-list.js.map +1 -1
  408. package/dist/threads/thread-prefetcher.d.ts +1 -1
  409. package/dist/threads/use-athena-session-attention.d.ts +1 -1
  410. package/dist/threads/use-athena-sessions.cjs +32 -22
  411. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  412. package/dist/threads/use-athena-sessions.js +33 -23
  413. package/dist/threads/use-athena-sessions.js.map +1 -1
  414. package/dist/threads/use-rest-conversation-history.d.ts +1 -1
  415. package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
  416. package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
  417. package/dist/tools/NestedPtcMessages.cjs +14 -9
  418. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  419. package/dist/tools/NestedPtcMessages.d.ts +9 -0
  420. package/dist/tools/NestedPtcMessages.js +6 -1
  421. package/dist/tools/NestedPtcMessages.js.map +1 -1
  422. package/dist/tools/index.d.ts +1 -1
  423. package/dist/tools/primitives.d.ts +1 -1
  424. package/dist/tools/subagent-task-tool-ui.cjs +494 -0
  425. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
  426. package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
  427. package/dist/tools/subagent-task-tool-ui.js +494 -0
  428. package/dist/tools/subagent-task-tool-ui.js.map +1 -0
  429. package/dist/tools/tool-fallback.d.ts +1 -1
  430. package/dist/tools/tool-icons.d.ts +1 -1
  431. package/dist/tools/tool-summary.d.ts +1 -1
  432. package/dist/tools/tool-uis.cjs +4 -0
  433. package/dist/tools/tool-uis.cjs.map +1 -1
  434. package/dist/tools/tool-uis.js +4 -0
  435. package/dist/tools/tool-uis.js.map +1 -1
  436. package/dist/voice/chat.cjs +6 -0
  437. package/dist/voice/chat.cjs.map +1 -0
  438. package/dist/voice/chat.d.ts +2 -0
  439. package/dist/voice/chat.js +6 -0
  440. package/dist/voice/chat.js.map +1 -0
  441. package/dist/voice/livekit-join.cjs +119 -0
  442. package/dist/voice/livekit-join.cjs.map +1 -0
  443. package/dist/voice/livekit-join.d.ts +8 -0
  444. package/dist/voice/livekit-join.js +119 -0
  445. package/dist/voice/livekit-join.js.map +1 -0
  446. package/dist/voice/livekit.cjs +32 -0
  447. package/dist/voice/livekit.cjs.map +1 -0
  448. package/dist/voice/livekit.d.ts +80 -0
  449. package/dist/voice/livekit.js +32 -0
  450. package/dist/voice/livekit.js.map +1 -0
  451. package/package.json +20 -10
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Tool-result classification shared by every tool card and activity timeline
3
+ * (the React SDK fallback, Olympus, the Chrome extension, the Office add-in,
4
+ * mobile). One rule set for "did this call succeed?", so a result that reads
5
+ * as a failure on one surface cannot read as a success on another.
6
+ *
7
+ * The rules, in order:
8
+ *
9
+ * 0. A `running` status is a running call, whatever result it carries: a part
10
+ * only has both while its result is interim (`isPreliminary` — the
11
+ * backend's running-tool placeholder, see `running-tool-placeholder.ts`),
12
+ * and assistant-ui gives such a part its message's status. A settled
13
+ * result always comes with `complete`.
14
+ * 1. An `incomplete` status is a failure; a `cancelled` reason reads as
15
+ * "Cancelled".
16
+ * 2. A string result opening with "⏸️ Interrupted —" is a **paused** call (the
17
+ * runtime parked it), not a failure.
18
+ * 2b. A result that records the user's refusal at the approval gate (see
19
+ * {@link readRejectedToolResult}) is a **rejected** call — neither a success
20
+ * nor a failure. It is read before the failure rules because the HITL
21
+ * runtime answers a refused call with an error-status tool message whose
22
+ * content is the refusal, which would otherwise read as a plain failure.
23
+ * Never applied to a pass-through payload: page JavaScript relays whatever
24
+ * the page returned, and a `{ status: "rejected" }` from a fetched API is
25
+ * the page's business, not a human decision.
26
+ * 3. A result record whose `success` or `ok` is `false` is a failure, with
27
+ * the best message available (`error`, `message`, `reason`, or a
28
+ * `data.humanIntervention` detail). Athena tools report failures this way
29
+ * — the sheet tools answer `{ success: false, message: "…" }` — so a bare
30
+ * flag must read as a failure. The one exception is a **pass-through
31
+ * payload** (`passThroughPayload: true`): page JavaScript relays whatever
32
+ * the page returned, and `{ success: false, message: "Payment required" }`
33
+ * from a fetched API is the page's business, not the tool failing, so there
34
+ * the flag counts only alongside an error detail (`error`, `errorCode`,
35
+ * `error_code`, or a `humanIntervention` message / reason / code). The
36
+ * Chrome extension opts its `chrome_javascript` tool in; everything else
37
+ * takes the default.
38
+ * 4. A result record with a non-empty `error` string is a failure regardless
39
+ * of flags — every Athena tool contract uses that field only on failure.
40
+ * 5. A plain-string result opening with an explicit error prefix (`Error:`,
41
+ * `Tool execution failed`, `Failed to route tool call`) is a failure —
42
+ * device-tunnel failures arrive in successful ToolMessages, so the prefix
43
+ * is the authoritative signal there. A bare leading "Error" word is not
44
+ * (an "Error handling guide" is content). A batch report that stopped at a
45
+ * step reads its header and failing step.
46
+ * 6. assistant-ui's own `isError` flag is a failure with the best message
47
+ * available.
48
+ * 7. `requires-action` and a result-less non-complete status read as such;
49
+ * everything else is a success.
50
+ */
51
+ /** The status shape a tool-call message part carries (structurally typed so this module stays UI-library-free). */
52
+ export interface ToolCallStatusLike {
53
+ type: 'running' | 'complete' | 'incomplete' | 'requires-action';
54
+ reason?: string;
55
+ error?: unknown;
56
+ }
57
+ export interface ToolFailure {
58
+ message: string;
59
+ code?: string;
60
+ }
61
+ export type ToolResultClassification = {
62
+ state: 'running';
63
+ } | {
64
+ state: 'complete';
65
+ } | {
66
+ state: 'requires-action';
67
+ } | {
68
+ state: 'paused';
69
+ notice: string;
70
+ } | {
71
+ state: 'rejected';
72
+ rejection: RejectedToolResult;
73
+ } | {
74
+ state: 'error';
75
+ failure: ToolFailure;
76
+ };
77
+ export type ToolResultState = ToolResultClassification['state'];
78
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
79
+ /** Parse a JSON string into a record, or `null` when it is not one. */
80
+ export declare function parseJsonRecord(value: string): Record<string, unknown> | null;
81
+ /** The result as a record: parsed when it arrived as a JSON string. */
82
+ export declare function resultRecord(result: unknown): Record<string, unknown> | null;
83
+ /** The first non-blank string among `keys` on `record`, or `null`. */
84
+ export declare function stringField(record: Record<string, unknown> | null | undefined, keys: readonly string[]): string | null;
85
+ /** The `message` a result carries, when it does (the row's completion summary). */
86
+ export declare function resultMessage(result: unknown): string | null;
87
+ /** The failure a tool call reports, or `null` when it succeeded (rules 1, 3-6). */
88
+ export declare function toolFailure({ status, result, isError, passThroughPayload, }: {
89
+ status?: ToolCallStatusLike;
90
+ result?: unknown;
91
+ isError?: boolean;
92
+ /** The result is an application payload relayed verbatim (rule 3): a flag needs an error detail to count. */
93
+ passThroughPayload?: boolean;
94
+ }): ToolFailure | null;
95
+ /** Classify a tool call for rendering (see the module docs for the rules). */
96
+ export declare function classifyToolResult({ status, result, isError, passThroughPayload, }: {
97
+ status?: ToolCallStatusLike;
98
+ result?: unknown;
99
+ isError?: boolean;
100
+ /** The result is an application payload relayed verbatim (rule 3): a flag needs an error detail to count. */
101
+ passThroughPayload?: boolean;
102
+ }): ToolResultClassification;
103
+ /** True when a completed call reads as a success under the shared rules. */
104
+ export declare function isToolResultSuccess(result: unknown): boolean;
105
+ /**
106
+ * A gated tool call the user rejected still "completes": both HITL runtimes
107
+ * answer the rejected call with a `ToolMessage` whose text is the rejection
108
+ * ("Tool call rejected by user. Reason: …"), and device tools may answer with
109
+ * a structured decision (`{ status: 'rejected' }`, `{ action: 'reject' }`,
110
+ * `{ decision: 'rejected' }`). Anything that labels a finished call has to
111
+ * read that, or a rejected email send reports itself as sent. The read is
112
+ * content-based, so it is scoped to where a rejection can appear: the opening
113
+ * of a string result, never deep inside returned content, and never a
114
+ * pass-through page payload (see {@link classifyToolResult}).
115
+ */
116
+ export interface RejectedToolResult {
117
+ /** The feedback the user typed, when they gave one. */
118
+ reason: string | null;
119
+ }
120
+ /**
121
+ * Read a rejection out of a completed tool call's result, or `null` when the
122
+ * call actually ran (or failed for a non-approval reason).
123
+ */
124
+ export declare function readRejectedToolResult(result: unknown): RejectedToolResult | null;
125
+ /** True when a completed call's result records that the user rejected it. */
126
+ export declare function isRejectedToolResult(result: unknown): boolean;
@@ -97,6 +97,7 @@ function classifyToolResult({
97
97
  isError,
98
98
  passThroughPayload
99
99
  }) {
100
+ if ((status == null ? void 0 : status.type) === "running") return { state: "running" };
100
101
  const notice = pausedNotice(result);
101
102
  if (notice) return { state: "paused", notice };
102
103
  const rejection = passThroughPayload ? null : readRejectedToolResult(result);
@@ -1 +1 @@
1
- {"version":3,"file":"tool-result.js","sources":["../../../../agent-runtime/src/tool-result.ts"],"sourcesContent":["/**\n * Tool-result classification shared by every tool card and activity timeline\n * (the React SDK fallback, Olympus, the Chrome extension, the Office add-in,\n * mobile). One rule set for \"did this call succeed?\", so a result that reads\n * as a failure on one surface cannot read as a success on another.\n *\n * The rules, in order:\n *\n * 1. An `incomplete` status is a failure; a `cancelled` reason reads as\n * \"Cancelled\".\n * 2. A string result opening with \"⏸️ Interrupted —\" is a **paused** call (the\n * runtime parked it), not a failure.\n * 2b. A result that records the user's refusal at the approval gate (see\n * {@link readRejectedToolResult}) is a **rejected** call — neither a success\n * nor a failure. It is read before the failure rules because the HITL\n * runtime answers a refused call with an error-status tool message whose\n * content is the refusal, which would otherwise read as a plain failure.\n * Never applied to a pass-through payload: page JavaScript relays whatever\n * the page returned, and a `{ status: \"rejected\" }` from a fetched API is\n * the page's business, not a human decision.\n * 3. A result record whose `success` or `ok` is `false` is a failure, with\n * the best message available (`error`, `message`, `reason`, or a\n * `data.humanIntervention` detail). Athena tools report failures this way\n * — the sheet tools answer `{ success: false, message: \"…\" }` — so a bare\n * flag must read as a failure. The one exception is a **pass-through\n * payload** (`passThroughPayload: true`): page JavaScript relays whatever\n * the page returned, and `{ success: false, message: \"Payment required\" }`\n * from a fetched API is the page's business, not the tool failing, so there\n * the flag counts only alongside an error detail (`error`, `errorCode`,\n * `error_code`, or a `humanIntervention` message / reason / code). The\n * Chrome extension opts its `chrome_javascript` tool in; everything else\n * takes the default.\n * 4. A result record with a non-empty `error` string is a failure regardless\n * of flags — every Athena tool contract uses that field only on failure.\n * 5. A plain-string result opening with an explicit error prefix (`Error:`,\n * `Tool execution failed`, `Failed to route tool call`) is a failure —\n * device-tunnel failures arrive in successful ToolMessages, so the prefix\n * is the authoritative signal there. A bare leading \"Error\" word is not\n * (an \"Error handling guide\" is content). A batch report that stopped at a\n * step reads its header and failing step.\n * 6. assistant-ui's own `isError` flag is a failure with the best message\n * available.\n * 7. `requires-action` and a result-less non-complete status read as such;\n * everything else is a success.\n */\n\n/** The status shape a tool-call message part carries (structurally typed so this module stays UI-library-free). */\nexport interface ToolCallStatusLike {\n type: 'running' | 'complete' | 'incomplete' | 'requires-action';\n reason?: string;\n error?: unknown;\n}\n\nexport interface ToolFailure {\n message: string;\n code?: string;\n}\n\nexport type ToolResultClassification =\n | { state: 'running' }\n | { state: 'complete' }\n | { state: 'requires-action' }\n | { state: 'paused'; notice: string }\n | { state: 'rejected'; rejection: RejectedToolResult }\n | { state: 'error'; failure: ToolFailure };\n\nexport type ToolResultState = ToolResultClassification['state'];\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Parse a JSON string into a record, or `null` when it is not one. */\nexport function parseJsonRecord(value: string): Record<string, unknown> | null {\n try {\n const parsed: unknown = JSON.parse(value);\n return isRecord(parsed) ? parsed : null;\n } catch {\n return null;\n }\n}\n\n/** The result as a record: parsed when it arrived as a JSON string. */\nexport function resultRecord(result: unknown): Record<string, unknown> | null {\n if (typeof result === 'string') return parseJsonRecord(result);\n return isRecord(result) ? result : null;\n}\n\n/** The first non-blank string among `keys` on `record`, or `null`. */\nexport function stringField(\n record: Record<string, unknown> | null | undefined,\n keys: readonly string[],\n): string | null {\n if (!record) return null;\n for (const key of keys) {\n const value = record[key];\n if (typeof value === 'string' && value.trim()) return value;\n }\n return null;\n}\n\n/** The `message` a result carries, when it does (the row's completion summary). */\nexport function resultMessage(result: unknown): string | null {\n return stringField(resultRecord(result), ['message']);\n}\n\nconst FAILURE_DETAIL_KEYS = ['error', 'errorCode', 'error_code'] as const;\nconst INTERVENTION_DETAIL_KEYS = ['message', 'reason', 'errorCode', 'error_code'] as const;\nconst FAILURE_CODE_KEYS = ['errorCode', 'error_code', 'code'] as const;\nconst FAILURE_MESSAGE_KEYS = ['error', 'message', 'reason'] as const;\n\nfunction batchReportFailure(trimmed: string): string | null {\n const lines = trimmed.split('\\n');\n const header = lines[0]?.trim() ?? '';\n if (!/^[\\w.-]*batch: \\d+\\/\\d+ ok — STOPPED at step \\d+/.test(header)) {\n return null;\n }\n const stepError = lines\n .map((line) => line.trim())\n .find(\n (line) =>\n /^\\d+\\.\\s/.test(line) && (line.includes(' ERROR — ') || line.endsWith(' ERROR')),\n );\n return stepError ? `${header}\\n${stepError}` : header;\n}\n\nconst STRING_ERROR_PREFIX = /^(?:Error:|Tool execution failed\\b|Failed to route tool call\\b)\\s*/;\n\nfunction plainStringError(result: unknown): string | null {\n if (typeof result !== 'string') return null;\n const trimmed = result.trim();\n if (!trimmed || parseJsonRecord(trimmed)) return null;\n if (STRING_ERROR_PREFIX.test(trimmed)) {\n return trimmed.replace(STRING_ERROR_PREFIX, '').trim() || trimmed;\n }\n return batchReportFailure(trimmed);\n}\n\nfunction pausedNotice(result: unknown): string | null {\n if (typeof result !== 'string') return null;\n const trimmed = result.trim();\n return /^⏸️?\\s*Interrupted —/.test(trimmed) ? trimmed : null;\n}\n\nfunction stringifyUnknown(value: unknown): string | null {\n if (value == null) return null;\n if (typeof value === 'string') return value;\n if (value instanceof Error) return value.message;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\n/** The failure a tool call reports, or `null` when it succeeded (rules 1, 3-6). */\nexport function toolFailure({\n status,\n result,\n isError,\n passThroughPayload = false,\n}: {\n status?: ToolCallStatusLike;\n result?: unknown;\n isError?: boolean;\n /** The result is an application payload relayed verbatim (rule 3): a flag needs an error detail to count. */\n passThroughPayload?: boolean;\n}): ToolFailure | null {\n if (status?.type === 'incomplete') {\n const errorText = stringifyUnknown(status.error);\n return {\n message:\n errorText ??\n (status.reason === 'cancelled' ? 'Cancelled' : `Tool stopped: ${status.reason}`),\n };\n }\n\n const record = resultRecord(result);\n const data = isRecord(record?.data) ? record.data : null;\n const humanIntervention = isRecord(data?.humanIntervention) ? data.humanIntervention : null;\n const failureDetail =\n stringField(record, FAILURE_DETAIL_KEYS) ??\n stringField(humanIntervention, INTERVENTION_DETAIL_KEYS);\n const flagged = record?.success === false || record?.ok === false;\n const flaggedFailure = flagged && (!passThroughPayload || failureDetail !== null);\n const errorField = stringField(record, ['error']) !== null;\n const stringError = plainStringError(result);\n\n if (!isError && !flaggedFailure && !errorField && !stringError) return null;\n\n const code =\n stringField(record, FAILURE_CODE_KEYS) ??\n stringField(humanIntervention, FAILURE_CODE_KEYS) ??\n undefined;\n const message =\n stringField(record, FAILURE_MESSAGE_KEYS) ??\n stringField(humanIntervention, FAILURE_MESSAGE_KEYS) ??\n stringError ??\n (typeof result === 'string' && !parseJsonRecord(result) ? result : null) ??\n 'Tool execution failed';\n\n return { message, code };\n}\n\n/** Classify a tool call for rendering (see the module docs for the rules). */\nexport function classifyToolResult({\n status,\n result,\n isError,\n passThroughPayload,\n}: {\n status?: ToolCallStatusLike;\n result?: unknown;\n isError?: boolean;\n /** The result is an application payload relayed verbatim (rule 3): a flag needs an error detail to count. */\n passThroughPayload?: boolean;\n}): ToolResultClassification {\n const notice = pausedNotice(result);\n if (notice) return { state: 'paused', notice };\n\n const rejection = passThroughPayload ? null : readRejectedToolResult(result);\n if (rejection) return { state: 'rejected', rejection };\n\n const failure = toolFailure({ status, result, isError, passThroughPayload });\n if (failure) return { state: 'error', failure };\n if (status?.type === 'requires-action') return { state: 'requires-action' };\n if (result === undefined && status?.type !== 'complete') {\n return { state: 'running' };\n }\n return { state: 'complete' };\n}\n\n/** True when a completed call reads as a success under the shared rules. */\nexport function isToolResultSuccess(result: unknown): boolean {\n return classifyToolResult({ status: { type: 'complete' }, result }).state === 'complete';\n}\n\n/**\n * A gated tool call the user rejected still \"completes\": both HITL runtimes\n * answer the rejected call with a `ToolMessage` whose text is the rejection\n * (\"Tool call rejected by user. Reason: …\"), and device tools may answer with\n * a structured decision (`{ status: 'rejected' }`, `{ action: 'reject' }`,\n * `{ decision: 'rejected' }`). Anything that labels a finished call has to\n * read that, or a rejected email send reports itself as sent. The read is\n * content-based, so it is scoped to where a rejection can appear: the opening\n * of a string result, never deep inside returned content, and never a\n * pass-through page payload (see {@link classifyToolResult}).\n */\nexport interface RejectedToolResult {\n /** The feedback the user typed, when they gave one. */\n reason: string | null;\n}\n\n/**\n * Phrasings the HITL runtimes use for a *human* rejection. Matching on these\n * rather than the word \"reject\" keeps deterministic failures out — argument\n * validation answers a call with \"Tool call rejected — ValidationError: …\",\n * which never involved the user and stays a plain failure.\n */\nconst USER_REJECTION_PATTERNS: readonly RegExp[] = [/rejected by (?:the )?user/i, /user rejected/i];\n\n/**\n * A rejection IS the tool message, so the phrasing opens it: \"The user rejected\n * this action. …\" (`hitl_bridge.py`), \"Tool call rejected by user. Reason: …\",\n * \"Tool 'x' execution rejected by user. …\", \"[INTERRUPT] Custom interrupt\n * '<uuid>' rejected by user. …\". Content a tool merely *returned* — a page read\n * or a document whose text happens to say a user rejected something — carries\n * the phrase deeper in, so only a match starting within this many characters\n * of the first line counts.\n */\nconst USER_REJECTION_LEAD_CHARS = 100;\n\n/** Whether `result` opens with a human-rejection phrasing (see {@link USER_REJECTION_LEAD_CHARS}). */\nfunction opensWithUserRejection(result: string): boolean {\n const firstLine = result.trimStart().split('\\n', 1)[0] ?? '';\n return USER_REJECTION_PATTERNS.some((pattern) => {\n const index = firstLine.search(pattern);\n return index !== -1 && index < USER_REJECTION_LEAD_CHARS;\n });\n}\n\n/** Reject-with-no-feedback placeholder the legacy approval editor sends. */\nconst NO_REASON = 'no reason provided';\n\n/**\n * Model-facing guidance the legacy HITL node appends on the same line after\n * the reason (\"… Reason: <reason> Acknowledge in one short sentence. Do not\n * retry…\"). It is instruction for the model, not the user's feedback.\n */\nconst TRAILING_GUIDANCE = /\\s*Acknowledge in one short sentence\\..*$/i;\n\n/**\n * How LangChain's HITL middleware answers a refused call: \"User rejected the\n * tool call for `x` with reason: <message>\", where <message> is the one the\n * deep-agent bridge (`hitl_bridge.py`) handed it.\n */\nconst MIDDLEWARE_ENVELOPE = /^User rejected the tool call for `[^`]*` with reason:\\s*/i;\n\n/**\n * The bridge's refusal, which opens its message. Inside the middleware envelope\n * it is scaffolding, not feedback; the member's own reason, when they gave one,\n * follows it as \"Reason: …\". Outside the envelope the text after \"Reason:\" is\n * the member's, whatever it says.\n */\nconst BRIDGE_REFUSAL = /^The user rejected this action\\.\\s*/i;\n\n/** Everything after \"Reason:\"; feedback typed in the approval editor can span lines. */\nconst REASON_TAIL = /Reason:\\s*([\\s\\S]+)/i;\n\nfunction readRejectionReason(result: string): string | null {\n const text = result.trim();\n const envelope = MIDDLEWARE_ENVELOPE.exec(text);\n let reason: string | undefined;\n if (envelope) {\n const message = text.slice(envelope[0].length).replace(TRAILING_GUIDANCE, '').trim();\n reason = BRIDGE_REFUSAL.test(message)\n ? message.replace(BRIDGE_REFUSAL, '').match(/^Reason:\\s*([\\s\\S]+)/i)?.[1]\n : message;\n } else {\n reason = text.match(REASON_TAIL)?.[1]?.replace(TRAILING_GUIDANCE, '');\n }\n reason = reason?.trim();\n if (!reason || reason.toLowerCase() === NO_REASON) return null;\n return reason;\n}\n\n/**\n * Read a rejection out of a completed tool call's result, or `null` when the\n * call actually ran (or failed for a non-approval reason).\n */\nexport function readRejectedToolResult(result: unknown): RejectedToolResult | null {\n if (typeof result === 'string') {\n if (!opensWithUserRejection(result)) return null;\n return { reason: readRejectionReason(result) };\n }\n if (!isRecord(result)) return null;\n if (result.status === 'rejected' || result.action === 'reject' || result.decision === 'rejected') {\n return { reason: stringField(result, ['reason']) };\n }\n return null;\n}\n\n/** True when a completed call's result records that the user rejected it. */\nexport function isRejectedToolResult(result: unknown): boolean {\n return readRejectedToolResult(result) !== null;\n}\n"],"names":[],"mappings":"AAoEO,SAAS,SAAS,OAAkD;AACzE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,C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AAO,wBAAwB,KAAK,CAAC,YAAY;AAC/C,UAAM,QAAQ,UAAU,OAAO,OAAO;AACtC,WAAO,UAAU,MAAM,QAAQ;AAAA,EACjC,CAAC;AACH;AAGA,MAAM,YAAY;AAOlB,MAAM,oBAAoB;AAO1B,MAAM,sBAAsB;AAQ5B,MAAM,iBAAiB;AAGvB,MAAM,cAAc;AAEpB,SAAS,oBAAoB,QAA+B;AAjPrD;AAkPL,QAAM,OAAO,OAAO,KAAA;AACpB,QAAM,WAAW,oBAAoB,KAAK,IAAI;AAC9C,MAAI;AACJ,MAAI,UAAU;AACZ,UAAM,UAAU,KAAK,MAAM,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,mBAAmB,EAAE,EAAE,KAAA;AAC9E,aAAS,eAAe,KAAK,OAAO,KAChC,aAAQ,QAAQ,gBAAgB,EAAE,EAAE,MAAM,uBAAuB,MAAjE,mBAAqE,KACrE;AAAA,EACN,OAAO;AACL,cAAS,gBAAK,MAAM,WAAW,MAAtB,mBAA0B,OAA1B,mBAA8B,QAAQ,mBAAmB;AAAA,EACpE;AACA,WAAS,iCAAQ;AACjB,MAAI,CAAC,UAAU,OAAO,YAAA,MAAkB,UAAW,QAAO;AAC1D,SAAO;AACT;AAMO,SAAS,uBAAuB,QAA4C;AACjF,MAAI,OAAO,WAAW,UAAU;AAC9B,QAAI,CAAC,uBAAuB,MAAM,EAAG,QAAO;AAC5C,WAAO,EAAE,QAAQ,oBAAoB,MAAM,EAAA;AAAA,EAC7C;AACA,MAAI,CAAC,SAAS,MAAM,EAAG,QAAO;AAC9B,MAAI,OAAO,WAAW,cAAc,OAAO,WAAW,YAAY,OAAO,aAAa,YAAY;AAChG,WAAO,EAAE,QAAQ,YAAY,QAAQ,CAAC,QAAQ,CAAC,EAAA;AAAA,EACjD;AACA,SAAO;AACT;"}
1
+ {"version":3,"file":"tool-result.js","sources":["../../../../agent-runtime/src/tool-result.ts"],"sourcesContent":["/**\n * Tool-result classification shared by every tool card and activity timeline\n * (the React SDK fallback, Olympus, the Chrome extension, the Office add-in,\n * mobile). One rule set for \"did this call succeed?\", so a result that reads\n * as a failure on one surface cannot read as a success on another.\n *\n * The rules, in order:\n *\n * 0. A `running` status is a running call, whatever result it carries: a part\n * only has both while its result is interim (`isPreliminary` — the\n * backend's running-tool placeholder, see `running-tool-placeholder.ts`),\n * and assistant-ui gives such a part its message's status. A settled\n * result always comes with `complete`.\n * 1. An `incomplete` status is a failure; a `cancelled` reason reads as\n * \"Cancelled\".\n * 2. A string result opening with \"⏸️ Interrupted —\" is a **paused** call (the\n * runtime parked it), not a failure.\n * 2b. A result that records the user's refusal at the approval gate (see\n * {@link readRejectedToolResult}) is a **rejected** call — neither a success\n * nor a failure. It is read before the failure rules because the HITL\n * runtime answers a refused call with an error-status tool message whose\n * content is the refusal, which would otherwise read as a plain failure.\n * Never applied to a pass-through payload: page JavaScript relays whatever\n * the page returned, and a `{ status: \"rejected\" }` from a fetched API is\n * the page's business, not a human decision.\n * 3. A result record whose `success` or `ok` is `false` is a failure, with\n * the best message available (`error`, `message`, `reason`, or a\n * `data.humanIntervention` detail). Athena tools report failures this way\n * — the sheet tools answer `{ success: false, message: \"…\" }` — so a bare\n * flag must read as a failure. The one exception is a **pass-through\n * payload** (`passThroughPayload: true`): page JavaScript relays whatever\n * the page returned, and `{ success: false, message: \"Payment required\" }`\n * from a fetched API is the page's business, not the tool failing, so there\n * the flag counts only alongside an error detail (`error`, `errorCode`,\n * `error_code`, or a `humanIntervention` message / reason / code). The\n * Chrome extension opts its `chrome_javascript` tool in; everything else\n * takes the default.\n * 4. A result record with a non-empty `error` string is a failure regardless\n * of flags — every Athena tool contract uses that field only on failure.\n * 5. A plain-string result opening with an explicit error prefix (`Error:`,\n * `Tool execution failed`, `Failed to route tool call`) is a failure —\n * device-tunnel failures arrive in successful ToolMessages, so the prefix\n * is the authoritative signal there. A bare leading \"Error\" word is not\n * (an \"Error handling guide\" is content). A batch report that stopped at a\n * step reads its header and failing step.\n * 6. assistant-ui's own `isError` flag is a failure with the best message\n * available.\n * 7. `requires-action` and a result-less non-complete status read as such;\n * everything else is a success.\n */\n\n/** The status shape a tool-call message part carries (structurally typed so this module stays UI-library-free). */\nexport interface ToolCallStatusLike {\n type: 'running' | 'complete' | 'incomplete' | 'requires-action';\n reason?: string;\n error?: unknown;\n}\n\nexport interface ToolFailure {\n message: string;\n code?: string;\n}\n\nexport type ToolResultClassification =\n | { state: 'running' }\n | { state: 'complete' }\n | { state: 'requires-action' }\n | { state: 'paused'; notice: string }\n | { state: 'rejected'; rejection: RejectedToolResult }\n | { state: 'error'; failure: ToolFailure };\n\nexport type ToolResultState = ToolResultClassification['state'];\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Parse a JSON string into a record, or `null` when it is not one. */\nexport function parseJsonRecord(value: string): Record<string, unknown> | null {\n try {\n const parsed: unknown = JSON.parse(value);\n return isRecord(parsed) ? parsed : null;\n } catch {\n return null;\n }\n}\n\n/** The result as a record: parsed when it arrived as a JSON string. */\nexport function resultRecord(result: unknown): Record<string, unknown> | null {\n if (typeof result === 'string') return parseJsonRecord(result);\n return isRecord(result) ? result : null;\n}\n\n/** The first non-blank string among `keys` on `record`, or `null`. */\nexport function stringField(\n record: Record<string, unknown> | null | undefined,\n keys: readonly string[],\n): string | null {\n if (!record) return null;\n for (const key of keys) {\n const value = record[key];\n if (typeof value === 'string' && value.trim()) return value;\n }\n return null;\n}\n\n/** The `message` a result carries, when it does (the row's completion summary). */\nexport function resultMessage(result: unknown): string | null {\n return stringField(resultRecord(result), ['message']);\n}\n\nconst FAILURE_DETAIL_KEYS = ['error', 'errorCode', 'error_code'] as const;\nconst INTERVENTION_DETAIL_KEYS = ['message', 'reason', 'errorCode', 'error_code'] as const;\nconst FAILURE_CODE_KEYS = ['errorCode', 'error_code', 'code'] as const;\nconst FAILURE_MESSAGE_KEYS = ['error', 'message', 'reason'] as const;\n\nfunction batchReportFailure(trimmed: string): string | null {\n const lines = trimmed.split('\\n');\n const header = lines[0]?.trim() ?? '';\n if (!/^[\\w.-]*batch: \\d+\\/\\d+ ok — STOPPED at step \\d+/.test(header)) {\n return null;\n }\n const stepError = lines\n .map((line) => line.trim())\n .find(\n (line) =>\n /^\\d+\\.\\s/.test(line) && (line.includes(' ERROR — ') || line.endsWith(' ERROR')),\n );\n return stepError ? `${header}\\n${stepError}` : header;\n}\n\nconst STRING_ERROR_PREFIX = /^(?:Error:|Tool execution failed\\b|Failed to route tool call\\b)\\s*/;\n\nfunction plainStringError(result: unknown): string | null {\n if (typeof result !== 'string') return null;\n const trimmed = result.trim();\n if (!trimmed || parseJsonRecord(trimmed)) return null;\n if (STRING_ERROR_PREFIX.test(trimmed)) {\n return trimmed.replace(STRING_ERROR_PREFIX, '').trim() || trimmed;\n }\n return batchReportFailure(trimmed);\n}\n\nfunction pausedNotice(result: unknown): string | null {\n if (typeof result !== 'string') return null;\n const trimmed = result.trim();\n return /^⏸️?\\s*Interrupted —/.test(trimmed) ? trimmed : null;\n}\n\nfunction stringifyUnknown(value: unknown): string | null {\n if (value == null) return null;\n if (typeof value === 'string') return value;\n if (value instanceof Error) return value.message;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\n/** The failure a tool call reports, or `null` when it succeeded (rules 1, 3-6). */\nexport function toolFailure({\n status,\n result,\n isError,\n passThroughPayload = false,\n}: {\n status?: ToolCallStatusLike;\n result?: unknown;\n isError?: boolean;\n /** The result is an application payload relayed verbatim (rule 3): a flag needs an error detail to count. */\n passThroughPayload?: boolean;\n}): ToolFailure | null {\n if (status?.type === 'incomplete') {\n const errorText = stringifyUnknown(status.error);\n return {\n message:\n errorText ??\n (status.reason === 'cancelled' ? 'Cancelled' : `Tool stopped: ${status.reason}`),\n };\n }\n\n const record = resultRecord(result);\n const data = isRecord(record?.data) ? record.data : null;\n const humanIntervention = isRecord(data?.humanIntervention) ? data.humanIntervention : null;\n const failureDetail =\n stringField(record, FAILURE_DETAIL_KEYS) ??\n stringField(humanIntervention, INTERVENTION_DETAIL_KEYS);\n const flagged = record?.success === false || record?.ok === false;\n const flaggedFailure = flagged && (!passThroughPayload || failureDetail !== null);\n const errorField = stringField(record, ['error']) !== null;\n const stringError = plainStringError(result);\n\n if (!isError && !flaggedFailure && !errorField && !stringError) return null;\n\n const code =\n stringField(record, FAILURE_CODE_KEYS) ??\n stringField(humanIntervention, FAILURE_CODE_KEYS) ??\n undefined;\n const message =\n stringField(record, FAILURE_MESSAGE_KEYS) ??\n stringField(humanIntervention, FAILURE_MESSAGE_KEYS) ??\n stringError ??\n (typeof result === 'string' && !parseJsonRecord(result) ? result : null) ??\n 'Tool execution failed';\n\n return { message, code };\n}\n\n/** Classify a tool call for rendering (see the module docs for the rules). */\nexport function classifyToolResult({\n status,\n result,\n isError,\n passThroughPayload,\n}: {\n status?: ToolCallStatusLike;\n result?: unknown;\n isError?: boolean;\n /** The result is an application payload relayed verbatim (rule 3): a flag needs an error detail to count. */\n passThroughPayload?: boolean;\n}): ToolResultClassification {\n if (status?.type === 'running') return { state: 'running' };\n\n const notice = pausedNotice(result);\n if (notice) return { state: 'paused', notice };\n\n const rejection = passThroughPayload ? null : readRejectedToolResult(result);\n if (rejection) return { state: 'rejected', rejection };\n\n const failure = toolFailure({ status, result, isError, passThroughPayload });\n if (failure) return { state: 'error', failure };\n if (status?.type === 'requires-action') return { state: 'requires-action' };\n if (result === undefined && status?.type !== 'complete') {\n return { state: 'running' };\n }\n return { state: 'complete' };\n}\n\n/** True when a completed call reads as a success under the shared rules. */\nexport function isToolResultSuccess(result: unknown): boolean {\n return classifyToolResult({ status: { type: 'complete' }, result }).state === 'complete';\n}\n\n/**\n * A gated tool call the user rejected still \"completes\": both HITL runtimes\n * answer the rejected call with a `ToolMessage` whose text is the rejection\n * (\"Tool call rejected by user. Reason: …\"), and device tools may answer with\n * a structured decision (`{ status: 'rejected' }`, `{ action: 'reject' }`,\n * `{ decision: 'rejected' }`). Anything that labels a finished call has to\n * read that, or a rejected email send reports itself as sent. The read is\n * content-based, so it is scoped to where a rejection can appear: the opening\n * of a string result, never deep inside returned content, and never a\n * pass-through page payload (see {@link classifyToolResult}).\n */\nexport interface RejectedToolResult {\n /** The feedback the user typed, when they gave one. */\n reason: string | null;\n}\n\n/**\n * Phrasings the HITL runtimes use for a *human* rejection. Matching on these\n * rather than the word \"reject\" keeps deterministic failures out — argument\n * validation answers a call with \"Tool call rejected — ValidationError: …\",\n * which never involved the user and stays a plain failure.\n */\nconst USER_REJECTION_PATTERNS: readonly RegExp[] = [/rejected by (?:the )?user/i, /user rejected/i];\n\n/**\n * A rejection IS the tool message, so the phrasing opens it: \"The user rejected\n * this action. …\" (`hitl_bridge.py`), \"Tool call rejected by user. Reason: …\",\n * \"Tool 'x' execution rejected by user. …\", \"[INTERRUPT] Custom interrupt\n * '<uuid>' rejected by user. …\". Content a tool merely *returned* — a page read\n * or a document whose text happens to say a user rejected something — carries\n * the phrase deeper in, so only a match starting within this many characters\n * of the first line counts.\n */\nconst USER_REJECTION_LEAD_CHARS = 100;\n\n/** Whether `result` opens with a human-rejection phrasing (see {@link USER_REJECTION_LEAD_CHARS}). */\nfunction opensWithUserRejection(result: string): boolean {\n const firstLine = result.trimStart().split('\\n', 1)[0] ?? '';\n return USER_REJECTION_PATTERNS.some((pattern) => {\n const index = firstLine.search(pattern);\n return index !== -1 && index < USER_REJECTION_LEAD_CHARS;\n });\n}\n\n/** Reject-with-no-feedback placeholder the legacy approval editor sends. */\nconst NO_REASON = 'no reason provided';\n\n/**\n * Model-facing guidance the legacy HITL node appends on the same line after\n * the reason (\"… Reason: <reason> Acknowledge in one short sentence. Do not\n * retry…\"). It is instruction for the model, not the user's feedback.\n */\nconst TRAILING_GUIDANCE = /\\s*Acknowledge in one short sentence\\..*$/i;\n\n/**\n * How LangChain's HITL middleware answers a refused call: \"User rejected the\n * tool call for `x` with reason: <message>\", where <message> is the one the\n * deep-agent bridge (`hitl_bridge.py`) handed it.\n */\nconst MIDDLEWARE_ENVELOPE = /^User rejected the tool call for `[^`]*` with reason:\\s*/i;\n\n/**\n * The bridge's refusal, which opens its message. Inside the middleware envelope\n * it is scaffolding, not feedback; the member's own reason, when they gave one,\n * follows it as \"Reason: …\". Outside the envelope the text after \"Reason:\" is\n * the member's, whatever it says.\n */\nconst BRIDGE_REFUSAL = /^The user rejected this action\\.\\s*/i;\n\n/** Everything after \"Reason:\"; feedback typed in the approval editor can span lines. */\nconst REASON_TAIL = /Reason:\\s*([\\s\\S]+)/i;\n\nfunction readRejectionReason(result: string): string | null {\n const text = result.trim();\n const envelope = MIDDLEWARE_ENVELOPE.exec(text);\n let reason: string | undefined;\n if (envelope) {\n const message = text.slice(envelope[0].length).replace(TRAILING_GUIDANCE, '').trim();\n reason = BRIDGE_REFUSAL.test(message)\n ? message.replace(BRIDGE_REFUSAL, '').match(/^Reason:\\s*([\\s\\S]+)/i)?.[1]\n : message;\n } else {\n reason = text.match(REASON_TAIL)?.[1]?.replace(TRAILING_GUIDANCE, '');\n }\n reason = reason?.trim();\n if (!reason || reason.toLowerCase() === NO_REASON) return null;\n return reason;\n}\n\n/**\n * Read a rejection out of a completed tool call's result, or `null` when the\n * call actually ran (or failed for a non-approval reason).\n */\nexport function readRejectedToolResult(result: unknown): RejectedToolResult | null {\n if (typeof result === 'string') {\n if (!opensWithUserRejection(result)) return null;\n return { reason: readRejectionReason(result) };\n }\n if (!isRecord(result)) return null;\n if (result.status === 'rejected' || result.action === 'reject' || result.decision === 'rejected') {\n return { reason: stringField(result, ['reason']) };\n }\n return null;\n}\n\n/** True when a completed call's result records that the user rejected it. */\nexport function isRejectedToolResult(result: unknown): boolean {\n return readRejectedToolResult(result) !== null;\n}\n"],"names":[],"mappings":"AAyEO,SAAS,SAAS,OAAkD;AACzE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAGO,SAAS,gBAAgB,OAA+C;AAC7E,MAAI;AACF,UAA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C,YAAY;AAC/C,UAAM,QAAQ,UAAU,OAAO,OAAO;AACtC,WAAO,UAAU,MAAM,QAAQ;AAAA,EACjC,CAAC;AACH;AAGA,MAAM,YAAY;AAOlB,MAAM,oBAAoB;AAO1B,MAAM,sBAAsB;AAQ5B,MAAM,iBAAiB;AAGvB,MAAM,cAAc;AAEpB,SAAS,oBAAoB,QAA+B;AAnPrD;AAoPL,QAAM,OAAO,OAAO,KAAA;AACpB,QAAM,WAAW,oBAAoB,KAAK,IAAI;AAC9C,MAAI;AACJ,MAAI,UAAU;AACZ,UAAM,UAAU,KAAK,MAAM,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,mBAAmB,EAAE,EAAE,KAAA;AAC9E,aAAS,eAAe,KAAK,OAAO,KAChC,aAAQ,QAAQ,gBAAgB,EAAE,EAAE,MAAM,uBAAuB,MAAjE,mBAAqE,KACrE;AAAA,EACN,OAAO;AACL,cAAS,gBAAK,MAAM,WAAW,MAAtB,mBAA0B,OAA1B,mBAA8B,QAAQ,mBAAmB;AAAA,EACpE;AACA,WAAS,iCAAQ;AACjB,MAAI,CAAC,UAAU,OAAO,YAAA,MAAkB,UAAW,QAAO;AAC1D,SAAO;AACT;AAMO,SAAS,uBAAuB,QAA4C;AACjF,MAAI,OAAO,WAAW,UAAU;AAC9B,QAAI,CAAC,uBAAuB,MAAM,EAAG,QAAO;AAC5C,WAAO,EAAE,QAAQ,oBAAoB,MAAM,EAAA;AAAA,EAC7C;AACA,MAAI,CAAC,SAAS,MAAM,EAAG,QAAO;AAC9B,MAAI,OAAO,WAAW,cAAc,OAAO,WAAW,YAAY,OAAO,aAAa,YAAY;AAChG,WAAO,EAAE,QAAQ,YAAY,QAAQ,CAAC,QAAQ,CAAC,EAAA;AAAA,EACjD;AACA,SAAO;AACT;"}
@@ -0,0 +1,159 @@
1
+ import type { LangChainMessage } from '@assistant-ui/react-langgraph';
2
+ import type { StatewireThread } from '@assistant-ui/react-statewire';
3
+ import type { StatewireClient } from 'statewire';
4
+ import type { DeepAgentVoiceWireError } from './voice-wire-types';
5
+ export type { DeepAgentVoiceWireError } from './voice-wire-types';
6
+ /** The deepagents `write_todos` item shape (also the `todos` state-channel element). */
7
+ export interface Todo {
8
+ content: string;
9
+ status: 'pending' | 'in_progress' | 'completed' | 'cancelled' | 'failed';
10
+ }
11
+ /**
12
+ * One in-eval subagent dispatch, from the backend's `ptc_subagents` state
13
+ * channel (route `_forward_ptc_subagent_event`). These lifecycle events are the
14
+ * only live signal for interpreter-dispatched subagents — their transcripts
15
+ * never reach the parent `messages` stream — so lanes derive status from here.
16
+ */
17
+ export interface PtcSubagentEntry {
18
+ id: string;
19
+ status?: 'queued' | 'running' | 'complete' | 'error';
20
+ subagent_type?: string | null;
21
+ label?: string | null;
22
+ description?: string | null;
23
+ eval_id?: string;
24
+ duration_ms?: number;
25
+ error?: string;
26
+ /**
27
+ * Final output text of a finished dispatch, from Athena's in-eval output
28
+ * bridge (the SDK's `complete` lifecycle event omits it). Absent on older
29
+ * backends.
30
+ */
31
+ output?: string;
32
+ /**
33
+ * Tool calls the dispatch executed, from Athena's `complete` lifecycle event
34
+ * (counted backend-side from the subagent's final state). Absent on older
35
+ * backends and when the dispatch produced no readable artifact — in-eval
36
+ * lanes previously hardcoded 0 here.
37
+ */
38
+ tool_call_count?: number;
39
+ /**
40
+ * The dispatch's live streamed transcript (Athena's in-eval transcript
41
+ * bridge, `phase: "message"` lifecycle events folded backend-side) — the
42
+ * same message-dict shape as a task ToolMessage's
43
+ * `artifact.subgraph_state.messages`. Wire-only: absent after a reopen and
44
+ * on older backends.
45
+ */
46
+ messages?: LangChainMessage[];
47
+ /**
48
+ * What the wire left off `messages`: the host carries the dispatch's newest
49
+ * steps, cut like a running `task` card's, and counts the whole lane here,
50
+ * `finished` once the lane settled (a finished in-eval lane stays cut).
51
+ * Absent while `messages` holds every step, and on older backends.
52
+ */
53
+ athena_lane_truncated?: {
54
+ messages: number;
55
+ tool_calls: number;
56
+ finished?: boolean;
57
+ };
58
+ /**
59
+ * The whole lane's token use, however much of the lane `messages` carries:
60
+ * the input counting the prompt cache's reads and writes, the cache counts
61
+ * being parts of it. Absent while no step reported usage, after a reopen, and
62
+ * on older backends (read through `readLaneUsage`).
63
+ */
64
+ athena_lane_usage?: {
65
+ input_tokens: number;
66
+ output_tokens: number;
67
+ cache_read_input_tokens: number;
68
+ cache_creation_input_tokens: number;
69
+ };
70
+ /**
71
+ * The checkpoint namespace the dispatch's subagent writes under, recorded
72
+ * from its streamed steps (agora's `LANE_NS_KEY`), on a registry entry and on
73
+ * the summary an eval persists. A lane whose steps no longer ride (a later
74
+ * run stripped its registry entry, or a reopen left only its summary) pages
75
+ * from that checkpoint with `history/lane {lane}`. Absent on summaries
76
+ * written before agora recorded it.
77
+ */
78
+ ns?: string | null;
79
+ }
80
+ /** The raw deep-agent transport state, typed for the fields the runtime reads. */
81
+ export interface DeepAgentStreamValues {
82
+ messages?: LangChainMessage[];
83
+ todos?: Todo[];
84
+ /**
85
+ * The most recent Live API rejection during the live voice session, or
86
+ * `null`/absent when there has been none. Surfaces render it as a notice
87
+ * line; the session itself stays live.
88
+ */
89
+ voiceLastError?: DeepAgentVoiceWireError | null;
90
+ /**
91
+ * Live in-eval subagent dispatch lifecycle, keyed by dispatch id (the
92
+ * backend's `ptc_subagents` channel). Read by `deriveEvalSubagents` — an in-eval
93
+ * dispatch has no top-level `task` tool call, so this is its only live lane
94
+ * source.
95
+ */
96
+ ptc_subagents?: Record<string, PtcSubagentEntry>;
97
+ /**
98
+ * The assets each running studio execution created so far, keyed by its tool call id: agora
99
+ * lists one as soon as it has verified the SDK's report, and drops the call's entry when the
100
+ * execution returns (`agora.runtime.ptc_live_creations`). Read by the studio follow-along, which
101
+ * opens such an asset while the call still writes to it.
102
+ */
103
+ ptc_created_assets?: Record<string, ReadonlyArray<{
104
+ asset_id: string;
105
+ asset_type: string;
106
+ }>>;
107
+ /** The replicated run mounts (lib-owned; see `runs: true` on the thread options). */
108
+ runs?: readonly StatewireThread.RunState[];
109
+ /**
110
+ * The ids of queued entries the user prioritized (⚡, `run/prioritize`), as
111
+ * the host records them durably: the live run ends at its next model-call
112
+ * boundary while one of them heads the queue lane. Absent until a thread
113
+ * first prioritizes; read through `readPrioritizedQueueIds`.
114
+ */
115
+ prioritizedQueueIds?: readonly string[];
116
+ /**
117
+ * Whether the backend has minted the thread's `session` asset (the row a
118
+ * host reads as `asset_<threadId>`). Absent — not `false` — while the flag
119
+ * is unknown: the attach snapshot publishes it (as `null` when the probe
120
+ * could not tell), and a new thread's preload seeds `false` because its
121
+ * asset cannot exist before its first run.
122
+ */
123
+ sessionPersisted?: boolean | null;
124
+ /**
125
+ * Server-advertised wire-contract version (`protocol` lane). Absent on
126
+ * snapshots from pre-negotiation hosts; read through
127
+ * `readDeepAgentProtocol` / `projectDeepAgentProtocol`, which ignore the
128
+ * `minClientVersion` key hosts still publish for older installed clients.
129
+ */
130
+ protocol?: {
131
+ version: number;
132
+ };
133
+ __interrupt__?: unknown;
134
+ [key: string]: unknown;
135
+ }
136
+ /** An object carrying a `messages` array — the app-owned slice of the state. */
137
+ export interface LangGraphState {
138
+ messages: LangChainMessage[];
139
+ /** Live per-thread lease status; `queued` means this turn has not started. */
140
+ run_lifecycle?: {
141
+ status: 'queued' | 'running' | 'failed' | 'cancelled';
142
+ wait_timeout_seconds?: number;
143
+ };
144
+ todos?: Todo[];
145
+ }
146
+ /** Statewire lifecycle statuses exposed to every Athena surface. */
147
+ export declare const DEEP_AGENT_CONNECTION_STATUSES: readonly ["standby", "connecting", "connected", "retrying", "stopped"];
148
+ export type DeepAgentConnectionStatus = StatewireClient.ConnectionState['status'];
149
+ /** Statewire connection with sanitized host or local suspension detail. */
150
+ export type DeepAgentConnectionState = StatewireClient.ConnectionState & {
151
+ message?: string;
152
+ };
153
+ /**
154
+ * Which run lanes project into the converter's message tail. Surfaces without
155
+ * a queue panel project both lanes so a queued message stays visible until its
156
+ * dispatch; surfaces with a queue panel project only the steer lane (queued
157
+ * entries render in the panel instead).
158
+ */
159
+ export type DeepAgentLaneProjection = 'both' | 'steer-only';
@@ -0,0 +1,76 @@
1
+ import { type QueryClient } from '@tanstack/react-query';
2
+ import { type ConversationListFetcher, type ConversationListFilter, type ConversationSummary } from './conversation-list';
3
+ export interface UseConversationListOptions {
4
+ /**
5
+ * Transport adapter for one page (GraphQL `listConversations`, the REST
6
+ * thread list, …). Captured in a ref — identity changes do not re-key the
7
+ * cache, so pair a changing fetcher with a changing `scopeKey`.
8
+ */
9
+ fetchPage: ConversationListFetcher;
10
+ filter?: ConversationListFilter;
11
+ pageSize?: number;
12
+ /**
13
+ * Cache identity beyond the filter. MUST include everything that changes
14
+ * whose list this is — principal/user id, backend base URL — so a
15
+ * credential swap can never serve another identity's rows from the cache.
16
+ */
17
+ scopeKey?: string;
18
+ enabled?: boolean;
19
+ staleTime?: number;
20
+ gcTime?: number;
21
+ refetchOnMount?: boolean | 'always';
22
+ refetchOnWindowFocus?: boolean;
23
+ /**
24
+ * Newest-page freshness is push-based by default (the conversation-index
25
+ * statewire invalidates these caches), so no timer runs unless asked.
26
+ */
27
+ refetchInterval?: number | false;
28
+ retry?: boolean | number | ((failureCount: number, error: Error) => boolean);
29
+ /**
30
+ * The client to cache in. Defaults to the one in context; a hook that may
31
+ * render outside any `QueryClientProvider` (and stays disabled there)
32
+ * passes its own.
33
+ */
34
+ queryClient?: QueryClient;
35
+ }
36
+ export interface ConversationListController {
37
+ /** Merged newest-first rows: live first page + retained history pages. */
38
+ conversations: ConversationSummary[];
39
+ /** Advisory total from the live first page, when the transport counts. */
40
+ totalCount: number | null;
41
+ isLoading: boolean;
42
+ isFetching: boolean;
43
+ /** True once the live first page has resolved at least once. */
44
+ hasResolvedFirstPage: boolean;
45
+ hasNextPage: boolean;
46
+ isFetchingNextPage: boolean;
47
+ /** True while the last next-page request failed (cleared by a successful one). */
48
+ isFetchNextPageError: boolean;
49
+ fetchNextPage: () => Promise<unknown>;
50
+ /** Refetch the live first page (history pages stay frozen). */
51
+ refresh: () => Promise<unknown>;
52
+ /** Invalidate every conversation-list cache in this scope (all filters). */
53
+ invalidate: () => Promise<void>;
54
+ /** Optimistically show a new conversation at the top of THIS filter view. */
55
+ prependConversation: (item: ConversationSummary) => void;
56
+ /** Optimistically drop a conversation from THIS filter view. */
57
+ removeConversation: (threadId: string) => void;
58
+ /** Optimistically patch a conversation's row in THIS filter view. */
59
+ patchConversation: (threadId: string, patch: Partial<ConversationSummary>) => void;
60
+ }
61
+ /**
62
+ * The shared headless conversation-list pager (chat-stack unification —
63
+ * thread-list-contract-convergence).
64
+ *
65
+ * Implements, once, the two-tier TanStack Query pattern Olympus and mobile
66
+ * each hand-rolled:
67
+ *
68
+ * - a LIVE first-page query — the only observer that refetches on
69
+ * invalidation/focus, so push-driven freshness costs one page, and
70
+ * - a permanently-disabled infinite "history" query whose pages are fetched
71
+ * only by explicit `fetchNextPage()` calls and retained without replay
72
+ * (invalidation/polling never refetches every loaded page).
73
+ *
74
+ * Rows merge newest-first with the live page winning duplicate threads.
75
+ */
76
+ export declare function useConversationList(options: UseConversationListOptions): ConversationListController;
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const react = require("react");
4
+ const chatOutbox = require("./chat-outbox.cjs");
5
+ const chatOutboxThread = require("./chat-outbox-thread.cjs");
6
+ function useDeepAgentChatOutbox({
7
+ client,
8
+ threadId,
9
+ isNewChat,
10
+ store,
11
+ reachability,
12
+ foreground,
13
+ restore,
14
+ openThread,
15
+ onEvent,
16
+ checkAttachments,
17
+ enabled = true,
18
+ countdownMs
19
+ }) {
20
+ const clientRef = react.useRef(client);
21
+ clientRef.current = client;
22
+ const restoreRef = react.useRef(restore);
23
+ restoreRef.current = restore;
24
+ const openThreadRef = react.useRef(openThread);
25
+ openThreadRef.current = openThread;
26
+ const canOpenThreads = openThread !== void 0;
27
+ const onEventRef = react.useRef(onEvent);
28
+ onEventRef.current = onEvent;
29
+ const checkAttachmentsRef = react.useRef(checkAttachments);
30
+ checkAttachmentsRef.current = checkAttachments;
31
+ const checksAttachments = checkAttachments !== void 0;
32
+ const reachabilityRef = react.useRef(reachability);
33
+ reachabilityRef.current = reachability;
34
+ const foregroundRef = react.useRef(foreground);
35
+ foregroundRef.current = foreground;
36
+ const [threadListeners] = react.useState(() => /* @__PURE__ */ new Set());
37
+ react.useEffect(() => {
38
+ if (!enabled) return void 0;
39
+ return client.subscribe(() => {
40
+ for (const listener of threadListeners) listener();
41
+ });
42
+ }, [client, threadListeners, enabled]);
43
+ const [stableSignals] = react.useState(() => {
44
+ const forward = (pick) => ({
45
+ get: () => pick().get(),
46
+ subscribe: (listener) => pick().subscribe(listener)
47
+ });
48
+ return {
49
+ reachability: forward(() => reachabilityRef.current),
50
+ foreground: forward(() => foregroundRef.current)
51
+ };
52
+ });
53
+ const isNewChatRef = react.useRef(isNewChat);
54
+ isNewChatRef.current = isNewChat;
55
+ const [outbox, setOutbox] = react.useState(null);
56
+ react.useEffect(() => {
57
+ if (!enabled || !threadId) {
58
+ setOutbox(null);
59
+ return void 0;
60
+ }
61
+ const created = chatOutbox.createChatOutbox({
62
+ threadId,
63
+ // Read at each hold: a chat that starts while mounted stamps its later messages as started.
64
+ isNewChat: () => isNewChatRef.current,
65
+ store,
66
+ reachability: stableSignals.reachability,
67
+ foreground: stableSignals.foreground,
68
+ thread: {
69
+ ...chatOutboxThread.createStatewireChatOutboxPort({ client: () => clientRef.current }),
70
+ subscribe: (listener) => {
71
+ threadListeners.add(listener);
72
+ return () => {
73
+ threadListeners.delete(listener);
74
+ };
75
+ }
76
+ },
77
+ restore: (entry) => restoreRef.current(entry),
78
+ ...canOpenThreads && {
79
+ openThread: (target) => {
80
+ var _a;
81
+ return (_a = openThreadRef.current) == null ? void 0 : _a.call(openThreadRef, target);
82
+ }
83
+ },
84
+ onEvent: (event) => {
85
+ var _a;
86
+ return (_a = onEventRef.current) == null ? void 0 : _a.call(onEventRef, event);
87
+ },
88
+ ...checksAttachments && {
89
+ checkAttachments: (attachments) => {
90
+ var _a;
91
+ return ((_a = checkAttachmentsRef.current) == null ? void 0 : _a.call(checkAttachmentsRef, attachments)) ?? Promise.resolve("ok");
92
+ }
93
+ },
94
+ ...countdownMs !== void 0 && { countdownMs }
95
+ });
96
+ setOutbox(created);
97
+ return () => {
98
+ created.dispose();
99
+ setOutbox((current) => current === created ? null : current);
100
+ };
101
+ }, [enabled, threadId, store, countdownMs, canOpenThreads, checksAttachments]);
102
+ return outbox !== null && outbox.threadId === threadId ? outbox : null;
103
+ }
104
+ const EMPTY_SNAPSHOT = {
105
+ rows: [],
106
+ countdownEndsAt: null,
107
+ durable: true,
108
+ loaded: true,
109
+ elsewhere: []
110
+ };
111
+ const noopSubscribe = () => () => void 0;
112
+ function useChatOutboxSnapshot(outbox) {
113
+ return react.useSyncExternalStore(
114
+ outbox ? outbox.subscribe : noopSubscribe,
115
+ () => (outbox == null ? void 0 : outbox.getSnapshot()) ?? EMPTY_SNAPSHOT,
116
+ () => (outbox == null ? void 0 : outbox.getSnapshot()) ?? EMPTY_SNAPSHOT
117
+ );
118
+ }
119
+ function useChatOutboxReachable(outbox) {
120
+ const subscribe = react.useCallback(
121
+ (listener) => outbox ? outbox.reachability.subscribe(listener) : () => void 0,
122
+ [outbox]
123
+ );
124
+ const reachable = () => (outbox == null ? void 0 : outbox.reachability.get()) ?? true;
125
+ return react.useSyncExternalStore(subscribe, reachable, reachable);
126
+ }
127
+ const DeepAgentChatOutboxContext = react.createContext(null);
128
+ function useDeepAgentChatOutboxContext() {
129
+ return react.useContext(DeepAgentChatOutboxContext);
130
+ }
131
+ exports.DeepAgentChatOutboxContext = DeepAgentChatOutboxContext;
132
+ exports.useChatOutboxReachable = useChatOutboxReachable;
133
+ exports.useChatOutboxSnapshot = useChatOutboxSnapshot;
134
+ exports.useDeepAgentChatOutbox = useDeepAgentChatOutbox;
135
+ exports.useDeepAgentChatOutboxContext = useDeepAgentChatOutboxContext;
136
+ //# sourceMappingURL=use-deep-agent-chat-outbox.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-deep-agent-chat-outbox.cjs","sources":["../../../../agent-runtime/src/use-deep-agent-chat-outbox.ts"],"sourcesContent":["import { createContext, useCallback, useContext, useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { ChatOutboxAttachmentCheck } from \"./chat-outbox-attachments\";\nimport {\n type ChatOutbox,\n type ChatOutboxCommandUpdate,\n type ChatOutboxEvent,\n type ChatOutboxSignal,\n type ChatOutboxSnapshot,\n createChatOutbox,\n} from \"./chat-outbox\";\nimport type { ChatOutboxEntry, ChatOutboxStore } from \"./chat-outbox-store\";\nimport { type ChatOutboxClientHost, createStatewireChatOutboxPort } from \"./chat-outbox-thread\";\n\nexport interface UseDeepAgentChatOutboxOptions {\n /** The thread's assistant-ui client (`useDeepAgentRuntime`'s result). */\n client: ChatOutboxClientHost;\n threadId: string;\n /** The conversation has never started (a new chat). */\n isNewChat: boolean;\n /**\n * This person's outbox store, one per person for the life of the page or app (a message the\n * device cannot keep waits in its memory, across thread switches); `null` keeps waiting messages\n * in this outbox alone.\n */\n store: ChatOutboxStore | null;\n /** Athena's reachability (the host's own model: the browser online AND agora answering). */\n reachability: ChatOutboxSignal;\n /** The app is in front (a visible tab, an active app, a focused desktop window). */\n foreground: ChatOutboxSignal;\n /** Give a cancelled message's text back to the composer. */\n restore: (entry: ChatOutboxEntry) => void;\n /**\n * Open another of the person's conversations holding waiting messages (the tray's Open); omit\n * it where the host cannot switch conversations.\n */\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n onEvent?: (event: ChatOutboxEvent) => void;\n /**\n * Asks Athena whether a waiting message's attachments can still be opened, right before it goes\n * (`createChatOutboxAttachmentCheck`); omitted, attachments go unchecked.\n */\n checkAttachments?: ChatOutboxAttachmentCheck;\n /** Off: no outbox (a read-only or suspended surface); sends behave as before. */\n enabled?: boolean;\n /** The countdown before a waiting message is sent (tests); defaults to `CHAT_OUTBOX_COUNTDOWN_MS`. */\n countdownMs?: number;\n}\n\n/**\n * The chat outbox for the mounted thread (`chat-outbox.ts`), one per thread and store: a thread\n * switch disposes it and makes the next thread's. The host forwards statewire's command lifecycle\n * to {@link ChatOutbox.observeCommand} (its `useDeepAgentRuntime` `onCommandChange`), shares the\n * instance through {@link DeepAgentChatOutboxContext}, and has its composer call\n * {@link ChatOutbox.shouldHold} / {@link ChatOutbox.hold} before sending.\n */\nexport function useDeepAgentChatOutbox({\n client,\n threadId,\n isNewChat,\n store,\n reachability,\n foreground,\n restore,\n openThread,\n onEvent,\n checkAttachments,\n enabled = true,\n countdownMs,\n}: UseDeepAgentChatOutboxOptions): ChatOutbox | null {\n const clientRef = useRef(client);\n clientRef.current = client;\n const restoreRef = useRef(restore);\n restoreRef.current = restore;\n const openThreadRef = useRef(openThread);\n openThreadRef.current = openThread;\n const canOpenThreads = openThread !== undefined;\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n const checkAttachmentsRef = useRef(checkAttachments);\n checkAttachmentsRef.current = checkAttachments;\n const checksAttachments = checkAttachments !== undefined;\n const reachabilityRef = useRef(reachability);\n reachabilityRef.current = reachability;\n const foregroundRef = useRef(foreground);\n foregroundRef.current = foreground;\n // The client's notifications reach the port through this set, so a client whose identity\n // changes mid-thread is followed without remaking the outbox (and losing its countdown).\n const [threadListeners] = useState(() => new Set<() => void>());\n // A host without an outbox (`enabled` false) is never subscribed to.\n useEffect(() => {\n if (!enabled) return undefined;\n return client.subscribe(() => {\n for (const listener of threadListeners) listener();\n });\n }, [client, threadListeners, enabled]);\n // Signals read through refs for the same reason: a host rebuilding its signal objects per render\n // never remakes the outbox.\n const [stableSignals] = useState(() => {\n const forward = (pick: () => ChatOutboxSignal): ChatOutboxSignal => ({\n get: () => pick().get(),\n subscribe: (listener) => pick().subscribe(listener),\n });\n return {\n reachability: forward(() => reachabilityRef.current),\n foreground: forward(() => foregroundRef.current),\n };\n });\n const isNewChatRef = useRef(isNewChat);\n isNewChatRef.current = isNewChat;\n\n const [outbox, setOutbox] = useState<ChatOutbox | null>(null);\n // Made in an effect, not during render: the outbox subscribes to its signals and reads its\n // store, and a render React throws away must not leave those behind.\n // biome-ignore lint/correctness/useExhaustiveDependencies: one outbox per thread and store; everything else is read through refs.\n useEffect(() => {\n if (!enabled || !threadId) {\n setOutbox(null);\n return undefined;\n }\n const created = createChatOutbox({\n threadId,\n // Read at each hold: a chat that starts while mounted stamps its later messages as started.\n isNewChat: () => isNewChatRef.current,\n store,\n reachability: stableSignals.reachability,\n foreground: stableSignals.foreground,\n thread: {\n ...createStatewireChatOutboxPort({ client: () => clientRef.current }),\n subscribe: (listener) => {\n threadListeners.add(listener);\n return () => {\n threadListeners.delete(listener);\n };\n },\n },\n restore: (entry) => restoreRef.current(entry),\n ...(canOpenThreads && {\n openThread: (target: { threadId: string; newChat: boolean }) => openThreadRef.current?.(target),\n }),\n onEvent: (event) => onEventRef.current?.(event),\n ...(checksAttachments && {\n checkAttachments: (attachments: Parameters<ChatOutboxAttachmentCheck>[0]) =>\n checkAttachmentsRef.current?.(attachments) ?? Promise.resolve(\"ok\" as const),\n }),\n ...(countdownMs !== undefined && { countdownMs }),\n });\n setOutbox(created);\n return () => {\n created.dispose();\n setOutbox((current) => (current === created ? null : current));\n };\n }, [enabled, threadId, store, countdownMs, canOpenThreads, checksAttachments]);\n // During a thread switch's first render the previous thread's outbox is still in state.\n return outbox !== null && outbox.threadId === threadId ? outbox : null;\n}\n\nconst EMPTY_SNAPSHOT: ChatOutboxSnapshot = {\n rows: [],\n countdownEndsAt: null,\n durable: true,\n loaded: true,\n elsewhere: [],\n};\nconst noopSubscribe = () => () => undefined;\n\n/** The outbox's rows and countdown, re-rendering on every change (`null` outbox: nothing waits). */\nexport function useChatOutboxSnapshot(outbox: ChatOutbox | null): ChatOutboxSnapshot {\n return useSyncExternalStore(\n outbox ? outbox.subscribe : noopSubscribe,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n () => outbox?.getSnapshot() ?? EMPTY_SNAPSHOT,\n );\n}\n\n/**\n * Whether Athena can be reached, as the thread's outbox reads it: `true` without an outbox (a host\n * that keeps none sends and edits as before). What a sent message's Edit is offered on; a boolean,\n * so a reader re-renders only when it flips.\n */\nexport function useChatOutboxReachable(outbox: ChatOutbox | null): boolean {\n const subscribe = useCallback(\n (listener: () => void) => (outbox ? outbox.reachability.subscribe(listener) : () => undefined),\n [outbox],\n );\n const reachable = () => outbox?.reachability.get() ?? true;\n return useSyncExternalStore(subscribe, reachable, reachable);\n}\n\n/** The mounted thread's chat outbox, shared from its runtime provider to its composer and tray. */\nexport const DeepAgentChatOutboxContext = createContext<ChatOutbox | null>(null);\n\nexport function useDeepAgentChatOutboxContext(): ChatOutbox | null {\n return useContext(DeepAgentChatOutboxContext);\n}\n\n/** Forward statewire's command lifecycle to an outbox held in a ref (the runtime is made first). */\nexport function forwardChatOutboxCommand(\n outbox: { current: ChatOutbox | null },\n update: ChatOutboxCommandUpdate,\n): void {\n outbox.current?.observeCommand(update);\n}\n"],"names":["useRef","useState","useEffect","createChatOutbox","createStatewireChatOutboxPort","useSyncExternalStore","useCallback","createContext","useContext"],"mappings":";;;;;AAuDO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AACF,GAAqD;AACnD,QAAM,YAAYA,MAAAA,OAAO,MAAM;AAC/B,YAAU,UAAU;AACpB,QAAM,aAAaA,MAAAA,OAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,gBAAgBA,MAAAA,OAAO,UAAU;AACvC,gBAAc,UAAU;AACxB,QAAM,iBAAiB,eAAe;AACtC,QAAM,aAAaA,MAAAA,OAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,sBAAsBA,MAAAA,OAAO,gBAAgB;AACnD,sBAAoB,UAAU;AAC9B,QAA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