@assistant-ui/core 0.2.12 → 0.2.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 (445) hide show
  1. package/dist/adapters/attachment.js.map +1 -1
  2. package/dist/adapters/directive-formatter.js.map +1 -1
  3. package/dist/adapters/speech.js.map +1 -1
  4. package/dist/adapters/thread-history.d.ts +3 -1
  5. package/dist/adapters/thread-history.d.ts.map +1 -1
  6. package/dist/adapters/voice.js.map +1 -1
  7. package/dist/index.d.ts +3 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/internal/duplicate-detection.js.map +1 -1
  10. package/dist/internal.d.ts +2 -1
  11. package/dist/internal.js +2 -1
  12. package/dist/model-context/frame/host.js.map +1 -1
  13. package/dist/model-context/frame/provider.js.map +1 -1
  14. package/dist/model-context/frame/types.js.map +1 -1
  15. package/dist/model-context/registry.js.map +1 -1
  16. package/dist/model-context/tool.js.map +1 -1
  17. package/dist/model-context/types.d.ts +1 -0
  18. package/dist/model-context/types.d.ts.map +1 -1
  19. package/dist/model-context/types.js.map +1 -1
  20. package/dist/react/AssistantProvider.js +7 -1
  21. package/dist/react/AssistantProvider.js.map +1 -1
  22. package/dist/react/AssistantRuntimeProvider.js +18 -6
  23. package/dist/react/AssistantRuntimeProvider.js.map +1 -1
  24. package/dist/react/RuntimeAdapter.d.ts +1 -1
  25. package/dist/react/RuntimeAdapter.d.ts.map +1 -1
  26. package/dist/react/RuntimeAdapter.js +35 -6
  27. package/dist/react/RuntimeAdapter.js.map +1 -1
  28. package/dist/react/adapters/LocalStorageThreadListAdapter.js +29 -7
  29. package/dist/react/adapters/LocalStorageThreadListAdapter.js.map +1 -1
  30. package/dist/react/adapters/TitleGenerationAdapter.js.map +1 -1
  31. package/dist/react/client/DataRenderers.d.ts +1 -8
  32. package/dist/react/client/DataRenderers.d.ts.map +1 -1
  33. package/dist/react/client/DataRenderers.js +56 -36
  34. package/dist/react/client/DataRenderers.js.map +1 -1
  35. package/dist/react/client/Interactables.d.ts +1 -1
  36. package/dist/react/client/Interactables.d.ts.map +1 -1
  37. package/dist/react/client/Interactables.js +71 -70
  38. package/dist/react/client/Interactables.js.map +1 -1
  39. package/dist/react/client/Tools.d.ts +2 -13
  40. package/dist/react/client/Tools.d.ts.map +1 -1
  41. package/dist/react/client/Tools.js +121 -57
  42. package/dist/react/client/Tools.js.map +1 -1
  43. package/dist/react/client/interactable-model-context.js.map +1 -1
  44. package/dist/react/model-context/define-mcp-toolkit.js.map +1 -1
  45. package/dist/react/model-context/define-toolkit.js.map +1 -1
  46. package/dist/react/model-context/external-tool.js.map +1 -1
  47. package/dist/react/model-context/human-tool.js.map +1 -1
  48. package/dist/react/model-context/makeAssistantDataUI.js.map +1 -1
  49. package/dist/react/model-context/makeAssistantTool.js.map +1 -1
  50. package/dist/react/model-context/makeAssistantToolUI.js.map +1 -1
  51. package/dist/react/model-context/provider-tool.js.map +1 -1
  52. package/dist/react/model-context/stub-tool.js.map +1 -1
  53. package/dist/react/model-context/toolbox.js.map +1 -1
  54. package/dist/react/model-context/useAssistantContext.js.map +1 -1
  55. package/dist/react/model-context/useAssistantDataUI.js +27 -8
  56. package/dist/react/model-context/useAssistantDataUI.js.map +1 -1
  57. package/dist/react/model-context/useAssistantInstructions.js +33 -10
  58. package/dist/react/model-context/useAssistantInstructions.js.map +1 -1
  59. package/dist/react/model-context/useAssistantInteractable.js.map +1 -1
  60. package/dist/react/model-context/useAssistantTool.js +59 -17
  61. package/dist/react/model-context/useAssistantTool.js.map +1 -1
  62. package/dist/react/model-context/useAssistantToolUI.js +30 -9
  63. package/dist/react/model-context/useAssistantToolUI.js.map +1 -1
  64. package/dist/react/model-context/useAuiToolOverrides.js.map +1 -1
  65. package/dist/react/model-context/useInlineRender.js +35 -8
  66. package/dist/react/model-context/useInlineRender.js.map +1 -1
  67. package/dist/react/model-context/useInteractableState.js +65 -19
  68. package/dist/react/model-context/useInteractableState.js.map +1 -1
  69. package/dist/react/model-context/useToolArgsStatus.js +42 -14
  70. package/dist/react/model-context/useToolArgsStatus.js.map +1 -1
  71. package/dist/react/primitive-hooks/useActionBarCopy.js +59 -22
  72. package/dist/react/primitive-hooks/useActionBarCopy.js.map +1 -1
  73. package/dist/react/primitive-hooks/useActionBarEdit.js +25 -7
  74. package/dist/react/primitive-hooks/useActionBarEdit.js.map +1 -1
  75. package/dist/react/primitive-hooks/useActionBarFeedback.js +49 -13
  76. package/dist/react/primitive-hooks/useActionBarFeedback.js.map +1 -1
  77. package/dist/react/primitive-hooks/useActionBarReload.js +25 -7
  78. package/dist/react/primitive-hooks/useActionBarReload.js.map +1 -1
  79. package/dist/react/primitive-hooks/useActionBarSpeak.js +28 -9
  80. package/dist/react/primitive-hooks/useActionBarSpeak.js.map +1 -1
  81. package/dist/react/primitive-hooks/useActionBarStopSpeaking.js +25 -7
  82. package/dist/react/primitive-hooks/useActionBarStopSpeaking.js.map +1 -1
  83. package/dist/react/primitive-hooks/useBranchPickerNext.js +27 -11
  84. package/dist/react/primitive-hooks/useBranchPickerNext.js.map +1 -1
  85. package/dist/react/primitive-hooks/useBranchPickerPrevious.js +27 -11
  86. package/dist/react/primitive-hooks/useBranchPickerPrevious.js.map +1 -1
  87. package/dist/react/primitive-hooks/useComposerAddAttachment.js +24 -8
  88. package/dist/react/primitive-hooks/useComposerAddAttachment.js.map +1 -1
  89. package/dist/react/primitive-hooks/useComposerCancel.js +25 -7
  90. package/dist/react/primitive-hooks/useComposerCancel.js.map +1 -1
  91. package/dist/react/primitive-hooks/useComposerDictate.js +25 -7
  92. package/dist/react/primitive-hooks/useComposerDictate.js.map +1 -1
  93. package/dist/react/primitive-hooks/useComposerSend.js +25 -7
  94. package/dist/react/primitive-hooks/useComposerSend.js.map +1 -1
  95. package/dist/react/primitive-hooks/useEditComposerCancel.js +18 -4
  96. package/dist/react/primitive-hooks/useEditComposerCancel.js.map +1 -1
  97. package/dist/react/primitive-hooks/useEditComposerSend.js +25 -7
  98. package/dist/react/primitive-hooks/useEditComposerSend.js.map +1 -1
  99. package/dist/react/primitive-hooks/useMessageBranching.js +41 -9
  100. package/dist/react/primitive-hooks/useMessageBranching.js.map +1 -1
  101. package/dist/react/primitive-hooks/useMessageError.js +4 -1
  102. package/dist/react/primitive-hooks/useMessageError.js.map +1 -1
  103. package/dist/react/primitive-hooks/useMessageReload.js +25 -7
  104. package/dist/react/primitive-hooks/useMessageReload.js.map +1 -1
  105. package/dist/react/primitive-hooks/useSuggestionTrigger.js +31 -13
  106. package/dist/react/primitive-hooks/useSuggestionTrigger.js.map +1 -1
  107. package/dist/react/primitive-hooks/useThreadIsEmpty.js +4 -1
  108. package/dist/react/primitive-hooks/useThreadIsEmpty.js.map +1 -1
  109. package/dist/react/primitive-hooks/useThreadIsRunning.js +4 -1
  110. package/dist/react/primitive-hooks/useThreadIsRunning.js.map +1 -1
  111. package/dist/react/primitive-hooks/useThreadListItemArchive.js +18 -4
  112. package/dist/react/primitive-hooks/useThreadListItemArchive.js.map +1 -1
  113. package/dist/react/primitive-hooks/useThreadListItemDelete.js +18 -4
  114. package/dist/react/primitive-hooks/useThreadListItemDelete.js.map +1 -1
  115. package/dist/react/primitive-hooks/useThreadListItemTrigger.js +18 -4
  116. package/dist/react/primitive-hooks/useThreadListItemTrigger.js.map +1 -1
  117. package/dist/react/primitive-hooks/useThreadListItemUnarchive.js +18 -4
  118. package/dist/react/primitive-hooks/useThreadListItemUnarchive.js.map +1 -1
  119. package/dist/react/primitive-hooks/useThreadListLoadMore.js +25 -7
  120. package/dist/react/primitive-hooks/useThreadListLoadMore.js.map +1 -1
  121. package/dist/react/primitive-hooks/useThreadListNew.js +18 -4
  122. package/dist/react/primitive-hooks/useThreadListNew.js.map +1 -1
  123. package/dist/react/primitive-hooks/useThreadMessages.js +4 -1
  124. package/dist/react/primitive-hooks/useThreadMessages.js.map +1 -1
  125. package/dist/react/primitive-hooks/useVoice.js +63 -13
  126. package/dist/react/primitive-hooks/useVoice.js.map +1 -1
  127. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js +42 -7
  128. package/dist/react/primitives/chainOfThought/ChainOfThoughtParts.js.map +1 -1
  129. package/dist/react/primitives/composer/ComposerAttachments.js +67 -16
  130. package/dist/react/primitives/composer/ComposerAttachments.js.map +1 -1
  131. package/dist/react/primitives/composer/ComposerIf.js +30 -9
  132. package/dist/react/primitives/composer/ComposerIf.js.map +1 -1
  133. package/dist/react/primitives/composer/ComposerQueue.js.map +1 -1
  134. package/dist/react/primitives/generativeUI/GenerativeUI.js +55 -13
  135. package/dist/react/primitives/generativeUI/GenerativeUI.js.map +1 -1
  136. package/dist/react/primitives/message/MessageAttachments.js +68 -16
  137. package/dist/react/primitives/message/MessageAttachments.js.map +1 -1
  138. package/dist/react/primitives/message/MessageGroupedParts.d.ts +3 -2
  139. package/dist/react/primitives/message/MessageGroupedParts.d.ts.map +1 -1
  140. package/dist/react/primitives/message/MessageGroupedParts.js +6 -6
  141. package/dist/react/primitives/message/MessageGroupedParts.js.map +1 -1
  142. package/dist/react/primitives/message/MessageParts.d.ts +28 -1
  143. package/dist/react/primitives/message/MessageParts.d.ts.map +1 -1
  144. package/dist/react/primitives/message/MessageParts.js +665 -163
  145. package/dist/react/primitives/message/MessageParts.js.map +1 -1
  146. package/dist/react/primitives/message/MessageQuote.js +18 -2
  147. package/dist/react/primitives/message/MessageQuote.js.map +1 -1
  148. package/dist/react/primitives/messagePart/MessagePartInProgress.js +6 -2
  149. package/dist/react/primitives/messagePart/MessagePartInProgress.js.map +1 -1
  150. package/dist/react/primitives/part/PartMessages.js +46 -14
  151. package/dist/react/primitives/part/PartMessages.js.map +1 -1
  152. package/dist/react/primitives/thread/ThreadMessages.js +67 -10
  153. package/dist/react/primitives/thread/ThreadMessages.js.map +1 -1
  154. package/dist/react/primitives/thread/ThreadSuggestions.js +50 -10
  155. package/dist/react/primitives/thread/ThreadSuggestions.js.map +1 -1
  156. package/dist/react/primitives/threadList/ThreadListItems.js +55 -14
  157. package/dist/react/primitives/threadList/ThreadListItems.js.map +1 -1
  158. package/dist/react/primitives/threadListItem/ThreadListItemTitle.js +15 -2
  159. package/dist/react/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
  160. package/dist/react/providers/AttachmentByIndexProvider.js +57 -12
  161. package/dist/react/providers/AttachmentByIndexProvider.js.map +1 -1
  162. package/dist/react/providers/ChainOfThoughtByIndicesProvider.js +33 -11
  163. package/dist/react/providers/ChainOfThoughtByIndicesProvider.js.map +1 -1
  164. package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js +29 -6
  165. package/dist/react/providers/ChainOfThoughtPartByIndexProvider.js.map +1 -1
  166. package/dist/react/providers/MessageByIndexProvider.js +49 -19
  167. package/dist/react/providers/MessageByIndexProvider.js.map +1 -1
  168. package/dist/react/providers/PartByIndexProvider.js +29 -6
  169. package/dist/react/providers/PartByIndexProvider.js.map +1 -1
  170. package/dist/react/providers/QueueItemByIndexProvider.js +29 -6
  171. package/dist/react/providers/QueueItemByIndexProvider.js.map +1 -1
  172. package/dist/react/providers/ReadonlyThreadProvider.js +83 -28
  173. package/dist/react/providers/ReadonlyThreadProvider.js.map +1 -1
  174. package/dist/react/providers/SuggestionByIndexProvider.js +29 -6
  175. package/dist/react/providers/SuggestionByIndexProvider.js.map +1 -1
  176. package/dist/react/providers/TextMessagePartProvider.d.ts.map +1 -1
  177. package/dist/react/providers/TextMessagePartProvider.js +75 -26
  178. package/dist/react/providers/TextMessagePartProvider.js.map +1 -1
  179. package/dist/react/providers/ThreadListItemByIndexProvider.js +30 -6
  180. package/dist/react/providers/ThreadListItemByIndexProvider.js.map +1 -1
  181. package/dist/react/providers/ThreadListItemRuntimeProvider.js +28 -5
  182. package/dist/react/providers/ThreadListItemRuntimeProvider.js.map +1 -1
  183. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts +2 -0
  184. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.d.ts.map +1 -1
  185. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js +19 -4
  186. package/dist/react/runtimes/RemoteThreadListHookInstanceManager.js.map +1 -1
  187. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts +2 -0
  188. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  189. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js +1 -0
  190. package/dist/react/runtimes/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  191. package/dist/react/runtimes/RuntimeAdapterProvider.js +27 -10
  192. package/dist/react/runtimes/RuntimeAdapterProvider.js.map +1 -1
  193. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
  194. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js +16 -1
  195. package/dist/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
  196. package/dist/react/runtimes/cloud/CloudFileAttachmentAdapter.js.map +1 -1
  197. package/dist/react/runtimes/cloud/auiV0.js.map +1 -1
  198. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.d.ts.map +1 -1
  199. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js +19 -17
  200. package/dist/react/runtimes/cloud/useCloudThreadListAdapter.js.map +1 -1
  201. package/dist/react/runtimes/createMessageConverter.js.map +1 -1
  202. package/dist/react/runtimes/external-message-converter.d.ts.map +1 -1
  203. package/dist/react/runtimes/external-message-converter.js +67 -30
  204. package/dist/react/runtimes/external-message-converter.js.map +1 -1
  205. package/dist/react/runtimes/useExternalStoreRuntime.js +44 -10
  206. package/dist/react/runtimes/useExternalStoreRuntime.js.map +1 -1
  207. package/dist/react/runtimes/useExternalStoreSharedOptions.js +17 -12
  208. package/dist/react/runtimes/useExternalStoreSharedOptions.js.map +1 -1
  209. package/dist/react/runtimes/useLocalRuntime.js.map +1 -1
  210. package/dist/react/runtimes/useRemoteThreadListRuntime.js +34 -6
  211. package/dist/react/runtimes/useRemoteThreadListRuntime.js.map +1 -1
  212. package/dist/react/types/MessagePartComponentTypes.d.ts +5 -6
  213. package/dist/react/types/MessagePartComponentTypes.d.ts.map +1 -1
  214. package/dist/react/utils/getMessageQuote.js.map +1 -1
  215. package/dist/react/utils/groupParts.d.ts +13 -1
  216. package/dist/react/utils/groupParts.d.ts.map +1 -1
  217. package/dist/react/utils/groupParts.js +17 -5
  218. package/dist/react/utils/groupParts.js.map +1 -1
  219. package/dist/runtime/api/assistant-runtime.js.map +1 -1
  220. package/dist/runtime/api/attachment-runtime.js.map +1 -1
  221. package/dist/runtime/api/bindings.d.ts +1 -0
  222. package/dist/runtime/api/bindings.d.ts.map +1 -1
  223. package/dist/runtime/api/composer-runtime.js.map +1 -1
  224. package/dist/runtime/api/message-part-runtime.d.ts +3 -9
  225. package/dist/runtime/api/message-part-runtime.d.ts.map +1 -1
  226. package/dist/runtime/api/message-part-runtime.js +3 -6
  227. package/dist/runtime/api/message-part-runtime.js.map +1 -1
  228. package/dist/runtime/api/message-runtime.d.ts +2 -0
  229. package/dist/runtime/api/message-runtime.d.ts.map +1 -1
  230. package/dist/runtime/api/message-runtime.js +5 -0
  231. package/dist/runtime/api/message-runtime.js.map +1 -1
  232. package/dist/runtime/api/thread-list-item-runtime.js.map +1 -1
  233. package/dist/runtime/api/thread-list-runtime.d.ts.map +1 -1
  234. package/dist/runtime/api/thread-list-runtime.js +1 -0
  235. package/dist/runtime/api/thread-list-runtime.js.map +1 -1
  236. package/dist/runtime/api/thread-runtime.d.ts +3 -0
  237. package/dist/runtime/api/thread-runtime.d.ts.map +1 -1
  238. package/dist/runtime/api/thread-runtime.js +4 -0
  239. package/dist/runtime/api/thread-runtime.js.map +1 -1
  240. package/dist/runtime/base/base-assistant-runtime-core.js.map +1 -1
  241. package/dist/runtime/base/base-composer-runtime-core.js.map +1 -1
  242. package/dist/runtime/base/base-thread-runtime-core.d.ts +1 -0
  243. package/dist/runtime/base/base-thread-runtime-core.d.ts.map +1 -1
  244. package/dist/runtime/base/base-thread-runtime-core.js.map +1 -1
  245. package/dist/runtime/base/default-edit-composer-runtime-core.js.map +1 -1
  246. package/dist/runtime/base/default-thread-composer-runtime-core.js.map +1 -1
  247. package/dist/runtime/branch/external-thread-branch-adapter.d.ts +30 -0
  248. package/dist/runtime/branch/external-thread-branch-adapter.d.ts.map +1 -0
  249. package/dist/runtime/branch/external-thread-branch-adapter.js +0 -0
  250. package/dist/runtime/interfaces/thread-list-runtime-core.d.ts +1 -0
  251. package/dist/runtime/interfaces/thread-list-runtime-core.d.ts.map +1 -1
  252. package/dist/runtime/interfaces/thread-runtime-core.d.ts +4 -1
  253. package/dist/runtime/interfaces/thread-runtime-core.d.ts.map +1 -1
  254. package/dist/runtime/queue/message-queue.js.map +1 -1
  255. package/dist/runtime/utils/auto-status.js.map +1 -1
  256. package/dist/runtime/utils/external-store-message.js.map +1 -1
  257. package/dist/runtime/utils/message-repository.js.map +1 -1
  258. package/dist/runtime/utils/resolveToolApprovalResponse.d.ts +15 -0
  259. package/dist/runtime/utils/resolveToolApprovalResponse.d.ts.map +1 -0
  260. package/dist/runtime/utils/resolveToolApprovalResponse.js +35 -0
  261. package/dist/runtime/utils/resolveToolApprovalResponse.js.map +1 -0
  262. package/dist/runtime/utils/thread-message-like.d.ts +5 -1
  263. package/dist/runtime/utils/thread-message-like.d.ts.map +1 -1
  264. package/dist/runtime/utils/thread-message-like.js.map +1 -1
  265. package/dist/runtimes/assistant-transport/utils.js.map +1 -1
  266. package/dist/runtimes/external-store/external-store-adapter.d.ts +1 -0
  267. package/dist/runtimes/external-store/external-store-adapter.d.ts.map +1 -1
  268. package/dist/runtimes/external-store/external-store-runtime-core.js.map +1 -1
  269. package/dist/runtimes/external-store/external-store-shared-options.js.map +1 -1
  270. package/dist/runtimes/external-store/external-store-thread-list-runtime-core.js.map +1 -1
  271. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts +1 -0
  272. package/dist/runtimes/external-store/external-store-thread-runtime-core.d.ts.map +1 -1
  273. package/dist/runtimes/external-store/external-store-thread-runtime-core.js +13 -0
  274. package/dist/runtimes/external-store/external-store-thread-runtime-core.js.map +1 -1
  275. package/dist/runtimes/external-store/thread-message-converter.js.map +1 -1
  276. package/dist/runtimes/local/local-runtime-core.js.map +1 -1
  277. package/dist/runtimes/local/local-runtime-options.d.ts +1 -1
  278. package/dist/runtimes/local/local-thread-list-runtime-core.js.map +1 -1
  279. package/dist/runtimes/local/local-thread-runtime-core.d.ts +9 -1
  280. package/dist/runtimes/local/local-thread-runtime-core.d.ts.map +1 -1
  281. package/dist/runtimes/local/local-thread-runtime-core.js +65 -5
  282. package/dist/runtimes/local/local-thread-runtime-core.js.map +1 -1
  283. package/dist/runtimes/local/should-continue.js +4 -2
  284. package/dist/runtimes/local/should-continue.js.map +1 -1
  285. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts +2 -0
  286. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.d.ts.map +1 -1
  287. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js +4 -0
  288. package/dist/runtimes/readonly/ReadonlyThreadRuntimeCore.js.map +1 -1
  289. package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
  290. package/dist/runtimes/remote-thread-list/empty-thread-core.d.ts.map +1 -1
  291. package/dist/runtimes/remote-thread-list/empty-thread-core.js +4 -0
  292. package/dist/runtimes/remote-thread-list/empty-thread-core.js.map +1 -1
  293. package/dist/runtimes/remote-thread-list/optimistic-state.js.map +1 -1
  294. package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts +1 -0
  295. package/dist/runtimes/remote-thread-list/remote-thread-state.d.ts.map +1 -1
  296. package/dist/runtimes/remote-thread-list/remote-thread-state.js +1 -0
  297. package/dist/runtimes/remote-thread-list/remote-thread-state.js.map +1 -1
  298. package/dist/runtimes/remote-thread-list/types.d.ts +1 -0
  299. package/dist/runtimes/remote-thread-list/types.d.ts.map +1 -1
  300. package/dist/runtimes/tool-invocations/ToolInvocationTracker.js.map +1 -1
  301. package/dist/store/clients/chain-of-thought-client.d.ts +2 -7
  302. package/dist/store/clients/chain-of-thought-client.d.ts.map +1 -1
  303. package/dist/store/clients/chain-of-thought-client.js +39 -20
  304. package/dist/store/clients/chain-of-thought-client.js.map +1 -1
  305. package/dist/store/clients/model-context-client.d.ts +1 -1
  306. package/dist/store/clients/model-context-client.d.ts.map +1 -1
  307. package/dist/store/clients/model-context-client.js +67 -16
  308. package/dist/store/clients/model-context-client.js.map +1 -1
  309. package/dist/store/clients/no-op-composer-client.d.ts +2 -4
  310. package/dist/store/clients/no-op-composer-client.d.ts.map +1 -1
  311. package/dist/store/clients/no-op-composer-client.js +96 -54
  312. package/dist/store/clients/no-op-composer-client.js.map +1 -1
  313. package/dist/store/clients/runtime-adapter.d.ts +1 -3
  314. package/dist/store/clients/runtime-adapter.d.ts.map +1 -1
  315. package/dist/store/clients/runtime-adapter.js +2 -15
  316. package/dist/store/clients/runtime-adapter.js.map +1 -1
  317. package/dist/store/clients/suggestions.d.ts +1 -4
  318. package/dist/store/clients/suggestions.d.ts.map +1 -1
  319. package/dist/store/clients/suggestions.js +63 -23
  320. package/dist/store/clients/suggestions.js.map +1 -1
  321. package/dist/store/clients/thread-message-client.d.ts +1 -1
  322. package/dist/store/clients/thread-message-client.d.ts.map +1 -1
  323. package/dist/store/clients/thread-message-client.js +184 -73
  324. package/dist/store/clients/thread-message-client.js.map +1 -1
  325. package/dist/store/internal.d.ts +2 -2
  326. package/dist/store/internal.js +2 -2
  327. package/dist/store/runtime-clients/attachment-runtime-client.d.ts +2 -4
  328. package/dist/store/runtime-clients/attachment-runtime-client.d.ts.map +1 -1
  329. package/dist/store/runtime-clients/attachment-runtime-client.js +31 -7
  330. package/dist/store/runtime-clients/attachment-runtime-client.js.map +1 -1
  331. package/dist/store/runtime-clients/composer-runtime-client.d.ts +2 -10
  332. package/dist/store/runtime-clients/composer-runtime-client.d.ts.map +1 -1
  333. package/dist/store/runtime-clients/composer-runtime-client.js +195 -72
  334. package/dist/store/runtime-clients/composer-runtime-client.js.map +1 -1
  335. package/dist/store/runtime-clients/liveRef.d.ts +7 -0
  336. package/dist/store/runtime-clients/liveRef.d.ts.map +1 -0
  337. package/dist/store/runtime-clients/liveRef.js +8 -0
  338. package/dist/store/runtime-clients/liveRef.js.map +1 -0
  339. package/dist/store/runtime-clients/message-part-runtime-client.d.ts +2 -4
  340. package/dist/store/runtime-clients/message-part-runtime-client.d.ts.map +1 -1
  341. package/dist/store/runtime-clients/message-part-runtime-client.js +49 -9
  342. package/dist/store/runtime-clients/message-part-runtime-client.js.map +1 -1
  343. package/dist/store/runtime-clients/message-runtime-client.d.ts +2 -7
  344. package/dist/store/runtime-clients/message-runtime-client.d.ts.map +1 -1
  345. package/dist/store/runtime-clients/message-runtime-client.js +220 -54
  346. package/dist/store/runtime-clients/message-runtime-client.js.map +1 -1
  347. package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts +2 -4
  348. package/dist/store/runtime-clients/thread-list-item-runtime-client.d.ts.map +1 -1
  349. package/dist/store/runtime-clients/thread-list-item-runtime-client.js +71 -26
  350. package/dist/store/runtime-clients/thread-list-item-runtime-client.js.map +1 -1
  351. package/dist/store/runtime-clients/thread-list-runtime-client.d.ts +2 -5
  352. package/dist/store/runtime-clients/thread-list-runtime-client.d.ts.map +1 -1
  353. package/dist/store/runtime-clients/thread-list-runtime-client.js +141 -36
  354. package/dist/store/runtime-clients/thread-list-runtime-client.js.map +1 -1
  355. package/dist/store/runtime-clients/thread-runtime-client.d.ts +2 -4
  356. package/dist/store/runtime-clients/thread-runtime-client.d.ts.map +1 -1
  357. package/dist/store/runtime-clients/thread-runtime-client.js +196 -72
  358. package/dist/store/runtime-clients/thread-runtime-client.js.map +1 -1
  359. package/dist/store/runtime-clients/useSubscribable.js +2 -9
  360. package/dist/store/runtime-clients/useSubscribable.js.map +1 -1
  361. package/dist/store/scopes/message.d.ts +1 -0
  362. package/dist/store/scopes/message.d.ts.map +1 -1
  363. package/dist/store/scopes/part.d.ts +5 -6
  364. package/dist/store/scopes/part.d.ts.map +1 -1
  365. package/dist/store/scopes/queue-item.js.map +1 -1
  366. package/dist/store/scopes/thread-list-item.d.ts +1 -0
  367. package/dist/store/scopes/thread-list-item.d.ts.map +1 -1
  368. package/dist/store/scopes/thread.d.ts +1 -0
  369. package/dist/store/scopes/thread.d.ts.map +1 -1
  370. package/dist/subscribable/subscribable.js.map +1 -1
  371. package/dist/tests/remote-thread-list-test-helpers.js.map +1 -1
  372. package/dist/types/message.d.ts +38 -5
  373. package/dist/types/message.d.ts.map +1 -1
  374. package/dist/types/message.js.map +1 -1
  375. package/dist/utils/composite-context-provider.js.map +1 -1
  376. package/dist/utils/id.js.map +1 -1
  377. package/dist/utils/json/is-json-equal.js.map +1 -1
  378. package/dist/utils/json/is-json.js.map +1 -1
  379. package/dist/utils/text.js.map +1 -1
  380. package/package.json +6 -6
  381. package/src/adapters/thread-history.ts +2 -0
  382. package/src/index.ts +5 -0
  383. package/src/internal.ts +1 -0
  384. package/src/model-context/types.ts +1 -0
  385. package/src/react/AssistantProvider.tsx +10 -1
  386. package/src/react/RuntimeAdapter.ts +25 -8
  387. package/src/react/client/DataRenderers.ts +42 -45
  388. package/src/react/client/Interactables.ts +261 -261
  389. package/src/react/client/Tools.ts +9 -9
  390. package/src/react/primitives/message/MessageGroupedParts.tsx +19 -7
  391. package/src/react/primitives/message/MessageParts.tsx +64 -13
  392. package/src/react/providers/TextMessagePartProvider.tsx +5 -3
  393. package/src/react/runtimes/RemoteThreadListThreadListRuntimeCore.tsx +1 -0
  394. package/src/react/runtimes/cloud/AssistantCloudThreadHistoryAdapter.ts +11 -0
  395. package/src/react/runtimes/cloud/useCloudThreadListAdapter.tsx +6 -0
  396. package/src/react/runtimes/external-message-converter.ts +3 -1
  397. package/src/react/types/MessagePartComponentTypes.ts +5 -5
  398. package/src/react/utils/groupParts.ts +27 -0
  399. package/src/runtime/api/bindings.ts +1 -0
  400. package/src/runtime/api/message-part-runtime.ts +14 -11
  401. package/src/runtime/api/message-runtime.ts +7 -0
  402. package/src/runtime/api/thread-list-runtime.ts +1 -0
  403. package/src/runtime/api/thread-runtime.ts +7 -0
  404. package/src/runtime/base/base-thread-runtime-core.ts +1 -0
  405. package/src/runtime/branch/external-thread-branch-adapter.ts +26 -0
  406. package/src/runtime/interfaces/thread-list-runtime-core.ts +1 -0
  407. package/src/runtime/interfaces/thread-runtime-core.ts +4 -0
  408. package/src/runtime/utils/resolveToolApprovalResponse.test.ts +91 -0
  409. package/src/runtime/utils/resolveToolApprovalResponse.ts +55 -0
  410. package/src/runtime/utils/thread-message-like.ts +10 -1
  411. package/src/runtimes/external-store/external-store-adapter.ts +1 -0
  412. package/src/runtimes/external-store/external-store-thread-runtime-core.ts +24 -0
  413. package/src/runtimes/local/local-runtime-options.ts +1 -1
  414. package/src/runtimes/local/local-thread-runtime-core.test.ts +370 -0
  415. package/src/runtimes/local/local-thread-runtime-core.ts +113 -7
  416. package/src/runtimes/local/should-continue.ts +24 -13
  417. package/src/runtimes/readonly/ReadonlyThreadRuntimeCore.ts +5 -0
  418. package/src/runtimes/remote-thread-list/empty-thread-core.ts +5 -0
  419. package/src/runtimes/remote-thread-list/remote-thread-state.ts +2 -0
  420. package/src/runtimes/remote-thread-list/types.ts +1 -0
  421. package/src/store/clients/chain-of-thought-client.ts +5 -3
  422. package/src/store/clients/model-context-client.test.ts +5 -4
  423. package/src/store/clients/model-context-client.ts +21 -21
  424. package/src/store/clients/no-op-composer-client.ts +5 -3
  425. package/src/store/clients/runtime-adapter.ts +0 -24
  426. package/src/store/clients/suggestions.ts +12 -23
  427. package/src/store/clients/thread-message-client.ts +42 -40
  428. package/src/store/internal.ts +1 -4
  429. package/src/store/runtime-clients/attachment-runtime-client.ts +14 -14
  430. package/src/store/runtime-clients/composer-runtime-client.ts +48 -45
  431. package/src/store/runtime-clients/liveRef.ts +5 -0
  432. package/src/store/runtime-clients/message-part-runtime-client.ts +5 -3
  433. package/src/store/runtime-clients/message-runtime-client.ts +42 -40
  434. package/src/store/runtime-clients/thread-list-item-runtime-client.ts +5 -3
  435. package/src/store/runtime-clients/thread-list-runtime-client.ts +13 -11
  436. package/src/store/runtime-clients/thread-runtime-client.ts +20 -16
  437. package/src/store/runtime-clients/useSubscribable.ts +2 -10
  438. package/src/store/scopes/message.ts +1 -0
  439. package/src/store/scopes/part.ts +5 -2
  440. package/src/store/scopes/thread-list-item.ts +1 -0
  441. package/src/store/scopes/thread.ts +1 -0
  442. package/src/tests/external-store-thread-runtime-core.test.ts +57 -0
  443. package/src/tests/groupMessageParts.test.ts +84 -0
  444. package/src/tests/groupParts.test.ts +55 -0
  445. package/src/types/message.ts +45 -3
