@assistant-ui/react 0.14.18 → 0.14.20

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 (334) hide show
  1. package/dist/client/ExternalThread.d.ts +3 -2
  2. package/dist/client/ExternalThread.d.ts.map +1 -1
  3. package/dist/client/ExternalThread.js +721 -256
  4. package/dist/client/ExternalThread.js.map +1 -1
  5. package/dist/client/InMemoryThreadList.d.ts.map +1 -1
  6. package/dist/client/InMemoryThreadList.js +292 -108
  7. package/dist/client/InMemoryThreadList.js.map +1 -1
  8. package/dist/client/SingleThreadList.js +139 -53
  9. package/dist/client/SingleThreadList.js.map +1 -1
  10. package/dist/context/ReadonlyStore.js.map +1 -1
  11. package/dist/context/providers/MessageProvider.js +38 -5
  12. package/dist/context/providers/MessageProvider.js.map +1 -1
  13. package/dist/context/providers/ThreadViewportProvider.js +76 -20
  14. package/dist/context/providers/ThreadViewportProvider.js.map +1 -1
  15. package/dist/context/react/ThreadViewportContext.js.map +1 -1
  16. package/dist/context/react/utils/createContextHook.js.map +1 -1
  17. package/dist/context/react/utils/createContextStoreHook.js +17 -2
  18. package/dist/context/react/utils/createContextStoreHook.js.map +1 -1
  19. package/dist/context/react/utils/createStateHookForRuntime.js.map +1 -1
  20. package/dist/context/react/utils/ensureBinding.js.map +1 -1
  21. package/dist/context/react/utils/useRuntimeState.js +18 -2
  22. package/dist/context/react/utils/useRuntimeState.js.map +1 -1
  23. package/dist/context/stores/ThreadViewport.js.map +1 -1
  24. package/dist/devtools/DevToolsHooks.js.map +1 -1
  25. package/dist/hooks/useMessageQuote.js.map +1 -1
  26. package/dist/hooks/useMessageTiming.js +4 -1
  27. package/dist/hooks/useMessageTiming.js.map +1 -1
  28. package/dist/hooks/useToolCallElapsed.d.ts +23 -0
  29. package/dist/hooks/useToolCallElapsed.d.ts.map +1 -0
  30. package/dist/hooks/useToolCallElapsed.js +72 -0
  31. package/dist/hooks/useToolCallElapsed.js.map +1 -0
  32. package/dist/index.d.ts +4 -2
  33. package/dist/index.js +3 -1
  34. package/dist/internal.js.map +1 -1
  35. package/dist/legacy-runtime/AssistantRuntimeProvider.js +46 -10
  36. package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
  37. package/dist/legacy-runtime/cloud/auiV0.js.map +1 -1
  38. package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.js +27 -6
  39. package/dist/legacy-runtime/cloud/useCloudThreadListRuntime.js.map +1 -1
  40. package/dist/legacy-runtime/hooks/AssistantContext.js +13 -2
  41. package/dist/legacy-runtime/hooks/AssistantContext.js.map +1 -1
  42. package/dist/legacy-runtime/hooks/AttachmentContext.js +9 -1
  43. package/dist/legacy-runtime/hooks/AttachmentContext.js.map +1 -1
  44. package/dist/legacy-runtime/hooks/ComposerContext.js +9 -1
  45. package/dist/legacy-runtime/hooks/ComposerContext.js.map +1 -1
  46. package/dist/legacy-runtime/hooks/MessageContext.js +12 -2
  47. package/dist/legacy-runtime/hooks/MessageContext.js.map +1 -1
  48. package/dist/legacy-runtime/hooks/MessagePartContext.js +9 -1
  49. package/dist/legacy-runtime/hooks/MessagePartContext.js.map +1 -1
  50. package/dist/legacy-runtime/hooks/ThreadContext.js +33 -5
  51. package/dist/legacy-runtime/hooks/ThreadContext.js.map +1 -1
  52. package/dist/legacy-runtime/hooks/ThreadListItemContext.js +9 -1
  53. package/dist/legacy-runtime/hooks/ThreadListItemContext.js.map +1 -1
  54. package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.js +3 -3
  55. package/dist/legacy-runtime/runtime-cores/assistant-transport/commandQueue.js.map +1 -1
  56. package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.js +71 -31
  57. package/dist/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.js.map +1 -1
  58. package/dist/legacy-runtime/runtime-cores/assistant-transport/runManager.js.map +1 -1
  59. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +24 -16
  60. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
  61. package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.js +17 -12
  62. package/dist/legacy-runtime/runtime-cores/assistant-transport/useConvertedState.js.map +1 -1
  63. package/dist/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.js +17 -3
  64. package/dist/legacy-runtime/runtime-cores/assistant-transport/useLatestRef.js.map +1 -1
  65. package/dist/mcp-apps/McpAppRenderer.js +6 -6
  66. package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
  67. package/dist/mcp-apps/McpAppsRemoteHost.js +3 -3
  68. package/dist/mcp-apps/McpAppsRemoteHost.js.map +1 -1
  69. package/dist/mcp-apps/app-frame.js +33 -14
  70. package/dist/mcp-apps/app-frame.js.map +1 -1
  71. package/dist/mcp-apps/bridge.js.map +1 -1
  72. package/dist/mcp-apps/types.js.map +1 -1
  73. package/dist/mcp-apps/utils.js.map +1 -1
  74. package/dist/model-context/frame/useAssistantFrameHost.js +32 -14
  75. package/dist/model-context/frame/useAssistantFrameHost.js.map +1 -1
  76. package/dist/model-context/makeAssistantVisible.js +64 -26
  77. package/dist/model-context/makeAssistantVisible.js.map +1 -1
  78. package/dist/primitives/actionBar/ActionBarCopy.js +94 -20
  79. package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
  80. package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
  81. package/dist/primitives/actionBar/ActionBarExportMarkdown.js +105 -37
  82. package/dist/primitives/actionBar/ActionBarExportMarkdown.js.map +1 -1
  83. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +60 -11
  84. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
  85. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +60 -11
  86. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
  87. package/dist/primitives/actionBar/ActionBarInteractionContext.js +3 -1
  88. package/dist/primitives/actionBar/ActionBarInteractionContext.js.map +1 -1
  89. package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
  90. package/dist/primitives/actionBar/ActionBarRoot.js +84 -25
  91. package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
  92. package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
  93. package/dist/primitives/actionBar/ActionBarStopSpeaking.js +45 -14
  94. package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
  95. package/dist/primitives/actionBar/useActionBarFloatStatus.js +22 -10
  96. package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
  97. package/dist/primitives/actionBar.js.map +1 -1
  98. package/dist/primitives/actionBarMore/ActionBarMoreContent.js +44 -7
  99. package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -1
  100. package/dist/primitives/actionBarMore/ActionBarMoreItem.js +28 -6
  101. package/dist/primitives/actionBarMore/ActionBarMoreItem.js.map +1 -1
  102. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +103 -36
  103. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js.map +1 -1
  104. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +28 -6
  105. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js.map +1 -1
  106. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +28 -6
  107. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js.map +1 -1
  108. package/dist/primitives/actionBarMore/scope.js.map +1 -1
  109. package/dist/primitives/actionBarMore.js.map +1 -1
  110. package/dist/primitives/assistantModal/AssistantModalAnchor.js +27 -6
  111. package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
  112. package/dist/primitives/assistantModal/AssistantModalContent.js +71 -10
  113. package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
  114. package/dist/primitives/assistantModal/AssistantModalRoot.js +93 -26
  115. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  116. package/dist/primitives/assistantModal/AssistantModalTrigger.js +27 -6
  117. package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
  118. package/dist/primitives/assistantModal/scope.js.map +1 -1
  119. package/dist/primitives/assistantModal.js.map +1 -1
  120. package/dist/primitives/attachment/AttachmentName.js +13 -1
  121. package/dist/primitives/attachment/AttachmentName.js.map +1 -1
  122. package/dist/primitives/attachment/AttachmentRemove.js +11 -4
  123. package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
  124. package/dist/primitives/attachment/AttachmentRoot.js +13 -4
  125. package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
  126. package/dist/primitives/attachment/AttachmentThumb.js +20 -9
  127. package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
  128. package/dist/primitives/attachment.js.map +1 -1
  129. package/dist/primitives/branchPicker/BranchPickerCount.js +14 -2
  130. package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
  131. package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
  132. package/dist/primitives/branchPicker/BranchPickerNumber.js +14 -2
  133. package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
  134. package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
  135. package/dist/primitives/branchPicker/BranchPickerRoot.js +34 -6
  136. package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
  137. package/dist/primitives/branchPicker.js.map +1 -1
  138. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +16 -5
  139. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
  140. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js +13 -4
  141. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js.map +1 -1
  142. package/dist/primitives/chainOfThought.js.map +1 -1
  143. package/dist/primitives/composer/ComposerAddAttachment.js +37 -24
  144. package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
  145. package/dist/primitives/composer/ComposerAttachmentDropzone.js +124 -49
  146. package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
  147. package/dist/primitives/composer/ComposerCancel.js.map +1 -1
  148. package/dist/primitives/composer/ComposerDictate.js.map +1 -1
  149. package/dist/primitives/composer/ComposerDictationTranscript.js +32 -7
  150. package/dist/primitives/composer/ComposerDictationTranscript.js.map +1 -1
  151. package/dist/primitives/composer/ComposerInput.js +26 -26
  152. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  153. package/dist/primitives/composer/ComposerInputPluginContext.js +71 -25
  154. package/dist/primitives/composer/ComposerInputPluginContext.js.map +1 -1
  155. package/dist/primitives/composer/ComposerQuote.js +92 -23
  156. package/dist/primitives/composer/ComposerQuote.js.map +1 -1
  157. package/dist/primitives/composer/ComposerRoot.js +45 -11
  158. package/dist/primitives/composer/ComposerRoot.js.map +1 -1
  159. package/dist/primitives/composer/ComposerSend.js +9 -2
  160. package/dist/primitives/composer/ComposerSend.js.map +1 -1
  161. package/dist/primitives/composer/ComposerStopDictation.js +15 -5
  162. package/dist/primitives/composer/ComposerStopDictation.js.map +1 -1
  163. package/dist/primitives/composer/trigger/TriggerPopover.d.ts.map +1 -1
  164. package/dist/primitives/composer/trigger/TriggerPopover.js +215 -75
  165. package/dist/primitives/composer/trigger/TriggerPopover.js.map +1 -1
  166. package/dist/primitives/composer/trigger/TriggerPopoverAction.js.map +1 -1
  167. package/dist/primitives/composer/trigger/TriggerPopoverBack.js +35 -7
  168. package/dist/primitives/composer/trigger/TriggerPopoverBack.js.map +1 -1
  169. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js +134 -28
  170. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js.map +1 -1
  171. package/dist/primitives/composer/trigger/TriggerPopoverDirective.js.map +1 -1
  172. package/dist/primitives/composer/trigger/TriggerPopoverItems.js +132 -28
  173. package/dist/primitives/composer/trigger/TriggerPopoverItems.js.map +1 -1
  174. package/dist/primitives/composer/trigger/TriggerPopoverResource.js +124 -52
  175. package/dist/primitives/composer/trigger/TriggerPopoverResource.js.map +1 -1
  176. package/dist/primitives/composer/trigger/TriggerPopoverRootContext.js +181 -78
  177. package/dist/primitives/composer/trigger/TriggerPopoverRootContext.js.map +1 -1
  178. package/dist/primitives/composer/trigger/detectTrigger.js.map +1 -1
  179. package/dist/primitives/composer/trigger/index.js.map +1 -1
  180. package/dist/primitives/composer/trigger/triggerDetectionResource.js +28 -14
  181. package/dist/primitives/composer/trigger/triggerDetectionResource.js.map +1 -1
  182. package/dist/primitives/composer/trigger/triggerKeyboardResource.js +115 -58
  183. package/dist/primitives/composer/trigger/triggerKeyboardResource.js.map +1 -1
  184. package/dist/primitives/composer/trigger/triggerNavigationResource.js +202 -70
  185. package/dist/primitives/composer/trigger/triggerNavigationResource.js.map +1 -1
  186. package/dist/primitives/composer/trigger/triggerSelectionResource.js +49 -13
  187. package/dist/primitives/composer/trigger/triggerSelectionResource.js.map +1 -1
  188. package/dist/primitives/composer.js.map +1 -1
  189. package/dist/primitives/dropdownMenuRenderPrimitives.js.map +1 -1
  190. package/dist/primitives/error/ErrorMessage.js +28 -6
  191. package/dist/primitives/error/ErrorMessage.js.map +1 -1
  192. package/dist/primitives/error/ErrorRoot.js +14 -5
  193. package/dist/primitives/error/ErrorRoot.js.map +1 -1
  194. package/dist/primitives/error.js.map +1 -1
  195. package/dist/primitives/message/MessageError.js +2 -1
  196. package/dist/primitives/message/MessageError.js.map +1 -1
  197. package/dist/primitives/message/MessageIf.js +50 -20
  198. package/dist/primitives/message/MessageIf.js.map +1 -1
  199. package/dist/primitives/message/MessageParts.js +41 -7
  200. package/dist/primitives/message/MessageParts.js.map +1 -1
  201. package/dist/primitives/message/MessagePartsGrouped.js +399 -94
  202. package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
  203. package/dist/primitives/message/MessageRoot.js +197 -65
  204. package/dist/primitives/message/MessageRoot.js.map +1 -1
  205. package/dist/primitives/message.js.map +1 -1
  206. package/dist/primitives/messagePart/MessagePartImage.js +15 -5
  207. package/dist/primitives/messagePart/MessagePartImage.js.map +1 -1
  208. package/dist/primitives/messagePart/MessagePartText.js +35 -7
  209. package/dist/primitives/messagePart/MessagePartText.js.map +1 -1
  210. package/dist/primitives/messagePart/useMessagePartData.js +5 -4
  211. package/dist/primitives/messagePart/useMessagePartData.js.map +1 -1
  212. package/dist/primitives/messagePart/useMessagePartFile.js +5 -4
  213. package/dist/primitives/messagePart/useMessagePartFile.js.map +1 -1
  214. package/dist/primitives/messagePart/useMessagePartImage.js +5 -4
  215. package/dist/primitives/messagePart/useMessagePartImage.js.map +1 -1
  216. package/dist/primitives/messagePart/useMessagePartReasoning.js +5 -4
  217. package/dist/primitives/messagePart/useMessagePartReasoning.js.map +1 -1
  218. package/dist/primitives/messagePart/useMessagePartSource.js +5 -4
  219. package/dist/primitives/messagePart/useMessagePartSource.js.map +1 -1
  220. package/dist/primitives/messagePart/useMessagePartText.js +5 -4
  221. package/dist/primitives/messagePart/useMessagePartText.js.map +1 -1
  222. package/dist/primitives/messagePart.js.map +1 -1
  223. package/dist/primitives/queueItem/QueueItemRemove.js +11 -4
  224. package/dist/primitives/queueItem/QueueItemRemove.js.map +1 -1
  225. package/dist/primitives/queueItem/QueueItemSteer.js +11 -4
  226. package/dist/primitives/queueItem/QueueItemSteer.js.map +1 -1
  227. package/dist/primitives/queueItem/QueueItemText.js +20 -6
  228. package/dist/primitives/queueItem/QueueItemText.js.map +1 -1
  229. package/dist/primitives/queueItem.js.map +1 -1
  230. package/dist/primitives/reasoning/useScrollLock.js +61 -43
  231. package/dist/primitives/reasoning/useScrollLock.js.map +1 -1
  232. package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js +56 -16
  233. package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js.map +1 -1
  234. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +120 -59
  235. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
  236. package/dist/primitives/selectionToolbar.js.map +1 -1
  237. package/dist/primitives/suggestion/SuggestionDescription.js +20 -6
  238. package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -1
  239. package/dist/primitives/suggestion/SuggestionTitle.js +20 -6
  240. package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -1
  241. package/dist/primitives/suggestion/SuggestionTrigger.js +39 -26
  242. package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -1
  243. package/dist/primitives/suggestion.js.map +1 -1
  244. package/dist/primitives/thread/ThreadEmpty.js +6 -2
  245. package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
  246. package/dist/primitives/thread/ThreadIf.js +32 -10
  247. package/dist/primitives/thread/ThreadIf.js.map +1 -1
  248. package/dist/primitives/thread/ThreadRoot.js +13 -4
  249. package/dist/primitives/thread/ThreadRoot.js.map +1 -1
  250. package/dist/primitives/thread/ThreadScrollToBottom.js +24 -6
  251. package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
  252. package/dist/primitives/thread/ThreadSuggestion.js +18 -6
  253. package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
  254. package/dist/primitives/thread/ThreadViewport.js +185 -47
  255. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  256. package/dist/primitives/thread/ThreadViewportFooter.js +22 -9
  257. package/dist/primitives/thread/ThreadViewportFooter.js.map +1 -1
  258. package/dist/primitives/thread/topAnchor/computeTopAnchorSlack.js.map +1 -1
  259. package/dist/primitives/thread/topAnchor/createReserveObservers.js.map +1 -1
  260. package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.js.map +1 -1
  261. package/dist/primitives/thread/topAnchor/topAnchorTurn.js.map +1 -1
  262. package/dist/primitives/thread/topAnchor/topAnchorUtils.js.map +1 -1
  263. package/dist/primitives/thread/topAnchor/useTopAnchorReserve.js +19 -4
  264. package/dist/primitives/thread/topAnchor/useTopAnchorReserve.js.map +1 -1
  265. package/dist/primitives/thread/useThreadViewportAutoScroll.js +16 -16
  266. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  267. package/dist/primitives/thread.js.map +1 -1
  268. package/dist/primitives/threadList/ThreadListLoadMore.js.map +1 -1
  269. package/dist/primitives/threadList/ThreadListNew.js +53 -11
  270. package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
  271. package/dist/primitives/threadList/ThreadListRoot.js +13 -4
  272. package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
  273. package/dist/primitives/threadList.js.map +1 -1
  274. package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
  275. package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
  276. package/dist/primitives/threadListItem/ThreadListItemRoot.js +26 -7
  277. package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
  278. package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
  279. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
  280. package/dist/primitives/threadListItem.js.map +1 -1
  281. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +44 -7
  282. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -1
  283. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +28 -6
  284. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js.map +1 -1
  285. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js +25 -5
  286. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -1
  287. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +28 -6
  288. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js.map +1 -1
  289. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +28 -6
  290. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js.map +1 -1
  291. package/dist/primitives/threadListItemMore/scope.js.map +1 -1
  292. package/dist/primitives/threadListItemMore.js.map +1 -1
  293. package/dist/sandbox-host/SandboxHost.js.map +1 -1
  294. package/dist/tests/remote-thread-list-test-helpers.js.map +1 -1
  295. package/dist/tests/setup.js.map +1 -1
  296. package/dist/unstable/useComposerInputHistory.js.map +1 -1
  297. package/dist/unstable/useMentionAdapter.js.map +1 -1
  298. package/dist/unstable/useMessageStallDetection.d.ts +29 -0
  299. package/dist/unstable/useMessageStallDetection.d.ts.map +1 -0
  300. package/dist/unstable/useMessageStallDetection.js +69 -0
  301. package/dist/unstable/useMessageStallDetection.js.map +1 -0
  302. package/dist/unstable/useSlashCommandAdapter.js.map +1 -1
  303. package/dist/utils/Primitive.js +57 -12
  304. package/dist/utils/Primitive.js.map +1 -1
  305. package/dist/utils/createActionButton.js +23 -7
  306. package/dist/utils/createActionButton.js.map +1 -1
  307. package/dist/utils/getSelectionMessageId.js.map +1 -1
  308. package/dist/utils/hooks/useManagedRef.js +16 -8
  309. package/dist/utils/hooks/useManagedRef.js.map +1 -1
  310. package/dist/utils/hooks/useMediaQuery.js +25 -10
  311. package/dist/utils/hooks/useMediaQuery.js.map +1 -1
  312. package/dist/utils/hooks/useOnResizeContent.js +29 -19
  313. package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
  314. package/dist/utils/hooks/useOnScrollToBottom.js +20 -4
  315. package/dist/utils/hooks/useOnScrollToBottom.js.map +1 -1
  316. package/dist/utils/hooks/useSizeHandle.js +23 -15
  317. package/dist/utils/hooks/useSizeHandle.js.map +1 -1
  318. package/dist/utils/json/is-json-equal.js.map +1 -1
  319. package/dist/utils/json/is-json.js.map +1 -1
  320. package/dist/utils/smooth/SmoothContext.js +41 -11
  321. package/dist/utils/smooth/SmoothContext.js.map +1 -1
  322. package/dist/utils/smooth/useSmooth.js +5 -5
  323. package/dist/utils/smooth/useSmooth.js.map +1 -1
  324. package/dist/utils/useToolArgsFieldStatus.js +13 -5
  325. package/dist/utils/useToolArgsFieldStatus.js.map +1 -1
  326. package/package.json +9 -9
  327. package/src/client/ExternalThread.ts +81 -52
  328. package/src/client/InMemoryThreadList.ts +12 -14
  329. package/src/hooks/useToolCallElapsed.ts +52 -0
  330. package/src/index.ts +11 -0
  331. package/src/legacy-runtime/runtime-cores/assistant-transport/replayBoundaryStream.test.ts +10 -6
  332. package/src/primitives/composer/trigger/TriggerPopover.tsx +4 -5
  333. package/src/tests/toolCallTiming.test.tsx +221 -0
  334. package/src/unstable/useMessageStallDetection.ts +91 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ensureBinding.js","names":[],"sources":["../../../../src/context/react/utils/ensureBinding.ts"],"sourcesContent":["type Bindable = {\n __internal_bindMethods?: () => void;\n __isBound?: boolean;\n};\nconst debugVerifyPrototype = (\n runtime: Record<string, unknown>,\n prototype: any,\n) => {\n const unboundMethods = Object.getOwnPropertyNames(prototype).filter(\n (methodStr) => {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, methodStr);\n const isMethod = descriptor && typeof descriptor.value === \"function\";\n if (!isMethod) return false;\n\n const methodName = methodStr as keyof typeof runtime | \"constructor\";\n return (\n isMethod &&\n !methodName.startsWith(\"_\") &&\n methodName !== \"constructor\" &&\n prototype[methodName] === runtime[methodName]\n );\n },\n );\n\n if (unboundMethods.length > 0) {\n throw new Error(\n `The following methods are not bound: ${JSON.stringify(unboundMethods)}`,\n );\n }\n\n const prototypePrototype = Object.getPrototypeOf(prototype);\n if (prototypePrototype && prototypePrototype !== Object.prototype) {\n debugVerifyPrototype(runtime, prototypePrototype);\n }\n};\nexport const ensureBinding = (r: unknown) => {\n const runtime = r as Bindable;\n if (runtime.__isBound) return;\n\n runtime.__internal_bindMethods?.();\n runtime.__isBound = true;\n\n if (process.env.NODE_ENV !== \"production\") {\n debugVerifyPrototype(runtime, Object.getPrototypeOf(runtime));\n }\n};\n"],"mappings":";AAIA,MAAM,wBACJ,SACA,cACG;CACH,MAAM,iBAAiB,OAAO,oBAAoB,SAAS,CAAC,CAAC,QAC1D,cAAc;EACb,MAAM,aAAa,OAAO,yBAAyB,WAAW,SAAS;EACvE,MAAM,WAAW,cAAc,OAAO,WAAW,UAAU;EAC3D,IAAI,CAAC,UAAU,OAAO;EAEtB,MAAM,aAAa;EACnB,OACE,YACA,CAAC,WAAW,WAAW,GAAG,KAC1B,eAAe,iBACf,UAAU,gBAAgB,QAAQ;CAEtC,CACF;CAEA,IAAI,eAAe,SAAS,GAC1B,MAAM,IAAI,MACR,wCAAwC,KAAK,UAAU,cAAc,GACvE;CAGF,MAAM,qBAAqB,OAAO,eAAe,SAAS;CAC1D,IAAI,sBAAsB,uBAAuB,OAAO,WACtD,qBAAqB,SAAS,kBAAkB;AAEpD;AACA,MAAa,iBAAiB,MAAe;CAC3C,MAAM,UAAU;CAChB,IAAI,QAAQ,WAAW;CAEvB,QAAQ,yBAAyB;CACjC,QAAQ,YAAY;CAEpB,IAAI,QAAQ,IAAI,aAAa,cAC3B,qBAAqB,SAAS,OAAO,eAAe,OAAO,CAAC;AAEhE"}
