@assistant-ui/core 0.1.5 → 0.1.7

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 (522) hide show
  1. package/dist/adapters/attachment.d.ts +1 -1
  2. package/dist/adapters/attachment.d.ts.map +1 -1
  3. package/dist/adapters/feedback.d.ts +1 -1
  4. package/dist/adapters/feedback.d.ts.map +1 -1
  5. package/dist/adapters/speech.d.ts +1 -1
  6. package/dist/adapters/speech.d.ts.map +1 -1
  7. package/dist/adapters/suggestion.d.ts +1 -1
  8. package/dist/adapters/suggestion.d.ts.map +1 -1
  9. package/dist/index.d.ts +44 -5
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +14 -5
  12. package/dist/index.js.map +1 -1
  13. package/dist/internal.d.ts +5 -2
  14. package/dist/internal.d.ts.map +1 -1
  15. package/dist/internal.js +13 -2
  16. package/dist/internal.js.map +1 -1
  17. package/dist/model-context/frame/host.d.ts +1 -1
  18. package/dist/model-context/frame/host.d.ts.map +1 -1
  19. package/dist/model-context/frame/provider.d.ts +1 -1
  20. package/dist/model-context/frame/provider.d.ts.map +1 -1
  21. package/dist/model-context/registry.d.ts +1 -1
  22. package/dist/model-context/registry.d.ts.map +1 -1
  23. package/dist/model-context/types.d.ts +1 -1
  24. package/dist/model-context/types.d.ts.map +1 -1
  25. package/dist/react/AssistantRuntimeProvider.d.ts +0 -1
  26. package/dist/react/AssistantRuntimeProvider.d.ts.map +1 -1
  27. package/dist/react/AssistantRuntimeProvider.js +0 -9
  28. package/dist/react/AssistantRuntimeProvider.js.map +1 -1
  29. package/dist/react/RuntimeAdapter.d.ts.map +1 -1
  30. package/dist/react/RuntimeAdapter.js +2 -1
  31. package/dist/react/RuntimeAdapter.js.map +1 -1
  32. package/dist/react/index.d.ts +67 -9
  33. package/dist/react/index.d.ts.map +1 -1
  34. package/dist/react/index.js +67 -8
  35. package/dist/react/index.js.map +1 -1
  36. package/dist/react/model-context/useInlineRender.d.ts +1 -1
  37. package/dist/react/model-context/useInlineRender.d.ts.map +1 -1
  38. package/dist/react/primitive-hooks/useActionBarSpeak.d.ts +5 -0
  39. package/dist/react/primitive-hooks/useActionBarSpeak.d.ts.map +1 -0
  40. package/dist/react/primitive-hooks/useActionBarSpeak.js +15 -0
  41. package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -0
  42. package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts +5 -0
  43. package/dist/react/primitive-hooks/useActionBarStopSpeaking.d.ts.map +1 -0
  44. package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +11 -0
  45. package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -0
  46. package/dist/react/primitive-hooks/useBranchPickerNext.d.ts +5 -0
  47. package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -0
  48. package/dist/react/primitive-hooks/useBranchPickerNext.js +18 -0
  49. package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -0
  50. package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts +5 -0
  51. package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -0
  52. package/dist/react/primitive-hooks/useBranchPickerPrevious.js +18 -0
  53. package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -0
  54. package/dist/react/primitive-hooks/useComposerDictate.d.ts +5 -0
  55. package/dist/react/primitive-hooks/useComposerDictate.d.ts.map +1 -0
  56. package/dist/react/primitive-hooks/useComposerDictate.js +13 -0
  57. package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -0
  58. package/dist/react/primitive-hooks/useMessageError.d.ts +2 -0
  59. package/dist/react/primitive-hooks/useMessageError.d.ts.map +1 -0
  60. package/dist/react/primitive-hooks/useMessageError.js +8 -0
  61. package/dist/react/primitive-hooks/useMessageError.js.map +1 -0
  62. package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts +10 -0
  63. package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -0
  64. package/dist/react/primitive-hooks/useSuggestionTrigger.js +32 -0
  65. package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -0
  66. package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts +4 -0
  67. package/dist/react/primitive-hooks/useThreadListItemArchive.d.ts.map +1 -0
  68. package/dist/react/primitive-hooks/useThreadListItemArchive.js +10 -0
  69. package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -0
  70. package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts +4 -0
  71. package/dist/react/primitive-hooks/useThreadListItemDelete.d.ts.map +1 -0
  72. package/dist/react/primitive-hooks/useThreadListItemDelete.js +10 -0
  73. package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -0
  74. package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts +4 -0
  75. package/dist/react/primitive-hooks/useThreadListItemTrigger.d.ts.map +1 -0
  76. package/dist/react/primitive-hooks/useThreadListItemTrigger.js +10 -0
  77. package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -0
  78. package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts +4 -0
  79. package/dist/react/primitive-hooks/useThreadListItemUnarchive.d.ts.map +1 -0
  80. package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +10 -0
  81. package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -0
  82. package/dist/react/primitive-hooks/useThreadListNew.d.ts +4 -0
  83. package/dist/react/primitive-hooks/useThreadListNew.d.ts.map +1 -0
  84. package/dist/react/primitive-hooks/useThreadListNew.js +10 -0
  85. package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -0
  86. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts +23 -13
  87. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.d.ts.map +1 -1
  88. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +16 -8
  89. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
  90. package/dist/react/primitives/composer/ComposerAttachments.d.ts +19 -8
  91. package/dist/react/primitives/composer/ComposerAttachments.d.ts.map +1 -1
  92. package/dist/react/primitives/composer/ComposerAttachments.js +19 -7
  93. package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
  94. package/dist/react/primitives/message/MessageAttachments.d.ts +19 -8
  95. package/dist/react/primitives/message/MessageAttachments.d.ts.map +1 -1
  96. package/dist/react/primitives/message/MessageAttachments.js +19 -7
  97. package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
  98. package/dist/react/primitives/message/MessageParts.d.ts +41 -5
  99. package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
  100. package/dist/react/primitives/message/MessageParts.js +113 -5
  101. package/dist/react/primitives/message/MessageParts.js.map +1 -1
  102. package/dist/react/primitives/message/MessageQuote.d.ts +10 -0
  103. package/dist/react/primitives/message/MessageQuote.d.ts.map +1 -0
  104. package/dist/react/primitives/message/MessageQuote.js +27 -0
  105. package/dist/react/primitives/message/MessageQuote.js.map +1 -0
  106. package/dist/react/primitives/part/PartMessages.d.ts +37 -0
  107. package/dist/react/primitives/part/PartMessages.d.ts.map +1 -0
  108. package/dist/react/primitives/part/PartMessages.js +49 -0
  109. package/dist/react/primitives/part/PartMessages.js.map +1 -0
  110. package/dist/react/primitives/thread/ThreadMessages.d.ts +54 -72
  111. package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
  112. package/dist/react/primitives/thread/ThreadMessages.js +32 -37
  113. package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
  114. package/dist/react/primitives/thread/ThreadSuggestions.d.ts +18 -10
  115. package/dist/react/primitives/thread/ThreadSuggestions.d.ts.map +1 -1
  116. package/dist/react/primitives/thread/ThreadSuggestions.js +25 -11
  117. package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
  118. package/dist/react/primitives/threadList/ThreadListItems.d.ts +18 -6
  119. package/dist/react/primitives/threadList/ThreadListItems.d.ts.map +1 -1
  120. package/dist/react/primitives/threadList/ThreadListItems.js +15 -7
  121. package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
  122. package/dist/react/providers/ReadonlyThreadProvider.d.ts +9 -0
  123. package/dist/react/providers/ReadonlyThreadProvider.d.ts.map +1 -0
  124. package/dist/react/providers/ReadonlyThreadProvider.js +52 -0
  125. package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -0
  126. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +1 -1
  127. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
  128. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +1 -1
  129. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
  130. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +1 -1
  131. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  132. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +1 -1
  133. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  134. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts +1 -1
  135. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
  136. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +1 -1
  137. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
  138. package/dist/react/runtimes/cloud/auiV0.d.ts +1 -1
  139. package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
  140. package/dist/react/runtimes/createMessageConverter.d.ts +1 -1
  141. package/dist/react/runtimes/createMessageConverter.d.ts.map +1 -1
  142. package/dist/react/runtimes/external-message-converter.d.ts +2 -1
  143. package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
  144. package/dist/react/runtimes/useLocalRuntime.d.ts +6 -6
  145. package/dist/react/runtimes/useLocalRuntime.js +1 -1
  146. package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
  147. package/dist/react/runtimes/useToolInvocations.d.ts +1 -1
  148. package/dist/react/runtimes/useToolInvocations.d.ts.map +1 -1
  149. package/dist/react/types/MessagePartComponentTypes.d.ts +3 -1
  150. package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
  151. package/dist/react/utils/getMessageQuote.d.ts +9 -0
  152. package/dist/react/utils/getMessageQuote.d.ts.map +1 -0
  153. package/dist/react/utils/getMessageQuote.js +7 -0
  154. package/dist/react/utils/getMessageQuote.js.map +1 -0
  155. package/dist/runtime/api/assistant-runtime.d.ts +2 -2
  156. package/dist/runtime/api/assistant-runtime.d.ts.map +1 -1
  157. package/dist/runtime/api/attachment-runtime.d.ts +2 -1
  158. package/dist/runtime/api/attachment-runtime.d.ts.map +1 -1
  159. package/dist/runtime/api/attachment-runtime.js.map +1 -1
  160. package/dist/runtime/api/bindings.d.ts +1 -1
  161. package/dist/runtime/api/bindings.d.ts.map +1 -1
  162. package/dist/runtime/api/composer-runtime.d.ts +5 -1
  163. package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
  164. package/dist/runtime/api/composer-runtime.js +2 -1
  165. package/dist/runtime/api/composer-runtime.js.map +1 -1
  166. package/dist/runtime/api/message-part-runtime.d.ts +3 -1
  167. package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
  168. package/dist/runtime/api/message-runtime.d.ts +3 -1
  169. package/dist/runtime/api/message-runtime.d.ts.map +1 -1
  170. package/dist/runtime/api/message-runtime.js +2 -1
  171. package/dist/runtime/api/message-runtime.js.map +1 -1
  172. package/dist/runtime/api/thread-list-item-runtime.d.ts +1 -1
  173. package/dist/runtime/api/thread-list-item-runtime.d.ts.map +1 -1
  174. package/dist/runtime/api/thread-list-runtime.d.ts +1 -1
  175. package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
  176. package/dist/runtime/api/thread-list-runtime.js +2 -1
  177. package/dist/runtime/api/thread-list-runtime.js.map +1 -1
  178. package/dist/runtime/api/thread-runtime.d.ts +18 -10
  179. package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
  180. package/dist/runtime/api/thread-runtime.js +9 -3
  181. package/dist/runtime/api/thread-runtime.js.map +1 -1
  182. package/dist/runtime/base/base-assistant-runtime-core.d.ts +2 -2
  183. package/dist/runtime/base/base-assistant-runtime-core.d.ts.map +1 -1
  184. package/dist/runtime/base/base-composer-runtime-core.d.ts +5 -2
  185. package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
  186. package/dist/runtime/base/base-composer-runtime-core.js +1 -1
  187. package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
  188. package/dist/runtime/base/base-thread-runtime-core.d.ts +3 -2
  189. package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
  190. package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
  191. package/dist/runtime/base/default-edit-composer-runtime-core.d.ts +1 -1
  192. package/dist/runtime/base/default-edit-composer-runtime-core.d.ts.map +1 -1
  193. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +1 -1
  194. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
  195. package/dist/runtime/interfaces/assistant-runtime-core.d.ts +2 -2
  196. package/dist/runtime/interfaces/assistant-runtime-core.d.ts.map +1 -1
  197. package/dist/runtime/interfaces/composer-runtime-core.d.ts +5 -1
  198. package/dist/runtime/interfaces/composer-runtime-core.d.ts.map +1 -1
  199. package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +1 -1
  200. package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
  201. package/dist/runtime/interfaces/thread-runtime-core.d.ts +4 -2
  202. package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
  203. package/dist/runtime/utils/auto-status.d.ts +1 -1
  204. package/dist/runtime/utils/auto-status.d.ts.map +1 -1
  205. package/dist/runtime/utils/chat-model-adapter.d.ts +3 -2
  206. package/dist/runtime/utils/chat-model-adapter.d.ts.map +1 -1
  207. package/dist/runtime/utils/external-store-message.d.ts +1 -1
  208. package/dist/runtime/utils/external-store-message.d.ts.map +1 -1
  209. package/dist/runtime/utils/message-repository.d.ts +2 -1
  210. package/dist/runtime/utils/message-repository.d.ts.map +1 -1
  211. package/dist/runtime/utils/message-repository.js.map +1 -1
  212. package/dist/runtime/utils/thread-message-like.d.ts +3 -1
  213. package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
  214. package/dist/runtime/utils/thread-message-like.js.map +1 -1
  215. package/dist/runtimes/external-store/external-store-adapter.d.ts +1 -1
  216. package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
  217. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts +1 -1
  218. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
  219. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +2 -2
  220. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
  221. package/dist/runtimes/external-store/thread-message-converter.d.ts +1 -1
  222. package/dist/runtimes/external-store/thread-message-converter.d.ts.map +1 -1
  223. package/dist/runtimes/internal.d.ts +1 -0
  224. package/dist/runtimes/internal.d.ts.map +1 -1
  225. package/dist/runtimes/internal.js +2 -0
  226. package/dist/runtimes/internal.js.map +1 -1
  227. package/dist/runtimes/local/local-thread-list-runtime-core.d.ts +1 -1
  228. package/dist/runtimes/local/local-thread-list-runtime-core.d.ts.map +1 -1
  229. package/dist/runtimes/local/local-thread-list-runtime-core.js +1 -1
  230. package/dist/runtimes/local/local-thread-list-runtime-core.js.map +1 -1
  231. package/dist/runtimes/local/local-thread-runtime-core.d.ts +2 -2
  232. package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
  233. package/dist/runtimes/local/should-continue.d.ts +1 -1
  234. package/dist/runtimes/local/should-continue.d.ts.map +1 -1
  235. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +85 -0
  236. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -0
  237. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +169 -0
  238. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -0
  239. package/dist/runtimes/remote-thread-list/types.d.ts +1 -1
  240. package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
  241. package/dist/store/clients/model-context-client.js +1 -1
  242. package/dist/store/clients/model-context-client.js.map +1 -1
  243. package/dist/store/clients/runtime-adapter.js +1 -1
  244. package/dist/store/clients/runtime-adapter.js.map +1 -1
  245. package/dist/store/clients/suggestions.d.ts.map +1 -1
  246. package/dist/store/clients/suggestions.js.map +1 -1
  247. package/dist/store/clients/thread-message-client.d.ts +1 -1
  248. package/dist/store/clients/thread-message-client.d.ts.map +1 -1
  249. package/dist/store/clients/thread-message-client.js.map +1 -1
  250. package/dist/store/index.d.ts +16 -2
  251. package/dist/store/index.d.ts.map +1 -1
  252. package/dist/store/index.js +5 -3
  253. package/dist/store/index.js.map +1 -1
  254. package/dist/store/internal.d.ts +7 -1
  255. package/dist/store/internal.d.ts.map +1 -1
  256. package/dist/store/internal.js +7 -1
  257. package/dist/store/internal.js.map +1 -1
  258. package/dist/store/runtime-clients/attachment-runtime-client.d.ts +1 -1
  259. package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
  260. package/dist/store/runtime-clients/composer-runtime-client.d.ts +1 -1
  261. package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
  262. package/dist/store/runtime-clients/message-part-runtime-client.d.ts +1 -1
  263. package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
  264. package/dist/store/runtime-clients/message-runtime-client.d.ts +1 -1
  265. package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
  266. package/dist/store/runtime-clients/tap-subscribable.d.ts +1 -1
  267. package/dist/store/runtime-clients/tap-subscribable.d.ts.map +1 -1
  268. package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +1 -1
  269. package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
  270. package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
  271. package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +2 -1
  272. package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
  273. package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
  274. package/dist/store/runtime-clients/thread-runtime-client.d.ts +1 -1
  275. package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
  276. package/dist/store/runtime-clients/thread-runtime-client.js +2 -1
  277. package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
  278. package/dist/store/scopes/attachment.d.ts +2 -2
  279. package/dist/store/scopes/attachment.d.ts.map +1 -1
  280. package/dist/store/scopes/chain-of-thought.d.ts +2 -1
  281. package/dist/store/scopes/chain-of-thought.d.ts.map +1 -1
  282. package/dist/store/scopes/composer.d.ts +6 -2
  283. package/dist/store/scopes/composer.d.ts.map +1 -1
  284. package/dist/store/scopes/message.d.ts +4 -2
  285. package/dist/store/scopes/message.d.ts.map +1 -1
  286. package/dist/store/scopes/model-context.d.ts +2 -2
  287. package/dist/store/scopes/model-context.d.ts.map +1 -1
  288. package/dist/store/scopes/part.d.ts +3 -2
  289. package/dist/store/scopes/part.d.ts.map +1 -1
  290. package/dist/store/scopes/thread-list-item.d.ts +2 -1
  291. package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
  292. package/dist/store/scopes/thread.d.ts +9 -2
  293. package/dist/store/scopes/thread.d.ts.map +1 -1
  294. package/dist/store/scopes/threads.d.ts +1 -1
  295. package/dist/store/scopes/threads.d.ts.map +1 -1
  296. package/dist/subscribable/subscribable.d.ts +1 -1
  297. package/dist/subscribable/subscribable.d.ts.map +1 -1
  298. package/dist/utils/composite-context-provider.d.ts +1 -1
  299. package/dist/utils/composite-context-provider.d.ts.map +1 -1
  300. package/dist/utils/composite-context-provider.js +1 -1
  301. package/dist/utils/composite-context-provider.js.map +1 -1
  302. package/dist/utils/text.d.ts +1 -1
  303. package/dist/utils/text.d.ts.map +1 -1
  304. package/dist/utils/text.js.map +1 -1
  305. package/package.json +10 -10
  306. package/src/adapters/attachment.ts +1 -1
  307. package/src/adapters/feedback.ts +1 -1
  308. package/src/adapters/speech.ts +1 -1
  309. package/src/adapters/suggestion.ts +1 -1
  310. package/src/index.ts +254 -5
  311. package/src/internal.ts +37 -2
  312. package/src/model-context/frame/host.ts +1 -1
  313. package/src/model-context/frame/provider.ts +1 -1
  314. package/src/model-context/registry.ts +1 -1
  315. package/src/model-context/types.ts +1 -1
  316. package/src/react/AssistantRuntimeProvider.tsx +1 -12
  317. package/src/react/RuntimeAdapter.ts +2 -1
  318. package/src/react/client/DataRenderers.ts +2 -2
  319. package/src/react/client/Tools.ts +2 -2
  320. package/src/react/index.ts +157 -10
  321. package/src/react/model-context/useInlineRender.ts +1 -1
  322. package/src/react/primitive-hooks/useActionBarSpeak.ts +20 -0
  323. package/src/react/primitive-hooks/useActionBarStopSpeaking.ts +13 -0
  324. package/src/react/primitive-hooks/useBranchPickerNext.ts +19 -0
  325. package/src/react/primitive-hooks/useBranchPickerPrevious.ts +19 -0
  326. package/src/react/primitive-hooks/useComposerDictate.ts +18 -0
  327. package/src/react/primitive-hooks/useMessageError.ts +10 -0
  328. package/src/react/primitive-hooks/useSuggestionTrigger.ts +43 -0
  329. package/src/react/primitive-hooks/useThreadListItemArchive.ts +12 -0
  330. package/src/react/primitive-hooks/useThreadListItemDelete.ts +12 -0
  331. package/src/react/primitive-hooks/useThreadListItemTrigger.ts +12 -0
  332. package/src/react/primitive-hooks/useThreadListItemUnarchive.ts +12 -0
  333. package/src/react/primitive-hooks/useThreadListNew.ts +12 -0
  334. package/src/react/primitives/chainOfThought/ChainOfThoughtParts.tsx +72 -28
  335. package/src/react/primitives/composer/ComposerAttachments.tsx +69 -30
  336. package/src/react/primitives/message/MessageAttachments.tsx +69 -30
  337. package/src/react/primitives/message/MessageParts.tsx +212 -24
  338. package/src/react/primitives/message/MessageQuote.tsx +37 -0
  339. package/src/react/primitives/part/PartMessages.tsx +75 -0
  340. package/src/react/primitives/thread/ThreadMessages.tsx +113 -99
  341. package/src/react/primitives/thread/ThreadSuggestions.tsx +72 -28
  342. package/src/react/primitives/threadList/ThreadListItems.tsx +69 -23
  343. package/src/react/providers/ReadonlyThreadProvider.tsx +84 -0
  344. package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +1 -1
  345. package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +1 -1
  346. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +1 -1
  347. package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +2 -2
  348. package/src/react/runtimes/cloud/auiV0.ts +1 -1
  349. package/src/react/runtimes/createMessageConverter.ts +1 -1
  350. package/src/react/runtimes/external-message-converter.ts +2 -2
  351. package/src/react/runtimes/useLocalRuntime.ts +1 -1
  352. package/src/react/runtimes/useToolInvocations.ts +1 -1
  353. package/src/react/types/MessagePartComponentTypes.ts +4 -0
  354. package/src/react/utils/getMessageQuote.ts +18 -0
  355. package/src/runtime/api/assistant-runtime.ts +2 -2
  356. package/src/runtime/api/attachment-runtime.ts +2 -1
  357. package/src/runtime/api/bindings.ts +1 -1
  358. package/src/runtime/api/composer-runtime.ts +9 -10
  359. package/src/runtime/api/message-part-runtime.ts +3 -3
  360. package/src/runtime/api/message-runtime.ts +5 -6
  361. package/src/runtime/api/thread-list-item-runtime.ts +1 -1
  362. package/src/runtime/api/thread-list-runtime.ts +5 -3
  363. package/src/runtime/api/thread-runtime.ts +19 -11
  364. package/src/runtime/base/base-assistant-runtime-core.ts +2 -2
  365. package/src/runtime/base/base-composer-runtime-core.ts +6 -7
  366. package/src/runtime/base/base-thread-runtime-core.ts +3 -2
  367. package/src/runtime/base/default-edit-composer-runtime-core.ts +1 -1
  368. package/src/runtime/base/default-thread-composer-runtime-core.ts +1 -1
  369. package/src/runtime/interfaces/assistant-runtime-core.ts +2 -2
  370. package/src/runtime/interfaces/composer-runtime-core.ts +5 -8
  371. package/src/runtime/interfaces/thread-list-runtime-core.ts +1 -1
  372. package/src/runtime/interfaces/thread-runtime-core.ts +4 -7
  373. package/src/runtime/utils/auto-status.ts +1 -1
  374. package/src/runtime/utils/chat-model-adapter.ts +7 -5
  375. package/src/runtime/utils/external-store-message.ts +1 -1
  376. package/src/runtime/utils/message-repository.ts +2 -1
  377. package/src/runtime/utils/thread-message-like.ts +3 -4
  378. package/src/runtimes/external-store/external-store-adapter.ts +1 -1
  379. package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +1 -1
  380. package/src/runtimes/external-store/external-store-thread-runtime-core.ts +2 -2
  381. package/src/runtimes/external-store/thread-message-converter.ts +1 -1
  382. package/src/runtimes/internal.ts +3 -0
  383. package/src/runtimes/local/local-thread-list-runtime-core.ts +1 -1
  384. package/src/runtimes/local/local-thread-runtime-core.ts +3 -3
  385. package/src/runtimes/local/should-continue.ts +1 -1
  386. package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +223 -0
  387. package/src/runtimes/remote-thread-list/types.ts +1 -1
  388. package/src/store/clients/chain-of-thought-client.ts +1 -1
  389. package/src/store/clients/model-context-client.ts +2 -2
  390. package/src/store/clients/no-op-composer-client.ts +1 -1
  391. package/src/store/clients/runtime-adapter.ts +1 -1
  392. package/src/store/clients/suggestions.ts +2 -1
  393. package/src/store/clients/thread-message-client.ts +4 -3
  394. package/src/store/index.ts +76 -2
  395. package/src/store/internal.ts +7 -1
  396. package/src/store/runtime-clients/attachment-runtime-client.ts +1 -1
  397. package/src/store/runtime-clients/composer-runtime-client.ts +4 -4
  398. package/src/store/runtime-clients/message-part-runtime-client.ts +1 -1
  399. package/src/store/runtime-clients/message-runtime-client.ts +2 -2
  400. package/src/store/runtime-clients/tap-subscribable.ts +1 -1
  401. package/src/store/runtime-clients/thread-list-item-runtime-client.ts +5 -2
  402. package/src/store/runtime-clients/thread-list-runtime-client.ts +3 -2
  403. package/src/store/runtime-clients/thread-runtime-client.ts +6 -4
  404. package/src/store/scopes/attachment.ts +2 -2
  405. package/src/store/scopes/chain-of-thought.ts +2 -1
  406. package/src/store/scopes/composer.ts +6 -8
  407. package/src/store/scopes/message.ts +4 -3
  408. package/src/store/scopes/model-context.ts +2 -2
  409. package/src/store/scopes/part.ts +3 -3
  410. package/src/store/scopes/thread-list-item.ts +2 -4
  411. package/src/store/scopes/thread.ts +11 -4
  412. package/src/store/scopes/threads.ts +1 -1
  413. package/src/subscribable/subscribable.ts +1 -1
  414. package/src/tests/MessageRepository.test.ts +2 -1
  415. package/src/tests/external-store-thread-runtime-core.test.ts +1 -1
  416. package/src/utils/composite-context-provider.ts +1 -1
  417. package/src/utils/text.ts +2 -1
  418. package/dist/adapters/index.d.ts +0 -8
  419. package/dist/adapters/index.d.ts.map +0 -1
  420. package/dist/adapters/index.js +0 -3
  421. package/dist/adapters/index.js.map +0 -1
  422. package/dist/model-context/frame/index.d.ts +0 -5
  423. package/dist/model-context/frame/index.d.ts.map +0 -1
  424. package/dist/model-context/frame/index.js +0 -4
  425. package/dist/model-context/frame/index.js.map +0 -1
  426. package/dist/model-context/index.d.ts +0 -8
  427. package/dist/model-context/index.d.ts.map +0 -1
  428. package/dist/model-context/index.js +0 -9
  429. package/dist/model-context/index.js.map +0 -1
  430. package/dist/react/client/index.d.ts +0 -3
  431. package/dist/react/client/index.d.ts.map +0 -1
  432. package/dist/react/client/index.js +0 -3
  433. package/dist/react/client/index.js.map +0 -1
  434. package/dist/react/model-context/index.d.ts +0 -12
  435. package/dist/react/model-context/index.d.ts.map +0 -1
  436. package/dist/react/model-context/index.js +0 -11
  437. package/dist/react/model-context/index.js.map +0 -1
  438. package/dist/react/primitive-hooks/index.d.ts +0 -15
  439. package/dist/react/primitive-hooks/index.d.ts.map +0 -1
  440. package/dist/react/primitive-hooks/index.js +0 -15
  441. package/dist/react/primitive-hooks/index.js.map +0 -1
  442. package/dist/react/providers/index.d.ts +0 -10
  443. package/dist/react/providers/index.d.ts.map +0 -1
  444. package/dist/react/providers/index.js +0 -10
  445. package/dist/react/providers/index.js.map +0 -1
  446. package/dist/react/runtimes/cloud/index.d.ts +0 -4
  447. package/dist/react/runtimes/cloud/index.d.ts.map +0 -1
  448. package/dist/react/runtimes/cloud/index.js +0 -4
  449. package/dist/react/runtimes/cloud/index.js.map +0 -1
  450. package/dist/react/runtimes/index.d.ts +0 -11
  451. package/dist/react/runtimes/index.d.ts.map +0 -1
  452. package/dist/react/runtimes/index.js +0 -11
  453. package/dist/react/runtimes/index.js.map +0 -1
  454. package/dist/react/types/index.d.ts +0 -3
  455. package/dist/react/types/index.d.ts.map +0 -1
  456. package/dist/react/types/index.js +0 -2
  457. package/dist/react/types/index.js.map +0 -1
  458. package/dist/react/types/scopes/index.d.ts +0 -3
  459. package/dist/react/types/scopes/index.d.ts.map +0 -1
  460. package/dist/react/types/scopes/index.js +0 -2
  461. package/dist/react/types/scopes/index.js.map +0 -1
  462. package/dist/runtime/index.d.ts +0 -20
  463. package/dist/runtime/index.d.ts.map +0 -1
  464. package/dist/runtime/index.js +0 -7
  465. package/dist/runtime/index.js.map +0 -1
  466. package/dist/runtimes/external-store/index.d.ts +0 -8
  467. package/dist/runtimes/external-store/index.d.ts.map +0 -1
  468. package/dist/runtimes/external-store/index.js +0 -5
  469. package/dist/runtimes/external-store/index.js.map +0 -1
  470. package/dist/runtimes/index.d.ts +0 -6
  471. package/dist/runtimes/index.d.ts.map +0 -1
  472. package/dist/runtimes/index.js +0 -4
  473. package/dist/runtimes/index.js.map +0 -1
  474. package/dist/runtimes/local/index.d.ts +0 -7
  475. package/dist/runtimes/local/index.d.ts.map +0 -1
  476. package/dist/runtimes/local/index.js +0 -5
  477. package/dist/runtimes/local/index.js.map +0 -1
  478. package/dist/store/clients/index.d.ts +0 -6
  479. package/dist/store/clients/index.d.ts.map +0 -1
  480. package/dist/store/clients/index.js +0 -6
  481. package/dist/store/clients/index.js.map +0 -1
  482. package/dist/store/runtime-clients/index.d.ts +0 -8
  483. package/dist/store/runtime-clients/index.d.ts.map +0 -1
  484. package/dist/store/runtime-clients/index.js +0 -8
  485. package/dist/store/runtime-clients/index.js.map +0 -1
  486. package/dist/store/scopes/index.d.ts +0 -12
  487. package/dist/store/scopes/index.d.ts.map +0 -1
  488. package/dist/store/scopes/index.js +0 -2
  489. package/dist/store/scopes/index.js.map +0 -1
  490. package/dist/subscribable/index.d.ts +0 -3
  491. package/dist/subscribable/index.d.ts.map +0 -1
  492. package/dist/subscribable/index.js +0 -8
  493. package/dist/subscribable/index.js.map +0 -1
  494. package/dist/types/index.d.ts +0 -5
  495. package/dist/types/index.d.ts.map +0 -1
  496. package/dist/types/index.js +0 -2
  497. package/dist/types/index.js.map +0 -1
  498. package/dist/utils/index.d.ts +0 -4
  499. package/dist/utils/index.d.ts.map +0 -1
  500. package/dist/utils/index.js +0 -7
  501. package/dist/utils/index.js.map +0 -1
  502. package/src/adapters/index.ts +0 -30
  503. package/src/model-context/frame/index.ts +0 -10
  504. package/src/model-context/index.ts +0 -35
  505. package/src/react/client/index.ts +0 -2
  506. package/src/react/model-context/index.ts +0 -25
  507. package/src/react/primitive-hooks/index.ts +0 -20
  508. package/src/react/providers/index.ts +0 -15
  509. package/src/react/runtimes/cloud/index.ts +0 -3
  510. package/src/react/runtimes/index.ts +0 -36
  511. package/src/react/types/index.ts +0 -31
  512. package/src/react/types/scopes/index.ts +0 -6
  513. package/src/runtime/index.ts +0 -109
  514. package/src/runtimes/external-store/index.ts +0 -15
  515. package/src/runtimes/index.ts +0 -28
  516. package/src/runtimes/local/index.ts +0 -6
  517. package/src/store/clients/index.ts +0 -8
  518. package/src/store/runtime-clients/index.ts +0 -7
  519. package/src/store/scopes/index.ts +0 -68
  520. package/src/subscribable/index.ts +0 -21
  521. package/src/types/index.ts +0 -40
  522. package/src/utils/index.ts +0 -14
