@assistant-ui/react 0.15.30 → 0.15.32

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 (550) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +1 -2
  2. package/dist/adapters/OpenAIRealtimeVoiceAdapter.js +1 -2
  3. package/dist/assistant-transport.js +1 -2
  4. package/dist/cloud-renderer/CloudRendererHost.d.ts.map +1 -1
  5. package/dist/cloud-renderer/CloudRendererHost.js +2 -4
  6. package/dist/cloud-renderer/CloudRendererHost.js.map +1 -1
  7. package/dist/context/ReadonlyStore.js +1 -2
  8. package/dist/context/providers/AttachmentByIndexProvider.js +1 -2
  9. package/dist/context/providers/ChainOfThoughtByIndicesProvider.js +1 -2
  10. package/dist/context/providers/MessageByIndexProvider.js +1 -2
  11. package/dist/context/providers/MessageProvider.js +1 -2
  12. package/dist/context/providers/PartByIndexProvider.js +1 -2
  13. package/dist/context/providers/SuggestionByIndexProvider.js +1 -2
  14. package/dist/context/providers/TextMessagePartProvider.js +1 -2
  15. package/dist/context/providers/ThreadListItemProvider.js +1 -2
  16. package/dist/context/providers/ThreadViewportProvider.js +1 -2
  17. package/dist/context/react/ThreadViewportContext.js +1 -2
  18. package/dist/context/react/utils/createContextHook.js +1 -2
  19. package/dist/context/react/utils/createContextStoreHook.js +1 -2
  20. package/dist/context/stores/ThreadViewport.js +1 -2
  21. package/dist/devtools/DevToolsHooks.js +1 -2
  22. package/dist/hooks/useMessageQuote.js +1 -2
  23. package/dist/hooks/useMessageTiming.js +1 -2
  24. package/dist/hooks/useToolCallElapsed.js +1 -2
  25. package/dist/index.d.ts +9 -8
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +2 -9
  28. package/dist/internal.d.ts +1 -1
  29. package/dist/internal.d.ts.map +1 -1
  30. package/dist/internal.js +2 -3
  31. package/dist/internal.js.map +1 -1
  32. package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts +1 -1
  33. package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
  34. package/dist/legacy-runtime/AssistantRuntimeProvider.js +1 -2
  35. package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
  36. package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
  37. package/dist/mcp-apps/McpAppRenderer.js +3 -3
  38. package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
  39. package/dist/mcp-apps/McpAppsRemoteHost.js +1 -2
  40. package/dist/mcp-apps/app-frame.js +1 -2
  41. package/dist/mcp-apps/bridge.js +1 -2
  42. package/dist/mcp-apps/csp.js +1 -2
  43. package/dist/mcp-apps/types.js +1 -2
  44. package/dist/mcp-apps/utils.js +1 -2
  45. package/dist/model-context/frame/useAssistantFrameHost.js +1 -2
  46. package/dist/model-context/makeAssistantVisible.js +1 -2
  47. package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -1
  48. package/dist/primitives/actionBar/ActionBarCopy.js +1 -2
  49. package/dist/primitives/actionBar/ActionBarEdit.d.ts +1 -1
  50. package/dist/primitives/actionBar/ActionBarEdit.js +1 -2
  51. package/dist/primitives/actionBar/ActionBarExportMarkdown.d.ts +1 -1
  52. package/dist/primitives/actionBar/ActionBarExportMarkdown.js +1 -2
  53. package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +1 -1
  54. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +1 -2
  55. package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +1 -1
  56. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +1 -2
  57. package/dist/primitives/actionBar/ActionBarInteractionContext.js +1 -2
  58. package/dist/primitives/actionBar/ActionBarReload.d.ts +1 -1
  59. package/dist/primitives/actionBar/ActionBarReload.js +1 -2
  60. package/dist/primitives/actionBar/ActionBarRoot.d.ts +1 -1
  61. package/dist/primitives/actionBar/ActionBarRoot.js +1 -2
  62. package/dist/primitives/actionBar/ActionBarSpeak.d.ts +1 -1
  63. package/dist/primitives/actionBar/ActionBarSpeak.js +1 -2
  64. package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts +1 -1
  65. package/dist/primitives/actionBar/ActionBarStopSpeaking.js +1 -2
  66. package/dist/primitives/actionBar/useActionBarFloatStatus.js +1 -2
  67. package/dist/primitives/actionBar.js +1 -2
  68. package/dist/primitives/actionBarMore/ActionBarMoreContent.js +1 -2
  69. package/dist/primitives/actionBarMore/ActionBarMoreItem.js +1 -2
  70. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +1 -2
  71. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +1 -2
  72. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +1 -2
  73. package/dist/primitives/actionBarMore/scope.js +1 -2
  74. package/dist/primitives/actionBarMore.js +1 -2
  75. package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -2
  76. package/dist/primitives/assistantModal/AssistantModalContent.js +1 -2
  77. package/dist/primitives/assistantModal/AssistantModalRoot.js +1 -2
  78. package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -2
  79. package/dist/primitives/assistantModal/popoverRenderPrimitives.js +1 -2
  80. package/dist/primitives/assistantModal/scope.js +1 -2
  81. package/dist/primitives/assistantModal.js +1 -2
  82. package/dist/primitives/attachment/AttachmentName.js +1 -2
  83. package/dist/primitives/attachment/AttachmentRemove.d.ts +1 -1
  84. package/dist/primitives/attachment/AttachmentRemove.js +1 -2
  85. package/dist/primitives/attachment/AttachmentRoot.d.ts +1 -1
  86. package/dist/primitives/attachment/AttachmentRoot.js +1 -2
  87. package/dist/primitives/attachment/AttachmentThumb.d.ts +1 -1
  88. package/dist/primitives/attachment/AttachmentThumb.js +1 -2
  89. package/dist/primitives/attachment.js +1 -2
  90. package/dist/primitives/branchPicker/BranchPickerCount.js +1 -2
  91. package/dist/primitives/branchPicker/BranchPickerNext.d.ts +1 -1
  92. package/dist/primitives/branchPicker/BranchPickerNext.js +1 -2
  93. package/dist/primitives/branchPicker/BranchPickerNumber.js +1 -2
  94. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +1 -1
  95. package/dist/primitives/branchPicker/BranchPickerPrevious.js +1 -2
  96. package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +1 -1
  97. package/dist/primitives/branchPicker/BranchPickerRoot.js +1 -2
  98. package/dist/primitives/branchPicker.js +1 -2
  99. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts +6 -5
  100. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.d.ts.map +1 -1
  101. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +57 -20
  102. package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
  103. package/dist/primitives/chainOfThought/ChainOfThoughtParts.js +1 -2
  104. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.d.ts +1 -1
  105. package/dist/primitives/chainOfThought/ChainOfThoughtRoot.js +1 -2
  106. package/dist/primitives/chainOfThought.js +1 -2
  107. package/dist/primitives/composer/ComposerAddAttachment.d.ts +1 -1
  108. package/dist/primitives/composer/ComposerAddAttachment.js +1 -2
  109. package/dist/primitives/composer/ComposerAttachmentDropzone.js +1 -2
  110. package/dist/primitives/composer/ComposerAttachments.js +1 -2
  111. package/dist/primitives/composer/ComposerCancel.d.ts +1 -1
  112. package/dist/primitives/composer/ComposerCancel.js +1 -2
  113. package/dist/primitives/composer/ComposerCompactContext.js +1 -2
  114. package/dist/primitives/composer/ComposerDictate.d.ts +1 -1
  115. package/dist/primitives/composer/ComposerDictate.js +1 -2
  116. package/dist/primitives/composer/ComposerDictationTranscript.d.ts +1 -1
  117. package/dist/primitives/composer/ComposerDictationTranscript.js +1 -2
  118. package/dist/primitives/composer/ComposerIf.js +1 -2
  119. package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
  120. package/dist/primitives/composer/ComposerInput.js +4 -5
  121. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  122. package/dist/primitives/composer/ComposerInputPluginContext.js +1 -2
  123. package/dist/primitives/composer/ComposerQueue.js +1 -2
  124. package/dist/primitives/composer/ComposerQuote.d.ts +3 -3
  125. package/dist/primitives/composer/ComposerQuote.js +1 -2
  126. package/dist/primitives/composer/ComposerResume.d.ts +1 -1
  127. package/dist/primitives/composer/ComposerResume.js +1 -2
  128. package/dist/primitives/composer/ComposerRoot.d.ts +1 -1
  129. package/dist/primitives/composer/ComposerRoot.js +1 -2
  130. package/dist/primitives/composer/ComposerSend.d.ts +1 -1
  131. package/dist/primitives/composer/ComposerSend.js +1 -2
  132. package/dist/primitives/composer/ComposerStopDictation.d.ts +1 -1
  133. package/dist/primitives/composer/ComposerStopDictation.js +1 -2
  134. package/dist/primitives/composer/composerInputSelector.js +1 -2
  135. package/dist/primitives/composer/trigger/TriggerPopover.d.ts +1 -1
  136. package/dist/primitives/composer/trigger/TriggerPopover.js +1 -2
  137. package/dist/primitives/composer/trigger/TriggerPopoverAction.js +1 -2
  138. package/dist/primitives/composer/trigger/TriggerPopoverBack.d.ts +1 -1
  139. package/dist/primitives/composer/trigger/TriggerPopoverBack.js +1 -2
  140. package/dist/primitives/composer/trigger/TriggerPopoverCategories.d.ts +2 -2
  141. package/dist/primitives/composer/trigger/TriggerPopoverCategories.js +1 -2
  142. package/dist/primitives/composer/trigger/TriggerPopoverDirective.js +1 -2
  143. package/dist/primitives/composer/trigger/TriggerPopoverItems.d.ts +2 -2
  144. package/dist/primitives/composer/trigger/TriggerPopoverItems.js +1 -2
  145. package/dist/primitives/composer/trigger/TriggerPopoverResource.js +1 -2
  146. package/dist/primitives/composer/trigger/TriggerPopoverRootContext.js +1 -2
  147. package/dist/primitives/composer/trigger/detectTrigger.js +1 -2
  148. package/dist/primitives/composer/trigger/index.d.ts +1 -1
  149. package/dist/primitives/composer/trigger/index.js +1 -2
  150. package/dist/primitives/composer/trigger/matchesTriggerItemQuery.js +1 -2
  151. package/dist/primitives/composer/trigger/triggerDetectionResource.js +1 -2
  152. package/dist/primitives/composer/trigger/triggerKeyboardResource.js +1 -2
  153. package/dist/primitives/composer/trigger/triggerNavigationResource.js +1 -2
  154. package/dist/primitives/composer/trigger/triggerSelectionResource.d.ts.map +1 -1
  155. package/dist/primitives/composer/trigger/triggerSelectionResource.js +3 -4
  156. package/dist/primitives/composer/trigger/triggerSelectionResource.js.map +1 -1
  157. package/dist/primitives/composer/useComposerCancelWithFocus.js +1 -2
  158. package/dist/primitives/composer/useComposerInputState.js +1 -2
  159. package/dist/primitives/composer.js +1 -2
  160. package/dist/primitives/dropdownMenuRenderPrimitives.js +1 -2
  161. package/dist/primitives/error/ErrorMessage.d.ts +1 -1
  162. package/dist/primitives/error/ErrorMessage.js +1 -2
  163. package/dist/primitives/error/ErrorRoot.d.ts +1 -1
  164. package/dist/primitives/error/ErrorRoot.js +1 -2
  165. package/dist/primitives/error.js +1 -2
  166. package/dist/primitives/message/MessageAttachments.js +1 -2
  167. package/dist/primitives/message/MessageError.js +1 -2
  168. package/dist/primitives/message/MessageIf.js +1 -2
  169. package/dist/primitives/message/MessageParts.js +1 -2
  170. package/dist/primitives/message/MessagePartsGrouped.js +1 -2
  171. package/dist/primitives/message/MessageRoot.d.ts +1 -1
  172. package/dist/primitives/message/MessageRoot.js +1 -2
  173. package/dist/primitives/message.js +1 -2
  174. package/dist/primitives/messagePart/MessagePartImage.d.ts +1 -1
  175. package/dist/primitives/messagePart/MessagePartImage.js +1 -2
  176. package/dist/primitives/messagePart/MessagePartInProgress.js +1 -2
  177. package/dist/primitives/messagePart/MessagePartText.d.ts +1 -1
  178. package/dist/primitives/messagePart/MessagePartText.js +1 -2
  179. package/dist/primitives/messagePart/useMessagePartData.js +1 -2
  180. package/dist/primitives/messagePart/useMessagePartFile.js +1 -2
  181. package/dist/primitives/messagePart/useMessagePartImage.js +1 -2
  182. package/dist/primitives/messagePart/useMessagePartReasoning.js +1 -2
  183. package/dist/primitives/messagePart/useMessagePartSource.js +1 -2
  184. package/dist/primitives/messagePart/useMessagePartText.js +1 -2
  185. package/dist/primitives/messagePart.js +1 -2
  186. package/dist/primitives/queueItem/QueueItemRemove.d.ts +1 -1
  187. package/dist/primitives/queueItem/QueueItemRemove.js +1 -2
  188. package/dist/primitives/queueItem/QueueItemSteer.d.ts +1 -1
  189. package/dist/primitives/queueItem/QueueItemSteer.js +1 -2
  190. package/dist/primitives/queueItem/QueueItemText.d.ts +1 -1
  191. package/dist/primitives/queueItem/QueueItemText.js +1 -2
  192. package/dist/primitives/queueItem.js +1 -2
  193. package/dist/primitives/reasoning/useScrollLock.d.ts.map +1 -1
  194. package/dist/primitives/reasoning/useScrollLock.js +41 -25
  195. package/dist/primitives/reasoning/useScrollLock.js.map +1 -1
  196. package/dist/primitives/selectionToolbar/SelectionToolbarQuote.d.ts +1 -1
  197. package/dist/primitives/selectionToolbar/SelectionToolbarQuote.js +1 -2
  198. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts +1 -1
  199. package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +1 -2
  200. package/dist/primitives/selectionToolbar.js +1 -2
  201. package/dist/primitives/suggestion/SuggestionDescription.d.ts +1 -1
  202. package/dist/primitives/suggestion/SuggestionDescription.js +1 -2
  203. package/dist/primitives/suggestion/SuggestionTitle.d.ts +1 -1
  204. package/dist/primitives/suggestion/SuggestionTitle.js +1 -2
  205. package/dist/primitives/suggestion/SuggestionTrigger.d.ts +1 -1
  206. package/dist/primitives/suggestion/SuggestionTrigger.js +1 -2
  207. package/dist/primitives/suggestion.js +1 -2
  208. package/dist/primitives/thread/ThreadEmpty.js +1 -2
  209. package/dist/primitives/thread/ThreadIf.js +1 -2
  210. package/dist/primitives/thread/ThreadLoadEarlier.d.ts +1 -1
  211. package/dist/primitives/thread/ThreadLoadEarlier.js +1 -2
  212. package/dist/primitives/thread/ThreadMessages.js +1 -2
  213. package/dist/primitives/thread/ThreadRoot.d.ts +1 -1
  214. package/dist/primitives/thread/ThreadRoot.js +1 -2
  215. package/dist/primitives/thread/ThreadRootElementContext.js +1 -2
  216. package/dist/primitives/thread/ThreadScrollToBottom.d.ts +1 -1
  217. package/dist/primitives/thread/ThreadScrollToBottom.js +1 -2
  218. package/dist/primitives/thread/ThreadSuggestion.d.ts +1 -1
  219. package/dist/primitives/thread/ThreadSuggestion.js +1 -2
  220. package/dist/primitives/thread/ThreadSuggestions.js +1 -2
  221. package/dist/primitives/thread/ThreadViewport.d.ts +1 -1
  222. package/dist/primitives/thread/ThreadViewport.js +1 -2
  223. package/dist/primitives/thread/ThreadViewportFooter.d.ts +1 -1
  224. package/dist/primitives/thread/ThreadViewportFooter.js +1 -2
  225. package/dist/primitives/thread/topAnchor/computeTopAnchorSlack.js +1 -2
  226. package/dist/primitives/thread/topAnchor/createReserveObservers.js +1 -2
  227. package/dist/primitives/thread/topAnchor/mountTopAnchorReserve.js +1 -2
  228. package/dist/primitives/thread/topAnchor/topAnchorTurn.js +1 -2
  229. package/dist/primitives/thread/topAnchor/topAnchorUtils.js +1 -2
  230. package/dist/primitives/thread/topAnchor/useTopAnchorReserve.js +1 -2
  231. package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
  232. package/dist/primitives/thread/useThreadViewportAutoScroll.js +7 -5
  233. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  234. package/dist/primitives/thread.js +1 -2
  235. package/dist/primitives/threadList/ThreadListItems.js +1 -2
  236. package/dist/primitives/threadList/ThreadListLoadMore.d.ts +1 -1
  237. package/dist/primitives/threadList/ThreadListLoadMore.js +1 -2
  238. package/dist/primitives/threadList/ThreadListNew.d.ts +1 -1
  239. package/dist/primitives/threadList/ThreadListNew.js +1 -2
  240. package/dist/primitives/threadList/ThreadListRoot.d.ts +1 -1
  241. package/dist/primitives/threadList/ThreadListRoot.js +1 -2
  242. package/dist/primitives/threadList.js +1 -2
  243. package/dist/primitives/threadListFocusGroup.d.ts +1 -1
  244. package/dist/primitives/threadListFocusGroup.d.ts.map +1 -1
  245. package/dist/primitives/threadListFocusGroup.js +1 -2
  246. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +1 -1
  247. package/dist/primitives/threadListItem/ThreadListItemArchive.js +1 -2
  248. package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +1 -1
  249. package/dist/primitives/threadListItem/ThreadListItemDelete.js +1 -2
  250. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +1 -1
  251. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -1
  252. package/dist/primitives/threadListItem/ThreadListItemRoot.js +2 -3
  253. package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
  254. package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -2
  255. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +1 -1
  256. package/dist/primitives/threadListItem/ThreadListItemTrigger.js +1 -2
  257. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +2 -2
  258. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
  259. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +3 -4
  260. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
  261. package/dist/primitives/threadListItem.js +1 -2
  262. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +1 -2
  263. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +1 -2
  264. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js +1 -2
  265. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +1 -2
  266. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +1 -2
  267. package/dist/primitives/threadListItemMore/scope.js +1 -2
  268. package/dist/primitives/threadListItemMore.js +1 -2
  269. package/dist/sandbox-host/SandboxHost.js +1 -2
  270. package/dist/unstable/useComposerInput.js +2 -3
  271. package/dist/unstable/useComposerInput.js.map +1 -1
  272. package/dist/unstable/useComposerInputHistory.d.ts.map +1 -1
  273. package/dist/unstable/useComposerInputHistory.js +3 -4
  274. package/dist/unstable/useComposerInputHistory.js.map +1 -1
  275. package/dist/unstable/useLiveCompletionAdapter.d.ts.map +1 -1
  276. package/dist/unstable/useLiveCompletionAdapter.js +4 -4
  277. package/dist/unstable/useLiveCompletionAdapter.js.map +1 -1
  278. package/dist/unstable/useMentionAdapter.js +1 -2
  279. package/dist/unstable/useMessageStallDetection.js +1 -2
  280. package/dist/unstable/useModelContextSnapshot.js +1 -2
  281. package/dist/unstable/useSlashCommandAdapter.js +1 -2
  282. package/dist/unstable/webmcp/WebMcpRegistrationResource.js +1 -2
  283. package/dist/unstable/webmcp/convertTools.js +1 -2
  284. package/dist/unstable/webmcp/useWebMcpProvider.js +1 -2
  285. package/dist/unstable/webmcp/webmcp-host.js +1 -2
  286. package/dist/utils/Primitive.d.ts +17 -17
  287. package/dist/utils/Primitive.js +1 -2
  288. package/dist/utils/createActionButton.d.ts +1 -1
  289. package/dist/utils/createActionButton.js +1 -2
  290. package/dist/utils/getSelectionMessageId.js +1 -2
  291. package/dist/utils/hooks/useManagedRef.js +1 -2
  292. package/dist/utils/hooks/useMediaQuery.js +1 -2
  293. package/dist/utils/hooks/useOnScrollToBottom.js +1 -2
  294. package/dist/utils/hooks/useSizeHandle.js +1 -2
  295. package/dist/utils/isCompositionKey.js +1 -2
  296. package/dist/utils/smooth/SmoothContext.js +1 -2
  297. package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
  298. package/dist/utils/smooth/useSmooth.js +11 -4
  299. package/dist/utils/smooth/useSmooth.js.map +1 -1
  300. package/dist/utils/useIsomorphicLayoutEffect.js +0 -1
  301. package/package.json +13 -13
  302. package/src/adapters/OpenAIRealtimeVoiceAdapter.test.ts +14 -1
  303. package/src/cloud-renderer/CloudRendererHost.tsx +4 -2
  304. package/src/index.ts +9 -8
  305. package/src/internal.ts +1 -1
  306. package/src/legacy-runtime/AssistantRuntimeProvider.tsx +1 -1
  307. package/src/mcp-apps/McpAppRenderer.composer.test.tsx +111 -0
  308. package/src/mcp-apps/McpAppRenderer.test.tsx +24 -23
  309. package/src/mcp-apps/McpAppRenderer.tsx +9 -1
  310. package/src/primitives/actionBar/ActionBarCopy.test.tsx +57 -0
  311. package/src/primitives/actionBar/ActionBarExportMarkdown.test.tsx +24 -5
  312. package/src/primitives/assistantModal/AssistantModalRoot.test.tsx +1 -1
  313. package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.test.tsx +91 -0
  314. package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.tsx +54 -0
  315. package/src/primitives/composer/ComposerInput.focus-on-run-start.test.tsx +1 -1
  316. package/src/primitives/composer/ComposerInput.test.tsx +1 -0
  317. package/src/primitives/composer/ComposerInput.text-change.test.tsx +68 -0
  318. package/src/primitives/composer/ComposerInput.thread-scope.test.tsx +82 -0
  319. package/src/primitives/composer/ComposerInput.tsx +4 -3
  320. package/src/primitives/composer/trigger/triggerSelectionResource.test.ts +6 -4
  321. package/src/primitives/composer/trigger/triggerSelectionResource.ts +2 -0
  322. package/src/primitives/reasoning/useScrollLock.test.tsx +71 -2
  323. package/src/primitives/reasoning/useScrollLock.ts +78 -51
  324. package/src/primitives/thread/ThreadRoot.test.tsx +1 -1
  325. package/src/primitives/thread/ThreadViewport.thread-scope.test.tsx +51 -0
  326. package/src/primitives/thread/useThreadViewportAutoScroll.ts +8 -2
  327. package/src/primitives/threadListItem/ThreadListItemRoot.tsx +4 -1
  328. package/src/primitives/threadListItem/ThreadListItemUnarchive.test.tsx +52 -0
  329. package/src/primitives/threadListItem/ThreadListItemUnarchive.ts +2 -2
  330. package/src/primitives/threadListItem/ThreadListKeyboardNav.test.tsx +25 -0
  331. package/src/tests/DataRenderers.test.tsx +1 -1
  332. package/src/tests/MessageParts.loading.test.tsx +1 -1
  333. package/src/tests/RemoteThreadListRuntime.adapterProvider.test.tsx +1 -1
  334. package/src/tests/RemoteThreadListRuntime.deferredProvider.test.tsx +4 -2
  335. package/src/tests/RemoteThreadListRuntime.reloadMainThread.test.tsx +4 -2
  336. package/src/tests/generative-ui.primitive.test.tsx +1 -1
  337. package/src/tests/local-runtime-queue.test.tsx +2 -2
  338. package/src/tests/messagePartSwitchRace.test.tsx +2 -2
  339. package/src/tests/messagePartTypeMismatch.test.tsx +1 -1
  340. package/src/tests/threadListItemIsRunning.test.tsx +5 -3
  341. package/src/tests/toolCallTiming.test.tsx +1 -1
  342. package/src/unstable/useComposerInput.test.tsx +1 -1
  343. package/src/unstable/useComposerInput.ts +1 -1
  344. package/src/unstable/useComposerInputHistory.test.tsx +10 -7
  345. package/src/unstable/useComposerInputHistory.thread-scope.test.tsx +123 -0
  346. package/src/unstable/useComposerInputHistory.ts +3 -2
  347. package/src/unstable/useLiveCompletionAdapter.test.tsx +44 -0
  348. package/src/unstable/useLiveCompletionAdapter.ts +3 -2
  349. package/src/unstable/webmcp/convertTools.test.ts +11 -1
  350. package/src/utils/hooks/useMediaQuery.test.tsx +35 -0
  351. package/src/utils/smooth/useSmooth.test.tsx +150 -14
  352. package/src/utils/smooth/useSmooth.ts +16 -2
  353. package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts +0 -2
  354. package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +0 -1
  355. package/dist/context/providers/ChainOfThoughtPartByIndexProvider.js +0 -3
  356. package/dist/legacy-runtime/RuntimeAdapter.d.ts +0 -2
  357. package/dist/legacy-runtime/RuntimeAdapter.d.ts.map +0 -1
  358. package/dist/legacy-runtime/RuntimeAdapter.js +0 -2
  359. package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts +0 -2
  360. package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +0 -1
  361. package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js +0 -3
  362. package/dist/legacy-runtime/runtime/AssistantRuntime.d.ts +0 -3
  363. package/dist/legacy-runtime/runtime/AssistantRuntime.d.ts.map +0 -1
  364. package/dist/legacy-runtime/runtime/AssistantRuntime.js +0 -2
  365. package/dist/legacy-runtime/runtime/AttachmentRuntime.d.ts +0 -3
  366. package/dist/legacy-runtime/runtime/AttachmentRuntime.d.ts.map +0 -1
  367. package/dist/legacy-runtime/runtime/AttachmentRuntime.js +0 -2
  368. package/dist/legacy-runtime/runtime/ComposerRuntime.d.ts +0 -4
  369. package/dist/legacy-runtime/runtime/ComposerRuntime.d.ts.map +0 -1
  370. package/dist/legacy-runtime/runtime/ComposerRuntime.js +0 -2
  371. package/dist/legacy-runtime/runtime/RuntimeBindings.d.ts +0 -3
  372. package/dist/legacy-runtime/runtime/RuntimeBindings.d.ts.map +0 -1
  373. package/dist/legacy-runtime/runtime/RuntimeBindings.js +0 -0
  374. package/dist/legacy-runtime/runtime/RuntimePathTypes.d.ts +0 -2
  375. package/dist/legacy-runtime/runtime/RuntimePathTypes.d.ts.map +0 -1
  376. package/dist/legacy-runtime/runtime/RuntimePathTypes.js +0 -0
  377. package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts +0 -5
  378. package/dist/legacy-runtime/runtime/ThreadListItemRuntime.d.ts.map +0 -1
  379. package/dist/legacy-runtime/runtime/ThreadListItemRuntime.js +0 -2
  380. package/dist/legacy-runtime/runtime/ThreadRuntime.d.ts +0 -4
  381. package/dist/legacy-runtime/runtime/ThreadRuntime.d.ts.map +0 -1
  382. package/dist/legacy-runtime/runtime/ThreadRuntime.js +0 -2
  383. package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.d.ts +0 -2
  384. package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.d.ts.map +0 -1
  385. package/dist/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.js +0 -3
  386. package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.d.ts +0 -2
  387. package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.d.ts.map +0 -1
  388. package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js +0 -3
  389. package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.d.ts +0 -2
  390. package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.d.ts.map +0 -1
  391. package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js +0 -2
  392. package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.d.ts +0 -2
  393. package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.d.ts.map +0 -1
  394. package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.js +0 -2
  395. package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.d.ts +0 -2
  396. package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.d.ts.map +0 -1
  397. package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.js +0 -2
  398. package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.d.ts +0 -2
  399. package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.d.ts.map +0 -1
  400. package/dist/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.js +0 -0
  401. package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.d.ts +0 -2
  402. package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.d.ts.map +0 -1
  403. package/dist/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.js +0 -2
  404. package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.d.ts +0 -2
  405. package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.d.ts.map +0 -1
  406. package/dist/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.js +0 -2
  407. package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts +0 -2
  408. package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts.map +0 -1
  409. package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.js +0 -0
  410. package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.d.ts +0 -2
  411. package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.d.ts.map +0 -1
  412. package/dist/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.js +0 -0
  413. package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts +0 -2
  414. package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts.map +0 -1
  415. package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.js +0 -0
  416. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.d.ts +0 -2
  417. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.d.ts.map +0 -1
  418. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.js +0 -0
  419. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.d.ts +0 -2
  420. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.d.ts.map +0 -1
  421. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.js +0 -2
  422. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.d.ts +0 -3
  423. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +0 -1
  424. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.js +0 -2
  425. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.d.ts +0 -2
  426. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +0 -1
  427. package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js +0 -2
  428. package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.d.ts +0 -3
  429. package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.d.ts.map +0 -1
  430. package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.js +0 -2
  431. package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.d.ts +0 -3
  432. package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.d.ts.map +0 -1
  433. package/dist/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.js +0 -2
  434. package/dist/legacy-runtime/runtime-cores/external-store/auto-status.d.ts +0 -2
  435. package/dist/legacy-runtime/runtime-cores/external-store/auto-status.d.ts.map +0 -1
  436. package/dist/legacy-runtime/runtime-cores/external-store/auto-status.js +0 -2
  437. package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.d.ts +0 -2
  438. package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.d.ts.map +0 -1
  439. package/dist/legacy-runtime/runtime-cores/external-store/createMessageConverter.js +0 -3
  440. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts +0 -2
  441. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts.map +0 -1
  442. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +0 -3
  443. package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.d.ts +0 -2
  444. package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.d.ts.map +0 -1
  445. package/dist/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.js +0 -3
  446. package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.d.ts +0 -2
  447. package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.d.ts.map +0 -1
  448. package/dist/legacy-runtime/runtime-cores/local/ChatModelAdapter.js +0 -0
  449. package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.d.ts +0 -2
  450. package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.d.ts.map +0 -1
  451. package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeCore.js +0 -2
  452. package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts +0 -4
  453. package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts.map +0 -1
  454. package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.js +0 -2
  455. package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.d.ts +0 -3
  456. package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.d.ts.map +0 -1
  457. package/dist/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.js +0 -2
  458. package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts +0 -2
  459. package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts.map +0 -1
  460. package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js +0 -2
  461. package/dist/legacy-runtime/runtime-cores/local/shouldContinue.d.ts +0 -2
  462. package/dist/legacy-runtime/runtime-cores/local/shouldContinue.d.ts.map +0 -1
  463. package/dist/legacy-runtime/runtime-cores/local/shouldContinue.js +0 -2
  464. package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts +0 -2
  465. package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.d.ts.map +0 -1
  466. package/dist/legacy-runtime/runtime-cores/local/useLocalRuntime.js +0 -3
  467. package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.d.ts +0 -2
  468. package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.d.ts.map +0 -1
  469. package/dist/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.js +0 -2
  470. package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.d.ts +0 -2
  471. package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.d.ts.map +0 -1
  472. package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.js +0 -2
  473. package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.d.ts +0 -2
  474. package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.d.ts.map +0 -1
  475. package/dist/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.js +0 -2
  476. package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts +0 -2
  477. package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.d.ts.map +0 -1
  478. package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.js +0 -3
  479. package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts +0 -2
  480. package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +0 -1
  481. package/dist/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +0 -3
  482. package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts +0 -2
  483. package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts.map +0 -1
  484. package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js +0 -3
  485. package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.d.ts +0 -2
  486. package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.d.ts.map +0 -1
  487. package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.js +0 -2
  488. package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.d.ts +0 -2
  489. package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.d.ts.map +0 -1
  490. package/dist/legacy-runtime/runtime-cores/remote-thread-list/types.js +0 -0
  491. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts +0 -2
  492. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +0 -1
  493. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +0 -3
  494. package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.d.ts +0 -4
  495. package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.d.ts.map +0 -1
  496. package/dist/legacy-runtime/runtime-cores/utils/MessageRepository.js +0 -3
  497. package/dist/utils/hooks/useOnResizeContent.d.ts +0 -2
  498. package/dist/utils/hooks/useOnResizeContent.d.ts.map +0 -1
  499. package/dist/utils/hooks/useOnResizeContent.js +0 -21
  500. package/dist/utils/hooks/useOnResizeContent.js.map +0 -1
  501. package/src/context/providers/ChainOfThoughtPartByIndexProvider.tsx +0 -3
  502. package/src/legacy-runtime/RuntimeAdapter.ts +0 -1
  503. package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.ts +0 -3
  504. package/src/legacy-runtime/runtime/AssistantRuntime.ts +0 -2
  505. package/src/legacy-runtime/runtime/AttachmentRuntime.ts +0 -7
  506. package/src/legacy-runtime/runtime/ComposerRuntime.ts +0 -20
  507. package/src/legacy-runtime/runtime/RuntimeBindings.ts +0 -12
  508. package/src/legacy-runtime/runtime/RuntimePathTypes.ts +0 -8
  509. package/src/legacy-runtime/runtime/ThreadListItemRuntime.ts +0 -10
  510. package/src/legacy-runtime/runtime/ThreadRuntime.ts +0 -14
  511. package/src/legacy-runtime/runtime-cores/adapters/RuntimeAdapterProvider.tsx +0 -7
  512. package/src/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.ts +0 -3
  513. package/src/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.ts +0 -1
  514. package/src/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.ts +0 -1
  515. package/src/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.ts +0 -1
  516. package/src/legacy-runtime/runtime-cores/core/AssistantRuntimeCore.ts +0 -1
  517. package/src/legacy-runtime/runtime-cores/core/BaseAssistantRuntimeCore.ts +0 -1
  518. package/src/legacy-runtime/runtime-cores/core/BaseThreadRuntimeCore.ts +0 -1
  519. package/src/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.ts +0 -6
  520. package/src/legacy-runtime/runtime-cores/core/ThreadListRuntimeCore.ts +0 -4
  521. package/src/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.ts +0 -13
  522. package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.ts +0 -6
  523. package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreRuntimeCore.ts +0 -1
  524. package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadListRuntimeCore.ts +0 -2
  525. package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.ts +0 -4
  526. package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageConverter.ts +0 -2
  527. package/src/legacy-runtime/runtime-cores/external-store/ThreadMessageLike.ts +0 -2
  528. package/src/legacy-runtime/runtime-cores/external-store/auto-status.ts +0 -1
  529. package/src/legacy-runtime/runtime-cores/external-store/createMessageConverter.ts +0 -2
  530. package/src/legacy-runtime/runtime-cores/external-store/external-message-converter.ts +0 -7
  531. package/src/legacy-runtime/runtime-cores/external-store/useExternalStoreRuntime.ts +0 -3
  532. package/src/legacy-runtime/runtime-cores/local/ChatModelAdapter.ts +0 -7
  533. package/src/legacy-runtime/runtime-cores/local/LocalRuntimeCore.ts +0 -1
  534. package/src/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.ts +0 -3
  535. package/src/legacy-runtime/runtime-cores/local/LocalThreadListRuntimeCore.ts +0 -2
  536. package/src/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.ts +0 -1
  537. package/src/legacy-runtime/runtime-cores/local/shouldContinue.ts +0 -1
  538. package/src/legacy-runtime/runtime-cores/local/useLocalRuntime.ts +0 -3
  539. package/src/legacy-runtime/runtime-cores/remote-thread-list/BaseSubscribable.ts +0 -1
  540. package/src/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.ts +0 -1
  541. package/src/legacy-runtime/runtime-cores/remote-thread-list/OptimisticState.ts +0 -1
  542. package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +0 -3
  543. package/src/legacy-runtime/runtime-cores/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +0 -3
  544. package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.tsx +0 -3
  545. package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/in-memory.ts +0 -1
  546. package/src/legacy-runtime/runtime-cores/remote-thread-list/types.ts +0 -7
  547. package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts +0 -3
  548. package/src/legacy-runtime/runtime-cores/utils/MessageRepository.ts +0 -3
  549. package/src/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.ts +0 -49
  550. package/src/utils/hooks/useOnResizeContent.ts +0 -15
