@assistant-ui/react 0.12.11 → 0.12.14

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 (357) hide show
  1. package/README.md +68 -58
  2. package/dist/client/ExternalThread.d.ts.map +1 -1
  3. package/dist/client/ExternalThread.js +25 -13
  4. package/dist/client/ExternalThread.js.map +1 -1
  5. package/dist/client/InMemoryThreadList.d.ts.map +1 -1
  6. package/dist/client/InMemoryThreadList.js +1 -2
  7. package/dist/client/InMemoryThreadList.js.map +1 -1
  8. package/dist/client/index.d.ts +1 -2
  9. package/dist/client/index.d.ts.map +1 -1
  10. package/dist/client/index.js +2 -2
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/context/providers/AttachmentByIndexProvider.d.ts +1 -7
  13. package/dist/context/providers/AttachmentByIndexProvider.d.ts.map +1 -1
  14. package/dist/context/providers/AttachmentByIndexProvider.js +1 -22
  15. package/dist/context/providers/AttachmentByIndexProvider.js.map +1 -1
  16. package/dist/context/providers/ChainOfThoughtByIndicesProvider.d.ts +1 -5
  17. package/dist/context/providers/ChainOfThoughtByIndicesProvider.d.ts.map +1 -1
  18. package/dist/context/providers/ChainOfThoughtByIndicesProvider.js +1 -19
  19. package/dist/context/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
  20. package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts +1 -4
  21. package/dist/context/providers/ChainOfThoughtPartByIndexProvider.d.ts.map +1 -1
  22. package/dist/context/providers/ChainOfThoughtPartByIndexProvider.js +1 -12
  23. package/dist/context/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
  24. package/dist/context/providers/MessageByIndexProvider.d.ts +1 -4
  25. package/dist/context/providers/MessageByIndexProvider.d.ts.map +1 -1
  26. package/dist/context/providers/MessageByIndexProvider.js +1 -17
  27. package/dist/context/providers/MessageByIndexProvider.js.map +1 -1
  28. package/dist/context/providers/PartByIndexProvider.d.ts +1 -4
  29. package/dist/context/providers/PartByIndexProvider.d.ts.map +1 -1
  30. package/dist/context/providers/PartByIndexProvider.js +1 -12
  31. package/dist/context/providers/PartByIndexProvider.js.map +1 -1
  32. package/dist/context/providers/SuggestionByIndexProvider.d.ts +1 -5
  33. package/dist/context/providers/SuggestionByIndexProvider.d.ts.map +1 -1
  34. package/dist/context/providers/SuggestionByIndexProvider.js +1 -12
  35. package/dist/context/providers/SuggestionByIndexProvider.js.map +1 -1
  36. package/dist/context/providers/TextMessagePartProvider.d.ts +1 -5
  37. package/dist/context/providers/TextMessagePartProvider.d.ts.map +1 -1
  38. package/dist/context/providers/TextMessagePartProvider.js +1 -25
  39. package/dist/context/providers/TextMessagePartProvider.js.map +1 -1
  40. package/dist/context/providers/ThreadListItemProvider.d.ts +1 -9
  41. package/dist/context/providers/ThreadListItemProvider.d.ts.map +1 -1
  42. package/dist/context/providers/ThreadListItemProvider.js +1 -19
  43. package/dist/context/providers/ThreadListItemProvider.js.map +1 -1
  44. package/dist/context/providers/index.d.ts +1 -0
  45. package/dist/context/providers/index.d.ts.map +1 -1
  46. package/dist/context/providers/index.js +1 -0
  47. package/dist/context/providers/index.js.map +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/legacy-runtime/AssistantRuntimeProvider.d.ts.map +1 -1
  53. package/dist/legacy-runtime/AssistantRuntimeProvider.js +8 -9
  54. package/dist/legacy-runtime/AssistantRuntimeProvider.js.map +1 -1
  55. package/dist/legacy-runtime/RuntimeAdapter.d.ts +1 -2
  56. package/dist/legacy-runtime/RuntimeAdapter.d.ts.map +1 -1
  57. package/dist/legacy-runtime/RuntimeAdapter.js +1 -48
  58. package/dist/legacy-runtime/RuntimeAdapter.js.map +1 -1
  59. package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
  60. package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js +135 -27
  61. package/dist/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
  62. package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +280 -112
  63. package/dist/legacy-runtime/hooks/AttachmentContext.d.ts.map +1 -1
  64. package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js +1 -1
  65. package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js.map +1 -1
  66. package/dist/legacy-runtime/runtime-cores/assistant-transport/index.d.ts +1 -1
  67. package/dist/legacy-runtime/runtime-cores/assistant-transport/index.d.ts.map +1 -1
  68. package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +22 -0
  69. package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +1 -1
  70. package/dist/legacy-runtime/runtime-cores/assistant-transport/types.js.map +1 -1
  71. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
  72. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +17 -13
  73. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
  74. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts.map +1 -1
  75. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +8 -6
  76. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js.map +1 -1
  77. package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts +1 -1
  78. package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts.map +1 -1
  79. package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js +1 -1
  80. package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js.map +1 -1
  81. package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts +1 -1
  82. package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts.map +1 -1
  83. package/dist/legacy-runtime/runtime-cores/external-store/index.js +1 -1
  84. package/dist/legacy-runtime/runtime-cores/external-store/index.js.map +1 -1
  85. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
  86. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +14 -4
  87. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
  88. package/dist/model-context/index.d.ts +4 -13
  89. package/dist/model-context/index.d.ts.map +1 -1
  90. package/dist/model-context/index.js +6 -11
  91. package/dist/model-context/index.js.map +1 -1
  92. package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts +1 -1
  93. package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts.map +1 -1
  94. package/dist/primitives/actionBarMore/ActionBarMoreContent.js +1 -1
  95. package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -1
  96. package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts +1 -1
  97. package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts.map +1 -1
  98. package/dist/primitives/actionBarMore/ActionBarMoreItem.js +1 -1
  99. package/dist/primitives/actionBarMore/ActionBarMoreItem.js.map +1 -1
  100. package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts +1 -1
  101. package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts.map +1 -1
  102. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +1 -1
  103. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js.map +1 -1
  104. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts +1 -1
  105. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts.map +1 -1
  106. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +1 -1
  107. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js.map +1 -1
  108. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts +1 -1
  109. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts.map +1 -1
  110. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +1 -1
  111. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js.map +1 -1
  112. package/dist/primitives/actionBarMore/scope.d.ts +1 -1
  113. package/dist/primitives/actionBarMore/scope.d.ts.map +1 -1
  114. package/dist/primitives/actionBarMore/scope.js +1 -1
  115. package/dist/primitives/actionBarMore/scope.js.map +1 -1
  116. package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts +1 -1
  117. package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts.map +1 -1
  118. package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -1
  119. package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
  120. package/dist/primitives/assistantModal/AssistantModalContent.d.ts +1 -1
  121. package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
  122. package/dist/primitives/assistantModal/AssistantModalContent.js +1 -1
  123. package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
  124. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts +1 -1
  125. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
  126. package/dist/primitives/assistantModal/AssistantModalRoot.js +1 -1
  127. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  128. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts +1 -1
  129. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
  130. package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -1
  131. package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
  132. package/dist/primitives/assistantModal/scope.d.ts +1 -1
  133. package/dist/primitives/assistantModal/scope.d.ts.map +1 -1
  134. package/dist/primitives/assistantModal/scope.js +1 -1
  135. package/dist/primitives/assistantModal/scope.js.map +1 -1
  136. package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts +1 -38
  137. package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
  138. package/dist/primitives/chainOfThought/ChainOfThoughtParts.js +1 -38
  139. package/dist/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
  140. package/dist/primitives/composer/ComposerAttachmentDropzone.js +2 -2
  141. package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
  142. package/dist/primitives/composer/ComposerAttachments.d.ts +1 -36
  143. package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
  144. package/dist/primitives/composer/ComposerAttachments.js +1 -61
  145. package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
  146. package/dist/primitives/composer/ComposerIf.d.ts +2 -17
  147. package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
  148. package/dist/primitives/composer/ComposerIf.js +1 -23
  149. package/dist/primitives/composer/ComposerIf.js.map +1 -1
  150. package/dist/primitives/composer/ComposerInput.js +2 -2
  151. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  152. package/dist/primitives/message/MessageAttachments.d.ts +1 -36
  153. package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
  154. package/dist/primitives/message/MessageAttachments.js +1 -65
  155. package/dist/primitives/message/MessageAttachments.js.map +1 -1
  156. package/dist/primitives/message/MessageIf.d.ts +1 -1
  157. package/dist/primitives/message/MessageIf.js +1 -1
  158. package/dist/primitives/message/MessageParts.d.ts +5 -219
  159. package/dist/primitives/message/MessageParts.d.ts.map +1 -1
  160. package/dist/primitives/message/MessageParts.js +29 -270
  161. package/dist/primitives/message/MessageParts.js.map +1 -1
  162. package/dist/primitives/message/MessagePartsGrouped.d.ts +1 -1
  163. package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
  164. package/dist/primitives/message/MessagePartsGrouped.js +2 -2
  165. package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
  166. package/dist/primitives/thread/ThreadEmpty.d.ts +3 -0
  167. package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
  168. package/dist/primitives/thread/ThreadEmpty.js +4 -1
  169. package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
  170. package/dist/primitives/thread/ThreadIf.d.ts +1 -1
  171. package/dist/primitives/thread/ThreadIf.js +1 -1
  172. package/dist/primitives/thread/ThreadMessages.d.ts +1 -94
  173. package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
  174. package/dist/primitives/thread/ThreadMessages.js +1 -109
  175. package/dist/primitives/thread/ThreadMessages.js.map +1 -1
  176. package/dist/primitives/thread/ThreadSuggestions.d.ts +1 -52
  177. package/dist/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
  178. package/dist/primitives/thread/ThreadSuggestions.js +1 -56
  179. package/dist/primitives/thread/ThreadSuggestions.js.map +1 -1
  180. package/dist/primitives/thread/ThreadViewportSlack.js +2 -2
  181. package/dist/primitives/thread/ThreadViewportSlack.js.map +1 -1
  182. package/dist/primitives/threadList/ThreadListItems.d.ts +1 -34
  183. package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
  184. package/dist/primitives/threadList/ThreadListItems.js +1 -35
  185. package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
  186. package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts +1 -7
  187. package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
  188. package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -7
  189. package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
  190. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts +1 -1
  191. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts.map +1 -1
  192. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +1 -1
  193. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -1
  194. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts +1 -1
  195. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts.map +1 -1
  196. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +1 -1
  197. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js.map +1 -1
  198. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts +1 -1
  199. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts.map +1 -1
  200. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js +1 -1
  201. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -1
  202. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts +1 -1
  203. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts.map +1 -1
  204. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +1 -1
  205. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js.map +1 -1
  206. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts +1 -1
  207. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts.map +1 -1
  208. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +1 -1
  209. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js.map +1 -1
  210. package/dist/primitives/threadListItemMore/scope.d.ts +1 -1
  211. package/dist/primitives/threadListItemMore/scope.d.ts.map +1 -1
  212. package/dist/primitives/threadListItemMore/scope.js +1 -1
  213. package/dist/primitives/threadListItemMore/scope.js.map +1 -1
  214. package/dist/types/index.d.ts +2 -2
  215. package/dist/types/index.d.ts.map +1 -1
  216. package/dist/types/scopes/index.d.ts +1 -2
  217. package/dist/types/scopes/index.d.ts.map +1 -1
  218. package/package.json +10 -12
  219. package/src/client/ExternalThread.ts +25 -13
  220. package/src/client/InMemoryThreadList.ts +1 -2
  221. package/src/client/index.ts +3 -2
  222. package/src/context/providers/AttachmentByIndexProvider.tsx +4 -34
  223. package/src/context/providers/ChainOfThoughtByIndicesProvider.tsx +1 -34
  224. package/src/context/providers/ChainOfThoughtPartByIndexProvider.tsx +1 -18
  225. package/src/context/providers/MessageByIndexProvider.tsx +1 -23
  226. package/src/context/providers/PartByIndexProvider.tsx +1 -18
  227. package/src/context/providers/SuggestionByIndexProvider.tsx +4 -21
  228. package/src/context/providers/TextMessagePartProvider.tsx +1 -46
  229. package/src/context/providers/ThreadListItemProvider.tsx +4 -33
  230. package/src/context/providers/index.ts +1 -0
  231. package/src/index.ts +1 -1
  232. package/src/legacy-runtime/AssistantRuntimeProvider.tsx +13 -21
  233. package/src/legacy-runtime/RuntimeAdapter.ts +1 -66
  234. package/src/legacy-runtime/cloud/AssistantCloudThreadHistoryAdapter.ts +179 -40
  235. package/src/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.ts +1 -1
  236. package/src/legacy-runtime/runtime-cores/assistant-transport/index.ts +1 -0
  237. package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +25 -0
  238. package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +22 -13
  239. package/src/legacy-runtime/runtime-cores/assistant-transport/useToolInvocations.test.ts +6 -3
  240. package/src/legacy-runtime/runtime-cores/external-store/external-message-converter.ts +19 -21
  241. package/src/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.ts +1 -0
  242. package/src/legacy-runtime/runtime-cores/external-store/index.ts +1 -0
  243. package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts +20 -4
  244. package/src/model-context/index.ts +29 -22
  245. package/src/primitives/actionBarMore/ActionBarMoreContent.tsx +1 -1
  246. package/src/primitives/actionBarMore/ActionBarMoreItem.tsx +1 -1
  247. package/src/primitives/actionBarMore/ActionBarMoreRoot.tsx +1 -1
  248. package/src/primitives/actionBarMore/ActionBarMoreSeparator.tsx +1 -1
  249. package/src/primitives/actionBarMore/ActionBarMoreTrigger.tsx +1 -1
  250. package/src/primitives/actionBarMore/scope.ts +1 -1
  251. package/src/primitives/assistantModal/AssistantModalAnchor.tsx +1 -1
  252. package/src/primitives/assistantModal/AssistantModalContent.tsx +1 -1
  253. package/src/primitives/assistantModal/AssistantModalRoot.tsx +1 -1
  254. package/src/primitives/assistantModal/AssistantModalTrigger.tsx +1 -1
  255. package/src/primitives/assistantModal/scope.ts +1 -1
  256. package/src/primitives/chainOfThought/ChainOfThoughtParts.tsx +1 -85
  257. package/src/primitives/composer/ComposerAttachmentDropzone.tsx +2 -2
  258. package/src/primitives/composer/ComposerAttachments.tsx +4 -110
  259. package/src/primitives/composer/ComposerIf.ts +2 -42
  260. package/src/primitives/composer/ComposerInput.tsx +2 -2
  261. package/src/primitives/message/MessageAttachments.tsx +4 -113
  262. package/src/primitives/message/MessageIf.ts +1 -1
  263. package/src/primitives/message/MessageParts.tsx +43 -642
  264. package/src/primitives/message/MessagePartsGrouped.tsx +3 -3
  265. package/src/primitives/thread/ThreadEmpty.ts +4 -3
  266. package/src/primitives/thread/ThreadIf.ts +1 -1
  267. package/src/primitives/thread/ThreadMessages.tsx +4 -217
  268. package/src/primitives/thread/ThreadSuggestions.tsx +4 -106
  269. package/src/primitives/thread/ThreadViewportSlack.tsx +2 -2
  270. package/src/primitives/threadList/ThreadListItems.tsx +4 -79
  271. package/src/primitives/threadListItem/ThreadListItemTitle.test.tsx +7 -3
  272. package/src/primitives/threadListItem/ThreadListItemTitle.tsx +1 -17
  273. package/src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx +1 -1
  274. package/src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx +1 -1
  275. package/src/primitives/threadListItemMore/ThreadListItemMoreRoot.tsx +1 -1
  276. package/src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx +1 -1
  277. package/src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx +1 -1
  278. package/src/primitives/threadListItemMore/scope.ts +1 -1
  279. package/src/tests/BaseComposerRuntimeCore.test.ts +106 -1
  280. package/src/tests/DataRenderers.test.ts +1 -2
  281. package/src/types/index.ts +3 -2
  282. package/src/types/scopes/index.ts +5 -3
  283. package/dist/client/DataRenderers.d.ts +0 -3
  284. package/dist/client/DataRenderers.d.ts.map +0 -1
  285. package/dist/client/DataRenderers.js +0 -33
  286. package/dist/client/DataRenderers.js.map +0 -1
  287. package/dist/client/Tools.d.ts +0 -8
  288. package/dist/client/Tools.d.ts.map +0 -1
  289. package/dist/client/Tools.js +0 -68
  290. package/dist/client/Tools.js.map +0 -1
  291. package/dist/model-context/makeAssistantDataUI.d.ts +0 -7
  292. package/dist/model-context/makeAssistantDataUI.d.ts.map +0 -1
  293. package/dist/model-context/makeAssistantDataUI.js +0 -11
  294. package/dist/model-context/makeAssistantDataUI.js.map +0 -1
  295. package/dist/model-context/makeAssistantTool.d.ts +0 -7
  296. package/dist/model-context/makeAssistantTool.d.ts.map +0 -1
  297. package/dist/model-context/makeAssistantTool.js +0 -11
  298. package/dist/model-context/makeAssistantTool.js.map +0 -1
  299. package/dist/model-context/makeAssistantToolUI.d.ts +0 -7
  300. package/dist/model-context/makeAssistantToolUI.d.ts.map +0 -1
  301. package/dist/model-context/makeAssistantToolUI.js +0 -11
  302. package/dist/model-context/makeAssistantToolUI.js.map +0 -1
  303. package/dist/model-context/toolbox.d.ts +0 -10
  304. package/dist/model-context/toolbox.d.ts.map +0 -1
  305. package/dist/model-context/toolbox.js +0 -3
  306. package/dist/model-context/toolbox.js.map +0 -1
  307. package/dist/model-context/useAssistantDataUI.d.ts +0 -7
  308. package/dist/model-context/useAssistantDataUI.d.ts.map +0 -1
  309. package/dist/model-context/useAssistantDataUI.js +0 -12
  310. package/dist/model-context/useAssistantDataUI.js.map +0 -1
  311. package/dist/model-context/useAssistantInstructions.d.ts +0 -4
  312. package/dist/model-context/useAssistantInstructions.d.ts.map +0 -1
  313. package/dist/model-context/useAssistantInstructions.js +0 -23
  314. package/dist/model-context/useAssistantInstructions.js.map +0 -1
  315. package/dist/model-context/useAssistantTool.d.ts +0 -7
  316. package/dist/model-context/useAssistantTool.d.ts.map +0 -1
  317. package/dist/model-context/useAssistantTool.js +0 -23
  318. package/dist/model-context/useAssistantTool.js.map +0 -1
  319. package/dist/model-context/useAssistantToolUI.d.ts +0 -7
  320. package/dist/model-context/useAssistantToolUI.d.ts.map +0 -1
  321. package/dist/model-context/useAssistantToolUI.js +0 -12
  322. package/dist/model-context/useAssistantToolUI.js.map +0 -1
  323. package/dist/model-context/useInlineRender.d.ts +0 -4
  324. package/dist/model-context/useInlineRender.d.ts.map +0 -1
  325. package/dist/model-context/useInlineRender.js +0 -16
  326. package/dist/model-context/useInlineRender.js.map +0 -1
  327. package/dist/types/MessagePartComponentTypes.d.ts +0 -33
  328. package/dist/types/MessagePartComponentTypes.d.ts.map +0 -1
  329. package/dist/types/MessagePartComponentTypes.js +0 -2
  330. package/dist/types/MessagePartComponentTypes.js.map +0 -1
  331. package/dist/types/scopes/dataRenderers.d.ts +0 -13
  332. package/dist/types/scopes/dataRenderers.d.ts.map +0 -1
  333. package/dist/types/scopes/dataRenderers.js +0 -2
  334. package/dist/types/scopes/dataRenderers.js.map +0 -1
  335. package/dist/types/scopes/tools.d.ts +0 -13
  336. package/dist/types/scopes/tools.d.ts.map +0 -1
  337. package/dist/types/scopes/tools.js +0 -2
  338. package/dist/types/scopes/tools.js.map +0 -1
  339. package/dist/types/store-augmentation.d.ts +0 -10
  340. package/dist/types/store-augmentation.d.ts.map +0 -1
  341. package/dist/types/store-augmentation.js +0 -2
  342. package/dist/types/store-augmentation.js.map +0 -1
  343. package/src/client/DataRenderers.ts +0 -42
  344. package/src/client/Tools.ts +0 -97
  345. package/src/model-context/makeAssistantDataUI.ts +0 -22
  346. package/src/model-context/makeAssistantTool.ts +0 -22
  347. package/src/model-context/makeAssistantToolUI.ts +0 -22
  348. package/src/model-context/toolbox.ts +0 -17
  349. package/src/model-context/useAssistantDataUI.ts +0 -18
  350. package/src/model-context/useAssistantInstructions.ts +0 -32
  351. package/src/model-context/useAssistantTool.ts +0 -39
  352. package/src/model-context/useAssistantToolUI.ts +0 -20
  353. package/src/model-context/useInlineRender.ts +0 -27
  354. package/src/types/MessagePartComponentTypes.ts +0 -66
  355. package/src/types/scopes/dataRenderers.ts +0 -15
  356. package/src/types/scopes/tools.ts +0 -18
  357. package/src/types/store-augmentation.ts +0 -11