@@ -4,8 +4,9 @@ import { TextMessagePartProvider } from "../../providers/TextMessagePartProvider
4
4
  import { ChainOfThoughtByIndicesProvider } from "../../providers/ChainOfThoughtByIndicesProvider.js";
5
5
  import { getMessageQuote } from "../../utils/getMessageQuote.js";
6
6
  import { GenerativeUIRender } from "../generativeUI/GenerativeUI.js";
7
- import { memo, useMemo } from "@assistant-ui/tap/react-shim";
7
+ import { memo } from "@assistant-ui/tap/react-shim";
8
8
  import { RenderChildrenWithAccessor, useAui, useAuiState } from "@assistant-ui/store";
9
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
9
10
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
11
  import { useShallow } from "zustand/shallow";
11
12
  //#region src/react/primitives/message/MessageParts.tsx
@@ -42,8 +43,10 @@ const createGroupState = (groupType) => {
42
43
  * Groups consecutive tool-call and reasoning message parts into ranges.
43
44
  * Always groups tool calls and reasoning parts, even if there's only one.
44
45
  * When useChainOfThought is true, groups tool-call and reasoning parts together.
46
+ * `partIds[i]` optionally carries a stable identity for part `i`; group
47
+ * ranges derive an `idKey` from their first part's id (first claim wins).
45
48
  */
46
- const groupMessageParts = (messageTypes, useChainOfThought) => {
49
+ const groupMessageParts = (messageTypes, useChainOfThought, partIds) => {
47
50
  const ranges = [];
48
51
  if (useChainOfThought) {
49
52
  const chainOfThoughtGroup = createGroupState("chainOfThoughtGroup");
@@ -82,29 +85,131 @@ const groupMessageParts = (messageTypes, useChainOfThought) => {
82
85
  toolGroup.finalize(messageTypes.length - 1, ranges);
83
86
  reasoningGroup.finalize(messageTypes.length - 1, ranges);
84
87
  }
88
+ if (partIds) {
89
+ const claimed = /* @__PURE__ */ new Set();
90
+ for (const range of ranges) {
91
+ if (range.type === "single") continue;
92
+ const id = partIds[range.startIndex];
93
+ if (id !== void 0 && !claimed.has(id)) {
94
+ claimed.add(id);
95
+ range.idKey = `id:${id}`;
96
+ }
97
+ }
98
+ }
85
99
  return ranges;
86
100
  };
87
101
  const useMessagePartsGroups = (useChainOfThought) => {
88
- const messageTypes = useAuiState(useShallow((s) => s.message.parts.map((c) => c.type)));
89
- return useMemo(() => {
90
- if (messageTypes.length === 0) return [];
91
- return groupMessageParts(messageTypes, useChainOfThought);
92
- }, [messageTypes, useChainOfThought]);
102
+ const $ = c(10);
103
+ const messageTypes = useAuiState(useShallow(_temp2));
104
+ const partIds = useAuiState(useShallow(_temp4));
105
+ let t0;
106
+ bb0: {
107
+ if (messageTypes.length === 0) {
108
+ let t1;
109
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
110
+ t1 = [];
111
+ $[0] = t1;
112
+ } else t1 = $[0];
113
+ let t2;
114
+ if ($[1] !== partIds) {
115
+ t2 = {
116
+ ranges: t1,
117
+ partIds
118
+ };
119
+ $[1] = partIds;
120
+ $[2] = t2;
121
+ } else t2 = $[2];
122
+ t0 = t2;
123
+ break bb0;
124
+ }
125
+ let t1;
126
+ if ($[3] !== messageTypes || $[4] !== partIds || $[5] !== useChainOfThought) {
127
+ t1 = groupMessageParts(messageTypes, useChainOfThought, partIds);
128
+ $[3] = messageTypes;
129
+ $[4] = partIds;
130
+ $[5] = useChainOfThought;
131
+ $[6] = t1;
132
+ } else t1 = $[6];
133
+ let t2;
134
+ if ($[7] !== partIds || $[8] !== t1) {
135
+ t2 = {
136
+ ranges: t1,
137
+ partIds
138
+ };
139
+ $[7] = partIds;
140
+ $[8] = t1;
141
+ $[9] = t2;
142
+ } else t2 = $[9];
143
+ t0 = t2;
144
+ }
145
+ return t0;
93
146
  };
94
- const ToolUIDisplay = ({ Fallback, ...props }) => {
95
- const Render = useAuiState((s) => s.tools.toolUIs[props.toolName]?.[0]?.render ?? Fallback);
147
+ const ToolUIDisplay = (t0) => {
148
+ const $ = c(9);
149
+ let Fallback;
150
+ let props;
151
+ if ($[0] !== t0) {
152
+ ({Fallback, ...props} = t0);
153
+ $[0] = t0;
154
+ $[1] = Fallback;
155
+ $[2] = props;
156
+ } else {
157
+ Fallback = $[1];
158
+ props = $[2];
159
+ }
160
+ let t1;
161
+ if ($[3] !== Fallback || $[4] !== props.toolName) {
162
+ t1 = (s) => s.tools.toolUIs[props.toolName]?.[0]?.render ?? Fallback;
163
+ $[3] = Fallback;
164
+ $[4] = props.toolName;
165
+ $[5] = t1;
166
+ } else t1 = $[5];
167
+ const Render = useAuiState(t1);
96
168
  if (!Render) return null;
97
- return /* @__PURE__ */ jsx(Render, { ...props });
169
+ let t2;
170
+ if ($[6] !== Render || $[7] !== props) {
171
+ t2 = /* @__PURE__ */ jsx(Render, { ...props });
172
+ $[6] = Render;
173
+ $[7] = props;
174
+ $[8] = t2;
175
+ } else t2 = $[8];
176
+ return t2;
98
177
  };
99
178
  const getDataRenderer = (dataRenderers, name, inlineFallback) => {
100
179
  const named = dataRenderers.renderers[name]?.[0];
101
180
  if (named) return named;
102
181
  return dataRenderers.fallbacks[0] ?? inlineFallback;
103
182
  };
104
- const DataUIDisplay = ({ Fallback, ...props }) => {
105
- const Render = useAuiState((s) => getDataRenderer(s.dataRenderers, props.name, Fallback));
183
+ const DataUIDisplay = (t0) => {
184
+ const $ = c(9);
185
+ let Fallback;
186
+ let props;
187
+ if ($[0] !== t0) {
188
+ ({Fallback, ...props} = t0);
189
+ $[0] = t0;
190
+ $[1] = Fallback;
191
+ $[2] = props;
192
+ } else {
193
+ Fallback = $[1];
194
+ props = $[2];
195
+ }
196
+ let t1;
197
+ if ($[3] !== Fallback || $[4] !== props.name) {
198
+ t1 = (s) => getDataRenderer(s.dataRenderers, props.name, Fallback);
199
+ $[3] = Fallback;
200
+ $[4] = props.name;
201
+ $[5] = t1;
202
+ } else t1 = $[5];
203
+ const Render = useAuiState(t1);
106
204
  if (!Render) return null;
107
- return /* @__PURE__ */ jsx(Render, { ...props });
205
+ let t2;
206
+ if ($[6] !== Render || $[7] !== props) {
207
+ t2 = /* @__PURE__ */ jsx(Render, { ...props });
208
+ $[6] = Render;
209
+ $[7] = props;
210
+ $[8] = t2;
211
+ } else t2 = $[8];
212
+ return t2;
108
213
  };
109
214
  /**
110
215
  * Platform-agnostic no-op default components.
@@ -120,54 +225,187 @@ const defaultComponents = {
120
225
  ToolGroup: ({ children }) => children,
121
226
  ReasoningGroup: ({ children }) => children
122
227
  };
123
- const MessagePartComponent = ({ components: { Text = defaultComponents.Text, Reasoning = defaultComponents.Reasoning, Image = defaultComponents.Image, Source = defaultComponents.Source, File = defaultComponents.File, Unstable_Audio: Audio = defaultComponents.Unstable_Audio, tools = {}, data, generativeUI } = {} }) => {
228
+ const MessagePartComponent = (t0) => {
229
+ const $ = c(47);
230
+ const { components: t1 } = t0;
231
+ let t2;
232
+ if ($[0] !== t1) {
233
+ t2 = t1 === void 0 ? {} : t1;
234
+ $[0] = t1;
235
+ $[1] = t2;
236
+ } else t2 = $[1];
237
+ const { Text: t3, Reasoning: t4, Image: t5, Source: t6, File: t7, Unstable_Audio: t8, tools: t9, data, generativeUI } = t2;
238
+ const Text = t3 === void 0 ? defaultComponents.Text : t3;
239
+ const Reasoning = t4 === void 0 ? defaultComponents.Reasoning : t4;
240
+ const Image = t5 === void 0 ? defaultComponents.Image : t5;
241
+ const Source = t6 === void 0 ? defaultComponents.Source : t6;
242
+ const File = t7 === void 0 ? defaultComponents.File : t7;
243
+ const Audio = t8 === void 0 ? defaultComponents.Unstable_Audio : t8;
244
+ let t10;
245
+ if ($[2] !== t9) {
246
+ t10 = t9 === void 0 ? {} : t9;
247
+ $[2] = t9;
248
+ $[3] = t10;
249
+ } else t10 = $[3];
250
+ const tools = t10;
124
251
  const aui = useAui();
125
- const part = useAuiState((s) => s.part);
252
+ const part = useAuiState(_temp5);
126
253
  const type = part.type;
127
254
  if (type === "tool-call") {
128
- const addResult = aui.part().addToolResult;
129
- const resume = aui.part().resumeToolCall;
130
- const respondToApproval = aui.part().respondToToolApproval;
131
- if ("Override" in tools) return /* @__PURE__ */ jsx(tools.Override, {
132
- ...part,
133
- addResult,
134
- resume,
135
- respondToApproval
136
- });
255
+ let t11;
256
+ if ($[4] !== aui) {
257
+ t11 = aui.part();
258
+ $[4] = aui;
259
+ $[5] = t11;
260
+ } else t11 = $[5];
261
+ const addResult = t11.addToolResult;
262
+ let t12;
263
+ if ($[6] !== aui) {
264
+ t12 = aui.part();
265
+ $[6] = aui;
266
+ $[7] = t12;
267
+ } else t12 = $[7];
268
+ const resume = t12.resumeToolCall;
269
+ let t13;
270
+ if ($[8] !== aui) {
271
+ t13 = aui.part();
272
+ $[8] = aui;
273
+ $[9] = t13;
274
+ } else t13 = $[9];
275
+ const respondToApproval = t13.respondToToolApproval;
276
+ if ("Override" in tools) {
277
+ let t14;
278
+ if ($[10] !== addResult || $[11] !== part || $[12] !== respondToApproval || $[13] !== resume || $[14] !== tools.Override) {
279
+ t14 = /* @__PURE__ */ jsx(tools.Override, {
280
+ ...part,
281
+ addResult,
282
+ resume,
283
+ respondToApproval
284
+ });
285
+ $[10] = addResult;
286
+ $[11] = part;
287
+ $[12] = respondToApproval;
288
+ $[13] = resume;
289
+ $[14] = tools.Override;
290
+ $[15] = t14;
291
+ } else t14 = $[15];
292
+ return t14;
293
+ }
137
294
  const Tool = tools.by_name?.[part.toolName] ?? tools.Fallback;
138
- return /* @__PURE__ */ jsx(ToolUIDisplay, {
139
- ...part,
140
- Fallback: Tool,
141
- addResult,
142
- resume,
143
- respondToApproval
144
- });
295
+ let t14;
296
+ if ($[16] !== Tool || $[17] !== addResult || $[18] !== part || $[19] !== respondToApproval || $[20] !== resume) {
297
+ t14 = /* @__PURE__ */ jsx(ToolUIDisplay, {
298
+ ...part,
299
+ Fallback: Tool,
300
+ addResult,
301
+ resume,
302
+ respondToApproval
303
+ });
304
+ $[16] = Tool;
305
+ $[17] = addResult;
306
+ $[18] = part;
307
+ $[19] = respondToApproval;
308
+ $[20] = resume;
309
+ $[21] = t14;
310
+ } else t14 = $[21];
311
+ return t14;
145
312
  }
146
313
  if (part.status?.type === "requires-action") throw new Error("Encountered unexpected requires-action status");
147
314
  switch (type) {
148
- case "text": return /* @__PURE__ */ jsx(Text, { ...part });
149
- case "reasoning": return /* @__PURE__ */ jsx(Reasoning, { ...part });
150
- case "source": return /* @__PURE__ */ jsx(Source, { ...part });
151
- case "image": return /* @__PURE__ */ jsx(Image, { ...part });
152
- case "file": return /* @__PURE__ */ jsx(File, { ...part });
153
- case "audio": return /* @__PURE__ */ jsx(Audio, { ...part });
315
+ case "text": {
316
+ let t11;
317
+ if ($[22] !== Text || $[23] !== part) {
318
+ t11 = /* @__PURE__ */ jsx(Text, { ...part });
319
+ $[22] = Text;
320
+ $[23] = part;
321
+ $[24] = t11;
322
+ } else t11 = $[24];
323
+ return t11;
324
+ }
325
+ case "reasoning": {
326
+ let t11;
327
+ if ($[25] !== Reasoning || $[26] !== part) {
328
+ t11 = /* @__PURE__ */ jsx(Reasoning, { ...part });
329
+ $[25] = Reasoning;
330
+ $[26] = part;
331
+ $[27] = t11;
332
+ } else t11 = $[27];
333
+ return t11;
334
+ }
335
+ case "source": {
336
+ let t11;
337
+ if ($[28] !== Source || $[29] !== part) {
338
+ t11 = /* @__PURE__ */ jsx(Source, { ...part });
339
+ $[28] = Source;
340
+ $[29] = part;
341
+ $[30] = t11;
342
+ } else t11 = $[30];
343
+ return t11;
344
+ }
345
+ case "image": {
346
+ let t11;
347
+ if ($[31] !== Image || $[32] !== part) {
348
+ t11 = /* @__PURE__ */ jsx(Image, { ...part });
349
+ $[31] = Image;
350
+ $[32] = part;
351
+ $[33] = t11;
352
+ } else t11 = $[33];
353
+ return t11;
354
+ }
355
+ case "file": {
356
+ let t11;
357
+ if ($[34] !== File || $[35] !== part) {
358
+ t11 = /* @__PURE__ */ jsx(File, { ...part });
359
+ $[34] = File;
360
+ $[35] = part;
361
+ $[36] = t11;
362
+ } else t11 = $[36];
363
+ return t11;
364
+ }
365
+ case "audio": {
366
+ let t11;
367
+ if ($[37] !== Audio || $[38] !== part) {
368
+ t11 = /* @__PURE__ */ jsx(Audio, { ...part });
369
+ $[37] = Audio;
370
+ $[38] = part;
371
+ $[39] = t11;
372
+ } else t11 = $[39];
373
+ return t11;
374
+ }
154
375
  case "data": {
155
376
  const Data = data?.by_name?.[part.name] ?? data?.Fallback;
156
- return /* @__PURE__ */ jsx(DataUIDisplay, {
157
- ...part,
158
- Fallback: Data
159
- });
377
+ let t11;
378
+ if ($[40] !== Data || $[41] !== part) {
379
+ t11 = /* @__PURE__ */ jsx(DataUIDisplay, {
380
+ ...part,
381
+ Fallback: Data
382
+ });
383
+ $[40] = Data;
384
+ $[41] = part;
385
+ $[42] = t11;
386
+ } else t11 = $[42];
387
+ return t11;
160
388
  }
161
- case "generative-ui":
389
+ case "generative-ui": {
162
390
  if (!generativeUI?.components) {
163
391
  if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") console.warn("MessagePrimitive.Parts received a generative-ui part but no `components.generativeUI.components` allowlist was provided. Pass an allowlist or render with <MessagePrimitive.GenerativeUI />.");
164
392
  return null;
165
393
  }
166
- return /* @__PURE__ */ jsx(GenerativeUIRender, {
167
- spec: part.spec,
168
- components: generativeUI.components,
169
- Fallback: generativeUI.Fallback
170
- });
394
+ const t11 = part;
395
+ let t12;
396
+ if ($[43] !== generativeUI.Fallback || $[44] !== generativeUI.components || $[45] !== t11.spec) {
397
+ t12 = /* @__PURE__ */ jsx(GenerativeUIRender, {
398
+ spec: t11.spec,
399
+ components: generativeUI.components,
400
+ Fallback: generativeUI.Fallback
401
+ });
402
+ $[43] = generativeUI.Fallback;
403
+ $[44] = generativeUI.components;
404
+ $[45] = t11.spec;
405
+ $[46] = t12;
406
+ } else t12 = $[46];
407
+ return t12;
408
+ }
171
409
  default:
172
410
  console.warn(`Unknown message part type: ${type}`);
173
411
  return null;
@@ -176,53 +414,128 @@ const MessagePartComponent = ({ components: { Text = defaultComponents.Text, Rea
176
414
  /**
177
415
  * Renders a single message part at the specified index.
178
416
  */
179
- const MessagePrimitivePartByIndex = memo(({ index, components }) => {
180
- return /* @__PURE__ */ jsx(PartByIndexProvider, {
181
- index,
182
- children: /* @__PURE__ */ jsx(MessagePartComponent, { components })
183
- });
417
+ const MessagePrimitivePartByIndex = memo((t0) => {
418
+ const $ = c(5);
419
+ const { index, components } = t0;
420
+ let t1;
421
+ if ($[0] !== components) {
422
+ t1 = /* @__PURE__ */ jsx(MessagePartComponent, { components });
423
+ $[0] = components;
424
+ $[1] = t1;
425
+ } else t1 = $[1];
426
+ let t2;
427
+ if ($[2] !== index || $[3] !== t1) {
428
+ t2 = /* @__PURE__ */ jsx(PartByIndexProvider, {
429
+ index,
430
+ children: t1
431
+ });
432
+ $[2] = index;
433
+ $[3] = t1;
434
+ $[4] = t2;
435
+ } else t2 = $[4];
436
+ return t2;
184
437
  }, (prev, next) => prev.index === next.index && prev.components?.Text === next.components?.Text && prev.components?.Reasoning === next.components?.Reasoning && prev.components?.Source === next.components?.Source && prev.components?.Image === next.components?.Image && prev.components?.File === next.components?.File && prev.components?.Unstable_Audio === next.components?.Unstable_Audio && prev.components?.tools === next.components?.tools && prev.components?.data === next.components?.data && prev.components?.generativeUI === next.components?.generativeUI && prev.components?.ToolGroup === next.components?.ToolGroup && prev.components?.ReasoningGroup === next.components?.ReasoningGroup);
185
438
  MessagePrimitivePartByIndex.displayName = "MessagePrimitive.PartByIndex";
186
- const EmptyPartFallback = ({ status, component: Component }) => {
187
- return /* @__PURE__ */ jsx(TextMessagePartProvider, {
188
- text: "",
189
- isRunning: status.type === "running",
190
- children: /* @__PURE__ */ jsx(Component, {
439
+ const EmptyPartFallback = (t0) => {
440
+ const $ = c(6);
441
+ const { status, component: Component } = t0;
442
+ const t1 = status.type === "running";
443
+ let t2;
444
+ if ($[0] !== Component || $[1] !== status) {
445
+ t2 = /* @__PURE__ */ jsx(Component, {
191
446
  type: "text",
192
447
  text: "",
193
448
  status
194
- })
195
- });
449
+ });
450
+ $[0] = Component;
451
+ $[1] = status;
452
+ $[2] = t2;
453
+ } else t2 = $[2];
454
+ let t3;
455
+ if ($[3] !== t1 || $[4] !== t2) {
456
+ t3 = /* @__PURE__ */ jsx(TextMessagePartProvider, {
457
+ text: "",
458
+ isRunning: t1,
459
+ children: t2
460
+ });
461
+ $[3] = t1;
462
+ $[4] = t2;
463
+ $[5] = t3;
464
+ } else t3 = $[5];
465
+ return t3;
196
466
  };
197
467
  const COMPLETE_STATUS = Object.freeze({ type: "complete" });
198
468
  const RUNNING_STATUS = Object.freeze({ type: "running" });
199
- const EmptyPartsImpl = ({ components }) => {
200
- const status = useAuiState((s) => s.message.status ?? COMPLETE_STATUS);
201
- if (components?.Empty) return /* @__PURE__ */ jsx(components.Empty, { status });
469
+ const EmptyPartsImpl = (t0) => {
470
+ const $ = c(6);
471
+ const { components } = t0;
472
+ const status = useAuiState(_temp6);
473
+ if (components?.Empty) {
474
+ let t1;
475
+ if ($[0] !== components.Empty || $[1] !== status) {
476
+ t1 = /* @__PURE__ */ jsx(components.Empty, { status });
477
+ $[0] = components.Empty;
478
+ $[1] = status;
479
+ $[2] = t1;
480
+ } else t1 = $[2];
481
+ return t1;
482
+ }
202
483
  if (status.type !== "running") return null;
203
- return /* @__PURE__ */ jsx(EmptyPartFallback, {
204
- status,
205
- component: components?.Text ?? defaultComponents.Text
206
- });
484
+ const t1 = components?.Text ?? defaultComponents.Text;
485
+ let t2;
486
+ if ($[3] !== status || $[4] !== t1) {
487
+ t2 = /* @__PURE__ */ jsx(EmptyPartFallback, {
488
+ status,
489
+ component: t1
490
+ });
491
+ $[3] = status;
492
+ $[4] = t1;
493
+ $[5] = t2;
494
+ } else t2 = $[5];
495
+ return t2;
207
496
  };
208
497
  const EmptyParts = memo(EmptyPartsImpl, (prev, next) => prev.components?.Empty === next.components?.Empty && prev.components?.Text === next.components?.Text);
209
- const ConditionalEmptyImpl = ({ components, enabled }) => {
210
- if (!useAuiState((s) => {
211
- if (!enabled) return false;
212
- if (s.message.parts.length === 0) return false;
213
- const lastPart = s.message.parts[s.message.parts.length - 1];
214
- return lastPart?.type !== "text" && lastPart?.type !== "reasoning";
215
- })) return null;
216
- return /* @__PURE__ */ jsx(EmptyParts, { components });
498
+ const ConditionalEmptyImpl = (t0) => {
499
+ const $ = c(4);
500
+ const { components, enabled } = t0;
501
+ let t1;
502
+ if ($[0] !== enabled) {
503
+ t1 = (s) => {
504
+ if (!enabled) return false;
505
+ if (s.message.parts.length === 0) return false;
506
+ const lastPart = s.message.parts[s.message.parts.length - 1];
507
+ return lastPart?.type !== "text" && lastPart?.type !== "reasoning";
508
+ };
509
+ $[0] = enabled;
510
+ $[1] = t1;
511
+ } else t1 = $[1];
512
+ if (!useAuiState(t1)) return null;
513
+ let t2;
514
+ if ($[2] !== components) {
515
+ t2 = /* @__PURE__ */ jsx(EmptyParts, { components });
516
+ $[2] = components;
517
+ $[3] = t2;
518
+ } else t2 = $[3];
519
+ return t2;
217
520
  };
218
521
  const ConditionalEmpty = memo(ConditionalEmptyImpl, (prev, next) => prev.enabled === next.enabled && prev.components?.Empty === next.components?.Empty && prev.components?.Text === next.components?.Text);
219
- const QuoteRendererImpl = ({ Quote }) => {
522
+ const QuoteRendererImpl = (t0) => {
523
+ const $ = c(4);
524
+ const { Quote } = t0;
220
525
  const quoteInfo = useAuiState(getMessageQuote);
221
526
  if (!quoteInfo) return null;
222
- return /* @__PURE__ */ jsx(Quote, {
223
- text: quoteInfo.text,
224
- messageId: quoteInfo.messageId
225
- });
527
+ let t1;
528
+ if ($[0] !== Quote || $[1] !== quoteInfo.messageId || $[2] !== quoteInfo.text) {
529
+ t1 = /* @__PURE__ */ jsx(Quote, {
530
+ text: quoteInfo.text,
531
+ messageId: quoteInfo.messageId
532
+ });
533
+ $[0] = Quote;
534
+ $[1] = quoteInfo.messageId;
535
+ $[2] = quoteInfo.text;
536
+ $[3] = t1;
537
+ } else t1 = $[3];
538
+ return t1;
226
539
  };
227
540
  const QuoteRenderer = memo(QuoteRendererImpl);
228
541
  function resolveToolRender(toolsState, part) {
@@ -236,26 +549,66 @@ function resolveToolRender(toolsState, part) {
236
549
  * current part context. Reads tool registry and part state from context.
237
550
  */
238
551
  const RegisteredToolUI = () => {
552
+ const $ = c(12);
239
553
  const aui = useAui();
240
- const part = useAuiState((s) => s.part);
241
- const Render = useAuiState((s) => s.part.type === "tool-call" ? resolveToolRender(s.tools, s.part) : null);
554
+ const part = useAuiState(_temp7);
555
+ const Render = useAuiState(_temp8);
242
556
  if (!Render || part.type !== "tool-call") return null;
243
- return /* @__PURE__ */ jsx(Render, {
244
- ...part,
245
- addResult: aui.part().addToolResult,
246
- resume: aui.part().resumeToolCall,
247
- respondToApproval: aui.part().respondToToolApproval
248
- });
557
+ let t0;
558
+ if ($[0] !== aui) {
559
+ t0 = aui.part();
560
+ $[0] = aui;
561
+ $[1] = t0;
562
+ } else t0 = $[1];
563
+ const t1 = t0.addToolResult;
564
+ let t2;
565
+ if ($[2] !== aui) {
566
+ t2 = aui.part();
567
+ $[2] = aui;
568
+ $[3] = t2;
569
+ } else t2 = $[3];
570
+ const t3 = t2.resumeToolCall;
571
+ let t4;
572
+ if ($[4] !== aui) {
573
+ t4 = aui.part();
574
+ $[4] = aui;
575
+ $[5] = t4;
576
+ } else t4 = $[5];
577
+ let t5;
578
+ if ($[6] !== Render || $[7] !== part || $[8] !== t0.addToolResult || $[9] !== t2.resumeToolCall || $[10] !== t4.respondToToolApproval) {
579
+ t5 = /* @__PURE__ */ jsx(Render, {
580
+ ...part,
581
+ addResult: t1,
582
+ resume: t3,
583
+ respondToApproval: t4.respondToToolApproval
584
+ });
585
+ $[6] = Render;
586
+ $[7] = part;
587
+ $[8] = t0.addToolResult;
588
+ $[9] = t2.resumeToolCall;
589
+ $[10] = t4.respondToToolApproval;
590
+ $[11] = t5;
591
+ } else t5 = $[11];
592
+ return t5;
249
593
  };
250
594
  /**
251
595
  * Stable propless component that renders the registered data renderer UI
252
596
  * for the current part context.
253
597
  */
254
598
  const RegisteredDataRendererUI = () => {
255
- const part = useAuiState((s) => s.part);
256
- const Render = useAuiState((s) => s.part.type === "data" ? getDataRenderer(s.dataRenderers, s.part.name, void 0) ?? null : null);
599
+ const $ = c(3);
600
+ const part = useAuiState(_temp9);
601
+ const Render = useAuiState(_temp0);
257
602
  if (!Render || part.type !== "data") return null;
258
- return /* @__PURE__ */ jsx(Render, { ...part });
603
+ const t0 = part;
604
+ let t1;
605
+ if ($[0] !== Render || $[1] !== t0) {
606
+ t1 = /* @__PURE__ */ jsx(Render, { ...t0 });
607
+ $[0] = Render;
608
+ $[1] = t0;
609
+ $[2] = t1;
610
+ } else t1 = $[2];
611
+ return t1;
259
612
  };
260
613
  /**
261
614
  * Fallback component rendered when the children render function returns null.
@@ -271,9 +624,24 @@ const RegisteredDataRendererUI = () => {
271
624
  * To explicitly render nothing (suppressing registered UIs), return <></>.
272
625
  */
273
626
  const DefaultPartFallback = () => {
274
- const partType = useAuiState((s) => s.part.type);
275
- if (partType === "tool-call") return /* @__PURE__ */ jsx(RegisteredToolUI, {});
276
- if (partType === "data") return /* @__PURE__ */ jsx(RegisteredDataRendererUI, {});
627
+ const $ = c(2);
628
+ const partType = useAuiState(_temp1);
629
+ if (partType === "tool-call") {
630
+ let t0;
631
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
632
+ t0 = /* @__PURE__ */ jsx(RegisteredToolUI, {});
633
+ $[0] = t0;
634
+ } else t0 = $[0];
635
+ return t0;
636
+ }
637
+ if (partType === "data") {
638
+ let t0;
639
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
640
+ t0 = /* @__PURE__ */ jsx(RegisteredDataRendererUI, {});
641
+ $[1] = t0;
642
+ } else t0 = $[1];
643
+ return t0;
644
+ }
277
645
  return null;
278
646
  };
279
647
  const EMPTY_RUNNING_TEXT_PART = Object.freeze({
@@ -295,7 +663,7 @@ const MessagePartChildren = ({ index, children }) => {
295
663
  return /* @__PURE__ */ jsx(PartByIndexProvider, {
296
664
  index,
297
665
  children: /* @__PURE__ */ jsx(RenderChildrenWithAccessor, {
298
- getItemState: (aui) => aui.message().part({ index }).getState(),
666
+ getItemState: (aui_0) => aui_0.message().part({ index }).getState(),
299
667
  children: (getItem) => children({ get part() {
300
668
  const state = getItem();
301
669
  if (state.type === "tool-call") {
@@ -321,22 +689,49 @@ const MessagePartChildren = ({ index, children }) => {
321
689
  })
322
690
  });
323
691
  };
324
- const MessagePrimitivePartsInner = ({ children }) => {
325
- const contentLength = useAuiState((s) => s.message.parts.length);
326
- const isRunning = useAuiState((s) => (s.message.status?.type ?? "complete") === "running");
692
+ const MessagePrimitivePartsInner = (t0) => {
693
+ const $ = c(9);
694
+ const { children } = t0;
695
+ const contentLength = useAuiState(_temp10);
696
+ const isRunning = useAuiState(_temp11);
327
697
  const isEmptyRunning = contentLength === 0 && isRunning;
328
698
  if (contentLength === 0) {
329
699
  if (!isEmptyRunning) return null;
330
- return /* @__PURE__ */ jsx(TextMessagePartProvider, {
331
- text: "",
332
- isRunning: true,
333
- children: children({ part: EMPTY_RUNNING_TEXT_PART })
334
- });
700
+ let t1;
701
+ if ($[0] !== children) {
702
+ t1 = children({ part: EMPTY_RUNNING_TEXT_PART });
703
+ $[0] = children;
704
+ $[1] = t1;
705
+ } else t1 = $[1];
706
+ let t2;
707
+ if ($[2] !== t1) {
708
+ t2 = /* @__PURE__ */ jsx(TextMessagePartProvider, {
709
+ text: "",
710
+ isRunning: true,
711
+ children: t1
712
+ });
713
+ $[2] = t1;
714
+ $[3] = t2;
715
+ } else t2 = $[3];
716
+ return t2;
335
717
  }
336
- return /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: contentLength }, (_, index) => /* @__PURE__ */ jsx(MessagePartChildren, {
337
- index,
338
- children: (value) => children(value) ?? /* @__PURE__ */ jsx(DefaultPartFallback, {})
339
- }, index)) });
718
+ let t1;
719
+ if ($[4] !== children || $[5] !== contentLength) {
720
+ let t2;
721
+ if ($[7] !== children) {
722
+ t2 = (_, index) => /* @__PURE__ */ jsx(MessagePartChildren, {
723
+ index,
724
+ children: (value) => children(value) ?? /* @__PURE__ */ jsx(DefaultPartFallback, {})
725
+ }, index);
726
+ $[7] = children;
727
+ $[8] = t2;
728
+ } else t2 = $[8];
729
+ t1 = /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: contentLength }, t2) });
730
+ $[4] = children;
731
+ $[5] = contentLength;
732
+ $[6] = t1;
733
+ } else t1 = $[6];
734
+ return t1;
340
735
  };
341
736
  /**
342
737
  * Renders the parts of a message with support for multiple content types.
@@ -344,70 +739,177 @@ const MessagePrimitivePartsInner = ({ children }) => {
344
739
  * This is the platform-agnostic base. Each platform wraps this with its own
345
740
  * default components (web uses `<p>`, `<span>`; RN would use `<Text>`, etc.).
346
741
  */
347
- const MessagePrimitiveParts = ({ components, unstable_showEmptyOnNonTextEnd = true, children }) => {
348
- if (children) return /* @__PURE__ */ jsx(MessagePrimitivePartsInner, { children });
349
- return /* @__PURE__ */ jsx(MessagePrimitivePartsCompat, {
350
- components,
351
- unstable_showEmptyOnNonTextEnd
352
- });
742
+ const MessagePrimitiveParts = (t0) => {
743
+ const $ = c(5);
744
+ const { components, unstable_showEmptyOnNonTextEnd: t1, children } = t0;
745
+ const unstable_showEmptyOnNonTextEnd = t1 === void 0 ? true : t1;
746
+ if (children) {
747
+ let t2;
748
+ if ($[0] !== children) {
749
+ t2 = /* @__PURE__ */ jsx(MessagePrimitivePartsInner, { children });
750
+ $[0] = children;
751
+ $[1] = t2;
752
+ } else t2 = $[1];
753
+ return t2;
754
+ }
755
+ let t2;
756
+ if ($[2] !== components || $[3] !== unstable_showEmptyOnNonTextEnd) {
757
+ t2 = /* @__PURE__ */ jsx(MessagePrimitivePartsCompat, {
758
+ components,
759
+ unstable_showEmptyOnNonTextEnd
760
+ });
761
+ $[2] = components;
762
+ $[3] = unstable_showEmptyOnNonTextEnd;
763
+ $[4] = t2;
764
+ } else t2 = $[4];
765
+ return t2;
353
766
  };
354
767
  MessagePrimitiveParts.displayName = "MessagePrimitive.Parts";
355
- const MessagePrimitivePartsCompat = ({ components, unstable_showEmptyOnNonTextEnd }) => {
356
- const contentLength = useAuiState((s) => s.message.parts.length);
357
- const messageRanges = useMessagePartsGroups(!!components?.ChainOfThought);
358
- const partsElements = useMemo(() => {
359
- if (contentLength === 0) return /* @__PURE__ */ jsx(EmptyParts, { components });
360
- return messageRanges.map((range) => {
361
- if (range.type === "single") return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
362
- index: range.index,
363
- components
364
- }, range.index);
365
- else if (range.type === "chainOfThoughtGroup") {
366
- const ChainOfThoughtComponent = components?.ChainOfThought;
367
- if (!ChainOfThoughtComponent) return null;
368
- return /* @__PURE__ */ jsx(ChainOfThoughtByIndicesProvider, {
768
+ const MessagePrimitivePartsCompat = (t0) => {
769
+ const $ = c(15);
770
+ const { components, unstable_showEmptyOnNonTextEnd } = t0;
771
+ const contentLength = useAuiState(_temp12);
772
+ const { ranges: messageRanges, partIds } = useMessagePartsGroups(!!components?.ChainOfThought);
773
+ let t1;
774
+ bb0: {
775
+ if (contentLength === 0) {
776
+ let t2;
777
+ if ($[0] !== components) {
778
+ t2 = /* @__PURE__ */ jsx(EmptyParts, { components });
779
+ $[0] = components;
780
+ $[1] = t2;
781
+ } else t2 = $[1];
782
+ t1 = t2;
783
+ break bb0;
784
+ }
785
+ let t2;
786
+ if ($[2] !== components || $[3] !== messageRanges || $[4] !== partIds) {
787
+ const claimed = /* @__PURE__ */ new Set();
788
+ const toolLeafKey = (partIndex) => {
789
+ const id = partIds[partIndex];
790
+ if (id !== void 0 && !claimed.has(id)) {
791
+ claimed.add(id);
792
+ return `part-id:${id}`;
793
+ }
794
+ return `part-${partIndex}`;
795
+ };
796
+ t2 = messageRanges.map((range) => {
797
+ if (range.type === "single") return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
798
+ index: range.index,
799
+ components
800
+ }, range.index);
801
+ else if (range.type === "chainOfThoughtGroup") {
802
+ const ChainOfThoughtComponent = components?.ChainOfThought;
803
+ if (!ChainOfThoughtComponent) return null;
804
+ return /* @__PURE__ */ jsx(ChainOfThoughtByIndicesProvider, {
805
+ startIndex: range.startIndex,
806
+ endIndex: range.endIndex,
807
+ children: /* @__PURE__ */ jsx(ChainOfThoughtComponent, {})
808
+ }, `chainOfThought-${range.idKey ?? range.startIndex}`);
809
+ } else if (range.type === "toolGroup") return /* @__PURE__ */ jsx(components?.ToolGroup ?? defaultComponents.ToolGroup, {
369
810
  startIndex: range.startIndex,
370
811
  endIndex: range.endIndex,
371
- children: /* @__PURE__ */ jsx(ChainOfThoughtComponent, {})
372
- }, `chainOfThought-${range.startIndex}`);
373
- } else if (range.type === "toolGroup") return /* @__PURE__ */ jsx(components?.ToolGroup ?? defaultComponents.ToolGroup, {
374
- startIndex: range.startIndex,
375
- endIndex: range.endIndex,
376
- children: Array.from({ length: range.endIndex - range.startIndex + 1 }, (_, i) => {
377
- const partIndex = range.startIndex + i;
378
- return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
379
- index: partIndex,
380
- components
381
- }, `part-${partIndex}`);
382
- })
383
- }, `tool-${range.startIndex}`);
384
- else return /* @__PURE__ */ jsx(components?.ReasoningGroup ?? defaultComponents.ReasoningGroup, {
385
- startIndex: range.startIndex,
386
- endIndex: range.endIndex,
387
- children: Array.from({ length: range.endIndex - range.startIndex + 1 }, (_, i) => {
388
- const partIndex = range.startIndex + i;
389
- return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
390
- index: partIndex,
391
- components
392
- }, `part-${partIndex}`);
393
- })
394
- }, `reasoning-${range.startIndex}`);
395
- });
396
- }, [
397
- messageRanges,
398
- components,
399
- contentLength
400
- ]);
401
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
402
- components?.Quote && /* @__PURE__ */ jsx(QuoteRenderer, { Quote: components.Quote }),
403
- partsElements,
404
- /* @__PURE__ */ jsx(ConditionalEmpty, {
812
+ children: Array.from({ length: range.endIndex - range.startIndex + 1 }, (_, i) => {
813
+ const partIndex_0 = range.startIndex + i;
814
+ return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
815
+ index: partIndex_0,
816
+ components
817
+ }, toolLeafKey(partIndex_0));
818
+ })
819
+ }, `tool-${range.idKey ?? range.startIndex}`);
820
+ else return /* @__PURE__ */ jsx(components?.ReasoningGroup ?? defaultComponents.ReasoningGroup, {
821
+ startIndex: range.startIndex,
822
+ endIndex: range.endIndex,
823
+ children: Array.from({ length: range.endIndex - range.startIndex + 1 }, (__0, i_0) => {
824
+ const partIndex_1 = range.startIndex + i_0;
825
+ return /* @__PURE__ */ jsx(MessagePrimitivePartByIndex, {
826
+ index: partIndex_1,
827
+ components
828
+ }, `part-${partIndex_1}`);
829
+ })
830
+ }, `reasoning-${range.startIndex}`);
831
+ });
832
+ $[2] = components;
833
+ $[3] = messageRanges;
834
+ $[4] = partIds;
835
+ $[5] = t2;
836
+ } else t2 = $[5];
837
+ t1 = t2;
838
+ }
839
+ const partsElements = t1;
840
+ let t2;
841
+ if ($[6] !== components) {
842
+ t2 = components?.Quote && /* @__PURE__ */ jsx(QuoteRenderer, { Quote: components.Quote });
843
+ $[6] = components;
844
+ $[7] = t2;
845
+ } else t2 = $[7];
846
+ let t3;
847
+ if ($[8] !== components || $[9] !== unstable_showEmptyOnNonTextEnd) {
848
+ t3 = /* @__PURE__ */ jsx(ConditionalEmpty, {
405
849
  components,
406
850
  enabled: unstable_showEmptyOnNonTextEnd
407
- })
408
- ] });
851
+ });
852
+ $[8] = components;
853
+ $[9] = unstable_showEmptyOnNonTextEnd;
854
+ $[10] = t3;
855
+ } else t3 = $[10];
856
+ let t4;
857
+ if ($[11] !== partsElements || $[12] !== t2 || $[13] !== t3) {
858
+ t4 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
859
+ t2,
860
+ partsElements,
861
+ t3
862
+ ] });
863
+ $[11] = partsElements;
864
+ $[12] = t2;
865
+ $[13] = t3;
866
+ $[14] = t4;
867
+ } else t4 = $[14];
868
+ return t4;
409
869
  };