@@ -6,7 +6,7 @@ import { AssistantProviderBase } from "@assistant-ui/core/react";
6
6
  import { memo, useEffect } from "@assistant-ui/tap/react-shim";
7
7
  import { useAui } from "@assistant-ui/store";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
- //#region src/legacy-runtime/AssistantRuntimeProvider.tsx
9
+ // src/legacy-runtime/AssistantRuntimeProvider.tsx
10
10
  const DevToolsRegistration = () => {
11
11
  const $ = c(3);
12
12
  const aui = useAui();
@@ -60,7 +60,6 @@ const AssistantRuntimeProviderImpl = (t0) => {
60
60
  return t4;
61
61
  };
62
62
  const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);
63
- //#endregion
64
63
  export { AssistantRuntimeProvider, AssistantRuntimeProviderImpl };
65
64
 
66
65
  //# sourceMappingURL=AssistantRuntimeProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantRuntimeProvider.js","names":["c","_c","FC","memo","PropsWithChildren","useEffect","AssistantClient","AuiConfig","useAui","AssistantRuntime","AssistantProviderBase","ThreadPrimitiveViewportProvider","DevToolsProviderApi","AssistantRuntimeProvider","Props","runtime","aui","config","DevToolsRegistration","$","t0","t1","process","env","NODE_ENV","register","AssistantRuntimeProviderImpl","children","t2","Symbol","for","t3","t4","_c"],"sources":["../../src/legacy-runtime/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, memo, type PropsWithChildren, useEffect } from \"react\";\nimport {\n type AssistantClient,\n type AuiConfig,\n useAui,\n} 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 * Optional extra scopes provided alongside the runtime's `threads`\n * scope; build with `AuiConfig`.\n */\n config?: AuiConfig;\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, config, runtime }) => {\n return (\n <AssistantProviderBase runtime={runtime} aui={aui ?? null} config={config}>\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 Ass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F,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAPxBa;AAOwB;AAI5B,MAAanB,2BAA2BV,KAAKuB,4BAA4B"}
