@assistant-ui/react 0.12.11 → 0.12.12

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 (352) 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/hooks/AttachmentContext.d.ts +280 -112
  60. package/dist/legacy-runtime/hooks/AttachmentContext.d.ts.map +1 -1
  61. package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js +1 -1
  62. package/dist/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.js.map +1 -1
  63. package/dist/legacy-runtime/runtime-cores/assistant-transport/index.d.ts +1 -1
  64. package/dist/legacy-runtime/runtime-cores/assistant-transport/index.d.ts.map +1 -1
  65. package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +22 -0
  66. package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +1 -1
  67. package/dist/legacy-runtime/runtime-cores/assistant-transport/types.js.map +1 -1
  68. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
  69. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +17 -13
  70. package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
  71. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.d.ts.map +1 -1
  72. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js +8 -6
  73. package/dist/legacy-runtime/runtime-cores/external-store/external-message-converter.js.map +1 -1
  74. package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts +1 -1
  75. package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.d.ts.map +1 -1
  76. package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js +1 -1
  77. package/dist/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.js.map +1 -1
  78. package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts +1 -1
  79. package/dist/legacy-runtime/runtime-cores/external-store/index.d.ts.map +1 -1
  80. package/dist/legacy-runtime/runtime-cores/external-store/index.js +1 -1
  81. package/dist/legacy-runtime/runtime-cores/external-store/index.js.map +1 -1
  82. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.d.ts.map +1 -1
  83. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js +14 -4
  84. package/dist/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
  85. package/dist/model-context/index.d.ts +4 -13
  86. package/dist/model-context/index.d.ts.map +1 -1
  87. package/dist/model-context/index.js +6 -11
  88. package/dist/model-context/index.js.map +1 -1
  89. package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts +1 -1
  90. package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts.map +1 -1
  91. package/dist/primitives/actionBarMore/ActionBarMoreContent.js +1 -1
  92. package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -1
  93. package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts +1 -1
  94. package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts.map +1 -1
  95. package/dist/primitives/actionBarMore/ActionBarMoreItem.js +1 -1
  96. package/dist/primitives/actionBarMore/ActionBarMoreItem.js.map +1 -1
  97. package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts +1 -1
  98. package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts.map +1 -1
  99. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +1 -1
  100. package/dist/primitives/actionBarMore/ActionBarMoreRoot.js.map +1 -1
  101. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts +1 -1
  102. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts.map +1 -1
  103. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +1 -1
  104. package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js.map +1 -1
  105. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts +1 -1
  106. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts.map +1 -1
  107. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +1 -1
  108. package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js.map +1 -1
  109. package/dist/primitives/actionBarMore/scope.d.ts +1 -1
  110. package/dist/primitives/actionBarMore/scope.d.ts.map +1 -1
  111. package/dist/primitives/actionBarMore/scope.js +1 -1
  112. package/dist/primitives/actionBarMore/scope.js.map +1 -1
  113. package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts +1 -1
  114. package/dist/primitives/assistantModal/AssistantModalAnchor.d.ts.map +1 -1
  115. package/dist/primitives/assistantModal/AssistantModalAnchor.js +1 -1
  116. package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
  117. package/dist/primitives/assistantModal/AssistantModalContent.d.ts +1 -1
  118. package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
  119. package/dist/primitives/assistantModal/AssistantModalContent.js +1 -1
  120. package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
  121. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts +1 -1
  122. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
  123. package/dist/primitives/assistantModal/AssistantModalRoot.js +1 -1
  124. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  125. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts +1 -1
  126. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
  127. package/dist/primitives/assistantModal/AssistantModalTrigger.js +1 -1
  128. package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
  129. package/dist/primitives/assistantModal/scope.d.ts +1 -1
  130. package/dist/primitives/assistantModal/scope.d.ts.map +1 -1
  131. package/dist/primitives/assistantModal/scope.js +1 -1
  132. package/dist/primitives/assistantModal/scope.js.map +1 -1
  133. package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts +1 -38
  134. package/dist/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
  135. package/dist/primitives/chainOfThought/ChainOfThoughtParts.js +1 -38
  136. package/dist/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
  137. package/dist/primitives/composer/ComposerAttachmentDropzone.js +2 -2
  138. package/dist/primitives/composer/ComposerAttachmentDropzone.js.map +1 -1
  139. package/dist/primitives/composer/ComposerAttachments.d.ts +1 -36
  140. package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
  141. package/dist/primitives/composer/ComposerAttachments.js +1 -61
  142. package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
  143. package/dist/primitives/composer/ComposerIf.d.ts +2 -17
  144. package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
  145. package/dist/primitives/composer/ComposerIf.js +1 -23
  146. package/dist/primitives/composer/ComposerIf.js.map +1 -1
  147. package/dist/primitives/composer/ComposerInput.js +2 -2
  148. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  149. package/dist/primitives/message/MessageAttachments.d.ts +1 -36
  150. package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
  151. package/dist/primitives/message/MessageAttachments.js +1 -65
  152. package/dist/primitives/message/MessageAttachments.js.map +1 -1
  153. package/dist/primitives/message/MessageIf.d.ts +1 -1
  154. package/dist/primitives/message/MessageIf.js +1 -1
  155. package/dist/primitives/message/MessageParts.d.ts +5 -219
  156. package/dist/primitives/message/MessageParts.d.ts.map +1 -1
  157. package/dist/primitives/message/MessageParts.js +29 -270
  158. package/dist/primitives/message/MessageParts.js.map +1 -1
  159. package/dist/primitives/message/MessagePartsGrouped.d.ts +1 -1
  160. package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
  161. package/dist/primitives/message/MessagePartsGrouped.js +2 -2
  162. package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
  163. package/dist/primitives/thread/ThreadEmpty.d.ts +3 -0
  164. package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
  165. package/dist/primitives/thread/ThreadEmpty.js +4 -1
  166. package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
  167. package/dist/primitives/thread/ThreadIf.d.ts +1 -1
  168. package/dist/primitives/thread/ThreadIf.js +1 -1
  169. package/dist/primitives/thread/ThreadMessages.d.ts +1 -94
  170. package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
  171. package/dist/primitives/thread/ThreadMessages.js +1 -109
  172. package/dist/primitives/thread/ThreadMessages.js.map +1 -1
  173. package/dist/primitives/thread/ThreadSuggestions.d.ts +1 -52
  174. package/dist/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
  175. package/dist/primitives/thread/ThreadSuggestions.js +1 -56
  176. package/dist/primitives/thread/ThreadSuggestions.js.map +1 -1
  177. package/dist/primitives/thread/ThreadViewportSlack.js +2 -2
  178. package/dist/primitives/thread/ThreadViewportSlack.js.map +1 -1
  179. package/dist/primitives/threadList/ThreadListItems.d.ts +1 -34
  180. package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -1
  181. package/dist/primitives/threadList/ThreadListItems.js +1 -35
  182. package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
  183. package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts +1 -7
  184. package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -1
  185. package/dist/primitives/threadListItem/ThreadListItemTitle.js +1 -7
  186. package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
  187. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts +1 -1
  188. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts.map +1 -1
  189. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +1 -1
  190. package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -1
  191. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts +1 -1
  192. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts.map +1 -1
  193. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +1 -1
  194. package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js.map +1 -1
  195. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts +1 -1
  196. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts.map +1 -1
  197. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js +1 -1
  198. package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -1
  199. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts +1 -1
  200. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts.map +1 -1
  201. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +1 -1
  202. package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js.map +1 -1
  203. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts +1 -1
  204. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts.map +1 -1
  205. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +1 -1
  206. package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js.map +1 -1
  207. package/dist/primitives/threadListItemMore/scope.d.ts +1 -1
  208. package/dist/primitives/threadListItemMore/scope.d.ts.map +1 -1
  209. package/dist/primitives/threadListItemMore/scope.js +1 -1
  210. package/dist/primitives/threadListItemMore/scope.js.map +1 -1
  211. package/dist/types/index.d.ts +2 -2
  212. package/dist/types/index.d.ts.map +1 -1
  213. package/dist/types/scopes/index.d.ts +1 -2
  214. package/dist/types/scopes/index.d.ts.map +1 -1
  215. package/package.json +10 -12
  216. package/src/client/ExternalThread.ts +25 -13
  217. package/src/client/InMemoryThreadList.ts +1 -2
  218. package/src/client/index.ts +3 -2
  219. package/src/context/providers/AttachmentByIndexProvider.tsx +4 -34
  220. package/src/context/providers/ChainOfThoughtByIndicesProvider.tsx +1 -34
  221. package/src/context/providers/ChainOfThoughtPartByIndexProvider.tsx +1 -18
  222. package/src/context/providers/MessageByIndexProvider.tsx +1 -23
  223. package/src/context/providers/PartByIndexProvider.tsx +1 -18
  224. package/src/context/providers/SuggestionByIndexProvider.tsx +4 -21
  225. package/src/context/providers/TextMessagePartProvider.tsx +1 -46
  226. package/src/context/providers/ThreadListItemProvider.tsx +4 -33
  227. package/src/context/providers/index.ts +1 -0
  228. package/src/index.ts +1 -1
  229. package/src/legacy-runtime/AssistantRuntimeProvider.tsx +13 -21
  230. package/src/legacy-runtime/RuntimeAdapter.ts +1 -66
  231. package/src/legacy-runtime/runtime-cores/adapters/attachment/CloudFileAttachmentAdapter.ts +1 -1
  232. package/src/legacy-runtime/runtime-cores/assistant-transport/index.ts +1 -0
  233. package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +25 -0
  234. package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.ts +22 -13
  235. package/src/legacy-runtime/runtime-cores/external-store/external-message-converter.ts +19 -21
  236. package/src/legacy-runtime/runtime-cores/external-store/getExternalStoreMessage.ts +1 -0
  237. package/src/legacy-runtime/runtime-cores/external-store/index.ts +1 -0
  238. package/src/legacy-runtime/runtime-cores/remote-thread-list/useRemoteThreadListRuntime.ts +20 -4
  239. package/src/model-context/index.ts +29 -22
  240. package/src/primitives/actionBarMore/ActionBarMoreContent.tsx +1 -1
  241. package/src/primitives/actionBarMore/ActionBarMoreItem.tsx +1 -1
  242. package/src/primitives/actionBarMore/ActionBarMoreRoot.tsx +1 -1
  243. package/src/primitives/actionBarMore/ActionBarMoreSeparator.tsx +1 -1
  244. package/src/primitives/actionBarMore/ActionBarMoreTrigger.tsx +1 -1
  245. package/src/primitives/actionBarMore/scope.ts +1 -1
  246. package/src/primitives/assistantModal/AssistantModalAnchor.tsx +1 -1
  247. package/src/primitives/assistantModal/AssistantModalContent.tsx +1 -1
  248. package/src/primitives/assistantModal/AssistantModalRoot.tsx +1 -1
  249. package/src/primitives/assistantModal/AssistantModalTrigger.tsx +1 -1
  250. package/src/primitives/assistantModal/scope.ts +1 -1
  251. package/src/primitives/chainOfThought/ChainOfThoughtParts.tsx +1 -85
  252. package/src/primitives/composer/ComposerAttachmentDropzone.tsx +2 -2
  253. package/src/primitives/composer/ComposerAttachments.tsx +4 -110
  254. package/src/primitives/composer/ComposerIf.ts +2 -42
  255. package/src/primitives/composer/ComposerInput.tsx +2 -2
  256. package/src/primitives/message/MessageAttachments.tsx +4 -113
  257. package/src/primitives/message/MessageIf.ts +1 -1
  258. package/src/primitives/message/MessageParts.tsx +43 -642
  259. package/src/primitives/message/MessagePartsGrouped.tsx +3 -3
  260. package/src/primitives/thread/ThreadEmpty.ts +4 -3
  261. package/src/primitives/thread/ThreadIf.ts +1 -1
  262. package/src/primitives/thread/ThreadMessages.tsx +4 -217
  263. package/src/primitives/thread/ThreadSuggestions.tsx +4 -106
  264. package/src/primitives/thread/ThreadViewportSlack.tsx +2 -2
  265. package/src/primitives/threadList/ThreadListItems.tsx +4 -79
  266. package/src/primitives/threadListItem/ThreadListItemTitle.test.tsx +7 -3
  267. package/src/primitives/threadListItem/ThreadListItemTitle.tsx +1 -17
  268. package/src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx +1 -1
  269. package/src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx +1 -1
  270. package/src/primitives/threadListItemMore/ThreadListItemMoreRoot.tsx +1 -1
  271. package/src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx +1 -1
  272. package/src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx +1 -1
  273. package/src/primitives/threadListItemMore/scope.ts +1 -1
  274. package/src/tests/BaseComposerRuntimeCore.test.ts +106 -1
  275. package/src/tests/DataRenderers.test.ts +1 -2
  276. package/src/types/index.ts +3 -2
  277. package/src/types/scopes/index.ts +5 -3
  278. package/dist/client/DataRenderers.d.ts +0 -3
  279. package/dist/client/DataRenderers.d.ts.map +0 -1
  280. package/dist/client/DataRenderers.js +0 -33
  281. package/dist/client/DataRenderers.js.map +0 -1
  282. package/dist/client/Tools.d.ts +0 -8
  283. package/dist/client/Tools.d.ts.map +0 -1
  284. package/dist/client/Tools.js +0 -68
  285. package/dist/client/Tools.js.map +0 -1
  286. package/dist/model-context/makeAssistantDataUI.d.ts +0 -7
  287. package/dist/model-context/makeAssistantDataUI.d.ts.map +0 -1
  288. package/dist/model-context/makeAssistantDataUI.js +0 -11
  289. package/dist/model-context/makeAssistantDataUI.js.map +0 -1
  290. package/dist/model-context/makeAssistantTool.d.ts +0 -7
  291. package/dist/model-context/makeAssistantTool.d.ts.map +0 -1
  292. package/dist/model-context/makeAssistantTool.js +0 -11
  293. package/dist/model-context/makeAssistantTool.js.map +0 -1
  294. package/dist/model-context/makeAssistantToolUI.d.ts +0 -7
  295. package/dist/model-context/makeAssistantToolUI.d.ts.map +0 -1
  296. package/dist/model-context/makeAssistantToolUI.js +0 -11
  297. package/dist/model-context/makeAssistantToolUI.js.map +0 -1
  298. package/dist/model-context/toolbox.d.ts +0 -10
  299. package/dist/model-context/toolbox.d.ts.map +0 -1
  300. package/dist/model-context/toolbox.js +0 -3
  301. package/dist/model-context/toolbox.js.map +0 -1
  302. package/dist/model-context/useAssistantDataUI.d.ts +0 -7
  303. package/dist/model-context/useAssistantDataUI.d.ts.map +0 -1
  304. package/dist/model-context/useAssistantDataUI.js +0 -12
  305. package/dist/model-context/useAssistantDataUI.js.map +0 -1
  306. package/dist/model-context/useAssistantInstructions.d.ts +0 -4
  307. package/dist/model-context/useAssistantInstructions.d.ts.map +0 -1
  308. package/dist/model-context/useAssistantInstructions.js +0 -23
  309. package/dist/model-context/useAssistantInstructions.js.map +0 -1
  310. package/dist/model-context/useAssistantTool.d.ts +0 -7
  311. package/dist/model-context/useAssistantTool.d.ts.map +0 -1
  312. package/dist/model-context/useAssistantTool.js +0 -23
  313. package/dist/model-context/useAssistantTool.js.map +0 -1
  314. package/dist/model-context/useAssistantToolUI.d.ts +0 -7
  315. package/dist/model-context/useAssistantToolUI.d.ts.map +0 -1
  316. package/dist/model-context/useAssistantToolUI.js +0 -12
  317. package/dist/model-context/useAssistantToolUI.js.map +0 -1
  318. package/dist/model-context/useInlineRender.d.ts +0 -4
  319. package/dist/model-context/useInlineRender.d.ts.map +0 -1
  320. package/dist/model-context/useInlineRender.js +0 -16
  321. package/dist/model-context/useInlineRender.js.map +0 -1
  322. package/dist/types/MessagePartComponentTypes.d.ts +0 -33
  323. package/dist/types/MessagePartComponentTypes.d.ts.map +0 -1
  324. package/dist/types/MessagePartComponentTypes.js +0 -2
  325. package/dist/types/MessagePartComponentTypes.js.map +0 -1
  326. package/dist/types/scopes/dataRenderers.d.ts +0 -13
  327. package/dist/types/scopes/dataRenderers.d.ts.map +0 -1
  328. package/dist/types/scopes/dataRenderers.js +0 -2
  329. package/dist/types/scopes/dataRenderers.js.map +0 -1
  330. package/dist/types/scopes/tools.d.ts +0 -13
  331. package/dist/types/scopes/tools.d.ts.map +0 -1
  332. package/dist/types/scopes/tools.js +0 -2
  333. package/dist/types/scopes/tools.js.map +0 -1
  334. package/dist/types/store-augmentation.d.ts +0 -10
  335. package/dist/types/store-augmentation.d.ts.map +0 -1
  336. package/dist/types/store-augmentation.js +0 -2
  337. package/dist/types/store-augmentation.js.map +0 -1
  338. package/src/client/DataRenderers.ts +0 -42
  339. package/src/client/Tools.ts +0 -97
  340. package/src/model-context/makeAssistantDataUI.ts +0 -22
  341. package/src/model-context/makeAssistantTool.ts +0 -22
  342. package/src/model-context/makeAssistantToolUI.ts +0 -22
  343. package/src/model-context/toolbox.ts +0 -17
  344. package/src/model-context/useAssistantDataUI.ts +0 -18
  345. package/src/model-context/useAssistantInstructions.ts +0 -32
  346. package/src/model-context/useAssistantTool.ts +0 -39
  347. package/src/model-context/useAssistantToolUI.ts +0 -20
  348. package/src/model-context/useInlineRender.ts +0 -27
  349. package/src/types/MessagePartComponentTypes.ts +0 -66
  350. package/src/types/scopes/dataRenderers.ts +0 -15
  351. package/src/types/scopes/tools.ts +0 -18
  352. package/src/types/store-augmentation.ts +0 -11