870
+ function _temp(c) {
871
+ return c.type;
872
+ }
873
+ function _temp2(s) {
874
+ return s.message.parts.map(_temp);
875
+ }
876
+ function _temp3(c_0) {
877
+ return c_0.type === "tool-call" ? c_0.toolCallId : void 0;
878
+ }
879
+ function _temp4(s_0) {
880
+ return s_0.message.parts.map(_temp3);
881
+ }
882
+ function _temp5(s) {
883
+ return s.part;
884
+ }
885
+ function _temp6(s) {
886
+ return s.message.status ?? COMPLETE_STATUS;
887
+ }
888
+ function _temp7(s) {
889
+ return s.part;
890
+ }
891
+ function _temp8(s_0) {
892
+ return s_0.part.type === "tool-call" ? resolveToolRender(s_0.tools, s_0.part) : null;
893
+ }
894
+ function _temp9(s) {
895
+ return s.part;
896
+ }
897
+ function _temp0(s_0) {
898
+ return s_0.part.type === "data" ? getDataRenderer(s_0.dataRenderers, s_0.part.name, void 0) ?? null : null;
899
+ }
900
+ function _temp1(s) {
901
+ return s.part.type;
902
+ }
903
+ function _temp10(s) {
904
+ return s.message.parts.length;
905
+ }
906
+ function _temp11(s_0) {
907
+ return (s_0.message.status?.type ?? "complete") === "running";
908
+ }
909
+ function _temp12(s) {
910
+ return s.message.parts.length;
911
+ }
410
912
  //#endregion
411
- export { MessagePartChildren, MessagePartComponent, MessagePrimitivePartByIndex, MessagePrimitiveParts, defaultComponents };
913
+ export { MessagePartChildren, MessagePartComponent, MessagePrimitivePartByIndex, MessagePrimitiveParts, defaultComponents, groupMessageParts };
412
914
 
413
915
  //# sourceMappingURL=MessageParts.js.map