1
+ {"version":3,"file":"AssistantRuntimeProvider.js","names":["c","_c","FC","memo","PropsWithChildren","useEffect","AssistantClient","AuiConfig","useAui","AssistantRuntime","AssistantProviderBase","ThreadPrimitiveViewportProvider","DevToolsProviderApi","AssistantRuntimeProvider","Props","runtime","aui","config","DevToolsRegistration","$","t0","t1","process","env","NODE_ENV","register","AssistantRuntimeProviderImpl","children","t2","Symbol","for","t3","t4","_c"],"sources":["../../src/legacy-runtime/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FC, memo, type PropsWithChildren, useEffect } from \"react\";\nimport {\n type AssistantClient,\n type AuiConfig,\n useAui,\n} from \"@assistant-ui/store\";\nimport type { AssistantRuntime } from \"@assistant-ui/core\";\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 * Optional extra scopes provided alongside the runtime's `threads`\n * scope; build with `AuiConfig`.\n */\n config?: AuiConfig;\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, config, runtime }) => {\n return (\n <AssistantProviderBase runtime={runtime} aui={aui ?? null} config={config}>\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":";;;;;;;;;AAuCA,MAAMkB,6BAA2B;CAAA,MAAAC,IAAAlB,EAAA,CAAA;CAC/B,MAAAe,MAAYR,OAAO;CAAE,IAAAY;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAH,KAAA;EACXI,WAAA;GACR,IAAI,OAAOE,YAAY,eAAeA,QAAOC,IAAIC,aAAc,cAAY;GAClE,OACFZ,oBAAmBa,SAAUT,GAAG;EAAC;EACvCK,KAAA,CAACL,GAAG;EAACG,EAAA,KAAAH;EAAAG,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAA;EAAAD,KAAAD,EAAA;EAAAE,KAAAF,EAAA;CAAA;CAJRd,UAAUe,IAIPC,EAAK;CAAC,OACF;AAAI;AAGb,MAAaK,gCAETN,OAAA;CAAA,MAAAD,IAAAlB,EAAA,CAAA;CAAC,MAAA,EAAA0B,UAAAX,KAAAC,QAAAF,YAAAK;CAE6C,MAAAC,KAAAL,OAAA;CAAW,IAAAY;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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AC,EAAE,IAAI,CACb,oBAAoB,EACpB,UAAU,GAAG,cAAc,GAAG,eAAe,CAC9C,CAAC;IACF,wGAAwG;IACxG,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sEAAsE;IACtE,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,uEAAuE;IACvE,aAAa,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACtD;;;;OAIG;IACH,IAAI,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACnC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,iBAAiB,CAAC;CAC5D,CAAC;AAiTF,eAAO,MAAM,cAAc;qBA3BL,4BAA4B;oCA2BO,CAAC"}
@@ -8,7 +8,7 @@ import { resource, useResource } from "@assistant-ui/tap";
8
8
  import { create } from "zustand";
9
9
  import { isRecord } from "@assistant-ui/core/internal";
10
10
  import { Fragment, jsx } from "react/jsx-runtime";
11
- //#region src/mcp-apps/McpAppRenderer.tsx
11
+ // src/mcp-apps/McpAppRenderer.tsx
12
12
  const isSameOptions = (a, b) => {
13
13
  const aKeys = Object.keys(a).filter((key) => key !== "host");
14
14
  const bKeys = Object.keys(b).filter((key) => key !== "host");
@@ -123,7 +123,8 @@ function InlineRenderer({ part, useRendererStore }) {
123
123
  ok: false,
124
124
  reason: result.reason
125
125
  };
126
- aui.thread.append({ content: result.content });
126
+ const composer = aui.thread.composer();
127
+ composer.setText([composer.getState().text, result.content.map((part_0) => part_0.text).join("\n")].filter((part_1) => part_1.trim()).join(" "));
127
128
  return { ok: true };
128
129
  }),