@@ -24,6 +24,7 @@ import {
24
24
  UserMessagePart,
25
25
  QueuedCommand,
26
26
  AssistantTransportCommand,
27
+ SendCommandsRequestBody,
27
28
  } from "./types";
28
29
  import { useCommandQueue } from "./commandQueue";
29
30
  import { useRunManager } from "./runManager";
@@ -137,24 +138,32 @@ const useAssistantTransportThreadRuntime = <T>(
137
138
  : options.body;
138
139
  const context = runtime.thread.getModelContext();
139
140
 
141
+ let requestBody: Record<string, unknown> = {
142
+ commands,
143
+ state: agentStateRef.current,
144
+ system: context.system,
145
+ tools: context.tools ? toToolsJSONSchema(context.tools) : undefined,
146
+ threadId,
147
+ ...(parentIdRef.current !== undefined && {
148
+ parentId: parentIdRef.current,
149
+ }),
150
+ ...context.callSettings,
151
+ ...context.config,
152
+ ...(bodyValue ?? {}),
153
+ };
154
+
155
+ if (options.prepareSendCommandsRequest) {
156
+ requestBody = await options.prepareSendCommandsRequest(
157
+ requestBody as SendCommandsRequestBody,
158
+ );
159
+ }
160
+
140
161
  const response = await fetch(
141
162
  isResume ? options.resumeApi! : options.api,
142
163
  {
143
164
  method: "POST",
144
165
  headers,
145
- body: JSON.stringify({
146
- commands,
147
- state: agentStateRef.current,
148
- system: context.system,
149
- tools: context.tools ? toToolsJSONSchema(context.tools) : undefined,
150
- threadId,
151
- ...(parentIdRef.current !== undefined && {
152
- parentId: parentIdRef.current,
153
- }),
154
- ...context.callSettings,
155
- ...context.config,
156
- ...(bodyValue ?? {}),
157
- }),
166
+ body: JSON.stringify(requestBody),
158
167
  signal,
159
168
  },
160
169
  );
@@ -5,6 +5,7 @@ import { ThreadMessageConverter } from "./ThreadMessageConverter";
5
5
  import {
6
6
  getExternalStoreMessages,
7
7
  symbolInnerMessage,
8
+ bindExternalStoreMessage,
8
9
  } from "./getExternalStoreMessage";
9
10
  import { fromThreadMessageLike, ThreadMessageLike } from "./ThreadMessageLike";
10
11
  import { getAutoStatus, isAutoStatus } from "./auto-status";
@@ -276,23 +277,22 @@ const chunkExternalMessages = <T>(
276
277
  function createErrorAssistantMessage(
277
278
  error: ReadonlyJSONValue,
278
279
  ): ThreadAssistantMessage {
279
- return Object.assign<ThreadAssistantMessage, { [symbolInnerMessage]: [] }>(
280
- {
281
- id: generateErrorMessageId(),
282
- role: "assistant",
283
- content: [],
284
- status: { type: "incomplete", reason: "error", error },
285
- createdAt: new Date(),
286
- metadata: {
287
- unstable_state: null,
288
- unstable_annotations: [],
289
- unstable_data: [],
290
- custom: {},
291
- steps: [],
292
- },
280
+ const msg: ThreadAssistantMessage = {
281
+ id: generateErrorMessageId(),
282
+ role: "assistant",
283
+ content: [],
284
+ status: { type: "incomplete", reason: "error", error },
285
+ createdAt: new Date(),
286
+ metadata: {
287
+ unstable_state: null,
288
+ unstable_annotations: [],
289
+ unstable_data: [],
290
+ custom: {},
291
+ steps: [],
293
292
  },
294
- { [symbolInnerMessage]: [] },
295
- );
293
+ };
294
+ bindExternalStoreMessage(msg, []);
295
+ return msg;
296
296
  }
297
297
 
298
298
  export const convertExternalMessages = <T extends WeakKey>(
@@ -331,7 +331,7 @@ export const convertExternalMessages = <T extends WeakKey>(
331
331
  idx.toString(),
332
332
  autoStatus,
333
333
  );
334
- (newMessage as any)[symbolInnerMessage] = message.inputs;
334
+ bindExternalStoreMessage(newMessage, message.inputs);
335
335
  return newMessage;
336
336
  });
337
337
 
@@ -439,14 +439,12 @@ export const useExternalMessageConverter = <T extends WeakKey>({
439
439
  idx.toString(),
440
440
  autoStatus,
441
441
  );
442
- (newMessage as any)[symbolInnerMessage] = message.inputs;
442
+ bindExternalStoreMessage(newMessage, message.inputs);
443
443
  return newMessage;
444
444
  },
445
445
  );
446
446
 
447
- (threadMessages as unknown as { [symbolInnerMessage]: T[] })[
448
- symbolInnerMessage
449
- ] = messages;
447
+ bindExternalStoreMessage(threadMessages, messages);
450
448
 
451
449
  if (state.metadata.error) {
452
450
  const lastMessage = threadMessages.at(-1);
@@ -1,5 +1,6 @@
1
1
  export {
2
2
  getExternalStoreMessage,
3
3
  getExternalStoreMessages,
4
+ bindExternalStoreMessage,
4
5
  } from "@assistant-ui/core";
5
6
  export { symbolInnerMessage } from "@assistant-ui/core/internal";
@@ -3,6 +3,7 @@ export type { ThreadMessageLike } from "@assistant-ui/core";
3
3
  export {
4
4
  getExternalStoreMessage,
5
5
  getExternalStoreMessages,
6
+ bindExternalStoreMessage,
6
7
  } from "@assistant-ui/core";
7
8
  export type {
8
9
  ExternalStoreAdapter,
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { useState, useEffect, useMemo } from "react";
3
+ import { useState, useEffect, useMemo, useRef, useCallback } from "react";
4
4
  import {
5
5
  BaseAssistantRuntimeCore,
6
6
  AssistantRuntimeImpl,
@@ -46,11 +46,27 @@ const useRemoteThreadListRuntimeImpl = (
46
46
  export const useRemoteThreadListRuntime = (
47
47
  options: RemoteThreadListOptions,
48
48
  ): AssistantRuntime => {
49
+ const runtimeHookRef = useRef(options.runtimeHook);
50
+ runtimeHookRef.current = options.runtimeHook;
51
+
52
+ const stableRuntimeHook = useCallback(() => {
53
+ return runtimeHookRef.current();
54
+ }, []);
55
+
56
+ const stableOptions = useMemo<RemoteThreadListOptions>(
57
+ () => ({
58
+ adapter: options.adapter,
59
+ allowNesting: options.allowNesting,
60
+ runtimeHook: stableRuntimeHook,
61
+ }),
62
+ [options.adapter, options.allowNesting, stableRuntimeHook],
63
+ );
64
+
49
65
  const aui = useAui();
50
66
  const isNested = aui.threadListItem.source !== null;
51
67
 
52
68
  if (isNested) {
53
- if (!options.allowNesting) {
69
+ if (!stableOptions.allowNesting) {
54
70
  throw new Error(
55
71
  "useRemoteThreadListRuntime cannot be nested inside another RemoteThreadListRuntime. " +
56
72
  "Set allowNesting: true to allow nesting (the inner runtime will become a no-op).",
@@ -59,8 +75,8 @@ export const useRemoteThreadListRuntime = (
59
75
 
60
76
  // If allowNesting is true and already inside a thread list context,
61
77
  // just call the runtimeHook directly (no-op behavior)
62
- return options.runtimeHook();
78
+ return stableRuntimeHook();
63
79
  }
64
80
 
65
- return useRemoteThreadListRuntimeImpl(options);
81
+ return useRemoteThreadListRuntimeImpl(stableOptions);
66
82
  };
@@ -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(