@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,311 @@
1
+ /**
2
+ * Subagent discovery: every subagent lane a deep-agent thread has spawned, as
3
+ * the card view model the surfaces that draw subagent lanes render. Two
4
+ * dispatch paths feed lanes keyed by dispatch id:
5
+ *
6
+ * - top-level `task` tool calls, read from the call's own tool-call part
7
+ * ({@link taskSubagentsOfTurn}): the part's result and `isPreliminary` say
8
+ * where the lane is, and its `messages` (the nested thread
9
+ * `createSubagentTranscriptConversionCache` converts) are the transcript;
10
+ * - in-eval `task()` dispatches ({@link deriveEvalSubagents}), whose only
11
+ * signals are the live `ptc_subagents` state channel and the summaries a
12
+ * finished `eval` ToolMessage persists in `artifact.ptc_subagents`.
13
+ */
14
+ import { type ThreadMessage } from '@assistant-ui/core';
15
+ import type { LangChainMessage, LangChainToolCall } from '@assistant-ui/react-langgraph';
16
+ import type { PtcSubagentEntry, Todo } from './types';
17
+ /**
18
+ * Where a subagent lane is:
19
+ *
20
+ * - `queued` — the dispatch has not started: a `task` call with no result yet
21
+ * (waiting for a dispatch slot or an approval; the backend shows the running
22
+ * card once the dispatch holds its slot), or an in-eval dispatch waiting for
23
+ * one of the bridge's concurrency slots.
24
+ * - `running` — a `task` call's result is still the backend's running
25
+ * placeholder (its part is `isPreliminary`), and the nested transcript fills
26
+ * in live; or an in-eval dispatch's lifecycle says it runs.
27
+ * - `complete` / `error` — the real result replaced the placeholder; `error`
28
+ * when it is an error result.
29
+ */
30
+ export type SubagentStatus = 'queued' | 'running' | 'complete' | 'error';
31
+ /** True for the settled lifecycle states (`complete` / `error`). */
32
+ export declare function isTerminalSubagentStatus(status: SubagentStatus): boolean;
33
+ /** Aggregate lane lifecycle counts for one fan-out (orchestration strip + header chip). */
34
+ export interface SubagentStatusCounts {
35
+ total: number;
36
+ queued: number;
37
+ running: number;
38
+ complete: number;
39
+ failed: number;
40
+ /** complete + failed — the settled count progress displays use. */
41
+ terminal: number;
42
+ }
43
+ export declare function countSubagentStatuses(snapshots: readonly SubagentDiscoverySnapshot[]): SubagentStatusCounts;
44
+ /**
45
+ * Discovery snapshot for one subagent invocation. Mirrors LangChain's
46
+ * `SubagentDiscoverySnapshot`: `id` is the `task` tool-call id that spawned the
47
+ * subagent (the dispatch id for an in-eval dispatch), so cards nest under the
48
+ * coordinator turn that delegated the work.
49
+ */
50
+ export interface SubagentDiscoverySnapshot {
51
+ /** The `task` tool-call id that spawned the subagent. */
52
+ id: string;
53
+ /** Subagent type/name, from the `task` call's `subagent_type` arg. */
54
+ name: string;
55
+ /** The one-line task brief from the `task` call's `description` arg. */
56
+ description: string;
57
+ /** Lifecycle state — see {@link SubagentStatus}. */
58
+ status: SubagentStatus;
59
+ /** The call's result text (empty while it is the running placeholder). */
60
+ output?: string;
61
+ /** Number of nested tool calls the subagent made. */
62
+ toolCallCount: number;
63
+ /**
64
+ * The subagent's transcript as a nested thread: a `task` part's native
65
+ * `messages`, or an in-eval dispatch's live transcript converted the same way.
66
+ */
67
+ messages: readonly ThreadMessage[];
68
+ /** Messages in the transcript as the wire carries them, before conversion joins a turn's steps. */
69
+ messageCount: number;
70
+ /**
71
+ * Nested messages the wire left off: a cut card carries its newest steps
72
+ * ({@link readTruncatedLane}) — a running card always, a finished one on a
73
+ * version-2 view — and the rest pages in through `history/lane`; an in-eval
74
+ * dispatch's streamed transcript is cut the same way, running or finished.
75
+ * Absent when the transcript rides whole.
76
+ */
77
+ omittedMessageCount?: number;
78
+ /**
79
+ * Where the lane's steps ride, what `history/lane` pages the rest of the lane
80
+ * under (`useDeepAgentLaneHistory`): a `task` lane's card, an in-eval lane's
81
+ * registry entry while it streams its steps, or, once they no longer ride,
82
+ * its subagent checkpoint (`checkpointed`), when agora recorded where that is
83
+ * (`ns`). Absent for any other in-eval lane with no streamed steps (a summary
84
+ * written before agora recorded the namespace, an older host).
85
+ */
86
+ source?: SubagentLaneSource;
87
+ /** The subagent's own plan, nested by the backend on the task artifact (`subgraph_state.todos`). */
88
+ todos?: Todo[];
89
+ /** The newest tool call in the transcript — the card's "last action" ticker. */
90
+ lastToolCall?: LangChainToolCall;
91
+ /** The newest assistant text in the transcript — the card's thought preview. */
92
+ currentText: string;
93
+ /**
94
+ * The `eval` tool-call id that dispatched this subagent, when it was spawned
95
+ * from INSIDE the code interpreter (`task()` in the REPL) rather than by a
96
+ * top-level `task` tool call. The eval card uses it to render lanes for its
97
+ * own dispatches.
98
+ */
99
+ evalId?: string;
100
+ /**
101
+ * Backend-reported runtime for a finished in-eval dispatch (from the terminal
102
+ * lifecycle event). Authoritative over client-side timing — it survives a page
103
+ * refresh, where local first-seen timestamps are gone.
104
+ */
105
+ durationMs?: number;
106
+ /** The model that produced the transcript, from its newest assistant turn's model stamp. */
107
+ model?: string;
108
+ /**
109
+ * The lane's token use: the whole lane's as the host counts it
110
+ * (`DEEP_AGENT_LANE_USAGE_KEY`), else the sum of the native step usage
111
+ * (`metadata.steps[].usage`) of the steps the transcript holds. Absent while
112
+ * no step reports any.
113
+ */
114
+ usage?: SubagentTokenUsage;
115
+ }
116
+ /** A subagent lane's token use. */
117
+ export interface SubagentTokenUsage {
118
+ /** Input tokens, the prompt cache's reads and writes included. */
119
+ readonly inputTokens: number;
120
+ readonly outputTokens: number;
121
+ /**
122
+ * Less than the lane will have used: the lane still runs (its newest step may
123
+ * not have reported yet), or no host total arrived and the sum covers only
124
+ * the steps held of a lane cut to its newest ones.
125
+ */
126
+ readonly partial: boolean;
127
+ }
128
+ /** Input and output tokens of some model calls. */
129
+ export interface TokenCounts {
130
+ readonly inputTokens: number;
131
+ readonly outputTokens: number;
132
+ }
133
+ /**
134
+ * The subagent's streamed transcript as the wire carries it, read from a task
135
+ * ToolMessage's `artifact.subgraph_state.messages` (the shape the backend nests
136
+ * it under — see the route's `_subagent_subgraph_state`).
137
+ */
138
+ export declare function nestedMessagesFromArtifact(artifact: unknown): LangChainMessage[];
139
+ /** What the wire left off a cut `task` card's nested transcript. */
140
+ export interface TruncatedLane {
141
+ /** Nested messages the host holds for the lane. */
142
+ messages: number;
143
+ /** Tool calls across all of them. */
144
+ toolCalls: number;
145
+ /**
146
+ * The card is a finished lane's, cut for a version-2 view. Only a host that
147
+ * serves `history/lane` cuts a finished card.
148
+ */
149
+ finished: boolean;
150
+ }
151
+ /**
152
+ * Where a lane's steps ride, and what `history/lane` pages the rest of them
153
+ * under: a `task` lane's card, by its message id, or an in-eval dispatch's
154
+ * `ptc_subagents` registry entry, by its dispatch id.
155
+ */
156
+ export type SubagentLaneSource = {
157
+ /** The steps as the wire carries them (a card's report restored, {@link withRepeatedResult}). */
158
+ readonly transcript: readonly LangChainMessage[];
159
+ /** The cut marker; absent while every step rides. */
160
+ readonly truncated?: TruncatedLane;
161
+ /**
162
+ * No steps ride, and `history/lane {lane}` pages the subagent's own steps
163
+ * from its checkpoint: an in-eval lane a later run in this activation left
164
+ * only its summary and `ns`, or a reopened session's lane (its registry gone,
165
+ * the summary its eval persisted records `ns`).
166
+ */
167
+ readonly checkpointed?: true;
168
+ } & ({
169
+ /** The card's message id: the running placeholder's, then the result's. */
170
+ readonly messageId: string;
171
+ readonly lane?: undefined;
172
+ } | {
173
+ /** The dispatch id: the in-eval lane's registry key. */
174
+ readonly lane: string;
175
+ readonly messageId?: undefined;
176
+ });
177
+ /**
178
+ * The cut marker off a `task` card's raw wire message: the host carries only
179
+ * the lane's newest nested steps and names the whole transcript here
180
+ * (`DEEP_AGENT_TRUNCATED_LANE_KEY`), on a running card and, for a version-2
181
+ * view, on a finished one. `null` when the transcript rides whole.
182
+ */
183
+ export declare function readTruncatedLane(toolMessage: unknown): TruncatedLane | null;
184
+ /**
185
+ * The whole lane's token use the host carries on a `task` card's raw wire
186
+ * message or an in-eval lane's `ptc_subagents` entry
187
+ * (`DEEP_AGENT_LANE_USAGE_KEY`), however much of the lane the wire carries.
188
+ * `null` when it carries none (an older host, or no step reported usage).
189
+ */
190
+ export declare function readLaneUsage(wire: unknown): TokenCounts | null;
191
+ /**
192
+ * What the model calls of a converted transcript used, from assistant-ui's
193
+ * native step usage (`metadata.steps[].usage`, one step per model call a turn
194
+ * joined). `undefined` when no step reports usage. Memoized per transcript
195
+ * array, which the conversion caches keep while the transcript is unchanged.
196
+ */
197
+ export declare function transcriptStepUsage(messages: readonly ThreadMessage[]): TokenCounts | undefined;
198
+ /**
199
+ * The subagent's own plan, read from a task ToolMessage's
200
+ * `artifact.subgraph_state.todos` (the backend mirrors the subagent's isolated
201
+ * `todos` state channel there — see the route's `_forward_subagent_todos`).
202
+ * `undefined` (not `[]`) when the subagent never wrote a plan, so the UI can
203
+ * distinguish "no plan" from "plan with zero items".
204
+ */
205
+ export declare function nestedTodosFromArtifact(artifact: unknown): Todo[] | undefined;
206
+ /**
207
+ * The persisted in-eval dispatch summaries from an `eval` ToolMessage's
208
+ * `artifact.ptc_subagents` (written by the backend when the eval ends). Unlike
209
+ * the live `ptc_subagents` state channel — which dies with the stream — these
210
+ * survive checkpoint reload, so reopened sessions can still render each
211
+ * dispatch's terminal status, duration, output, and error.
212
+ */
213
+ export declare function ptcSubagentsFromArtifact(artifact: unknown): PtcSubagentEntry[];
214
+ /**
215
+ * The lane of every `task` call in one converted turn (a `ThreadMessage`, or the
216
+ * message state assistant-ui publishes for it), keyed by tool-call id in call
217
+ * order. Memoized per turn and per part.
218
+ */
219
+ export declare function taskSubagentsOfTurn(message: ThreadMessage): ReadonlyMap<string, SubagentDiscoverySnapshot>;
220
+ /** The lane of every `task` call in a converted thread, in transcript order. */
221
+ export declare function taskSubagentsOfThread(messages: readonly ThreadMessage[]): SubagentDiscoverySnapshot[];
222
+ /**
223
+ * The lanes of in-eval dispatches, from two sources: the *persisted* summaries
224
+ * each finished `eval` ToolMessage carries in `artifact.ptc_subagents`
225
+ * (terminal truth; the only source after a session reopen), then the *live*
226
+ * `ptc_subagents` state channel (`ptcSubagents`) for dispatches still
227
+ * streaming. A live entry never downgrades a terminal snapshot back to
228
+ * `running` — a stale lifecycle entry whose terminal event was lost must not
229
+ * resurrect a perpetually-running lane the persisted summary already settled.
230
+ * A lane whose steps no longer ride but whose subagent checkpoint namespace is
231
+ * recorded (`ns`) is `checkpointed`, and `history/lane {lane}` pages its
232
+ * steps: a live entry a later run stripped to its summary, or a persisted
233
+ * summary with no live entry (the registry died with the activation that
234
+ * streamed it). A live entry speaks for its lane over the summary.
235
+ */
236
+ export declare function deriveEvalSubagents(messages: readonly LangChainMessage[], ptcSubagents?: Record<string, PtcSubagentEntry>): Map<string, SubagentDiscoverySnapshot>;
237
+ /**
238
+ * Whether a subagent lane waits on a person's approval, given the gated calls
239
+ * still waiting on one (`toolCallIdsAwaitingApproval`): its own dispatch is the
240
+ * gated call (a per-dispatch `task` gate), or a call it made is (a gated tool
241
+ * raised inside the delegated subagent). The approval names the gated call's
242
+ * `tool_call_id` and never the lane, and a lane's transcript carries the calls
243
+ * it made with their ids, so the call id is the join. A settled lane waits on
244
+ * nobody.
245
+ */
246
+ export declare function subagentAwaitingApproval({ lane, toolCallIds, }: {
247
+ lane: Pick<SubagentDiscoverySnapshot, 'id' | 'status' | 'messages'>;
248
+ /** The gated calls still waiting on a decision (`toolCallIdsAwaitingApproval`). */
249
+ toolCallIds: ReadonlySet<string>;
250
+ }): boolean;
251
+ /**
252
+ * The call a subagent made that waits on a person's approval (a gated tool
253
+ * raised inside the delegated subagent), read off its transcript — what the
254
+ * lane card names while it waits. `undefined` when the lane made none, which
255
+ * includes a lane whose own dispatch is the gated call.
256
+ */
257
+ export declare function subagentToolCallAwaitingApproval({ lane, toolCallIds, }: {
258
+ lane: Pick<SubagentDiscoverySnapshot, 'status' | 'messages'>;
259
+ /** The gated calls still waiting on a decision (`toolCallIdsAwaitingApproval`). */
260
+ toolCallIds: ReadonlySet<string>;
261
+ }): LangChainToolCall | undefined;
262
+ /**
263
+ * The calls of one converted turn that wait on a person's approval, in turn
264
+ * order: a gated call of the turn itself, or a `task` call not yet settled
265
+ * (no result, or the running placeholder) whose lane holds a gated call — the
266
+ * steps the turn's step list reads as waiting rather than running or done.
267
+ */
268
+ export declare function turnToolCallsAwaitingApproval({ message, toolCallIds, }: {
269
+ message: ThreadMessage;
270
+ /** The gated calls still waiting on a decision (`toolCallIdsAwaitingApproval`). */
271
+ toolCallIds: ReadonlySet<string>;
272
+ }): string[];
273
+ /**
274
+ * {@link turnToolCallsAwaitingApproval} for the message in scope: what a
275
+ * turn's step list takes as `waitingToolCallIds`, given the run's waiting
276
+ * calls (`toolCallIdsAwaitingApproval`). Selected as a joined string, so a
277
+ * streamed token re-renders the caller only when the waiting steps change, and
278
+ * the set keeps its identity while they do not. Olympus's activity card and
279
+ * the SDK chat's turns both read it.
280
+ */
281
+ export declare function useTurnToolCallsAwaitingApproval(toolCallIds: ReadonlySet<string>): ReadonlySet<string>;
282
+ /** Result text shown for a dispatch whose owning run ended before it finished. */
283
+ export declare const ORPHANED_SUBAGENT_OUTPUT = "Interrupted \u2014 the run that dispatched this subagent ended before it finished.";
284
+ /**
285
+ * Settle snapshots orphaned by their dispatching context: once the owner (e.g.
286
+ * the `eval` tool call whose in-eval `task()` issued them) is itself terminal,
287
+ * nothing can ever deliver a `complete`/`error` lifecycle event for a lane still
288
+ * `queued`/`running` — the dispatch coroutines were cancelled with the eval. Those
289
+ * lanes are coerced to `error` with an interruption message so the UI can't show
290
+ * perpetual "Running · no activity" ghosts. Returns the input array unchanged
291
+ * (same reference) when there is nothing to settle.
292
+ */
293
+ export declare function finalizeOrphanedSubagents(snapshots: readonly SubagentDiscoverySnapshot[], ownerTerminal: boolean): readonly SubagentDiscoverySnapshot[];
294
+ /**
295
+ * The `task` tool calls sharing `toolCallId`'s parent AI message — the parallel
296
+ * fan-out siblings, in declaration order. Parallel `task` calls always live on ONE
297
+ * AI message's `tool_calls`, so "same parent message" IS the parallelism boundary;
298
+ * sequential delegations sit on separate AI messages and form singleton groups.
299
+ * The FIRST sibling is the group's `anchorId`: its tool-part render draws the whole
300
+ * side-by-side group and the other siblings render nothing, keeping the layout
301
+ * change fully inside the `task` tool UI. Falls back to a singleton group when the
302
+ * parent AI message isn't among `messages` (a turn's bound sources, or a raw
303
+ * transcript).
304
+ */
305
+ export interface TaskSiblingGroup {
306
+ /** Sibling `task` tool-call ids in declaration order. */
307
+ ids: string[];
308
+ /** The first sibling — the one tool-part render that owns the group's UI. */
309
+ anchorId: string;
310
+ }
311
+ export declare function taskSiblingGroup(messages: readonly LangChainMessage[], toolCallId: string): TaskSiblingGroup;
@@ -0,0 +1,253 @@
1
+ import { getExternalStoreMessages } from "@assistant-ui/core";
2
+ import { useAuiState } from "@assistant-ui/store";
3
+ import { useMemo } from "react";
4
+ import { DEEP_AGENT_TRUNCATED_LANE_KEY, DEEP_AGENT_LANE_USAGE_KEY } from "./generated/runconfig-contract.js";
5
+ import { getMessageText } from "./message-text.js";
6
+ import { withRepeatedResult } from "./subagent-transcripts.js";
7
+ import { TASK_TOOL_NAME } from "./tool-names.js";
8
+ function isTerminalSubagentStatus(status) {
9
+ return status === "complete" || status === "error";
10
+ }
11
+ function subagentNameFromArgs(args) {
12
+ if (!args) return "subagent";
13
+ return String(args.subagent_type ?? args.subagentType ?? args.subagent ?? "subagent");
14
+ }
15
+ function nestedMessagesFromArtifact(artifact) {
16
+ var _a;
17
+ const a = artifact;
18
+ return ((_a = a == null ? void 0 : a.subgraph_state) == null ? void 0 : _a.messages) ?? [];
19
+ }
20
+ const isCount = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0;
21
+ function readTruncatedLane(toolMessage) {
22
+ if (typeof toolMessage !== "object" || toolMessage === null) return null;
23
+ const marker = toolMessage[DEEP_AGENT_TRUNCATED_LANE_KEY];
24
+ if (typeof marker !== "object" || marker === null) return null;
25
+ const { messages, tool_calls: toolCalls, finished } = marker;
26
+ return isCount(messages) && isCount(toolCalls) ? { messages, toolCalls, finished: finished === true } : null;
27
+ }
28
+ function readLaneUsage(wire) {
29
+ if (typeof wire !== "object" || wire === null) return null;
30
+ const usage = wire[DEEP_AGENT_LANE_USAGE_KEY];
31
+ if (typeof usage !== "object" || usage === null) return null;
32
+ const { input_tokens: inputTokens, output_tokens: outputTokens } = usage;
33
+ return isCount(inputTokens) && isCount(outputTokens) ? { inputTokens, outputTokens } : null;
34
+ }
35
+ function laneTokenUsage(wire, steps, status, cut) {
36
+ const settled = isTerminalSubagentStatus(status);
37
+ const whole = readLaneUsage(wire);
38
+ if (whole !== null) return { ...whole, partial: !settled };
39
+ return steps === void 0 ? void 0 : { ...steps, partial: !settled || cut };
40
+ }
41
+ const transcriptStepUsageCache = /* @__PURE__ */ new WeakMap();
42
+ function transcriptStepUsage(messages) {
43
+ const cached = transcriptStepUsageCache.get(messages);
44
+ if (cached !== void 0) return cached ?? void 0;
45
+ let inputTokens = 0;
46
+ let outputTokens = 0;
47
+ let counted = false;
48
+ for (const message of messages) {
49
+ for (const step of message.metadata.steps ?? []) {
50
+ if (step.usage === void 0) continue;
51
+ inputTokens += step.usage.inputTokens;
52
+ outputTokens += step.usage.outputTokens;
53
+ counted = true;
54
+ }
55
+ }
56
+ const usage = counted ? { inputTokens, outputTokens } : null;
57
+ transcriptStepUsageCache.set(messages, usage);
58
+ return usage ?? void 0;
59
+ }
60
+ function nestedTodosFromArtifact(artifact) {
61
+ var _a;
62
+ const a = artifact;
63
+ const todos = (_a = a == null ? void 0 : a.subgraph_state) == null ? void 0 : _a.todos;
64
+ return Array.isArray(todos) ? todos : void 0;
65
+ }
66
+ const EMPTY_TRANSCRIPT_DERIVATION = {
67
+ currentText: "",
68
+ model: void 0,
69
+ lastToolCall: void 0,
70
+ toolCallCount: 0,
71
+ todos: void 0
72
+ };
73
+ const transcriptDerivationCache = /* @__PURE__ */ new WeakMap();
74
+ function deriveTranscript(transcript) {
75
+ var _a, _b;
76
+ if (transcript.length === 0) return EMPTY_TRANSCRIPT_DERIVATION;
77
+ const cached = transcriptDerivationCache.get(transcript);
78
+ if (cached !== void 0) return cached;
79
+ let currentText = "";
80
+ let model;
81
+ let lastToolCall;
82
+ let toolCallCount = 0;
83
+ let todos;
84
+ for (const message of transcript) {
85
+ if (message.role !== "assistant") continue;
86
+ const turnModel = (_b = (_a = message.metadata) == null ? void 0 : _a.custom) == null ? void 0 : _b.model;
87
+ if (typeof turnModel === "string" && turnModel) model = turnModel;
88
+ for (const part of message.content) {
89
+ if (part.type === "text") {
90
+ if (part.text) currentText = part.text;
91
+ continue;
92
+ }
93
+ if (part.type !== "tool-call") continue;
94
+ toolCallCount += 1;
95
+ lastToolCall = { id: part.toolCallId, name: part.toolName, args: part.args };
96
+ if (part.toolName !== "write_todos") continue;
97
+ const list = part.args.todos;
98
+ if (Array.isArray(list)) todos = list;
99
+ }
100
+ }
101
+ const derivation = {
102
+ currentText,
103
+ model,
104
+ lastToolCall,
105
+ toolCallCount,
106
+ todos
107
+ };
108
+ transcriptDerivationCache.set(transcript, derivation);
109
+ return derivation;
110
+ }
111
+ const NO_TRANSCRIPT = [];
112
+ function taskSubagent(part, toolMessage) {
113
+ const args = part.args;
114
+ const transcript = part.messages ?? NO_TRANSCRIPT;
115
+ const derived = deriveTranscript(transcript);
116
+ const messageCount = nestedMessagesFromArtifact(part.artifact).length;
117
+ const lane = readTruncatedLane(toolMessage);
118
+ const todos = nestedTodosFromArtifact(part.artifact);
119
+ const status = part.result === void 0 ? "queued" : part.isPreliminary === true ? "running" : part.isError === true ? "error" : "complete";
120
+ const usage = laneTokenUsage(
121
+ toolMessage,
122
+ transcriptStepUsage(transcript),
123
+ status,
124
+ lane !== null && lane.messages > messageCount
125
+ );
126
+ return {
127
+ id: part.toolCallId,
128
+ name: subagentNameFromArgs(args),
129
+ description: typeof args.description === "string" ? args.description : "",
130
+ status,
131
+ ...part.result !== void 0 && { output: getMessageText({ content: part.result }) },
132
+ toolCallCount: Math.max(derived.toolCallCount, (lane == null ? void 0 : lane.toolCalls) ?? 0),
133
+ messages: transcript,
134
+ messageCount,
135
+ ...lane !== null && { omittedMessageCount: Math.max(0, lane.messages - messageCount) },
136
+ ...typeof (toolMessage == null ? void 0 : toolMessage.id) === "string" && {
137
+ source: {
138
+ messageId: toolMessage.id,
139
+ transcript: withRepeatedResult(nestedMessagesFromArtifact(part.artifact), part.result),
140
+ ...lane !== null && { truncated: lane }
141
+ }
142
+ },
143
+ ...todos !== void 0 && { todos },
144
+ ...derived.lastToolCall !== void 0 && { lastToolCall: derived.lastToolCall },
145
+ currentText: derived.currentText,
146
+ ...derived.model !== void 0 && { model: derived.model },
147
+ ...usage !== void 0 && { usage }
148
+ };
149
+ }
150
+ function toolMessagesOfTurn(message) {
151
+ const byCall = /* @__PURE__ */ new Map();
152
+ for (const source of getExternalStoreMessages(message)) {
153
+ if (source.type === "tool") byCall.set(source.tool_call_id, source);
154
+ }
155
+ return byCall;
156
+ }
157
+ const taskSubagentByPart = /* @__PURE__ */ new WeakMap();
158
+ const taskSubagentsByTurn = /* @__PURE__ */ new WeakMap();
159
+ function taskSubagentsOfTurn(message) {
160
+ const cached = taskSubagentsByTurn.get(message);
161
+ if (cached !== void 0) return cached;
162
+ const lanes = /* @__PURE__ */ new Map();
163
+ if (message.role === "assistant") {
164
+ let toolMessages = null;
165
+ for (const part of message.content) {
166
+ if (part.type !== "tool-call" || part.toolName !== TASK_TOOL_NAME) continue;
167
+ let lane = taskSubagentByPart.get(part);
168
+ if (lane === void 0) {
169
+ toolMessages ?? (toolMessages = toolMessagesOfTurn(message));
170
+ lane = taskSubagent(part, toolMessages.get(part.toolCallId));
171
+ taskSubagentByPart.set(part, lane);
172
+ }
173
+ lanes.set(part.toolCallId, lane);
174
+ }
175
+ }
176
+ taskSubagentsByTurn.set(message, lanes);
177
+ return lanes;
178
+ }
179
+ function findToolCall({
180
+ messages,
181
+ toolCallIds
182
+ }) {
183
+ if (messages === void 0) return void 0;
184
+ for (const message of messages) {
185
+ if (message.role !== "assistant") continue;
186
+ for (const part of message.content) {
187
+ if (part.type === "tool-call" && toolCallIds.has(part.toolCallId)) return part;
188
+ }
189
+ }
190
+ return void 0;
191
+ }
192
+ function subagentAwaitingApproval({
193
+ lane,
194
+ toolCallIds
195
+ }) {
196
+ if (toolCallIds.size === 0 || isTerminalSubagentStatus(lane.status)) return false;
197
+ return toolCallIds.has(lane.id) || findToolCall({ messages: lane.messages, toolCallIds }) !== void 0;
198
+ }
199
+ function subagentToolCallAwaitingApproval({
200
+ lane,
201
+ toolCallIds
202
+ }) {
203
+ if (toolCallIds.size === 0 || isTerminalSubagentStatus(lane.status)) return void 0;
204
+ const part = findToolCall({ messages: lane.messages, toolCallIds });
205
+ return part === void 0 ? void 0 : { id: part.toolCallId, name: part.toolName, args: part.args };
206
+ }
207
+ function turnToolCallsAwaitingApproval({
208
+ message,
209
+ toolCallIds
210
+ }) {
211
+ if (toolCallIds.size === 0 || message.role !== "assistant") return [];
212
+ const ids = [];
213
+ for (const part of message.content) {
214
+ if (part.type !== "tool-call") continue;
215
+ if (toolCallIds.has(part.toolCallId)) {
216
+ ids.push(part.toolCallId);
217
+ continue;
218
+ }
219
+ if (part.toolName !== TASK_TOOL_NAME) continue;
220
+ const settled = part.result !== void 0 && part.isPreliminary !== true;
221
+ if (!settled && findToolCall({ messages: part.messages, toolCallIds }) !== void 0) {
222
+ ids.push(part.toolCallId);
223
+ }
224
+ }
225
+ return ids;
226
+ }
227
+ const NO_WAITING_TOOL_CALLS = /* @__PURE__ */ new Set();
228
+ const TOOL_CALL_ID_SEPARATOR = "\n";
229
+ function useTurnToolCallsAwaitingApproval(toolCallIds) {
230
+ const key = useAuiState(
231
+ (s) => toolCallIds.size === 0 ? "" : turnToolCallsAwaitingApproval({ message: s.message, toolCallIds }).join(
232
+ TOOL_CALL_ID_SEPARATOR
233
+ )
234
+ );
235
+ return useMemo(
236
+ () => key === "" ? NO_WAITING_TOOL_CALLS : new Set(key.split(TOOL_CALL_ID_SEPARATOR)),
237
+ [key]
238
+ );
239
+ }
240
+ export {
241
+ isTerminalSubagentStatus,
242
+ nestedMessagesFromArtifact,
243
+ nestedTodosFromArtifact,
244
+ readLaneUsage,
245
+ readTruncatedLane,
246
+ subagentAwaitingApproval,
247
+ subagentToolCallAwaitingApproval,
248
+ taskSubagentsOfTurn,
249
+ transcriptStepUsage,
250
+ turnToolCallsAwaitingApproval,
251
+ useTurnToolCallsAwaitingApproval
252
+ };
253
+ //# sourceMappingURL=subagents.js.map