129
130
  callTool: (params_0) => useRendererStore.getState().host.callTool({
@@ -205,7 +206,6 @@ const useMcpAppRenderer = (options) => {
205
206
  }, [useRendererStore]) };
206
207
  };
207
208
  const McpAppRenderer = resource(useMcpAppRenderer);
208
- //#endregion
209
209
  export { McpAppRenderer };
210
210
 
211
211
  //# sourceMappingURL=McpAppRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpAppRenderer.js","names":["useEffect","useMemo","useRef","useState","ReactNode","useIsomorphicLayoutEffect","McpAppMetadata","TextMessagePart","ToolCallMessagePart","ToolCallMessagePartComponent","ToolCallMessagePartProps","useAui","create","StoreApi","UseBoundStore","useResource","resource","ResourceElement","McpAppFrame","McpAppBridgeHandlers","McpAppHostContext","McpAppHostInfo","McpAppResource","McpAppSandboxConfig","McpAppsHost","getMcpAppFromToolPart","isRecord","McpAppPartOptions","sandbox","maxHeight","hostInfo","hostContext","handlers","Omit","fallback","loadingFallback","errorFallback","error","Error","McpAppRendererOptions","host","forPart","part","LoadedResourceState","resourceUri","serverId","RendererState","options","UseRendererStore","isSameOptions","a","b","aKeys","Object","keys","filter","key","bKeys","length","aValues","Record","bValues","every","hasOwn","is","getInput","status","type","argsText","args","undefined","defaultOpenLink","url","window","open","extractSendMessageTexts","params","obj","content","Array","isArray","index","Number","isInteger","String","map","block","text","extractSendMessageContent","reason","texts","resolvePartOptions","overrides","InlineRenderer","useRendererStore","aui","rendererOptions","state","opts","app","cachedAppRef","current","appForRender","loadedResource","setLoadedResource","callerHandlers","cancelled","targetHost","targetUri","targetServerId","loadResource","Promise","resolve","getState","res","uri","bridgeHandlers","openLink","sendMessage","result","isError","ok","thread","append","callTool","readResource","listResources","loadedResourceForApp","appResource","useMcpAppRenderer","render","setState","prev","Render","props","displayName","McpAppRenderer"],"sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../utils/useIsomorphicLayoutEffect\";\nimport type {\n McpAppMetadata,\n TextMessagePart,\n ToolCallMessagePart,\n} from \"@assistant-ui/core\";\nimport type {\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from \"@assistant-ui/core/react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { create, type StoreApi, type UseBoundStore } from \"zustand\";\n\nimport { useResource, resource, type ResourceElement } from \"@assistant-ui/tap\";\nimport { McpAppFrame } from \"./app-frame\";\nimport type {\n McpAppBridgeHandlers,\n McpAppHostContext,\n McpAppHostInfo,\n McpAppResource,\n McpAppSandboxConfig,\n McpAppsHost,\n} from \"./types\";\nimport { getMcpAppFromToolPart } from \"./utils\";\nimport { isRecord } from \"@assistant-ui/core/internal\";\n\n/**\n * Options that apply to a single MCP app. `McpAppRenderer` takes them as\n * thread-wide defaults, and its `forPart` resolver overrides them for one part.\n */\nexport type McpAppPartOptions = {\n /** Sandbox + container styling. Passes through to SafeContentFrame. */\n sandbox?: McpAppSandboxConfig;\n /**\n * Upper bound (in pixels) applied to the widget-driven auto-resize height.\n * Defaults to 800.\n */\n maxHeight?: number;\n /** Identifies the host to the widget in the `ui/initialize` response. */\n hostInfo?: McpAppHostInfo;\n /** Delivered to the widget on initialize and pushed via `notifications/host_context/changed` on change. */\n hostContext?: McpAppHostContext;\n /**\n * Optional widget interaction and lifecycle handlers. Data-plane handlers\n * (`callTool`, `readResource`, `listResources`) always use `host`.\n *\n * Which handlers a widget may call is captured when its frame mounts, so a\n * `forPart` resolver returns the same handler keys for a part on every\n * render even when the implementations change.\n */\n handlers?: Omit<\n McpAppBridgeHandlers,\n \"callTool\" | \"readResource\" | \"listResources\"\n >;\n /** Rendered when no MCP app is on the part, or while load is in flight / failed (unless overridden). */\n fallback?: ReactNode;\n /** Rendered while the resource is loading. Defaults to `fallback`. */\n loadingFallback?: ReactNode;\n /** Rendered when the resource load rejects. Defaults to `fallback`. */\n errorFallback?: ReactNode | ((error: Error) => ReactNode);\n};\n\nexport type McpAppRendererOptions = McpAppPartOptions & {\n /**\n * Provides the data-plane operations the widget can request\n * (`loadResource`, `callTool`, `readResource`, `listResources`). Use\n * `McpAppsRemoteHost({ url })` for the default HTTP-route convention.\n */\n host: ResourceElement<McpAppsHost>;\n /**\n * Resolves the options for one part. Each returned value replaces the\n * thread-wide option of the same name, so a host can give every MCP app its\n * own display mode and answer `requestDisplayMode` for the part that asked.\n *\n * `handlers` is the exception and merges per key. Its keys are capabilities\n * negotiated with the widget rather than data, so replacing the whole bag to\n * add one handler would withdraw the others from that part's widget with\n * nothing to observe it by.\n */\n forPart?: (part: ToolCallMessagePart) => McpAppPartOptions;\n};\n\ntype LoadedResourceState = {\n host: McpAppsHost;\n resourceUri: string;\n serverId?: string;\n resource?: McpAppResource;\n error?: Error;\n};\n\ntype RendererState = {\n host: McpAppsHost;\n options: McpAppRendererOptions;\n};\n\ntype UseRendererStore = UseBoundStore<StoreApi<RendererState>>;\n\n// Callers pass options as an object literal, so the resource hands this a fresh\n// identity on every run; comparing the values keeps an unchanged run from\n// re-rendering every mounted part. `host` is excluded because it is an element\n// rebuilt on every run, and the store carries the resolved host separately.\nconst isSameOptions = (\n a: McpAppRendererOptions,\n b: McpAppRendererOptions,\n): boolean => {\n const aKeys = Object.keys(a).filter((key) => key !== \"host\");\n const bKeys = Object.keys(b).filter((key) => key !== \"host\");\n if (aKeys.length !== bKeys.length) return false;\n const aValues = a as Record<string, unknown>;\n const bValues = b as Record<string, unknown>;\n return aKeys.every(\n (key) =>\n Object.hasOwn(bValues, key) && Object.is(aValues[key], bValues[key]),\n );\n};\n\nfunction getInput(part: {\n status: { type: string };\n argsText: string;\n args: unknown;\n}): unknown {\n if (\n part.status.type === \"running\" &&\n (part.argsText === \"\" || part.argsText === \"{}\")\n ) {\n return undefined;\n }\n return part.args;\n}\n\nconst defaultOpenLink = ({ url }: { url: string }) => {\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n};\n\nfunction extractSendMessageTexts(params: unknown): string[] | undefined {\n if (typeof params === \"string\") return [params];\n if (!params || typeof params !== \"object\") return undefined;\n const obj = params as Record<string, unknown>;\n if (typeof obj[\"prompt\"] === \"string\") return [obj[\"prompt\"]];\n if (typeof obj[\"text\"] === \"string\") return [obj[\"text\"]];\n if (typeof obj[\"message\"] === \"string\") return [obj[\"message\"]];\n const content = obj[\"content\"];\n if (Array.isArray(content)) {\n return Object.keys(content)\n .filter((key) => {\n const index = Number(key);\n return (\n Number.isInteger(index) &&\n index >= 0 &&\n index < content.length &&\n String(index) === key\n );\n })\n .map((key) => content[Number(key)])\n .filter(\n (block): block is { type: \"text\"; text: string } =>\n isRecord(block) &&\n block[\"type\"] === \"text\" &&\n typeof block[\"text\"] === \"string\",\n )\n .map((block) => block.text);\n }\n return undefined;\n}\n\nfunction extractSendMessageContent(\n params: unknown,\n): { content: TextMessagePart[] } | { reason: string } {\n const texts = extractSendMessageTexts(params);\n if (!texts) return { reason: \"unrecognised params shape\" };\n const content = texts\n .filter((text) => text !== \"\")\n .map((text): TextMessagePart => ({ type: \"text\", text }));\n if (content.length === 0) {\n return { reason: \"no text content to append\" };\n }\n return { content };\n}\n\nfunction resolvePartOptions(\n options: McpAppRendererOptions,\n part: ToolCallMessagePartProps,\n): McpAppRendererOptions {\n const overrides = options.forPart?.(part);\n if (!overrides) return options;\n const handlers =\n options.handlers && overrides.handlers\n ? { ...options.handlers, ...overrides.handlers }\n : (overrides.handlers ?? options.handlers);\n return {\n ...options,\n ...overrides,\n ...(handlers === undefined ? {} : { handlers }),\n };\n}\n\nfunction InlineRenderer({\n part,\n useRendererStore,\n}: {\n part: ToolCallMessagePartProps;\n useRendererStore: UseRendererStore;\n}) {\n const aui = useAui();\n const rendererOptions = useRendererStore((state) => state.options);\n const opts = resolvePartOptions(rendererOptions, part);\n const app = getMcpAppFromToolPart(part);\n const cachedAppRef = useRef<McpAppMetadata | undefined>(undefined);\n useIsomorphicLayoutEffect(() => {\n if (app != null) cachedAppRef.current = app;\n }, [app]);\n const appForRender = app ?? cachedAppRef.current;\n\n const [loadedResource, setLoadedResource] = useState<LoadedResourceState>();\n\n const host = useRendererStore((state) => state.host);\n const resourceUri = appForRender?.resourceUri;\n const serverId = appForRender?.serverId;\n const callerHandlers = opts.handlers;\n useEffect(() => {\n if (resourceUri == null) return;\n let cancelled = false;\n const targetHost = host;\n const targetUri = resourceUri;\n const targetServerId = serverId;\n\n // Host changes are published later in this passive flush. Defer until that\n // publication lands, then verify this effect still owns the current host.\n const loadResource = async () => {\n await Promise.resolve();\n if (cancelled || useRendererStore.getState().host !== targetHost) return;\n try {\n const res = await targetHost.loadResource({\n uri: targetUri,\n ...(targetServerId ? { serverId: targetServerId } : {}),\n });\n if (!cancelled)\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n resource: res,\n });\n } catch (error: unknown) {\n if (!cancelled) {\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n };\n void loadResource();\n\n return () => {\n cancelled = true;\n };\n }, [host, resourceUri, serverId, useRendererStore]);\n\n const bridgeHandlers = useMemo<McpAppBridgeHandlers>(\n () => ({\n ...callerHandlers,\n openLink: callerHandlers?.openLink ?? defaultOpenLink,\n sendMessage:\n callerHandlers?.sendMessage ??\n ((params) => {\n const result = extractSendMessageContent(params);\n if (\"reason\" in result) {\n return { isError: true, ok: false, reason: result.reason };\n }\n aui.thread.append({ content: result.content });\n return { ok: true };\n }),\n callTool: (params) =>\n useRendererStore.getState().host.callTool({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n readResource: (params) =>\n useRendererStore.getState().host.readResource({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n listResources: (params) => {\n if (!serverId) {\n return useRendererStore.getState().host.listResources(params);\n }\n return useRendererStore.getState().host.listResources({\n ...(isRecord(params) ? params : {}),\n serverId,\n });\n },\n }),\n [aui, callerHandlers, serverId, useRendererStore],\n );\n\n const loadedResourceForApp =\n loadedResource?.host === host &&\n loadedResource?.resourceUri === appForRender?.resourceUri &&\n loadedResource?.serverId === appForRender?.serverId\n ? loadedResource\n : undefined;\n const appResource = loadedResourceForApp?.resource;\n const error = loadedResourceForApp?.error;\n\n const fallback = opts.fallback ?? null;\n if (appForRender == null) {\n return <>{fallback}</>;\n }\n if (error != null) {\n const errorFallback = opts.errorFallback;\n if (errorFallback === undefined) return <>{fallback}</>;\n if (typeof errorFallback === \"function\") return <>{errorFallback(error)}</>;\n return <>{errorFallback}</>;\n }\n if (appResource == null) {\n return <>{opts.loadingFallback ?? fallback}</>;\n }\n\n return (\n <McpAppFrame\n app={appForRender}\n resource={appResource}\n input={getInput(part)}\n output={part.result}\n sandbox={opts.sandbox}\n handlers={bridgeHandlers}\n hostInfo={opts.hostInfo}\n hostContext={opts.hostContext}\n maxHeight={opts.maxHeight}\n />\n );\n}\n\n/**\n * Creates a tool-call renderer for MCP Apps embedded in assistant messages.\n *\n * Compose this into the `Tools` resource through its `mcpApp` option. When a\n * tool-call part carries `mcp.app` metadata for a `ui://` resource, the\n * renderer loads that resource from the configured host and displays it in a\n * sandboxed frame.\n */\nconst useMcpAppRenderer = (\n options: McpAppRendererOptions,\n): { readonly render: ToolCallMessagePartComponent } => {\n const host = useResource(options.host);\n\n // The rendered component identity has to stay stable, or every part remounts\n // its frame; options reach the parts through the store instead of props.\n const [useRendererStore] = useState(() =>\n create<RendererState>(() => ({ host, options })),\n );\n useEffect(() => {\n useRendererStore.setState((prev) =>\n prev.host === host && isSameOptions(prev.options, options)\n ? prev\n : { host, options },\n );\n }, [host, options, useRendererStore]);\n\n const render = useMemo((): ToolCallMessagePartComponent => {\n const Render: ToolCallMessagePartComponent = (props) => (\n <InlineRenderer part={props} useRendererStore={useRendererStore} />\n );\n Render.displayName = \"McpAppRenderer\";\n return Render;\n }, [useRendererStore]);\n\n return { render };\n};\n\nexport const McpAppRenderer = resource(useMcpAppRenderer);\n"],"mappings":";;;;;;;;;;;AAwGA,MAAMiD,iBACJC,GACAC,MACY;CACZ,MAAMC,QAAQC,OAAOC,KAAKJ,CAAC,CAAC,CA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AA,EAAA,UAAGA,cAAcC,OAAK,EAAE,CAAA;EACxE,OAAO,oBAAA,UAAA,EAAA,UAAGD,cAAc,CAAA;CAC1B;CACA,IAAI4F,eAAe,MACjB,OAAO,oBAAA,UAAA,EAAA,UAAG9B,KAAK/D,mBAAmBD,SAAS,CAAA;CAG7C,OACE,oBAAC,aAAD;EACE,KAAKoE;EACL,UAAU0B;EACV,OAAO/D,SAASvB,IAAI;EACpB,QAAQA,KAAK6E;EACb,SAASrB,KAAKtE;EACd,UAAUwF;EACV,UAAUlB,KAAKpE;EACf,aAAaoE,KAAKnE;EAClB,WAAWmE,KAAKrE;CAAU,CAAA;AAGhC;;;;;;;;;AAUA,MAAMoG,qBACJlF,YACsD;CACtD,MAAMP,OAAOzB,YAAYgC,QAAQP,IAAI;CAIrC,MAAM,CAACsD,oBAAoB3F,eACzBS,cAA6B;EAAE4B;EAAMO;CAAQ,EAAE,CACjD;CACA/C,gBAAgB;EACd8F,iBAAiBqC,UAAUC,SACzBA,KAAK5F,SAASA,QAAQS,cAAcmF,KAAKrF,SAASA,OAAO,IACrDqF,OACA;GAAE5F;GAAMO;EAAQ,CACtB;CACF,GAAG;EAACP;EAAMO;EAAS+C;CAAgB,CAAC;CAUpC,OAAO,EAAEoC,QARMjI,cAA4C;EACzD,MAAMoI,UAAwCC,UAC5C,oBAAC,gBAAD;GAAgB,MAAMA;GAAyBxC;EAAiB,CAAA;EAElEuC,OAAOE,cAAc;EACrB,OAAOF;CACT,GAAG,CAACvC,gBAAgB,CAEXoC,EAAO;AAClB;AAEA,MAAaM,iBAAiBxH,SAASiH,iBAAiB"}