@@ -1,23 +1,31 @@
1
- import type { Attachment } from "../../../types";
2
- import { ComponentType, type FC, memo, useMemo } from "react";
3
- import { useAuiState } from "@assistant-ui/store";
4
- import { ComposerAttachmentByIndexProvider } from "../../providers";
1
+ import type { Attachment } from "../../../types/attachment";
2
+ import { ComponentType, type FC, type ReactNode, memo, useMemo } from "react";
3
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
4
+ import { ComposerAttachmentByIndexProvider } from "../../providers/AttachmentByIndexProvider";
5
+
6
+ type ComposerAttachmentsComponentConfig = {
7
+ Image?: ComponentType | undefined;
8
+ Document?: ComponentType | undefined;
9
+ File?: ComponentType | undefined;
10
+ Attachment?: ComponentType | undefined;
11
+ };
5
12
 
6
13
  export namespace ComposerPrimitiveAttachments {
7
- export type Props = {
8
- components:
9
- | {
10
- Image?: ComponentType | undefined;
11
- Document?: ComponentType | undefined;
12
- File?: ComponentType | undefined;
13
- Attachment?: ComponentType | undefined;
14
- }
15
- | undefined;
16
- };
14
+ export type Props =
15
+ | {
16
+ /** @deprecated Use the children render function instead. */
17
+ components: ComposerAttachmentsComponentConfig;
18
+ children?: never;
19
+ }
20
+ | {
21
+ /** Render function called for each attachment. Receives the attachment. */
22
+ children: (value: { attachment: Attachment }) => ReactNode;
23
+ components?: never;
24
+ };
17
25
  }