@@ -1,38 +1,45 @@
1
- export { makeAssistantTool, type AssistantTool } from "./makeAssistantTool";
1
+ "use client";
2
+
3
+ // Re-export shared from core/react
2
4
  export {
3
- type AssistantToolUI,
5
+ makeAssistantTool,
6
+ type AssistantTool,
4
7
  makeAssistantToolUI,
5
- } from "./makeAssistantToolUI";
6
- export {
7
- type AssistantDataUI,
8
+ type AssistantToolUI,
8
9
  makeAssistantDataUI,
9
- } from "./makeAssistantDataUI";
10
- export { useAssistantInstructions } from "./useAssistantInstructions";
11
- export { useAssistantTool, type AssistantToolProps } from "./useAssistantTool";
12
- export {
10
+ type AssistantDataUI,
11
+ useAssistantTool,
12
+ type AssistantToolProps,
13
13
  useAssistantToolUI,
14
14
  type AssistantToolUIProps,
15
- } from "./useAssistantToolUI";
16
- export {
17
15
  useAssistantDataUI,
18
16
  type AssistantDataUIProps,
19
- } from "./useAssistantDataUI";
20
- export { useInlineRender } from "./useInlineRender";
21
-
22
- export type { ModelContext, ModelContextProvider } from "@assistant-ui/core";
17
+ useAssistantInstructions,
18
+ useInlineRender,
19
+ type Toolkit,
20
+ type ToolDefinition,
21
+ Tools,
22
+ DataRenderers,
23
+ } from "@assistant-ui/core/react";
24
+
25
+ // Core pass-through (unchanged)
26
+ export type {
27
+ ModelContext,
28
+ ModelContextProvider,
29
+ LanguageModelConfig,
30
+ LanguageModelV1CallSettings,
31
+ } from "@assistant-ui/core";
32
+
33
+ export { mergeModelContexts } from "@assistant-ui/core";
23
34
 