1
+ {"version":3,"file":"McpAppRenderer.js","names":["useEffect","useMemo","useRef","useState","ReactNode","useIsomorphicLayoutEffect","McpAppMetadata","TextMessagePart","ToolCallMessagePart","ToolCallMessagePartComponent","ToolCallMessagePartProps","useAui","create","StoreApi","UseBoundStore","useResource","resource","ResourceElement","McpAppFrame","McpAppBridgeHandlers","McpAppHostContext","McpAppHostInfo","McpAppResource","McpAppSandboxConfig","McpAppsHost","getMcpAppFromToolPart","isRecord","McpAppPartOptions","sandbox","maxHeight","hostInfo","hostContext","handlers","Omit","fallback","loadingFallback","errorFallback","error","Error","McpAppRendererOptions","host","forPart","part","LoadedResourceState","resourceUri","serverId","RendererState","options","UseRendererStore","isSameOptions","a","b","aKeys","Object","keys","filter","key","bKeys","length","aValues","Record","bValues","every","hasOwn","is","getInput","status","type","argsText","args","undefined","defaultOpenLink","url","window","open","extractSendMessageTexts","params","obj","content","Array","isArray","index","Number","isInteger","String","map","block","text","extractSendMessageContent","reason","texts","resolvePartOptions","overrides","InlineRenderer","useRendererStore","aui","rendererOptions","state","opts","app","cachedAppRef","current","appForRender","loadedResource","setLoadedResource","callerHandlers","cancelled","targetHost","targetUri","targetServerId","loadResource","Promise","resolve","getState","res","uri","bridgeHandlers","openLink","sendMessage","result","isError","ok","composer","thread","setText","join","trim","callTool","readResource","listResources","loadedResourceForApp","appResource","useMcpAppRenderer","render","setState","prev","Render","props","displayName","McpAppRenderer"],"sources":["../../src/mcp-apps/McpAppRenderer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../utils/useIsomorphicLayoutEffect\";\nimport type {\n McpAppMetadata,\n TextMessagePart,\n ToolCallMessagePart,\n} from \"@assistant-ui/core\";\nimport type {\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from \"@assistant-ui/core/react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { create, type StoreApi, type UseBoundStore } from \"zustand\";\n\nimport { useResource, resource, type ResourceElement } from \"@assistant-ui/tap\";\nimport { McpAppFrame } from \"./app-frame\";\nimport type {\n McpAppBridgeHandlers,\n McpAppHostContext,\n McpAppHostInfo,\n McpAppResource,\n McpAppSandboxConfig,\n McpAppsHost,\n} from \"./types\";\nimport { getMcpAppFromToolPart } from \"./utils\";\nimport { isRecord } from \"@assistant-ui/core/internal\";\n\n/**\n * Options that apply to a single MCP app. `McpAppRenderer` takes them as\n * thread-wide defaults, and its `forPart` resolver overrides them for one part.\n */\nexport type McpAppPartOptions = {\n /** Sandbox + container styling. Passes through to SafeContentFrame. */\n sandbox?: McpAppSandboxConfig;\n /**\n * Upper bound (in pixels) applied to the widget-driven auto-resize height.\n * Defaults to 800.\n */\n maxHeight?: number;\n /** Identifies the host to the widget in the `ui/initialize` response. */\n hostInfo?: McpAppHostInfo;\n /** Delivered to the widget on initialize and pushed via `notifications/host_context/changed` on change. */\n hostContext?: McpAppHostContext;\n /**\n * Optional widget interaction and lifecycle handlers. Data-plane handlers\n * (`callTool`, `readResource`, `listResources`) always use `host`.\n *\n * Which handlers a widget may call is captured when its frame mounts, so a\n * `forPart` resolver returns the same handler keys for a part on every\n * render even when the implementations change.\n */\n handlers?: Omit<\n McpAppBridgeHandlers,\n \"callTool\" | \"readResource\" | \"listResources\"\n >;\n /** Rendered when no MCP app is on the part, or while load is in flight / failed (unless overridden). */\n fallback?: ReactNode;\n /** Rendered while the resource is loading. Defaults to `fallback`. */\n loadingFallback?: ReactNode;\n /** Rendered when the resource load rejects. Defaults to `fallback`. */\n errorFallback?: ReactNode | ((error: Error) => ReactNode);\n};\n\nexport type McpAppRendererOptions = McpAppPartOptions & {\n /**\n * Provides the data-plane operations the widget can request\n * (`loadResource`, `callTool`, `readResource`, `listResources`). Use\n * `McpAppsRemoteHost({ url })` for the default HTTP-route convention.\n */\n host: ResourceElement<McpAppsHost>;\n /**\n * Resolves the options for one part. Each returned value replaces the\n * thread-wide option of the same name, so a host can give every MCP app its\n * own display mode and answer `requestDisplayMode` for the part that asked.\n *\n * `handlers` is the exception and merges per key. Its keys are capabilities\n * negotiated with the widget rather than data, so replacing the whole bag to\n * add one handler would withdraw the others from that part's widget with\n * nothing to observe it by.\n */\n forPart?: (part: ToolCallMessagePart) => McpAppPartOptions;\n};\n\ntype LoadedResourceState = {\n host: McpAppsHost;\n resourceUri: string;\n serverId?: string;\n resource?: McpAppResource;\n error?: Error;\n};\n\ntype RendererState = {\n host: McpAppsHost;\n options: McpAppRendererOptions;\n};\n\ntype UseRendererStore = UseBoundStore<StoreApi<RendererState>>;\n\n// Callers pass options as an object literal, so the resource hands this a fresh\n// identity on every run; comparing the values keeps an unchanged run from\n// re-rendering every mounted part. `host` is excluded because it is an element\n// rebuilt on every run, and the store carries the resolved host separately.\nconst isSameOptions = (\n a: McpAppRendererOptions,\n b: McpAppRendererOptions,\n): boolean => {\n const aKeys = Object.keys(a).filter((key) => key !== \"host\");\n const bKeys = Object.keys(b).filter((key) => key !== \"host\");\n if (aKeys.length !== bKeys.length) return false;\n const aValues = a as Record<string, unknown>;\n const bValues = b as Record<string, unknown>;\n return aKeys.every(\n (key) =>\n Object.hasOwn(bValues, key) && Object.is(aValues[key], bValues[key]),\n );\n};\n\nfunction getInput(part: {\n status: { type: string };\n argsText: string;\n args: unknown;\n}): unknown {\n if (\n part.status.type === \"running\" &&\n (part.argsText === \"\" || part.argsText === \"{}\")\n ) {\n return undefined;\n }\n return part.args;\n}\n\nconst defaultOpenLink = ({ url }: { url: string }) => {\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n};\n\nfunction extractSendMessageTexts(params: unknown): string[] | undefined {\n if (typeof params === \"string\") return [params];\n if (!params || typeof params !== \"object\") return undefined;\n const obj = params as Record<string, unknown>;\n if (typeof obj[\"prompt\"] === \"string\") return [obj[\"prompt\"]];\n if (typeof obj[\"text\"] === \"string\") return [obj[\"text\"]];\n if (typeof obj[\"message\"] === \"string\") return [obj[\"message\"]];\n const content = obj[\"content\"];\n if (Array.isArray(content)) {\n return Object.keys(content)\n .filter((key) => {\n const index = Number(key);\n return (\n Number.isInteger(index) &&\n index >= 0 &&\n index < content.length &&\n String(index) === key\n );\n })\n .map((key) => content[Number(key)])\n .filter(\n (block): block is { type: \"text\"; text: string } =>\n isRecord(block) &&\n block[\"type\"] === \"text\" &&\n typeof block[\"text\"] === \"string\",\n )\n .map((block) => block.text);\n }\n return undefined;\n}\n\nfunction extractSendMessageContent(\n params: unknown,\n): { content: TextMessagePart[] } | { reason: string } {\n const texts = extractSendMessageTexts(params);\n if (!texts) return { reason: \"unrecognised params shape\" };\n const content = texts\n .filter((text) => text !== \"\")\n .map((text): TextMessagePart => ({ type: \"text\", text }));\n if (content.length === 0) {\n return { reason: \"no text content to append\" };\n }\n return { content };\n}\n\nfunction resolvePartOptions(\n options: McpAppRendererOptions,\n part: ToolCallMessagePartProps,\n): McpAppRendererOptions {\n const overrides = options.forPart?.(part);\n if (!overrides) return options;\n const handlers =\n options.handlers && overrides.handlers\n ? { ...options.handlers, ...overrides.handlers }\n : (overrides.handlers ?? options.handlers);\n return {\n ...options,\n ...overrides,\n ...(handlers === undefined ? {} : { handlers }),\n };\n}\n\nfunction InlineRenderer({\n part,\n useRendererStore,\n}: {\n part: ToolCallMessagePartProps;\n useRendererStore: UseRendererStore;\n}) {\n const aui = useAui();\n const rendererOptions = useRendererStore((state) => state.options);\n const opts = resolvePartOptions(rendererOptions, part);\n const app = getMcpAppFromToolPart(part);\n const cachedAppRef = useRef<McpAppMetadata | undefined>(undefined);\n useIsomorphicLayoutEffect(() => {\n if (app != null) cachedAppRef.current = app;\n }, [app]);\n const appForRender = app ?? cachedAppRef.current;\n\n const [loadedResource, setLoadedResource] = useState<LoadedResourceState>();\n\n const host = useRendererStore((state) => state.host);\n const resourceUri = appForRender?.resourceUri;\n const serverId = appForRender?.serverId;\n const callerHandlers = opts.handlers;\n useEffect(() => {\n if (resourceUri == null) return;\n let cancelled = false;\n const targetHost = host;\n const targetUri = resourceUri;\n const targetServerId = serverId;\n\n // Host changes are published later in this passive flush. Defer until that\n // publication lands, then verify this effect still owns the current host.\n const loadResource = async () => {\n await Promise.resolve();\n if (cancelled || useRendererStore.getState().host !== targetHost) return;\n try {\n const res = await targetHost.loadResource({\n uri: targetUri,\n ...(targetServerId ? { serverId: targetServerId } : {}),\n });\n if (!cancelled)\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n resource: res,\n });\n } catch (error: unknown) {\n if (!cancelled) {\n setLoadedResource({\n host: targetHost,\n resourceUri: targetUri,\n ...(targetServerId !== undefined\n ? { serverId: targetServerId }\n : {}),\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n };\n void loadResource();\n\n return () => {\n cancelled = true;\n };\n }, [host, resourceUri, serverId, useRendererStore]);\n\n const bridgeHandlers = useMemo<McpAppBridgeHandlers>(\n () => ({\n ...callerHandlers,\n openLink: callerHandlers?.openLink ?? defaultOpenLink,\n sendMessage:\n callerHandlers?.sendMessage ??\n ((params) => {\n const result = extractSendMessageContent(params);\n if (\"reason\" in result) {\n return { isError: true, ok: false, reason: result.reason };\n }\n const composer = aui.thread.composer();\n composer.setText(\n [\n composer.getState().text,\n result.content.map((part) => part.text).join(\"\\n\"),\n ]\n .filter((part) => part.trim())\n .join(\" \"),\n );\n return { ok: true };\n }),\n callTool: (params) =>\n useRendererStore.getState().host.callTool({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n readResource: (params) =>\n useRendererStore.getState().host.readResource({\n ...params,\n ...(serverId ? { serverId } : {}),\n }),\n listResources: (params) => {\n if (!serverId) {\n return useRendererStore.getState().host.listResources(params);\n }\n return useRendererStore.getState().host.listResources({\n ...(isRecord(params) ? params : {}),\n serverId,\n });\n },\n }),\n [aui, callerHandlers, serverId, useRendererStore],\n );\n\n const loadedResourceForApp =\n loadedResource?.host === host &&\n loadedResource?.resourceUri === appForRender?.resourceUri &&\n loadedResource?.serverId === appForRender?.serverId\n ? loadedResource\n : undefined;\n const appResource = loadedResourceForApp?.resource;\n const error = loadedResourceForApp?.error;\n\n const fallback = opts.fallback ?? null;\n if (appForRender == null) {\n return <>{fallback}</>;\n }\n if (error != null) {\n const errorFallback = opts.errorFallback;\n if (errorFallback === undefined) return <>{fallback}</>;\n if (typeof errorFallback === \"function\") return <>{errorFallback(error)}</>;\n return <>{errorFallback}</>;\n }\n if (appResource == null) {\n return <>{opts.loadingFallback ?? fallback}</>;\n }\n\n return (\n <McpAppFrame\n app={appForRender}\n resource={appResource}\n input={getInput(part)}\n output={part.result}\n sandbox={opts.sandbox}\n handlers={bridgeHandlers}\n hostInfo={opts.hostInfo}\n hostContext={opts.hostContext}\n maxHeight={opts.maxHeight}\n />\n );\n}\n\n/**\n * Creates a tool-call renderer for MCP Apps embedded in assistant messages.\n *\n * Compose this into the `Tools` resource through its `mcpApp` option. When a\n * tool-call part carries `mcp.app` metadata for a `ui://` resource, the\n * renderer loads that resource from the configured host and displays it in a\n * sandboxed frame.\n */\nconst useMcpAppRenderer = (\n options: McpAppRendererOptions,\n): { readonly render: ToolCallMessagePartComponent } => {\n const host = useResource(options.host);\n\n // The rendered component identity has to stay stable, or every part remounts\n // its frame; options reach the parts through the store instead of props.\n const [useRendererStore] = useState(() =>\n create<RendererState>(() => ({ host, options })),\n );\n useEffect(() => {\n useRendererStore.setState((prev) =>\n prev.host === host && isSameOptions(prev.options, options)\n ? prev\n : { host, options },\n );\n }, [host, options, useRendererStore]);\n\n const render = useMemo((): ToolCallMessagePartComponent => {\n const Render: ToolCallMessagePartComponent = (props) => (\n <InlineRenderer part={props} useRendererStore={useRendererStore} />\n );\n Render.displayName = \"McpAppRenderer\";\n return Render;\n }, [useRendererStore]);\n\n return { render };\n};\n\nexport const McpAppRenderer = resource(useMcpAppRenderer);\n"],"mappings":";;;;;;;;;;;AAwGA,MAAMiD,iBACJC,GACAC,MACY;CACZ,MAAMC,QAAQC,OAAOC,KAAKJ,CAAC,CAAC,CAACK,QAAQC,QAAQA,QAAQ,MAAM;CAC3D,MAAMC,QAAQJ,OAAOC,KAAKH,CAAC,CAAC,CAACI,QAAQC,QAAQA,QAAQ,MAAM;CAC3D,IAAIJ,MAAMM,WAAWD,MAAMC,QAAQ,OAAO;CAC1C,MAAMC,UAAUT;CAChB,MAAMW,UAAUV;CAChB,OAAOC,MAAMU,OACVN,Q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ACxE,OAAO,oBAAA,UAAA,EAAA,UAAGD,cAAc,CAAA;CAC1B;CACA,IAAI+F,eAAe,MACjB,OAAO,oBAAA,UAAA,EAAA,UAAGjC,KAAK/D,mBAAmBD,SAAS,CAAA;CAG7C,OACE,oBAAC,aAAD;EACE,KAAKoE;EACL,UAAU6B;EACV,OAAOlE,SAASvB,IAAI;EACpB,QAAQA,KAAK6E;EACb,SAASrB,KAAKtE;EACd,UAAUwF;EACV,UAAUlB,KAAKpE;EACf,aAAaoE,KAAKnE;EAClB,WAAWmE,KAAKrE;CAAU,CAAA;AAGhC;;;;;;;;;AAUA,MAAMuG,qBACJrF,YACsD;CACtD,MAAMP,OAAOzB,YAAYgC,QAAQP,IAAI;CAIrC,MAAM,CAACsD,oBAAoB3F,eACzBS,cAA6B;EAAE4B;EAAMO;CAAQ,EAAE,CACjD;CACA/C,gBAAgB;EACd8F,iBAAiBwC,UAAUC,SACzBA,KAAK/F,SAASA,QAAQS,cAAcsF,KAAKxF,SAASA,OAAO,IACrDwF,OACA;GAAE/F;GAAMO;EAAQ,CACtB;CACF,GAAG;EAACP;EAAMO;EAAS+C;CAAgB,CAAC;CAUpC,OAAO,EAAEuC,QARMpI,cAA4C;EACzD,MAAMuI,UAAwCC,UAC5C,oBAAC,gBAAD;GAAgB,MAAMA;GAAyB3C;EAAiB,CAAA;EAElE0C,OAAOE,cAAc;EACrB,OAAOF;CACT,GAAG,CAAC1C,gBAAgB,CAEXuC,EAAO;AAClB;AAEA,MAAaM,iBAAiB3H,SAASoH,iBAAiB"}
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useMemo, useRef } from "@assistant-ui/tap/react-shim";
2
2
  import { resource } from "@assistant-ui/tap";
