@assistant-ui/core 0.3.13 → 0.3.15

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 (463) hide show
  1. package/dist/adapters/speech.d.ts.map +1 -1
  2. package/dist/adapters/speech.js +9 -15
  3. package/dist/adapters/speech.js.map +1 -1
  4. package/dist/adapters/thread-history.d.ts +2 -0
  5. package/dist/adapters/thread-history.d.ts.map +1 -1
  6. package/dist/adapters/voice.d.ts.map +1 -1
  7. package/dist/adapters/voice.js +38 -15
  8. package/dist/adapters/voice.js.map +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/internal.d.ts +3 -2
  13. package/dist/internal.js +8 -7
  14. package/dist/model-context/frame/host.d.ts +1 -1
  15. package/dist/model-context/frame/host.d.ts.map +1 -1
  16. package/dist/model-context/frame/host.js +19 -4
  17. package/dist/model-context/frame/host.js.map +1 -1
  18. package/dist/model-context/frame/provider.d.ts +4 -0
  19. package/dist/model-context/frame/provider.d.ts.map +1 -1
  20. package/dist/model-context/frame/provider.js +50 -3
  21. package/dist/model-context/frame/provider.js.map +1 -1
  22. package/dist/model-context/frame/types.d.ts +4 -1
  23. package/dist/model-context/frame/types.d.ts.map +1 -1
  24. package/dist/model-context/frame/types.js.map +1 -1
  25. package/dist/model-context/registry.d.ts.map +1 -1
  26. package/dist/model-context/registry.js +16 -4
  27. package/dist/model-context/registry.js.map +1 -1
  28. package/dist/react/RuntimeAdapter.d.ts +8 -1
  29. package/dist/react/RuntimeAdapter.d.ts.map +1 -1
  30. package/dist/react/RuntimeAdapter.js +23 -18
  31. package/dist/react/RuntimeAdapter.js.map +1 -1
  32. package/dist/react/adapters/LocalStorageThreadListAdapter.d.ts.map +1 -1
  33. package/dist/react/adapters/LocalStorageThreadListAdapter.js +28 -12
  34. package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
  35. package/dist/react/client/AdaptedRemoteThread.d.ts +11 -0
  36. package/dist/react/client/AdaptedRemoteThread.d.ts.map +1 -0
  37. package/dist/react/client/AdaptedRemoteThread.js +27 -0
  38. package/dist/react/client/AdaptedRemoteThread.js.map +1 -0
  39. package/dist/react/client/InMemoryThreadList.d.ts +19 -0
  40. package/dist/react/client/InMemoryThreadList.d.ts.map +1 -0
  41. package/dist/react/client/InMemoryThreadList.js +418 -0
  42. package/dist/react/client/InMemoryThreadList.js.map +1 -0
  43. package/dist/react/client/Interactables.d.ts.map +1 -1
  44. package/dist/react/client/Interactables.js +159 -102
  45. package/dist/react/client/Interactables.js.map +1 -1
  46. package/dist/react/client/RemoteThreadList.d.ts +34 -0
  47. package/dist/react/client/RemoteThreadList.d.ts.map +1 -0
  48. package/dist/react/client/RemoteThreadList.js +898 -0
  49. package/dist/react/client/RemoteThreadList.js.map +1 -0
  50. package/dist/react/client/Tools.d.ts.map +1 -1
  51. package/dist/react/client/Tools.js +38 -27
  52. package/dist/react/client/Tools.js.map +1 -1
  53. package/dist/react/index.d.ts +7 -2
  54. package/dist/react/index.js +5 -2
  55. package/dist/react/interactables-legacy/Interactables.d.ts.map +1 -1
  56. package/dist/react/interactables-legacy/Interactables.js +145 -110
  57. package/dist/react/interactables-legacy/Interactables.js.map +1 -1
  58. package/dist/react/primitive-hooks/useActionBarCopy.d.ts.map +1 -1
  59. package/dist/react/primitive-hooks/useActionBarCopy.js +20 -19
  60. package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
  61. package/dist/react/primitive-hooks/useActionBarEdit.d.ts.map +1 -1
  62. package/dist/react/primitive-hooks/useActionBarEdit.js +2 -4
  63. package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
  64. package/dist/react/primitive-hooks/useActionBarReload.d.ts.map +1 -1
  65. package/dist/react/primitive-hooks/useActionBarReload.js +2 -4
  66. package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
  67. package/dist/react/primitive-hooks/useBranchPickerNext.d.ts.map +1 -1
  68. package/dist/react/primitive-hooks/useBranchPickerNext.js +2 -6
  69. package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
  70. package/dist/react/primitive-hooks/useBranchPickerPrevious.d.ts.map +1 -1
  71. package/dist/react/primitive-hooks/useBranchPickerPrevious.js +2 -6
  72. package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
  73. package/dist/react/primitive-hooks/useComposerCancel.d.ts.map +1 -1
  74. package/dist/react/primitive-hooks/useComposerCancel.js +2 -4
  75. package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
  76. package/dist/react/primitive-hooks/useComposerSend.d.ts.map +1 -1
  77. package/dist/react/primitive-hooks/useComposerSend.js +2 -4
  78. package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
  79. package/dist/react/primitive-hooks/useSuggestionTrigger.d.ts.map +1 -1
  80. package/dist/react/primitive-hooks/useSuggestionTrigger.js +6 -2
  81. package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
  82. package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts +3 -0
  83. package/dist/react/primitive-hooks/useThreadIsEmpty.d.ts.map +1 -1
  84. package/dist/react/primitive-hooks/useThreadIsEmpty.js +3 -0
  85. package/dist/react/primitive-hooks/useThreadIsEmpty.js.map +1 -1
  86. package/dist/react/primitive-hooks/useThreadIsRunning.d.ts +3 -0
  87. package/dist/react/primitive-hooks/useThreadIsRunning.d.ts.map +1 -1
  88. package/dist/react/primitive-hooks/useThreadIsRunning.js +3 -0
  89. package/dist/react/primitive-hooks/useThreadIsRunning.js.map +1 -1
  90. package/dist/react/primitives/message/MessageParts.d.ts +13 -0
  91. package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
  92. package/dist/react/primitives/message/MessageParts.js.map +1 -1
  93. package/dist/react/primitives/thread/ThreadMessages.d.ts.map +1 -1
  94. package/dist/react/primitives/thread/ThreadMessages.js +1 -1
  95. package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
  96. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +24 -10
  97. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
  98. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +115 -71
  99. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
  100. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +14 -2
  101. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  102. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +232 -63
  103. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  104. package/dist/react/runtimes/RemoteThreadResource.d.ts +30 -0
  105. package/dist/react/runtimes/RemoteThreadResource.d.ts.map +1 -0
  106. package/dist/react/runtimes/RemoteThreadResource.js +136 -0
  107. package/dist/react/runtimes/RemoteThreadResource.js.map +1 -0
  108. package/dist/react/runtimes/RuntimeAdapterProvider.d.ts +3 -10
  109. package/dist/react/runtimes/RuntimeAdapterProvider.d.ts.map +1 -1
  110. package/dist/react/runtimes/RuntimeAdapterProvider.js +3 -6
  111. package/dist/react/runtimes/RuntimeAdapterProvider.js.map +1 -1
  112. package/dist/react/runtimes/assistant-transport/commandQueue.d.ts +17 -0
  113. package/dist/react/runtimes/assistant-transport/commandQueue.d.ts.map +1 -0
  114. package/dist/react/runtimes/assistant-transport/commandQueue.js +55 -0
  115. package/dist/react/runtimes/assistant-transport/commandQueue.js.map +1 -0
  116. package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts +11 -0
  117. package/dist/react/runtimes/assistant-transport/replayBoundaryStream.d.ts.map +1 -0
  118. package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js +165 -0
  119. package/dist/react/runtimes/assistant-transport/replayBoundaryStream.js.map +1 -0
  120. package/dist/react/runtimes/assistant-transport/runManager.d.ts +15 -0
  121. package/dist/react/runtimes/assistant-transport/runManager.d.ts.map +1 -0
  122. package/dist/react/runtimes/assistant-transport/runManager.js +86 -0
  123. package/dist/react/runtimes/assistant-transport/runManager.js.map +1 -0
  124. package/dist/react/runtimes/assistant-transport/types.d.ts +130 -0
  125. package/dist/react/runtimes/assistant-transport/types.d.ts.map +1 -0
  126. package/dist/react/runtimes/assistant-transport/types.js +0 -0
  127. package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts +14 -0
  128. package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -0
  129. package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js +296 -0
  130. package/dist/react/runtimes/assistant-transport/useAssistantTransportRuntime.js.map +1 -0
  131. package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts +7 -0
  132. package/dist/react/runtimes/assistant-transport/useConvertedState.d.ts.map +1 -0
  133. package/dist/react/runtimes/assistant-transport/useConvertedState.js +25 -0
  134. package/dist/react/runtimes/assistant-transport/useConvertedState.js.map +1 -0
  135. package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts +7 -0
  136. package/dist/react/runtimes/assistant-transport/useLatestRef.d.ts.map +1 -0
  137. package/dist/react/runtimes/assistant-transport/useLatestRef.js +27 -0
  138. package/dist/react/runtimes/assistant-transport/useLatestRef.js.map +1 -0
  139. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
  140. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +39 -13
  141. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
  142. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts +2 -1
  143. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.d.ts.map +1 -1
  144. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js +3 -3
  145. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
  146. package/dist/react/runtimes/cloud/auiV0.d.ts +4 -0
  147. package/dist/react/runtimes/cloud/auiV0.d.ts.map +1 -1
  148. package/dist/react/runtimes/cloud/auiV0.js +7 -0
  149. package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
  150. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
  151. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +60 -17
  152. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
  153. package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts +16 -0
  154. package/dist/react/runtimes/cloud/useCloudThreadListRuntime.d.ts.map +1 -0
  155. package/dist/react/runtimes/cloud/useCloudThreadListRuntime.js +36 -0
  156. package/dist/react/runtimes/cloud/useCloudThreadListRuntime.js.map +1 -0
  157. package/dist/react/runtimes/external-message-converter.js +14 -14
  158. package/dist/react/runtimes/external-message-converter.js.map +1 -1
  159. package/dist/react/runtimes/useExternalStoreRuntime.d.ts.map +1 -1
  160. package/dist/react/runtimes/useExternalStoreRuntime.js +44 -28
  161. package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
  162. package/dist/react/runtimes/useExternalStoreSharedOptions.js.map +1 -1
  163. package/dist/react/runtimes/useLocalRuntime.js +1 -1
  164. package/dist/react/runtimes/useRuntimeAdapters.d.ts +9 -0
  165. package/dist/react/runtimes/useRuntimeAdapters.d.ts.map +1 -0
  166. package/dist/react/runtimes/useRuntimeAdapters.js +20 -0
  167. package/dist/react/runtimes/useRuntimeAdapters.js.map +1 -0
  168. package/dist/runtime/api/composer-runtime.d.ts +5 -0
  169. package/dist/runtime/api/composer-runtime.d.ts.map +1 -1
  170. package/dist/runtime/api/composer-runtime.js.map +1 -1
  171. package/dist/runtime/api/message-runtime.js +1 -1
  172. package/dist/runtime/api/thread-list-runtime.d.ts +1 -0
  173. package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
  174. package/dist/runtime/api/thread-list-runtime.js +4 -2
  175. package/dist/runtime/api/thread-list-runtime.js.map +1 -1
  176. package/dist/runtime/api/thread-runtime.d.ts +12 -2
  177. package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
  178. package/dist/runtime/api/thread-runtime.js +8 -2
  179. package/dist/runtime/api/thread-runtime.js.map +1 -1
  180. package/dist/runtime/base/base-composer-runtime-core.d.ts.map +1 -1
  181. package/dist/runtime/base/base-composer-runtime-core.js +8 -7
  182. package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
  183. package/dist/runtime/base/base-thread-runtime-core.d.ts +1 -0
  184. package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
  185. package/dist/runtime/base/base-thread-runtime-core.js +3 -3
  186. package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
  187. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts +0 -1
  188. package/dist/runtime/base/default-thread-composer-runtime-core.d.ts.map +1 -1
  189. package/dist/runtime/base/default-thread-composer-runtime-core.js +10 -4
  190. package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
  191. package/dist/runtime/interfaces/thread-runtime-core.d.ts +6 -0
  192. package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
  193. package/dist/runtime/internal.js +5 -5
  194. package/dist/runtime/queue/message-queue.d.ts.map +1 -1
  195. package/dist/runtime/queue/message-queue.js +2 -1
  196. package/dist/runtime/queue/message-queue.js.map +1 -1
  197. package/dist/runtime/utils/message-repository.d.ts.map +1 -1
  198. package/dist/runtime/utils/message-repository.js +27 -18
  199. package/dist/runtime/utils/message-repository.js.map +1 -1
  200. package/dist/runtime/utils/thread-runtime-lifecycle.d.ts +8 -0
  201. package/dist/runtime/utils/thread-runtime-lifecycle.d.ts.map +1 -0
  202. package/dist/runtime/utils/thread-runtime-lifecycle.js +11 -0
  203. package/dist/runtime/utils/thread-runtime-lifecycle.js.map +1 -0
  204. package/dist/runtimes/external-store/external-store-shared-options.js.map +1 -1
  205. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.d.ts.map +1 -1
  206. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js +4 -1
  207. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
  208. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +8 -0
  209. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
  210. package/dist/runtimes/external-store/external-store-thread-runtime-core.js +37 -13
  211. package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
  212. package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts +102 -0
  213. package/dist/runtimes/inert/InertThreadRuntimeCore.d.ts.map +1 -0
  214. package/dist/runtimes/inert/InertThreadRuntimeCore.js +156 -0
  215. package/dist/runtimes/inert/InertThreadRuntimeCore.js.map +1 -0
  216. package/dist/runtimes/internal.d.ts +1 -1
  217. package/dist/runtimes/local/local-thread-runtime-core.d.ts +3 -0
  218. package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
  219. package/dist/runtimes/local/local-thread-runtime-core.js +78 -19
  220. package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
  221. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +12 -59
  222. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
  223. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +10 -142
  224. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
  225. package/dist/runtimes/remote-thread-list/adapter-changed.d.ts +9 -0
  226. package/dist/runtimes/remote-thread-list/adapter-changed.d.ts.map +1 -0
  227. package/dist/runtimes/remote-thread-list/adapter-changed.js +13 -0
  228. package/dist/runtimes/remote-thread-list/adapter-changed.js.map +1 -0
  229. package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
  230. package/dist/runtimes/remote-thread-list/empty-thread-core.js +16 -152
  231. package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
  232. package/dist/runtimes/remote-thread-list/optimistic-state.d.ts +2 -0
  233. package/dist/runtimes/remote-thread-list/optimistic-state.d.ts.map +1 -1
  234. package/dist/runtimes/remote-thread-list/optimistic-state.js +11 -0
  235. package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
  236. package/dist/runtimes/remote-thread-list/types.d.ts +32 -1
  237. package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
  238. package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts +1 -12
  239. package/dist/runtimes/tool-invocations/ToolInvocationTracker.d.ts.map +1 -1
  240. package/dist/runtimes/tool-invocations/ToolInvocationTracker.js +67 -38
  241. package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
  242. package/dist/store/clients/external-thread.js +1 -1
  243. package/dist/store/clients/external-thread.js.map +1 -1
  244. package/dist/store/clients/suggestions.js +2 -2
  245. package/dist/store/clients/suggestions.js.map +1 -1
  246. package/dist/store/clients/thread-selection-events.d.ts +10 -0
  247. package/dist/store/clients/thread-selection-events.d.ts.map +1 -0
  248. package/dist/store/clients/thread-selection-events.js +40 -0
  249. package/dist/store/clients/thread-selection-events.js.map +1 -0
  250. package/dist/store/env.d.ts +5 -0
  251. package/dist/store/env.d.ts.map +1 -0
  252. package/dist/store/env.js +12 -0
  253. package/dist/store/env.js.map +1 -0
  254. package/dist/store/index.d.ts +5 -3
  255. package/dist/store/index.js +4 -2
  256. package/dist/store/internal.d.ts +4 -1
  257. package/dist/store/internal.js +4 -1
  258. package/dist/store/primitive-predicates.d.ts +19 -0
  259. package/dist/store/primitive-predicates.d.ts.map +1 -0
  260. package/dist/store/primitive-predicates.js +19 -0
  261. package/dist/store/primitive-predicates.js.map +1 -0
  262. package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
  263. package/dist/store/runtime-clients/attachment-runtime-client.js +18 -11
  264. package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
  265. package/dist/store/runtime-clients/handle-runtime-action.d.ts +5 -0
  266. package/dist/store/runtime-clients/handle-runtime-action.d.ts.map +1 -0
  267. package/dist/store/runtime-clients/handle-runtime-action.js +14 -0
  268. package/dist/store/runtime-clients/handle-runtime-action.js.map +1 -0
  269. package/dist/store/runtime-clients/handle-thread-list-action.d.ts +5 -0
  270. package/dist/store/runtime-clients/handle-thread-list-action.d.ts.map +1 -0
  271. package/dist/store/runtime-clients/handle-thread-list-action.js +7 -0
  272. package/dist/store/runtime-clients/handle-thread-list-action.js.map +1 -0
  273. package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
  274. package/dist/store/runtime-clients/thread-list-item-runtime-client.js +62 -29
  275. package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
  276. package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
  277. package/dist/store/runtime-clients/thread-list-runtime-client.js +5 -6
  278. package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
  279. package/dist/store/scopes/composer.d.ts +9 -4
  280. package/dist/store/scopes/composer.d.ts.map +1 -1
  281. package/dist/store/scopes/thread-list-item.d.ts +7 -6
  282. package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
  283. package/dist/store/scopes/thread.d.ts +8 -7
  284. package/dist/store/scopes/thread.d.ts.map +1 -1
  285. package/dist/store/scopes/threads.d.ts +17 -1
  286. package/dist/store/scopes/threads.d.ts.map +1 -1
  287. package/dist/subscribable/subscribable.d.ts +2 -1
  288. package/dist/subscribable/subscribable.d.ts.map +1 -1
  289. package/dist/subscribable/subscribable.js +23 -18
  290. package/dist/subscribable/subscribable.js.map +1 -1
  291. package/dist/types/message.d.ts +1 -1
  292. package/dist/types/message.js.map +1 -1
  293. package/dist/utils/composite-context-provider.d.ts +1 -0
  294. package/dist/utils/composite-context-provider.d.ts.map +1 -1
  295. package/dist/utils/composite-context-provider.js +25 -9
  296. package/dist/utils/composite-context-provider.js.map +1 -1
  297. package/dist/utils/notify-event-listeners.d.ts +2 -2
  298. package/dist/utils/notify-event-listeners.d.ts.map +1 -1
  299. package/dist/utils/notify-event-listeners.js +2 -2
  300. package/dist/utils/notify-event-listeners.js.map +1 -1
  301. package/dist/utils/silent-runtime-action.d.ts +6 -0
  302. package/dist/utils/silent-runtime-action.d.ts.map +1 -0
  303. package/dist/utils/silent-runtime-action.js +7 -0
  304. package/dist/utils/silent-runtime-action.js.map +1 -0
  305. package/package.json +8 -8
  306. package/src/adapters/speech.test.ts +118 -1
  307. package/src/adapters/speech.ts +21 -22
  308. package/src/adapters/thread-history.ts +2 -0
  309. package/src/adapters/voice.test.ts +134 -0
  310. package/src/adapters/voice.ts +35 -27
  311. package/src/index.ts +1 -0
  312. package/src/internal.ts +1 -0
  313. package/src/model-context/frame/host.test.ts +87 -5
  314. package/src/model-context/frame/host.ts +18 -4
  315. package/src/model-context/frame/provider.test.ts +347 -20
  316. package/src/model-context/frame/provider.ts +58 -2
  317. package/src/model-context/frame/types.ts +5 -0
  318. package/src/model-context/registry.test.ts +131 -0
  319. package/src/model-context/registry.ts +16 -6
  320. package/src/react/RuntimeAdapter.test.ts +2 -0
  321. package/src/react/RuntimeAdapter.ts +20 -8
  322. package/src/react/adapters/LocalStorageThreadListAdapter.tsx +34 -17
  323. package/src/react/client/AdaptedRemoteThread.ts +41 -0
  324. package/src/react/client/InMemoryThreadList.test.tsx +148 -0
  325. package/src/react/client/InMemoryThreadList.ts +290 -0
  326. package/src/react/client/Interactables.test.ts +326 -2
  327. package/src/react/client/Interactables.ts +227 -110
  328. package/src/react/client/RemoteThreadList.test.ts +1222 -0
  329. package/src/react/client/RemoteThreadList.ts +1136 -0
  330. package/src/react/client/Tools.ts +36 -29
  331. package/src/react/index.ts +13 -0
  332. package/src/react/interactables-legacy/Interactables.test.ts +317 -0
  333. package/src/react/interactables-legacy/Interactables.ts +204 -128
  334. package/src/react/primitive-hooks/useActionBarCopy.test.ts +15 -0
  335. package/src/react/primitive-hooks/useActionBarCopy.ts +15 -10
  336. package/src/react/primitive-hooks/useActionBarEdit.ts +2 -1
  337. package/src/react/primitive-hooks/useActionBarReload.ts +2 -6
  338. package/src/react/primitive-hooks/useBranchPickerNext.ts +2 -7
  339. package/src/react/primitive-hooks/useBranchPickerPrevious.ts +2 -7
  340. package/src/react/primitive-hooks/useComposerCancel.ts +2 -1
  341. package/src/react/primitive-hooks/useComposerSend.ts +2 -5
  342. package/src/react/primitive-hooks/useSuggestionTrigger.test.ts +11 -0
  343. package/src/react/primitive-hooks/useSuggestionTrigger.ts +4 -5
  344. package/src/react/primitive-hooks/useThreadIsEmpty.ts +3 -0
  345. package/src/react/primitive-hooks/useThreadIsRunning.ts +3 -0
  346. package/src/react/primitives/message/MessageParts.tsx +0 -1
  347. package/src/react/primitives/thread/ThreadMessages.tsx +2 -1
  348. package/src/react/runtimes/RemoteThreadListHookInstanceManager.retry.test.tsx +116 -0
  349. package/src/react/runtimes/RemoteThreadListHookInstanceManager.running.test.tsx +1 -1
  350. package/src/react/runtimes/RemoteThreadListHookInstanceManager.test.tsx +57 -6
  351. package/src/react/runtimes/RemoteThreadListHookInstanceManager.title.test.tsx +272 -0
  352. package/src/react/runtimes/RemoteThreadListHookInstanceManager.tsx +171 -124
  353. package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.republish.test.ts +87 -0
  354. package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +327 -83
  355. package/src/react/runtimes/RemoteThreadResource.test.ts +141 -0
  356. package/src/react/runtimes/RemoteThreadResource.ts +233 -0
  357. package/src/react/runtimes/RuntimeAdapterProvider.tsx +8 -20
  358. package/src/react/runtimes/assistant-transport/commandQueue.ts +68 -0
  359. package/src/react/runtimes/assistant-transport/replayBoundaryStream.test.ts +455 -0
  360. package/src/react/runtimes/assistant-transport/replayBoundaryStream.ts +172 -0
  361. package/src/react/runtimes/assistant-transport/runManager.ts +124 -0
  362. package/src/react/runtimes/assistant-transport/transport-delivery.test.tsx +79 -0
  363. package/src/react/runtimes/assistant-transport/transport-parentid.test.tsx +97 -0
  364. package/src/react/runtimes/assistant-transport/transport-scheduling.test.ts +414 -0
  365. package/src/react/runtimes/assistant-transport/types.ts +170 -0
  366. package/src/react/runtimes/assistant-transport/useAssistantTransport.spec.md +141 -0
  367. package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.test.tsx +683 -0
  368. package/src/react/runtimes/assistant-transport/useAssistantTransportRuntime.ts +483 -0
  369. package/src/react/runtimes/assistant-transport/useConvertedState.ts +20 -0
  370. package/src/react/runtimes/assistant-transport/useLatestRef.ts +9 -0
  371. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.test.tsx +131 -6
  372. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +61 -15
  373. package/src/react/runtimes/cloud/CloudFileAttachmentAdapter.ts +6 -4
  374. package/src/react/runtimes/cloud/auiV0.ts +17 -1
  375. package/src/react/runtimes/cloud/useCloudThreadListAdapter.test.tsx +98 -3
  376. package/src/react/runtimes/cloud/useCloudThreadListAdapter.tsx +104 -27
  377. package/src/react/runtimes/cloud/useCloudThreadListRuntime.test.tsx +56 -0
  378. package/src/react/runtimes/cloud/useCloudThreadListRuntime.ts +31 -0
  379. package/src/react/runtimes/external-message-converter.test.ts +143 -0
  380. package/src/react/runtimes/external-message-converter.ts +41 -41
  381. package/src/react/runtimes/remote-thread-hook-on-tap.test.ts +58 -0
  382. package/src/react/runtimes/useExternalStoreRuntime.lifecycle.test.tsx +83 -0
  383. package/src/react/runtimes/useExternalStoreRuntime.suggestions.test.tsx +13 -3
  384. package/src/react/runtimes/useExternalStoreRuntime.ts +7 -0
  385. package/src/react/runtimes/useExternalStoreSharedOptions.ts +3 -1
  386. package/src/react/runtimes/useLocalRuntime.test.tsx +134 -8
  387. package/src/react/runtimes/useRuntimeAdapters.test.tsx +62 -0
  388. package/src/react/runtimes/useRuntimeAdapters.ts +28 -0
  389. package/src/runtime/api/composer-runtime.ts +5 -0
  390. package/src/runtime/api/thread-list-runtime.ts +3 -1
  391. package/src/runtime/api/thread-runtime.ts +20 -2
  392. package/src/runtime/base/base-composer-runtime-core.ts +6 -5
  393. package/src/runtime/base/base-thread-runtime-core.test.ts +191 -0
  394. package/src/runtime/base/base-thread-runtime-core.ts +11 -2
  395. package/src/runtime/base/default-thread-composer-runtime-core.ts +12 -4
  396. package/src/runtime/interfaces/thread-runtime-core.ts +6 -0
  397. package/src/runtime/queue/message-queue.ts +2 -1
  398. package/src/runtime/utils/message-repository.ts +26 -18
  399. package/src/runtime/utils/thread-runtime-lifecycle.ts +18 -0
  400. package/src/runtimes/external-store/external-store-shared-options.ts +3 -1
  401. package/src/runtimes/external-store/external-store-thread-list-runtime-core.ts +4 -1
  402. package/src/runtimes/external-store/external-store-thread-runtime-core.ts +103 -34
  403. package/src/runtimes/inert/InertThreadRuntimeCore.test.ts +253 -0
  404. package/src/runtimes/inert/InertThreadRuntimeCore.ts +232 -0
  405. package/src/runtimes/local/local-thread-runtime-core.test.ts +692 -4
  406. package/src/runtimes/local/local-thread-runtime-core.ts +117 -22
  407. package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +17 -205
  408. package/src/runtimes/remote-thread-list/adapter-changed.ts +10 -0
  409. package/src/runtimes/remote-thread-list/empty-thread-core.ts +28 -217
  410. package/src/runtimes/remote-thread-list/optimistic-state.test.ts +18 -0
  411. package/src/runtimes/remote-thread-list/optimistic-state.ts +13 -0
  412. package/src/runtimes/remote-thread-list/types.ts +34 -0
  413. package/src/runtimes/tool-invocations/EDGE_CASES.md +17 -6
  414. package/src/runtimes/tool-invocations/ToolInvocationTracker.test.ts +243 -0
  415. package/src/runtimes/tool-invocations/ToolInvocationTracker.ts +127 -61
  416. package/src/store/clients/external-thread.ts +1 -1
  417. package/src/store/clients/model-context-client.test.ts +16 -8
  418. package/src/store/clients/suggestions.ts +2 -2
  419. package/src/store/clients/thread-selection-events.ts +21 -0
  420. package/src/store/env.ts +11 -0
  421. package/src/store/index.ts +14 -1
  422. package/src/store/internal.ts +13 -0
  423. package/src/store/primitive-predicates.test.ts +184 -0
  424. package/src/store/primitive-predicates.ts +43 -0
  425. package/src/store/runtime-clients/attachment-runtime-client.test.ts +41 -0
  426. package/src/store/runtime-clients/attachment-runtime-client.ts +2 -1
  427. package/src/store/runtime-clients/handle-runtime-action.test.ts +40 -0
  428. package/src/store/runtime-clients/handle-runtime-action.ts +14 -0
  429. package/src/store/runtime-clients/handle-thread-list-action.test.ts +69 -0
  430. package/src/store/runtime-clients/handle-thread-list-action.ts +6 -0
  431. package/src/store/runtime-clients/thread-list-item-runtime-client.ts +15 -7
  432. package/src/store/runtime-clients/thread-list-runtime-client.ts +9 -6
  433. package/src/store/scopes/composer.ts +9 -4
  434. package/src/store/scopes/thread-list-item.ts +7 -6
  435. package/src/store/scopes/thread.ts +8 -7
  436. package/src/store/scopes/threads.ts +14 -0
  437. package/src/subscribable/subscribable.test.ts +77 -1
  438. package/src/subscribable/subscribable.ts +38 -23
  439. package/src/tests/MessageRepository.test.ts +48 -0
  440. package/src/tests/RemoteThreadListThreadListRuntimeCore-errors.test.ts +2 -2
  441. package/src/tests/RemoteThreadListThreadListRuntimeCore-loadMore.test.ts +8 -6
  442. package/src/tests/RemoteThreadListThreadListRuntimeCore-switchToThread-unarchive.test.ts +25 -0
  443. package/src/tests/auiV0Encode.test.ts +66 -0
  444. package/src/tests/base-composer-runtime-core-send.test.ts +30 -0
  445. package/src/tests/base-composer-runtime-core.test.ts +28 -0
  446. package/src/tests/composer-can-cancel.test.ts +101 -0
  447. package/src/tests/empty-thread-core.test.ts +6 -0
  448. package/src/tests/external-store-thread-list-runtime-core.test.ts +101 -0
  449. package/src/tests/external-store-thread-runtime-core-adapter.test.ts +211 -1
  450. package/src/tests/external-store-thread-runtime-core.test.ts +124 -0
  451. package/src/tests/external-thread-isEmpty.test.tsx +100 -0
  452. package/src/tests/interactables-toolui-migration.test.tsx +66 -0
  453. package/src/tests/message-queue.test.ts +28 -0
  454. package/src/tests/remote-thread-list-adapter-switch.test.ts +383 -0
  455. package/src/tests/session-reset-notification.test.ts +145 -0
  456. package/src/tests/thread-switch-events.test.tsx +99 -1
  457. package/src/tests/tools-scope-migration.test.tsx +58 -0
  458. package/src/tests/useRemoteThreadListRuntime-controlled.test.tsx +67 -0
  459. package/src/types/message.ts +1 -1
  460. package/src/utils/composite-context-provider.test.ts +139 -0
  461. package/src/utils/composite-context-provider.ts +26 -8
  462. package/src/utils/notify-event-listeners.ts +10 -5
  463. package/src/utils/silent-runtime-action.ts +6 -0