24
35
  export type { Tool } from "assistant-stream";
25
36
 
26
37
  export { tool } from "@assistant-ui/core";
27
38
 
28
- export { makeAssistantVisible } from "./makeAssistantVisible";
29
-
30
- export type { Toolkit, ToolDefinition } from "./toolbox";
31
-
32
- export { Tools } from "../client/Tools";
33
- export { DataRenderers } from "../client/DataRenderers";
34
-
35
39
  export { Suggestions, type SuggestionConfig } from "@assistant-ui/core/store";
36
40
 
41
+ // React-only (stays)
42
+ export { makeAssistantVisible } from "./makeAssistantVisible";
43
+
37
44
  export * from "./registry";
38
45
  export * from "./frame";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
5
5
  import { ScopedProps, useDropdownMenuScope } from "./scope";
6
6
 
7
7
  export namespace ActionBarMorePrimitiveContent {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
5
5
  import { ScopedProps, useDropdownMenuScope } from "./scope";
6
6
 
7
7
  export namespace ActionBarMorePrimitiveItem {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { FC } from "react";
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
5
5
  import { ScopedProps, useDropdownMenuScope } from "./scope";
6
6
 
7
7
  export namespace ActionBarMorePrimitiveRoot {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
5
5
  import { ScopedProps, useDropdownMenuScope } from "./scope";
6
6
 
7
7
  export namespace ActionBarMorePrimitiveSeparator {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
5
5
  import { ScopedProps, useDropdownMenuScope } from "./scope";
6
6
 
7
7
  export namespace ActionBarMorePrimitiveTrigger {
@@ -1,4 +1,4 @@
1
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
1
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
2
2
  import type { Scope } from "@radix-ui/react-context";
3
3
 
4
4
  export const useDropdownMenuScope: ReturnType<
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
4
- import * as PopoverPrimitive from "@radix-ui/react-popover";
4
+ import { Popover as PopoverPrimitive } from "radix-ui";
5
5
  import { ScopedProps, usePopoverScope } from "./scope";
6
6
 
7
7
  export namespace AssistantModalPrimitiveAnchor {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
4
- import * as PopoverPrimitive from "@radix-ui/react-popover";
4
+ import { Popover as PopoverPrimitive } from "radix-ui";
5
5
  import { ScopedProps, usePopoverScope } from "./scope";
6
6
  import { composeEventHandlers } from "@radix-ui/primitive";
7
7
 
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { FC, useEffect, useState } from "react";
4
- import * as PopoverPrimitive from "@radix-ui/react-popover";
4
+ import { Popover as PopoverPrimitive } from "radix-ui";
5
5
  import { ScopedProps, usePopoverScope } from "./scope";
6
6
  import { useAui } from "@assistant-ui/store";
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
2
- import * as PopoverPrimitive from "@radix-ui/react-popover";
2
+ import { Popover as PopoverPrimitive } from "radix-ui";
3
3
  import { ScopedProps, usePopoverScope } from "./scope";
4
4
 
5
5
  export namespace AssistantModalPrimitiveTrigger {
@@ -1,4 +1,4 @@
1
- import * as PopoverPrimitive from "@radix-ui/react-popover";
1
+ import { Popover as PopoverPrimitive } from "radix-ui";
2
2
  import type { Scope } from "@radix-ui/react-context";
3
3
 
4
4
  export const usePopoverScope: ReturnType<
@@ -1,87 +1,3 @@
1
1
  "use client";
2
2
 
3
- import {
4
- type ComponentType,
5
- type FC,
6
- type PropsWithChildren,
7
- useMemo,
8
- } from "react";
9
- import { useAuiState } from "@assistant-ui/store";
10
- import { ChainOfThoughtPartByIndexProvider } from "../../context/providers/ChainOfThoughtPartByIndexProvider";
11
- import { MessagePartComponent } from "../message/MessageParts";
12
- import type {
13
- ReasoningMessagePartComponent,
14
- ToolCallMessagePartComponent,
15
- } from "../../types/MessagePartComponentTypes";
16
-
17
- export namespace ChainOfThoughtPrimitiveParts {
18
- export type Props = {
19
- /**
20
- * Component configuration for rendering chain of thought parts.
21
- */
22
- components?: {
23
- /** Component for rendering reasoning parts */
24
- Reasoning?: ReasoningMessagePartComponent | undefined;
25
- /** Fallback component for tool-call parts */
26
- tools?: {
27
- Fallback?: ToolCallMessagePartComponent | undefined;
28
- };
29
- /** Layout component to wrap the rendered parts when expanded */
30
- Layout?: ComponentType<PropsWithChildren> | undefined;
31
- };
32
- };
33
- }
34
-
35
- /**
36
- * Renders the parts within a chain of thought, with support for collapsed/expanded states.
37
- *
38
- * When collapsed, no parts are shown. When expanded, all parts are rendered
39
- * using the provided component configuration through the part scope mechanism.
40
- *
41
- * @example
42
- * ```tsx
43
- * <ChainOfThoughtPrimitive.Parts
44
- * components={{
45
- * Reasoning: ({ text }) => <p className="reasoning">{text}</p>,
46
- * tools: {
47
- * Fallback: ({ toolName }) => <div>Tool: {toolName}</div>
48
- * }
49
- * }}
50
- * />
51
- * ```
52
- */
53
- export const ChainOfThoughtPrimitiveParts: FC<
54
- ChainOfThoughtPrimitiveParts.Props
55
- > = ({ components }) => {
56
- const partsLength = useAuiState((s) => s.chainOfThought.parts.length);
57
-
58
- const messageComponents = useMemo(
59
- () => ({
60
- Reasoning: components?.Reasoning,
61
- tools: {
62
- Fallback: components?.tools?.Fallback,
63
- },
64
- }),
65
- [components?.Reasoning, components?.tools?.Fallback],
66
- );
67
-
68
- const Layout = components?.Layout;
69
-
70
- const elements = useMemo(() => {
71
- return Array.from({ length: partsLength }, (_, index) => (
72
- <ChainOfThoughtPartByIndexProvider key={index} index={index}>
73
- {Layout ? (
74
- <Layout>
75
- <MessagePartComponent components={messageComponents} />
76
- </Layout>
77
- ) : (
78
- <MessagePartComponent components={messageComponents} />
79
- )}
80
- </ChainOfThoughtPartByIndexProvider>
81
- ));
82
- }, [partsLength, messageComponents, Layout]);
83
-
84
- return <>{elements}</>;
85
- };
86
-
87
- ChainOfThoughtPrimitiveParts.displayName = "ChainOfThoughtPrimitive.Parts";
3
+ export { ChainOfThoughtPrimitiveParts } from "@assistant-ui/core/react";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { forwardRef, useCallback, useState } from "react";
4
4
 
5
- import { Slot } from "@radix-ui/react-slot";
5
+ import { Slot } from "radix-ui";
6
6
  import React from "react";
7
7
  import { useAui } from "@assistant-ui/store";
8
8
 
@@ -75,7 +75,7 @@ export const ComposerPrimitiveAttachmentDropzone = forwardRef<
75
75
  onDropCapture: handleDrop,
76
76
  };
77
77
 
78
- const Comp = asChild ? Slot : "div";
78
+ const Comp = asChild ? Slot.Root : "div";
79
79
 
80
80
  return (
81
81
  <Comp
@@ -1,112 +1,6 @@
1
1
  "use client";
2
2
 
3
- import type { Attachment } from "@assistant-ui/core";
4
- import { ComponentType, type FC, memo, useMemo } from "react";
5
- import { useAuiState } from "@assistant-ui/store";
6
- import { ComposerAttachmentByIndexProvider } from "../../context/providers";
7
-
8
- export namespace ComposerPrimitiveAttachments {
9
- export type Props = {
10
- components:
11
- | {
12
- Image?: ComponentType | undefined;
13
- Document?: ComponentType | undefined;
14
- File?: ComponentType | undefined;
15
- Attachment?: ComponentType | undefined;
16
- }
17
- | undefined;
18
- };
19
- }
20
-
21
- const getComponent = (
22
- components: ComposerPrimitiveAttachments.Props["components"],
23
- attachment: Attachment,
24
- ) => {
25
- const type = attachment.type;
26
- switch (type) {
27
- case "image":
28
- return components?.Image ?? components?.Attachment;
29
- case "document":
30
- return components?.Document ?? components?.Attachment;
31
- case "file":
32
- return components?.File ?? components?.Attachment;
33
- default:
34
- const _exhaustiveCheck: never = type;
35
- throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
36
- }
37
- };
38
-
39
- const AttachmentComponent: FC<{
40
- components: ComposerPrimitiveAttachments.Props["components"];
41
- }> = ({ components }) => {
42
- const attachment = useAuiState((s) => s.attachment);
43
- if (!attachment) return null;
44
-
45
- const Component = getComponent(components, attachment);
46
- if (!Component) return null;
47
- return <Component />;
48
- };
49
-
50
- export namespace ComposerPrimitiveAttachmentByIndex {
51
- export type Props = {
52
- index: number;
53
- components?: ComposerPrimitiveAttachments.Props["components"];
54
- };
55
- }
56
-
57
- /**
58
- * Renders a single attachment at the specified index within the composer.
59
- *
60
- * This component provides direct access to render a specific attachment
61
- * from the composer's attachment list using the provided component configuration.
62
- *
63
- * @example
64
- * ```tsx
65
- * <ComposerPrimitive.AttachmentByIndex
66
- * index={0}
67
- * components={{
68
- * Image: MyImageAttachment,
69
- * Document: MyDocumentAttachment
70
- * }}
71
- * />
72
- * ```
73
- */
74
- export const ComposerPrimitiveAttachmentByIndex: FC<ComposerPrimitiveAttachmentByIndex.Props> =
75
- memo(
76
- ({ index, components }) => {
77
- return (
78
- <ComposerAttachmentByIndexProvider index={index}>
79
- <AttachmentComponent components={components} />
80
- </ComposerAttachmentByIndexProvider>
81
- );
82
- },
83
- (prev, next) =>
84
- prev.index === next.index &&
85
- prev.components?.Image === next.components?.Image &&
86
- prev.components?.Document === next.components?.Document &&
87
- prev.components?.File === next.components?.File &&
88
- prev.components?.Attachment === next.components?.Attachment,
89
- );
90
-
91
- ComposerPrimitiveAttachmentByIndex.displayName =
92
- "ComposerPrimitive.AttachmentByIndex";
93
-
94
- export const ComposerPrimitiveAttachments: FC<
95
- ComposerPrimitiveAttachments.Props
96
- > = ({ components }) => {
97
- const attachmentsCount = useAuiState((s) => s.composer.attachments.length);
98
-
99
- const attachmentElements = useMemo(() => {
100
- return Array.from({ length: attachmentsCount }, (_, index) => (
101
- <ComposerPrimitiveAttachmentByIndex
102
- key={index}
103
- index={index}
104
- components={components}
105
- />
106
- ));
107
- }, [attachmentsCount, components]);
108
-
109
- return attachmentElements;
110
- };
111
-
112
- ComposerPrimitiveAttachments.displayName = "ComposerPrimitive.Attachments";
3
+ export {
4
+ ComposerPrimitiveAttachments,
5
+ ComposerPrimitiveAttachmentByIndex,
6
+ } from "@assistant-ui/core/react";
@@ -1,44 +1,4 @@
1
1
  "use client";
2
2
 
3
- import type { FC, PropsWithChildren } from "react";
4
- import { useAuiState } from "@assistant-ui/store";
5
- import type { RequireAtLeastOne } from "../../utils/RequireAtLeastOne";
6
-
7
- type ComposerIfFilters = {
8
- /** Whether the composer is in editing mode */
9
- editing: boolean | undefined;
10
- /** Whether dictation is currently active */
11
- dictation: boolean | undefined;
12
- };
13
-
14
- export type UseComposerIfProps = RequireAtLeastOne<ComposerIfFilters>;
15
-
16
- const useComposerIf = (props: UseComposerIfProps) => {
17
- return useAuiState((s) => {
18
- if (props.editing === true && !s.composer.isEditing) return false;
19
- if (props.editing === false && s.composer.isEditing) return false;
20
-
21
- const isDictating = s.composer.dictation != null;
22
- if (props.dictation === true && !isDictating) return false;
23
- if (props.dictation === false && isDictating) return false;
24
-
25
- return true;
26
- });
27
- };
28
-
29
- export namespace ComposerPrimitiveIf {
30
- export type Props = PropsWithChildren<UseComposerIfProps>;
31
- }
32
-
33
- /**
34
- * @deprecated Use `<AuiIf condition={({ composer }) => ...} />` instead.
35
- */
36
- export const ComposerPrimitiveIf: FC<ComposerPrimitiveIf.Props> = ({
37
- children,
38
- ...query
39
- }) => {
40
- const result = useComposerIf(query);
41
- return result ? children : null;
42
- };
43
-
44
- ComposerPrimitiveIf.displayName = "ComposerPrimitive.If";
3
+ export { ComposerPrimitiveIf } from "@assistant-ui/core/react";
4
+ export type { UseComposerIfProps } from "@assistant-ui/core/react";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { composeEventHandlers } from "@radix-ui/primitive";
4
4
  import { useComposedRefs } from "@radix-ui/react-compose-refs";
5
- import { Slot } from "@radix-ui/react-slot";
5
+ import { Slot } from "radix-ui";
6
6
  import {
7
7
  ClipboardEvent,
8
8
  type KeyboardEvent,
@@ -139,7 +139,7 @@ export const ComposerPrimitiveInput = forwardRef<
139
139
  return s.composer.text;
140
140
  });
141
141
 
142
- const Component = asChild ? Slot : TextareaAutosize;
142
+ const Component = asChild ? Slot.Root : TextareaAutosize;
143
143
 
144
144
  const isDisabled =
145
145
  useAuiState(
@@ -1,115 +1,6 @@
1
1
  "use client";
2
2
 
3
- import type { CompleteAttachment } from "@assistant-ui/core";
4
- import { ComponentType, type FC, memo, useMemo } from "react";
5
- import { useAuiState } from "@assistant-ui/store";
6
- import { MessageAttachmentByIndexProvider } from "../../context/providers";
7
-
8
- export namespace MessagePrimitiveAttachments {
9
- export type Props = {
10
- components:
11
- | {
12
- Image?: ComponentType | undefined;
13
- Document?: ComponentType | undefined;
14
- File?: ComponentType | undefined;
15
- Attachment?: ComponentType | undefined;
16
- }
17
- | undefined;
18
- };
19
- }
20
-
21
- const getComponent = (
22
- components: MessagePrimitiveAttachments.Props["components"],
23
- attachment: CompleteAttachment,
24
- ) => {
25
- const type = attachment.type;
26
- switch (type) {
27
- case "image":
28
- return components?.Image ?? components?.Attachment;
29
- case "document":
30
- return components?.Document ?? components?.Attachment;
31
- case "file":
32
- return components?.File ?? components?.Attachment;
33
- default:
34
- const _exhaustiveCheck: never = type;
35
- throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
36
- }
37
- };
38
-
39
- const AttachmentComponent: FC<{
40
- components: MessagePrimitiveAttachments.Props["components"];
41
- }> = ({ components }) => {
42
- const attachment = useAuiState((s) => s.attachment);
43
- if (!attachment) return null;
44
-
45
- const Component = getComponent(components, attachment as CompleteAttachment);
46
- if (!Component) return null;
47
- return <Component />;
48
- };
49
-
50
- export namespace MessagePrimitiveAttachmentByIndex {
51
- export type Props = {
52
- index: number;
53
- components?: MessagePrimitiveAttachments.Props["components"];
54
- };
55
- }
56
-
57
- /**
58
- * Renders a single attachment at the specified index within the current message.
59
- *
60
- * This component provides direct access to render a specific attachment
61
- * from the message's attachment list using the provided component configuration.
62
- *
63
- * @example
64
- * ```tsx
65
- * <MessagePrimitive.AttachmentByIndex
66
- * index={0}
67
- * components={{
68
- * Image: MyImageAttachment,
69
- * Document: MyDocumentAttachment
70
- * }}
71
- * />
72
- * ```
73
- */
74
- export const MessagePrimitiveAttachmentByIndex: FC<MessagePrimitiveAttachmentByIndex.Props> =
75
- memo(
76
- ({ index, components }) => {
77
- return (
78
- <MessageAttachmentByIndexProvider index={index}>
79
- <AttachmentComponent components={components} />
80
- </MessageAttachmentByIndexProvider>
81
- );
82
- },
83
- (prev, next) =>
84
- prev.index === next.index &&
85
- prev.components?.Image === next.components?.Image &&
86
- prev.components?.Document === next.components?.Document &&
87
- prev.components?.File === next.components?.File &&
88
- prev.components?.Attachment === next.components?.Attachment,
89
- );
90
-
91
- MessagePrimitiveAttachmentByIndex.displayName =
92
- "MessagePrimitive.AttachmentByIndex";
93
-
94
- export const MessagePrimitiveAttachments: FC<
95
- MessagePrimitiveAttachments.Props
96
- > = ({ components }) => {
97
- const attachmentsCount = useAuiState((s) => {
98
- if (s.message.role !== "user") return 0;
99
- return s.message.attachments.length;
100
- });
101
-
102
- const attachmentElements = useMemo(() => {
103
- return Array.from({ length: attachmentsCount }, (_, index) => (
104
- <MessagePrimitiveAttachmentByIndex
105
- key={index}
106
- index={index}
107
- components={components}
108
- />
109
- ));
110
- }, [attachmentsCount, components]);
111
-
112
- return attachmentElements;
113
- };
114
-
115
- MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
3
+ export {
4
+ MessagePrimitiveAttachments,
5
+ MessagePrimitiveAttachmentByIndex,
6
+ } from "@assistant-ui/core/react";
@@ -78,7 +78,7 @@ export namespace MessagePrimitiveIf {
78
78
  }
79
79
 
80
80
  /**
81
- * @deprecated Use `<AuiIf condition={({ message }) => ...} />` instead.
81
+ * @deprecated Use `<AuiIf condition={(s) => s.message...} />` instead.
82
82
  */
83
83
  export const MessagePrimitiveIf: FC<MessagePrimitiveIf.Props> = ({
84
84
  children,