18
26
 
19
27
  const getComponent = (
20
- components: ComposerPrimitiveAttachments.Props["components"],
28
+ components: ComposerAttachmentsComponentConfig | undefined,
21
29
  attachment: Attachment,
22
30
  ) => {
23
31
  const type = attachment.type;
@@ -34,7 +42,7 @@ const getComponent = (
34
42
  };
35
43
 
36
44
  const AttachmentComponent: FC<{
37
- components: ComposerPrimitiveAttachments.Props["components"];
45
+ components: ComposerAttachmentsComponentConfig | undefined;
38
46
  }> = ({ components }) => {
39
47
  const attachment = useAuiState((s) => s.attachment);
40
48
  if (!attachment) return null;
@@ -47,7 +55,7 @@ const AttachmentComponent: FC<{
47
55
  export namespace ComposerPrimitiveAttachmentByIndex {
48
56
  export type Props = {
49
57
  index: number;
50
- components?: ComposerPrimitiveAttachments.Props["components"];
58
+ components?: ComposerAttachmentsComponentConfig;
51
59
  };
52
60
  }
53
61
 
@@ -74,22 +82,53 @@ export const ComposerPrimitiveAttachmentByIndex: FC<ComposerPrimitiveAttachmentB
74
82
  ComposerPrimitiveAttachmentByIndex.displayName =
75
83
  "ComposerPrimitive.AttachmentByIndex";
76
84
 
77
- export const ComposerPrimitiveAttachments: FC<
78
- ComposerPrimitiveAttachments.Props
79
- > = ({ components }) => {
85
+ const ComposerPrimitiveAttachmentsInner: FC<{
86
+ children: (value: { attachment: Attachment }) => ReactNode;
87
+ }> = ({ children }) => {
80
88
  const attachmentsCount = useAuiState((s) => s.composer.attachments.length);
81
89
 
82
- const attachmentElements = useMemo(() => {
83
- return Array.from({ length: attachmentsCount }, (_, index) => (
84
- <ComposerPrimitiveAttachmentByIndex
85
- key={index}
86
- index={index}
87
- components={components}
88
- />
89
- ));
90
- }, [attachmentsCount, components]);
90
+ return useMemo(
91
+ () =>
92
+ Array.from({ length: attachmentsCount }, (_, index) => (
93
+ <ComposerAttachmentByIndexProvider key={index} index={index}>
94
+ <RenderChildrenWithAccessor
95
+ getItemState={(aui) =>
96
+ aui.composer().attachment({ index }).getState()
97
+ }
98
+ >
99
+ {(getItem) =>
100
+ children({
101
+ get attachment() {
102
+ return getItem();
103
+ },
104
+ })
105
+ }
106
+ </RenderChildrenWithAccessor>
107
+ </ComposerAttachmentByIndexProvider>
108
+ )),
109
+ [attachmentsCount, children],
110
+ );
111
+ };
91
112
 
92
- return attachmentElements;
113
+ export const ComposerPrimitiveAttachments: FC<
114
+ ComposerPrimitiveAttachments.Props
115
+ > = ({ components, children }) => {
116
+ if (components) {
117
+ return (
118
+ <ComposerPrimitiveAttachmentsInner>
119
+ {({ attachment }) => {
120
+ const Component = getComponent(components, attachment);
121
+ if (!Component) return null;
122
+ return <Component />;
123
+ }}
124
+ </ComposerPrimitiveAttachmentsInner>
125
+ );
126
+ }
127
+ return (
128
+ <ComposerPrimitiveAttachmentsInner>
129
+ {children}
130
+ </ComposerPrimitiveAttachmentsInner>
131
+ );
93
132
  };
94
133
 
95
134
  ComposerPrimitiveAttachments.displayName = "ComposerPrimitive.Attachments";
@@ -1,23 +1,31 @@
1
- import type { CompleteAttachment } from "../../../types";
2
- import { ComponentType, type FC, memo, useMemo } from "react";
3
- import { useAuiState } from "@assistant-ui/store";
4
- import { MessageAttachmentByIndexProvider } from "../../providers";
1
+ import type { CompleteAttachment } from "../../../types/attachment";
2
+ import { ComponentType, type FC, type ReactNode, memo, useMemo } from "react";
3
+ import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
4
+ import { MessageAttachmentByIndexProvider } from "../../providers/AttachmentByIndexProvider";
5
+
6
+ type MessageAttachmentsComponentConfig = {
7
+ Image?: ComponentType | undefined;
8
+ Document?: ComponentType | undefined;
9
+ File?: ComponentType | undefined;
10
+ Attachment?: ComponentType | undefined;
11
+ };
5
12
 
6
13
  export namespace MessagePrimitiveAttachments {
7
- export type Props = {
8
- components:
9
- | {
10
- Image?: ComponentType | undefined;
11
- Document?: ComponentType | undefined;
12
- File?: ComponentType | undefined;
13
- Attachment?: ComponentType | undefined;
14
- }
15
- | undefined;
16
- };
14
+ export type Props =
15
+ | {
16
+ /** @deprecated Use the children render function instead. */
17
+ components: MessageAttachmentsComponentConfig;
18
+ children?: never;
19
+ }
20
+ | {
21
+ /** Render function called for each attachment. Receives the attachment. */
22
+ children: (value: { attachment: CompleteAttachment }) => ReactNode;
23
+ components?: never;
24
+ };
17
25
  }
18
26
 
19
27
  const getComponent = (
20
- components: MessagePrimitiveAttachments.Props["components"],
28
+ components: MessageAttachmentsComponentConfig | undefined,
21
29
  attachment: CompleteAttachment,
22
30
  ) => {
23
31
  const type = attachment.type;
@@ -34,7 +42,7 @@ const getComponent = (
34
42
  };
35
43
 
36
44
  const AttachmentComponent: FC<{
37
- components: MessagePrimitiveAttachments.Props["components"];
45
+ components: MessageAttachmentsComponentConfig | undefined;
38
46
  }> = ({ components }) => {
39
47
  const attachment = useAuiState((s) => s.attachment);
40
48
  if (!attachment) return null;
@@ -47,7 +55,7 @@ const AttachmentComponent: FC<{
47
55
  export namespace MessagePrimitiveAttachmentByIndex {
48
56
  export type Props = {
49
57
  index: number;
50
- components?: MessagePrimitiveAttachments.Props["components"];
58
+ components?: MessageAttachmentsComponentConfig;
51
59
  };
52
60
  }
53
61
 
@@ -74,25 +82,56 @@ export const MessagePrimitiveAttachmentByIndex: FC<MessagePrimitiveAttachmentByI
74
82
  MessagePrimitiveAttachmentByIndex.displayName =
75
83
  "MessagePrimitive.AttachmentByIndex";
76
84
 
77
- export const MessagePrimitiveAttachments: FC<
78
- MessagePrimitiveAttachments.Props
79
- > = ({ components }) => {
85
+ const MessagePrimitiveAttachmentsInner: FC<{
86
+ children: (value: { attachment: CompleteAttachment }) => ReactNode;
87
+ }> = ({ children }) => {
80
88
  const attachmentsCount = useAuiState((s) => {
81
89
  if (s.message.role !== "user") return 0;
82
90
  return s.message.attachments.length;
83
91
  });
84
92
 
85
- const attachmentElements = useMemo(() => {
86
- return Array.from({ length: attachmentsCount }, (_, index) => (
87
- <MessagePrimitiveAttachmentByIndex
88
- key={index}
89
- index={index}
90
- components={components}
91
- />
92
- ));
93
- }, [attachmentsCount, components]);
93
+ return useMemo(
94
+ () =>
95
+ Array.from({ length: attachmentsCount }, (_, index) => (
96
+ <MessageAttachmentByIndexProvider key={index} index={index}>
97
+ <RenderChildrenWithAccessor
98
+ getItemState={(aui) =>
99
+ aui.message().attachment({ index }).getState()
100
+ }
101
+ >
102
+ {(getItem) =>
103
+ children({
104
+ get attachment() {
105
+ return getItem() as CompleteAttachment;
106
+ },
107
+ })
108
+ }
109
+ </RenderChildrenWithAccessor>
110
+ </MessageAttachmentByIndexProvider>
111
+ )),
112
+ [attachmentsCount, children],
113
+ );
114
+ };
94
115
 
95
- return attachmentElements;
116
+ export const MessagePrimitiveAttachments: FC<
117
+ MessagePrimitiveAttachments.Props
118
+ > = ({ components, children }) => {
119
+ if (components) {
120
+ return (
121
+ <MessagePrimitiveAttachmentsInner>
122
+ {({ attachment }) => {
123
+ const Component = getComponent(components, attachment);
124
+ if (!Component) return null;
125
+ return <Component />;
126
+ }}
127
+ </MessagePrimitiveAttachmentsInner>
128
+ );
129
+ }
130
+ return (
131
+ <MessagePrimitiveAttachmentsInner>
132
+ {children}
133
+ </MessagePrimitiveAttachmentsInner>
134
+ );
96
135
  };
97
136
 
98
137
  MessagePrimitiveAttachments.displayName = "MessagePrimitive.Attachments";
@@ -1,13 +1,21 @@
1
1
  import {
2
2
  type ComponentType,
3
3
  type FC,
4
+ type ReactNode,
4
5
  memo,
5
6
  PropsWithChildren,
6
7
  useMemo,
7
8
  } from "react";
8
- import { useAuiState, useAui } from "@assistant-ui/store";
9
- import { PartByIndexProvider, TextMessagePartProvider } from "../../providers";
9
+ import {
10
+ RenderChildrenWithAccessor,
11
+ useAuiState,
12
+ useAui,
13
+ } from "@assistant-ui/store";
14
+ import type { PartState } from "../../../store/scopes/part";
15
+ import { PartByIndexProvider } from "../../providers/PartByIndexProvider";
16
+ import { TextMessagePartProvider } from "../../providers/TextMessagePartProvider";
10
17
  import { ChainOfThoughtByIndicesProvider } from "../../providers/ChainOfThoughtByIndicesProvider";
18
+ import { getMessageQuote } from "../../utils/getMessageQuote";
11
19
  import type {
12
20
  Unstable_AudioMessagePartComponent,
13
21
  DataMessagePartComponent,
@@ -21,8 +29,9 @@ import type {
21
29
  FileMessagePartComponent,
22
30
  ReasoningMessagePartComponent,
23
31
  ReasoningGroupComponent,
24
- } from "../../types";
25
- import type { MessagePartStatus } from "../../../types";
32
+ QuoteMessagePartComponent,
33
+ } from "../../types/MessagePartComponentTypes";
34
+ import type { MessagePartStatus } from "../../../types/message";
26
35
  import { useShallow } from "zustand/shallow";
27
36
 
28
37
  type MessagePartRange =
@@ -161,6 +170,8 @@ export namespace MessagePrimitiveParts {
161
170
  Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;
162
171
  /** Configuration for data part rendering */
163
172
  data?: DataConfig | undefined;
173
+ /** Component for rendering a quoted message reference (from metadata, not parts) */
174
+ Quote?: QuoteMessagePartComponent | undefined;
164
175
  };
165
176
 
166
177
  type ToolsConfig =
@@ -230,24 +241,32 @@ export namespace MessagePrimitiveParts {
230
241
  ReasoningGroup?: never;
231
242
  };
232
243
 
233
- export type Props = {
234
- /**
235
- * Component configuration for rendering different types of message content.
236
- *
237
- * Use either `Reasoning`/`tools`/`ToolGroup`/`ReasoningGroup` for standard rendering,
238
- * or `ChainOfThought` to group all reasoning and tool-call parts into a single
239
- * collapsible component. These two modes are mutually exclusive.
240
- */
241
- components?: StandardComponents | ChainOfThoughtComponents | undefined;
242
- /**
243
- * When enabled, shows the Empty component if the last part in the message
244
- * is anything other than Text or Reasoning.
245
- *
246
- * @experimental This API is experimental and may change in future versions.
247
- * @default true
248
- */
249
- unstable_showEmptyOnNonTextEnd?: boolean | undefined;
250
- };
244
+ export type Props =
245
+ | {
246
+ /**
247
+ * Component configuration for rendering different types of message content.
248
+ *
249
+ * Use either `Reasoning`/`tools`/`ToolGroup`/`ReasoningGroup` for standard rendering,
250
+ * or `ChainOfThought` to group all reasoning and tool-call parts into a single
251
+ * collapsible component. These two modes are mutually exclusive.
252
+ */
253
+ components?: StandardComponents | ChainOfThoughtComponents | undefined;
254
+ /**
255
+ * When enabled, shows the Empty component if the last part in the message
256
+ * is anything other than Text or Reasoning.
257
+ *
258
+ * @experimental This API is experimental and may change in future versions.
259
+ * @default true
260
+ */
261
+ unstable_showEmptyOnNonTextEnd?: boolean | undefined;
262
+ children?: never;
263
+ }
264
+ | {
265
+ /** Render function called for each part. Receives the enriched part state. */
266
+ children: (value: { part: EnrichedPartState }) => ReactNode;
267
+ components?: never;
268
+ unstable_showEmptyOnNonTextEnd?: never;
269
+ };
251
270
  }
252
271
 
253
272
  const ToolUIDisplay = ({
@@ -460,6 +479,158 @@ const ConditionalEmpty = memo(
460
479
  prev.components?.Text === next.components?.Text,
461
480
  );
462
481
 
482
+ const QuoteRendererImpl: FC<{ Quote: QuoteMessagePartComponent }> = ({
483
+ Quote,
484
+ }) => {
485
+ const quoteInfo = useAuiState(getMessageQuote);
486
+ if (!quoteInfo) return null;
487
+ return <Quote text={quoteInfo.text} messageId={quoteInfo.messageId} />;
488
+ };
489
+
490
+ const QuoteRenderer = memo(QuoteRendererImpl);
491
+
492
+ /**
493
+ * Stable propless component that renders the registered tool UI for the
494
+ * current part context. Reads tool registry and part state from context.
495
+ */
496
+ const RegisteredToolUI: FC = () => {
497
+ const aui = useAui();
498
+ const part = useAuiState((s) => s.part);
499
+ const Render = useAuiState((s) => {
500
+ if (s.part.type !== "tool-call") return null;
501
+ const entry = s.tools.tools[s.part.toolName];
502
+ if (Array.isArray(entry)) return entry[0] ?? null;
503
+ return entry ?? null;
504
+ });
505
+
506
+ if (!Render || part.type !== "tool-call") return null;
507
+
508
+ return (
509
+ <Render
510
+ {...part}
511
+ addResult={aui.part().addToolResult}
512
+ resume={aui.part().resumeToolCall}
513
+ />
514
+ );
515
+ };
516
+
517
+ /**
518
+ * Stable propless component that renders the registered data renderer UI
519
+ * for the current part context.
520
+ */
521
+ const RegisteredDataRendererUI: FC = () => {
522
+ const part = useAuiState((s) => s.part);
523
+ const Render = useAuiState((s) => {
524
+ if (s.part.type !== "data") return null;
525
+ const entry = s.dataRenderers.renderers[s.part.name];
526
+ if (Array.isArray(entry)) return entry[0] ?? null;
527
+ return entry ?? null;
528
+ });
529
+
530
+ if (!Render || part.type !== "data") return null;
531
+
532
+ return <Render {...(part as DataMessagePartProps)} />;
533
+ };
534
+
535
+ /**
536
+ * Fallback component rendered when the children render function returns null.
537
+ * Renders registered tool/data UIs via context.
538
+ * For all other part types, renders nothing.
539
+ *
540
+ * This allows users to write:
541
+ * {({ part }) => {
542
+ * if (part.type === "text") return <MyText />;
543
+ * return null; // tool UIs and data UIs still render via registry
544
+ * }}
545
+ *
546
+ * To explicitly render nothing (suppressing registered UIs), return <></>.
547
+ */
548
+ const DefaultPartFallback: FC = () => {
549
+ const partType = useAuiState((s) => s.part.type);
550
+
551
+ if (partType === "tool-call") return <RegisteredToolUI />;
552
+ if (partType === "data") return <RegisteredDataRendererUI />;
553
+
554
+ return null;
555
+ };
556
+
557
+ export type { PartState };
558
+
559
+ /**
560
+ * Enriched part state passed to children render functions.
561
+ *
562
+ * For tool-call parts, adds `toolUI`, `addResult`, and `resume`.
563
+ * For data parts, adds `dataRendererUI`.
564
+ */
565
+ export type EnrichedPartState =
566
+ | (Extract<PartState, { type: "tool-call" }> & {
567
+ /** The registered tool UI element, or null if none registered. */
568
+ readonly toolUI: ReactNode;
569
+ /** Add a tool result to this tool call. */
570
+ addResult: ToolCallMessagePartProps["addResult"];
571
+ /** Resume a tool call waiting for human input. */
572
+ resume: ToolCallMessagePartProps["resume"];
573
+ })
574
+ | (Extract<PartState, { type: "data" }> & {
575
+ /** The registered data renderer UI element, or null if none registered. */
576
+ readonly dataRendererUI: ReactNode;
577
+ })
578
+ | Exclude<PartState, { type: "tool-call" } | { type: "data" }>;
579
+
580
+ const MessagePrimitivePartsInner: FC<{
581
+ children: (value: { part: EnrichedPartState }) => ReactNode;
582
+ }> = ({ children }) => {
583
+ const aui = useAui();
584
+ const contentLength = useAuiState((s) => s.message.parts.length);
585
+
586
+ // biome-ignore lint/correctness/useExhaustiveDependencies: aui accessors are stable refs
587
+ return useMemo(
588
+ () =>
589
+ Array.from({ length: contentLength }, (_, index) => (
590
+ <PartByIndexProvider key={index} index={index}>
591
+ <RenderChildrenWithAccessor
592
+ getItemState={(aui) => aui.message().part({ index }).getState()}
593
+ >
594
+ {(getItem) => {
595
+ const result = children({
596
+ get part() {
597
+ const state = getItem();
598
+ if (state.type === "tool-call") {
599
+ const entry = aui.tools().getState().tools[state.toolName];
600
+ const hasUI = Array.isArray(entry) ? !!entry[0] : !!entry;
601
+ const partMethods = aui.message().part({ index });
602
+ return {
603
+ ...state,
604
+ toolUI: hasUI ? <RegisteredToolUI /> : null,
605
+ addResult: partMethods.addToolResult,
606
+ resume: partMethods.resumeToolCall,
607
+ };
608
+ }
609
+ if (state.type === "data") {
610
+ const entry = aui.dataRenderers().getState().renderers[
611
+ state.name
612
+ ];
613
+ const hasUI = Array.isArray(entry) ? !!entry[0] : !!entry;
614
+ return {
615
+ ...state,
616
+ dataRendererUI: hasUI ? (
617
+ <RegisteredDataRendererUI />
618
+ ) : null,
619
+ };
620
+ }
621
+ return state;
622
+ },
623
+ });
624
+ if (result !== null) return result;
625
+ return <DefaultPartFallback />;
626
+ }}
627
+ </RenderChildrenWithAccessor>
628
+ </PartByIndexProvider>
629
+ )),
630
+ [contentLength, children],
631
+ );
632
+ };
633
+
463
634
  /**
464
635
  * Renders the parts of a message with support for multiple content types.
465
636
  *
@@ -469,7 +640,25 @@ const ConditionalEmpty = memo(
469
640
  export const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = ({
470
641
  components,
471
642
  unstable_showEmptyOnNonTextEnd = true,
643
+ children,
472
644
  }) => {
645
+ if (children) {
646
+ return <MessagePrimitivePartsInner>{children}</MessagePrimitivePartsInner>;
647
+ }
648
+ return (
649
+ <MessagePrimitivePartsCompat
650
+ components={components}
651
+ unstable_showEmptyOnNonTextEnd={unstable_showEmptyOnNonTextEnd}
652
+ />
653
+ );
654
+ };
655
+
656
+ MessagePrimitiveParts.displayName = "MessagePrimitive.Parts";
657
+
658
+ const MessagePrimitivePartsCompat: FC<{
659
+ components: MessagePrimitiveParts.Props["components"];
660
+ unstable_showEmptyOnNonTextEnd: boolean;
661
+ }> = ({ components, unstable_showEmptyOnNonTextEnd }) => {
473
662
  const contentLength = useAuiState((s) => s.message.parts.length);
474
663
  const useChainOfThought = !!components?.ChainOfThought;
475
664
  const messageRanges = useMessagePartsGroups(useChainOfThought);
@@ -549,6 +738,7 @@ export const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = ({
549
738
 
550
739
  return (
551
740
  <>
741
+ {components?.Quote && <QuoteRenderer Quote={components.Quote} />}
552
742
  {partsElements}
553
743
  <ConditionalEmpty
554
744
  components={components}
@@ -557,5 +747,3 @@ export const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = ({
557
747
  </>
558
748
  );
559
749
  };
560
-
561
- MessagePrimitiveParts.displayName = "MessagePrimitive.Parts";
@@ -0,0 +1,37 @@
1
+ import { type FC, type ReactNode, memo } from "react";
2
+ import { useAuiState } from "@assistant-ui/store";
3
+ import { getMessageQuote } from "../../utils/getMessageQuote";
4
+ import type { QuoteInfo } from "../../../types/quote";
5
+
6
+ export namespace MessagePrimitiveQuote {
7
+ export type Props = {
8
+ /** Render function called when a quote is present. Receives quote info. */
9
+ children: (value: QuoteInfo) => ReactNode;
10
+ };
11
+ }
12
+
13
+ /**
14
+ * Renders a quote block if the message has quote metadata.
15
+ * Place this above `MessagePrimitive.Parts` in your message layout.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <MessagePrimitive.Quote>
20
+ * {({ text, messageId }) => <QuoteBlock text={text} messageId={messageId} />}
21
+ * </MessagePrimitive.Quote>
22
+ * <MessagePrimitive.Parts>
23
+ * {({ part }) => { ... }}
24
+ * </MessagePrimitive.Parts>
25
+ * ```
26
+ */
27
+ const MessagePrimitiveQuoteImpl: FC<MessagePrimitiveQuote.Props> = ({
28
+ children,
29
+ }) => {
30
+ const quoteInfo = useAuiState(getMessageQuote);
31
+ if (!quoteInfo) return null;
32
+ return <>{children(quoteInfo)}</>;
33
+ };
34
+
35
+ export const MessagePrimitiveQuote = memo(MessagePrimitiveQuoteImpl);
36
+
37
+ MessagePrimitiveQuote.displayName = "MessagePrimitive.Quote";
@@ -0,0 +1,75 @@
1
+ import { type FC, type ReactNode, memo } from "react";
2
+ import { useAuiState } from "@assistant-ui/store";
3
+ import type { ThreadMessage } from "../../../types/message";
4
+ import { ReadonlyThreadProvider } from "../../providers/ReadonlyThreadProvider";
5
+ import {
6
+ ThreadPrimitiveMessages,
7
+ ThreadPrimitiveMessagesImpl,
8
+ } from "../thread/ThreadMessages";
9
+
10
+ export namespace PartPrimitiveMessages {
11
+ export type Props = {
12
+ components?: ThreadPrimitiveMessages.Props["components"];
13
+ /** Render function called for each message. Receives the message. */
14
+ children?: (value: { message: ThreadMessage }) => ReactNode;
15
+ };
16
+ }
17
+
18
+ const usePartMessages = (): readonly ThreadMessage[] | undefined => {
19
+ return useAuiState((s) => {
20
+ const part = s.part;
21
+ if (part.type !== "tool-call") return undefined;
22
+ return "messages" in part
23
+ ? (part.messages as readonly ThreadMessage[] | undefined)
24
+ : undefined;
25
+ });
26
+ };
27
+
28
+ /**
29
+ * Renders the nested messages of a tool call part (e.g. sub-agent conversation).
30
+ *
31
+ * This primitive reads `messages` from the current tool call part in the PartScope
32
+ * and renders them using a readonly thread context. All existing message and part
33
+ * primitives work inside, and parent tool UI registrations are inherited.
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * const SubAgentToolUI = makeAssistantToolUI({
38
+ * toolName: "invoke_sub_agent",
39
+ * render: () => (
40
+ * <PartPrimitive.Messages>
41
+ * {({ message }) => {
42
+ * if (message.role === "user") return <MyUserMessage />;
43
+ * return <MyAssistantMessage />;
44
+ * }}
45
+ * </PartPrimitive.Messages>
46
+ * ),
47
+ * });
48
+ * ```
49
+ */
50
+ export const PartPrimitiveMessagesImpl: FC<PartPrimitiveMessages.Props> = ({
51
+ components,
52
+ children,
53
+ }) => {
54
+ const messages = usePartMessages();
55
+
56
+ if (!messages?.length) return null;
57
+
58
+ if (children) {
59
+ return (
60
+ <ReadonlyThreadProvider messages={messages}>
61
+ <ThreadPrimitiveMessagesImpl>{children}</ThreadPrimitiveMessagesImpl>
62
+ </ReadonlyThreadProvider>
63
+ );
64
+ }
65
+
66
+ return (
67
+ <ReadonlyThreadProvider messages={messages}>
68
+ <ThreadPrimitiveMessagesImpl components={components!} />
69
+ </ReadonlyThreadProvider>
70
+ );
71
+ };
72
+
73
+ PartPrimitiveMessagesImpl.displayName = "PartPrimitive.Messages";
74
+
75
+ export const PartPrimitiveMessages = memo(PartPrimitiveMessagesImpl);