@@ -1 +1 @@
1
- {"version":3,"file":"MessageParts.js","names":["ComponentType","FC","ReactNode","memo","PropsWithChildren","useMemo","RenderChildrenWithAccessor","useAuiState","useAui","PartState","PartByIndexProvider","TextMessagePartProvider","ChainOfThoughtByIndicesProvider","getMessageQuote","Unstable_AudioMessagePartComponent","DataMessagePartComponent","DataMessagePartProps","EmptyMessagePartComponent","TextMessagePartComponent","ImageMessagePartComponent","SourceMessagePartComponent","ToolCallMessagePartComponent","ToolCallMessagePartProps","FileMessagePartComponent","ReasoningMessagePartComponent","ReasoningGroupComponent","QuoteMessagePartComponent","GenerativeUIComponentRegistry","GenerativeUIRender","isMcpAppUri","MessagePartStatus","GenerativeUIMessagePart","DataRenderersState","ToolsState","useShallow","MessagePartRange","type","index","startIndex","endIndex","idKey","createGroupState","groupType","T","start","startGroup","endGroup","ranges","push","finalize","groupMessageParts","messageTypes","useChainOfThought","partIds","chainOfThoughtGroup","i","length","toolGroup","reasoningGroup","claimed","Set","range","id","undefined","has","add","useMessagePartsGroups","$","_c","_temp2","_temp4","t0","bb0","t1","Symbol","for","t2","MessagePrimitiveParts","DataConfig","by_name","Record","Fallback","BaseComponents","Empty","Text","Source","Image","File","Unstable_Audio","data","Quote","generativeUI","components","component","props","ToolsConfig","Override","StandardComponents","Reasoning","tools","ToolGroup","ReasoningGroup","ChainOfThought","ChainOfThoughtComponents","Props","unstable_showEmptyOnNonTextEnd","children","value","part","EnrichedPartState","ToolUIDisplay","toolName","s","toolUIs","render","Render","getDataRenderer","dataRenderers","name","inlineFallback","named","renderers","fallbacks","DataUIDisplay","defaultComponents","MessagePartComponentProps","MessagePartComponent","t3","t4","t5","t6","t7","t8","t9","Audio","t10","aui","_temp5","addResult","addToolResult","resume","resumeToolCall","respondToApproval","respondToToolApproval","t11","Tool","status","Error","Data","process","env","NODE_ENV","console","warn","t12","spec","MessagePrimitivePartByIndex","prev","next","displayName","EmptyPartFallback","Component","COMPLETE_STATUS","Object","freeze","RUNNING_STATUS","EmptyPartsImpl","_temp6","EmptyParts","ConditionalEmptyImpl","enabled","message","parts","lastPart","shouldShowEmpty","ConditionalEmpty","QuoteRendererImpl","quoteInfo","messageId","text","QuoteRenderer","resolveToolRender","toolsState","Extract","mcp","app","resourceUri","mcpApp","RegisteredToolUI","_temp7","_temp8","RegisteredDataRendererUI","_temp9","_temp0","DefaultPartFallback","partType","_temp1","toolUI","dataRendererUI","Exclude","EMPTY_RUNNING_TEXT_PART","MessagePartChildrenProps","MessagePartChildrenInner","Pick","client","getState","getItem","state","hasUI","partMethods","MessagePartChildren","MessagePrimitivePartsInner","contentLength","_temp10","isRunning","_temp11","isEmptyRunning","_","Array","from","MessagePrimitivePartsCompat","_temp12","messageRanges","toolLeafKey","partIndex","map","ChainOfThoughtComponent","ToolGroupComponent","partIndex_0","__0","i_0","partIndex_1","partsElements","_temp","c","_temp3","c_0","toolCallId","s_0"],"sources":["../../../../src/react/primitives/message/MessageParts.tsx"],"sourcesContent":["import {\n type ComponentType,\n type FC,\n type ReactNode,\n memo,\n type PropsWithChildren,\n useMemo,\n} from \"react\";\nimport {\n RenderChildrenWithAccessor,\n useAuiState,\n useAui,\n} from \"@assistant-ui/store\";\nimport type { PartState } from \"../../../store/scopes/part\";\nimport { PartByIndexProvider } from \"../../providers/PartByIndexProvider\";\nimport { TextMessagePartProvider } from \"../../providers/TextMessagePartProvider\";\nimport { ChainOfThoughtByIndicesProvider } from \"../../providers/ChainOfThoughtByIndicesProvider\";\nimport { getMessageQuote } from \"../../utils/getMessageQuote\";\nimport type {\n Unstable_AudioMessagePartComponent,\n DataMessagePartComponent,\n DataMessagePartProps,\n EmptyMessagePartComponent,\n TextMessagePartComponent,\n ImageMessagePartComponent,\n SourceMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n FileMessagePartComponent,\n ReasoningMessagePartComponent,\n ReasoningGroupComponent,\n QuoteMessagePartComponent,\n GenerativeUIComponentRegistry,\n} from \"../../types/MessagePartComponentTypes\";\nimport { GenerativeUIRender } from \"../generativeUI/GenerativeUI\";\nimport {\n isMcpAppUri,\n type MessagePartStatus,\n type GenerativeUIMessagePart,\n} from \"../../../types/message\";\nimport type { DataRenderersState } from \"../../types/scopes/dataRenderers\";\nimport type { ToolsState } from \"../../types/scopes/tools\";\nimport { useShallow } from \"zustand/shallow\";\n\ntype MessagePartRange =\n | { type: \"single\"; index: number }\n | {\n type: \"toolGroup\";\n startIndex: number;\n endIndex: number;\n idKey?: string | undefined;\n }\n | {\n type: \"reasoningGroup\";\n startIndex: number;\n endIndex: number;\n idKey?: string | undefined;\n }\n | {\n type: \"chainOfThoughtGroup\";\n startIndex: number;\n endIndex: number;\n idKey?: string | undefined;\n };\n\n/**\n * Creates a group state manager for a specific part type.\n * Returns functions to start, end, and finalize groups.\n */\nconst createGroupState = <\n T extends \"toolGroup\" | \"reasoningGroup\" | \"chainOfThoughtGroup\",\n>(\n groupType: T,\n) => {\n let start = -1;\n\n return {\n startGroup: (index: number) => {\n if (start === -1) {\n start = index;\n }\n },\n endGroup: (endIndex: number, ranges: MessagePartRange[]) => {\n if (start !== -1) {\n ranges.push({\n type: groupType,\n startIndex: start,\n endIndex,\n } as MessagePartRange);\n start = -1;\n }\n },\n finalize: (endIndex: number, ranges: MessagePartRange[]) => {\n if (start !== -1) {\n ranges.push({\n type: groupType,\n startIndex: start,\n endIndex,\n } as MessagePartRange);\n }\n },\n };\n};\n\n/**\n * Groups consecutive tool-call and reasoning message parts into ranges.\n * Always groups tool calls and reasoning parts, even if there's only one.\n * When useChainOfThought is true, groups tool-call and reasoning parts together.\n * `partIds[i]` optionally carries a stable identity for part `i`; group\n * ranges derive an `idKey` from their first part's id (first claim wins).\n */\nexport const groupMessageParts = (\n messageTypes: readonly string[],\n useChainOfThought: boolean,\n partIds?: readonly (string | undefined)[],\n): MessagePartRange[] => {\n const ranges: MessagePartRange[] = [];\n\n if (useChainOfThought) {\n const chainOfThoughtGroup = createGroupState(\"chainOfThoughtGroup\");\n\n for (let i = 0; i < messageTypes.length; i++) {\n const type = messageTypes[i];\n\n if (type === \"tool-call\" || type === \"reasoning\") {\n chainOfThoughtGroup.startGroup(i);\n } else {\n chainOfThoughtGroup.endGroup(i - 1, ranges);\n ranges.push({ type: \"single\", index: i });\n }\n }\n\n chainOfThoughtGroup.finalize(messageTypes.length - 1, ranges);\n } else {\n const toolGroup = createGroupState(\"toolGroup\");\n const reasoningGroup = createGroupState(\"reasoningGroup\");\n\n for (let i = 0; i < messageTypes.length; i++) {\n const type = messageTypes[i];\n\n if (type === \"tool-call\") {\n reasoningGroup.endGroup(i - 1, ranges);\n toolGroup.startGroup(i);\n } else if (type === \"reasoning\") {\n toolGroup.endGroup(i - 1, ranges);\n reasoningGroup.startGroup(i);\n } else {\n toolGroup.endGroup(i - 1, ranges);\n reasoningGroup.endGroup(i - 1, ranges);\n ranges.push({ type: \"single\", index: i });\n }\n }\n\n toolGroup.finalize(messageTypes.length - 1, ranges);\n reasoningGroup.finalize(messageTypes.length - 1, ranges);\n }\n\n if (partIds) {\n const claimed = new Set<string>();\n for (const range of ranges) {\n if (range.type === \"single\") continue;\n const id = partIds[range.startIndex];\n if (id !== undefined && !claimed.has(id)) {\n claimed.add(id);\n range.idKey = `id:${id}`;\n }\n }\n }\n\n return ranges;\n};\n\nconst useMessagePartsGroups = (\n useChainOfThought: boolean,\n): { ranges: MessagePartRange[]; partIds: (string | undefined)[] } => {\n const messageTypes = useAuiState(\n useShallow((s) => s.message.parts.map((c: any) => c.type)),\n );\n const partIds = useAuiState(\n useShallow((s) =>\n s.message.parts.map((c: any) =>\n c.type === \"tool-call\" ? c.toolCallId : undefined,\n ),\n ),\n );\n\n return useMemo(() => {\n if (messageTypes.length === 0) {\n return { ranges: [], partIds };\n }\n return {\n ranges: groupMessageParts(messageTypes, useChainOfThought, partIds),\n partIds,\n };\n }, [messageTypes, partIds, useChainOfThought]);\n};\n\nexport namespace MessagePrimitiveParts {\n type DataConfig = {\n /** Map data event names to specific components */\n by_name?: Record<string, DataMessagePartComponent | undefined> | undefined;\n /** Fallback component for unmatched data events */\n Fallback?: DataMessagePartComponent | undefined;\n };\n\n type BaseComponents = {\n /** Component for rendering empty messages */\n Empty?: EmptyMessagePartComponent | undefined;\n /** Component for rendering text content */\n Text?: TextMessagePartComponent | undefined;\n /** Component for rendering source content */\n Source?: SourceMessagePartComponent | undefined;\n /** Component for rendering image content */\n Image?: ImageMessagePartComponent | undefined;\n /** Component for rendering file content */\n File?: FileMessagePartComponent | undefined;\n /**\n * Component for rendering audio content.\n *\n * @deprecated Render audio through the `File` slot instead, branching on an\n * `audio/*` mime type.\n */\n Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;\n /** Configuration for data part rendering */\n data?: DataConfig | undefined;\n /** Component for rendering a quoted message reference (from metadata, not parts) */\n Quote?: QuoteMessagePartComponent | undefined;\n /**\n * Configuration for generative-ui part rendering.\n *\n * `components` is the consumer-provided allowlist of React components\n * the agent's JSON spec is permitted to render. Any name not present in\n * the registry is rejected with a typed `GenerativeUIRenderError` —\n * this is the security boundary in the same-realm rendering path.\n */\n generativeUI?:\n | {\n /** The component allowlist (the security boundary). */\n components: GenerativeUIComponentRegistry;\n /** Optional fallback for unknown component names. */\n Fallback?:\n | ComponentType<{ component: string; props?: unknown }>\n | undefined;\n }\n | undefined;\n };\n\n type ToolsConfig =\n | {\n /** Map of tool names to their specific components */\n by_name?:\n | Record<string, ToolCallMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unregistered tools */\n Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;\n }\n | {\n /** Override component that handles all tool calls */\n Override: ComponentType<ToolCallMessagePartProps>;\n };\n\n /**\n * Standard component configuration for rendering reasoning and tool-call parts\n * individually (with optional grouping).\n *\n * Cannot be combined with `ChainOfThought`.\n */\n type StandardComponents = BaseComponents & {\n /** Component for rendering reasoning content (typically hidden) */\n Reasoning?: ReasoningMessagePartComponent | undefined;\n /** Configuration for tool call rendering */\n tools?: ToolsConfig | undefined;\n\n /**\n * Component for rendering grouped consecutive tool calls.\n *\n * @param startIndex - Index of the first tool call in the group\n * @param endIndex - Index of the last tool call in the group\n * @param children - Rendered tool call components to display within the group\n *\n * @deprecated Use `<MessagePrimitive.GroupedParts>` with a custom `groupBy` instead.\n */\n ToolGroup?: ComponentType<\n PropsWithChildren<{ startIndex: number; endIndex: number }>\n >;\n\n /**\n * Component for rendering grouped reasoning parts.\n *\n * @param startIndex - Index of the first reasoning part in the group\n * @param endIndex - Index of the last reasoning part in the group\n * @param children - Rendered reasoning part components\n *\n * @deprecated Use `<MessagePrimitive.GroupedParts>` with a custom `groupBy` instead.\n */\n ReasoningGroup?: ReasoningGroupComponent;\n\n ChainOfThought?: never;\n };\n\n /**\n * Chain of thought component configuration.\n *\n * When `ChainOfThought` is set, it takes control of rendering ALL reasoning and\n * tool-call parts in the message. The `Reasoning`, `tools`, `ReasoningGroup`, and\n * `ToolGroup` components cannot be used alongside it.\n */\n type ChainOfThoughtComponents = BaseComponents & {\n /**\n * @deprecated Use `<MessagePrimitive.GroupedParts>` with a `groupBy`\n * that returns `[\"group-thought\", ...]` for reasoning and tool-call\n * parts. See `@assistant-ui/ui` for a worked example.\n */\n ChainOfThought: ComponentType;\n\n Reasoning?: never;\n tools?: never;\n ToolGroup?: never;\n ReasoningGroup?: never;\n };\n\n export type Props =\n | {\n /**\n * Component configuration for rendering different types of message content.\n *\n * Use either `Reasoning`/`tools`/`ToolGroup`/`ReasoningGroup` for standard rendering,\n * or `ChainOfThought` to group all reasoning and tool-call parts into a single\n * collapsible component. These two modes are mutually exclusive.\n */\n components?: StandardComponents | ChainOfThoughtComponents | undefined;\n /**\n * When enabled, shows the Empty component if the last part in the message\n * is anything other than Text or Reasoning.\n *\n * @experimental This API is experimental and may change in future versions.\n * @default true\n */\n unstable_showEmptyOnNonTextEnd?: boolean | undefined;\n children?: never;\n }\n | {\n /** Render function called for each part. Receives the enriched part state. */\n children: (value: { part: EnrichedPartState }) => ReactNode;\n components?: never;\n unstable_showEmptyOnNonTextEnd?: never;\n };\n}\n\nconst ToolUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: ToolCallMessagePartComponent | undefined;\n} & ToolCallMessagePartProps) => {\n const Render = useAuiState(\n (s) => s.tools.toolUIs[props.toolName]?.[0]?.render ?? Fallback,\n );\n if (!Render) return null;\n return <Render {...props} />;\n};\n\nconst getDataRenderer = (\n dataRenderers: DataRenderersState,\n name: string,\n inlineFallback: DataMessagePartComponent | undefined,\n): DataMessagePartComponent | undefined => {\n const named = dataRenderers.renderers[name]?.[0];\n if (named) return named;\n return dataRenderers.fallbacks[0] ?? inlineFallback;\n};\n\nconst DataUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: DataMessagePartComponent | undefined;\n} & DataMessagePartProps) => {\n const Render = useAuiState((s) =>\n getDataRenderer(s.dataRenderers, props.name, Fallback),\n );\n if (!Render) return null;\n return <Render {...props} />;\n};\n\n/**\n * Platform-agnostic no-op default components.\n * Each platform (web, RN) wraps MessagePrimitiveParts with its own defaults.\n */\nexport const defaultComponents = {\n Text: () => null,\n Reasoning: () => null,\n Source: () => null,\n Image: () => null,\n File: () => null,\n Unstable_Audio: () => null,\n ToolGroup: ({ children }: PropsWithChildren) => children,\n ReasoningGroup: ({ children }: PropsWithChildren) => children,\n} satisfies MessagePrimitiveParts.Props[\"components\"];\n\ntype MessagePartComponentProps = {\n components: MessagePrimitiveParts.Props[\"components\"];\n};\n\nexport const MessagePartComponent: FC<MessagePartComponentProps> = ({\n components: {\n Text = defaultComponents.Text,\n Reasoning = defaultComponents.Reasoning,\n Image = defaultComponents.Image,\n Source = defaultComponents.Source,\n File = defaultComponents.File,\n Unstable_Audio: Audio = defaultComponents.Unstable_Audio,\n tools = {},\n data,\n generativeUI,\n } = {},\n}) => {\n const aui = useAui();\n const part = useAuiState((s) => s.part);\n\n const type = part.type;\n if (type === \"tool-call\") {\n const addResult = aui.part.addToolResult;\n const resume = aui.part.resumeToolCall;\n const respondToApproval = aui.part.respondToToolApproval;\n if (\"Override\" in tools)\n return (\n <tools.Override\n {...part}\n addResult={addResult}\n resume={resume}\n respondToApproval={respondToApproval}\n />\n );\n const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;\n return (\n <ToolUIDisplay\n {...part}\n Fallback={Tool}\n addResult={addResult}\n resume={resume}\n respondToApproval={respondToApproval}\n />\n );\n }\n\n if (part.status?.type === \"requires-action\")\n throw new Error(\"Encountered unexpected requires-action status\");\n\n switch (type) {\n case \"text\":\n return <Text {...part} />;\n\n case \"reasoning\":\n return <Reasoning {...part} />;\n\n case \"source\":\n return <Source {...part} />;\n\n case \"image\":\n return <Image {...part} />;\n\n case \"file\":\n return <File {...part} />;\n\n case \"audio\":\n return <Audio {...part} />;\n\n case \"data\": {\n const Data = data?.by_name?.[part.name] ?? data?.Fallback;\n return <DataUIDisplay {...part} Fallback={Data} />;\n }\n\n case \"generative-ui\": {\n if (!generativeUI?.components) {\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\"\n ) {\n console.warn(\n \"MessagePrimitive.Parts received a generative-ui part but no \" +\n \"`components.generativeUI.components` allowlist was provided. \" +\n \"Pass an allowlist or render with <MessagePrimitive.GenerativeUI />.\",\n );\n }\n return null;\n }\n return (\n <GenerativeUIRender\n spec={(part as GenerativeUIMessagePart).spec}\n components={generativeUI.components}\n Fallback={generativeUI.Fallback}\n />\n );\n }\n\n default:\n console.warn(`Unknown message part type: ${type}`);\n return null;\n }\n};\n\nexport namespace MessagePrimitivePartByIndex {\n export type Props = {\n index: number;\n components: MessagePrimitiveParts.Props[\"components\"];\n };\n}\n\n/**\n * Renders a single message part at the specified index.\n */\nexport const MessagePrimitivePartByIndex: FC<MessagePrimitivePartByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <PartByIndexProvider index={index}>\n <MessagePartComponent components={components} />\n </PartByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n prev.components?.Text === next.components?.Text &&\n prev.components?.Reasoning === next.components?.Reasoning &&\n prev.components?.Source === next.components?.Source &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.File === next.components?.File &&\n prev.components?.Unstable_Audio === next.components?.Unstable_Audio &&\n prev.components?.tools === next.components?.tools &&\n prev.components?.data === next.components?.data &&\n prev.components?.generativeUI === next.components?.generativeUI &&\n prev.components?.ToolGroup === next.components?.ToolGroup &&\n prev.components?.ReasoningGroup === next.components?.ReasoningGroup,\n );\n\nMessagePrimitivePartByIndex.displayName = \"MessagePrimitive.PartByIndex\";\n\nconst EmptyPartFallback: FC<{\n status: MessagePartStatus;\n component: TextMessagePartComponent;\n}> = ({ status, component: Component }) => {\n return (\n <TextMessagePartProvider text=\"\" isRunning={status.type === \"running\"}>\n <Component type=\"text\" text=\"\" status={status} />\n </TextMessagePartProvider>\n );\n};\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nconst RUNNING_STATUS: MessagePartStatus = Object.freeze({\n type: \"running\",\n});\n\nconst EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {\n const status = useAuiState(\n (s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,\n );\n\n if (components?.Empty) return <components.Empty status={status} />;\n\n if (status.type !== \"running\") return null;\n\n return (\n <EmptyPartFallback\n status={status}\n component={components?.Text ?? defaultComponents.Text}\n />\n );\n};\n\nconst EmptyParts = memo(\n EmptyPartsImpl,\n (prev, next) =>\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\nconst ConditionalEmptyImpl: FC<{\n components: MessagePrimitiveParts.Props[\"components\"];\n enabled: boolean;\n}> = ({ components, enabled }) => {\n const shouldShowEmpty = useAuiState((s) => {\n if (!enabled) return false;\n if (s.message.parts.length === 0) return false;\n\n const lastPart = s.message.parts[s.message.parts.length - 1];\n return lastPart?.type !== \"text\" && lastPart?.type !== \"reasoning\";\n });\n\n if (!shouldShowEmpty) return null;\n return <EmptyParts components={components} />;\n};\n\nconst ConditionalEmpty = memo(\n ConditionalEmptyImpl,\n (prev, next) =>\n prev.enabled === next.enabled &&\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\nconst QuoteRendererImpl: FC<{ Quote: QuoteMessagePartComponent }> = ({\n Quote,\n}) => {\n const quoteInfo = useAuiState(getMessageQuote);\n if (!quoteInfo) return null;\n return <Quote text={quoteInfo.text} messageId={quoteInfo.messageId} />;\n};\n\nconst QuoteRenderer = memo(QuoteRendererImpl);\n\nfunction resolveToolRender(\n toolsState: ToolsState,\n part: Extract<PartState, { type: \"tool-call\" }>,\n): ToolCallMessagePartComponent | null {\n const named = toolsState.toolUIs[part.toolName]?.[0]?.render ?? null;\n if (named) return named;\n if (isMcpAppUri(part.mcp?.app?.resourceUri) && toolsState.mcpApp) {\n return toolsState.mcpApp.render;\n }\n return null;\n}\n\n/**\n * Stable propless component that renders the registered tool UI for the\n * current part context. Reads tool registry and part state from context.\n */\nconst RegisteredToolUI: FC = () => {\n const aui = useAui();\n const part = useAuiState((s) => s.part);\n const Render = useAuiState((s) =>\n s.part.type === \"tool-call\" ? resolveToolRender(s.tools, s.part) : null,\n );\n\n if (!Render || part.type !== \"tool-call\") return null;\n\n return (\n <Render\n {...part}\n addResult={aui.part.addToolResult}\n resume={aui.part.resumeToolCall}\n respondToApproval={aui.part.respondToToolApproval}\n />\n );\n};\n\n/**\n * Stable propless component that renders the registered data renderer UI\n * for the current part context.\n */\nconst RegisteredDataRendererUI: FC = () => {\n const part = useAuiState((s) => s.part);\n const Render = useAuiState((s) =>\n s.part.type === \"data\"\n ? (getDataRenderer(s.dataRenderers, s.part.name, undefined) ?? null)\n : null,\n );\n\n if (!Render || part.type !== \"data\") return null;\n\n return <Render {...(part as DataMessagePartProps)} />;\n};\n\n/**\n * Fallback component rendered when the children render function returns null.\n * Renders registered tool/data UIs via context.\n * For all other part types, renders nothing.\n *\n * This allows users to write:\n * {({ part }) => {\n * if (part.type === \"text\") return <MyText />;\n * return null; // tool UIs and data UIs still render via registry\n * }}\n *\n * To explicitly render nothing (suppressing registered UIs), return <></>.\n */\nconst DefaultPartFallback: FC = () => {\n const partType = useAuiState((s) => s.part.type);\n\n if (partType === \"tool-call\") return <RegisteredToolUI />;\n if (partType === \"data\") return <RegisteredDataRendererUI />;\n\n return null;\n};\n\nexport type { PartState };\n\n/**\n * Enriched part state passed to children render functions.\n *\n * For tool-call parts, adds `toolUI`, `addResult`, and `resume`.\n * For data parts, adds `dataRendererUI`.\n *\n * The render function is also invoked once with a synthetic empty text part\n * (`{ type: \"text\", text: \"\", status: { type: \"running\" } }`) when the\n * assistant message has no parts yet but is in the running state, so a\n * loading indicator can render. Differentiate this from a real empty text\n * via `part.status?.type === \"running\" && part.text === \"\"`.\n */\nexport type EnrichedPartState =\n | (Extract<PartState, { type: \"tool-call\" }> & {\n /** The registered tool UI element, or null if none registered. */\n readonly toolUI: ReactNode;\n /** Add a tool result to this tool call. */\n addResult: ToolCallMessagePartProps[\"addResult\"];\n /** Resume a tool call waiting for human input. */\n resume: ToolCallMessagePartProps[\"resume\"];\n /** Respond to a server-side tool approval gate. */\n respondToApproval: ToolCallMessagePartProps[\"respondToApproval\"];\n })\n | (Extract<PartState, { type: \"data\" }> & {\n /** The registered data renderer UI element, or null if none registered. */\n readonly dataRendererUI: ReactNode;\n })\n | Exclude<PartState, { type: \"tool-call\" } | { type: \"data\" }>;\n\nconst EMPTY_RUNNING_TEXT_PART: Extract<EnrichedPartState, { type: \"text\" }> =\n Object.freeze({\n type: \"text\",\n text: \"\",\n status: RUNNING_STATUS,\n });\n\n/**\n * @internal\n * Renders a single part by index, calling `children` with the\n * {@link EnrichedPartState} (tool/data UI enrichments + addResult/resume\n * for tool calls). Shared between `<MessagePrimitive.Parts>` and\n * `<MessagePrimitive.GroupedParts>`. Returns whatever `children`\n * returns — callers decide how to handle a `null` return.\n */\ntype MessagePartChildrenProps = {\n index: number;\n children: (value: { part: EnrichedPartState }) => ReactNode;\n};\n\nconst MessagePartChildrenInner: FC<\n Pick<MessagePartChildrenProps, \"children\">\n> = ({ children }) => {\n const aui = useAui();\n // Subscribed (not snapshotted like `tools`) so fallbacks registered\n // after the first render trigger a re-render and `hasUI` re-evaluates.\n const dataRenderers = useAuiState((s) => s.dataRenderers);\n\n return (\n <RenderChildrenWithAccessor\n getItemState={(client) => client.part.getState()}\n >\n {(getItem) =>\n children({\n get part() {\n const state = getItem();\n if (state.type === \"tool-call\") {\n const toolsState = aui.tools.getState();\n const hasUI = resolveToolRender(toolsState, state) !== null;\n const partMethods = aui.part;\n return {\n ...state,\n toolUI: hasUI ? <RegisteredToolUI /> : null,\n addResult: partMethods.addToolResult,\n resume: partMethods.resumeToolCall,\n respondToApproval: partMethods.respondToToolApproval,\n };\n }\n if (state.type === \"data\") {\n const hasUI =\n getDataRenderer(dataRenderers, state.name, undefined) !==\n undefined;\n return {\n ...state,\n dataRendererUI: hasUI ? <RegisteredDataRendererUI /> : null,\n };\n }\n return state;\n },\n })\n }\n </RenderChildrenWithAccessor>\n );\n};\n\nexport const MessagePartChildren: FC<MessagePartChildrenProps> = ({\n index,\n children,\n}) => {\n return (\n <PartByIndexProvider index={index}>\n <MessagePartChildrenInner>{children}</MessagePartChildrenInner>\n </PartByIndexProvider>\n );\n};\n\nconst MessagePrimitivePartsInner: FC<{\n children: (value: { part: EnrichedPartState }) => ReactNode;\n}> = ({ children }) => {\n const contentLength = useAuiState((s) => s.message.parts.length);\n const isRunning = useAuiState(\n (s) => (s.message.status?.type ?? \"complete\") === \"running\",\n );\n const isEmptyRunning = contentLength === 0 && isRunning;\n\n if (contentLength === 0) {\n if (!isEmptyRunning) return null;\n return (\n <TextMessagePartProvider text=\"\" isRunning>\n {children({ part: EMPTY_RUNNING_TEXT_PART })}\n </TextMessagePartProvider>\n );\n }\n\n return (\n <>\n {Array.from({ length: contentLength }, (_, index) => (\n <MessagePartChildren key={index} index={index}>\n {(value) => children(value) ?? <DefaultPartFallback />}\n </MessagePartChildren>\n ))}\n </>\n );\n};\n\n/**\n * Renders the parts of a message with support for multiple content types.\n *\n * This is the platform-agnostic base. Each platform wraps this with its own\n * default components (web uses `<p>`, `<span>`; RN would use `<Text>`, etc.).\n */\nexport const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = ({\n components,\n unstable_showEmptyOnNonTextEnd = true,\n children,\n}) => {\n if (children) {\n return <MessagePrimitivePartsInner>{children}</MessagePrimitivePartsInner>;\n }\n return (\n <MessagePrimitivePartsCompat\n components={components}\n unstable_showEmptyOnNonTextEnd={unstable_showEmptyOnNonTextEnd}\n />\n );\n};\n\nMessagePrimitiveParts.displayName = \"MessagePrimitive.Parts\";\n\nconst MessagePrimitivePartsCompat: FC<{\n components: MessagePrimitiveParts.Props[\"components\"];\n unstable_showEmptyOnNonTextEnd: boolean;\n}> = ({ components, unstable_showEmptyOnNonTextEnd }) => {\n const contentLength = useAuiState((s) => s.message.parts.length);\n const useChainOfThought = !!components?.ChainOfThought;\n const { ranges: messageRanges, partIds } =\n useMessagePartsGroups(useChainOfThought);\n\n const partsElements = useMemo(() => {\n if (contentLength === 0) {\n return <EmptyParts components={components} />;\n }\n\n const claimed = new Set<string>();\n const toolLeafKey = (partIndex: number) => {\n const id = partIds[partIndex];\n if (id !== undefined && !claimed.has(id)) {\n claimed.add(id);\n return `part-id:${id}`;\n }\n return `part-${partIndex}`;\n };\n\n return messageRanges.map((range) => {\n if (range.type === \"single\") {\n return (\n <MessagePrimitivePartByIndex\n key={range.index}\n index={range.index}\n components={components}\n />\n );\n } else if (range.type === \"chainOfThoughtGroup\") {\n const ChainOfThoughtComponent = components?.ChainOfThought;\n if (!ChainOfThoughtComponent) return null;\n return (\n <ChainOfThoughtByIndicesProvider\n key={`chainOfThought-${range.idKey ?? range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n <ChainOfThoughtComponent />\n </ChainOfThoughtByIndicesProvider>\n );\n } else if (range.type === \"toolGroup\") {\n const ToolGroupComponent =\n components?.ToolGroup ?? defaultComponents.ToolGroup;\n return (\n <ToolGroupComponent\n key={`tool-${range.idKey ?? range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n {Array.from(\n { length: range.endIndex - range.startIndex + 1 },\n (_, i) => {\n const partIndex = range.startIndex + i;\n return (\n <MessagePrimitivePartByIndex\n key={toolLeafKey(partIndex)}\n index={partIndex}\n components={components}\n />\n );\n },\n )}\n </ToolGroupComponent>\n );\n } else {\n // reasoningGroup\n const ReasoningGroupComponent =\n components?.ReasoningGroup ?? defaultComponents.ReasoningGroup;\n return (\n <ReasoningGroupComponent\n key={`reasoning-${range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n {Array.from(\n { length: range.endIndex - range.startIndex + 1 },\n (_, i) => {\n const partIndex = range.startIndex + i;\n return (\n <MessagePrimitivePartByIndex\n key={`part-${partIndex}`}\n index={partIndex}\n components={components}\n />\n );\n },\n )}\n </ReasoningGroupComponent>\n );\n }\n });\n }, [messageRanges, partIds, components, contentLength]);\n\n return (\n <>\n {components?.Quote && <QuoteRenderer Quote={components.Quote} />}\n {partsElements}\n <ConditionalEmpty\n components={components}\n enabled={unstable_showEmptyOnNonTextEnd}\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAqEA,MAAMyC,oBAGJC,cACG;CACH,IAAIE,QAAQ;CAEZ,OAAO;EACLC,aAAaR,UAAkB;GAC7B,IAAIO,UAAU,IACZA,QAAQP;EAEZ;EACAS,WAAWP,UAAkBQ,WAA+B;GAC1D,IAAIH,UAAU,IAAI;IAChBG,OAAOC,KAAK;KACVZ,MAAMM;KACNJ,YAAYM;KACZL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K;AAJ9B,SAAAiC,OAAA2C,GAAA;CAAA,OAIRA,EAAC2D,QAAQC,MAAMqD,IAAKQ,KAAkB;AAAC;AAJ/B,SAAAE,OAAAC,KAAA;CAAA,OAStBF,IAACtM,SAAU,cAAcsM,IAACG,aAA1B9K,KAAAA;AAAiD;AAT3B,SAAAO,OAAAwK,KAAA;CAAA,OAQxB9H,IAAC2D,QAAQC,MAAMqD,IAAKU,MAEpB;AAAC;AA8N4D,SAAAlG,OAAAzB,GAAA;CAAA,OAcjCA,EAACJ;AAAK;AA2Ic,SAAA2D,OAAAvD,GAAA;CAAA,OAE1CA,EAAC2D,QAAQzB,UAATgB;AAAyD;AAwExC,SAAA2B,OAAA7E,GAAA;CAAA,OAEKA,EAACJ;AAAK;AAFX,SAAAkF,OAAAgD,KAAA;CAAA,OAIzB9H,IAACJ,KAAKxE,SAAU,cAAciJ,kBAAkBrE,IAACb,OAAQa,IAACJ,IAAY,IAAtE;AAAuE;AAmBtC,SAAAoF,OAAAhF,GAAA;CAAA,OACHA,EAACJ;AAAK;AADH,SAAAqF,OAAA6C,KAAA;CAAA,OAGjC9H,IAACJ,KAAKxE,SAAU,SACXgF,gBAAgBJ,IAACK,eAAgBL,IAACJ,KAAKU,MAAOvD,KAAAA,CAAiB,KAA/D,OADL;AAEQ;AAqBoB,SAAAqI,OAAApF,GAAA;CAAA,OACMA,EAACJ,KAAKxE;AAAK;AAqH5C,SAAAiL,QAAArG,GAAA;CAAA,OACsCA,EAAC2D,QAAQC,MAAMpH;AAAO;AAD5D,SAAA+J,QAAAuB,KAAA;CAAA,QAGO9H,IAAC2D,QAAQzB,QAAa9G,QAAtB,gBAA0C;AAAS;AAmD1D,SAAAyL,QAAA7G,GAAA;CAAA,OACsCA,EAAC2D,QAAQC,MAAMpH;AAAO"}
1
+ {"version":3,"file":"MessageParts.js","names":["ComponentType","FC","ReactNode","memo","PropsWithChildren","useMemo","RenderChildrenWithAccessor","useAuiState","useAui","PartState","PartByIndexProvider","TextMessagePartProvider","ChainOfThoughtByIndicesProvider","getMessageQuote","Unstable_AudioMessagePartComponent","DataMessagePartComponent","DataMessagePartProps","EmptyMessagePartComponent","TextMessagePartComponent","ImageMessagePartComponent","SourceMessagePartComponent","ToolCallMessagePartComponent","ToolCallMessagePartProps","FileMessagePartComponent","ReasoningMessagePartComponent","ReasoningGroupComponent","QuoteMessagePartComponent","GenerativeUIComponentRegistry","GenerativeUIRender","isMcpAppUri","MessagePartStatus","GenerativeUIMessagePart","DataRenderersState","ToolsState","useShallow","MessagePartRange","type","index","startIndex","endIndex","idKey","createGroupState","groupType","T","start","startGroup","endGroup","ranges","push","finalize","groupMessageParts","messageTypes","useChainOfThought","partIds","chainOfThoughtGroup","i","length","toolGroup","reasoningGroup","claimed","Set","range","id","undefined","has","add","useMessagePartsGroups","$","_c","_temp2","_temp4","t0","bb0","t1","Symbol","for","t2","MessagePrimitiveParts","DataConfig","by_name","Record","Fallback","BaseComponents","Empty","Text","Source","Image","File","Unstable_Audio","data","Quote","generativeUI","components","component","props","ToolsConfig","Override","StandardComponents","Reasoning","tools","ToolGroup","ReasoningGroup","ChainOfThought","ChainOfThoughtComponents","Props","unstable_showEmptyOnNonTextEnd","children","value","part","EnrichedPartState","ToolUIDisplay","toolName","s","toolUIs","render","Render","getDataRenderer","dataRenderers","name","inlineFallback","named","renderers","fallbacks","DataUIDisplay","defaultComponents","MessagePartComponentProps","MessagePartComponent","t3","t4","t5","t6","t7","t8","t9","Audio","t10","aui","_temp5","addResult","addToolResult","resume","resumeToolCall","respondToApproval","respondToToolApproval","t11","Tool","status","Error","Data","process","env","NODE_ENV","console","warn","t12","spec","MessagePrimitivePartByIndex","prev","next","displayName","EmptyPartFallback","Component","COMPLETE_STATUS","Object","freeze","RUNNING_STATUS","EmptyPartsImpl","_temp6","EmptyParts","ConditionalEmptyImpl","enabled","message","parts","lastPart","shouldShowEmpty","ConditionalEmpty","QuoteRendererImpl","quoteInfo","messageId","text","QuoteRenderer","resolveToolRender","toolsState","Extract","mcp","app","resourceUri","mcpApp","RegisteredToolUI","_temp7","_temp8","RegisteredDataRendererUI","_temp9","_temp0","DefaultPartFallback","partType","_temp1","toolUI","dataRendererUI","Exclude","EMPTY_RUNNING_TEXT_PART","MessagePartChildrenProps","MessagePartChildrenInner","Pick","client","getState","getItem","state","hasUI","partMethods","MessagePartChildren","MessagePrimitivePartsInner","contentLength","_temp10","isRunning","_temp11","isEmptyRunning","_","Array","from","MessagePrimitivePartsCompat","_temp12","messageRanges","toolLeafKey","partIndex","map","ChainOfThoughtComponent","ToolGroupComponent","partIndex_0","__0","i_0","partIndex_1","partsElements","_temp","c","_temp3","c_0","toolCallId","s_0"],"sources":["../../../../src/react/primitives/message/MessageParts.tsx"],"sourcesContent":["import {\n type ComponentType,\n type FC,\n type ReactNode,\n memo,\n type PropsWithChildren,\n useMemo,\n} from \"react\";\nimport {\n RenderChildrenWithAccessor,\n useAuiState,\n useAui,\n} from \"@assistant-ui/store\";\nimport type { PartState } from \"../../../store/scopes/part\";\nimport { PartByIndexProvider } from \"../../providers/PartByIndexProvider\";\nimport { TextMessagePartProvider } from \"../../providers/TextMessagePartProvider\";\nimport { ChainOfThoughtByIndicesProvider } from \"../../providers/ChainOfThoughtByIndicesProvider\";\nimport { getMessageQuote } from \"../../utils/getMessageQuote\";\nimport type {\n Unstable_AudioMessagePartComponent,\n DataMessagePartComponent,\n DataMessagePartProps,\n EmptyMessagePartComponent,\n TextMessagePartComponent,\n ImageMessagePartComponent,\n SourceMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n FileMessagePartComponent,\n ReasoningMessagePartComponent,\n ReasoningGroupComponent,\n QuoteMessagePartComponent,\n GenerativeUIComponentRegistry,\n} from \"../../types/MessagePartComponentTypes\";\nimport { GenerativeUIRender } from \"../generativeUI/GenerativeUI\";\nimport {\n isMcpAppUri,\n type MessagePartStatus,\n type GenerativeUIMessagePart,\n} from \"../../../types/message\";\nimport type { DataRenderersState } from \"../../types/scopes/dataRenderers\";\nimport type { ToolsState } from \"../../types/scopes/tools\";\nimport { useShallow } from \"zustand/shallow\";\n\ntype MessagePartRange =\n | { type: \"single\"; index: number }\n | {\n type: \"toolGroup\";\n startIndex: number;\n endIndex: number;\n idKey?: string | undefined;\n }\n | {\n type: \"reasoningGroup\";\n startIndex: number;\n endIndex: number;\n idKey?: string | undefined;\n }\n | {\n type: \"chainOfThoughtGroup\";\n startIndex: number;\n endIndex: number;\n idKey?: string | undefined;\n };\n\n/**\n * Creates a group state manager for a specific part type.\n * Returns functions to start, end, and finalize groups.\n */\nconst createGroupState = <\n T extends \"toolGroup\" | \"reasoningGroup\" | \"chainOfThoughtGroup\",\n>(\n groupType: T,\n) => {\n let start = -1;\n\n return {\n startGroup: (index: number) => {\n if (start === -1) {\n start = index;\n }\n },\n endGroup: (endIndex: number, ranges: MessagePartRange[]) => {\n if (start !== -1) {\n ranges.push({\n type: groupType,\n startIndex: start,\n endIndex,\n } as MessagePartRange);\n start = -1;\n }\n },\n finalize: (endIndex: number, ranges: MessagePartRange[]) => {\n if (start !== -1) {\n ranges.push({\n type: groupType,\n startIndex: start,\n endIndex,\n } as MessagePartRange);\n }\n },\n };\n};\n\n/**\n * Groups consecutive tool-call and reasoning message parts into ranges.\n * Always groups tool calls and reasoning parts, even if there's only one.\n * When useChainOfThought is true, groups tool-call and reasoning parts together.\n * `partIds[i]` optionally carries a stable identity for part `i`; group\n * ranges derive an `idKey` from their first part's id (first claim wins).\n */\nexport const groupMessageParts = (\n messageTypes: readonly string[],\n useChainOfThought: boolean,\n partIds?: readonly (string | undefined)[],\n): MessagePartRange[] => {\n const ranges: MessagePartRange[] = [];\n\n if (useChainOfThought) {\n const chainOfThoughtGroup = createGroupState(\"chainOfThoughtGroup\");\n\n for (let i = 0; i < messageTypes.length; i++) {\n const type = messageTypes[i];\n\n if (type === \"tool-call\" || type === \"reasoning\") {\n chainOfThoughtGroup.startGroup(i);\n } else {\n chainOfThoughtGroup.endGroup(i - 1, ranges);\n ranges.push({ type: \"single\", index: i });\n }\n }\n\n chainOfThoughtGroup.finalize(messageTypes.length - 1, ranges);\n } else {\n const toolGroup = createGroupState(\"toolGroup\");\n const reasoningGroup = createGroupState(\"reasoningGroup\");\n\n for (let i = 0; i < messageTypes.length; i++) {\n const type = messageTypes[i];\n\n if (type === \"tool-call\") {\n reasoningGroup.endGroup(i - 1, ranges);\n toolGroup.startGroup(i);\n } else if (type === \"reasoning\") {\n toolGroup.endGroup(i - 1, ranges);\n reasoningGroup.startGroup(i);\n } else {\n toolGroup.endGroup(i - 1, ranges);\n reasoningGroup.endGroup(i - 1, ranges);\n ranges.push({ type: \"single\", index: i });\n }\n }\n\n toolGroup.finalize(messageTypes.length - 1, ranges);\n reasoningGroup.finalize(messageTypes.length - 1, ranges);\n }\n\n if (partIds) {\n const claimed = new Set<string>();\n for (const range of ranges) {\n if (range.type === \"single\") continue;\n const id = partIds[range.startIndex];\n if (id !== undefined && !claimed.has(id)) {\n claimed.add(id);\n range.idKey = `id:${id}`;\n }\n }\n }\n\n return ranges;\n};\n\nconst useMessagePartsGroups = (\n useChainOfThought: boolean,\n): { ranges: MessagePartRange[]; partIds: (string | undefined)[] } => {\n const messageTypes = useAuiState(\n useShallow((s) => s.message.parts.map((c: any) => c.type)),\n );\n const partIds = useAuiState(\n useShallow((s) =>\n s.message.parts.map((c: any) =>\n c.type === \"tool-call\" ? c.toolCallId : undefined,\n ),\n ),\n );\n\n return useMemo(() => {\n if (messageTypes.length === 0) {\n return { ranges: [], partIds };\n }\n return {\n ranges: groupMessageParts(messageTypes, useChainOfThought, partIds),\n partIds,\n };\n }, [messageTypes, partIds, useChainOfThought]);\n};\n\nexport namespace MessagePrimitiveParts {\n type DataConfig = {\n /** Map data event names to specific components */\n by_name?: Record<string, DataMessagePartComponent | undefined> | undefined;\n /** Fallback component for unmatched data events */\n Fallback?: DataMessagePartComponent | undefined;\n };\n\n type BaseComponents = {\n /** Component for rendering empty messages */\n Empty?: EmptyMessagePartComponent | undefined;\n /** Component for rendering text content */\n Text?: TextMessagePartComponent | undefined;\n /** Component for rendering source content */\n Source?: SourceMessagePartComponent | undefined;\n /** Component for rendering image content */\n Image?: ImageMessagePartComponent | undefined;\n /** Component for rendering file content */\n File?: FileMessagePartComponent | undefined;\n /**\n * Component for rendering audio content.\n *\n * @deprecated Render audio through the `File` slot instead, branching on an\n * `audio/*` mime type.\n */\n Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;\n /** Configuration for data part rendering */\n data?: DataConfig | undefined;\n /** Component for rendering a quoted message reference (from metadata, not parts) */\n Quote?: QuoteMessagePartComponent | undefined;\n /**\n * Configuration for generative-ui part rendering.\n *\n * `components` is the consumer-provided allowlist of React components\n * the agent's JSON spec is permitted to render. Any name not present in\n * the registry is rejected with a typed `GenerativeUIRenderError` —\n * this is the security boundary in the same-realm rendering path.\n */\n generativeUI?:\n | {\n /** The component allowlist (the security boundary). */\n components: GenerativeUIComponentRegistry;\n /** Optional fallback for unknown component names. */\n Fallback?:\n | ComponentType<{ component: string; props?: unknown }>\n | undefined;\n }\n | undefined;\n };\n\n type ToolsConfig =\n | {\n /** Map of tool names to their specific components */\n by_name?:\n | Record<string, ToolCallMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unregistered tools */\n Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;\n }\n | {\n /** Override component that handles all tool calls */\n Override: ComponentType<ToolCallMessagePartProps>;\n };\n\n /**\n * Standard component configuration for rendering reasoning and tool-call parts\n * individually (with optional grouping).\n *\n * Cannot be combined with `ChainOfThought`.\n */\n type StandardComponents = BaseComponents & {\n /** Component for rendering reasoning content (typically hidden) */\n Reasoning?: ReasoningMessagePartComponent | undefined;\n /** Configuration for tool call rendering */\n tools?: ToolsConfig | undefined;\n\n /**\n * Component for rendering grouped consecutive tool calls.\n *\n * @param startIndex - Index of the first tool call in the group\n * @param endIndex - Index of the last tool call in the group\n * @param children - Rendered tool call components to display within the group\n *\n * @deprecated Use `<MessagePrimitive.GroupedParts>` with a custom `groupBy` instead.\n */\n ToolGroup?: ComponentType<\n PropsWithChildren<{ startIndex: number; endIndex: number }>\n >;\n\n /**\n * Component for rendering grouped reasoning parts.\n *\n * @param startIndex - Index of the first reasoning part in the group\n * @param endIndex - Index of the last reasoning part in the group\n * @param children - Rendered reasoning part components\n *\n * @deprecated Use `<MessagePrimitive.GroupedParts>` with a custom `groupBy` instead.\n */\n ReasoningGroup?: ReasoningGroupComponent;\n\n ChainOfThought?: never;\n };\n\n /**\n * Chain of thought component configuration.\n *\n * When `ChainOfThought` is set, it takes control of rendering ALL reasoning and\n * tool-call parts in the message. The `Reasoning`, `tools`, `ReasoningGroup`, and\n * `ToolGroup` components cannot be used alongside it.\n */\n type ChainOfThoughtComponents = BaseComponents & {\n /**\n * @deprecated Use `<MessagePrimitive.GroupedParts>` with a `groupBy`\n * that returns `[\"group-thought\", ...]` for reasoning and tool-call\n * parts. See `@assistant-ui/ui` for a worked example.\n */\n ChainOfThought: ComponentType;\n\n Reasoning?: never;\n tools?: never;\n ToolGroup?: never;\n ReasoningGroup?: never;\n };\n\n export type Props =\n | {\n /**\n * Component configuration for rendering different types of message content.\n *\n * Use either `Reasoning`/`tools`/`ToolGroup`/`ReasoningGroup` for standard rendering,\n * or `ChainOfThought` to group all reasoning and tool-call parts into a single\n * collapsible component. These two modes are mutually exclusive.\n */\n components?: StandardComponents | ChainOfThoughtComponents | undefined;\n /**\n * When enabled, shows the Empty component if the last part in the message\n * is anything other than Text or Reasoning.\n *\n * @experimental This API is experimental and may change in future versions.\n * @default true\n */\n unstable_showEmptyOnNonTextEnd?: boolean | undefined;\n children?: never;\n }\n | {\n /** Render function called for each part. Receives the enriched part state. */\n children: (value: { part: EnrichedPartState }) => ReactNode;\n components?: never;\n unstable_showEmptyOnNonTextEnd?: never;\n };\n}\n\nconst ToolUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: ToolCallMessagePartComponent | undefined;\n} & ToolCallMessagePartProps) => {\n const Render = useAuiState(\n (s) => s.tools.toolUIs[props.toolName]?.[0]?.render ?? Fallback,\n );\n if (!Render) return null;\n return <Render {...props} />;\n};\n\nconst getDataRenderer = (\n dataRenderers: DataRenderersState,\n name: string,\n inlineFallback: DataMessagePartComponent | undefined,\n): DataMessagePartComponent | undefined => {\n const named = dataRenderers.renderers[name]?.[0];\n if (named) return named;\n return dataRenderers.fallbacks[0] ?? inlineFallback;\n};\n\nconst DataUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: DataMessagePartComponent | undefined;\n} & DataMessagePartProps) => {\n const Render = useAuiState((s) =>\n getDataRenderer(s.dataRenderers, props.name, Fallback),\n );\n if (!Render) return null;\n return <Render {...props} />;\n};\n\n/**\n * Platform-agnostic no-op default components.\n * Each platform (web, RN) wraps MessagePrimitiveParts with its own defaults.\n */\nexport const defaultComponents = {\n Text: () => null,\n Reasoning: () => null,\n Source: () => null,\n Image: () => null,\n File: () => null,\n Unstable_Audio: () => null,\n ToolGroup: ({ children }: PropsWithChildren) => children,\n ReasoningGroup: ({ children }: PropsWithChildren) => children,\n} satisfies MessagePrimitiveParts.Props[\"components\"];\n\ntype MessagePartComponentProps = {\n components: MessagePrimitiveParts.Props[\"components\"];\n};\n\nexport const MessagePartComponent: FC<MessagePartComponentProps> = ({\n components: {\n Text = defaultComponents.Text,\n Reasoning = defaultComponents.Reasoning,\n Image = defaultComponents.Image,\n Source = defaultComponents.Source,\n File = defaultComponents.File,\n Unstable_Audio: Audio = defaultComponents.Unstable_Audio,\n tools = {},\n data,\n generativeUI,\n } = {},\n}) => {\n const aui = useAui();\n const part = useAuiState((s) => s.part);\n\n const type = part.type;\n if (type === \"tool-call\") {\n const addResult = aui.part.addToolResult;\n const resume = aui.part.resumeToolCall;\n const respondToApproval = aui.part.respondToToolApproval;\n if (\"Override\" in tools)\n return (\n <tools.Override\n {...part}\n addResult={addResult}\n resume={resume}\n respondToApproval={respondToApproval}\n />\n );\n const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;\n return (\n <ToolUIDisplay\n {...part}\n Fallback={Tool}\n addResult={addResult}\n resume={resume}\n respondToApproval={respondToApproval}\n />\n );\n }\n\n if (part.status?.type === \"requires-action\")\n throw new Error(\"Encountered unexpected requires-action status\");\n\n switch (type) {\n case \"text\":\n return <Text {...part} />;\n\n case \"reasoning\":\n return <Reasoning {...part} />;\n\n case \"source\":\n return <Source {...part} />;\n\n case \"image\":\n return <Image {...part} />;\n\n case \"file\":\n return <File {...part} />;\n\n case \"audio\":\n return <Audio {...part} />;\n\n case \"data\": {\n const Data = data?.by_name?.[part.name] ?? data?.Fallback;\n return <DataUIDisplay {...part} Fallback={Data} />;\n }\n\n case \"generative-ui\": {\n if (!generativeUI?.components) {\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\"\n ) {\n console.warn(\n \"MessagePrimitive.Parts received a generative-ui part but no \" +\n \"`components.generativeUI.components` allowlist was provided. \" +\n \"Pass an allowlist or render with <MessagePrimitive.GenerativeUI />.\",\n );\n }\n return null;\n }\n return (\n <GenerativeUIRender\n spec={(part as GenerativeUIMessagePart).spec}\n components={generativeUI.components}\n Fallback={generativeUI.Fallback}\n />\n );\n }\n\n default:\n console.warn(`Unknown message part type: ${type}`);\n return null;\n }\n};\n\nexport namespace MessagePrimitivePartByIndex {\n export type Props = {\n index: number;\n components: MessagePrimitiveParts.Props[\"components\"];\n };\n}\n\n/**\n * Renders a single message part at the specified index.\n */\nexport const MessagePrimitivePartByIndex: FC<MessagePrimitivePartByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <PartByIndexProvider index={index}>\n <MessagePartComponent components={components} />\n </PartByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n prev.components?.Text === next.components?.Text &&\n prev.components?.Reasoning === next.components?.Reasoning &&\n prev.components?.Source === next.components?.Source &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.File === next.components?.File &&\n prev.components?.Unstable_Audio === next.components?.Unstable_Audio &&\n prev.components?.tools === next.components?.tools &&\n prev.components?.data === next.components?.data &&\n prev.components?.generativeUI === next.components?.generativeUI &&\n prev.components?.ToolGroup === next.components?.ToolGroup &&\n prev.components?.ReasoningGroup === next.components?.ReasoningGroup,\n );\n\nMessagePrimitivePartByIndex.displayName = \"MessagePrimitive.PartByIndex\";\n\nconst EmptyPartFallback: FC<{\n status: MessagePartStatus;\n component: TextMessagePartComponent;\n}> = ({ status, component: Component }) => {\n return (\n <TextMessagePartProvider text=\"\" isRunning={status.type === \"running\"}>\n <Component type=\"text\" text=\"\" status={status} />\n </TextMessagePartProvider>\n );\n};\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nconst RUNNING_STATUS: MessagePartStatus = Object.freeze({\n type: \"running\",\n});\n\nconst EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {\n const status = useAuiState(\n (s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,\n );\n\n if (components?.Empty) return <components.Empty status={status} />;\n\n if (status.type !== \"running\") return null;\n\n return (\n <EmptyPartFallback\n status={status}\n component={components?.Text ?? defaultComponents.Text}\n />\n );\n};\n\nconst EmptyParts = memo(\n EmptyPartsImpl,\n (prev, next) =>\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\nconst ConditionalEmptyImpl: FC<{\n components: MessagePrimitiveParts.Props[\"components\"];\n enabled: boolean;\n}> = ({ components, enabled }) => {\n const shouldShowEmpty = useAuiState((s) => {\n if (!enabled) return false;\n if (s.message.parts.length === 0) return false;\n\n const lastPart = s.message.parts[s.message.parts.length - 1];\n return lastPart?.type !== \"text\" && lastPart?.type !== \"reasoning\";\n });\n\n if (!shouldShowEmpty) return null;\n return <EmptyParts components={components} />;\n};\n\nconst ConditionalEmpty = memo(\n ConditionalEmptyImpl,\n (prev, next) =>\n prev.enabled === next.enabled &&\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\nconst QuoteRendererImpl: FC<{ Quote: QuoteMessagePartComponent }> = ({\n Quote,\n}) => {\n const quoteInfo = useAuiState(getMessageQuote);\n if (!quoteInfo) return null;\n return <Quote text={quoteInfo.text} messageId={quoteInfo.messageId} />;\n};\n\nconst QuoteRenderer = memo(QuoteRendererImpl);\n\nfunction resolveToolRender(\n toolsState: ToolsState,\n part: Extract<PartState, { type: \"tool-call\" }>,\n): ToolCallMessagePartComponent | null {\n const named = toolsState.toolUIs[part.toolName]?.[0]?.render ?? null;\n if (named) return named;\n if (isMcpAppUri(part.mcp?.app?.resourceUri) && toolsState.mcpApp) {\n return toolsState.mcpApp.render;\n }\n return null;\n}\n\n/**\n * Stable propless component that renders the registered tool UI for the\n * current part context. Reads tool registry and part state from context.\n */\nconst RegisteredToolUI: FC = () => {\n const aui = useAui();\n const part = useAuiState((s) => s.part);\n const Render = useAuiState((s) =>\n s.part.type === \"tool-call\" ? resolveToolRender(s.tools, s.part) : null,\n );\n\n if (!Render || part.type !== \"tool-call\") return null;\n\n return (\n <Render\n {...part}\n addResult={aui.part.addToolResult}\n resume={aui.part.resumeToolCall}\n respondToApproval={aui.part.respondToToolApproval}\n />\n );\n};\n\n/**\n * Stable propless component that renders the registered data renderer UI\n * for the current part context.\n */\nconst RegisteredDataRendererUI: FC = () => {\n const part = useAuiState((s) => s.part);\n const Render = useAuiState((s) =>\n s.part.type === \"data\"\n ? (getDataRenderer(s.dataRenderers, s.part.name, undefined) ?? null)\n : null,\n );\n\n if (!Render || part.type !== \"data\") return null;\n\n return <Render {...(part as DataMessagePartProps)} />;\n};\n\n/**\n * Fallback component rendered when the children render function returns null.\n * Renders registered tool/data UIs via context.\n * For all other part types, renders nothing.\n *\n * This allows users to write:\n * {({ part }) => {\n * if (part.type === \"text\") return <MyText />;\n * return null; // tool UIs and data UIs still render via registry\n * }}\n *\n * To explicitly render nothing (suppressing registered UIs), return <></>.\n */\nconst DefaultPartFallback: FC = () => {\n const partType = useAuiState((s) => s.part.type);\n\n if (partType === \"tool-call\") return <RegisteredToolUI />;\n if (partType === \"data\") return <RegisteredDataRendererUI />;\n\n return null;\n};\n\nexport type { PartState };\n\n/**\n * Enriched part state passed to children render functions.\n *\n * For tool-call parts, adds `toolUI`, `addResult`, and `resume`.\n * For data parts, adds `dataRendererUI`.\n *\n * The render function is also invoked once with a synthetic empty text part\n * (`{ type: \"text\", text: \"\", status: { type: \"running\" } }`) when the\n * assistant message has no parts yet but is in the running state, so a\n * loading indicator can render. Differentiate this from a real empty text\n * via `part.status?.type === \"running\" && part.text === \"\"`.\n */\nexport type EnrichedPartState =\n | (Extract<PartState, { type: \"tool-call\" }> & {\n /** The registered tool UI element, or null if none registered. */\n readonly toolUI: ReactNode;\n /** Add a tool result to this tool call. */\n addResult: ToolCallMessagePartProps[\"addResult\"];\n /** Resume a tool call waiting for human input. */\n resume: ToolCallMessagePartProps[\"resume\"];\n /** Respond to a server-side tool approval gate. */\n respondToApproval: ToolCallMessagePartProps[\"respondToApproval\"];\n })\n | (Extract<PartState, { type: \"data\" }> & {\n /** The registered data renderer UI element, or null if none registered. */\n readonly dataRendererUI: ReactNode;\n })\n | Exclude<PartState, { type: \"tool-call\" } | { type: \"data\" }>;\n\nconst EMPTY_RUNNING_TEXT_PART: Extract<EnrichedPartState, { type: \"text\" }> =\n Object.freeze({\n type: \"text\",\n text: \"\",\n status: RUNNING_STATUS,\n });\n\n/**\n * Renders a single part by index, calling `children` with the\n * {@link EnrichedPartState} (tool/data UI enrichments + addResult/resume\n * for tool calls). Shared between `<MessagePrimitive.Parts>` and\n * `<MessagePrimitive.GroupedParts>`. Returns whatever `children`\n * returns — callers decide how to handle a `null` return.\n */\ntype MessagePartChildrenProps = {\n index: number;\n children: (value: { part: EnrichedPartState }) => ReactNode;\n};\n\nconst MessagePartChildrenInner: FC<\n Pick<MessagePartChildrenProps, \"children\">\n> = ({ children }) => {\n const aui = useAui();\n // Subscribed (not snapshotted like `tools`) so fallbacks registered\n // after the first render trigger a re-render and `hasUI` re-evaluates.\n const dataRenderers = useAuiState((s) => s.dataRenderers);\n\n return (\n <RenderChildrenWithAccessor\n getItemState={(client) => client.part.getState()}\n >\n {(getItem) =>\n children({\n get part() {\n const state = getItem();\n if (state.type === \"tool-call\") {\n const toolsState = aui.tools.getState();\n const hasUI = resolveToolRender(toolsState, state) !== null;\n const partMethods = aui.part;\n return {\n ...state,\n toolUI: hasUI ? <RegisteredToolUI /> : null,\n addResult: partMethods.addToolResult,\n resume: partMethods.resumeToolCall,\n respondToApproval: partMethods.respondToToolApproval,\n };\n }\n if (state.type === \"data\") {\n const hasUI =\n getDataRenderer(dataRenderers, state.name, undefined) !==\n undefined;\n return {\n ...state,\n dataRendererUI: hasUI ? <RegisteredDataRendererUI /> : null,\n };\n }\n return state;\n },\n })\n }\n </RenderChildrenWithAccessor>\n );\n};\n\nexport const MessagePartChildren: FC<MessagePartChildrenProps> = ({\n index,\n children,\n}) => {\n return (\n <PartByIndexProvider index={index}>\n <MessagePartChildrenInner>{children}</MessagePartChildrenInner>\n </PartByIndexProvider>\n );\n};\n\nconst MessagePrimitivePartsInner: FC<{\n children: (value: { part: EnrichedPartState }) => ReactNode;\n}> = ({ children }) => {\n const contentLength = useAuiState((s) => s.message.parts.length);\n const isRunning = useAuiState(\n (s) => (s.message.status?.type ?? \"complete\") === \"running\",\n );\n const isEmptyRunning = contentLength === 0 && isRunning;\n\n if (contentLength === 0) {\n if (!isEmptyRunning) return null;\n return (\n <TextMessagePartProvider text=\"\" isRunning>\n {children({ part: EMPTY_RUNNING_TEXT_PART })}\n </TextMessagePartProvider>\n );\n }\n\n return (\n <>\n {Array.from({ length: contentLength }, (_, index) => (\n <MessagePartChildren key={index} index={index}>\n {(value) => children(value) ?? <DefaultPartFallback />}\n </MessagePartChildren>\n ))}\n </>\n );\n};\n\n/**\n * Renders the parts of a message with support for multiple content types.\n *\n * This is the platform-agnostic base. Each platform wraps this with its own\n * default components (web uses `<p>`, `<span>`; RN would use `<Text>`, etc.).\n */\nexport const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = ({\n components,\n unstable_showEmptyOnNonTextEnd = true,\n children,\n}) => {\n if (children) {\n return <MessagePrimitivePartsInner>{children}</MessagePrimitivePartsInner>;\n }\n return (\n <MessagePrimitivePartsCompat\n components={components}\n unstable_showEmptyOnNonTextEnd={unstable_showEmptyOnNonTextEnd}\n />\n );\n};\n\nMessagePrimitiveParts.displayName = \"MessagePrimitive.Parts\";\n\nconst MessagePrimitivePartsCompat: FC<{\n components: MessagePrimitiveParts.Props[\"components\"];\n unstable_showEmptyOnNonTextEnd: boolean;\n}> = ({ components, unstable_showEmptyOnNonTextEnd }) => {\n const contentLength = useAuiState((s) => s.message.parts.length);\n const useChainOfThought = !!components?.ChainOfThought;\n const { ranges: messageRanges, partIds } =\n useMessagePartsGroups(useChainOfThought);\n\n const partsElements = useMemo(() => {\n if (contentLength === 0) {\n return <EmptyParts components={components} />;\n }\n\n const claimed = new Set<string>();\n const toolLeafKey = (partIndex: number) => {\n const id = partIds[partIndex];\n if (id !== undefined && !claimed.has(id)) {\n claimed.add(id);\n return `part-id:${id}`;\n }\n return `part-${partIndex}`;\n };\n\n return messageRanges.map((range) => {\n if (range.type === \"single\") {\n return (\n <MessagePrimitivePartByIndex\n key={range.index}\n index={range.index}\n components={components}\n />\n );\n } else if (range.type === \"chainOfThoughtGroup\") {\n const ChainOfThoughtComponent = components?.ChainOfThought;\n if (!ChainOfThoughtComponent) return null;\n return (\n <ChainOfThoughtByIndicesProvider\n key={`chainOfThought-${range.idKey ?? range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n <ChainOfThoughtComponent />\n </ChainOfThoughtByIndicesProvider>\n );\n } else if (range.type === \"toolGroup\") {\n const ToolGroupComponent =\n components?.ToolGroup ?? defaultComponents.ToolGroup;\n return (\n <ToolGroupComponent\n key={`tool-${range.idKey ?? range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n {Array.from(\n { length: range.endIndex - range.startIndex + 1 },\n (_, i) => {\n const partIndex = range.startIndex + i;\n return (\n <MessagePrimitivePartByIndex\n key={toolLeafKey(partIndex)}\n index={partIndex}\n components={components}\n />\n );\n },\n )}\n </ToolGroupComponent>\n );\n } else {\n // reasoningGroup\n const ReasoningGroupComponent =\n components?.ReasoningGroup ?? defaultComponents.ReasoningGroup;\n return (\n <ReasoningGroupComponent\n key={`reasoning-${range.startIndex}`}\n startIndex={range.startIndex}\n endIndex={range.endIndex}\n >\n {Array.from(\n { length: range.endIndex - range.startIndex + 1 },\n (_, i) => {\n const partIndex = range.startIndex + i;\n return (\n <MessagePrimitivePartByIndex\n key={`part-${partIndex}`}\n index={partIndex}\n components={components}\n />\n );\n },\n )}\n </ReasoningGroupComponent>\n );\n }\n });\n }, [messageRanges, partIds, components, contentLength]);\n\n return (\n <>\n {components?.Quote && <QuoteRenderer Quote={components.Quote} />}\n {partsElements}\n <ConditionalEmpty\n components={components}\n enabled={unstable_showEmptyOnNonTextEnd}\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAqEA,MAAMyC,oBAGJC,cACG;CACH,IAAIE,QAAQ;CAEZ,OAAO;EACLC,aAAaR,UAAkB;GAC7B,IAAIO,UAAU,IACZA,QAAQP;EAEZ;EACAS,WAAWP,UAAkBQ,WAA+B;GAC1D,IAAIH,UAAU,IAAI;IAChBG,OAAOC,KAAK;KACVZ,MAAMM;KACNJ,YAAYM;KACZL;IACF,CAAqB;IACrBK,QAAQ;GACV;EACF;EACAK,WAAWV,UAAkBQ,WAA+B;GAC1D,IAAIH,UAAU,IACZG,OAAOC,KAAK;IACVZ,MAAMM;IACNJ,YAAYM;IACZL;GACF,CAAqB;EAEzB;CACF;AACF;;;;;;;;AASA,MAAaW,qBACXC,cACAC,mBACAC,YACuB;CACvB,MAAMN,SAA6B,CAAA;CAEnC,IAAIK,mBAAmB;EACrB,MAAME,sBAAsBb,iBAAiB,qBAAqB;EAElE,KAAK,IAAIc,IAAI,GAAGA,IAAIJ,aAAaK,QAA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BAA8B;kBAgB5D;OACH;IACV;IACA,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;cA2BH,qCAAqC,GAAG,oCAAoC;;;;;;;;;;;;;;cA4D5E,6BAA6B,GAAG,wBAAwB;cAkBxD,yCAAuB,qBAAA,wBAAA"}
1
+ {"version":3,"file":"ThreadMessages.d.ts","names":[],"sources":["../../../../src/react/primitives/thread/ThreadMessages.tsx"],"mappings":";;;;KAYK;;EAGC,SAAS;;EAET,eAAe;;EAEf,mBAAmB;;EAEnB,wBAAwB;;EAExB,qBAAqB;;EAErB,cAAc;;EAEd,mBAAmB;;EAEnB,gBAAgB;;;EAIhB,UAAU;;EAEV,eAAe;;EAEf,mBAAmB;;EAEnB,wBAAwB;;EAExB,qBAAqB;;EAErB,aAAa;;EAEb,kBAAkB;;EAElB,gBAAgB;;kBAGL;OACH;;IAGN,YAAY;IACZ;;;IAIA,WAAW;MAAS,SAAS;UAAmB;IAChD;;;kBAsGS;OACH;IACV;IACA,YAAY;;;;;;cAOH,+BAA+B,GAAG,8BAA8B;kBAgB5D;OACH;IACV;IACA,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;cA2BH,qCAAqC,GAAG,oCAAoC;;;;;;;;;;;;;;cA4D5E,6BAA6B,GAAG,wBAAwB;cAkBxD,yCAAuB,qBAAA,wBAAA"}
@@ -24,7 +24,7 @@ const getComponent = (components, role, isEditing) => {
24
24
  else return components.UserMessage ?? components.Message;
25
25
  case "assistant": if (isEditing) return components.AssistantEditComposer ?? components.EditComposer ?? components.AssistantMessage ?? components.Message;
26
26
  else return components.AssistantMessage ?? components.Message;
27
- case "system": if (isEditing) return components.SystemEditComposer ?? components.EditComposer ?? components.SystemMessage ?? components.Message;
27
+ case "system": if (isEditing) return components.SystemEditComposer ?? components.EditComposer ?? components.SystemMessage ?? components.Message ?? DEFAULT_SYSTEM_MESSAGE;
28
28
  else return components.SystemMessage ?? components.Message ?? DEFAULT_SYSTEM_MESSAGE;
29
29
  default: throw new Error(`Unknown message role: ${role}`);
30
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadMessages.js","names":["ComponentType","FC","ReactNode","memo","useMemo","RenderChildrenWithAccessor","useAuiState","MessageByIndexProvider","MessageByIdProvider","MessageState","MessagesComponentConfig","Message","EditComposer","UserEditComposer","AssistantEditComposer","SystemEditComposer","UserMessage","AssistantMessage","SystemMessage","ThreadPrimitiveMessages","Props","components","children","value","message","isComponentsSame","prev","next","DEFAULT_SYSTEM_MESSAGE","messageIdSetCache","WeakMap","ReadonlySet","hasMessageId","messages","messageId","ids","get","Set","map","m","id","set","has","getComponent","role","isEditing","_exhaustiveCheck","Error","ThreadMessageComponentProps","ThreadMessageComponent","t0","$","_c","_temp","_temp2","t1","Component","t2","ThreadPrimitiveMessageByIndex","index","displayName","ThreadPrimitiveUnstable_MessageById","s","thread","exists","t3","ThreadPrimitiveMessagesInner","messagesLength","length","Array","from","_","aui","getState","getItem","ThreadPrimitiveMessagesImpl","s_0","composer"],"sources":["../../../../src/react/primitives/thread/ThreadMessages.tsx"],"sourcesContent":["import {\n type ComponentType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { MessageByIndexProvider } from \"../../providers/MessageByIndexProvider\";\nimport { MessageByIdProvider } from \"../../providers/MessageByIdProvider\";\nimport type { MessageState } from \"../../../store\";\n\ntype MessagesComponentConfig =\n | {\n /** Component used to render all message types */\n Message: ComponentType;\n /** Component used when editing any message type */\n EditComposer?: ComponentType | undefined;\n /** Component used when editing user messages specifically */\n UserEditComposer?: ComponentType | undefined;\n /** Component used when editing assistant messages specifically */\n AssistantEditComposer?: ComponentType | undefined;\n /** Component used when editing system messages specifically */\n SystemEditComposer?: ComponentType | undefined;\n /** Component used to render user messages specifically */\n UserMessage?: ComponentType | undefined;\n /** Component used to render assistant messages specifically */\n AssistantMessage?: ComponentType | undefined;\n /** Component used to render system messages specifically */\n SystemMessage?: ComponentType | undefined;\n }\n | {\n /** Component used to render all message types (fallback) */\n Message?: ComponentType | undefined;\n /** Component used when editing any message type */\n EditComposer?: ComponentType | undefined;\n /** Component used when editing user messages specifically */\n UserEditComposer?: ComponentType | undefined;\n /** Component used when editing assistant messages specifically */\n AssistantEditComposer?: ComponentType | undefined;\n /** Component used when editing system messages specifically */\n SystemEditComposer?: ComponentType | undefined;\n /** Component used to render user messages */\n UserMessage: ComponentType;\n /** Component used to render assistant messages */\n AssistantMessage: ComponentType;\n /** Component used to render system messages */\n SystemMessage?: ComponentType | undefined;\n };\n\nexport namespace ThreadPrimitiveMessages {\n export type Props =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessagesComponentConfig;\n children?: never;\n }\n | {\n /** Render function called for each message. Receives the message. */\n children: (value: { message: MessageState }) => ReactNode;\n components?: never;\n };\n}\n\nconst isComponentsSame = (\n prev: MessagesComponentConfig,\n next: MessagesComponentConfig,\n) => {\n return (\n prev.Message === next.Message &&\n prev.EditComposer === next.EditComposer &&\n prev.UserEditComposer === next.UserEditComposer &&\n prev.AssistantEditComposer === next.AssistantEditComposer &&\n prev.SystemEditComposer === next.SystemEditComposer &&\n prev.UserMessage === next.UserMessage &&\n prev.AssistantMessage === next.AssistantMessage &&\n prev.SystemMessage === next.SystemMessage\n );\n};\n\nconst DEFAULT_SYSTEM_MESSAGE = () => null;\n\nconst messageIdSetCache = new WeakMap<\n readonly MessageState[],\n ReadonlySet<string>\n>();\n\nconst hasMessageId = (messages: readonly MessageState[], messageId: string) => {\n let ids = messageIdSetCache.get(messages);\n if (!ids) {\n ids = new Set(messages.map((m) => m.id));\n messageIdSetCache.set(messages, ids);\n }\n return ids.has(messageId);\n};\n\nconst getComponent = (\n components: MessagesComponentConfig,\n role: MessageState[\"role\"],\n isEditing: boolean,\n) => {\n switch (role) {\n case \"user\":\n if (isEditing) {\n return (\n components.UserEditComposer ??\n components.EditComposer ??\n components.UserMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return components.UserMessage ?? (components.Message as ComponentType);\n }\n case \"assistant\":\n if (isEditing) {\n return (\n components.AssistantEditComposer ??\n components.EditComposer ??\n components.AssistantMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.AssistantMessage ?? (components.Message as ComponentType)\n );\n }\n case \"system\":\n if (isEditing) {\n return (\n components.SystemEditComposer ??\n components.EditComposer ??\n components.SystemMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unknown message role: ${_exhaustiveCheck}`);\n }\n }\n};\n\ntype ThreadMessageComponentProps = {\n components: MessagesComponentConfig;\n};\n\nconst ThreadMessageComponent: FC<ThreadMessageComponentProps> = ({\n components,\n}) => {\n const role = useAuiState((s) => s.message.role);\n const isEditing = useAuiState((s) => s.message.composer.isEditing);\n const Component = getComponent(components, role, isEditing);\n\n return <Component />;\n};\nexport namespace ThreadPrimitiveMessageByIndex {\n export type Props = {\n index: number;\n components: MessagesComponentConfig;\n };\n}\n\n/**\n * Renders a single message at the specified index in the current thread.\n */\nexport const ThreadPrimitiveMessageByIndex: FC<ThreadPrimitiveMessageByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <MessageByIndexProvider index={index}>\n <ThreadMessageComponent components={components} />\n </MessageByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n isComponentsSame(prev.components, next.components),\n );\n\nThreadPrimitiveMessageByIndex.displayName = \"ThreadPrimitive.MessageByIndex\";\n\nexport namespace ThreadPrimitiveUnstable_MessageById {\n export type Props = {\n messageId: string;\n components: MessagesComponentConfig;\n };\n}\n\n/**\n * Renders the message with the given id in the current thread.\n *\n * Unlike {@link ThreadPrimitiveMessageByIndex}, this keys off the message id,\n * so it stays attached to the same message across reordering and windowing -\n * the shape needed to drive a virtualized or custom message list together with\n * `unstable_useThreadMessageIds`. A missing or removed id renders `null` rather\n * than throwing.\n *\n * @deprecated Unstable / Experimental - may change in any release.\n *\n * @example\n * ```tsx\n * const messageIds = unstable_useThreadMessageIds();\n * return messageIds.map((messageId) => (\n * <ThreadPrimitive.Unstable_MessageById\n * key={messageId}\n * messageId={messageId}\n * components={MESSAGE_COMPONENTS}\n * />\n * ));\n * ```\n */\nexport const ThreadPrimitiveUnstable_MessageById: FC<ThreadPrimitiveUnstable_MessageById.Props> =\n memo(\n ({ messageId, components }) => {\n const exists = useAuiState((s) =>\n hasMessageId(s.thread.messages, messageId),\n );\n if (!exists) return null;\n\n return (\n <MessageByIdProvider id={messageId}>\n <ThreadMessageComponent components={components} />\n </MessageByIdProvider>\n );\n },\n (prev, next) =>\n prev.messageId === next.messageId &&\n isComponentsSame(prev.components, next.components),\n );\n\nThreadPrimitiveUnstable_MessageById.displayName =\n \"ThreadPrimitive.Unstable_MessageById\";\n\nconst ThreadPrimitiveMessagesInner: FC<{\n children: (value: { message: MessageState }) => ReactNode;\n}> = ({ children }) => {\n const messagesLength = useAuiState((s) => s.thread.messages.length);\n\n return useMemo(() => {\n if (messagesLength === 0) return null;\n return Array.from({ length: messagesLength }, (_, index) => (\n <MessageByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.thread.message({ index }).getState()}\n >\n {(getItem) =>\n children({\n get message() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageByIndexProvider>\n ));\n }, [messagesLength, children]);\n};\n\n/**\n * Renders all messages in the current thread.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Messages>\n * {({ message }) => {\n * if (message.role === \"user\") return <MyUserMessage />;\n * return <MyAssistantMessage />;\n * }}\n * </ThreadPrimitive.Messages>\n * ```\n */\nexport const ThreadPrimitiveMessagesImpl: FC<ThreadPrimitiveMessages.Props> = ({\n components,\n children,\n}) => {\n if (components) {\n return (\n <ThreadPrimitiveMessagesInner>\n {() => <ThreadMessageComponent components={components} />}\n </ThreadPrimitiveMessagesInner>\n );\n }\n return (\n <ThreadPrimitiveMessagesInner>{children}</ThreadPrimitiveMessagesInner>\n );\n};\n\nThreadPrimitiveMessagesImpl.displayName = \"ThreadPrimitive.Messages\";\n\nexport const ThreadPrimitiveMessages = memo(\n ThreadPrimitiveMessagesImpl,\n (prev, next) => {\n if (prev.children || next.children) {\n return prev.children === next.children;\n }\n return isComponentsSame(prev.components!, next.components!);\n },\n);\n"],"mappings":";;;;;;;AAgEA,MAAMyB,oBACJC,MACAC,SACG;CACH,OACED,KAAKf,YAAYgB,KAAKhB,WACtBe,KAAKd,iBAAiBe,KAAKf,gBAC3Bc,KAAKb,qBAAqBc,KAAKd,oBAC/Ba,KAAKZ,0BAA0Ba,KAAKb,yBACpCY,KAAKX,uBAAuBY,KAAKZ,sBACjCW,KAAKV,gBAAgBW,KAAKX,eAC1BU,KAAKT,qBAAqBU,KAAKV,oBAC/BS,KAAKR,kBAAkBS,KAAKT;AAEhC;AAEA,MAAMU,+BAA+B;AAErC,MAAMC,oCAAoB,IAAIC,QAG5B;AAEF,MAAME,gBAAgBC,UAAmCC,cAAsB;CAC7E,IAAIC,MAAMN,kBAAkBO,IAAIH,QAAQ;CACxC,IAAI,CAACE,KAAK;EACRA,MAAM,IAAIE,IAAIJ,SAASK,KAAKC,MAAMA,EAAEC,EAAE,CAAC;EACvCX,kBAAkBY,IAAIR,UAAUE,GAAG;CACrC;CACA,OAAOA,IAAIO,IAAIR,SAAS;AAC1B;AAEA,MAAMS,gBACJtB,YACAuB,MACAC,cACG;CACH,QAAQD,MAAR;EACE,KAAK,QACH,IAAIC,WACF,OACExB,WAAWR,oBACXQ,WAAWT,gBACXS,WAAWL,eACVK,WAAWV;OAGd,OAAOU,WAAWL,eAAgBK,WAAWV;EAEjD,KAAK,aACH,IAAIkC,WACF,OACExB,WAAWP,yBACXO,WAAWT,gBACXS,WAAWJ,oBACVI,WAAWV;OAGd,OACEU,WAAWJ,oBAAqBI,WAAWV;EAGjD,KAAK,UACH,IAAIkC,W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AHgB,SAAAU,OAAAsB,KAAA;CAAA,OAIzBd,IAACtC,QAAQqD,SAAShC;AAAU"}
1
+ {"version":3,"file":"ThreadMessages.js","names":["ComponentType","FC","ReactNode","memo","useMemo","RenderChildrenWithAccessor","useAuiState","MessageByIndexProvider","MessageByIdProvider","MessageState","MessagesComponentConfig","Message","EditComposer","UserEditComposer","AssistantEditComposer","SystemEditComposer","UserMessage","AssistantMessage","SystemMessage","ThreadPrimitiveMessages","Props","components","children","value","message","isComponentsSame","prev","next","DEFAULT_SYSTEM_MESSAGE","messageIdSetCache","WeakMap","ReadonlySet","hasMessageId","messages","messageId","ids","get","Set","map","m","id","set","has","getComponent","role","isEditing","_exhaustiveCheck","Error","ThreadMessageComponentProps","ThreadMessageComponent","t0","$","_c","_temp","_temp2","t1","Component","t2","ThreadPrimitiveMessageByIndex","index","displayName","ThreadPrimitiveUnstable_MessageById","s","thread","exists","t3","ThreadPrimitiveMessagesInner","messagesLength","length","Array","from","_","aui","getState","getItem","ThreadPrimitiveMessagesImpl","s_0","composer"],"sources":["../../../../src/react/primitives/thread/ThreadMessages.tsx"],"sourcesContent":["import {\n type ComponentType,\n type FC,\n type ReactNode,\n memo,\n useMemo,\n} from \"react\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { MessageByIndexProvider } from \"../../providers/MessageByIndexProvider\";\nimport { MessageByIdProvider } from \"../../providers/MessageByIdProvider\";\nimport type { MessageState } from \"../../../store\";\n\ntype MessagesComponentConfig =\n | {\n /** Component used to render all message types */\n Message: ComponentType;\n /** Component used when editing any message type */\n EditComposer?: ComponentType | undefined;\n /** Component used when editing user messages specifically */\n UserEditComposer?: ComponentType | undefined;\n /** Component used when editing assistant messages specifically */\n AssistantEditComposer?: ComponentType | undefined;\n /** Component used when editing system messages specifically */\n SystemEditComposer?: ComponentType | undefined;\n /** Component used to render user messages specifically */\n UserMessage?: ComponentType | undefined;\n /** Component used to render assistant messages specifically */\n AssistantMessage?: ComponentType | undefined;\n /** Component used to render system messages specifically */\n SystemMessage?: ComponentType | undefined;\n }\n | {\n /** Component used to render all message types (fallback) */\n Message?: ComponentType | undefined;\n /** Component used when editing any message type */\n EditComposer?: ComponentType | undefined;\n /** Component used when editing user messages specifically */\n UserEditComposer?: ComponentType | undefined;\n /** Component used when editing assistant messages specifically */\n AssistantEditComposer?: ComponentType | undefined;\n /** Component used when editing system messages specifically */\n SystemEditComposer?: ComponentType | undefined;\n /** Component used to render user messages */\n UserMessage: ComponentType;\n /** Component used to render assistant messages */\n AssistantMessage: ComponentType;\n /** Component used to render system messages */\n SystemMessage?: ComponentType | undefined;\n };\n\nexport namespace ThreadPrimitiveMessages {\n export type Props =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessagesComponentConfig;\n children?: never;\n }\n | {\n /** Render function called for each message. Receives the message. */\n children: (value: { message: MessageState }) => ReactNode;\n components?: never;\n };\n}\n\nconst isComponentsSame = (\n prev: MessagesComponentConfig,\n next: MessagesComponentConfig,\n) => {\n return (\n prev.Message === next.Message &&\n prev.EditComposer === next.EditComposer &&\n prev.UserEditComposer === next.UserEditComposer &&\n prev.AssistantEditComposer === next.AssistantEditComposer &&\n prev.SystemEditComposer === next.SystemEditComposer &&\n prev.UserMessage === next.UserMessage &&\n prev.AssistantMessage === next.AssistantMessage &&\n prev.SystemMessage === next.SystemMessage\n );\n};\n\nconst DEFAULT_SYSTEM_MESSAGE = () => null;\n\nconst messageIdSetCache = new WeakMap<\n readonly MessageState[],\n ReadonlySet<string>\n>();\n\nconst hasMessageId = (messages: readonly MessageState[], messageId: string) => {\n let ids = messageIdSetCache.get(messages);\n if (!ids) {\n ids = new Set(messages.map((m) => m.id));\n messageIdSetCache.set(messages, ids);\n }\n return ids.has(messageId);\n};\n\nconst getComponent = (\n components: MessagesComponentConfig,\n role: MessageState[\"role\"],\n isEditing: boolean,\n) => {\n switch (role) {\n case \"user\":\n if (isEditing) {\n return (\n components.UserEditComposer ??\n components.EditComposer ??\n components.UserMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return components.UserMessage ?? (components.Message as ComponentType);\n }\n case \"assistant\":\n if (isEditing) {\n return (\n components.AssistantEditComposer ??\n components.EditComposer ??\n components.AssistantMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.AssistantMessage ?? (components.Message as ComponentType)\n );\n }\n case \"system\":\n if (isEditing) {\n return (\n components.SystemEditComposer ??\n components.EditComposer ??\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n } else {\n return (\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unknown message role: ${_exhaustiveCheck}`);\n }\n }\n};\n\ntype ThreadMessageComponentProps = {\n components: MessagesComponentConfig;\n};\n\nconst ThreadMessageComponent: FC<ThreadMessageComponentProps> = ({\n components,\n}) => {\n const role = useAuiState((s) => s.message.role);\n const isEditing = useAuiState((s) => s.message.composer.isEditing);\n const Component = getComponent(components, role, isEditing);\n\n return <Component />;\n};\nexport namespace ThreadPrimitiveMessageByIndex {\n export type Props = {\n index: number;\n components: MessagesComponentConfig;\n };\n}\n\n/**\n * Renders a single message at the specified index in the current thread.\n */\nexport const ThreadPrimitiveMessageByIndex: FC<ThreadPrimitiveMessageByIndex.Props> =\n memo(\n ({ index, components }) => {\n return (\n <MessageByIndexProvider index={index}>\n <ThreadMessageComponent components={components} />\n </MessageByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index &&\n isComponentsSame(prev.components, next.components),\n );\n\nThreadPrimitiveMessageByIndex.displayName = \"ThreadPrimitive.MessageByIndex\";\n\nexport namespace ThreadPrimitiveUnstable_MessageById {\n export type Props = {\n messageId: string;\n components: MessagesComponentConfig;\n };\n}\n\n/**\n * Renders the message with the given id in the current thread.\n *\n * Unlike {@link ThreadPrimitiveMessageByIndex}, this keys off the message id,\n * so it stays attached to the same message across reordering and windowing -\n * the shape needed to drive a virtualized or custom message list together with\n * `unstable_useThreadMessageIds`. A missing or removed id renders `null` rather\n * than throwing.\n *\n * @deprecated Unstable / Experimental - may change in any release.\n *\n * @example\n * ```tsx\n * const messageIds = unstable_useThreadMessageIds();\n * return messageIds.map((messageId) => (\n * <ThreadPrimitive.Unstable_MessageById\n * key={messageId}\n * messageId={messageId}\n * components={MESSAGE_COMPONENTS}\n * />\n * ));\n * ```\n */\nexport const ThreadPrimitiveUnstable_MessageById: FC<ThreadPrimitiveUnstable_MessageById.Props> =\n memo(\n ({ messageId, components }) => {\n const exists = useAuiState((s) =>\n hasMessageId(s.thread.messages, messageId),\n );\n if (!exists) return null;\n\n return (\n <MessageByIdProvider id={messageId}>\n <ThreadMessageComponent components={components} />\n </MessageByIdProvider>\n );\n },\n (prev, next) =>\n prev.messageId === next.messageId &&\n isComponentsSame(prev.components, next.components),\n );\n\nThreadPrimitiveUnstable_MessageById.displayName =\n \"ThreadPrimitive.Unstable_MessageById\";\n\nconst ThreadPrimitiveMessagesInner: FC<{\n children: (value: { message: MessageState }) => ReactNode;\n}> = ({ children }) => {\n const messagesLength = useAuiState((s) => s.thread.messages.length);\n\n return useMemo(() => {\n if (messagesLength === 0) return null;\n return Array.from({ length: messagesLength }, (_, index) => (\n <MessageByIndexProvider key={index} index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.thread.message({ index }).getState()}\n >\n {(getItem) =>\n children({\n get message() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageByIndexProvider>\n ));\n }, [messagesLength, children]);\n};\n\n/**\n * Renders all messages in the current thread.\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Messages>\n * {({ message }) => {\n * if (message.role === \"user\") return <MyUserMessage />;\n * return <MyAssistantMessage />;\n * }}\n * </ThreadPrimitive.Messages>\n * ```\n */\nexport const ThreadPrimitiveMessagesImpl: FC<ThreadPrimitiveMessages.Props> = ({\n components,\n children,\n}) => {\n if (components) {\n return (\n <ThreadPrimitiveMessagesInner>\n {() => <ThreadMessageComponent components={components} />}\n </ThreadPrimitiveMessagesInner>\n );\n }\n return (\n <ThreadPrimitiveMessagesInner>{children}</ThreadPrimitiveMessagesInner>\n );\n};\n\nThreadPrimitiveMessagesImpl.displayName = \"ThreadPrimitive.Messages\";\n\nexport const ThreadPrimitiveMessages = memo(\n ThreadPrimitiveMessagesImpl,\n (prev, next) => {\n if (prev.children || next.children) {\n return prev.children === next.children;\n }\n return isComponentsSame(prev.components!, next.components!);\n },\n);\n"],"mappings":";;;;;;;AAgEA,MAAMyB,oBACJC,MACAC,SACG;CACH,OACED,KAAKf,YAAYgB,KAAKhB,WACtBe,KAAKd,iBAAiBe,KAAKf,gBAC3Bc,KAAKb,qBAAqBc,KAAKd,oBAC/Ba,KAAKZ,0BAA0Ba,KAAKb,yBACpCY,KAAKX,uBAAuBY,KAAKZ,sBACjCW,KAAKV,gBAAgBW,KAAKX,eAC1BU,KAAKT,qBAAqBU,KAAKV,oBAC/BS,KAAKR,kBAAkBS,KAAKT;AAEhC;AAEA,MAAMU,+BAA+B;AAErC,MAAMC,oCAAoB,IAAIC,QAG5B;AAEF,MAAME,gBAAgBC,UAAmCC,cAAsB;CAC7E,IAAIC,MAAMN,kBAAkBO,IAAIH,QAAQ;CACxC,IAAI,CAACE,KAAK;EACRA,MAAM,IAAIE,IAAIJ,SAASK,KAAKC,MAAMA,EAAEC,EAAE,CAAC;EACvCX,kBAAkBY,IAAIR,UAAUE,GAAG;CACrC;CACA,OAAOA,IAAIO,IAAIR,SAAS;AAC1B;AAEA,MAAMS,gBACJtB,YACAuB,MACAC,cACG;CACH,QAAQD,MAAR;EACE,KAAK,QACH,IAAIC,WACF,OACExB,WAAWR,oBACXQ,WAAWT,gBACXS,WAAWL,eACVK,WAAWV;OAGd,OAAOU,WAAWL,eAAgBK,WAAWV;EAEjD,KAAK,aACH,IAAIkC,WACF,OACExB,WAAWP,yBACXO,WAAWT,gBACXS,WAAWJ,oBACVI,WAAWV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,CACF;AAvJgE,SAAAgC,MAAAS,GAAA;CAAA,OAG9BA,EAACtC,QAAQoB;AAAK;AAHgB,SAAAU,OAAAsB,KAAA;CAAA,OAIzBd,IAACtC,QAAQqD,SAAShC;AAAU"}
@@ -9,17 +9,22 @@ import { EditComposerRuntimeCore, ThreadComposerRuntimeCore } from "../../runtim
9
9
  import { AddToolResultOptions, RespondToToolApprovalOptions, ResumeRunConfig, ResumeToolCallOptions, RuntimeCapabilities, SpeechState, StartRunConfig, SubmitFeedbackOptions, ThreadRuntimeEventCallback, ThreadRuntimeEventType, ThreadSuggestion, VoiceSessionState } from "../../runtime/interfaces/thread-runtime-core.js";
10
10
  import { ThreadListRuntimeCore } from "../../runtime/interfaces/thread-list-runtime-core.js";
11
11
  import { BaseSubscribable } from "../../subscribable/subscribable.js";
12
+ import { RuntimeAdapters } from "../../runtimes/remote-thread-list/types.js";
12
13
  import "../../store/index.js";
13
14
  import { AssistantRuntime } from "../../runtime/api/assistant-runtime.js";
14
15
  import "../../index.js";
16
+ import "./RuntimeAdapterProvider.js";
17
+ import { RemoteThreadListHook } from "./RemoteThreadResource.js";
15
18
  import { ComponentType, FC, PropsWithChildren } from "react";
19
+ import { AssistantClient } from "@assistant-ui/store";
16
20
  //#region src/react/runtimes/RemoteThreadListHookInstanceManager.d.ts
17
- type RemoteThreadListHook = () => AssistantRuntime;
18
21
  declare class RemoteThreadListHookInstanceManager extends BaseSubscribable {
19
- private useRuntimeHook;
22
+ private runtimeHook;
23
+ private readonly adapterStore;
24
+ private readonly hostStore;
25
+ private readonly pendingThreadAdapters;
20
26
  private instances;
21
27
  private nextGeneration;
22
- private useAliveThreadsKeysChanged;
23
28
  private parent;
24
29
  constructor(runtimeHook: RemoteThreadListHook, parent: ThreadListRuntimeCore);
25
30
  private _whenRuntimeAttached;
@@ -36,6 +41,7 @@ declare class RemoteThreadListHookInstanceManager extends BaseSubscribable {
36
41
  startRun: (config: StartRunConfig) => void;
37
42
  resumeRun: (config: ResumeRunConfig) => void;
38
43
  cancelRun: () => void;
44
+ unstable_notifySessionReset: () => void;
39
45
  addToolResult: (options: AddToolResultOptions) => void;
40
46
  resumeToolCall: (options: ResumeToolCallOptions) => void;
41
47
  respondToToolApproval: (options: RespondToToolApprovalOptions) => void;
@@ -89,6 +95,7 @@ declare class RemoteThreadListHookInstanceManager extends BaseSubscribable {
89
95
  startRun: (config: StartRunConfig) => void;
90
96
  resumeRun: (config: ResumeRunConfig) => void;
91
97
  cancelRun: () => void;
98
+ unstable_notifySessionReset: () => void;
92
99
  addToolResult: (options: AddToolResultOptions) => void;
93
100
  resumeToolCall: (options: ResumeToolCallOptions) => void;
94
101
  respondToToolApproval: (options: RespondToToolApprovalOptions) => void;
@@ -142,6 +149,7 @@ declare class RemoteThreadListHookInstanceManager extends BaseSubscribable {
142
149
  startRun: (config: StartRunConfig) => void;
143
150
  resumeRun: (config: ResumeRunConfig) => void;
144
151
  cancelRun: () => void;
152
+ unstable_notifySessionReset: () => void;
145
153
  addToolResult: (options: AddToolResultOptions) => void;
146
154
  resumeToolCall: (options: ResumeToolCallOptions) => void;
147
155
  respondToToolApproval: (options: RespondToToolApprovalOptions) => void;
@@ -184,22 +192,28 @@ declare class RemoteThreadListHookInstanceManager extends BaseSubscribable {
184
192
  }> | undefined;
185
193
  __internal_isThreadRunning(threadId: string): boolean;
186
194
  private runningSubscribers;
187
- /**
188
- * Fires when any thread crosses the running boundary. Separate from the
189
- * general subscription so a run does not push the thread list through the
190
- * channel that resolves pending runtime attachments.
191
- */
192
195
  __internal_subscribeRunningChanged(callback: () => void): Unsubscribe;
196
+ private _publish;
193
197
  private _publishThreadRuntime;
198
+ private replacedSubscribers;
199
+ __internal_subscribeRuntimeReplaced(callback: () => void): Unsubscribe;
194
200
  private _trackRunning;
195
201
  private _setRunning;
196
202
  stopThreadRuntime(threadId: string): void;
197
203
  setRuntimeHook(newRuntimeHook: RemoteThreadListHook): void;
198
- private _RuntimeBinder;
199
- private _OuterActiveThreadProvider;
204
+ __internal_setDefaultAdapters(adapters: RuntimeAdapters | null): void;
205
+ __internal_setThreadAdapters(threadId: string, adapters: RuntimeAdapters | null): void;
206
+ __internal_dispose(): void;
207
+ private _syncHostThreads;
208
+ __internal_useHost(parentClient: AssistantClient): AssistantRuntime[];
200
209
  __internal_RenderThreadRuntimes: FC<{
201
210
  provider: ComponentType<PropsWithChildren>;
202
211
  }>;
212
+ __internal_Host: FC<{
213
+ parentClient: AssistantClient;
214
+ }>;
215
+ private _OuterActiveThreadProvider;
216
+ private _AdapterSink;
203
217
  }
204
218
  //#endregion
205
219
  export { RemoteThreadListHookInstanceManager };
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteThreadListHookInstanceManager.d.ts","names":[],"sources":["../../../src/react/runtimes/RemoteThreadListHookInstanceManager.tsx"],"mappings":";;;;;;;;;;;;;;;;KA4BK,6BAA6B;cAqBrB,4CAA4C;UAC/C;UAGA;UAGA;UACA;UACA;EAGN,YAAA,aAAa,sBACb,QAAQ;UAOF;EAsBD,mBAAmB,mBAAgB,QAAA;;;eA7BhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCH,gCAAgC,mBAAgB,QAAA;;;eAZb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBnC,qBAAqB,mBAAgB;;;eAXW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBhD,2BAA2B;UAI1B;;;;;;EAOD,mCAAmC,uBAAuB;UAKzD;UA0BA;UAgBA;EASD,kBAAkB;EAOlB,eAAe,gBAAgB;UAS9B;UAgEA;EAsCD,iCAAiC;IACtC,UAAU,cAAc"}
1
+ {"version":3,"file":"RemoteThreadListHookInstanceManager.d.ts","names":[],"sources":["../../../src/react/runtimes/RemoteThreadListHookInstanceManager.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;cA2Da,4CAA4C;UAC/C;mBACS;mBAIA;mBAIA;UAIT;UACA;UACA;EAGN,YAAA,aAAa,sBACb,QAAQ;UAOF;EAsBD,mBAAmB,mBAAgB,QAAA;;;eA7BhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CH,gCAAgC,mBAAgB,QAAA;;;eAbb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBnC,qBAAqB,mBAAgB;;;eAZW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBhD,2BAA2B;UAI1B;EAED,mCAAmC,uBAAuB;UAKzD;UAQA;UAsBA;EAED,oCACL,uBACC;UAKK;UAgBA;EASD,kBAAkB;EAUlB,eAAe,gBAAgB;EAS/B,8BAA8B,UAAU;EAMxC,6BACL,kBACA,UAAU;EASL;UAMC;EAYD,mBAAmB,cAAc,kBAAA;EAyBjC,iCAAiC;IACtC,UAAU,cAAc;;EAenB,iBAAiB;IAAK,cAAc;;UAOnC;UAmCA"}