1
+ {"version":3,"file":"ensureBinding.js","names":["Bindable","__internal_bindMethods","__isBound","debugVerifyPrototype","runtime","Record","prototype","unboundMethods","Object","getOwnPropertyNames","filter","methodStr","descriptor","getOwnPropertyDescriptor","isMethod","value","methodName","startsWith","length","Error","JSON","stringify","prototypePrototype","getPrototypeOf","ensureBinding","r","process","env","NODE_ENV"],"sources":["../../../../src/context/react/utils/ensureBinding.ts"],"sourcesContent":["type Bindable = {\n __internal_bindMethods?: () => void;\n __isBound?: boolean;\n};\nconst debugVerifyPrototype = (\n runtime: Record<string, unknown>,\n prototype: any,\n) => {\n const unboundMethods = Object.getOwnPropertyNames(prototype).filter(\n (methodStr) => {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, methodStr);\n const isMethod = descriptor && typeof descriptor.value === \"function\";\n if (!isMethod) return false;\n\n const methodName = methodStr as keyof typeof runtime | \"constructor\";\n return (\n isMethod &&\n !methodName.startsWith(\"_\") &&\n methodName !== \"constructor\" &&\n prototype[methodName] === runtime[methodName]\n );\n },\n );\n\n if (unboundMethods.length > 0) {\n throw new Error(\n `The following methods are not bound: ${JSON.stringify(unboundMethods)}`,\n );\n }\n\n const prototypePrototype = Object.getPrototypeOf(prototype);\n if (prototypePrototype && prototypePrototype !== Object.prototype) {\n debugVerifyPrototype(runtime, prototypePrototype);\n }\n};\nexport const ensureBinding = (r: unknown) => {\n const runtime = r as Bindable;\n if (runtime.__isBound) return;\n\n runtime.__internal_bindMethods?.();\n runtime.__isBound = true;\n\n if (process.env.NODE_ENV !== \"production\") {\n debugVerifyPrototype(runtime, Object.getPrototypeOf(runtime));\n }\n};\n"],"mappings":";AAIA,MAAMG,wBACJC,SACAE,cACG;CACH,MAAMC,iBAAiBC,OAAOC,oBAAoBH,SAAS,CAAC,CAACI,QAC1DC,cAAc;EACb,MAAMC,aAAaJ,OAAOK,yBAAyBP,WAAWK,SAAS;EACvE,MAAMG,WAAWF,cAAc,OAAOA,WAAWG,UAAU;EAC3D,IAAI,CAACD,UAAU,OAAO;EAEtB,MAAME,aAAaL;EACnB,OACEG,YACA,CAACE,WAAWC,WAAW,GAAG,KAC1BD,eAAe,iBACfV,UAAUU,gBAAgBZ,QAAQY;CAEtC,CACF;CAEA,IAAIT,eAAeW,SAAS,GAC1B,MAAM,IAAIC,MACR,wCAAwCC,KAAKC,UAAUd,cAAc,GACvE;CAGF,MAAMe,qBAAqBd,OAAOe,eAAejB,SAAS;CAC1D,IAAIgB,sBAAsBA,uBAAuBd,OAAOF,WACtDH,qBAAqBC,SAASkB,kBAAkB;AAEpD;AACA,MAAaE,iBAAiBC,MAAe;CAC3C,MAAMrB,UAAUqB;CAChB,IAAIrB,QAAQF,WAAW;CAEvBE,QAAQH,yBAAyB;CACjCG,QAAQF,YAAY;CAEpB,IAAIwB,QAAQC,IAAIC,aAAa,cAC3BzB,qBAAqBC,SAASI,OAAOe,eAAenB,OAAO,CAAC;AAEhE"}
@@ -1,9 +1,25 @@
1
1
  import { ensureBinding } from "./ensureBinding.js";
2
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
2
3
  import { useDebugValue, useSyncExternalStore } from "@assistant-ui/tap/react-shim";
3
4
  //#region src/context/react/utils/useRuntimeState.ts
