@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,109 @@
1
+ /**
2
+ * The subagent card: one `task` call the deep agent delegated, shown the way
3
+ * Olympus shows a subagent lane.
4
+ *
5
+ * - On the card: where the lane is (queued, running, done, failed, stopped),
6
+ * how many tool calls it made (the wire's cut marker counts a lane whose
7
+ * card carries only its newest steps), how long it has run, and while it
8
+ * runs, its newest step; a finished lane's report, or why it failed, under
9
+ * it, clamped.
10
+ * - Behind its disclosure: the lane's steps, live while it runs, ending on
11
+ * what the lane ended on, whole (a failure, or a report no step carries),
12
+ * so a lane with no steps still opens to its full result. The lane is
13
+ * assistant-ui's native nested thread: the `task` part's `messages`, which
14
+ * the SDK runtime's opt-in conversion fills
15
+ * (`createSubagentTranscriptConversionCache`), rendered read-only under
16
+ * `ReadonlyThreadProvider` with the chat's own tool UIs. A cut lane (a
17
+ * running card always; a finished one when the provider declares the
18
+ * lane-cut contract, `subagentLaneHistory`) says how many of its steps it
19
+ * shows, and "Load earlier steps" reads the rest with `history/lane`
20
+ * (`useDeepAgentLaneHistory`), a read under the thread's own attach.
21
+ *
22
+ * A read-only nested thread has no statewire thread behind it: a `task` call
23
+ * inside a subagent's own steps renders as a static row, and the steps are
24
+ * their own error boundary, so a tool UI that throws there never takes the
25
+ * chat down with it.
26
+ */
27
+ import { type ThreadMessage, type ToolCallMessagePartComponent, type ToolCallMessagePartStatus } from "@assistant-ui/react";
28
+ import { type SubagentStatus } from "../agent-runtime/src/index";
29
+ import { type ToolCallSummary } from "./tool-summary";
30
+ /**
31
+ * Where a lane is, as the card shows it: the lane's own status, except that a
32
+ * lane parked on a person's approval is `approval` (its own dispatch, or a call
33
+ * it made, is a gated call nobody has answered), any other call the run waits
34
+ * on an answer for is `waiting`, and one the run stopped before it settled is
35
+ * `stopped`.
36
+ */
37
+ export type SubagentLanePhase = "queued" | "approval" | "waiting" | "running" | "complete" | "error" | "stopped";
38
+ export declare const SUBAGENT_LANE_PHASE_LABELS: Record<SubagentLanePhase, string>;
39
+ /** The lane's phase from its status, the status assistant-ui gives its part, and the run's approval. */
40
+ export declare function subagentLanePhase({ status, partStatus, awaitingApproval, }: {
41
+ status: SubagentStatus;
42
+ partStatus: ToolCallMessagePartStatus | undefined;
43
+ /** The lane waits on a person's approval (agent-runtime's `subagentAwaitingApproval`). */
44
+ awaitingApproval?: boolean;
45
+ }): SubagentLanePhase;
46
+ /** The phases a lane never leaves. */
47
+ export declare function isSettledSubagentLanePhase(phase: SubagentLanePhase): boolean;
48
+ /**
49
+ * What a settled lane ended on, whole: its report, or why it failed. A lane
50
+ * that the run's own failure ended has no result of its own, so the `task`
51
+ * part's status says why (as the generic card shows a failed call). Empty
52
+ * while the lane runs.
53
+ */
54
+ export declare function subagentLaneResult({ output, phase, partStatus, }: {
55
+ /** The lane's own result text (`SubagentDiscoverySnapshot.output`). */
56
+ output: string | undefined;
57
+ phase: SubagentLanePhase;
58
+ partStatus: ToolCallMessagePartStatus | undefined;
59
+ }): string;
60
+ /**
61
+ * How long a finished lane ran, measured by the server: the `task` result's
62
+ * `_started_at` and `_created_at`, which the deep agent's tool-call timing
63
+ * stamps on every tool result and mirrors onto its artifact (the one field of
64
+ * a tool message the converter hands the tool-call part). `null` when either
65
+ * stamp is missing.
66
+ */
67
+ export declare function finishedLaneDurationMs(artifact: unknown): number | null;
68
+ /**
69
+ * When the agent delegated the call `toolCallId`: the server stamp
70
+ * (`_created_at`) of the assistant message that made it, among the raw
71
+ * messages bound to the turn. A running lane's card carries no stamp of its
72
+ * own, so its clock counts from here, the way the turn header counts from the
73
+ * turn's own stamps. `null` without one.
74
+ */
75
+ export declare function laneDelegatedAtMs({ sources, toolCallId, }: {
76
+ sources: readonly unknown[];
77
+ toolCallId: string;
78
+ }): number | null;
79
+ /**
80
+ * The lane's newest tool step as its summary line ("Read `routes.ts`",
81
+ * "Running `npm test`"), from the lane's converted steps: the last tool call
82
+ * of its newest assistant turn, worded for whether it has answered. `null`
83
+ * before the lane's first tool call.
84
+ */
85
+ export declare function latestLaneStep(messages: readonly ThreadMessage[]): ToolCallSummary | null;
86
+ /**
87
+ * The subagent's type as the card names it: the `task` call's `subagent_type`
88
+ * in words, with the default `general-purpose` agent as "Subagent".
89
+ */
90
+ export declare function subagentTypeLabel(name: string): string;
91
+ /** "1 tool call", "12 tool calls". */
92
+ export declare function toolCallCountLabel(count: number): string;
93
+ /** What the steps panel says about the steps it shows of a cut lane. */
94
+ export declare function laneStepsNote({ shown, total, arrivesLater, }: {
95
+ /** Steps the panel shows. */
96
+ shown: number;
97
+ /** Steps the lane stores (its cut marker), when the card carries fewer. */
98
+ total: number | undefined;
99
+ /**
100
+ * A running lane on a host that pages no running lane: its card brings the
101
+ * rest once the subagent finishes.
102
+ */
103
+ arrivesLater: boolean;
104
+ }): string | null;
105
+ /**
106
+ * The `task` tool UI (`TOOL_UI_REGISTRY.task`): the subagent card, or inside
107
+ * a subagent's own steps, a static delegation row.
108
+ */
109
+ export declare const SubagentTaskToolUI: ToolCallMessagePartComponent;
@@ -0,0 +1,494 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useAuiState, getExternalStoreMessages, ReadonlyThreadProvider, ThreadPrimitive, MessagePrimitive } from "@assistant-ui/react";
3
+ import { QueryClientProvider } from "@tanstack/react-query";
4
+ import { BotIcon, ChevronDownIcon, LoaderIcon, CheckIcon, AlertCircleIcon, XCircleIcon, ShieldAlertIcon, CircleDashedIcon } from "lucide-react";
5
+ import { memo, useMemo, useState, useEffect, Component, createContext, useContext } from "react";
6
+ import { useApprovalWaitInScope } from "../chat/use-statewire-approval-request.js";
7
+ import { MESSAGE_CREATED_AT_KEY } from "../chat/message-time.js";
8
+ import { readInstantMs, formatWorkDuration } from "../chat/super-grouping/turn-timing.js";
9
+ import { athenaDiagnostics } from "../diagnostics/athena-diagnostics.js";
10
+ import { useAthenaQueryClient } from "../lib/use-athena-rest-query.js";
11
+ import { CollapsibleTrigger } from "../ui/collapsible.js";
12
+ import { useNestedPtcComponents } from "./NestedPtcMessages.js";
13
+ import { StepText } from "./step-text.js";
14
+ import { useToolAppearance } from "./tool-appearance.js";
15
+ import { ToolFallbackRoot, ToolFallbackContent, ToolFallback } from "./tool-fallback.js";
16
+ import { summarizeToolCall, humanizeToolName } from "./tool-summary.js";
17
+ import { hasStatewireThreadExtras } from "../agent-runtime/src/thread-extras.js";
18
+ import { taskSubagentsOfTurn, subagentAwaitingApproval, subagentToolCallAwaitingApproval } from "../agent-runtime/src/subagents.js";
19
+ import { salientToolCallDetail } from "../agent-runtime/src/tool-names.js";
20
+ import { useDeepAgentLaneHistory } from "../agent-runtime/src/lane-history.js";
21
+ import { createSubagentLaneConversion, withLaneReport } from "../agent-runtime/src/subagent-transcripts.js";
22
+ import { deepAgentRowKey } from "../agent-runtime/src/messages.js";
23
+ import { cn } from "cnfast";
24
+ const NO_LANE_STEPS = [];
25
+ const NO_MESSAGES = [];
26
+ const SUBAGENT_LANE_PHASE_LABELS = {
27
+ queued: "Queued",
28
+ approval: "Waiting for approval",
29
+ waiting: "Waiting for you",
30
+ running: "Running",
31
+ complete: "Done",
32
+ error: "Failed",
33
+ stopped: "Stopped"
34
+ };
35
+ function subagentLanePhase({
36
+ status,
37
+ partStatus,
38
+ awaitingApproval = false
39
+ }) {
40
+ if (status === "complete" || status === "error") return status;
41
+ if (awaitingApproval) return "approval";
42
+ if ((partStatus == null ? void 0 : partStatus.type) === "requires-action") return "waiting";
43
+ if ((partStatus == null ? void 0 : partStatus.type) === "incomplete") {
44
+ return partStatus.reason === "cancelled" ? "stopped" : "error";
45
+ }
46
+ return status;
47
+ }
48
+ function isSettledSubagentLanePhase(phase) {
49
+ return phase === "complete" || phase === "error" || phase === "stopped";
50
+ }
51
+ function subagentLaneResult({
52
+ output,
53
+ phase,
54
+ partStatus
55
+ }) {
56
+ if (!isSettledSubagentLanePhase(phase)) return "";
57
+ const own = (output == null ? void 0 : output.trim()) ?? "";
58
+ if (own !== "" || phase !== "error" || (partStatus == null ? void 0 : partStatus.type) !== "incomplete") return own;
59
+ const { error } = partStatus;
60
+ if (error === void 0 || error === null) return "";
61
+ return (typeof error === "string" ? error : JSON.stringify(error)).trim();
62
+ }
63
+ function record(value) {
64
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
65
+ }
66
+ function finishedLaneDurationMs(artifact) {
67
+ const stamps = record(artifact);
68
+ const startedAt = readInstantMs(stamps == null ? void 0 : stamps._started_at);
69
+ const finishedAt = readInstantMs(stamps == null ? void 0 : stamps[MESSAGE_CREATED_AT_KEY]);
70
+ return startedAt !== null && finishedAt !== null && finishedAt >= startedAt ? finishedAt - startedAt : null;
71
+ }
72
+ const ASSISTANT_TYPES = /* @__PURE__ */ new Set(["ai", "AIMessageChunk"]);
73
+ function laneDelegatedAtMs({
74
+ sources,
75
+ toolCallId
76
+ }) {
77
+ for (const source of sources) {
78
+ const message = record(source);
79
+ if (!message || !ASSISTANT_TYPES.has(message.type)) continue;
80
+ const calls = message.tool_calls;
81
+ if (!Array.isArray(calls) || !calls.some((call) => {
82
+ var _a;
83
+ return ((_a = record(call)) == null ? void 0 : _a.id) === toolCallId;
84
+ })) continue;
85
+ const kwargs = record(message.additional_kwargs);
86
+ const metadata = record(kwargs == null ? void 0 : kwargs.metadata);
87
+ return readInstantMs(metadata == null ? void 0 : metadata[MESSAGE_CREATED_AT_KEY]) ?? readInstantMs(kwargs == null ? void 0 : kwargs[MESSAGE_CREATED_AT_KEY]) ?? readInstantMs(message[MESSAGE_CREATED_AT_KEY]);
88
+ }
89
+ return null;
90
+ }
91
+ function latestLaneStep(messages) {
92
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
93
+ const message = messages[index];
94
+ if ((message == null ? void 0 : message.role) !== "assistant") continue;
95
+ for (let partIndex = message.content.length - 1; partIndex >= 0; partIndex -= 1) {
96
+ const part = message.content[partIndex];
97
+ if ((part == null ? void 0 : part.type) !== "tool-call") continue;
98
+ const answered = part.result !== void 0 && part.isPreliminary !== true;
99
+ return summarizeToolCall({
100
+ toolName: part.toolName,
101
+ args: part.args,
102
+ result: answered ? part.result : void 0,
103
+ status: answered ? part.isError === true ? "error" : "complete" : "running"
104
+ });
105
+ }
106
+ }
107
+ return null;
108
+ }
109
+ function subagentTypeLabel(name) {
110
+ const trimmed = name.trim();
111
+ if (trimmed === "" || trimmed === "subagent" || trimmed === "general-purpose") return "Subagent";
112
+ return humanizeToolName(trimmed);
113
+ }
114
+ function toolCallCountLabel(count) {
115
+ return `${count} tool call${count === 1 ? "" : "s"}`;
116
+ }
117
+ function stepsLabel(count) {
118
+ return `${count} step${count === 1 ? "" : "s"}`;
119
+ }
120
+ function laneStepsNote({
121
+ shown,
122
+ total,
123
+ arrivesLater
124
+ }) {
125
+ if (total === void 0 || total <= shown) return null;
126
+ const leftOff = total - shown;
127
+ return arrivesLater ? `Showing the latest steps. ${leftOff} earlier ${leftOff === 1 ? "step arrives" : "steps arrive"} when this subagent finishes.` : `Showing the latest ${shown} of ${stepsLabel(total)}.`;
128
+ }
129
+ function useInReadOnlyThread() {
130
+ return useAuiState((s) => {
131
+ var _a;
132
+ const thread = (_a = s.optional) == null ? void 0 : _a.thread;
133
+ return thread !== void 0 && !hasStatewireThreadExtras(thread.extras);
134
+ });
135
+ }
136
+ function laneFromArgs(toolCallId, args) {
137
+ const record2 = typeof args === "object" && args !== null ? args : {};
138
+ return {
139
+ id: toolCallId,
140
+ name: typeof record2.subagent_type === "string" ? record2.subagent_type : "subagent",
141
+ description: typeof record2.description === "string" ? record2.description : "",
142
+ status: "queued",
143
+ toolCallCount: 0,
144
+ messages: NO_MESSAGES,
145
+ messageCount: 0,
146
+ currentText: ""
147
+ };
148
+ }
149
+ function LaneStatusGlyph({ phase }) {
150
+ const glyph = phase === "running" ? /* @__PURE__ */ jsx(LoaderIcon, { className: "size-3.5 animate-spin text-muted-foreground motion-reduce:animate-none" }) : phase === "complete" ? /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5 text-emerald-600" }) : phase === "error" ? /* @__PURE__ */ jsx(AlertCircleIcon, { className: "size-3.5 text-destructive" }) : phase === "stopped" ? /* @__PURE__ */ jsx(XCircleIcon, { className: "size-3.5 text-muted-foreground" }) : phase === "waiting" || phase === "approval" ? /* @__PURE__ */ jsx(ShieldAlertIcon, { className: "size-3.5 text-amber-600" }) : /* @__PURE__ */ jsx(CircleDashedIcon, { className: "size-3.5 text-muted-foreground motion-safe:animate-pulse" });
151
+ return /* @__PURE__ */ jsx(
152
+ "span",
153
+ {
154
+ "data-slot": "subagent-status",
155
+ "data-phase": phase,
156
+ "aria-hidden": "true",
157
+ className: "mt-0.5 flex size-4 shrink-0 items-center justify-center",
158
+ children: glyph
159
+ }
160
+ );
161
+ }
162
+ function useRunningElapsedMs(running, startMs) {
163
+ const [clock, setClock] = useState(null);
164
+ useEffect(() => {
165
+ if (!running) {
166
+ setClock(null);
167
+ return void 0;
168
+ }
169
+ const seenAt = Date.now();
170
+ setClock({ seenAt, now: seenAt });
171
+ const timer = setInterval(() => setClock({ seenAt, now: Date.now() }), 1e3);
172
+ return () => clearInterval(timer);
173
+ }, [running]);
174
+ if (!running || clock === null) return null;
175
+ return Math.max(0, clock.now - (startMs ?? clock.seenAt));
176
+ }
177
+ const LaneStepComponentsContext = createContext(null);
178
+ const EmptyStepPart = () => null;
179
+ const LaneStep = () => {
180
+ const role = useAuiState((s) => s.message.role);
181
+ const components = useContext(LaneStepComponentsContext);
182
+ if (role !== "assistant") return null;
183
+ return /* @__PURE__ */ jsx(MessagePrimitive.Parts, { components: { Empty: EmptyStepPart, ...components } });
184
+ };
185
+ const LANE_ROW_COMPONENTS = { Message: LaneStep };
186
+ const ROW_KEY_SEPARATOR = "\0";
187
+ function LaneRows() {
188
+ const joinedKeys = useAuiState(
189
+ (s) => s.thread.messages.map((message) => deepAgentRowKey(message)).join(ROW_KEY_SEPARATOR)
190
+ );
191
+ const rowKeys = useMemo(
192
+ () => joinedKeys === "" ? [] : joinedKeys.split(ROW_KEY_SEPARATOR),
193
+ [joinedKeys]
194
+ );
195
+ return /* @__PURE__ */ jsx(Fragment, { children: rowKeys.map((key, index) => /* @__PURE__ */ jsx(ThreadPrimitive.MessageByIndex, { index, components: LANE_ROW_COMPONENTS }, key)) });
196
+ }
197
+ class LaneStepsBoundary extends Component {
198
+ constructor(props) {
199
+ super(props);
200
+ this.state = { failed: false };
201
+ }
202
+ static getDerivedStateFromError() {
203
+ return { failed: true };
204
+ }
205
+ componentDidCatch(error, errorInfo) {
206
+ var _a;
207
+ athenaDiagnostics.error(
208
+ "sdk.error",
209
+ error,
210
+ {
211
+ code: "chat_render_crash",
212
+ message: "A subagent's steps could not be shown",
213
+ hint: "Inspect component_stack: a tool UI that reads the live thread fails inside a subagent's read-only steps."
214
+ },
215
+ {
216
+ surface: "subagent-lane",
217
+ subagent: this.props.name,
218
+ component_stack: ((_a = errorInfo.componentStack) == null ? void 0 : _a.slice(0, 2e3)) ?? null
219
+ }
220
+ );
221
+ }
222
+ render() {
223
+ if (this.state.failed) {
224
+ return /* @__PURE__ */ jsx("p", { role: "alert", className: "px-1 text-xs text-muted-foreground", children: "These steps couldn't be shown. The conversation is not affected." });
225
+ }
226
+ return this.props.children;
227
+ }
228
+ }
229
+ function LaneQueryScope({ children }) {
230
+ const queryClient = useAthenaQueryClient();
231
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children });
232
+ }
233
+ function LaneSteps({ lane, phase, result, partMessages }) {
234
+ var _a, _b;
235
+ const running = lane.status === "running" && (phase === "running" || phase === "approval");
236
+ const source = lane.source;
237
+ const history = useDeepAgentLaneHistory({
238
+ messageId: source == null ? void 0 : source.messageId,
239
+ lane: source == null ? void 0 : source.lane,
240
+ carried: (source == null ? void 0 : source.transcript) ?? NO_LANE_STEPS,
241
+ total: (_a = source == null ? void 0 : source.truncated) == null ? void 0 : _a.messages,
242
+ finished: ((_b = source == null ? void 0 : source.truncated) == null ? void 0 : _b.finished) === true
243
+ });
244
+ const [convertLane] = useState(() => createSubagentLaneConversion());
245
+ const report = lane.status === "complete" && (source == null ? void 0 : source.messageId) !== void 0 ? lane.output : void 0;
246
+ const messages = (source === void 0 ? void 0 : convertLane(withLaneReport(history.steps, report), running)) ?? partMessages ?? NO_MESSAGES;
247
+ const components = useNestedPtcComponents(ToolFallback);
248
+ const shown = history.steps.length;
249
+ const arrivesLater = running && (source == null ? void 0 : source.messageId) !== void 0 && !history.available;
250
+ const note = laneStepsNote({ shown, total: history.total, arrivesLater });
251
+ const emptyText = phase === "running" ? "Starting…" : phase === "queued" || phase === "waiting" || phase === "approval" ? "Not started yet." : "No steps were recorded for this subagent.";
252
+ const failed = phase === "error";
253
+ const closing = failed || messages.length === 0 ? result : "";
254
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "subagent-steps", className: "flex min-w-0 flex-col gap-2 px-2.5", children: [
255
+ lane.description ? /* @__PURE__ */ jsx(
256
+ "p",
257
+ {
258
+ "data-slot": "subagent-brief",
259
+ className: "whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground",
260
+ children: lane.description
261
+ }
262
+ ) : null,
263
+ note ? /* @__PURE__ */ jsxs(
264
+ "div",
265
+ {
266
+ "data-slot": "subagent-steps-note",
267
+ className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",
268
+ children: [
269
+ /* @__PURE__ */ jsx("span", { children: note }),
270
+ history.hasEarlier && !arrivesLater ? /* @__PURE__ */ jsx(
271
+ "button",
272
+ {
273
+ type: "button",
274
+ onClick: history.loadEarlier,
275
+ disabled: history.loading,
276
+ className: "rounded font-medium text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default disabled:no-underline disabled:opacity-60",
277
+ children: history.loading ? "Loading earlier steps…" : "Load earlier steps"
278
+ }
279
+ ) : null
280
+ ]
281
+ }
282
+ ) : null,
283
+ messages.length > 0 ? /* @__PURE__ */ jsx(LaneStepsBoundary, { name: lane.name, children: /* @__PURE__ */ jsx(LaneStepComponentsContext.Provider, { value: components, children: /* @__PURE__ */ jsx(ReadonlyThreadProvider, { messages, children: /* @__PURE__ */ jsx("div", { "data-slot": "subagent-step-rows", className: "flex min-w-0 flex-col gap-1", children: /* @__PURE__ */ jsx(LaneRows, {}) }) }) }) }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: emptyText }),
284
+ closing ? /* @__PURE__ */ jsxs("div", { "data-slot": "subagent-result", className: "flex min-w-0 flex-col gap-0.5", children: [
285
+ /* @__PURE__ */ jsx(
286
+ "p",
287
+ {
288
+ className: cn(
289
+ "text-xs font-medium",
290
+ failed ? "text-destructive" : "text-muted-foreground"
291
+ ),
292
+ children: failed ? "Error" : "Report"
293
+ }
294
+ ),
295
+ /* @__PURE__ */ jsx(
296
+ "p",
297
+ {
298
+ "data-slot": "subagent-result-text",
299
+ className: cn(
300
+ "max-h-72 overflow-auto whitespace-pre-wrap break-words text-xs leading-relaxed",
301
+ failed ? "text-destructive/80" : "text-foreground/80"
302
+ ),
303
+ children: closing
304
+ }
305
+ )
306
+ ] }) : null
307
+ ] });
308
+ }
309
+ function laneMeta({
310
+ phase,
311
+ toolCallCount,
312
+ elapsedMs
313
+ }) {
314
+ const parts = [SUBAGENT_LANE_PHASE_LABELS[phase]];
315
+ if (toolCallCount > 0 || isSettledSubagentLanePhase(phase)) {
316
+ parts.push(toolCallCountLabel(toolCallCount));
317
+ }
318
+ if (elapsedMs !== null && (phase !== "running" || elapsedMs >= 1e3)) {
319
+ parts.push(formatWorkDuration(elapsedMs));
320
+ }
321
+ return parts.join(" · ");
322
+ }
323
+ function SubagentTaskCard({ toolCallId, args, status, artifact, messages }) {
324
+ const appearance = useToolAppearance();
325
+ const isThread = appearance === "thread";
326
+ const readLane = useAuiState((s) => taskSubagentsOfTurn(s.message).get(toolCallId));
327
+ const lane = useMemo(
328
+ () => readLane ?? laneFromArgs(toolCallId, args),
329
+ [readLane, toolCallId, args]
330
+ );
331
+ const { toolCallIds: waitingToolCallIds } = useApprovalWaitInScope();
332
+ const awaitingApproval = subagentAwaitingApproval({ lane, toolCallIds: waitingToolCallIds });
333
+ const gatedCall = awaitingApproval ? subagentToolCallAwaitingApproval({ lane, toolCallIds: waitingToolCallIds }) : void 0;
334
+ const phase = subagentLanePhase({ status: lane.status, partStatus: status, awaitingApproval });
335
+ const running = phase === "running";
336
+ const delegatedAt = useAuiState(
337
+ (s) => running ? laneDelegatedAtMs({ sources: getExternalStoreMessages(s.message), toolCallId }) : null
338
+ );
339
+ const runningElapsed = useRunningElapsedMs(running, delegatedAt);
340
+ const elapsedMs = running ? runningElapsed : isSettledSubagentLanePhase(phase) ? finishedLaneDurationMs(artifact) : null;
341
+ const step = useMemo(() => running ? latestLaneStep(lane.messages) : null, [running, lane.messages]);
342
+ const hasSteps = lane.messageCount > 0 || (lane.omittedMessageCount ?? 0) > 0;
343
+ const typeLabel = subagentTypeLabel(lane.name);
344
+ const title = lane.description.trim() || typeLabel;
345
+ const meta = laneMeta({ phase, toolCallCount: lane.toolCallCount, elapsedMs });
346
+ const liveText = step ? null : lane.currentText.trim();
347
+ const report = subagentLaneResult({ output: lane.output, phase, partStatus: status });
348
+ const header = /* @__PURE__ */ jsxs(Fragment, { children: [
349
+ /* @__PURE__ */ jsx(LaneStatusGlyph, { phase }),
350
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
351
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-baseline gap-1.5", children: [
352
+ /* @__PURE__ */ jsx(
353
+ "span",
354
+ {
355
+ "data-slot": "subagent-title",
356
+ title: lane.description || void 0,
357
+ className: "min-w-0 truncate font-medium text-foreground",
358
+ children: title
359
+ }
360
+ ),
361
+ title !== typeLabel ? /* @__PURE__ */ jsx(
362
+ "span",
363
+ {
364
+ "data-slot": "subagent-type",
365
+ className: "shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground",
366
+ children: typeLabel
367
+ }
368
+ ) : null
369
+ ] }),
370
+ /* @__PURE__ */ jsx(
371
+ "span",
372
+ {
373
+ "data-slot": "subagent-meta",
374
+ className: cn(
375
+ "text-xs tabular-nums text-muted-foreground",
376
+ phase === "error" && "text-destructive"
377
+ ),
378
+ children: meta
379
+ }
380
+ ),
381
+ phase === "approval" ? /* @__PURE__ */ jsxs(
382
+ "span",
383
+ {
384
+ "data-slot": "subagent-approval",
385
+ className: "flex min-w-0 items-baseline gap-1 text-xs text-muted-foreground",
386
+ children: [
387
+ /* @__PURE__ */ jsx("span", { className: "shrink-0 text-amber-700", children: gatedCall ? "Needs approval to run" : "Needs approval to start" }),
388
+ gatedCall ? /* @__PURE__ */ jsxs(Fragment, { children: [
389
+ /* @__PURE__ */ jsx("code", { className: "shrink-0 rounded bg-foreground/[0.06] px-1 py-px font-mono text-[11px] text-foreground/85", children: gatedCall.name }),
390
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: salientToolCallDetail(gatedCall) })
391
+ ] }) : null
392
+ ]
393
+ }
394
+ ) : running ? /* @__PURE__ */ jsx("span", { "data-slot": "subagent-activity", className: "min-w-0 truncate text-xs text-muted-foreground", children: step ? /* @__PURE__ */ jsx("span", { title: step.detail, children: /* @__PURE__ */ jsx(StepText, { text: step.label, code: step.code }) }) : liveText || "Starting…" }) : null
395
+ ] })
396
+ ] });
397
+ return /* @__PURE__ */ jsxs(
398
+ ToolFallbackRoot,
399
+ {
400
+ "data-testid": "subagent-task-card",
401
+ "data-phase": phase,
402
+ role: "group",
403
+ "aria-label": `Subagent: ${title}`,
404
+ className: cn(isThread && phase === "error" && "border-destructive/30 bg-destructive/5"),
405
+ children: [
406
+ hasSteps || running || report ? /* @__PURE__ */ jsxs(
407
+ CollapsibleTrigger,
408
+ {
409
+ "data-slot": "subagent-trigger",
410
+ className: cn(
411
+ "group/trigger flex w-full min-w-0 items-start gap-2 text-left text-[13px] leading-snug transition-colors hover:bg-muted/40",
412
+ isThread ? "rounded-lg px-2.5 py-1.5" : "px-3"
413
+ ),
414
+ children: [
415
+ header,
416
+ /* @__PURE__ */ jsx(
417
+ ChevronDownIcon,
418
+ {
419
+ "aria-hidden": "true",
420
+ className: cn(
421
+ "mt-0.5 size-3.5 shrink-0 text-muted-foreground/60",
422
+ "transition-transform duration-(--animation-duration) ease-out",
423
+ "group-data-[state=closed]/trigger:-rotate-90"
424
+ )
425
+ }
426
+ )
427
+ ]
428
+ }
429
+ ) : /* @__PURE__ */ jsx(
430
+ "div",
431
+ {
432
+ "data-slot": "subagent-trigger",
433
+ className: cn(
434
+ "flex w-full min-w-0 items-start gap-2 text-[13px] leading-snug",
435
+ isThread ? "px-2.5 py-1.5" : "px-3"
436
+ ),
437
+ children: header
438
+ }
439
+ ),
440
+ report ? /* @__PURE__ */ jsx(
441
+ "p",
442
+ {
443
+ "data-slot": "subagent-report",
444
+ className: cn(
445
+ "mb-1.5 line-clamp-3 whitespace-pre-line break-words text-xs leading-relaxed",
446
+ isThread ? "mr-2.5 ml-8" : "mx-3 mt-1.5 ml-9",
447
+ phase === "error" ? "text-destructive" : "text-foreground/80"
448
+ ),
449
+ children: report
450
+ }
451
+ ) : null,
452
+ /* @__PURE__ */ jsx(ToolFallbackContent, { children: /* @__PURE__ */ jsx(LaneQueryScope, { children: /* @__PURE__ */ jsx(LaneSteps, { lane, phase, result: report, partMessages: messages }) }) })
453
+ ]
454
+ }
455
+ );
456
+ }
457
+ function SubagentDelegationRow({ args, result, isError, status }) {
458
+ const settled = result !== void 0 && (status == null ? void 0 : status.type) !== "running";
459
+ const summary = summarizeToolCall({
460
+ toolName: "task",
461
+ args: typeof args === "object" && args !== null ? args : void 0,
462
+ status: !settled ? "running" : isError === true ? "error" : "complete"
463
+ });
464
+ return /* @__PURE__ */ jsxs(
465
+ "div",
466
+ {
467
+ "data-testid": "subagent-delegation",
468
+ className: "my-1 flex min-w-0 items-center gap-2 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-[13px]",
469
+ children: [
470
+ /* @__PURE__ */ jsx(BotIcon, { "aria-hidden": "true", className: "size-3.5 shrink-0 text-muted-foreground" }),
471
+ /* @__PURE__ */ jsx("span", { title: summary.detail, className: "min-w-0 truncate text-foreground", children: summary.label })
472
+ ]
473
+ }
474
+ );
475
+ }
476
+ const SubagentTaskToolUIImpl = (props) => useInReadOnlyThread() ? /* @__PURE__ */ jsx(SubagentDelegationRow, { ...props }) : /* @__PURE__ */ jsx(SubagentTaskCard, { ...props });
477
+ const SubagentTaskToolUI = memo(
478
+ SubagentTaskToolUIImpl
479
+ );
480
+ SubagentTaskToolUI.displayName = "SubagentTaskToolUI";
481
+ export {
482
+ SUBAGENT_LANE_PHASE_LABELS,
483
+ SubagentTaskToolUI,
484
+ finishedLaneDurationMs,
485
+ isSettledSubagentLanePhase,
486
+ laneDelegatedAtMs,
487
+ laneStepsNote,
488
+ latestLaneStep,
489
+ subagentLanePhase,
490
+ subagentLaneResult,
491
+ subagentTypeLabel,
492
+ toolCallCountLabel
493
+ };
494
+ //# sourceMappingURL=subagent-task-tool-ui.js.map