3
- //#region src/mcp-apps/McpAppsRemoteHost.ts
3
+ // src/mcp-apps/McpAppsRemoteHost.ts
4
4
  const truncateBody = (body) => body.length > 500 ? `${body.slice(0, 500)}...` : body;
5
5
  const extractErrorBody = (body) => {
6
6
  const trimmed = body.trim();
@@ -97,7 +97,6 @@ const useMcpAppsRemoteHost = (options) => {
97
97
  return hostState.host;
98
98
  };
99
99
  const McpAppsRemoteHost = resource(useMcpAppsRemoteHost);
100
- //#endregion
101
100
  export { McpAppsRemoteHost };
102
101
 
103
102
  //# sourceMappingURL=McpAppsRemoteHost.js.map
@@ -7,7 +7,7 @@ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
7
7
  import { useEffect, useRef } from "@assistant-ui/tap/react-shim";
8
8
  import { isRecord } from "@assistant-ui/core/internal";
9
9
  import { jsx } from "react/jsx-runtime";
10
- //#region src/mcp-apps/app-frame.tsx
10
+ // src/mcp-apps/app-frame.tsx
11
11
  const DEFAULT_PRODUCT = "assistant-ui-mcp-app";
12
12
  const INIT_TIMEOUT_MS = 5e3;
13
13
  const DEFAULT_MAX_HEIGHT = 800;
@@ -305,7 +305,6 @@ function _temp2(b_1, v_0) {
305
305
  function _temp(b_0, v) {
306
306
  return b_0.notifyToolInput(v);
307
307
  }
308
- //#endregion
309
308
  export { McpAppFrame };
310
309
 
311
310
  //# sourceMappingURL=app-frame.js.map
@@ -1,6 +1,6 @@
1
1
  import "./types.js";
2
2
  import { invokeUserCallback, isRecord } from "@assistant-ui/core/internal";
3
- //#region src/mcp-apps/bridge.ts
3
+ // src/mcp-apps/bridge.ts
4
4
  const VALID_DISPLAY_MODES = [
5
5
  "inline",
6
6
  "fullscreen",
@@ -314,7 +314,6 @@ function createMcpAppBridge(opts) {
314
314
  }
315
315
  };
316
316
  }
317
- //#endregion
318
317
  export { createMcpAppBridge };
319
318
 
320
319
  //# sourceMappingURL=bridge.js.map
@@ -1,4 +1,4 @@
1
- //#region src/mcp-apps/csp.ts
1
+ // src/mcp-apps/csp.ts
2
2
  const isAllowedOrigin = (value, allowWebSocket) => {
3
3
  if (!(allowWebSocket ? /^(?:https?|wss?):\/\//i : /^https?:\/\//i).test(value) || /[\s;'"`,]/.test(value)) return false;
4
4
  try {
@@ -87,7 +87,6 @@ const applyMcpAppCsp = (html, csp) => {
87
87
  const insertionPoint = findDoctypeEnd(normalizedHtml);
88
88
  return `${normalizedHtml.slice(0, insertionPoint)}${meta}${normalizedHtml.slice(insertionPoint)}`;
89
89
  };
90
- //#endregion
91
90
  export { applyMcpAppCsp, buildMcpAppCsp };
92
91
 
93
92
  //# sourceMappingURL=csp.js.map
@@ -1,7 +1,6 @@
1
- //#region src/mcp-apps/types.ts
1
+ // src/mcp-apps/types.ts
2
2
  const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
3
3
  const MCP_APP_PROTOCOL_VERSION = "0.1";
4
- //#endregion
5
4
  export { MCP_APP_MIME_TYPE, MCP_APP_PROTOCOL_VERSION };
6
5
 
7
6
  //# sourceMappingURL=types.js.map
@@ -1,5 +1,5 @@
1
1
  import { isMcpAppUri } from "@assistant-ui/core";
2
- //#region src/mcp-apps/utils.ts
2
+ // src/mcp-apps/utils.ts
3
3
  /**
4
4
  * Returns MCP app metadata for a tool-call part that points at a `ui://`
5
5
  * resource.
@@ -13,7 +13,6 @@ function getMcpAppFromToolPart(part) {
13
13
  if (!isMcpAppUri(app.resourceUri)) return void 0;
14
14
  return app;
15
15
  }
16
- //#endregion
17
16
  export { getMcpAppFromToolPart };
18
17
 
19
18
  //# sourceMappingURL=utils.js.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { AssistantFrameHost } from "@assistant-ui/core";
3
3
  import { useEffect } from "@assistant-ui/tap/react-shim";
4
- //#region src/model-context/frame/useAssistantFrameHost.ts
4
+ // src/model-context/frame/useAssistantFrameHost.ts
5
5
  /**
6
6
  * React hook that manages the lifecycle of an AssistantFrameHost and its binding to the current AssistantRuntime.
7
7
  *
@@ -91,7 +91,6 @@ const useAssistantFrameHost = ({ iframeRef, targetOrigin, register }) => {
91
91
  register
92
92
  ]);
93
93
  };
94
- //#endregion
95
94
  export { useAssistantFrameHost };
96
95
 
97
96
  //# sourceMappingURL=useAssistantFrameHost.js.map
@@ -5,7 +5,7 @@ import { createContext, forwardRef, useContext, useEffect, useId, useRef } from
5
5
  import { useAui } from "@assistant-ui/store";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { useComposedRefs } from "radix-ui/internal";
8
- //#region src/model-context/makeAssistantVisible.tsx
8
+ // src/model-context/makeAssistantVisible.tsx
9
9
  const DEFAULT_ACTION_SETTLE_DELAY_MS = 2e3;
10
10
  const MAX_ACTION_SETTLE_DELAY_MS = 2147483647;
11
11
  const waitForSettle = async (settleDelayMs) => {
@@ -144,7 +144,6 @@ const makeAssistantVisible = (Component, config) => {
144
144
  ReadableComponent.displayName = Component.displayName;
145
145
  return ReadableComponent;
146
146
  };
147
- //#endregion
148
147
  export { makeAssistantVisible as default, makeAssistantVisible };
149
148
 
150
149
  //# sourceMappingURL=makeAssistantVisible.js.map
@@ -49,7 +49,7 @@ export declare namespace ActionBarPrimitiveCopy {
49
49
  * ```
50
50
  */
51
51
  export declare const ActionBarPrimitiveCopy: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
52
- asChild?: boolean;
52
+ asChild?: boolean | undefined;
53
53
  }, "ref"> & {
54
54
  render?: import("react").ReactElement | undefined;
55
55
  } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & {
@@ -6,7 +6,7 @@ import { forwardRef } from "@assistant-ui/tap/react-shim";
6
6
  import { useAuiState } from "@assistant-ui/store";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import { composeEventHandlers } from "radix-ui/internal";
9
- //#region src/primitives/actionBar/ActionBarCopy.tsx
9
+ // src/primitives/actionBar/ActionBarCopy.tsx
10
10
  /**
11
11
  * Hook that provides copy functionality for action bar buttons.
12
12
  *
@@ -144,7 +144,6 @@ function _temp(text) {
144
144
  function _temp2(s) {
145
145
  return s.message.isCopied;
146
146
  }
147
- //#endregion
148
147
  export { ActionBarPrimitiveCopy };
149
148
 
150
149
  //# sourceMappingURL=ActionBarCopy.js.map
@@ -43,7 +43,7 @@ export declare namespace ActionBarPrimitiveEdit {
43
43
  * ```
44
44
  */
45
45
  export declare const ActionBarPrimitiveEdit: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
46
- asChild?: boolean;
46
+ asChild?: boolean | undefined;
47
47
  }, "ref"> & {
48
48
  render?: import("react").ReactElement | undefined;
49
49
  } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createActionButton } from "../../utils/createActionButton.js";
3
3
  import { useActionBarEdit } from "@assistant-ui/core/react";
4
- //#region src/primitives/actionBar/ActionBarEdit.ts
4
+ // src/primitives/actionBar/ActionBarEdit.ts
5
5
  /**
6
6
  * Hook that provides edit functionality for action bar buttons.
7
7
  *
@@ -42,7 +42,6 @@ const useActionBarEdit$1 = () => {
42
42
  * ```
43
43
  */
44
44
  const ActionBarPrimitiveEdit = createActionButton("ActionBarPrimitive.Edit", useActionBarEdit$1);
45
- //#endregion
46
45
  export { ActionBarPrimitiveEdit };
47
46
 
48
47
  //# sourceMappingURL=ActionBarEdit.js.map
@@ -8,7 +8,7 @@ export declare namespace ActionBarPrimitiveExportMarkdown {
8
8
  type Props = ActionButtonProps<typeof useActionBarExportMarkdown>;
9
9
  }
10
10
  export declare const ActionBarPrimitiveExportMarkdown: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
11
- asChild?: boolean;
11
+ asChild?: boolean | undefined;
12
12
  }, "ref"> & {
13
13
  render?: import("react").ReactElement | undefined;
14
14
  } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & {
@@ -5,7 +5,7 @@ import { forwardRef } from "@assistant-ui/tap/react-shim";
5
5
  import { useAui, useAuiState } from "@assistant-ui/store";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { composeEventHandlers } from "radix-ui/internal";
8
- //#region src/primitives/actionBar/ActionBarExportMarkdown.tsx
8
+ // src/primitives/actionBar/ActionBarExportMarkdown.tsx
9
9
  const useActionBarExportMarkdown = (t0) => {
10
10
  const $ = c(6);
11
11
  let t1;
@@ -122,7 +122,6 @@ function _temp2(s) {
122
122
  function _temp3(error) {
123
123
  console.error("[assistant-ui] markdown export failed:", error);
124
124
  }
125
- //#endregion
126
125
  export { ActionBarPrimitiveExportMarkdown };
127
126
 
128
127
  //# sourceMappingURL=ActionBarExportMarkdown.js.map
@@ -5,7 +5,7 @@ export declare namespace ActionBarPrimitiveFeedbackNegative {
5
5
  type Props = ActionButtonProps<typeof useActionBarFeedbackNegative>;
6
6
  }
7
7
  export declare const ActionBarPrimitiveFeedbackNegative: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
- asChild?: boolean;
8
+ asChild?: boolean | undefined;
9
9
  }, "ref"> & {
10
10
  render?: import("react").ReactElement | undefined;
11
11
  } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -6,7 +6,7 @@ import { forwardRef } from "@assistant-ui/tap/react-shim";
6
6
  import { useAuiState } from "@assistant-ui/store";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import { composeEventHandlers } from "radix-ui/internal";
9
- //#region src/primitives/actionBar/ActionBarFeedbackNegative.tsx
9
+ // src/primitives/actionBar/ActionBarFeedbackNegative.tsx
10
10
  const useActionBarFeedbackNegative$1 = () => {
11
11
  const { submit } = useActionBarFeedbackNegative();
12
12
  return submit;
@@ -76,7 +76,6 @@ ActionBarPrimitiveFeedbackNegative.displayName = "ActionBarPrimitive.FeedbackNeg
76
76
  function _temp(s) {
77
77
  return s.message.metadata.submittedFeedback?.type === "negative";
78
78
  }
79
- //#endregion
80
79
  export { ActionBarPrimitiveFeedbackNegative };
81
80
 
82
81
  //# sourceMappingURL=ActionBarFeedbackNegative.js.map
@@ -5,7 +5,7 @@ export declare namespace ActionBarPrimitiveFeedbackPositive {
5
5
  type Props = ActionButtonProps<typeof useActionBarFeedbackPositive>;
6
6
  }
7
7
  export declare const ActionBarPrimitiveFeedbackPositive: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
- asChild?: boolean;
8
+ asChild?: boolean | undefined;
9
9
  }, "ref"> & {
10
10
  render?: import("react").ReactElement | undefined;
11
11
  } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -6,7 +6,7 @@ import { forwardRef } from "@assistant-ui/tap/react-shim";
6
6
  import { useAuiState } from "@assistant-ui/store";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import { composeEventHandlers } from "radix-ui/internal";
9
- //#region src/primitives/actionBar/ActionBarFeedbackPositive.tsx
9
+ // src/primitives/actionBar/ActionBarFeedbackPositive.tsx
10
10
  const useActionBarFeedbackPositive$1 = () => {
11
11
  const { submit } = useActionBarFeedbackPositive();
12
12
  return submit;
@@ -76,7 +76,6 @@ ActionBarPrimitiveFeedbackPositive.displayName = "ActionBarPrimitive.FeedbackPos
76
76
  function _temp(s) {
77
77
  return s.message.metadata.submittedFeedback?.type === "positive";
78
78
  }
79
- //#endregion
80
79
  export { ActionBarPrimitiveFeedbackPositive };
81
80
 
82
81
  //# sourceMappingURL=ActionBarFeedbackPositive.js.map
@@ -1,11 +1,10 @@
1
1
  "use client";
2
2
  import { createContext, useContext } from "@assistant-ui/tap/react-shim";
3
- //#region src/primitives/actionBar/ActionBarInteractionContext.ts
3
+ // src/primitives/actionBar/ActionBarInteractionContext.ts
4
4
  const ActionBarInteractionContext = createContext(null);
5
5
  const useActionBarInteractionContext = () => {
6
6
  return useContext(ActionBarInteractionContext);
7
7
  };
8
- //#endregion
9
8
  export { ActionBarInteractionContext, useActionBarInteractionContext };
10
9
 
11
10
  //# sourceMappingURL=ActionBarInteractionContext.js.map
@@ -44,7 +44,7 @@ export declare namespace ActionBarPrimitiveReload {
44
44
  * ```
45
45
  */
46
46
  export declare const ActionBarPrimitiveReload: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
47
- asChild?: boolean;
47
+ asChild?: boolean | undefined;
48
48
  }, "ref"> & {
49
49
  render?: import("react").ReactElement | undefined;
50
50
  } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createActionButton } from "../../utils/createActionButton.js";
3
3
  import { useActionBarReload } from "@assistant-ui/core/react";
4
- //#region src/primitives/actionBar/ActionBarReload.ts
4
+ // src/primitives/actionBar/ActionBarReload.ts
5
5
  /**
6
6
  * Hook that provides reload functionality for action bar buttons.
7
7
  *
@@ -43,7 +43,6 @@ const useActionBarReload$1 = () => {
43
43
  * ```
44
44
  */
45
45
  const ActionBarPrimitiveReload = createActionButton("ActionBarPrimitive.Reload", useActionBarReload$1);
46
- //#endregion
47
46
  export { ActionBarPrimitiveReload };
48
47
 
49
48
  //# sourceMappingURL=ActionBarReload.js.map
@@ -48,7 +48,7 @@ export declare namespace ActionBarPrimitiveRoot {
48
48
  * ```
49
49
  */
50
50
  export declare const ActionBarPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
51
- asChild?: boolean;
51
+ asChild?: boolean | undefined;
52
52
  }, "ref"> & {
53
53
  render?: import("react").ReactElement | undefined;
54
54
  } & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
@@ -5,7 +5,7 @@ import { ActionBarInteractionContext } from "./ActionBarInteractionContext.js";
5
5
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
6
6
  import { forwardRef, useState } from "@assistant-ui/tap/react-shim";
7
7
  import { jsx } from "react/jsx-runtime";
8
- //#region src/primitives/actionBar/ActionBarRoot.tsx
8
+ // src/primitives/actionBar/ActionBarRoot.tsx
9
9
  /**
10
10
  * The root container for action bar components.
11
11
  *
@@ -113,7 +113,6 @@ function _temp(count) {
113
113
  function _temp2(count_0) {
114
114
  return Math.max(0, count_0 - 1);
115
115
  }
116
- //#endregion
117
116
  export { ActionBarPrimitiveRoot };
118
117
 
119
118
  //# sourceMappingURL=ActionBarRoot.js.map
@@ -5,7 +5,7 @@ export declare namespace ActionBarPrimitiveSpeak {
5
5
  type Props = ActionButtonProps<typeof useActionBarSpeak>;
6
6
  }
7
7
  export declare const ActionBarPrimitiveSpeak: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
- asChild?: boolean;
8
+ asChild?: boolean | undefined;
9
9
  }, "ref"> & {
10
10
  render?: import("react").ReactElement | undefined;
11
11
  } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,14 +1,13 @@
1
1
  "use client";
2
2
  import { createActionButton } from "../../utils/createActionButton.js";
3
3
  import { useActionBarSpeak } from "@assistant-ui/core/react";
4
- //#region src/primitives/actionBar/ActionBarSpeak.ts
4
+ // src/primitives/actionBar/ActionBarSpeak.ts
5
5
  const useActionBarSpeak$1 = () => {
6
6
  const { disabled, speak } = useActionBarSpeak();
7
7
  if (disabled) return null;
8
8
  return speak;
9
9
  };
10
10
  const ActionBarPrimitiveSpeak = createActionButton("ActionBarPrimitive.Speak", useActionBarSpeak$1);
11
- //#endregion
12
11
  export { ActionBarPrimitiveSpeak };
13
12
 
14
13
  //# sourceMappingURL=ActionBarSpeak.js.map
@@ -5,7 +5,7 @@ export declare namespace ActionBarPrimitiveStopSpeaking {
5
5
  type Props = ActionButtonProps<typeof useActionBarStopSpeaking>;
6
6
  }
7
7
  export declare const ActionBarPrimitiveStopSpeaking: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
- asChild?: boolean;
8
+ asChild?: boolean | undefined;
9
9
  }, "ref"> & {
10
10
  render?: import("react").ReactElement | undefined;
11
11
  } & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -5,7 +5,7 @@ import { useActionBarStopSpeaking } from "@assistant-ui/core/react";
5
5
  import { forwardRef } from "@assistant-ui/tap/react-shim";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { composeEventHandlers } from "radix-ui/internal";
8
- //#region src/primitives/actionBar/ActionBarStopSpeaking.tsx
8
+ // src/primitives/actionBar/ActionBarStopSpeaking.tsx
9
9
  const useActionBarStopSpeaking$1 = () => {
10
10
  const { disabled, stopSpeaking } = useActionBarStopSpeaking();
11
11
  if (disabled) return null;
@@ -48,7 +48,6 @@ const ActionBarPrimitiveStopSpeaking = forwardRef((props, ref) => {
48
48
  return t3;
49
49
  });
50
50
  ActionBarPrimitiveStopSpeaking.displayName = "ActionBarPrimitive.StopSpeaking";
51
- //#endregion
52
51
  export { ActionBarPrimitiveStopSpeaking };
53
52
 
54
53
  //# sourceMappingURL=ActionBarStopSpeaking.js.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
3
  import { useAuiState } from "@assistant-ui/store";
4
- //#region src/primitives/actionBar/useActionBarFloatStatus.ts
4
+ // src/primitives/actionBar/useActionBarFloatStatus.ts
5
5
  const HideAndFloatStatus = {
6
6
  Hidden: "hidden",
7
7
  Floating: "floating",
@@ -29,7 +29,6 @@ const useActionBarFloatStatus = (t0) => {
29
29
  } else t1 = $[4];
30
30
  return useAuiState(t1);
31
31
  };
32
- //#endregion
33
32
  export { HideAndFloatStatus, useActionBarFloatStatus };
34
33
 
35
34
  //# sourceMappingURL=useActionBarFloatStatus.js.map
@@ -8,7 +8,7 @@ import { ActionBarPrimitiveStopSpeaking } from "./actionBar/ActionBarStopSpeakin
8
8
  import { ActionBarPrimitiveFeedbackPositive } from "./actionBar/ActionBarFeedbackPositive.js";
9
9
  import { ActionBarPrimitiveFeedbackNegative } from "./actionBar/ActionBarFeedbackNegative.js";
10
10
  import { ActionBarPrimitiveExportMarkdown } from "./actionBar/ActionBarExportMarkdown.js";
11
- //#region src/primitives/actionBar.ts
11
+ // src/primitives/actionBar.ts
12
12
  var actionBar_exports = /* @__PURE__ */ __exportAll({
13
13
  Copy: () => ActionBarPrimitiveCopy,
14
14
  Edit: () => ActionBarPrimitiveEdit,
@@ -20,7 +20,6 @@ var actionBar_exports = /* @__PURE__ */ __exportAll({
20
20
  Speak: () => ActionBarPrimitiveSpeak,
21
21
  StopSpeaking: () => ActionBarPrimitiveStopSpeaking
22
22
  });
23
- //#endregion
24
23
  export { ActionBarPrimitiveCopy as Copy, ActionBarPrimitiveEdit as Edit, ActionBarPrimitiveExportMarkdown as ExportMarkdown, ActionBarPrimitiveFeedbackNegative as FeedbackNegative, ActionBarPrimitiveFeedbackPositive as FeedbackPositive, ActionBarPrimitiveReload as Reload, ActionBarPrimitiveRoot as Root, ActionBarPrimitiveSpeak as Speak, ActionBarPrimitiveStopSpeaking as StopSpeaking, actionBar_exports };
25
24
 
26
25
  //# sourceMappingURL=actionBar.js.map