4
- function useRuntimeStateInternal(runtime, selector = identity) {
5
+ function useRuntimeStateInternal(runtime, t0) {
6
+ const $ = c(4);
7
+ const selector = t0 === void 0 ? identity : t0;
5
8
  ensureBinding(runtime);
6
- const slice = useSyncExternalStore(runtime.subscribe, () => selector(runtime.getState()), () => selector(runtime.getState()));
9
+ let t1;
10
+ let t2;
11
+ if ($[0] !== runtime || $[1] !== selector) {
12
+ t1 = () => selector(runtime.getState());
13
+ t2 = () => selector(runtime.getState());
14
+ $[0] = runtime;
15
+ $[1] = selector;
16
+ $[2] = t1;
17
+ $[3] = t2;
18
+ } else {
19
+ t1 = $[2];
20
+ t2 = $[3];
21
+ }
22
+ const slice = useSyncExternalStore(runtime.subscribe, t1, t2);
7
23
  useDebugValue(slice);
8
24
  return slice;
9
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useRuntimeState.js","names":[],"sources":["../../../../src/context/react/utils/useRuntimeState.ts"],"sourcesContent":["import type { Unsubscribe } from \"@assistant-ui/core\";\nimport { useDebugValue, useSyncExternalStore } from \"react\";\nimport { ensureBinding } from \"./ensureBinding\";\n\nexport type SubscribableRuntime<TState> = {\n getState: () => TState;\n subscribe: (callback: () => void) => Unsubscribe;\n};\n\nexport function useRuntimeStateInternal<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected | TState) | undefined = identity,\n): TSelected | TState {\n // TODO move to useRuntimeState\n ensureBinding(runtime);\n\n const slice = useSyncExternalStore(\n runtime.subscribe,\n () => selector(runtime.getState()),\n () => selector(runtime.getState()),\n );\n useDebugValue(slice);\n return slice;\n}\n\nconst identity = <T>(arg: T): T => arg;\nexport function useRuntimeState<TState>(\n runtime: SubscribableRuntime<TState>,\n): TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: (state: TState) => TSelected,\n): TSelected;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected) | undefined,\n): TSelected | TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector?: ((state: TState) => TSelected) | undefined,\n): TSelected | TState {\n // ensure that the runtime is bound\n // ensureBinding(runtime);\n\n return useRuntimeStateInternal(runtime, selector);\n}\n"],"mappings":";;;AASA,SAAgB,wBACd,SACA,WAAgE,UAC5C;CAEpB,cAAc,OAAO;CAErB,MAAM,QAAQ,qBACZ,QAAQ,iBACF,SAAS,QAAQ,SAAS,CAAC,SAC3B,SAAS,QAAQ,SAAS,CAAC,CACnC;CACA,cAAc,KAAK;CACnB,OAAO;AACT;AAEA,MAAM,YAAe,QAAc;AAYnC,SAAgB,gBACd,SACA,UACoB;CAIpB,OAAO,wBAAwB,SAAS,QAAQ;AAClD"}
1
+ {"version":3,"file":"useRuntimeState.js","names":["Unsubscribe","useDebugValue","useSyncExternalStore","ensureBinding","SubscribableRuntime","getState","TState","subscribe","callback","useRuntimeStateInternal","runtime","t0","$","_c","selector","undefined","identity","t1","t2","slice","arg","T","useRuntimeState","state","TSelected"],"sources":["../../../../src/context/react/utils/useRuntimeState.ts"],"sourcesContent":["import type { Unsubscribe } from \"@assistant-ui/core\";\nimport { useDebugValue, useSyncExternalStore } from \"react\";\nimport { ensureBinding } from \"./ensureBinding\";\n\nexport type SubscribableRuntime<TState> = {\n getState: () => TState;\n subscribe: (callback: () => void) => Unsubscribe;\n};\n\nexport function useRuntimeStateInternal<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected | TState) | undefined = identity,\n): TSelected | TState {\n // TODO move to useRuntimeState\n ensureBinding(runtime);\n\n const slice = useSyncExternalStore(\n runtime.subscribe,\n () => selector(runtime.getState()),\n () => selector(runtime.getState()),\n );\n useDebugValue(slice);\n return slice;\n}\n\nconst identity = <T>(arg: T): T => arg;\nexport function useRuntimeState<TState>(\n runtime: SubscribableRuntime<TState>,\n): TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: (state: TState) => TSelected,\n): TSelected;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected) | undefined,\n): TSelected | TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector?: ((state: TState) => TSelected) | undefined,\n): TSelected | TState {\n // ensure that the runtime is bound\n // ensureBinding(runtime);\n\n return useRuntimeStateInternal(runtime, selector);\n}\n"],"mappings":";;;;AASA,SAAOS,wBAAAC,SAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAEL,MAAAC,WAAAH,OAAAI,KAAAA,IAAAC,WAAAL;CAGAR,cAAcO,OAAO;CAAC,IAAAO;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAF,WAAAE,EAAA,OAAAE,UAAA;EAIpBG,WAAMH,SAASJ,QAAOL,SAAU,CAAC;EACjCa,WAAMJ,SAASJ,QAAOL,SAAU,CAAC;EAACO,EAAA,KAAAF;EAAAE,EAAA,KAAAE;EAAAF,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAA;EAAAD,KAAAL,EAAA;EAAAM,KAAAN,EAAA;CAAA;CAHpC,MAAAO,QAAcjB,qBACZQ,QAAOH,WACPU,IACAC,EACF;CACAjB,cAAckB,KAAK;CAAC,OACbA;AAAK;AAGd,MAAMH,YAAeI,QAAcA;AAYnC,SAAOE,gBAAAZ,SAAAI,UAAA;CAAA,OAOEL,wBAAwBC,SAASI,QAAQ;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadViewport.js","names":[],"sources":["../../../src/context/stores/ThreadViewport.ts"],"sourcesContent":["\"use client\";\n\nimport { create } from \"zustand\";\nimport type { Unsubscribe } from \"@assistant-ui/core\";\n\nexport type SizeHandle = {\n /** Update the height */\n setHeight: (height: number) => void;\n /** Unregister this handle */\n unregister: Unsubscribe;\n};\n\ntype SizeRegistry = {\n register: () => SizeHandle;\n};\n\nconst createSizeRegistry = (\n onChange: (total: number) => void,\n): SizeRegistry => {\n const entries = new Map<symbol, number>();\n\n const recalculate = () => {\n let total = 0;\n for (const height of entries.values()) {\n total += height;\n }\n onChange(total);\n };\n\n return {\n register: () => {\n const id = Symbol();\n entries.set(id, 0);\n\n return {\n setHeight: (height: number) => {\n if (entries.get(id) !== height) {\n entries.set(id, height);\n recalculate();\n }\n },\n unregister: () => {\n entries.delete(id);\n recalculate();\n },\n };\n },\n };\n};\n\nexport type ThreadViewportState = {\n readonly isAtBottom: boolean;\n readonly scrollToBottom: (config?: {\n behavior?: ScrollBehavior | undefined;\n }) => void;\n readonly onScrollToBottom: (\n callback: ({ behavior }: { behavior: ScrollBehavior }) => void,\n ) => Unsubscribe;\n\n /** Controls scroll anchoring: \"top\" anchors user messages at top, \"bottom\" is classic behavior */\n readonly turnAnchor: \"top\" | \"bottom\";\n\n /** Clamps tall user messages so the assistant response stays in view. */\n readonly topAnchorMessageClamp: {\n readonly tallerThan: string;\n readonly visibleHeight: string;\n };\n\n /** Raw height values from registered elements */\n readonly height: {\n /** Total viewport height */\n readonly viewport: number;\n /** Total content inset height (footer, anchor message, etc.) */\n readonly inset: number;\n };\n\n /** Current DOM elements used for geometry-based top anchoring */\n readonly element: {\n readonly viewport: HTMLElement | null;\n readonly anchor: HTMLElement | null;\n readonly target: HTMLElement | null;\n };\n\n /** Numeric clamp configuration for the active top-anchor target message */\n readonly targetConfig: {\n readonly tallerThan: number;\n readonly visibleHeight: number;\n } | null;\n\n /**\n * The current top-anchor turn activated in this viewport session.\n * History-loaded messages do not populate this; it is set when a run creates\n * a live user/assistant pair and remains after the run completes.\n */\n readonly topAnchorTurn: {\n readonly anchorId: string;\n readonly targetId: string;\n } | null;\n\n /** Register a viewport and get a handle to update its height */\n readonly registerViewport: () => SizeHandle;\n\n /** Register a content inset (footer, anchor message, etc.) and get a handle to update its height */\n readonly registerContentInset: () => SizeHandle;\n\n /** Register the scroll viewport element */\n readonly registerViewportElement: (\n element: HTMLElement | null,\n ) => Unsubscribe;\n\n /** Register the current anchor user message element */\n readonly registerAnchorElement: (element: HTMLElement | null) => Unsubscribe;\n\n /**\n * Register the current top-anchor target (last assistant response) element\n * along with its numeric clamp configuration. When unregistered, both\n * `element.target` and `targetConfig` clear together.\n */\n readonly registerAnchorTargetElement: (\n element: HTMLElement | null,\n config?: { readonly tallerThan: number; readonly visibleHeight: number },\n ) => Unsubscribe;\n\n readonly setTopAnchorTurn: (\n turn: { readonly anchorId: string; readonly targetId: string } | null,\n ) => void;\n};\n\nexport type ThreadViewportStoreOptions = {\n turnAnchor?: \"top\" | \"bottom\" | undefined;\n topAnchorMessageClamp?:\n | {\n tallerThan?: string | undefined;\n visibleHeight?: string | undefined;\n }\n | undefined;\n};\n\nexport const makeThreadViewportStore = (\n options: ThreadViewportStoreOptions = {},\n) => {\n const scrollToBottomListeners = new Set<\n (config: { behavior: ScrollBehavior }) => void\n >();\n\n const viewportRegistry = createSizeRegistry((total) => {\n store.setState({\n height: {\n ...store.getState().height,\n viewport: total,\n },\n });\n });\n const insetRegistry = createSizeRegistry((total) => {\n store.setState({\n height: {\n ...store.getState().height,\n inset: total,\n },\n });\n });\n const registerElementSlot = (\n key: \"viewport\" | \"anchor\",\n element: HTMLElement | null,\n ) => {\n store.setState({\n element: {\n ...store.getState().element,\n [key]: element,\n },\n });\n\n return () => {\n if (store.getState().element[key] !== element) return;\n store.setState({\n element: {\n ...store.getState().element,\n [key]: null,\n },\n });\n };\n };\n\n const store = create<ThreadViewportState>(() => ({\n isAtBottom: true,\n scrollToBottom: ({ behavior = \"auto\" } = {}) => {\n for (const listener of scrollToBottomListeners) {\n listener({ behavior });\n }\n },\n onScrollToBottom: (callback) => {\n scrollToBottomListeners.add(callback);\n return () => {\n scrollToBottomListeners.delete(callback);\n };\n },\n\n turnAnchor: options.turnAnchor ?? \"bottom\",\n topAnchorMessageClamp: {\n tallerThan: options.topAnchorMessageClamp?.tallerThan ?? \"10em\",\n visibleHeight: options.topAnchorMessageClamp?.visibleHeight ?? \"6em\",\n },\n\n height: {\n viewport: 0,\n inset: 0,\n },\n element: {\n viewport: null,\n anchor: null,\n target: null,\n },\n targetConfig: null,\n topAnchorTurn: null,\n\n registerViewport: viewportRegistry.register,\n registerContentInset: insetRegistry.register,\n registerViewportElement: (element) =>\n registerElementSlot(\"viewport\", element),\n registerAnchorElement: (element) => registerElementSlot(\"anchor\", element),\n registerAnchorTargetElement: (element, config) => {\n store.setState({\n element: {\n ...store.getState().element,\n target: element,\n },\n targetConfig: element && config ? config : null,\n });\n\n return () => {\n if (store.getState().element.target !== element) return;\n store.setState({\n element: {\n ...store.getState().element,\n target: null,\n },\n targetConfig: null,\n });\n };\n },\n setTopAnchorTurn: (topAnchorTurn) => {\n store.setState({ topAnchorTurn });\n },\n }));\n\n return store;\n};\n"],"mappings":";;;AAgBA,MAAM,sBACJ,aACiB;CACjB,MAAM,0BAAU,IAAI,IAAoB;CAExC,MAAM,oBAAoB;EACxB,IAAI,QAAQ;EACZ,KAAK,MAAM,UAAU,QAAQ,OAAO,GAClC,SAAS;EAEX,SAAS,KAAK;CAChB;CAEA,OAAO,EACL,gBAAgB;EACd,MAAM,KAAK,OAAO;EAClB,QAAQ,IAAI,IAAI,CAAC;EAEjB,OAAO;GACL,YAAY,WAAmB;IAC7B,IAAI,QAAQ,IAAI,EAAE,MAAM,QAAQ;KAC9B,QAAQ,IAAI,IAAI,MAAM;KACtB,YAAY;IACd;GACF;GACA,kBAAkB;IAChB,QAAQ,OAAO,EAAE;IACjB,YAAY;GACd;EACF;CACF,EACF;AACF;AA0FA,MAAa,2BACX,UAAsC,CAAC,MACpC;CACH,MAAM,0CAA0B,IAAI,IAElC;CAEF,MAAM,mBAAmB,oBAAoB,UAAU;EACrD,MAAM,SAAS,EACb,QAAQ;GACN,GAAG,MAAM,SAAS,CAAC,CAAC;GACpB,UAAU;EACZ,EACF,CAAC;CACH,CAAC;CACD,MAAM,gBAAgB,oBAAoB,UAAU;EAClD,MAAM,SAAS,EACb,QAAQ;GACN,GAAG,MAAM,SAAS,CAAC,CAAC;GACpB,OAAO;EACT,EACF,CAAC;CACH,CAAC;CACD,MAAM,uBACJ,KACA,YACG;EACH,MAAM,SAAS,EACb,SAAS;GACP,GAAG,MAAM,SAAS,CAAC,CAAC;IACnB,MAAM;EACT,EACF,CAAC;EAED,aAAa;GACX,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,SAAS,SAAS;GAC/C,MAAM,SAAS,EACb,SAAS;IACP,GAAG,MAAM,SAAS,CAAC,CAAC;KACnB,MAAM;GACT,EACF,CAAC;EACH;CACF;CAEA,MAAM,QAAQ,cAAmC;EAC/C,YAAY;EACZ,iBAAiB,EAAE,WAAW,WAAW,CAAC,MAAM;GAC9C,KAAK,MAAM,YAAY,yBACrB,SAAS,EAAE,SAAS,CAAC;EAEzB;EACA,mBAAmB,aAAa;GAC9B,wBAAwB,IAAI,QAAQ;GACpC,aAAa;IACX,wBAAwB,OAAO,QAAQ;GACzC;EACF;EAEA,YAAY,QAAQ,cAAc;EAClC,uBAAuB;GACrB,YAAY,QAAQ,uBAAuB,cAAc;GACzD,eAAe,QAAQ,uBAAuB,iBAAiB;EACjE;EAEA,QAAQ;GACN,UAAU;GACV,OAAO;EACT;EACA,SAAS;GACP,UAAU;GACV,QAAQ;GACR,QAAQ;EACV;EACA,cAAc;EACd,eAAe;EAEf,kBAAkB,iBAAiB;EACnC,sBAAsB,cAAc;EACpC,0BAA0B,YACxB,oBAAoB,YAAY,OAAO;EACzC,wBAAwB,YAAY,oBAAoB,UAAU,OAAO;EACzE,8BAA8B,SAAS,WAAW;GAChD,MAAM,SAAS;IACb,SAAS;KACP,GAAG,MAAM,SAAS,CAAC,CAAC;KACpB,QAAQ;IACV;IACA,cAAc,WAAW,SAAS,SAAS;GAC7C,CAAC;GAED,aAAa;IACX,IAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,WAAW,SAAS;IACjD,MAAM,SAAS;KACb,SAAS;MACP,GAAG,MAAM,SAAS,CAAC,CAAC;MACpB,QAAQ;KACV;KACA,cAAc;IAChB,CAAC;GACH;EACF;EACA,mBAAmB,kBAAkB;GACnC,MAAM,SAAS,EAAE,cAAc,CAAC;EAClC;CACF,EAAE;CAEF,OAAO;AACT"}
1
+ {"version":3,"file":"ThreadViewport.js","names":["create","Unsubscribe","SizeHandle","setHeight","height","unregister","SizeRegistry","register","createSizeRegistry","onChange","total","entries","Map","recalculate","values","id","Symbol","set","get","delete","ThreadViewportState","isAtBottom","scrollToBottom","config","behavior","ScrollBehavior","onScrollToBottom","callback","turnAnchor","topAnchorMessageClamp","tallerThan","visibleHeight","viewport","inset","element","HTMLElement","anchor","target","targetConfig","topAnchorTurn","anchorId","targetId","registerViewport","registerContentInset","registerViewportElement","registerAnchorElement","registerAnchorTargetElement","setTopAnchorTurn","turn","ThreadViewportStoreOptions","makeThreadViewportStore","options","scrollToBottomListeners","Set","viewportRegistry","store","setState","getState","insetRegistry","registerElementSlot","key","listener","add"],"sources":["../../../src/context/stores/ThreadViewport.ts"],"sourcesContent":["\"use client\";\n\nimport { create } from \"zustand\";\nimport type { Unsubscribe } from \"@assistant-ui/core\";\n\nexport type SizeHandle = {\n /** Update the height */\n setHeight: (height: number) => void;\n /** Unregister this handle */\n unregister: Unsubscribe;\n};\n\ntype SizeRegistry = {\n register: () => SizeHandle;\n};\n\nconst createSizeRegistry = (\n onChange: (total: number) => void,\n): SizeRegistry => {\n const entries = new Map<symbol, number>();\n\n const recalculate = () => {\n let total = 0;\n for (const height of entries.values()) {\n total += height;\n }\n onChange(total);\n };\n\n return {\n register: () => {\n const id = Symbol();\n entries.set(id, 0);\n\n return {\n setHeight: (height: number) => {\n if (entries.get(id) !== height) {\n entries.set(id, height);\n recalculate();\n }\n },\n unregister: () => {\n entries.delete(id);\n recalculate();\n },\n };\n },\n };\n};\n\nexport type ThreadViewportState = {\n readonly isAtBottom: boolean;\n readonly scrollToBottom: (config?: {\n behavior?: ScrollBehavior | undefined;\n }) => void;\n readonly onScrollToBottom: (\n callback: ({ behavior }: { behavior: ScrollBehavior }) => void,\n ) => Unsubscribe;\n\n /** Controls scroll anchoring: \"top\" anchors user messages at top, \"bottom\" is classic behavior */\n readonly turnAnchor: \"top\" | \"bottom\";\n\n /** Clamps tall user messages so the assistant response stays in view. */\n readonly topAnchorMessageClamp: {\n readonly tallerThan: string;\n readonly visibleHeight: string;\n };\n\n /** Raw height values from registered elements */\n readonly height: {\n /** Total viewport height */\n readonly viewport: number;\n /** Total content inset height (footer, anchor message, etc.) */\n readonly inset: number;\n };\n\n /** Current DOM elements used for geometry-based top anchoring */\n readonly element: {\n readonly viewport: HTMLElement | null;\n readonly anchor: HTMLElement | null;\n readonly target: HTMLElement | null;\n };\n\n /** Numeric clamp configuration for the active top-anchor target message */\n readonly targetConfig: {\n readonly tallerThan: number;\n readonly visibleHeight: number;\n } | null;\n\n /**\n * The current top-anchor turn activated in this viewport session.\n * History-loaded messages do not populate this; it is set when a run creates\n * a live user/assistant pair and remains after the run completes.\n */\n readonly topAnchorTurn: {\n readonly anchorId: string;\n readonly targetId: string;\n } | null;\n\n /** Register a viewport and get a handle to update its height */\n readonly registerViewport: () => SizeHandle;\n\n /** Register a content inset (footer, anchor message, etc.) and get a handle to update its height */\n readonly registerContentInset: () => SizeHandle;\n\n /** Register the scroll viewport element */\n readonly registerViewportElement: (\n element: HTMLElement | null,\n ) => Unsubscribe;\n\n /** Register the current anchor user message element */\n readonly registerAnchorElement: (element: HTMLElement | null) => Unsubscribe;\n\n /**\n * Register the current top-anchor target (last assistant response) element\n * along with its numeric clamp configuration. When unregistered, both\n * `element.target` and `targetConfig` clear together.\n */\n readonly registerAnchorTargetElement: (\n element: HTMLElement | null,\n config?: { readonly tallerThan: number; readonly visibleHeight: number },\n ) => Unsubscribe;\n\n readonly setTopAnchorTurn: (\n turn: { readonly anchorId: string; readonly targetId: string } | null,\n ) => void;\n};\n\nexport type ThreadViewportStoreOptions = {\n turnAnchor?: \"top\" | \"bottom\" | undefined;\n topAnchorMessageClamp?:\n | {\n tallerThan?: string | undefined;\n visibleHeight?: string | undefined;\n }\n | undefined;\n};\n\nexport const makeThreadViewportStore = (\n options: ThreadViewportStoreOptions = {},\n) => {\n const scrollToBottomListeners = new Set<\n (config: { behavior: ScrollBehavior }) => void\n >();\n\n const viewportRegistry = createSizeRegistry((total) => {\n store.setState({\n height: {\n ...store.getState().height,\n viewport: total,\n },\n });\n });\n const insetRegistry = createSizeRegistry((total) => {\n store.setState({\n height: {\n ...store.getState().height,\n inset: total,\n },\n });\n });\n const registerElementSlot = (\n key: \"viewport\" | \"anchor\",\n element: HTMLElement | null,\n ) => {\n store.setState({\n element: {\n ...store.getState().element,\n [key]: element,\n },\n });\n\n return () => {\n if (store.getState().element[key] !== element) return;\n store.setState({\n element: {\n ...store.getState().element,\n [key]: null,\n },\n });\n };\n };\n\n const store = create<ThreadViewportState>(() => ({\n isAtBottom: true,\n scrollToBottom: ({ behavior = \"auto\" } = {}) => {\n for (const listener of scrollToBottomListeners) {\n listener({ behavior });\n }\n },\n onScrollToBottom: (callback) => {\n scrollToBottomListeners.add(callback);\n return () => {\n scrollToBottomListeners.delete(callback);\n };\n },\n\n turnAnchor: options.turnAnchor ?? \"bottom\",\n topAnchorMessageClamp: {\n tallerThan: options.topAnchorMessageClamp?.tallerThan ?? \"10em\",\n visibleHeight: options.topAnchorMessageClamp?.visibleHeight ?? \"6em\",\n },\n\n height: {\n viewport: 0,\n inset: 0,\n },\n element: {\n viewport: null,\n anchor: null,\n target: null,\n },\n targetConfig: null,\n topAnchorTurn: null,\n\n registerViewport: viewportRegistry.register,\n registerContentInset: insetRegistry.register,\n registerViewportElement: (element) =>\n registerElementSlot(\"viewport\", element),\n registerAnchorElement: (element) => registerElementSlot(\"anchor\", element),\n registerAnchorTargetElement: (element, config) => {\n store.setState({\n element: {\n ...store.getState().element,\n target: element,\n },\n targetConfig: element && config ? config : null,\n });\n\n return () => {\n if (store.getState().element.target !== element) return;\n store.setState({\n element: {\n ...store.getState().element,\n target: null,\n },\n targetConfig: null,\n });\n };\n },\n setTopAnchorTurn: (topAnchorTurn) => {\n store.setState({ topAnchorTurn });\n },\n }));\n\n return store;\n};\n"],"mappings":";;;AAgBA,MAAMQ,sBACJC,aACiB;CACjB,MAAME,0BAAU,IAAIC,IAAoB;CAExC,MAAMC,oBAAoB;EACxB,IAAIH,QAAQ;EACZ,KAAK,MAAMN,UAAUO,QAAQG,OAAO,GAClCJ,SAASN;EAEXK,SAASC,KAAK;CAChB;CAEA,OAAO,EACLH,gBAAgB;EACd,MAAMQ,KAAKC,OAAO;EAClBL,QAAQM,IAAIF,IAAI,CAAC;EAEjB,OAAO;GACLZ,YAAYC,WAAmB;IAC7B,IAAIO,QAAQO,IAAIH,EAAE,MAAMX,QAAQ;KAC9BO,QAAQM,IAAIF,IAAIX,MAAM;KACtBS,YAAY;IACd;GACF;GACAR,kBAAkB;IAChBM,QAAQQ,OAAOJ,EAAE;IACjBF,YAAY;GACd;EACF;CACF,EACF;AACF;AA0FA,MAAaqC,2BACXC,UAAsC,CAAC,MACpC;CACH,MAAMC,0CAA0B,IAAIC,IAElC;CAEF,MAAMC,mBAAmB9C,oBAAoBE,UAAU;EACrD6C,MAAMC,SAAS,EACbpD,QAAQ;GACN,GAAGmD,MAAME,SAAS,CAAC,CAACrD;GACpB4B,UAAUtB;EACZ,EACF,CAAC;CACH,CAAC;CACD,MAAMgD,gBAAgBlD,oBAAoBE,UAAU;EAClD6C,MAAMC,SAAS,EACbpD,QAAQ;GACN,GAAGmD,MAAME,SAAS,CAAC,CAACrD;GACpB6B,OAAOvB;EACT,EACF,CAAC;CACH,CAAC;CACD,MAAMiD,uBACJC,KACA1B,YACG;EACHqB,MAAMC,SAAS,EACbtB,SAAS;GACP,GAAGqB,MAAME,SAAS,CAAC,CAACvB;IACnB0B,MAAM1B;EACT,EACF,CAAC;EAED,aAAa;GACX,IAAIqB,MAAME,SAAS,CAAC,CAACvB,QAAQ0B,SAAS1B,SAAS;GAC/CqB,MAAMC,SAAS,EACbtB,SAAS;IACP,GAAGqB,MAAME,SAAS,CAAC,CAACvB;KACnB0B,MAAM;GACT,EACF,CAAC;EACH;CACF;CAEA,MAAML,QAAQvD,cAAmC;EAC/CqB,YAAY;EACZC,iBAAiB,EAAEE,WAAW,WAAW,CAAC,MAAM;GAC9C,KAAK,MAAMqC,YAAYT,yBACrBS,SAAS,EAAErC,SAAS,CAAC;EAEzB;EACAE,mBAAmBC,aAAa;GAC9ByB,wBAAwBU,IAAInC,QAAQ;GACpC,aAAa;IACXyB,wBAAwBjC,OAAOQ,QAAQ;GACzC;EACF;EAEAC,YAAYuB,QAAQvB,cAAc;EAClCC,uBAAuB;GACrBC,YAAYqB,QAAQtB,uBAAuBC,cAAc;GACzDC,eAAeoB,QAAQtB,uBAAuBE,iBAAiB;EACjE;EAEA3B,QAAQ;GACN4B,UAAU;GACVC,OAAO;EACT;EACAC,SAAS;GACPF,UAAU;GACVI,QAAQ;GACRC,QAAQ;EACV;EACAC,cAAc;EACdC,eAAe;EAEfG,kBAAkBY,iBAAiB/C;EACnCoC,sBAAsBe,cAAcnD;EACpCqC,0BAA0BV,YACxByB,oBAAoB,YAAYzB,OAAO;EACzCW,wBAAwBX,YAAYyB,oBAAoB,UAAUzB,OAAO;EACzEY,8BAA8BZ,SAASX,WAAW;GAChDgC,MAAMC,SAAS;IACbtB,SAAS;KACP,GAAGqB,MAAME,SAAS,CAAC,CAACvB;KACpBG,QAAQH;IACV;IACAI,cAAcJ,WAAWX,SAASA,SAAS;GAC7C,CAAC;GAED,aAAa;IACX,IAAIgC,MAAME,SAAS,CAAC,CAACvB,QAAQG,WAAWH,SAAS;IACjDqB,MAAMC,SAAS;KACbtB,SAAS;MACP,GAAGqB,MAAME,SAAS,CAAC,CAACvB;MACpBG,QAAQ;KACV;KACAC,cAAc;IAChB,CAAC;GACH;EACF;EACAS,mBAAmBR,kBAAkB;GACnCgB,MAAMC,SAAS,EAAEjB,cAAc,CAAC;EAClC;CACF,EAAE;CAEF,OAAOgB;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"DevToolsHooks.js","names":[],"sources":["../../src/devtools/DevToolsHooks.ts"],"sourcesContent":["import type { Unsubscribe } from \"@assistant-ui/core\";\nimport type { AssistantClient } from \"@assistant-ui/store\";\n\nexport interface EventLog {\n time: Date;\n event: string;\n data: unknown;\n}\n\ninterface DevToolsApiEntry {\n api: Partial<AssistantClient>;\n logs: EventLog[];\n}\n\ninterface DevToolsHook {\n apis: Map<number, DevToolsApiEntry>;\n nextId: number;\n listeners: Set<(apiId: number) => void>;\n}\n\ndeclare global {\n interface Window {\n __ASSISTANT_UI_DEVTOOLS_HOOK__?: DevToolsHook;\n }\n}\n\nlet cachedHook: DevToolsHook | undefined;\n\nconst getHook = (): DevToolsHook => {\n if (cachedHook) {\n return cachedHook;\n }\n\n const createHook = (): DevToolsHook => ({\n apis: new Map(),\n nextId: 0,\n listeners: new Set(),\n });\n\n if (typeof window === \"undefined\") {\n cachedHook = createHook();\n return cachedHook;\n }\n\n const existingHook = window.__ASSISTANT_UI_DEVTOOLS_HOOK__;\n if (existingHook) {\n cachedHook = existingHook;\n return existingHook;\n }\n\n const newHook = createHook();\n window.__ASSISTANT_UI_DEVTOOLS_HOOK__ = newHook;\n cachedHook = newHook;\n return newHook;\n};\n\nexport class DevToolsHooks {\n static subscribe(listener: () => void): Unsubscribe {\n const hook = getHook();\n hook.listeners.add(listener);\n return () => {\n hook.listeners.delete(listener);\n };\n }\n\n static clearEventLogs(apiId: number): void {\n const hook = getHook();\n const entry = hook.apis.get(apiId);\n if (!entry) return;\n\n entry.logs = [];\n DevToolsHooks.notifyListeners(apiId);\n }\n\n static getApis(): Map<number, DevToolsApiEntry> {\n return getHook().apis;\n }\n\n private static notifyListeners(apiId: number): void {\n const hook = getHook();\n hook.listeners.forEach((listener) => listener(apiId));\n }\n}\n\nexport class DevToolsProviderApi {\n private static readonly MAX_EVENT_LOGS_PER_API = 200;\n\n static register(aui: Partial<AssistantClient>): Unsubscribe {\n const hook = getHook();\n\n for (const entry of hook.apis.values()) {\n if (entry.api === aui) {\n return () => {};\n }\n }\n\n const apiId = hook.nextId++;\n const entry: DevToolsApiEntry = {\n api: aui,\n logs: [],\n };\n\n const eventUnsubscribe = aui.on?.(\"*\", (e) => {\n const entry = hook.apis.get(apiId);\n if (!entry) return;\n\n entry.logs.push({\n time: new Date(),\n event: e.event,\n data: e.payload,\n });\n\n if (entry.logs.length > DevToolsProviderApi.MAX_EVENT_LOGS_PER_API) {\n entry.logs = entry.logs.slice(\n -DevToolsProviderApi.MAX_EVENT_LOGS_PER_API,\n );\n }\n\n DevToolsProviderApi.notifyListeners(apiId);\n });\n\n const stateUnsubscribe = aui.subscribe?.(() => {\n DevToolsProviderApi.notifyListeners(apiId);\n });\n\n hook.apis.set(apiId, entry);\n DevToolsProviderApi.notifyListeners(apiId);\n\n return () => {\n const hook = getHook();\n const entry = hook.apis.get(apiId);\n if (!entry) return;\n\n eventUnsubscribe?.();\n stateUnsubscribe?.();\n\n hook.apis.delete(apiId);\n\n DevToolsProviderApi.notifyListeners(apiId);\n };\n }\n\n private static notifyListeners(apiId: number): void {\n const hook = getHook();\n hook.listeners.forEach((listener) => listener(apiId));\n }\n}\n"],"mappings":";AA0BA,IAAI;AAEJ,MAAM,gBAA8B;CAClC,IAAI,YACF,OAAO;CAGT,MAAM,oBAAkC;EACtC,sBAAM,IAAI,IAAI;EACd,QAAQ;EACR,2BAAW,IAAI,IAAI;CACrB;CAEA,IAAI,OAAO,WAAW,aAAa;EACjC,aAAa,WAAW;EACxB,OAAO;CACT;CAEA,MAAM,eAAe,OAAO;CAC5B,IAAI,cAAc;EAChB,aAAa;EACb,OAAO;CACT;CAEA,MAAM,UAAU,WAAW;CAC3B,OAAO,iCAAiC;CACxC,aAAa;CACb,OAAO;AACT;AAEA,IAAa,gBAAb,MAAa,cAAc;CACzB,OAAO,UAAU,UAAmC;EAClD,MAAM,OAAO,QAAQ;EACrB,KAAK,UAAU,IAAI,QAAQ;EAC3B,aAAa;GACX,KAAK,UAAU,OAAO,QAAQ;EAChC;CACF;CAEA,OAAO,eAAe,OAAqB;EAEzC,MAAM,QADO,QACI,CAAC,CAAC,KAAK,IAAI,KAAK;EACjC,IAAI,CAAC,OAAO;EAEZ,MAAM,OAAO,CAAC;EACd,cAAc,gBAAgB,KAAK;CACrC;CAEA,OAAO,UAAyC;EAC9C,OAAO,QAAQ,CAAC,CAAC;CACnB;CAEA,OAAe,gBAAgB,OAAqB;EAElD,QAAG,CAAC,CAAC,UAAU,SAAS,aAAa,SAAS,KAAK,CAAC;CACtD;AACF;AAEA,IAAa,sBAAb,MAAa,oBAAoB;CAC/B,OAAwB,yBAAyB;CAEjD,OAAO,SAAS,KAA4C;EAC1D,MAAM,OAAO,QAAQ;EAErB,KAAK,MAAM,SAAS,KAAK,KAAK,OAAO,GACnC,IAAI,MAAM,QAAQ,KAChB,aAAa,CAAC;EAIlB,MAAM,QAAQ,KAAK;EACnB,MAAM,QAA0B;GAC9B,KAAK;GACL,MAAM,CAAC;EACT;EAEA,MAAM,mBAAmB,IAAI,KAAK,MAAM,MAAM;GAC5C,MAAM,QAAQ,KAAK,KAAK,IAAI,KAAK;GACjC,IAAI,CAAC,OAAO;GAEZ,MAAM,KAAK,KAAK;IACd,sBAAM,IAAI,KAAK;IACf,OAAO,EAAE;IACT,MAAM,EAAE;GACV,CAAC;GAED,IAAI,MAAM,KAAK,SAAS,oBAAoB,wBAC1C,MAAM,OAAO,MAAM,KAAK,MACtB,CAAC,oBAAoB,sBACvB;GAGF,oBAAoB,gBAAgB,KAAK;EAC3C,CAAC;EAED,MAAM,mBAAmB,IAAI,kBAAkB;GAC7C,oBAAoB,gBAAgB,KAAK;EAC3C,CAAC;EAED,KAAK,KAAK,IAAI,OAAO,KAAK;EAC1B,oBAAoB,gBAAgB,KAAK;EAEzC,aAAa;GACX,MAAM,OAAO,QAAQ;GAErB,IAAI,CADU,KAAK,KAAK,IAAI,KACnB,GAAG;GAEZ,mBAAmB;GACnB,mBAAmB;GAEnB,KAAK,KAAK,OAAO,KAAK;GAEtB,oBAAoB,gBAAgB,KAAK;EAC3C;CACF;CAEA,OAAe,gBAAgB,OAAqB;EAElD,QAAG,CAAC,CAAC,UAAU,SAAS,aAAa,SAAS,KAAK,CAAC;CACtD;AACF"}
1
+ {"version":3,"file":"DevToolsHooks.js","names":["Unsubscribe","AssistantClient","EventLog","time","Date","event","data","DevToolsApiEntry","api","Partial","logs","DevToolsHook","apis","Map","nextId","listeners","Set","apiId","global","Window","__ASSISTANT_UI_DEVTOOLS_HOOK__","cachedHook","getHook","createHook","window","existingHook","newHook","DevToolsHooks","subscribe","listener","hook","add","delete","clearEventLogs","entry","get","notifyListeners","getApis","forEach","DevToolsProviderApi","MAX_EVENT_LOGS_PER_API","register","aui","values","eventUnsubscribe","on","e","push","payload","length","slice","stateUnsubscribe","set"],"sources":["../../src/devtools/DevToolsHooks.ts"],"sourcesContent":["import type { Unsubscribe } from \"@assistant-ui/core\";\nimport type { AssistantClient } from \"@assistant-ui/store\";\n\nexport interface EventLog {\n time: Date;\n event: string;\n data: unknown;\n}\n\ninterface DevToolsApiEntry {\n api: Partial<AssistantClient>;\n logs: EventLog[];\n}\n\ninterface DevToolsHook {\n apis: Map<number, DevToolsApiEntry>;\n nextId: number;\n listeners: Set<(apiId: number) => void>;\n}\n\ndeclare global {\n interface Window {\n __ASSISTANT_UI_DEVTOOLS_HOOK__?: DevToolsHook;\n }\n}\n\nlet cachedHook: DevToolsHook | undefined;\n\nconst getHook = (): DevToolsHook => {\n if (cachedHook) {\n return cachedHook;\n }\n\n const createHook = (): DevToolsHook => ({\n apis: new Map(),\n nextId: 0,\n listeners: new Set(),\n });\n\n if (typeof window === \"undefined\") {\n cachedHook = createHook();\n return cachedHook;\n }\n\n const existingHook = window.__ASSISTANT_UI_DEVTOOLS_HOOK__;\n if (existingHook) {\n cachedHook = existingHook;\n return existingHook;\n }\n\n const newHook = createHook();\n window.__ASSISTANT_UI_DEVTOOLS_HOOK__ = newHook;\n cachedHook = newHook;\n return newHook;\n};\n\nexport class DevToolsHooks {\n static subscribe(listener: () => void): Unsubscribe {\n const hook = getHook();\n hook.listeners.add(listener);\n return () => {\n hook.listeners.delete(listener);\n };\n }\n\n static clearEventLogs(apiId: number): void {\n const hook = getHook();\n const entry = hook.apis.get(apiId);\n if (!entry) return;\n\n entry.logs = [];\n DevToolsHooks.notifyListeners(apiId);\n }\n\n static getApis(): Map<number, DevToolsApiEntry> {\n return getHook().apis;\n }\n\n private static notifyListeners(apiId: number): void {\n const hook = getHook();\n hook.listeners.forEach((listener) => listener(apiId));\n }\n}\n\nexport class DevToolsProviderApi {\n private static readonly MAX_EVENT_LOGS_PER_API = 200;\n\n static register(aui: Partial<AssistantClient>): Unsubscribe {\n const hook = getHook();\n\n for (const entry of hook.apis.values()) {\n if (entry.api === aui) {\n return () => {};\n }\n }\n\n const apiId = hook.nextId++;\n const entry: DevToolsApiEntry = {\n api: aui,\n logs: [],\n };\n\n const eventUnsubscribe = aui.on?.(\"*\", (e) => {\n const entry = hook.apis.get(apiId);\n if (!entry) return;\n\n entry.logs.push({\n time: new Date(),\n event: e.event,\n data: e.payload,\n });\n\n if (entry.logs.length > DevToolsProviderApi.MAX_EVENT_LOGS_PER_API) {\n entry.logs = entry.logs.slice(\n -DevToolsProviderApi.MAX_EVENT_LOGS_PER_API,\n );\n }\n\n DevToolsProviderApi.notifyListeners(apiId);\n });\n\n const stateUnsubscribe = aui.subscribe?.(() => {\n DevToolsProviderApi.notifyListeners(apiId);\n });\n\n hook.apis.set(apiId, entry);\n DevToolsProviderApi.notifyListeners(apiId);\n\n return () => {\n const hook = getHook();\n const entry = hook.apis.get(apiId);\n if (!entry) return;\n\n eventUnsubscribe?.();\n stateUnsubscribe?.();\n\n hook.apis.delete(apiId);\n\n DevToolsProviderApi.notifyListeners(apiId);\n };\n }\n\n private static notifyListeners(apiId: number): void {\n const hook = getHook();\n hook.listeners.forEach((listener) => listener(apiId));\n }\n}\n"],"mappings":";AA0BA,IAAIqB;AAEJ,MAAMC,gBAA8B;CAClC,IAAID,YACF,OAAOA;CAGT,MAAME,oBAAkC;EACtCX,sBAAM,IAAIC,IAAI;EACdC,QAAQ;EACRC,2BAAW,IAAIC,IAAI;CACrB;CAEA,IAAI,OAAOQ,WAAW,aAAa;EACjCH,aAAaE,WAAW;EACxB,OAAOF;CACT;CAEA,MAAMI,eAAeD,OAAOJ;CAC5B,IAAIK,cAAc;EAChBJ,aAAaI;EACb,OAAOA;CACT;CAEA,MAAMC,UAAUH,WAAW;CAC3BC,OAAOJ,iCAAiCM;CACxCL,aAAaK;CACb,OAAOA;AACT;AAEA,IAAaC,gBAAb,MAAaA,cAAc;CACzB,OAAOC,UAAUC,UAAmC;EAClD,MAAMC,OAAOR,QAAQ;EACrBQ,KAAKf,UAAUgB,IAAIF,QAAQ;EAC3B,aAAa;GACXC,KAAKf,UAAUiB,OAAOH,QAAQ;EAChC;CACF;CAEA,OAAOI,eAAehB,OAAqB;EAEzC,MAAMiB,QADOZ,QACCQ,CAAI,CAAClB,KAAKuB,IAAIlB,KAAK;EACjC,IAAI,CAACiB,OAAO;EAEZA,MAAMxB,OAAO,CAAA;EACbiB,cAAcS,gBAAgBnB,KAAK;CACrC;CAEA,OAAOoB,UAAyC;EAC9C,OAAOf,QAAQ,CAAC,CAACV;CACnB;CAEA,OAAewB,gBAAgBnB,OAAqB;EAElDa,QAAAA,CAAI,CAACf,UAAUuB,SAAST,aAAaA,SAASZ,KAAK,CAAC;CACtD;AACF;AAEA,IAAasB,sBAAb,MAAaA,oBAAoB;CAC/B,OAAwBC,yBAAyB;CAEjD,OAAOC,SAASC,KAA4C;EAC1D,MAAMZ,OAAOR,QAAQ;EAErB,KAAK,MAAMY,SAASJ,KAAKlB,KAAK+B,OAAO,GACnC,IAAIT,MAAM1B,QAAQkC,KAChB,aAAa,CAAC;EAIlB,MAAMzB,QAAQa,KAAKhB;EACnB,MAAMoB,QAA0B;GAC9B1B,KAAKkC;GACLhC,MAAM,CAAA;EACR;EAEA,MAAMkC,mBAAmBF,IAAIG,KAAK,MAAMC,MAAM;GAC5C,MAAMZ,QAAQJ,KAAKlB,KAAKuB,IAAIlB,KAAK;GACjC,IAAI,CAACiB,OAAO;GAEZA,MAAMxB,KAAKqC,KAAK;IACd5C,sBAAM,IAAIC,KAAK;IACfC,OAAOyC,EAAEzC;IACTC,MAAMwC,EAAEE;GACV,CAAC;GAED,IAAId,MAAMxB,KAAKuC,SAASV,oBAAoBC,wBAC1CN,MAAMxB,OAAOwB,MAAMxB,KAAKwC,MACtB,CAACX,oBAAoBC,sBACvB;GAGFD,oBAAoBH,gBAAgBnB,KAAK;EAC3C,CAAC;EAED,MAAMkC,mBAAmBT,IAAId,kBAAkB;GAC7CW,oBAAoBH,gBAAgBnB,KAAK;EAC3C,CAAC;EAEDa,KAAKlB,KAAKwC,IAAInC,OAAOiB,KAAK;EAC1BK,oBAAoBH,gBAAgBnB,KAAK;EAEzC,aAAa;GACX,MAAMa,OAAOR,QAAQ;GAErB,IAAI,CADUQ,KAAKlB,KAAKuB,IAAIlB,KACvBiB,GAAO;GAEZU,mBAAmB;GACnBO,mBAAmB;GAEnBrB,KAAKlB,KAAKoB,OAAOf,KAAK;GAEtBsB,oBAAoBH,gBAAgBnB,KAAK;EAC3C;CACF;CAEA,OAAemB,gBAAgBnB,OAAqB;EAElDa,QAAAA,CAAI,CAACf,UAAUuB,SAAST,aAAaA,SAASZ,KAAK,CAAC;CACtD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"useMessageQuote.js","names":[],"sources":["../../src/hooks/useMessageQuote.ts"],"sourcesContent":["\"use client\";\n\nimport type { QuoteInfo } from \"@assistant-ui/core\";\nimport { getMessageQuote } from \"@assistant-ui/core/react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * Hook that returns the quote info for the current message, if any.\n *\n * Reads from `message.metadata.custom.quote`.\n *\n * @example\n * ```tsx\n * function QuoteBlock() {\n * const quote = useMessageQuote();\n * if (!quote) return null;\n * return <blockquote>{quote.text}</blockquote>;\n * }\n * ```\n */\nexport const useMessageQuote = (): QuoteInfo | undefined => {\n return useAuiState(getMessageQuote);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAa,wBAA+C;CAC1D,OAAO,YAAY,eAAe;AACpC"}
1
+ {"version":3,"file":"useMessageQuote.js","names":["QuoteInfo","getMessageQuote","useAuiState","useMessageQuote"],"sources":["../../src/hooks/useMessageQuote.ts"],"sourcesContent":["\"use client\";\n\nimport type { QuoteInfo } from \"@assistant-ui/core\";\nimport { getMessageQuote } from \"@assistant-ui/core/react\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\n/**\n * Hook that returns the quote info for the current message, if any.\n *\n * Reads from `message.metadata.custom.quote`.\n *\n * @example\n * ```tsx\n * function QuoteBlock() {\n * const quote = useMessageQuote();\n * if (!quote) return null;\n * return <blockquote>{quote.text}</blockquote>;\n * }\n * ```\n */\nexport const useMessageQuote = (): QuoteInfo | undefined => {\n return useAuiState(getMessageQuote);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,MAAaG,wBAAkB;CAAA,OACtBD,YAAYD,eAAe;AAAC"}
@@ -16,8 +16,11 @@ import { useAuiState } from "@assistant-ui/store";
16
16
  * ```
17
17
  */
18
18
  const useMessageTiming = () => {
19
- return useAuiState((s) => s.message.role === "assistant" ? s.message.metadata?.timing : void 0);
19
+ return useAuiState(_temp);
20
20
  };
21
+ function _temp(s) {
22
+ return s.message.role === "assistant" ? s.message.metadata?.timing : void 0;
23
+ }
21
24
  //#endregion
22
25
  export { useMessageTiming };
23
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"useMessageTiming.js","names":[],"sources":["../../src/hooks/useMessageTiming.ts"],"sourcesContent":["\"use client\";\n\nimport { useAuiState } from \"@assistant-ui/store\";\nimport type { MessageTiming } from \"@assistant-ui/core\";\n\n/**\n * Hook that returns timing information for the current assistant message.\n *\n * Reads from `message.metadata.timing`.\n *\n * @example\n * ```tsx\n * function MessageStats() {\n * const timing = useMessageTiming();\n * if (!timing) return null;\n * return <span>{timing.tokensPerSecond?.toFixed(1)} tok/s</span>;\n * }\n * ```\n */\nexport const useMessageTiming = (): MessageTiming | undefined => {\n return useAuiState((s) =>\n s.message.role === \"assistant\" ? s.message.metadata?.timing : undefined,\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAa,yBAAoD;CAC/D,OAAO,aAAa,MAClB,EAAE,QAAQ,SAAS,cAAc,EAAE,QAAQ,UAAU,SAAS,KAAA,CAChE;AACF"}
1
+ {"version":3,"file":"useMessageTiming.js","names":["useAuiState","MessageTiming","useMessageTiming","_temp","s","message","role","metadata","timing","undefined"],"sources":["../../src/hooks/useMessageTiming.ts"],"sourcesContent":["\"use client\";\n\nimport { useAuiState } from \"@assistant-ui/store\";\nimport type { MessageTiming } from \"@assistant-ui/core\";\n\n/**\n * Hook that returns timing information for the current assistant message.\n *\n * Reads from `message.metadata.timing`.\n *\n * @example\n * ```tsx\n * function MessageStats() {\n * const timing = useMessageTiming();\n * if (!timing) return null;\n * return <span>{timing.tokensPerSecond?.toFixed(1)} tok/s</span>;\n * }\n * ```\n */\nexport const useMessageTiming = (): MessageTiming | undefined => {\n return useAuiState((s) =>\n s.message.role === \"assistant\" ? s.message.metadata?.timing : undefined,\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAaE,yBAAmB;CAAA,OACvBF,YAAYG,KAEnB;AAAC;AAH6B,SAAAA,MAAAC,GAAA;CAAA,OAE5BA,EAACC,QAAQC,SAAU,cAAcF,EAACC,QAAQE,UAAiBC,SAA3DC,KAAAA;AAAuE"}
@@ -0,0 +1,23 @@
1
+ //#region src/hooks/useToolCallElapsed.d.ts
2
+ /**
3
+ * Hook that returns the elapsed wall-clock time of the current tool call in
4
+ * milliseconds, ticking once per second while the call runs.
5
+ *
6
+ * Reads `part.timing`. Returns `undefined` when the part is not a tool call,
7
+ * carries no timing, ended without a recorded completion (the duration is
8
+ * unknown), or when no message part scope is available (so kit components
9
+ * stay renderable standalone, e.g. in docs previews).
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * function ToolDuration() {
14
+ * const elapsedMs = useToolCallElapsed();
15
+ * if (elapsedMs === undefined) return null;
16
+ * return <span>{(elapsedMs / 1000).toFixed(1)}s</span>;
17
+ * }
18
+ * ```
19
+ */
20
+ declare const useToolCallElapsed: () => number | undefined;
21
+ //#endregion
22
+ export { useToolCallElapsed };
23
+ //# sourceMappingURL=useToolCallElapsed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolCallElapsed.d.ts","names":[],"sources":["../../src/hooks/useToolCallElapsed.ts"],"mappings":";;AAuBA;;;;AA4BC;;;;;;;;;;;;;cA5BY,kBAAA"}
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ import { useAui, useAuiState } from "@assistant-ui/store";
3
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
4
+ import { useEffect, useState } from "@assistant-ui/tap/react-shim";
5
+ //#region src/hooks/useToolCallElapsed.ts
6
+ /**
7
+ * Hook that returns the elapsed wall-clock time of the current tool call in
8
+ * milliseconds, ticking once per second while the call runs.
9
+ *
10
+ * Reads `part.timing`. Returns `undefined` when the part is not a tool call,
11
+ * carries no timing, ended without a recorded completion (the duration is
12
+ * unknown), or when no message part scope is available (so kit components
13
+ * stay renderable standalone, e.g. in docs previews).
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * function ToolDuration() {
18
+ * const elapsedMs = useToolCallElapsed();
19
+ * if (elapsedMs === undefined) return null;
20
+ * return <span>{(elapsedMs / 1000).toFixed(1)}s</span>;
21
+ * }
22
+ * ```
23
+ */
24
+ const useToolCallElapsed = () => {
25
+ const $ = c(7);
26
+ const hasPart = useAui().part.source !== null;
27
+ let t0;
28
+ if ($[0] !== hasPart) {
29
+ t0 = (s) => hasPart && s.part.type === "tool-call" ? s.part.timing : void 0;
30
+ $[0] = hasPart;
31
+ $[1] = t0;
32
+ } else t0 = $[1];
33
+ const timing = useAuiState(t0);
34
+ let t1;
35
+ if ($[2] !== hasPart) {
36
+ t1 = (s_0) => hasPart && s_0.part.type === "tool-call" && s_0.part.status.type === "running";
37
+ $[2] = hasPart;
38
+ $[3] = t1;
39
+ } else t1 = $[3];
40
+ const partRunning = useAuiState(t1);
41
+ const running = timing !== void 0 && timing.completedAt === void 0 && partRunning;
42
+ const [now, setNow] = useState(_temp);
43
+ let t2;
44
+ let t3;
45
+ if ($[4] !== running) {
46
+ t2 = () => {
47
+ if (!running) return;
48
+ setNow(Date.now());
49
+ const id = setInterval(() => setNow(Date.now()), 1e3);
50
+ return () => clearInterval(id);
51
+ };
52
+ t3 = [running];
53
+ $[4] = running;
54
+ $[5] = t2;
55
+ $[6] = t3;
56
+ } else {
57
+ t2 = $[5];
58
+ t3 = $[6];
59
+ }
60
+ useEffect(t2, t3);
61
+ if (timing === void 0) return;
62
+ if (timing.completedAt !== void 0) return Math.max(0, timing.completedAt - timing.startedAt);
63
+ if (!running) return;
64
+ return Math.max(0, now - timing.startedAt);
65
+ };
66
+ function _temp() {
67
+ return Date.now();
68
+ }
69
+ //#endregion
70
+ export { useToolCallElapsed };
71
+
72
+ //# sourceMappingURL=useToolCallElapsed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolCallElapsed.js","names":["c","_c","useEffect","useState","useAui","useAuiState","useToolCallElapsed","$","aui","hasPart","part","source","t0","s","type","timing","undefined","t1","s_0","status","partRunning","running","completedAt","now","setNow","_temp","t2","t3","Date","id","setInterval","clearInterval","Math","max","startedAt"],"sources":["../../src/hooks/useToolCallElapsed.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\n/**\n * Hook that returns the elapsed wall-clock time of the current tool call in\n * milliseconds, ticking once per second while the call runs.\n *\n * Reads `part.timing`. Returns `undefined` when the part is not a tool call,\n * carries no timing, ended without a recorded completion (the duration is\n * unknown), or when no message part scope is available (so kit components\n * stay renderable standalone, e.g. in docs previews).\n *\n * @example\n * ```tsx\n * function ToolDuration() {\n * const elapsedMs = useToolCallElapsed();\n * if (elapsedMs === undefined) return null;\n * return <span>{(elapsedMs / 1000).toFixed(1)}s</span>;\n * }\n * ```\n */\nexport const useToolCallElapsed = (): number | undefined => {\n const aui = useAui();\n const hasPart = aui.part.source !== null;\n const timing = useAuiState((s) =>\n hasPart && s.part.type === \"tool-call\" ? s.part.timing : undefined,\n );\n const partRunning = useAuiState(\n (s) =>\n hasPart &&\n s.part.type === \"tool-call\" &&\n s.part.status.type === \"running\",\n );\n const running =\n timing !== undefined && timing.completedAt === undefined && partRunning;\n const [now, setNow] = useState(() => Date.now());\n\n useEffect(() => {\n if (!running) return undefined;\n setNow(Date.now());\n const id = setInterval(() => setNow(Date.now()), 1000);\n return () => clearInterval(id);\n }, [running]);\n\n if (timing === undefined) return undefined;\n if (timing.completedAt !== undefined)\n return Math.max(0, timing.completedAt - timing.startedAt);\n if (!running) return undefined;\n return Math.max(0, now - timing.startedAt);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAaM,2BAAqB;CAAA,MAAAC,IAAAN,EAAA,CAAA;CAEhC,MAAAQ,UADYL,OACII,CAAG,CAAAE,KAAKC,WAAY;CAAK,IAAAC;CAAA,IAAAL,EAAA,OAAAE,SAAA;EACdG,MAAAC,MACzBJ,WAAWI,EAACH,KAAKI,SAAU,cAAcD,EAACH,KAAKK,SAA/CC,KAAAA;EAAkET,EAAA,KAAAE;EAAAF,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CADpE,MAAAQ,SAAeV,YAAYO,EAE3B;CAAE,IAAAK;CAAA,IAAAV,EAAA,OAAAE,SAAA;EAEAQ,MAAAC,QACET,WACAI,IAACH,KAAKI,SAAU,eAChBD,IAACH,KAAKS,OAAOL,SAAU;EAASP,EAAA,KAAAE;EAAAF,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAJpC,MAAAa,cAAoBf,YAClBY,EAIF;CACA,MAAAI,UACEN,WAAWC,KAAAA,KAAaD,OAAMO,gBAAiBN,KAAAA,KAA/CI;CACF,MAAA,CAAAG,KAAAC,UAAsBrB,SAASsB,KAAgB;CAAE,IAAAC;CAAA,IAAAC;CAAA,IAAApB,EAAA,OAAAc,SAAA;EAEvCK,WAAA;GACR,IAAI,CAACL,SAAO;GACZG,OAAOI,KAAIL,IAAK,CAAC;GACjB,MAAAM,KAAWC,kBAAkBN,OAAOI,KAAIL,IAAK,CAAC,GAAG,GAAI;GAAE,aAC1CQ,cAAcF,EAAE;EAAC;EAC7BF,KAAA,CAACN,OAAO;EAACd,EAAA,KAAAc;EAAAd,EAAA,KAAAmB;EAAAnB,EAAA,KAAAoB;CAAA,OAAA;EAAAD,KAAAnB,EAAA;EAAAoB,KAAApB,EAAA;CAAA;CALZL,UAAUwB,IAKPC,EAAS;CAEZ,IAAIZ,WAAWC,KAAAA,GAAS;CACxB,IAAID,OAAMO,gBAAiBN,KAAAA,GAAS,OAC3BgB,KAAIC,IAAK,GAAGlB,OAAMO,cAAeP,OAAMmB,SAAU;CAC1D,IAAI,CAACb,SAAO;CAAmB,OACxBW,KAAIC,IAAK,GAAGV,MAAMR,OAAMmB,SAAU;AAAC;AA3BV,SAAAT,QAAA;CAAA,OAcKG,KAAIL,IAAK;AAAC"}
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ import { ReadonlyThreadProvider } from "./context/index.js";
25
25
  import { DevToolsHooks, DevToolsProviderApi } from "./devtools/DevToolsHooks.js";
26
26
  import { useMessageQuote } from "./hooks/useMessageQuote.js";
27
27
  import { useMessageTiming } from "./hooks/useMessageTiming.js";
28
+ import { useToolCallElapsed } from "./hooks/useToolCallElapsed.js";
28
29
  import { useCloudThreadListRuntime } from "./legacy-runtime/cloud/useCloudThreadListRuntime.js";
29
30
  import { CloudFileAttachmentAdapter } from "./legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js";
30
31
  import { AssistantTransportCommand, AssistantTransportConnectionMetadata, AssistantTransportProtocol, SendCommandsRequestBody } from "./legacy-runtime/runtime-cores/assistant-transport/types.js";
@@ -67,6 +68,7 @@ import { useMessagePartImage } from "./primitives/messagePart/useMessagePartImag
67
68
  import { useMessagePartData } from "./primitives/messagePart/useMessagePartData.js";
68
69
  import { useThreadViewportAutoScroll } from "./primitives/thread/useThreadViewportAutoScroll.js";
69
70
  import { useScrollLock } from "./primitives/reasoning/useScrollLock.js";
71
+ import { Unstable_MessageStallDetection, Unstable_MessageStallDetectionOptions, unstable_useMessageStallDetection } from "./unstable/useMessageStallDetection.js";
70
72
  import { ToolExecutionStatus, internal_d_exports } from "./internal.js";
71
73
  import { Unstable_IconComponent, Unstable_Mention, Unstable_MentionCategory, Unstable_MentionDirective, Unstable_ModelContextToolsOptions, Unstable_UseMentionAdapterOptions, unstable_useMentionAdapter } from "./unstable/useMentionAdapter.js";
72
74
  import { Unstable_SlashCommand, Unstable_SlashCommandAction, Unstable_UseSlashCommandAdapterOptions, unstable_useSlashCommandAdapter } from "./unstable/useSlashCommandAdapter.js";
@@ -78,7 +80,7 @@ import { getMcpAppFromToolPart } from "./mcp-apps/utils.js";
78
80
  import { AssistantClient, AssistantEventCallback, AssistantEventName, AssistantEventPayload, AssistantEventScope, AssistantEventSelector, AssistantState, AuiIf, AuiProvider, useAui, useAuiEvent, useAuiState } from "@assistant-ui/store";
79
81
  import { AssistantContextConfig, AssistantDataUI, AssistantDataUIProps, AssistantInteractableProps, AssistantTool, AssistantToolProps, AssistantToolUI, AssistantToolUIProps, DataMessagePartComponent, DataMessagePartProps, DataRenderers, EmptyMessagePartComponent, EmptyMessagePartProps, EnrichedPartState, FileMessagePartComponent, FileMessagePartProps, GenerativeUIComponentRegistry, GenerativeUIMessagePartComponent, GenerativeUIMessagePartProps, GenerativeUIRender, GenerativeUIRenderError, GenerativeUIRenderProps, GroupByContext, ImageMessagePartComponent, ImageMessagePartProps, Interactables, McpAppResourceOutput, McpToolkitDefinition, PartState, ProviderToolConfig, QuoteMessagePartComponent, QuoteMessagePartProps, ReasoningGroupComponent, ReasoningGroupProps, ReasoningMessagePartComponent, ReasoningMessagePartProps, RuntimeAdapterProvider, RuntimeAdapters, SourceMessagePartComponent, SourceMessagePartProps, TextMessagePartComponent, TextMessagePartProps, ToolArgsStatus, ToolCallMessagePartComponent, ToolCallMessagePartProps, ToolCallText, ToolDefinition, Toolkit, ToolkitDefinition, ToolkitDefinitionEntry, Tools, Unstable_AudioMessagePartComponent, Unstable_AudioMessagePartProps, defineMcpToolkit, defineToolkit, externalTool, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, providerTool, stubTool, useAssistantContext, useAssistantDataUI, useAssistantInstructions, useAssistantInteractable, useAssistantTool, useAssistantToolUI, useAuiToolOverrides, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useRuntimeAdapters, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume } from "@assistant-ui/core/react";
80
82
  import { AssistantCloud } from "assistant-cloud";
81
- import { AddToolResultOptions, AppendMessage, AssistantFrameHost, AssistantFrameProvider, AssistantRuntime, Attachment, AttachmentAdapter, AttachmentRuntime, AttachmentState, AttachmentStatus, ChatModelAdapter, ChatModelRunOptions, ChatModelRunResult, ChatModelRunUpdate, CompleteAttachment, ComposerRuntime, ComposerState, CompositeAttachmentAdapter, CreateAppendMessage, CreateAttachment, CreateResumeRunConfig, CreateStartRunConfig, DataMessagePart, DictationAdapter, DictationState, EditComposerRuntime, EditComposerState, ExportedMessageRepository, ExportedMessageRepositoryItem, ExternalStoreAdapter, ExternalStoreMessageConverter, ExternalStoreSharedOptions, ExternalStoreThreadData, ExternalStoreThreadListAdapter, ExternalThreadBranchAdapter, ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, FeedbackAdapter, FileMessagePart, FrameMessage, FrameMessageType, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, GenericThreadHistoryAdapter, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, LocalRuntimeOptionsBase, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessagePartRuntime, MessagePartState, MessagePartStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, SerializedModelContext, SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SourceMessagePart, SourceProviderMetadata, SpeechSynthesisAdapter, SubmitFeedbackOptions, SuggestionAdapter, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadComposerRuntime, ThreadComposerState, ThreadHistoryAdapter, ThreadListItemRuntime, ThreadListItemState, ThreadListItemStatus, ThreadListRuntime, ThreadListState, ThreadMessage, ThreadMessageLike, ThreadRuntime, ThreadState, ThreadSuggestion, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolCallMessagePart, ToolCallMessagePartStatus, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_DirectiveFormatter, Unstable_DirectiveSegment, Unstable_TriggerItem, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, getExternalStoreMessages, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter } from "@assistant-ui/core";
83
+ import { AddToolResultOptions, AppendMessage, AssistantFrameHost, AssistantFrameProvider, AssistantRuntime, Attachment, AttachmentAdapter, AttachmentRuntime, AttachmentState, AttachmentStatus, ChatModelAdapter, ChatModelRunOptions, ChatModelRunResult, ChatModelRunUpdate, CompleteAttachment, ComposerRuntime, ComposerState, CompositeAttachmentAdapter, CreateAppendMessage, CreateAttachment, CreateResumeRunConfig, CreateStartRunConfig, DataMessagePart, DictationAdapter, DictationState, EditComposerRuntime, EditComposerState, ExportedMessageRepository, ExportedMessageRepositoryItem, ExternalStoreAdapter, ExternalStoreMessageConverter, ExternalStoreSharedOptions, ExternalStoreThreadData, ExternalStoreThreadListAdapter, ExternalThreadBranchAdapter, ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, FeedbackAdapter, FileMessagePart, FrameMessage, FrameMessageType, GenerativeUIMessagePart, GenerativeUINode, GenerativeUISpec, GenericThreadHistoryAdapter, ImageMessagePart, InMemoryThreadListAdapter, LanguageModelConfig, LanguageModelV1CallSettings, LocalRuntimeOptionsBase, MessageFormatAdapter, MessageFormatItem, MessageFormatRepository, MessagePartRuntime, MessagePartState, MessagePartStatus, MessageQueueController, MessageQueueDriver, MessageRuntime, MessageState, MessageStatus, MessageStorageEntry, MessageTiming, ModelContext, ModelContextProvider, ModelContextRegistry, ModelContextRegistryInstructionHandle, ModelContextRegistryProviderHandle, ModelContextRegistryToolHandle, PendingAttachment, QuoteInfo, RealtimeVoiceAdapter, ReasoningMessagePart, RemoteThreadListAdapter, RespondToToolApprovalOptions, SerializedModelContext, SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SourceMessagePart, SourceProviderMetadata, SpeechSynthesisAdapter, SubmitFeedbackOptions, SuggestionAdapter, TextMessagePart, ThreadAssistantMessage, ThreadAssistantMessagePart, ThreadComposerRuntime, ThreadComposerState, ThreadHistoryAdapter, ThreadListItemRuntime, ThreadListItemState, ThreadListItemStatus, ThreadListRuntime, ThreadListState, ThreadMessage, ThreadMessageLike, ThreadRuntime, ThreadState, ThreadSuggestion, ThreadSystemMessage, ThreadUserMessage, ThreadUserMessagePart, ToolApprovalOption, ToolApprovalOptionKind, ToolApprovalResponse, ToolCallMessagePart, ToolCallMessagePartStatus, ToolCallTiming, ToolModelContentPart, Unstable_AudioMessagePart, Unstable_DirectiveFormatter, Unstable_DirectiveSegment, Unstable_TriggerItem, Unsubscribe, VoiceSessionControls, VoiceSessionHelpers, VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, getExternalStoreMessages, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter } from "@assistant-ui/core";
82
84
  import { Tool } from "assistant-stream";
83
85
  import { ChainOfThoughtClient, ComposerSendOptions, ModelContext as ModelContextClient, QueueItemMethods, QueueItemState, SuggestionConfig, Suggestions } from "@assistant-ui/core/store";
84
- export { actionBarMore_d_exports as ActionBarMorePrimitive, actionBar_d_exports as ActionBarPrimitive, type AddToolResultOptions, type AppendMessage, type Assistant, type AssistantClient, AssistantCloud, type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantEventCallback, type AssistantEventName, type AssistantEventPayload, type AssistantEventScope, type AssistantEventSelector, AssistantFrameHost, AssistantFrameProvider, type AssistantInteractableProps, assistantModal_d_exports as AssistantModalPrimitive, type AssistantRuntime, AssistantRuntimeProvider, type AssistantState, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantTransportCommand, type AssistantTransportConnectionMetadata, type AssistantTransportProtocol, type Attachment, type AttachmentAdapter, attachment_d_exports as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, type AttachmentStatus, AuiIf, AuiProvider, branchPicker_d_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_d_exports as ChainOfThoughtPrimitive, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, CloudFileAttachmentAdapter, type CompleteAttachment, ComposerAttachmentByIndexProvider, composer_d_exports as ComposerPrimitive, type ComposerRuntime, type ComposerSendOptions, type ComposerState, CompositeAttachmentAdapter, type CreateAppendMessage, type CreateAttachment, type CreateResumeRunConfig, type CreateStartRunConfig, type DataMessagePart, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, DevToolsHooks, DevToolsProviderApi, type DictationAdapter, type DictationState, type EditComposerRuntime, type EditComposerState, type EmptyMessagePartComponent, type EmptyMessagePartProps, type EnrichedPartState, error_d_exports as ErrorPrimitive, ExportedMessageRepository, type ExportedMessageRepositoryItem, type ExternalStoreAdapter, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, ExternalThread, type ExternalThreadBranchAdapter, type ExternalThreadMessage, type ExternalThreadProps, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type FrameMessage, type FrameMessageType, type GenerativeUIComponentRegistry, type GenerativeUIMessagePart, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, type GenerativeUINode, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GenerativeUISpec, type GenericThreadHistoryAdapter, type GroupByContext, internal_d_exports as INTERNAL, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadList, InMemoryThreadListAdapter, type InMemoryThreadListProps, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type LocalRuntimeOptionsBase, type McpAppDisplayMode, type McpAppHostContext, type McpAppHostInfo, type McpAppMetadata, McpAppRenderer, type McpAppRendererOptions, type McpAppResource, type McpAppResourceCSP, type McpAppResourceMeta, type McpAppResourceOutput, type McpAppSandboxConfig, type McpAppToolCallParams, type McpAppsHost, McpAppsRemoteHost, type McpAppsRemoteHostOptions, type McpToolkitDefinition, MessageAttachmentByIndexProvider, MessageByIndexProvider, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, messagePart_d_exports as MessagePartPrimitive, type MessagePartRuntime, type MessagePartState, type MessagePartStatus, message_d_exports as MessagePrimitive, MessageProvider, type MessageQueueController, type MessageQueueDriver, type MessageRuntime, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PartState, type PendingAttachment, type ProviderToolConfig, type QueueItemMethods, queueItem_d_exports as QueueItemPrimitive, type QueueItemState, type QuoteInfo, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, type RemoteThreadListAdapter, RuntimeAdapterProvider, type RuntimeAdapters, selectionToolbar_d_exports as SelectionToolbarPrimitive, type SendCommandsRequestBody, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, type SmoothOptions, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SourceProviderMetadata, type SpeechSynthesisAdapter, type SubmitFeedbackOptions, type SuggestionAdapter, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItemMore_d_exports as ThreadListItemMorePrimitive, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, type ThreadListItemStatus, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadListState, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadViewportState, type Tool, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartProps, type ToolCallMessagePartStatus, type ToolCallText, type ToolDefinition, type ToolExecutionStatus, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_ComposerInputHistory, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_IconComponent, type Unstable_Mention, type Unstable_MentionCategory, type Unstable_MentionDirective, type Unstable_ModelContextToolsOptions, type RegisteredTrigger as Unstable_RegisteredTrigger, type Unstable_SlashCommand, type Unstable_SlashCommandAction, type TriggerBehavior as Unstable_TriggerBehavior, type Unstable_TriggerItem, type Unstable_UseMentionAdapterOptions, type Unstable_UseSlashCommandAdapterOptions, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_useComposerInputHistory, unstable_useMentionAdapter, unstable_useSlashCommandAdapter, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantRuntime, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAttachment, useAttachmentRuntime, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useComposer, useComposerRuntime, useEditComposer, useEditComposerAttachment, useEditComposerAttachmentRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessage, useMessageAttachment, useMessageAttachmentRuntime, useMessagePart, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartRuntime, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageRuntime, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThread, useThreadComposer, useThreadComposerAttachment, useThreadComposerAttachmentRuntime, useThreadList, useThreadListItem, useThreadListItemRuntime, useThreadModelContext, useThreadRuntime, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
86
+ export { actionBarMore_d_exports as ActionBarMorePrimitive, actionBar_d_exports as ActionBarPrimitive, type AddToolResultOptions, type AppendMessage, type Assistant, type AssistantClient, AssistantCloud, type AssistantContextConfig, type AssistantDataUI, type AssistantDataUIProps, type AssistantEventCallback, type AssistantEventName, type AssistantEventPayload, type AssistantEventScope, type AssistantEventSelector, AssistantFrameHost, AssistantFrameProvider, type AssistantInteractableProps, assistantModal_d_exports as AssistantModalPrimitive, type AssistantRuntime, AssistantRuntimeProvider, type AssistantState, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantTransportCommand, type AssistantTransportConnectionMetadata, type AssistantTransportProtocol, type Attachment, type AttachmentAdapter, attachment_d_exports as AttachmentPrimitive, type AttachmentRuntime, type AttachmentState, type AttachmentStatus, AuiIf, AuiProvider, branchPicker_d_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_d_exports as ChainOfThoughtPrimitive, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, CloudFileAttachmentAdapter, type CompleteAttachment, ComposerAttachmentByIndexProvider, composer_d_exports as ComposerPrimitive, type ComposerRuntime, type ComposerSendOptions, type ComposerState, CompositeAttachmentAdapter, type CreateAppendMessage, type CreateAttachment, type CreateResumeRunConfig, type CreateStartRunConfig, type DataMessagePart, type DataMessagePartComponent, type DataMessagePartProps, DataRenderers, DevToolsHooks, DevToolsProviderApi, type DictationAdapter, type DictationState, type EditComposerRuntime, type EditComposerState, type EmptyMessagePartComponent, type EmptyMessagePartProps, type EnrichedPartState, error_d_exports as ErrorPrimitive, ExportedMessageRepository, type ExportedMessageRepositoryItem, type ExternalStoreAdapter, type ExternalStoreMessageConverter, type ExternalStoreSharedOptions, type ExternalStoreThreadData, type ExternalStoreThreadListAdapter, ExternalThread, type ExternalThreadBranchAdapter, type ExternalThreadMessage, type ExternalThreadProps, type ExternalThreadQueueAdapter, FRAME_MESSAGE_CHANNEL, type FeedbackAdapter, type FileMessagePart, type FileMessagePartComponent, type FileMessagePartProps, type FrameMessage, type FrameMessageType, type GenerativeUIComponentRegistry, type GenerativeUIMessagePart, type GenerativeUIMessagePartComponent, type GenerativeUIMessagePartProps, type GenerativeUINode, GenerativeUIRender, GenerativeUIRenderError, type GenerativeUIRenderProps, type GenerativeUISpec, type GenericThreadHistoryAdapter, type GroupByContext, internal_d_exports as INTERNAL, type ImageMessagePart, type ImageMessagePartComponent, type ImageMessagePartProps, InMemoryThreadList, InMemoryThreadListAdapter, type InMemoryThreadListProps, Interactables, type LanguageModelConfig, type LanguageModelV1CallSettings, type LocalRuntimeOptions, type LocalRuntimeOptionsBase, type McpAppDisplayMode, type McpAppHostContext, type McpAppHostInfo, type McpAppMetadata, McpAppRenderer, type McpAppRendererOptions, type McpAppResource, type McpAppResourceCSP, type McpAppResourceMeta, type McpAppResourceOutput, type McpAppSandboxConfig, type McpAppToolCallParams, type McpAppsHost, McpAppsRemoteHost, type McpAppsRemoteHostOptions, type McpToolkitDefinition, MessageAttachmentByIndexProvider, MessageByIndexProvider, type MessageFormatAdapter, type MessageFormatItem, type MessageFormatRepository, messagePart_d_exports as MessagePartPrimitive, type MessagePartRuntime, type MessagePartState, type MessagePartStatus, message_d_exports as MessagePrimitive, MessageProvider, type MessageQueueController, type MessageQueueDriver, type MessageRuntime, type MessageState, type MessageStatus, type MessageStorageEntry, type MessageTiming, type ModelContext, ModelContextClient, type ModelContextProvider, ModelContextRegistry, type ModelContextRegistryInstructionHandle, type ModelContextRegistryProviderHandle, type ModelContextRegistryToolHandle, PartByIndexProvider, type PartState, type PendingAttachment, type ProviderToolConfig, type QueueItemMethods, queueItem_d_exports as QueueItemPrimitive, type QueueItemState, type QuoteInfo, type QuoteMessagePartComponent, type QuoteMessagePartProps, ReadonlyThreadProvider, type RealtimeVoiceAdapter, type ReasoningGroupComponent, type ReasoningGroupProps, type ReasoningMessagePart, type ReasoningMessagePartComponent, type ReasoningMessagePartProps, type RemoteThreadListAdapter, type RespondToToolApprovalOptions, RuntimeAdapterProvider, type RuntimeAdapters, selectionToolbar_d_exports as SelectionToolbarPrimitive, type SendCommandsRequestBody, type SerializedModelContext, type SerializedTool, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, type SmoothOptions, type SourceMessagePart, type SourceMessagePartComponent, type SourceMessagePartProps, type SourceProviderMetadata, type SpeechSynthesisAdapter, type SubmitFeedbackOptions, type SuggestionAdapter, SuggestionByIndexProvider, type SuggestionConfig, suggestion_d_exports as SuggestionPrimitive, Suggestions, type TextMessagePart, type TextMessagePartComponent, type TextMessagePartProps, TextMessagePartProvider, type ThreadAssistantMessage, type ThreadAssistantMessagePart, type ThreadComposerRuntime, type ThreadComposerState, type ThreadHistoryAdapter, ThreadListItemByIndexProvider, threadListItemMore_d_exports as ThreadListItemMorePrimitive, threadListItem_d_exports as ThreadListItemPrimitive, type ThreadListItemRuntime, ThreadListItemRuntimeProvider, type ThreadListItemState, type ThreadListItemStatus, threadList_d_exports as ThreadListPrimitive, type ThreadListRuntime, type ThreadListState, type ThreadMessage, type ThreadMessageLike, thread_d_exports as ThreadPrimitive, type ThreadRuntime, type ThreadState, type ThreadSuggestion, type ThreadSystemMessage, type ThreadUserMessage, type ThreadUserMessagePart, type ThreadViewportState, type Tool, type ToolApprovalOption, type ToolApprovalOptionKind, type ToolApprovalResponse, type ToolArgsStatus, type ToolCallMessagePart, type ToolCallMessagePartComponent, type ToolCallMessagePartMcpMetadata, type ToolCallMessagePartProps, type ToolCallMessagePartStatus, type ToolCallText, type ToolCallTiming, type ToolDefinition, type ToolExecutionStatus, type ToolModelContentPart, type Toolkit, type ToolkitDefinition, type ToolkitDefinitionEntry, Tools, type Unstable_AudioMessagePart, type Unstable_AudioMessagePartComponent, type Unstable_AudioMessagePartProps, type Unstable_ComposerInputHistory, type Unstable_DirectiveFormatter, type Unstable_DirectiveSegment, type Unstable_IconComponent, type Unstable_Mention, type Unstable_MentionCategory, type Unstable_MentionDirective, type Unstable_MessageStallDetection, type Unstable_MessageStallDetectionOptions, type Unstable_ModelContextToolsOptions, type RegisteredTrigger as Unstable_RegisteredTrigger, type Unstable_SlashCommand, type Unstable_SlashCommandAction, type TriggerBehavior as Unstable_TriggerBehavior, type Unstable_TriggerItem, type Unstable_UseMentionAdapterOptions, type Unstable_UseSlashCommandAdapterOptions, type Unsubscribe, type VoiceSessionControls, type VoiceSessionHelpers, type VoiceSessionState, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_useComposerInputHistory, unstable_useMentionAdapter, unstable_useMessageStallDetection, unstable_useSlashCommandAdapter, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantRuntime, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAttachment, useAttachmentRuntime, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useComposer, useComposerRuntime, useEditComposer, useEditComposerAttachment, useEditComposerAttachmentRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessage, useMessageAttachment, useMessageAttachmentRuntime, useMessagePart, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartRuntime, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageRuntime, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThread, useThreadComposer, useThreadComposerAttachment, useThreadComposerAttachmentRuntime, useThreadList, useThreadListItem, useThreadListItemRuntime, useThreadModelContext, useThreadRuntime, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useToolCallElapsed, useVoiceControls, useVoiceState, useVoiceVolume };
package/dist/index.js CHANGED
@@ -58,6 +58,8 @@ import { useMessagePartData } from "./primitives/messagePart/useMessagePartData.
58
58
  import { useScrollLock } from "./primitives/reasoning/useScrollLock.js";
59
59
  import { useMessageQuote } from "./hooks/useMessageQuote.js";
60
60
  import { useMessageTiming } from "./hooks/useMessageTiming.js";
61
+ import { useToolCallElapsed } from "./hooks/useToolCallElapsed.js";
62
+ import { unstable_useMessageStallDetection } from "./unstable/useMessageStallDetection.js";
61
63
  import { SingleThreadList } from "./client/SingleThreadList.js";
62
64
  import { ExternalThread } from "./client/ExternalThread.js";
63
65
  import { InMemoryThreadList } from "./client/InMemoryThreadList.js";
@@ -73,4 +75,4 @@ import { DataRenderers, GenerativeUIRender, GenerativeUIRenderError, Interactabl
73
75
  import { AssistantCloud } from "assistant-cloud";
74
76
  import { AssistantFrameHost, AssistantFrameProvider, CompositeAttachmentAdapter, ExportedMessageRepository, FRAME_MESSAGE_CHANNEL, InMemoryThreadListAdapter, ModelContextRegistry, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, getExternalStoreMessages, mergeModelContexts, pickExternalStoreSharedOptions, tool, unstable_defaultDirectiveFormatter } from "@assistant-ui/core";
75
77
  import { ChainOfThoughtClient, ModelContext as ModelContextClient, Suggestions } from "@assistant-ui/core/store";
76
- export { actionBarMore_exports as ActionBarMorePrimitive, actionBar_exports as ActionBarPrimitive, AssistantCloud, AssistantFrameHost, AssistantFrameProvider, assistantModal_exports as AssistantModalPrimitive, AssistantRuntimeProvider, attachment_exports as AttachmentPrimitive, AuiIf, AuiProvider, branchPicker_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_exports as ChainOfThoughtPrimitive, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, composer_exports as ComposerPrimitive, CompositeAttachmentAdapter, DataRenderers, DevToolsHooks, DevToolsProviderApi, error_exports as ErrorPrimitive, ExportedMessageRepository, ExternalThread, FRAME_MESSAGE_CHANNEL, GenerativeUIRender, GenerativeUIRenderError, internal_exports as INTERNAL, InMemoryThreadList, InMemoryThreadListAdapter, Interactables, McpAppRenderer, McpAppsRemoteHost, MessageAttachmentByIndexProvider, MessageByIndexProvider, messagePart_exports as MessagePartPrimitive, message_exports as MessagePrimitive, MessageProvider, ModelContextClient, ModelContextRegistry, PartByIndexProvider, queueItem_exports as QueueItemPrimitive, ReadonlyThreadProvider, RuntimeAdapterProvider, selectionToolbar_exports as SelectionToolbarPrimitive, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, SuggestionByIndexProvider, suggestion_exports as SuggestionPrimitive, Suggestions, TextMessagePartProvider, ThreadListItemByIndexProvider, threadListItemMore_exports as ThreadListItemMorePrimitive, threadListItem_exports as ThreadListItemPrimitive, ThreadListItemRuntimeProvider, threadList_exports as ThreadListPrimitive, thread_exports as ThreadPrimitive, Tools, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_useComposerInputHistory, unstable_useMentionAdapter, unstable_useSlashCommandAdapter, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantRuntime, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAttachment, useAttachmentRuntime, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useComposer, useComposerRuntime, useEditComposer, useEditComposerAttachment, useEditComposerAttachmentRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessage, useMessageAttachment, useMessageAttachmentRuntime, useMessagePart, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartRuntime, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageRuntime, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThread, useThreadComposer, useThreadComposerAttachment, useThreadComposerAttachmentRuntime, useThreadList, useThreadListItem, useThreadListItemRuntime, useThreadModelContext, useThreadRuntime, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useVoiceControls, useVoiceState, useVoiceVolume };
78
+ export { actionBarMore_exports as ActionBarMorePrimitive, actionBar_exports as ActionBarPrimitive, AssistantCloud, AssistantFrameHost, AssistantFrameProvider, assistantModal_exports as AssistantModalPrimitive, AssistantRuntimeProvider, attachment_exports as AttachmentPrimitive, AuiIf, AuiProvider, branchPicker_exports as BranchPickerPrimitive, ChainOfThoughtByIndicesProvider, ChainOfThoughtClient, chainOfThought_exports as ChainOfThoughtPrimitive, CloudFileAttachmentAdapter, ComposerAttachmentByIndexProvider, composer_exports as ComposerPrimitive, CompositeAttachmentAdapter, DataRenderers, DevToolsHooks, DevToolsProviderApi, error_exports as ErrorPrimitive, ExportedMessageRepository, ExternalThread, FRAME_MESSAGE_CHANNEL, GenerativeUIRender, GenerativeUIRenderError, internal_exports as INTERNAL, InMemoryThreadList, InMemoryThreadListAdapter, Interactables, McpAppRenderer, McpAppsRemoteHost, MessageAttachmentByIndexProvider, MessageByIndexProvider, messagePart_exports as MessagePartPrimitive, message_exports as MessagePrimitive, MessageProvider, ModelContextClient, ModelContextRegistry, PartByIndexProvider, queueItem_exports as QueueItemPrimitive, ReadonlyThreadProvider, RuntimeAdapterProvider, selectionToolbar_exports as SelectionToolbarPrimitive, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SingleThreadList, SuggestionByIndexProvider, suggestion_exports as SuggestionPrimitive, Suggestions, TextMessagePartProvider, ThreadListItemByIndexProvider, threadListItemMore_exports as ThreadListItemMorePrimitive, threadListItem_exports as ThreadListItemPrimitive, ThreadListItemRuntimeProvider, threadList_exports as ThreadListPrimitive, thread_exports as ThreadPrimitive, Tools, WebSpeechDictationAdapter, WebSpeechSynthesisAdapter, bindExternalStoreMessage, createMessageQueue, createVoiceSession, defineMcpToolkit, defineToolkit, externalTool, getExternalStoreMessages, getMcpAppFromToolPart, groupPartByType, hitl, hitlTool, humanTool, makeAssistantDataUI, makeAssistantTool, makeAssistantToolUI, makeAssistantVisible, mergeModelContexts, pickExternalStoreSharedOptions, providerTool, stubTool, tool, convertExternalMessages as unstable_convertExternalMessages, createMessageConverter as unstable_createMessageConverter, unstable_defaultDirectiveFormatter, unstable_useComposerInputHistory, unstable_useMentionAdapter, unstable_useMessageStallDetection, unstable_useSlashCommandAdapter, useTriggerPopoverRootContext as unstable_useTriggerPopoverRootContext, useTriggerPopoverRootContextOptional as unstable_useTriggerPopoverRootContextOptional, useTriggerPopoverScopeContext as unstable_useTriggerPopoverScopeContext, useTriggerPopoverScopeContextOptional as unstable_useTriggerPopoverScopeContextOptional, useTriggerPopoverTriggers as unstable_useTriggerPopoverTriggers, useTriggerPopoverTriggersOptional as unstable_useTriggerPopoverTriggersOptional, useAssistantContext, useAssistantDataUI, useAssistantFrameHost, useAssistantInstructions, useAssistantInteractable, useAssistantRuntime, useAssistantTool, useAssistantToolUI, useAssistantTransportRuntime, useAssistantTransportSendCommand, useAssistantTransportState, useAttachment, useAttachmentRuntime, useAui, useAuiEvent, useAuiState, useAuiToolOverrides, useCloudThreadListAdapter, useCloudThreadListRuntime, useComposer, useComposerRuntime, useEditComposer, useEditComposerAttachment, useEditComposerAttachmentRuntime, useExternalMessageConverter, useExternalStoreRuntime, useExternalStoreSharedOptions, useInlineRender, useInteractableState, useLocalRuntime, useMessage, useMessageAttachment, useMessageAttachmentRuntime, useMessagePart, useMessagePartData, useMessagePartFile, useMessagePartImage, useMessagePartReasoning, useMessagePartRuntime, useMessagePartSource, useMessagePartText, useMessageQuote, useMessageRuntime, useMessageTiming, useRemoteThreadListRuntime, useRuntimeAdapters, useScrollLock, useSmooth, useThread, useThreadComposer, useThreadComposerAttachment, useThreadComposerAttachmentRuntime, useThreadList, useThreadListItem, useThreadListItemRuntime, useThreadModelContext, useThreadRuntime, useThreadViewport, useThreadViewportAutoScroll, useThreadViewportStore, useToolArgsStatus, useToolCallElapsed, useVoiceControls, useVoiceState, useVoiceVolume };
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","names":[],"sources":["../src/internal.ts"],"sourcesContent":["// Re-export from @assistant-ui/core\nexport type {\n ThreadRuntimeCore,\n ThreadListRuntimeCore,\n} from \"@assistant-ui/core\";\n\n// Re-export from @assistant-ui/core/internal\nexport {\n DefaultThreadComposerRuntimeCore,\n CompositeContextProvider,\n MessageRepository,\n BaseAssistantRuntimeCore,\n generateId,\n AssistantRuntimeImpl,\n ThreadRuntimeImpl,\n fromThreadMessageLike,\n getAutoStatus,\n} from \"@assistant-ui/core/internal\";\nexport type {\n ThreadRuntimeCoreBinding,\n ThreadListItemRuntimeBinding,\n} from \"@assistant-ui/core/internal\";\n\n// React-specific (stay in react)\nexport { splitLocalRuntimeOptions } from \"./legacy-runtime/runtime-cores/local/LocalRuntimeOptions\";\nexport type { ToolExecutionStatus } from \"@assistant-ui/core\";\n\nexport { useSmooth } from \"./utils/smooth/useSmooth\";\nexport {\n useSmoothStatus,\n withSmoothContextProvider,\n} from \"./utils/smooth/SmoothContext\";\n\n// ComposerInput plugin registry (used by react-lexical)\nexport { useComposerInputPluginRegistryOptional } from \"./primitives/composer/ComposerInputPluginContext\";\n"],"mappings":""}
1
+ {"version":3,"file":"internal.js","names":["ThreadRuntimeCore","ThreadListRuntimeCore","DefaultThreadComposerRuntimeCore","CompositeContextProvider","MessageRepository","BaseAssistantRuntimeCore","generateId","AssistantRuntimeImpl","ThreadRuntimeImpl","fromThreadMessageLike","getAutoStatus","ThreadRuntimeCoreBinding","ThreadListItemRuntimeBinding","splitLocalRuntimeOptions","ToolExecutionStatus","useSmooth","useSmoothStatus","withSmoothContextProvider","useComposerInputPluginRegistryOptional"],"sources":["../src/internal.ts"],"sourcesContent":["// Re-export from @assistant-ui/core\nexport type {\n ThreadRuntimeCore,\n ThreadListRuntimeCore,\n} from \"@assistant-ui/core\";\n\n// Re-export from @assistant-ui/core/internal\nexport {\n DefaultThreadComposerRuntimeCore,\n CompositeContextProvider,\n MessageRepository,\n BaseAssistantRuntimeCore,\n generateId,\n AssistantRuntimeImpl,\n ThreadRuntimeImpl,\n fromThreadMessageLike,\n getAutoStatus,\n} from \"@assistant-ui/core/internal\";\nexport type {\n ThreadRuntimeCoreBinding,\n ThreadListItemRuntimeBinding,\n} from \"@assistant-ui/core/internal\";\n\n// React-specific (stay in react)\nexport { splitLocalRuntimeOptions } from \"./legacy-runtime/runtime-cores/local/LocalRuntimeOptions\";\nexport type { ToolExecutionStatus } from \"@assistant-ui/core\";\n\nexport { useSmooth } from \"./utils/smooth/useSmooth\";\nexport {\n useSmoothStatus,\n withSmoothContextProvider,\n} from \"./utils/smooth/SmoothContext\";\n\n// ComposerInput plugin registry (used by react-lexical)\nexport { useComposerInputPluginRegistryOptional } from \"./primitives/composer/ComposerInputPluginContext\";\n"],"mappings":""}
@@ -2,24 +2,60 @@
2
2
  import { ThreadPrimitiveViewportProvider } from "../context/providers/ThreadViewportProvider.js";
3
3
  import { DevToolsProviderApi } from "../devtools/DevToolsHooks.js";
4
4
  import { useAui } from "@assistant-ui/store";
5
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
5
6
  import { AssistantProviderBase } from "@assistant-ui/core/react";
6
7
  import { memo, useEffect } from "@assistant-ui/tap/react-shim";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  //#region src/legacy-runtime/AssistantRuntimeProvider.tsx
9
10
  const DevToolsRegistration = () => {
11
+ const $ = c(3);
10
12
  const aui = useAui();
11
- useEffect(() => {
12
- if (typeof process === "undefined" || process.env.NODE_ENV === "production") return;
13
- return DevToolsProviderApi.register(aui);
14
- }, [aui]);
13
+ let t0;
14
+ let t1;
15
+ if ($[0] !== aui) {
16
+ t0 = () => {
17
+ if (typeof process === "undefined" || process.env.NODE_ENV === "production") return;
18
+ return DevToolsProviderApi.register(aui);
19
+ };
20
+ t1 = [aui];
21
+ $[0] = aui;
22
+ $[1] = t0;
23
+ $[2] = t1;
24
+ } else {
25
+ t0 = $[1];
26
+ t1 = $[2];
27
+ }
28
+ useEffect(t0, t1);
15
29
  return null;
16
30
  };
17
- const AssistantRuntimeProviderImpl = ({ children, aui, runtime }) => {
18
- return /* @__PURE__ */ jsxs(AssistantProviderBase, {
19
- runtime,
20
- aui: aui ?? null,
21
- children: [/* @__PURE__ */ jsx(DevToolsRegistration, {}), /* @__PURE__ */ jsx(ThreadPrimitiveViewportProvider, { children })]
22
- });
31
+ const AssistantRuntimeProviderImpl = (t0) => {
32
+ const $ = c(7);
33
+ const { children, aui, runtime } = t0;
34
+ const t1 = aui ?? null;
35
+ let t2;
36
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
37
+ t2 = /* @__PURE__ */ jsx(DevToolsRegistration, {});
38
+ $[0] = t2;
39
+ } else t2 = $[0];
40
+ let t3;
41
+ if ($[1] !== children) {
42
+ t3 = /* @__PURE__ */ jsx(ThreadPrimitiveViewportProvider, { children });
43
+ $[1] = children;
44
+ $[2] = t3;
45
+ } else t3 = $[2];
46
+ let t4;
47
+ if ($[3] !== runtime || $[4] !== t1 || $[5] !== t3) {
48
+ t4 = /* @__PURE__ */ jsxs(AssistantProviderBase, {
49
+ runtime,
50
+ aui: t1,
51
+ children: [t2, t3]
52
+ });
53
+ $[3] = runtime;
54
+ $[4] = t1;
55
+ $[5] = t3;
56
+ $[6] = t4;
57
+ } else t4 = $[6];
58
+ return t4;
23
59
  };
24
60
  const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);
25
61
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantRuntimeProvider.js","names":[],"sources":["../../src/legacy-runtime/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, memo, type PropsWithChildren, useEffect } from \"react\";\nimport { type AssistantClient, useAui } from \"@assistant-ui/store\";\nimport type { AssistantRuntime } from \"./runtime/AssistantRuntime\";\nimport { AssistantProviderBase } from \"@assistant-ui/core/react\";\nimport { ThreadPrimitiveViewportProvider } from \"../context/providers/ThreadViewportProvider\";\nimport { DevToolsProviderApi } from \"../devtools/DevToolsHooks\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The assistant runtime to expose to descendants. Build one with\n * `useLocalRuntime`, `useExternalStoreRuntime`, or\n * `useAssistantTransportRuntime`.\n */\n runtime: AssistantRuntime;\n\n /**\n * Optional parent `AssistantClient` whose scopes are inherited by the\n * client created for this runtime. Use this when nesting an\n * `AssistantRuntimeProvider` inside another assistant context. Omit this\n * prop when there is no parent client.\n * @defaultValue undefined\n */\n aui?: AssistantClient;\n }>;\n}\n\nconst DevToolsRegistration: FC = () => {\n const aui = useAui();\n useEffect(() => {\n if (typeof process === \"undefined\" || process.env.NODE_ENV === \"production\")\n return;\n return DevToolsProviderApi.register(aui);\n }, [aui]);\n return null;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, aui, runtime }) => {\n return (\n <AssistantProviderBase runtime={runtime} aui={aui ?? null}>\n <DevToolsRegistration />\n {/* TODO temporarily allow accessing viewport state from outside the viewport */}\n {/* TODO figure out if this behavior should be deprecated, since it is quite hacky */}\n <ThreadPrimitiveViewportProvider>\n {children}\n </ThreadPrimitiveViewportProvider>\n </AssistantProviderBase>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;;;;;;AA6BA,MAAM,6BAAiC;CACrC,MAAM,MAAM,OAAO;CACnB,gBAAgB;EACd,IAAI,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa,cAC7D;EACF,OAAO,oBAAoB,SAAS,GAAG;CACzC,GAAG,CAAC,GAAG,CAAC;CACR,OAAO;AACT;AAEA,MAAa,gCAER,EAAE,UAAU,KAAK,cAAc;CAClC,OACE,qBAAC,uBAAD;EAAgC;EAAS,KAAK,OAAO;YAArD,CACE,oBAAC,sBAAD,CAAuB,CAAA,GAGvB,oBAAC,iCAAD,EACG,SAC8B,CAAA,CACZ;;AAE3B;AAEA,MAAa,2BAA2B,KAAK,4BAA4B"}
1
+ {"version":3,"file":"AssistantRuntimeProvider.js","names":["c","_c","FC","memo","PropsWithChildren","useEffect","AssistantClient","useAui","AssistantRuntime","AssistantProviderBase","ThreadPrimitiveViewportProvider","DevToolsProviderApi","AssistantRuntimeProvider","Props","runtime","aui","DevToolsRegistration","$","t0","t1","process","env","NODE_ENV","register","AssistantRuntimeProviderImpl","children","t2","Symbol","for","t3","t4"],"sources":["../../src/legacy-runtime/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, memo, type PropsWithChildren, useEffect } from \"react\";\nimport { type AssistantClient, useAui } from \"@assistant-ui/store\";\nimport type { AssistantRuntime } from \"./runtime/AssistantRuntime\";\nimport { AssistantProviderBase } from \"@assistant-ui/core/react\";\nimport { ThreadPrimitiveViewportProvider } from \"../context/providers/ThreadViewportProvider\";\nimport { DevToolsProviderApi } from \"../devtools/DevToolsHooks\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The assistant runtime to expose to descendants. Build one with\n * `useLocalRuntime`, `useExternalStoreRuntime`, or\n * `useAssistantTransportRuntime`.\n */\n runtime: AssistantRuntime;\n\n /**\n * Optional parent `AssistantClient` whose scopes are inherited by the\n * client created for this runtime. Use this when nesting an\n * `AssistantRuntimeProvider` inside another assistant context. Omit this\n * prop when there is no parent client.\n * @defaultValue undefined\n */\n aui?: AssistantClient;\n }>;\n}\n\nconst DevToolsRegistration: FC = () => {\n const aui = useAui();\n useEffect(() => {\n if (typeof process === \"undefined\" || process.env.NODE_ENV === \"production\")\n return;\n return DevToolsProviderApi.register(aui);\n }, [aui]);\n return null;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, aui, runtime }) => {\n return (\n <AssistantProviderBase runtime={runtime} aui={aui ?? null}>\n <DevToolsRegistration />\n {/* TODO temporarily allow accessing viewport state from outside the viewport */}\n {/* TODO figure out if this behavior should be deprecated, since it is quite hacky */}\n <ThreadPrimitiveViewportProvider>\n {children}\n </ThreadPrimitiveViewportProvider>\n </AssistantProviderBase>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;;;;;;;AA6BA,MAAMgB,6BAA2B;CAAA,MAAAC,IAAAhB,EAAA,CAAA;CAC/B,MAAAc,MAAYR,OAAO;CAAE,IAAAW;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAF,KAAA;EACXG,WAAA;GACR,IAAI,OAAOE,YAAY,eAAeA,QAAOC,IAAIC,aAAc,cAAY;GAClE,OACFX,oBAAmBY,SAAUR,GAAG;EAAC;EACvCI,KAAA,CAACJ,GAAG;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAA;EAAAD,KAAAD,EAAA;EAAAE,KAAAF,EAAA;CAAA;CAJRZ,UAAUa,IAIPC,EAAK;CAAC,OACF;AAAI;AAGb,MAAaK,gCAETN,OAAA;CAAA,MAAAD,IAAAhB,EAAA,CAAA;CAAC,MAAA,EAAAwB,UAAAV,KAAAD,YAAAI;CAE6C,MAAAC,KAAAJ,OAAA;CAAW,IAAAW;CAAA,IAAAT,EAAA,OAAAU,OAAAC,IAAA,2BAAA,GAAA;EACvDF,KAAA,oBAAC,sBAAD,CAAqB,CAAA;EAAGT,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAQ,UAAA;EAGxBI,KAAA,oBAAC,iCAAD,EACGJ,SAD6B,CAAA;EAEER,EAAA,KAAAQ;EAAAR,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAH,WAAAG,EAAA,OAAAE,MAAAF,EAAA,OAAAY,IAAA;EANpCC,KAAA,qBAAC,uBAAD;GAAgChB;GAAc,KAAAK;aAA9C,CACEO,IAGAG,EAJoB;;EAOEZ,EAAA,KAAAH;EAAAG,EAAA,KAAAE;EAAAF,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAPxBa;AAOwB;AAI5B,MAAalB,2BAA2BT,KAAKqB,4BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"auiV0.js","names":["unhandledType"],"sources":["../../../src/legacy-runtime/cloud/auiV0.ts"],"sourcesContent":["import type {\n MessageStatus,\n SourceProviderMetadata,\n ThreadMessage,\n} from \"@assistant-ui/core\";\nimport { fromThreadMessageLike } from \"../runtime-cores/external-store/ThreadMessageLike\";\nimport type { CloudMessage } from \"assistant-cloud\";\nimport { isJSONValue } from \"../../utils/json/is-json\";\nimport type {\n ReadonlyJSONObject,\n ReadonlyJSONValue,\n} from \"assistant-stream/utils\";\nimport type { ExportedMessageRepositoryItem } from \"../runtime-cores/utils/MessageRepository\";\n\ntype AuiV0MessagePart =\n | {\n readonly type: \"text\";\n readonly text: string;\n }\n | {\n readonly type: \"reasoning\";\n readonly text: string;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"url\";\n readonly id: string;\n readonly url: string;\n readonly title?: string;\n readonly providerMetadata?: SourceProviderMetadata;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"document\";\n readonly id: string;\n readonly title: string;\n readonly mediaType: string;\n readonly filename?: string;\n readonly providerMetadata?: SourceProviderMetadata;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: ReadonlyJSONObject;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly argsText: string;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n }\n | {\n readonly type: \"image\";\n readonly image: string;\n }\n | {\n readonly type: \"file\";\n readonly data: string;\n readonly mimeType: string;\n readonly filename?: string;\n };\n\ntype AuiV0Message = {\n readonly role: \"assistant\" | \"user\" | \"system\";\n readonly status?: MessageStatus;\n readonly content: readonly AuiV0MessagePart[];\n readonly metadata: {\n readonly unstable_state?: ReadonlyJSONValue;\n readonly unstable_annotations: readonly ReadonlyJSONValue[];\n readonly unstable_data: readonly ReadonlyJSONValue[];\n readonly steps: readonly {\n readonly usage?: {\n readonly inputTokens: number;\n readonly outputTokens: number;\n };\n }[];\n readonly custom: ReadonlyJSONObject;\n };\n};\n\nexport function auiV0Encode(message: ThreadMessage): AuiV0Message {\n // TODO attachments are currently intentionally ignored\n // info: ID and createdAt are ignored (we use the server value instead)\n\n const status: MessageStatus | undefined =\n message.status?.type === \"running\"\n ? { type: \"incomplete\", reason: \"cancelled\" }\n : message.status;\n\n return {\n role: message.role,\n content: message.content.map((part) => {\n const type = part.type;\n switch (type) {\n case \"text\":\n return { type: \"text\", text: part.text };\n\n case \"reasoning\":\n return { type: \"reasoning\", text: part.text };\n\n case \"source\":\n if (part.sourceType === \"url\") {\n return {\n type: \"source\",\n sourceType: \"url\",\n id: part.id,\n url: part.url,\n ...(part.title != null ? { title: part.title } : undefined),\n ...(part.providerMetadata != null\n ? { providerMetadata: part.providerMetadata }\n : undefined),\n };\n }\n\n return {\n type: \"source\",\n sourceType: \"document\",\n id: part.id,\n title: part.title,\n mediaType: part.mediaType,\n ...(part.filename != null\n ? { filename: part.filename }\n : undefined),\n ...(part.providerMetadata != null\n ? { providerMetadata: part.providerMetadata }\n : undefined),\n };\n\n case \"tool-call\": {\n if (!isJSONValue(part.result)) {\n console.warn(\n `tool-call result is not JSON! ${JSON.stringify(part)}`,\n );\n }\n return {\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n ...(JSON.stringify(part.args) === part.argsText\n ? { args: part.args }\n : { argsText: part.argsText }),\n ...(part.result\n ? { result: part.result as ReadonlyJSONValue }\n : undefined),\n ...(part.isError ? { isError: true } : undefined),\n };\n }\n\n case \"image\":\n return { type: \"image\", image: part.image };\n\n case \"file\":\n return {\n type: \"file\",\n data: part.data,\n mimeType: part.mimeType,\n ...(part.filename ? { filename: part.filename } : undefined),\n };\n\n default: {\n const unhandledType: \"audio\" | \"data\" | \"generative-ui\" = type;\n throw new Error(\n `Message part type not supported by aui/v0: ${unhandledType}`,\n );\n }\n }\n }),\n metadata: message.metadata as AuiV0Message[\"metadata\"],\n ...(status ? { status } : undefined),\n };\n}\n\nexport function auiV0Decode(\n cloudMessage: CloudMessage & { format: \"aui/v0\" },\n): ExportedMessageRepositoryItem {\n const payload = cloudMessage.content as unknown as AuiV0Message;\n const message = fromThreadMessageLike(\n {\n id: cloudMessage.id,\n createdAt: cloudMessage.created_at,\n ...payload,\n },\n cloudMessage.id,\n { type: \"complete\", reason: \"unknown\" },\n );\n\n return {\n parentId: cloudMessage.parent_id,\n message,\n };\n}\n"],"mappings":";;;AAqFA,SAAgB,YAAY,SAAsC;CAIhE,MAAM,SACJ,QAAQ,QAAQ,SAAS,YACrB;EAAE,MAAM;EAAc,QAAQ;CAAY,IAC1C,QAAQ;CAEd,OAAO;EACL,MAAM,QAAQ;EACd,SAAS,QAAQ,QAAQ,KAAK,SAAS;GACrC,MAAM,OAAO,KAAK;GAClB,QAAQ,MAAR;IACE,KAAK,QACH,OAAO;KAAE,MAAM;KAAQ,MAAM,KAAK;IAAK;IAEzC,KAAK,aACH,OAAO;KAAE,MAAM;KAAa,MAAM,KAAK;IAAK;IAE9C,KAAK;KACH,IAAI,KAAK,eAAe,OACtB,OAAO;MACL,MAAM;MACN,YAAY;MACZ,IAAI,KAAK;MACT,KAAK,KAAK;MACV,GAAI,KAAK,SAAS,OAAO,EAAE,OAAO,KAAK,MAAM,IAAI,KAAA;MACjD,GAAI,KAAK,oBAAoB,OACzB,EAAE,kBAAkB,KAAK,iBAAiB,IAC1C,KAAA;KACN;KAGF,OAAO;MACL,MAAM;MACN,YAAY;MACZ,IAAI,KAAK;MACT,OAAO,KAAK;MACZ,WAAW,KAAK;MAChB,GAAI,KAAK,YAAY,OACjB,EAAE,UAAU,KAAK,SAAS,IAC1B,KAAA;MACJ,GAAI,KAAK,oBAAoB,OACzB,EAAE,kBAAkB,KAAK,iBAAiB,IAC1C,KAAA;KACN;IAEF,KAAK;KACH,IAAI,CAAC,YAAY,KAAK,MAAM,GAC1B,QAAQ,KACN,iCAAiC,KAAK,UAAU,IAAI,GACtD;KAEF,OAAO;MACL,MAAM;MACN,YAAY,KAAK;MACjB,UAAU,KAAK;MACf,GAAI,KAAK,UAAU,KAAK,IAAI,MAAM,KAAK,WACnC,EAAE,MAAM,KAAK,KAAK,IAClB,EAAE,UAAU,KAAK,SAAS;MAC9B,GAAI,KAAK,SACL,EAAE,QAAQ,KAAK,OAA4B,IAC3C,KAAA;MACJ,GAAI,KAAK,UAAU,EAAE,SAAS,KAAK,IAAI,KAAA;KACzC;IAGF,KAAK,SACH,OAAO;KAAE,MAAM;KAAS,OAAO,KAAK;IAAM;IAE5C,KAAK,QACH,OAAO;KACL,MAAM;KACN,MAAM,KAAK;KACX,UAAU,KAAK;KACf,GAAI,KAAK,WAAW,EAAE,UAAU,KAAK,SAAS,IAAI,KAAA;IACpD;IAEF,SAEE,MAAM,IAAI,MACR,8CAA8CA,MAChD;GAEJ;EACF,CAAC;EACD,UAAU,QAAQ;EAClB,GAAI,SAAS,EAAE,OAAO,IAAI,KAAA;CAC5B;AACF;AAEA,SAAgB,YACd,cAC+B;CAC/B,MAAM,UAAU,aAAa;CAC7B,MAAM,UAAU,sBACd;EACE,IAAI,aAAa;EACjB,WAAW,aAAa;EACxB,GAAG;CACL,GACA,aAAa,IACb;EAAE,MAAM;EAAY,QAAQ;CAAU,CACxC;CAEA,OAAO;EACL,UAAU,aAAa;EACvB;CACF;AACF"}
1
+ {"version":3,"file":"auiV0.js","names":["MessageStatus","SourceProviderMetadata","ThreadMessage","fromThreadMessageLike","CloudMessage","isJSONValue","ReadonlyJSONObject","ReadonlyJSONValue","ExportedMessageRepositoryItem","AuiV0MessagePart","type","text","sourceType","id","url","title","providerMetadata","mediaType","filename","toolCallId","toolName","args","result","isError","argsText","image","data","mimeType","AuiV0Message","role","status","content","metadata","unstable_state","unstable_annotations","unstable_data","steps","usage","inputTokens","outputTokens","custom","auiV0Encode","message","reason","map","part","undefined","console","warn","JSON","stringify","unhandledType","Error","auiV0Decode","cloudMessage","format","payload","createdAt","created_at","parentId","parent_id"],"sources":["../../../src/legacy-runtime/cloud/auiV0.ts"],"sourcesContent":["import type {\n MessageStatus,\n SourceProviderMetadata,\n ThreadMessage,\n} from \"@assistant-ui/core\";\nimport { fromThreadMessageLike } from \"../runtime-cores/external-store/ThreadMessageLike\";\nimport type { CloudMessage } from \"assistant-cloud\";\nimport { isJSONValue } from \"../../utils/json/is-json\";\nimport type {\n ReadonlyJSONObject,\n ReadonlyJSONValue,\n} from \"assistant-stream/utils\";\nimport type { ExportedMessageRepositoryItem } from \"../runtime-cores/utils/MessageRepository\";\n\ntype AuiV0MessagePart =\n | {\n readonly type: \"text\";\n readonly text: string;\n }\n | {\n readonly type: \"reasoning\";\n readonly text: string;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"url\";\n readonly id: string;\n readonly url: string;\n readonly title?: string;\n readonly providerMetadata?: SourceProviderMetadata;\n }\n | {\n readonly type: \"source\";\n readonly sourceType: \"document\";\n readonly id: string;\n readonly title: string;\n readonly mediaType: string;\n readonly filename?: string;\n readonly providerMetadata?: SourceProviderMetadata;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly args: ReadonlyJSONObject;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n }\n | {\n readonly type: \"tool-call\";\n readonly toolCallId: string;\n readonly toolName: string;\n readonly argsText: string;\n readonly result?: ReadonlyJSONValue;\n readonly isError?: true;\n }\n | {\n readonly type: \"image\";\n readonly image: string;\n }\n | {\n readonly type: \"file\";\n readonly data: string;\n readonly mimeType: string;\n readonly filename?: string;\n };\n\ntype AuiV0Message = {\n readonly role: \"assistant\" | \"user\" | \"system\";\n readonly status?: MessageStatus;\n readonly content: readonly AuiV0MessagePart[];\n readonly metadata: {\n readonly unstable_state?: ReadonlyJSONValue;\n readonly unstable_annotations: readonly ReadonlyJSONValue[];\n readonly unstable_data: readonly ReadonlyJSONValue[];\n readonly steps: readonly {\n readonly usage?: {\n readonly inputTokens: number;\n readonly outputTokens: number;\n };\n }[];\n readonly custom: ReadonlyJSONObject;\n };\n};\n\nexport function auiV0Encode(message: ThreadMessage): AuiV0Message {\n // TODO attachments are currently intentionally ignored\n // info: ID and createdAt are ignored (we use the server value instead)\n\n const status: MessageStatus | undefined =\n message.status?.type === \"running\"\n ? { type: \"incomplete\", reason: \"cancelled\" }\n : message.status;\n\n return {\n role: message.role,\n content: message.content.map((part) => {\n const type = part.type;\n switch (type) {\n case \"text\":\n return { type: \"text\", text: part.text };\n\n case \"reasoning\":\n return { type: \"reasoning\", text: part.text };\n\n case \"source\":\n if (part.sourceType === \"url\") {\n return {\n type: \"source\",\n sourceType: \"url\",\n id: part.id,\n url: part.url,\n ...(part.title != null ? { title: part.title } : undefined),\n ...(part.providerMetadata != null\n ? { providerMetadata: part.providerMetadata }\n : undefined),\n };\n }\n\n return {\n type: \"source\",\n sourceType: \"document\",\n id: part.id,\n title: part.title,\n mediaType: part.mediaType,\n ...(part.filename != null\n ? { filename: part.filename }\n : undefined),\n ...(part.providerMetadata != null\n ? { providerMetadata: part.providerMetadata }\n : undefined),\n };\n\n case \"tool-call\": {\n if (!isJSONValue(part.result)) {\n console.warn(\n `tool-call result is not JSON! ${JSON.stringify(part)}`,\n );\n }\n return {\n type: \"tool-call\",\n toolCallId: part.toolCallId,\n toolName: part.toolName,\n ...(JSON.stringify(part.args) === part.argsText\n ? { args: part.args }\n : { argsText: part.argsText }),\n ...(part.result\n ? { result: part.result as ReadonlyJSONValue }\n : undefined),\n ...(part.isError ? { isError: true } : undefined),\n };\n }\n\n case \"image\":\n return { type: \"image\", image: part.image };\n\n case \"file\":\n return {\n type: \"file\",\n data: part.data,\n mimeType: part.mimeType,\n ...(part.filename ? { filename: part.filename } : undefined),\n };\n\n default: {\n const unhandledType: \"audio\" | \"data\" | \"generative-ui\" = type;\n throw new Error(\n `Message part type not supported by aui/v0: ${unhandledType}`,\n );\n }\n }\n }),\n metadata: message.metadata as AuiV0Message[\"metadata\"],\n ...(status ? { status } : undefined),\n };\n}\n\nexport function auiV0Decode(\n cloudMessage: CloudMessage & { format: \"aui/v0\" },\n): ExportedMessageRepositoryItem {\n const payload = cloudMessage.content as unknown as AuiV0Message;\n const message = fromThreadMessageLike(\n {\n id: cloudMessage.id,\n createdAt: cloudMessage.created_at,\n ...payload,\n },\n cloudMessage.id,\n { type: \"complete\", reason: \"unknown\" },\n );\n\n return {\n parentId: cloudMessage.parent_id,\n message,\n };\n}\n"],"mappings":";;;AAqFA,SAAgByC,YAAYC,SAAsC;CAIhE,MAAMZ,SACJY,QAAQZ,QAAQpB,SAAS,YACrB;EAAEA,MAAM;EAAciC,QAAQ;CAAY,IAC1CD,QAAQZ;CAEd,OAAO;EACLD,MAAMa,QAAQb;EACdE,SAASW,QAAQX,QAAQa,KAAKC,SAAS;GACrC,MAAMnC,OAAOmC,KAAKnC;GAClB,QAAQA,MAAR;IACE,KAAK,QACH,OAAO;KAAEA,MAAM;KAAQC,MAAMkC,KAAKlC;IAAK;IAEzC,KAAK,aACH,OAAO;KAAED,MAAM;KAAaC,MAAMkC,KAAKlC;IAAK;IAE9C,KAAK;KACH,IAAIkC,KAAKjC,eAAe,OACtB,OAAO;MACLF,MAAM;MACNE,YAAY;MACZC,IAAIgC,KAAKhC;MACTC,KAAK+B,KAAK/B;MACV,GAAI+B,KAAK9B,SAAS,OAAO,EAAEA,OAAO8B,KAAK9B,MAAM,IAAI+B,KAAAA;MACjD,GAAID,KAAK7B,oBAAoB,OACzB,EAAEA,kBAAkB6B,KAAK7B,iBAAiB,IAC1C8B,KAAAA;KACN;KAGF,OAAO;MACLpC,MAAM;MACNE,YAAY;MACZC,IAAIgC,KAAKhC;MACTE,OAAO8B,KAAK9B;MACZE,WAAW4B,KAAK5B;MAChB,GAAI4B,KAAK3B,YAAY,OACjB,EAAEA,UAAU2B,KAAK3B,SAAS,IAC1B4B,KAAAA;MACJ,GAAID,KAAK7B,oBAAoB,OACzB,EAAEA,kBAAkB6B,KAAK7B,iBAAiB,IAC1C8B,KAAAA;KACN;IAEF,KAAK;KACH,IAAI,CAACzC,YAAYwC,KAAKvB,MAAM,GAC1ByB,QAAQC,KACN,iCAAiCC,KAAKC,UAAUL,IAAI,GACtD;KAEF,OAAO;MACLnC,MAAM;MACNS,YAAY0B,KAAK1B;MACjBC,UAAUyB,KAAKzB;MACf,GAAI6B,KAAKC,UAAUL,KAAKxB,IAAI,MAAMwB,KAAKrB,WACnC,EAAEH,MAAMwB,KAAKxB,KAAK,IAClB,EAAEG,UAAUqB,KAAKrB,SAAS;MAC9B,GAAIqB,KAAKvB,SACL,EAAEA,QAAQuB,KAAKvB,OAA4B,IAC3CwB,KAAAA;MACJ,GAAID,KAAKtB,UAAU,EAAEA,SAAS,KAAK,IAAIuB,KAAAA;KACzC;IAGF,KAAK,SACH,OAAO;KAAEpC,MAAM;KAASe,OAAOoB,KAAKpB;IAAM;IAE5C,KAAK,QACH,OAAO;KACLf,MAAM;KACNgB,MAAMmB,KAAKnB;KACXC,UAAUkB,KAAKlB;KACf,GAAIkB,KAAK3B,WAAW,EAAEA,UAAU2B,KAAK3B,SAAS,IAAI4B,KAAAA;IACpD;IAEF,SAEE,MAAM,IAAIM,MACR,8CAA8CD,MAChD;GAEJ;EACF,CAAC;EACDnB,UAAUU,QAAQV;EAClB,GAAIF,SAAS,EAAEA,OAAO,IAAIgB,KAAAA;CAC5B;AACF;AAEA,SAAgBO,YACdC,cAC+B;CAC/B,MAAME,UAAUF,aAAavB;CAC7B,MAAMW,UAAUvC,sBACd;EACEU,IAAIyC,aAAazC;EACjB4C,WAAWH,aAAaI;EACxB,GAAGF;CACL,GACAF,aAAazC,IACb;EAAEH,MAAM;EAAYiC,QAAQ;CAAU,CACxC;CAEA,OAAO;EACLgB,UAAUL,aAAaM;EACvBlB;CACF;AACF"}