@assistant-ui/react 0.8.5 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/dist/api/MessageRuntime.js +1 -1
  2. package/dist/api/MessageRuntime.js.map +1 -1
  3. package/dist/api/MessageRuntime.mjs +1 -1
  4. package/dist/api/MessageRuntime.mjs.map +1 -1
  5. package/dist/api/subscribable/NestedSubscriptionSubject.d.ts.map +1 -1
  6. package/dist/api/subscribable/NestedSubscriptionSubject.js.map +1 -1
  7. package/dist/api/subscribable/NestedSubscriptionSubject.mjs.map +1 -1
  8. package/dist/cloud/auiV0.d.ts.map +1 -1
  9. package/dist/cloud/auiV0.js +9 -2
  10. package/dist/cloud/auiV0.js.map +1 -1
  11. package/dist/cloud/auiV0.mjs +9 -2
  12. package/dist/cloud/auiV0.mjs.map +1 -1
  13. package/dist/context/react/utils/createStateHookForRuntime.d.ts.map +1 -1
  14. package/dist/context/react/utils/createStateHookForRuntime.js.map +1 -1
  15. package/dist/context/react/utils/createStateHookForRuntime.mjs.map +1 -1
  16. package/dist/context/react/utils/ensureBinding.js.map +1 -1
  17. package/dist/context/react/utils/ensureBinding.mjs.map +1 -1
  18. package/dist/model-context/makeAssistantVisible.d.ts.map +1 -1
  19. package/dist/model-context/makeAssistantVisible.js +2 -1
  20. package/dist/model-context/makeAssistantVisible.js.map +1 -1
  21. package/dist/model-context/makeAssistantVisible.mjs +2 -1
  22. package/dist/model-context/makeAssistantVisible.mjs.map +1 -1
  23. package/dist/model-context/useAssistantInstructions.js +1 -1
  24. package/dist/model-context/useAssistantInstructions.js.map +1 -1
  25. package/dist/model-context/useAssistantInstructions.mjs +1 -1
  26. package/dist/model-context/useAssistantInstructions.mjs.map +1 -1
  27. package/dist/model-context/useAssistantToolUI.js +1 -1
  28. package/dist/model-context/useAssistantToolUI.js.map +1 -1
  29. package/dist/model-context/useAssistantToolUI.mjs +1 -1
  30. package/dist/model-context/useAssistantToolUI.mjs.map +1 -1
  31. package/dist/model-context/useInlineRender.d.ts.map +1 -1
  32. package/dist/model-context/useInlineRender.js +8 -5
  33. package/dist/model-context/useInlineRender.js.map +1 -1
  34. package/dist/model-context/useInlineRender.mjs +8 -5
  35. package/dist/model-context/useInlineRender.mjs.map +1 -1
  36. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
  37. package/dist/primitives/assistantModal/AssistantModalRoot.js +6 -1
  38. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  39. package/dist/primitives/assistantModal/AssistantModalRoot.mjs +6 -1
  40. package/dist/primitives/assistantModal/AssistantModalRoot.mjs.map +1 -1
  41. package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
  42. package/dist/primitives/composer/ComposerInput.js +7 -2
  43. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  44. package/dist/primitives/composer/ComposerInput.mjs +7 -2
  45. package/dist/primitives/composer/ComposerInput.mjs.map +1 -1
  46. package/dist/primitives/contentPart/useContentPartFile.d.ts +5 -0
  47. package/dist/primitives/contentPart/useContentPartFile.d.ts.map +1 -0
  48. package/dist/{runtimes/edge/streams/utils/index.js → primitives/contentPart/useContentPartFile.js} +18 -12
  49. package/dist/primitives/contentPart/useContentPartFile.js.map +1 -0
  50. package/dist/primitives/contentPart/useContentPartFile.mjs +18 -0
  51. package/dist/primitives/contentPart/useContentPartFile.mjs.map +1 -0
  52. package/dist/primitives/contentPart/useContentPartSource.d.ts +5 -0
  53. package/dist/primitives/contentPart/useContentPartSource.d.ts.map +1 -0
  54. package/dist/{runtimes/edge/streams/utils/PipeableTransformStream.js → primitives/contentPart/useContentPartSource.js} +18 -16
  55. package/dist/primitives/contentPart/useContentPartSource.js.map +1 -0
  56. package/dist/primitives/contentPart/useContentPartSource.mjs +18 -0
  57. package/dist/primitives/contentPart/useContentPartSource.mjs.map +1 -0
  58. package/dist/primitives/index.d.ts +3 -1
  59. package/dist/primitives/index.d.ts.map +1 -1
  60. package/dist/primitives/index.js +7 -1
  61. package/dist/primitives/index.js.map +1 -1
  62. package/dist/primitives/index.mjs +5 -1
  63. package/dist/primitives/index.mjs.map +1 -1
  64. package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
  65. package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
  66. package/dist/primitives/thread/ThreadScrollToBottom.mjs +4 -1
  67. package/dist/primitives/thread/ThreadScrollToBottom.mjs.map +1 -1
  68. package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
  69. package/dist/primitives/thread/ThreadViewport.js +1 -0
  70. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  71. package/dist/primitives/thread/ThreadViewport.mjs +1 -0
  72. package/dist/primitives/thread/ThreadViewport.mjs.map +1 -1
  73. package/dist/primitives/thread/useThreadViewportAutoScroll.js +1 -1
  74. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  75. package/dist/primitives/thread/useThreadViewportAutoScroll.mjs +1 -1
  76. package/dist/primitives/thread/useThreadViewportAutoScroll.mjs.map +1 -1
  77. package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.d.ts +5 -1
  78. package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.d.ts.map +1 -1
  79. package/dist/runtimes/adapters/thread-history/ThreadHistoryAdapter.js.map +1 -1
  80. package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
  81. package/dist/runtimes/composer/BaseComposerRuntimeCore.js +3 -1
  82. package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
  83. package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +3 -1
  84. package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
  85. package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.d.ts +1 -1
  86. package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.d.ts.map +1 -1
  87. package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.js +2 -2
  88. package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.js.map +1 -1
  89. package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.mjs +2 -2
  90. package/dist/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.mjs.map +1 -1
  91. package/dist/runtimes/edge/EdgeChatAdapter.d.ts +8 -3
  92. package/dist/runtimes/edge/EdgeChatAdapter.d.ts.map +1 -1
  93. package/dist/runtimes/edge/EdgeChatAdapter.js +8 -9
  94. package/dist/runtimes/edge/EdgeChatAdapter.js.map +1 -1
  95. package/dist/runtimes/edge/EdgeChatAdapter.mjs +11 -9
  96. package/dist/runtimes/edge/EdgeChatAdapter.mjs.map +1 -1
  97. package/dist/runtimes/edge/converters/fromLanguageModelMessages.d.ts +2 -2
  98. package/dist/runtimes/edge/converters/fromLanguageModelMessages.d.ts.map +1 -1
  99. package/dist/runtimes/edge/converters/fromLanguageModelMessages.js +5 -2
  100. package/dist/runtimes/edge/converters/fromLanguageModelMessages.js.map +1 -1
  101. package/dist/runtimes/edge/converters/fromLanguageModelMessages.mjs +5 -2
  102. package/dist/runtimes/edge/converters/fromLanguageModelMessages.mjs.map +1 -1
  103. package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
  104. package/dist/runtimes/edge/converters/toCoreMessages.js +1 -1
  105. package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
  106. package/dist/runtimes/edge/converters/toCoreMessages.mjs +1 -1
  107. package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
  108. package/dist/runtimes/edge/converters/toLanguageModelMessages.d.ts.map +1 -1
  109. package/dist/runtimes/edge/converters/toLanguageModelMessages.js +2 -1
  110. package/dist/runtimes/edge/converters/toLanguageModelMessages.js.map +1 -1
  111. package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs +2 -1
  112. package/dist/runtimes/edge/converters/toLanguageModelMessages.mjs.map +1 -1
  113. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts +2 -2
  114. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts.map +1 -1
  115. package/dist/runtimes/edge/createEdgeRuntimeAPI.js +17 -34
  116. package/dist/runtimes/edge/createEdgeRuntimeAPI.js.map +1 -1
  117. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs +21 -37
  118. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs.map +1 -1
  119. package/dist/runtimes/edge/index.d.ts +0 -1
  120. package/dist/runtimes/edge/index.d.ts.map +1 -1
  121. package/dist/runtimes/edge/index.js +1 -3
  122. package/dist/runtimes/edge/index.js.map +1 -1
  123. package/dist/runtimes/edge/index.mjs +0 -1
  124. package/dist/runtimes/edge/index.mjs.map +1 -1
  125. package/dist/runtimes/edge/streams/toolResultStream.d.ts +2 -33
  126. package/dist/runtimes/edge/streams/toolResultStream.d.ts.map +1 -1
  127. package/dist/runtimes/edge/streams/toolResultStream.js +19 -96
  128. package/dist/runtimes/edge/streams/toolResultStream.js.map +1 -1
  129. package/dist/runtimes/edge/streams/toolResultStream.mjs +19 -86
  130. package/dist/runtimes/edge/streams/toolResultStream.mjs.map +1 -1
  131. package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
  132. package/dist/runtimes/external-store/ThreadMessageLike.js +1 -0
  133. package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
  134. package/dist/runtimes/external-store/ThreadMessageLike.mjs +1 -0
  135. package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
  136. package/dist/runtimes/external-store/external-message-converter.js +1 -1
  137. package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
  138. package/dist/runtimes/external-store/external-message-converter.mjs +1 -1
  139. package/dist/runtimes/external-store/external-message-converter.mjs.map +1 -1
  140. package/dist/runtimes/local/ChatModelAdapter.d.ts +2 -2
  141. package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
  142. package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
  143. package/dist/runtimes/local/LocalRuntimeOptions.d.ts +1 -1
  144. package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +3 -2
  145. package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
  146. package/dist/runtimes/local/LocalThreadRuntimeCore.js +22 -7
  147. package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
  148. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +22 -7
  149. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
  150. package/dist/runtimes/local/useLocalRuntime.d.ts.map +1 -1
  151. package/dist/runtimes/local/useLocalRuntime.js +3 -1
  152. package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
  153. package/dist/runtimes/local/useLocalRuntime.mjs +3 -1
  154. package/dist/runtimes/local/useLocalRuntime.mjs.map +1 -1
  155. package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js +1 -1
  156. package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
  157. package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.mjs +1 -1
  158. package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.mjs.map +1 -1
  159. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.d.ts.map +1 -1
  160. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +2 -2
  161. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  162. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs +2 -2
  163. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.mjs.map +1 -1
  164. package/dist/runtimes/remote-thread-list/adapter/cloud.js +1 -1
  165. package/dist/runtimes/remote-thread-list/adapter/cloud.js.map +1 -1
  166. package/dist/runtimes/remote-thread-list/adapter/cloud.mjs +1 -1
  167. package/dist/runtimes/remote-thread-list/adapter/cloud.mjs.map +1 -1
  168. package/dist/runtimes/utils/MessageRepository.d.ts +1 -0
  169. package/dist/runtimes/utils/MessageRepository.d.ts.map +1 -1
  170. package/dist/runtimes/utils/MessageRepository.js +3 -0
  171. package/dist/runtimes/utils/MessageRepository.js.map +1 -1
  172. package/dist/runtimes/utils/MessageRepository.mjs +3 -0
  173. package/dist/runtimes/utils/MessageRepository.mjs.map +1 -1
  174. package/dist/types/AssistantTypes.d.ts +1 -1
  175. package/dist/types/AssistantTypes.d.ts.map +1 -1
  176. package/dist/types/AssistantTypes.js.map +1 -1
  177. package/dist/utils/json/is-json.d.ts +1 -1
  178. package/dist/utils/json/is-json.d.ts.map +1 -1
  179. package/dist/utils/json/is-json.js +10 -4
  180. package/dist/utils/json/is-json.js.map +1 -1
  181. package/dist/utils/json/is-json.mjs +10 -4
  182. package/dist/utils/json/is-json.mjs.map +1 -1
  183. package/package.json +3 -3
  184. package/src/api/MessageRuntime.ts +1 -1
  185. package/src/api/subscribable/NestedSubscriptionSubject.ts +7 -2
  186. package/src/cloud/auiV0.ts +9 -2
  187. package/src/context/react/utils/createStateHookForRuntime.ts +3 -0
  188. package/src/context/react/utils/ensureBinding.ts +1 -1
  189. package/src/model-context/makeAssistantVisible.tsx +3 -1
  190. package/src/model-context/useAssistantInstructions.tsx +1 -1
  191. package/src/model-context/useAssistantToolUI.tsx +1 -1
  192. package/src/model-context/useInlineRender.tsx +8 -5
  193. package/src/primitives/assistantModal/AssistantModalRoot.tsx +6 -1
  194. package/src/primitives/composer/ComposerInput.tsx +7 -2
  195. package/src/primitives/contentPart/useContentPartFile.tsx +18 -0
  196. package/src/primitives/contentPart/useContentPartSource.tsx +18 -0
  197. package/src/primitives/index.ts +3 -1
  198. package/src/primitives/thread/ThreadScrollToBottom.tsx +4 -1
  199. package/src/primitives/thread/ThreadViewport.tsx +3 -0
  200. package/src/primitives/thread/useThreadViewportAutoScroll.tsx +1 -1
  201. package/src/runtimes/adapters/thread-history/ThreadHistoryAdapter.ts +5 -1
  202. package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +3 -1
  203. package/src/runtimes/dangerous-in-browser/DangerousInBrowserAdapter.ts +2 -2
  204. package/src/runtimes/edge/EdgeChatAdapter.ts +26 -15
  205. package/src/runtimes/edge/converters/fromLanguageModelMessages.ts +24 -14
  206. package/src/runtimes/edge/converters/toCoreMessages.ts +6 -2
  207. package/src/runtimes/edge/converters/toLanguageModelMessages.ts +3 -2
  208. package/src/runtimes/edge/createEdgeRuntimeAPI.ts +31 -48
  209. package/src/runtimes/edge/index.ts +0 -2
  210. package/src/runtimes/edge/streams/toolResultStream.ts +28 -152
  211. package/src/runtimes/external-store/ThreadMessageLike.tsx +2 -1
  212. package/src/runtimes/external-store/external-message-converter.tsx +1 -1
  213. package/src/runtimes/local/ChatModelAdapter.tsx +2 -0
  214. package/src/runtimes/local/LocalThreadRuntimeCore.tsx +31 -7
  215. package/src/runtimes/local/useLocalRuntime.tsx +3 -1
  216. package/src/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.tsx +1 -1
  217. package/src/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.tsx +2 -3
  218. package/src/runtimes/remote-thread-list/adapter/cloud.tsx +1 -1
  219. package/src/runtimes/utils/MessageRepository.tsx +4 -0
  220. package/src/types/AssistantTypes.ts +2 -1
  221. package/src/utils/json/is-json.ts +17 -4
  222. package/dist/runtimes/edge/streams/AssistantStreamChunkType.d.ts +0 -62
  223. package/dist/runtimes/edge/streams/AssistantStreamChunkType.d.ts.map +0 -1
  224. package/dist/runtimes/edge/streams/AssistantStreamChunkType.js +0 -46
  225. package/dist/runtimes/edge/streams/AssistantStreamChunkType.js.map +0 -1
  226. package/dist/runtimes/edge/streams/AssistantStreamChunkType.mjs +0 -21
  227. package/dist/runtimes/edge/streams/AssistantStreamChunkType.mjs.map +0 -1
  228. package/dist/runtimes/edge/streams/assistantDecoderStream.d.ts +0 -5
  229. package/dist/runtimes/edge/streams/assistantDecoderStream.d.ts.map +0 -1
  230. package/dist/runtimes/edge/streams/assistantDecoderStream.js +0 -170
  231. package/dist/runtimes/edge/streams/assistantDecoderStream.js.map +0 -1
  232. package/dist/runtimes/edge/streams/assistantDecoderStream.mjs +0 -147
  233. package/dist/runtimes/edge/streams/assistantDecoderStream.mjs.map +0 -1
  234. package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts +0 -5
  235. package/dist/runtimes/edge/streams/assistantEncoderStream.d.ts.map +0 -1
  236. package/dist/runtimes/edge/streams/assistantEncoderStream.js +0 -137
  237. package/dist/runtimes/edge/streams/assistantEncoderStream.js.map +0 -1
  238. package/dist/runtimes/edge/streams/assistantEncoderStream.mjs +0 -114
  239. package/dist/runtimes/edge/streams/assistantEncoderStream.mjs.map +0 -1
  240. package/dist/runtimes/edge/streams/runResultStream.d.ts +0 -4
  241. package/dist/runtimes/edge/streams/runResultStream.d.ts.map +0 -1
  242. package/dist/runtimes/edge/streams/runResultStream.js +0 -313
  243. package/dist/runtimes/edge/streams/runResultStream.js.map +0 -1
  244. package/dist/runtimes/edge/streams/runResultStream.mjs +0 -288
  245. package/dist/runtimes/edge/streams/runResultStream.mjs.map +0 -1
  246. package/dist/runtimes/edge/streams/utils/PipeableTransformStream.d.ts +0 -4
  247. package/dist/runtimes/edge/streams/utils/PipeableTransformStream.d.ts.map +0 -1
  248. package/dist/runtimes/edge/streams/utils/PipeableTransformStream.js.map +0 -1
  249. package/dist/runtimes/edge/streams/utils/PipeableTransformStream.mjs +0 -15
  250. package/dist/runtimes/edge/streams/utils/PipeableTransformStream.mjs.map +0 -1
  251. package/dist/runtimes/edge/streams/utils/StreamPart.d.ts +0 -7
  252. package/dist/runtimes/edge/streams/utils/StreamPart.d.ts.map +0 -1
  253. package/dist/runtimes/edge/streams/utils/StreamPart.js +0 -19
  254. package/dist/runtimes/edge/streams/utils/StreamPart.js.map +0 -1
  255. package/dist/runtimes/edge/streams/utils/StreamPart.mjs +0 -1
  256. package/dist/runtimes/edge/streams/utils/StreamPart.mjs.map +0 -1
  257. package/dist/runtimes/edge/streams/utils/chunkByLineStream.d.ts +0 -2
  258. package/dist/runtimes/edge/streams/utils/chunkByLineStream.d.ts.map +0 -1
  259. package/dist/runtimes/edge/streams/utils/chunkByLineStream.js +0 -48
  260. package/dist/runtimes/edge/streams/utils/chunkByLineStream.js.map +0 -1
  261. package/dist/runtimes/edge/streams/utils/chunkByLineStream.mjs +0 -23
  262. package/dist/runtimes/edge/streams/utils/chunkByLineStream.mjs.map +0 -1
  263. package/dist/runtimes/edge/streams/utils/index.d.ts +0 -14
  264. package/dist/runtimes/edge/streams/utils/index.d.ts.map +0 -1
  265. package/dist/runtimes/edge/streams/utils/index.js.map +0 -1
  266. package/dist/runtimes/edge/streams/utils/index.mjs +0 -11
  267. package/dist/runtimes/edge/streams/utils/index.mjs.map +0 -1
  268. package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.d.ts +0 -4
  269. package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.d.ts.map +0 -1
  270. package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.js +0 -50
  271. package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.js.map +0 -1
  272. package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.mjs +0 -25
  273. package/dist/runtimes/edge/streams/utils/streamPartDecoderStream.mjs.map +0 -1
  274. package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.d.ts +0 -3
  275. package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.d.ts.map +0 -1
  276. package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.js +0 -48
  277. package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.js.map +0 -1
  278. package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.mjs +0 -23
  279. package/dist/runtimes/edge/streams/utils/streamPartEncoderStream.mjs.map +0 -1
  280. package/src/runtimes/edge/streams/AssistantStreamChunkType.ts +0 -73
  281. package/src/runtimes/edge/streams/assistantDecoderStream.ts +0 -170
  282. package/src/runtimes/edge/streams/assistantEncoderStream.ts +0 -126
  283. package/src/runtimes/edge/streams/runResultStream.ts +0 -360
  284. package/src/runtimes/edge/streams/utils/PipeableTransformStream.ts +0 -10
  285. package/src/runtimes/edge/streams/utils/StreamPart.ts +0 -3
  286. package/src/runtimes/edge/streams/utils/chunkByLineStream.ts +0 -24
  287. package/src/runtimes/edge/streams/utils/index.ts +0 -15
  288. package/src/runtimes/edge/streams/utils/streamPartDecoderStream.ts +0 -29
  289. package/src/runtimes/edge/streams/utils/streamPartEncoderStream.ts +0 -23
@@ -30,11 +30,14 @@ var useInlineRender = (toolUI) => {
30
30
  const [useToolUI] = (0, import_react.useState)(() => (0, import_zustand.create)(() => toolUI));
31
31
  (0, import_react.useEffect)(() => {
32
32
  useToolUI.setState(toolUI);
33
- });
34
- return (0, import_react.useCallback)((args) => {
35
- const toolUI2 = useToolUI();
36
- return toolUI2(args);
37
- }, []);
33
+ }, [toolUI, useToolUI]);
34
+ return (0, import_react.useCallback)(
35
+ function ToolUI(args) {
36
+ const toolUI2 = useToolUI();
37
+ return toolUI2(args);
38
+ },
39
+ [useToolUI]
40
+ );
38
41
  };
39
42
  // Annotate the CommonJS export names for ESM import in node:
40
43
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model-context/useInlineRender.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useCallback, useEffect, useState } from \"react\";\nimport { ToolCallContentPartProps } from \"../types\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallContentPartProps<TArgs, TResult>>,\n): FC<ToolCallContentPartProps<TArgs, TResult>> => {\n const [useToolUI] = useState(() => create(() => toolUI));\n\n useEffect(() => {\n useToolUI.setState(toolUI);\n });\n\n return useCallback((args) => {\n const toolUI = useToolUI();\n return toolUI(args);\n }, []);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAqD;AAErD,qBAAuB;AAEhB,IAAM,kBAAkB,CAC7B,WACiD;AACjD,QAAM,CAAC,SAAS,QAAI,uBAAS,UAAM,uBAAO,MAAM,MAAM,CAAC;AAEvD,8BAAU,MAAM;AACd,cAAU,SAAS,MAAM;AAAA,EAC3B,CAAC;AAED,aAAO,0BAAY,CAAC,SAAS;AAC3B,UAAMA,UAAS,UAAU;AACzB,WAAOA,QAAO,IAAI;AAAA,EACpB,GAAG,CAAC,CAAC;AACP;","names":["toolUI"]}
1
+ {"version":3,"sources":["../../src/model-context/useInlineRender.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useCallback, useEffect, useState } from \"react\";\nimport { ToolCallContentPartProps } from \"../types\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallContentPartProps<TArgs, TResult>>,\n): FC<ToolCallContentPartProps<TArgs, TResult>> => {\n const [useToolUI] = useState(() => create(() => toolUI));\n\n useEffect(() => {\n useToolUI.setState(toolUI);\n }, [toolUI, useToolUI]);\n\n return useCallback(\n function ToolUI(args) {\n const toolUI = useToolUI();\n return toolUI(args);\n },\n [useToolUI],\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAqD;AAErD,qBAAuB;AAEhB,IAAM,kBAAkB,CAC7B,WACiD;AACjD,QAAM,CAAC,SAAS,QAAI,uBAAS,UAAM,uBAAO,MAAM,MAAM,CAAC;AAEvD,8BAAU,MAAM;AACd,cAAU,SAAS,MAAM;AAAA,EAC3B,GAAG,CAAC,QAAQ,SAAS,CAAC;AAEtB,aAAO;AAAA,IACL,SAAS,OAAO,MAAM;AACpB,YAAMA,UAAS,UAAU;AACzB,aAAOA,QAAO,IAAI;AAAA,IACpB;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AACF;","names":["toolUI"]}
@@ -7,11 +7,14 @@ var useInlineRender = (toolUI) => {
7
7
  const [useToolUI] = useState(() => create(() => toolUI));
8
8
  useEffect(() => {
9
9
  useToolUI.setState(toolUI);
10
- });
11
- return useCallback((args) => {
12
- const toolUI2 = useToolUI();
13
- return toolUI2(args);
14
- }, []);
10
+ }, [toolUI, useToolUI]);
11
+ return useCallback(
12
+ function ToolUI(args) {
13
+ const toolUI2 = useToolUI();
14
+ return toolUI2(args);
15
+ },
16
+ [useToolUI]
17
+ );
15
18
  };
16
19
  export {
17
20
  useInlineRender
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model-context/useInlineRender.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useCallback, useEffect, useState } from \"react\";\nimport { ToolCallContentPartProps } from \"../types\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallContentPartProps<TArgs, TResult>>,\n): FC<ToolCallContentPartProps<TArgs, TResult>> => {\n const [useToolUI] = useState(() => create(() => toolUI));\n\n useEffect(() => {\n useToolUI.setState(toolUI);\n });\n\n return useCallback((args) => {\n const toolUI = useToolUI();\n return toolUI(args);\n }, []);\n};\n"],"mappings":";;;AAEA,SAAa,aAAa,WAAW,gBAAgB;AAErD,SAAS,cAAc;AAEhB,IAAM,kBAAkB,CAC7B,WACiD;AACjD,QAAM,CAAC,SAAS,IAAI,SAAS,MAAM,OAAO,MAAM,MAAM,CAAC;AAEvD,YAAU,MAAM;AACd,cAAU,SAAS,MAAM;AAAA,EAC3B,CAAC;AAED,SAAO,YAAY,CAAC,SAAS;AAC3B,UAAMA,UAAS,UAAU;AACzB,WAAOA,QAAO,IAAI;AAAA,EACpB,GAAG,CAAC,CAAC;AACP;","names":["toolUI"]}
1
+ {"version":3,"sources":["../../src/model-context/useInlineRender.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useCallback, useEffect, useState } from \"react\";\nimport { ToolCallContentPartProps } from \"../types\";\nimport { create } from \"zustand\";\n\nexport const useInlineRender = <TArgs, TResult>(\n toolUI: FC<ToolCallContentPartProps<TArgs, TResult>>,\n): FC<ToolCallContentPartProps<TArgs, TResult>> => {\n const [useToolUI] = useState(() => create(() => toolUI));\n\n useEffect(() => {\n useToolUI.setState(toolUI);\n }, [toolUI, useToolUI]);\n\n return useCallback(\n function ToolUI(args) {\n const toolUI = useToolUI();\n return toolUI(args);\n },\n [useToolUI],\n );\n};\n"],"mappings":";;;AAEA,SAAa,aAAa,WAAW,gBAAgB;AAErD,SAAS,cAAc;AAEhB,IAAM,kBAAkB,CAC7B,WACiD;AACjD,QAAM,CAAC,SAAS,IAAI,SAAS,MAAM,OAAO,MAAM,MAAM,CAAC;AAEvD,YAAU,MAAM;AACd,cAAU,SAAS,MAAM;AAAA,EAC3B,GAAG,CAAC,QAAQ,SAAS,CAAC;AAEtB,SAAO;AAAA,IACL,SAAS,OAAO,MAAM;AACpB,YAAMA,UAAS,UAAU;AACzB,aAAOA,QAAO,IAAI;AAAA,IACpB;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AACF;","names":["toolUI"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantModalRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAK5D,yBAAiB,2BAA2B,CAAC;IAC3C,KAAY,KAAK,GAAG,gBAAgB,CAAC,YAAY,GAAG;QAClD,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC/C,CAAC;CACH;AAwBD,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,2BAA2B,CAAC,KAAK,CAwBlC,CAAC"}
1
+ {"version":3,"file":"AssistantModalRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAuB,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAK5D,yBAAiB,2BAA2B,CAAC;IAC3C,KAAY,KAAK,GAAG,gBAAgB,CAAC,YAAY,GAAG;QAClD,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAC/C,CAAC;CACH;AA6BD,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,2BAA2B,CAAC,KAAK,CAwBlC,CAAC"}
@@ -52,7 +52,12 @@ var useAssistantModalOpenState = ({
52
52
  return threadRuntime.unstable_on("run-start", () => {
53
53
  setOpen(true);
54
54
  });
55
- }, [unstable_openOnRunStart]);
55
+ }, [
56
+ unstable_openOnRunStart,
57
+ setOpen,
58
+ threadRuntime,
59
+ !unstable_openOnRunStart
60
+ ]);
56
61
  return state;
57
62
  };
58
63
  var AssistantModalPrimitiveRoot = ({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { ScopedProps, usePopoverScope } from \"./scope\";\nimport { useThreadRuntime } from \"../../context\";\n\nexport namespace AssistantModalPrimitiveRoot {\n export type Props = PopoverPrimitive.PopoverProps & {\n unstable_openOnRunStart?: boolean | undefined;\n };\n}\n\nconst useAssistantModalOpenState = ({\n defaultOpen = false,\n unstable_openOnRunStart = true,\n}: {\n defaultOpen?: boolean | undefined;\n unstable_openOnRunStart?: boolean | undefined;\n}) => {\n const state = useState(defaultOpen);\n\n const [, setOpen] = state;\n const threadRuntime = useThreadRuntime();\n useEffect(() => {\n if (!unstable_openOnRunStart) return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", () => {\n setOpen(true);\n });\n }, [unstable_openOnRunStart]);\n\n return state;\n};\n\nexport const AssistantModalPrimitiveRoot: FC<\n AssistantModalPrimitiveRoot.Props\n> = ({\n __scopeAssistantModal,\n defaultOpen,\n unstable_openOnRunStart,\n open,\n onOpenChange,\n ...rest\n}: ScopedProps<AssistantModalPrimitiveRoot.Props>) => {\n const scope = usePopoverScope(__scopeAssistantModal);\n\n const [modalOpen, setOpen] = useAssistantModalOpenState({\n defaultOpen,\n unstable_openOnRunStart,\n });\n\n return (\n <PopoverPrimitive.Root\n {...scope}\n open={open === undefined ? modalOpen : open}\n onOpenChange={composeEventHandlers(onOpenChange, setOpen)}\n {...rest}\n />\n );\n};\n\nAssistantModalPrimitiveRoot.displayName = \"AssistantModalPrimitive.Root\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAwC;AACxC,uBAAkC;AAClC,uBAAqC;AACrC,mBAA6C;AAC7C,qBAAiC;AAgD7B;AAxCJ,IAAM,6BAA6B,CAAC;AAAA,EAClC,cAAc;AAAA,EACd,0BAA0B;AAC5B,MAGM;AACJ,QAAM,YAAQ,uBAAS,WAAW;AAElC,QAAM,CAAC,EAAE,OAAO,IAAI;AACpB,QAAM,oBAAgB,iCAAiB;AACvC,8BAAU,MAAM;AACd,QAAI,CAAC,wBAAyB,QAAO;AAErC,WAAO,cAAc,YAAY,aAAa,MAAM;AAClD,cAAQ,IAAI;AAAA,IACd,CAAC;AAAA,EACH,GAAG,CAAC,uBAAuB,CAAC;AAE5B,SAAO;AACT;AAEO,IAAM,8BAET,CAAC;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsD;AACpD,QAAM,YAAQ,8BAAgB,qBAAqB;AAEnD,QAAM,CAAC,WAAW,OAAO,IAAI,2BAA2B;AAAA,IACtD;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAkB;AAAA,IAAjB;AAAA,MACE,GAAG;AAAA,MACJ,MAAM,SAAS,SAAY,YAAY;AAAA,MACvC,kBAAc,uCAAqB,cAAc,OAAO;AAAA,MACvD,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,4BAA4B,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { ScopedProps, usePopoverScope } from \"./scope\";\nimport { useThreadRuntime } from \"../../context\";\n\nexport namespace AssistantModalPrimitiveRoot {\n export type Props = PopoverPrimitive.PopoverProps & {\n unstable_openOnRunStart?: boolean | undefined;\n };\n}\n\nconst useAssistantModalOpenState = ({\n defaultOpen = false,\n unstable_openOnRunStart = true,\n}: {\n defaultOpen?: boolean | undefined;\n unstable_openOnRunStart?: boolean | undefined;\n}) => {\n const state = useState(defaultOpen);\n\n const [, setOpen] = state;\n const threadRuntime = useThreadRuntime();\n useEffect(() => {\n if (!unstable_openOnRunStart) return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", () => {\n setOpen(true);\n });\n }, [\n unstable_openOnRunStart,\n setOpen,\n threadRuntime,\n !unstable_openOnRunStart,\n ]);\n\n return state;\n};\n\nexport const AssistantModalPrimitiveRoot: FC<\n AssistantModalPrimitiveRoot.Props\n> = ({\n __scopeAssistantModal,\n defaultOpen,\n unstable_openOnRunStart,\n open,\n onOpenChange,\n ...rest\n}: ScopedProps<AssistantModalPrimitiveRoot.Props>) => {\n const scope = usePopoverScope(__scopeAssistantModal);\n\n const [modalOpen, setOpen] = useAssistantModalOpenState({\n defaultOpen,\n unstable_openOnRunStart,\n });\n\n return (\n <PopoverPrimitive.Root\n {...scope}\n open={open === undefined ? modalOpen : open}\n onOpenChange={composeEventHandlers(onOpenChange, setOpen)}\n {...rest}\n />\n );\n};\n\nAssistantModalPrimitiveRoot.displayName = \"AssistantModalPrimitive.Root\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAwC;AACxC,uBAAkC;AAClC,uBAAqC;AACrC,mBAA6C;AAC7C,qBAAiC;AAqD7B;AA7CJ,IAAM,6BAA6B,CAAC;AAAA,EAClC,cAAc;AAAA,EACd,0BAA0B;AAC5B,MAGM;AACJ,QAAM,YAAQ,uBAAS,WAAW;AAElC,QAAM,CAAC,EAAE,OAAO,IAAI;AACpB,QAAM,oBAAgB,iCAAiB;AACvC,8BAAU,MAAM;AACd,QAAI,CAAC,wBAAyB,QAAO;AAErC,WAAO,cAAc,YAAY,aAAa,MAAM;AAClD,cAAQ,IAAI;AAAA,IACd,CAAC;AAAA,EACH,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;AAEO,IAAM,8BAET,CAAC;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsD;AACpD,QAAM,YAAQ,8BAAgB,qBAAqB;AAEnD,QAAM,CAAC,WAAW,OAAO,IAAI,2BAA2B;AAAA,IACtD;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAkB;AAAA,IAAjB;AAAA,MACE,GAAG;AAAA,MACJ,MAAM,SAAS,SAAY,YAAY;AAAA,MACvC,kBAAc,uCAAqB,cAAc,OAAO;AAAA,MACvD,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,4BAA4B,cAAc;","names":[]}
@@ -19,7 +19,12 @@ var useAssistantModalOpenState = ({
19
19
  return threadRuntime.unstable_on("run-start", () => {
20
20
  setOpen(true);
21
21
  });
22
- }, [unstable_openOnRunStart]);
22
+ }, [
23
+ unstable_openOnRunStart,
24
+ setOpen,
25
+ threadRuntime,
26
+ !unstable_openOnRunStart
27
+ ]);
23
28
  return state;
24
29
  };
25
30
  var AssistantModalPrimitiveRoot = ({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { ScopedProps, usePopoverScope } from \"./scope\";\nimport { useThreadRuntime } from \"../../context\";\n\nexport namespace AssistantModalPrimitiveRoot {\n export type Props = PopoverPrimitive.PopoverProps & {\n unstable_openOnRunStart?: boolean | undefined;\n };\n}\n\nconst useAssistantModalOpenState = ({\n defaultOpen = false,\n unstable_openOnRunStart = true,\n}: {\n defaultOpen?: boolean | undefined;\n unstable_openOnRunStart?: boolean | undefined;\n}) => {\n const state = useState(defaultOpen);\n\n const [, setOpen] = state;\n const threadRuntime = useThreadRuntime();\n useEffect(() => {\n if (!unstable_openOnRunStart) return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", () => {\n setOpen(true);\n });\n }, [unstable_openOnRunStart]);\n\n return state;\n};\n\nexport const AssistantModalPrimitiveRoot: FC<\n AssistantModalPrimitiveRoot.Props\n> = ({\n __scopeAssistantModal,\n defaultOpen,\n unstable_openOnRunStart,\n open,\n onOpenChange,\n ...rest\n}: ScopedProps<AssistantModalPrimitiveRoot.Props>) => {\n const scope = usePopoverScope(__scopeAssistantModal);\n\n const [modalOpen, setOpen] = useAssistantModalOpenState({\n defaultOpen,\n unstable_openOnRunStart,\n });\n\n return (\n <PopoverPrimitive.Root\n {...scope}\n open={open === undefined ? modalOpen : open}\n onOpenChange={composeEventHandlers(onOpenChange, setOpen)}\n {...rest}\n />\n );\n};\n\nAssistantModalPrimitiveRoot.displayName = \"AssistantModalPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAa,WAAW,gBAAgB;AACxC,YAAY,sBAAsB;AAClC,SAAS,4BAA4B;AACrC,SAAsB,uBAAuB;AAC7C,SAAS,wBAAwB;AAgD7B;AAxCJ,IAAM,6BAA6B,CAAC;AAAA,EAClC,cAAc;AAAA,EACd,0BAA0B;AAC5B,MAGM;AACJ,QAAM,QAAQ,SAAS,WAAW;AAElC,QAAM,CAAC,EAAE,OAAO,IAAI;AACpB,QAAM,gBAAgB,iBAAiB;AACvC,YAAU,MAAM;AACd,QAAI,CAAC,wBAAyB,QAAO;AAErC,WAAO,cAAc,YAAY,aAAa,MAAM;AAClD,cAAQ,IAAI;AAAA,IACd,CAAC;AAAA,EACH,GAAG,CAAC,uBAAuB,CAAC;AAE5B,SAAO;AACT;AAEO,IAAM,8BAET,CAAC;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsD;AACpD,QAAM,QAAQ,gBAAgB,qBAAqB;AAEnD,QAAM,CAAC,WAAW,OAAO,IAAI,2BAA2B;AAAA,IACtD;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAkB;AAAA,IAAjB;AAAA,MACE,GAAG;AAAA,MACJ,MAAM,SAAS,SAAY,YAAY;AAAA,MACvC,cAAc,qBAAqB,cAAc,OAAO;AAAA,MACvD,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,4BAA4B,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/assistantModal/AssistantModalRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { ScopedProps, usePopoverScope } from \"./scope\";\nimport { useThreadRuntime } from \"../../context\";\n\nexport namespace AssistantModalPrimitiveRoot {\n export type Props = PopoverPrimitive.PopoverProps & {\n unstable_openOnRunStart?: boolean | undefined;\n };\n}\n\nconst useAssistantModalOpenState = ({\n defaultOpen = false,\n unstable_openOnRunStart = true,\n}: {\n defaultOpen?: boolean | undefined;\n unstable_openOnRunStart?: boolean | undefined;\n}) => {\n const state = useState(defaultOpen);\n\n const [, setOpen] = state;\n const threadRuntime = useThreadRuntime();\n useEffect(() => {\n if (!unstable_openOnRunStart) return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", () => {\n setOpen(true);\n });\n }, [\n unstable_openOnRunStart,\n setOpen,\n threadRuntime,\n !unstable_openOnRunStart,\n ]);\n\n return state;\n};\n\nexport const AssistantModalPrimitiveRoot: FC<\n AssistantModalPrimitiveRoot.Props\n> = ({\n __scopeAssistantModal,\n defaultOpen,\n unstable_openOnRunStart,\n open,\n onOpenChange,\n ...rest\n}: ScopedProps<AssistantModalPrimitiveRoot.Props>) => {\n const scope = usePopoverScope(__scopeAssistantModal);\n\n const [modalOpen, setOpen] = useAssistantModalOpenState({\n defaultOpen,\n unstable_openOnRunStart,\n });\n\n return (\n <PopoverPrimitive.Root\n {...scope}\n open={open === undefined ? modalOpen : open}\n onOpenChange={composeEventHandlers(onOpenChange, setOpen)}\n {...rest}\n />\n );\n};\n\nAssistantModalPrimitiveRoot.displayName = \"AssistantModalPrimitive.Root\";\n"],"mappings":";;;AAEA,SAAa,WAAW,gBAAgB;AACxC,YAAY,sBAAsB;AAClC,SAAS,4BAA4B;AACrC,SAAsB,uBAAuB;AAC7C,SAAS,wBAAwB;AAqD7B;AA7CJ,IAAM,6BAA6B,CAAC;AAAA,EAClC,cAAc;AAAA,EACd,0BAA0B;AAC5B,MAGM;AACJ,QAAM,QAAQ,SAAS,WAAW;AAElC,QAAM,CAAC,EAAE,OAAO,IAAI;AACpB,QAAM,gBAAgB,iBAAiB;AACvC,YAAU,MAAM;AACd,QAAI,CAAC,wBAAyB,QAAO;AAErC,WAAO,cAAc,YAAY,aAAa,MAAM;AAClD,cAAQ,IAAI;AAAA,IACd,CAAC;AAAA,EACH,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC;AAAA,EACH,CAAC;AAED,SAAO;AACT;AAEO,IAAM,8BAET,CAAC;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAsD;AACpD,QAAM,QAAQ,gBAAgB,qBAAqB;AAEnD,QAAM,CAAC,WAAW,OAAO,IAAI,2BAA2B;AAAA,IACtD;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAkB;AAAA,IAAjB;AAAA,MACE,GAAG;AAAA,MACJ,MAAM,SAAS,SAAY,YAAY;AAAA,MACvC,cAAc,qBAAqB,cAAc,OAAO;AAAA,MACvD,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,4BAA4B,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ComposerInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerInput.tsx"],"names":[],"mappings":"AAYA,OAAyB,EACvB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAUjC,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,qBAAqB,GAAG;QAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC9B,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACpC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACrC,wBAAwB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC/C,8BAA8B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACrD,8BAA8B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACtD,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB;cATrB,OAAO,GAAG,SAAS;oBACb,OAAO,GAAG,SAAS;qBAClB,OAAO,GAAG,SAAS;+BACT,OAAO,GAAG,SAAS;qCACb,OAAO,GAAG,SAAS;qCACnB,OAAO,GAAG,SAAS;uDA+GvD,CAAC"}
1
+ {"version":3,"file":"ComposerInput.d.ts","sourceRoot":"","sources":["../../../src/primitives/composer/ComposerInput.tsx"],"names":[],"mappings":"AAYA,OAAyB,EACvB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAUjC,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,qBAAqB,GAAG;QAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC9B,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACpC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACrC,wBAAwB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC/C,8BAA8B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QACrD,8BAA8B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACtD,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB;cATrB,OAAO,GAAG,SAAS;oBACb,OAAO,GAAG,SAAS;qBAClB,OAAO,GAAG,SAAS;+BACT,OAAO,GAAG,SAAS;qCACb,OAAO,GAAG,SAAS;qCACnB,OAAO,GAAG,SAAS;uDAoHvD,CAAC"}
@@ -105,12 +105,17 @@ var ComposerPrimitiveInput = (0, import_react.forwardRef)(
105
105
  if (composerRuntime.type !== "thread" || !unstable_focusOnRunStart)
106
106
  return void 0;
107
107
  return threadRuntime.unstable_on("run-start", focus);
108
- }, [unstable_focusOnRunStart]);
108
+ }, [unstable_focusOnRunStart, focus, composerRuntime, threadRuntime]);
109
109
  (0, import_react.useEffect)(() => {
110
110
  if (composerRuntime.type !== "thread" || !unstable_focusOnThreadSwitched)
111
111
  return void 0;
112
112
  return threadListItemRuntime.unstable_on("switched-to", focus);
113
- }, [unstable_focusOnThreadSwitched]);
113
+ }, [
114
+ unstable_focusOnThreadSwitched,
115
+ focus,
116
+ composerRuntime,
117
+ threadListItemRuntime
118
+ ]);
114
119
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
115
120
  Component,
116
121
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport {\n useComposer,\n useComposerRuntime,\n} from \"../../context/react/ComposerContext\";\nimport { useThread, useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n export type Props = TextareaAutosizeProps & {\n asChild?: boolean | undefined;\n submitOnEnter?: boolean | undefined;\n cancelOnEscape?: boolean | undefined;\n unstable_focusOnRunStart?: boolean | undefined;\n unstable_focusOnScrollToBottom?: boolean | undefined;\n unstable_focusOnThreadSwitched?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n submitOnEnter = true,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const threadRuntime = useThreadRuntime();\n const composerRuntime = useComposerRuntime();\n\n const value = useComposer((c) => {\n if (!c.isEditing) return \"\";\n return c.text;\n });\n\n const Component = asChild ? Slot : TextareaAutosize;\n\n const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n if (!cancelOnEscape) return;\n\n if (composerRuntime.getState().canCancel) {\n composerRuntime.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled || !submitOnEnter) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n if (e.key === \"Enter\" && e.shiftKey === false) {\n const { isRunning } = threadRuntime.getState();\n\n if (!isRunning) {\n e.preventDefault();\n\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (composerRuntime.type === \"thread\" && unstable_focusOnScrollToBottom) {\n focus();\n }\n });\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnRunStart)\n return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", focus);\n }, [unstable_focusOnRunStart]);\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnThreadSwitched)\n return undefined;\n\n return threadListItemRuntime.unstable_on(\"switched-to\", focus);\n }, [unstable_focusOnThreadSwitched]);\n\n return (\n <Component\n name=\"input\"\n value={value}\n {...rest}\n ref={ref}\n disabled={isDisabled}\n onChange={composeEventHandlers(onChange, (e) => {\n if (!composerRuntime.getState().isEditing) return;\n return composerRuntime.setText(e.target.value);\n })}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyPress)}\n />\n );\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":"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","names":["TextareaAutosize"]}
1
+ {"version":3,"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport {\n useComposer,\n useComposerRuntime,\n} from \"../../context/react/ComposerContext\";\nimport { useThread, useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n export type Props = TextareaAutosizeProps & {\n asChild?: boolean | undefined;\n submitOnEnter?: boolean | undefined;\n cancelOnEscape?: boolean | undefined;\n unstable_focusOnRunStart?: boolean | undefined;\n unstable_focusOnScrollToBottom?: boolean | undefined;\n unstable_focusOnThreadSwitched?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n submitOnEnter = true,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const threadRuntime = useThreadRuntime();\n const composerRuntime = useComposerRuntime();\n\n const value = useComposer((c) => {\n if (!c.isEditing) return \"\";\n return c.text;\n });\n\n const Component = asChild ? Slot : TextareaAutosize;\n\n const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n if (!cancelOnEscape) return;\n\n if (composerRuntime.getState().canCancel) {\n composerRuntime.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled || !submitOnEnter) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n if (e.key === \"Enter\" && e.shiftKey === false) {\n const { isRunning } = threadRuntime.getState();\n\n if (!isRunning) {\n e.preventDefault();\n\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (composerRuntime.type === \"thread\" && unstable_focusOnScrollToBottom) {\n focus();\n }\n });\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnRunStart)\n return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", focus);\n }, [unstable_focusOnRunStart, focus, composerRuntime, threadRuntime]);\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnThreadSwitched)\n return undefined;\n\n return threadListItemRuntime.unstable_on(\"switched-to\", focus);\n }, [\n unstable_focusOnThreadSwitched,\n focus,\n composerRuntime,\n threadListItemRuntime,\n ]);\n\n return (\n <Component\n name=\"input\"\n value={value}\n {...rest}\n ref={ref}\n disabled={isDisabled}\n onChange={composeEventHandlers(onChange, (e) => {\n if (!composerRuntime.getState().isEditing) return;\n return composerRuntime.setText(e.target.value);\n })}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyPress)}\n />\n );\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":"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","names":["TextareaAutosize"]}
@@ -80,12 +80,17 @@ var ComposerPrimitiveInput = forwardRef(
80
80
  if (composerRuntime.type !== "thread" || !unstable_focusOnRunStart)
81
81
  return void 0;
82
82
  return threadRuntime.unstable_on("run-start", focus);
83
- }, [unstable_focusOnRunStart]);
83
+ }, [unstable_focusOnRunStart, focus, composerRuntime, threadRuntime]);
84
84
  useEffect(() => {
85
85
  if (composerRuntime.type !== "thread" || !unstable_focusOnThreadSwitched)
86
86
  return void 0;
87
87
  return threadListItemRuntime.unstable_on("switched-to", focus);
88
- }, [unstable_focusOnThreadSwitched]);
88
+ }, [
89
+ unstable_focusOnThreadSwitched,
90
+ focus,
91
+ composerRuntime,
92
+ threadListItemRuntime
93
+ ]);
89
94
  return /* @__PURE__ */ jsx(
90
95
  Component,
91
96
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport {\n useComposer,\n useComposerRuntime,\n} from \"../../context/react/ComposerContext\";\nimport { useThread, useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n export type Props = TextareaAutosizeProps & {\n asChild?: boolean | undefined;\n submitOnEnter?: boolean | undefined;\n cancelOnEscape?: boolean | undefined;\n unstable_focusOnRunStart?: boolean | undefined;\n unstable_focusOnScrollToBottom?: boolean | undefined;\n unstable_focusOnThreadSwitched?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n submitOnEnter = true,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const threadRuntime = useThreadRuntime();\n const composerRuntime = useComposerRuntime();\n\n const value = useComposer((c) => {\n if (!c.isEditing) return \"\";\n return c.text;\n });\n\n const Component = asChild ? Slot : TextareaAutosize;\n\n const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n if (!cancelOnEscape) return;\n\n if (composerRuntime.getState().canCancel) {\n composerRuntime.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled || !submitOnEnter) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n if (e.key === \"Enter\" && e.shiftKey === false) {\n const { isRunning } = threadRuntime.getState();\n\n if (!isRunning) {\n e.preventDefault();\n\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (composerRuntime.type === \"thread\" && unstable_focusOnScrollToBottom) {\n focus();\n }\n });\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnRunStart)\n return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", focus);\n }, [unstable_focusOnRunStart]);\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnThreadSwitched)\n return undefined;\n\n return threadListItemRuntime.unstable_on(\"switched-to\", focus);\n }, [unstable_focusOnThreadSwitched]);\n\n return (\n <Component\n name=\"input\"\n value={value}\n {...rest}\n ref={ref}\n disabled={isDisabled}\n onChange={composeEventHandlers(onChange, (e) => {\n if (!composerRuntime.getState().isEditing) return;\n return composerRuntime.setText(e.target.value);\n })}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyPress)}\n />\n );\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":"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","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/composer/ComposerInput.tsx"],"sourcesContent":["\"use client\";\n\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport TextareaAutosize, {\n type TextareaAutosizeProps,\n} from \"react-textarea-autosize\";\nimport {\n useComposer,\n useComposerRuntime,\n} from \"../../context/react/ComposerContext\";\nimport { useThread, useThreadRuntime } from \"../../context/react/ThreadContext\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { useOnScrollToBottom } from \"../../utils/hooks/useOnScrollToBottom\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nexport namespace ComposerPrimitiveInput {\n export type Element = HTMLTextAreaElement;\n export type Props = TextareaAutosizeProps & {\n asChild?: boolean | undefined;\n submitOnEnter?: boolean | undefined;\n cancelOnEscape?: boolean | undefined;\n unstable_focusOnRunStart?: boolean | undefined;\n unstable_focusOnScrollToBottom?: boolean | undefined;\n unstable_focusOnThreadSwitched?: boolean | undefined;\n };\n}\n\nexport const ComposerPrimitiveInput = forwardRef<\n ComposerPrimitiveInput.Element,\n ComposerPrimitiveInput.Props\n>(\n (\n {\n autoFocus = false,\n asChild,\n disabled: disabledProp,\n onChange,\n onKeyDown,\n submitOnEnter = true,\n cancelOnEscape = true,\n unstable_focusOnRunStart = true,\n unstable_focusOnScrollToBottom = true,\n unstable_focusOnThreadSwitched = true,\n ...rest\n },\n forwardedRef,\n ) => {\n const threadListItemRuntime = useThreadListItemRuntime();\n const threadRuntime = useThreadRuntime();\n const composerRuntime = useComposerRuntime();\n\n const value = useComposer((c) => {\n if (!c.isEditing) return \"\";\n return c.text;\n });\n\n const Component = asChild ? Slot : TextareaAutosize;\n\n const isDisabled = useThread((t) => t.isDisabled) ?? disabledProp ?? false;\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const ref = useComposedRefs(forwardedRef, textareaRef);\n\n useEscapeKeydown((e) => {\n if (!cancelOnEscape) return;\n\n if (composerRuntime.getState().canCancel) {\n composerRuntime.cancel();\n e.preventDefault();\n }\n });\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (isDisabled || !submitOnEnter) return;\n\n // ignore IME composition events\n if (e.nativeEvent.isComposing) return;\n\n if (e.key === \"Enter\" && e.shiftKey === false) {\n const { isRunning } = threadRuntime.getState();\n\n if (!isRunning) {\n e.preventDefault();\n\n textareaRef.current?.closest(\"form\")?.requestSubmit();\n }\n }\n };\n\n const autoFocusEnabled = autoFocus && !isDisabled;\n const focus = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea || !autoFocusEnabled) return;\n\n textarea.focus({ preventScroll: true });\n textarea.setSelectionRange(textarea.value.length, textarea.value.length);\n }, [autoFocusEnabled]);\n\n useEffect(() => focus(), [focus]);\n\n useOnScrollToBottom(() => {\n if (composerRuntime.type === \"thread\" && unstable_focusOnScrollToBottom) {\n focus();\n }\n });\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnRunStart)\n return undefined;\n\n return threadRuntime.unstable_on(\"run-start\", focus);\n }, [unstable_focusOnRunStart, focus, composerRuntime, threadRuntime]);\n\n useEffect(() => {\n if (composerRuntime.type !== \"thread\" || !unstable_focusOnThreadSwitched)\n return undefined;\n\n return threadListItemRuntime.unstable_on(\"switched-to\", focus);\n }, [\n unstable_focusOnThreadSwitched,\n focus,\n composerRuntime,\n threadListItemRuntime,\n ]);\n\n return (\n <Component\n name=\"input\"\n value={value}\n {...rest}\n ref={ref}\n disabled={isDisabled}\n onChange={composeEventHandlers(onChange, (e) => {\n if (!composerRuntime.getState().isEditing) return;\n return composerRuntime.setText(e.target.value);\n })}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyPress)}\n />\n );\n },\n);\n\nComposerPrimitiveInput.displayName = \"ComposerPrimitive.Input\";\n"],"mappings":"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","names":[]}
@@ -0,0 +1,5 @@
1
+ import { FileContentPart } from "../../types";
2
+ export declare const useContentPartFile: () => FileContentPart & {
3
+ readonly status: import("../../types/AssistantTypes").ContentPartStatus | import("../../types/AssistantTypes").ToolCallContentPartStatus;
4
+ };
5
+ //# sourceMappingURL=useContentPartFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContentPartFile.d.ts","sourceRoot":"","sources":["../../../src/primitives/contentPart/useContentPartFile.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,kBAAkB;;CAW9B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -17,20 +18,25 @@ var __copyProps = (to, from, except, desc) => {
17
18
  };
18
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
20
 
20
- // src/runtimes/edge/streams/utils/index.ts
21
- var utils_exports = {};
22
- __export(utils_exports, {
23
- streamUtils: () => streamUtils
21
+ // src/primitives/contentPart/useContentPartFile.tsx
22
+ var useContentPartFile_exports = {};
23
+ __export(useContentPartFile_exports, {
24
+ useContentPartFile: () => useContentPartFile
24
25
  });
25
- module.exports = __toCommonJS(utils_exports);
26
- var import_streamPartDecoderStream = require("./streamPartDecoderStream.js");
27
- var import_streamPartEncoderStream = require("./streamPartEncoderStream.js");
28
- var streamUtils = {
29
- streamPartEncoderStream: import_streamPartEncoderStream.streamPartEncoderStream,
30
- streamPartDecoderStream: import_streamPartDecoderStream.streamPartDecoderStream
26
+ module.exports = __toCommonJS(useContentPartFile_exports);
27
+ var import_ContentPartContext = require("../../context/react/ContentPartContext.js");
28
+ var useContentPartFile = () => {
29
+ const file = (0, import_ContentPartContext.useContentPart)((c) => {
30
+ if (c.type !== "file")
31
+ throw new Error(
32
+ "ContentPartFile can only be used inside file content parts."
33
+ );
34
+ return c;
35
+ });
36
+ return file;
31
37
  };
32
38
  // Annotate the CommonJS export names for ESM import in node:
33
39
  0 && (module.exports = {
34
- streamUtils
40
+ useContentPartFile
35
41
  });
36
- //# sourceMappingURL=index.js.map
42
+ //# sourceMappingURL=useContentPartFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/contentPart/useContentPartFile.tsx"],"sourcesContent":["\"use client\";\n\nimport { ContentPartState } from \"../../api/ContentPartRuntime\";\nimport { useContentPart } from \"../../context/react/ContentPartContext\";\nimport { FileContentPart } from \"../../types\";\n\nexport const useContentPartFile = () => {\n const file = useContentPart((c) => {\n if (c.type !== \"file\")\n throw new Error(\n \"ContentPartFile can only be used inside file content parts.\",\n );\n\n return c as ContentPartState & FileContentPart;\n });\n\n return file;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAA+B;AAGxB,IAAM,qBAAqB,MAAM;AACtC,QAAM,WAAO,0CAAe,CAAC,MAAM;AACjC,QAAI,EAAE,SAAS;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT;","names":[]}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+
3
+ // src/primitives/contentPart/useContentPartFile.tsx
4
+ import { useContentPart } from "../../context/react/ContentPartContext.mjs";
5
+ var useContentPartFile = () => {
6
+ const file = useContentPart((c) => {
7
+ if (c.type !== "file")
8
+ throw new Error(
9
+ "ContentPartFile can only be used inside file content parts."
10
+ );
11
+ return c;
12
+ });
13
+ return file;
14
+ };
15
+ export {
16
+ useContentPartFile
17
+ };
18
+ //# sourceMappingURL=useContentPartFile.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/contentPart/useContentPartFile.tsx"],"sourcesContent":["\"use client\";\n\nimport { ContentPartState } from \"../../api/ContentPartRuntime\";\nimport { useContentPart } from \"../../context/react/ContentPartContext\";\nimport { FileContentPart } from \"../../types\";\n\nexport const useContentPartFile = () => {\n const file = useContentPart((c) => {\n if (c.type !== \"file\")\n throw new Error(\n \"ContentPartFile can only be used inside file content parts.\",\n );\n\n return c as ContentPartState & FileContentPart;\n });\n\n return file;\n};\n"],"mappings":";;;AAGA,SAAS,sBAAsB;AAGxB,IAAM,qBAAqB,MAAM;AACtC,QAAM,OAAO,eAAe,CAAC,MAAM;AACjC,QAAI,EAAE,SAAS;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT;","names":[]}
@@ -0,0 +1,5 @@
1
+ import { SourceContentPart } from "../../types";
2
+ export declare const useContentPartSource: () => SourceContentPart & {
3
+ readonly status: import("../../types/AssistantTypes").ContentPartStatus | import("../../types/AssistantTypes").ToolCallContentPartStatus;
4
+ };
5
+ //# sourceMappingURL=useContentPartSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContentPartSource.d.ts","sourceRoot":"","sources":["../../../src/primitives/contentPart/useContentPartSource.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,oBAAoB;;CAWhC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -17,24 +18,25 @@ var __copyProps = (to, from, except, desc) => {
17
18
  };
18
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
20
 
20
- // src/runtimes/edge/streams/utils/PipeableTransformStream.ts
21
- var PipeableTransformStream_exports = {};
22
- __export(PipeableTransformStream_exports, {
23
- PipeableTransformStream: () => PipeableTransformStream
21
+ // src/primitives/contentPart/useContentPartSource.tsx
22
+ var useContentPartSource_exports = {};
23
+ __export(useContentPartSource_exports, {
24
+ useContentPartSource: () => useContentPartSource
24
25
  });
25
- module.exports = __toCommonJS(PipeableTransformStream_exports);
26
- var PipeableTransformStream = class extends TransformStream {
27
- constructor(transform) {
28
- super();
29
- const readable = transform(super.readable);
30
- Object.defineProperty(this, "readable", {
31
- value: readable,
32
- writable: false
33
- });
34
- }
26
+ module.exports = __toCommonJS(useContentPartSource_exports);
27
+ var import_ContentPartContext = require("../../context/react/ContentPartContext.js");
28
+ var useContentPartSource = () => {
29
+ const source = (0, import_ContentPartContext.useContentPart)((c) => {
30
+ if (c.type !== "source")
31
+ throw new Error(
32
+ "ContentPartSource can only be used inside source content parts."
33
+ );
34
+ return c;
35
+ });
36
+ return source;
35
37
  };
36
38
  // Annotate the CommonJS export names for ESM import in node:
37
39
  0 && (module.exports = {
38
- PipeableTransformStream
40
+ useContentPartSource
39
41
  });
40
- //# sourceMappingURL=PipeableTransformStream.js.map
42
+ //# sourceMappingURL=useContentPartSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/contentPart/useContentPartSource.tsx"],"sourcesContent":["\"use client\";\n\nimport { ContentPartState } from \"../../api/ContentPartRuntime\";\nimport { useContentPart } from \"../../context/react/ContentPartContext\";\nimport { SourceContentPart } from \"../../types\";\n\nexport const useContentPartSource = () => {\n const source = useContentPart((c) => {\n if (c.type !== \"source\")\n throw new Error(\n \"ContentPartSource can only be used inside source content parts.\",\n );\n\n return c as ContentPartState & SourceContentPart;\n });\n\n return source;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAA+B;AAGxB,IAAM,uBAAuB,MAAM;AACxC,QAAM,aAAS,0CAAe,CAAC,MAAM;AACnC,QAAI,EAAE,SAAS;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT;","names":[]}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+
3
+ // src/primitives/contentPart/useContentPartSource.tsx
4
+ import { useContentPart } from "../../context/react/ContentPartContext.mjs";
5
+ var useContentPartSource = () => {
6
+ const source = useContentPart((c) => {
7
+ if (c.type !== "source")
8
+ throw new Error(
9
+ "ContentPartSource can only be used inside source content parts."
10
+ );
11
+ return c;
12
+ });
13
+ return source;
14
+ };
15
+ export {
16
+ useContentPartSource
17
+ };
18
+ //# sourceMappingURL=useContentPartSource.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/contentPart/useContentPartSource.tsx"],"sourcesContent":["\"use client\";\n\nimport { ContentPartState } from \"../../api/ContentPartRuntime\";\nimport { useContentPart } from \"../../context/react/ContentPartContext\";\nimport { SourceContentPart } from \"../../types\";\n\nexport const useContentPartSource = () => {\n const source = useContentPart((c) => {\n if (c.type !== \"source\")\n throw new Error(\n \"ContentPartSource can only be used inside source content parts.\",\n );\n\n return c as ContentPartState & SourceContentPart;\n });\n\n return source;\n};\n"],"mappings":";;;AAGA,SAAS,sBAAsB;AAGxB,IAAM,uBAAuB,MAAM;AACxC,QAAM,SAAS,eAAe,CAAC,MAAM;AACnC,QAAI,EAAE,SAAS;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAEF,WAAO;AAAA,EACT,CAAC;AAED,SAAO;AACT;","names":[]}
@@ -8,8 +8,10 @@ export * as MessagePrimitive from "./message";
8
8
  export * as ThreadPrimitive from "./thread";
9
9
  export * as ThreadListPrimitive from "./threadList";
10
10
  export * as ThreadListItemPrimitive from "./threadListItem";
11
- export { useContentPartImage } from "./contentPart/useContentPartImage";
12
11
  export { useContentPartText } from "./contentPart/useContentPartText";
13
12
  export { useContentPartReasoning } from "./contentPart/useContentPartReasoning";
13
+ export { useContentPartSource } from "./contentPart/useContentPartSource";
14
+ export { useContentPartFile } from "./contentPart/useContentPartFile";
15
+ export { useContentPartImage } from "./contentPart/useContentPartImage";
14
16
  export { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll";
15
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,qBAAqB,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,iBAAiB,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,oBAAoB,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,eAAe,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,qBAAqB,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,iBAAiB,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,oBAAoB,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,gBAAgB,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,eAAe,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,uBAAuB,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC"}
@@ -40,8 +40,10 @@ __export(primitives_exports, {
40
40
  ThreadListItemPrimitive: () => ThreadListItemPrimitive,
41
41
  ThreadListPrimitive: () => ThreadListPrimitive,
42
42
  ThreadPrimitive: () => ThreadPrimitive,
43
+ useContentPartFile: () => import_useContentPartFile.useContentPartFile,
43
44
  useContentPartImage: () => import_useContentPartImage.useContentPartImage,
44
45
  useContentPartReasoning: () => import_useContentPartReasoning.useContentPartReasoning,
46
+ useContentPartSource: () => import_useContentPartSource.useContentPartSource,
45
47
  useContentPartText: () => import_useContentPartText.useContentPartText,
46
48
  useThreadViewportAutoScroll: () => import_useThreadViewportAutoScroll.useThreadViewportAutoScroll
47
49
  });
@@ -56,9 +58,11 @@ var MessagePrimitive = __toESM(require("./message/index.js"));
56
58
  var ThreadPrimitive = __toESM(require("./thread/index.js"));
57
59
  var ThreadListPrimitive = __toESM(require("./threadList/index.js"));
58
60
  var ThreadListItemPrimitive = __toESM(require("./threadListItem/index.js"));
59
- var import_useContentPartImage = require("./contentPart/useContentPartImage.js");
60
61
  var import_useContentPartText = require("./contentPart/useContentPartText.js");
61
62
  var import_useContentPartReasoning = require("./contentPart/useContentPartReasoning.js");
63
+ var import_useContentPartSource = require("./contentPart/useContentPartSource.js");
64
+ var import_useContentPartFile = require("./contentPart/useContentPartFile.js");
65
+ var import_useContentPartImage = require("./contentPart/useContentPartImage.js");
62
66
  var import_useThreadViewportAutoScroll = require("./thread/useThreadViewportAutoScroll.js");
63
67
  // Annotate the CommonJS export names for ESM import in node:
64
68
  0 && (module.exports = {
@@ -72,8 +76,10 @@ var import_useThreadViewportAutoScroll = require("./thread/useThreadViewportAuto
72
76
  ThreadListItemPrimitive,
73
77
  ThreadListPrimitive,
74
78
  ThreadPrimitive,
79
+ useContentPartFile,
75
80
  useContentPartImage,
76
81
  useContentPartReasoning,
82
+ useContentPartSource,
77
83
  useContentPartText,
78
84
  useThreadViewportAutoScroll
79
85
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\nexport { useContentPartReasoning } from \"./contentPart/useContentPartReasoning\";\nexport { useThreadViewportAutoScroll } from \"./thread/useThreadViewportAutoScroll\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAoC;AACpC,8BAAyC;AACzC,0BAAqC;AACrC,4BAAuC;AACvC,wBAAmC;AACnC,2BAAsC;AACtC,uBAAkC;AAClC,sBAAiC;AACjC,0BAAqC;AACrC,8BAAyC;AAEzC,iCAAoC;AACpC,gCAAmC;AACnC,qCAAwC;AACxC,yCAA4C;","names":[]}
1
+ {"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\nexport { useContentPartReasoning } from \"./contentPart/useContentPartReasoning\";\nexport { useContentPartSource } from \"./contentPart/useContentPartSource\";\nexport { useContentPartFile } from \"./contentPart/useContentPartFile\";\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useThreadViewportAutoScroll } from \"./thread/useThreadViewportAutoScroll\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAoC;AACpC,8BAAyC;AACzC,0BAAqC;AACrC,4BAAuC;AACvC,wBAAmC;AACnC,2BAAsC;AACtC,uBAAkC;AAClC,sBAAiC;AACjC,0BAAqC;AACrC,8BAAyC;AAEzC,gCAAmC;AACnC,qCAAwC;AACxC,kCAAqC;AACrC,gCAAmC;AACnC,iCAAoC;AACpC,yCAA4C;","names":[]}
@@ -9,9 +9,11 @@ import * as MessagePrimitive from "./message/index.mjs";
9
9
  import * as ThreadPrimitive from "./thread/index.mjs";
10
10
  import * as ThreadListPrimitive from "./threadList/index.mjs";
11
11
  import * as ThreadListItemPrimitive from "./threadListItem/index.mjs";
12
- import { useContentPartImage } from "./contentPart/useContentPartImage.mjs";
13
12
  import { useContentPartText } from "./contentPart/useContentPartText.mjs";
14
13
  import { useContentPartReasoning } from "./contentPart/useContentPartReasoning.mjs";
14
+ import { useContentPartSource } from "./contentPart/useContentPartSource.mjs";
15
+ import { useContentPartFile } from "./contentPart/useContentPartFile.mjs";
16
+ import { useContentPartImage } from "./contentPart/useContentPartImage.mjs";
15
17
  import { useThreadViewportAutoScroll } from "./thread/useThreadViewportAutoScroll.mjs";
16
18
  export {
17
19
  ActionBarPrimitive,
@@ -24,8 +26,10 @@ export {
24
26
  ThreadListItemPrimitive,
25
27
  ThreadListPrimitive,
26
28
  ThreadPrimitive,
29
+ useContentPartFile,
27
30
  useContentPartImage,
28
31
  useContentPartReasoning,
32
+ useContentPartSource,
29
33
  useContentPartText,
30
34
  useThreadViewportAutoScroll
31
35
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\nexport { useContentPartReasoning } from \"./contentPart/useContentPartReasoning\";\nexport { useThreadViewportAutoScroll } from \"./thread/useThreadViewportAutoScroll\";\n"],"mappings":";AAAA,YAAY,wBAAwB;AACpC,YAAY,6BAA6B;AACzC,YAAY,yBAAyB;AACrC,YAAY,2BAA2B;AACvC,YAAY,uBAAuB;AACnC,YAAY,0BAA0B;AACtC,YAAY,sBAAsB;AAClC,YAAY,qBAAqB;AACjC,YAAY,yBAAyB;AACrC,YAAY,6BAA6B;AAEzC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,mCAAmC;","names":[]}
1
+ {"version":3,"sources":["../../src/primitives/index.ts"],"sourcesContent":["export * as ActionBarPrimitive from \"./actionBar\";\nexport * as AssistantModalPrimitive from \"./assistantModal\";\nexport * as AttachmentPrimitive from \"./attachment\";\nexport * as BranchPickerPrimitive from \"./branchPicker\";\nexport * as ComposerPrimitive from \"./composer\";\nexport * as ContentPartPrimitive from \"./contentPart\";\nexport * as MessagePrimitive from \"./message\";\nexport * as ThreadPrimitive from \"./thread\";\nexport * as ThreadListPrimitive from \"./threadList\";\nexport * as ThreadListItemPrimitive from \"./threadListItem\";\n\nexport { useContentPartText } from \"./contentPart/useContentPartText\";\nexport { useContentPartReasoning } from \"./contentPart/useContentPartReasoning\";\nexport { useContentPartSource } from \"./contentPart/useContentPartSource\";\nexport { useContentPartFile } from \"./contentPart/useContentPartFile\";\nexport { useContentPartImage } from \"./contentPart/useContentPartImage\";\nexport { useThreadViewportAutoScroll } from \"./thread/useThreadViewportAutoScroll\";\n"],"mappings":";AAAA,YAAY,wBAAwB;AACpC,YAAY,6BAA6B;AACzC,YAAY,yBAAyB;AACrC,YAAY,2BAA2B;AACvC,YAAY,uBAAuB;AACnC,YAAY,0BAA0B;AACtC,YAAY,sBAAsB;AAClC,YAAY,qBAAqB;AACjC,YAAY,yBAAyB;AACrC,YAAY,6BAA6B;AAEzC,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AACpC,SAAS,mCAAmC;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadScrollToBottom.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAIxC,QAAA,MAAM,uBAAuB,2BAW5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B;;6DAGzC,CAAC"}
1
+ {"version":3,"file":"ThreadScrollToBottom.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAOxC,QAAA,MAAM,uBAAuB,2BAW5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B;;6DAGzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThreadViewport, useThreadViewportStore } from \"../../context/react/ThreadViewportContext\";\n\nconst useThreadScrollToBottom = () => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom();\n }, [threadViewportStore]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mBAA4B;AAC5B,mCAA0D;AAE1D,IAAM,0BAA0B,MAAM;AACpC,QAAM,iBAAa,gDAAkB,CAAC,MAAM,EAAE,UAAU;AAExD,QAAM,0BAAsB,qDAAuB;AAEnD,QAAM,2BAAuB,0BAAY,MAAM;AAC7C,wBAAoB,SAAS,EAAE,eAAe;AAAA,EAChD,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,WAAY,QAAO;AACvB,SAAO;AACT;AAOO,IAAM,oCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"../../context/react/ThreadViewportContext\";\n\nconst useThreadScrollToBottom = () => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom();\n }, [threadViewportStore]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mBAA4B;AAC5B,mCAGO;AAEP,IAAM,0BAA0B,MAAM;AACpC,QAAM,iBAAa,gDAAkB,CAAC,MAAM,EAAE,UAAU;AAExD,QAAM,0BAAsB,qDAAuB;AAEnD,QAAM,2BAAuB,0BAAY,MAAM;AAC7C,wBAAoB,SAAS,EAAE,eAAe;AAAA,EAChD,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,WAAY,QAAO;AACvB,SAAO;AACT;AAOO,IAAM,oCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
@@ -5,7 +5,10 @@ import {
5
5
  createActionButton
6
6
  } from "../../utils/createActionButton.mjs";
7
7
  import { useCallback } from "react";
8
- import { useThreadViewport, useThreadViewportStore } from "../../context/react/ThreadViewportContext.mjs";
8
+ import {
9
+ useThreadViewport,
10
+ useThreadViewportStore
11
+ } from "../../context/react/ThreadViewportContext.mjs";
9
12
  var useThreadScrollToBottom = () => {
10
13
  const isAtBottom = useThreadViewport((s) => s.isAtBottom);
11
14
  const threadViewportStore = useThreadViewportStore();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport { useThreadViewport, useThreadViewportStore } from \"../../context/react/ThreadViewportContext\";\n\nconst useThreadScrollToBottom = () => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom();\n }, [threadViewportStore]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB,8BAA8B;AAE1D,IAAM,0BAA0B,MAAM;AACpC,QAAM,aAAa,kBAAkB,CAAC,MAAM,EAAE,UAAU;AAExD,QAAM,sBAAsB,uBAAuB;AAEnD,QAAM,uBAAuB,YAAY,MAAM;AAC7C,wBAAoB,SAAS,EAAE,eAAe;AAAA,EAChD,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,WAAY,QAAO;AACvB,SAAO;AACT;AAOO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/primitives/thread/ThreadScrollToBottom.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useCallback } from \"react\";\nimport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"../../context/react/ThreadViewportContext\";\n\nconst useThreadScrollToBottom = () => {\n const isAtBottom = useThreadViewport((s) => s.isAtBottom);\n\n const threadViewportStore = useThreadViewportStore();\n\n const handleScrollToBottom = useCallback(() => {\n threadViewportStore.getState().scrollToBottom();\n }, [threadViewportStore]);\n\n if (isAtBottom) return null;\n return handleScrollToBottom;\n};\n\nexport namespace ThreadPrimitiveScrollToBottom {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadScrollToBottom>;\n}\n\nexport const ThreadPrimitiveScrollToBottom = createActionButton(\n \"ThreadPrimitive.ScrollToBottom\",\n useThreadScrollToBottom,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,IAAM,0BAA0B,MAAM;AACpC,QAAM,aAAa,kBAAkB,CAAC,MAAM,EAAE,UAAU;AAExD,QAAM,sBAAsB,uBAAuB;AAEnD,QAAM,uBAAuB,YAAY,MAAM;AAC7C,wBAAoB,SAAS,EAAE,eAAe;AAAA,EAChD,GAAG,CAAC,mBAAmB,CAAC;AAExB,MAAI,WAAY,QAAO;AACvB,SAAO;AACT;AAOO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAIhF,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG;QACnE,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAClC,CAAC;CACH;AAmBD,eAAO,MAAM,uBAAuB;;;iBArBnB,OAAO,GAAG,SAAS;kDA8BlC,CAAC"}
1
+ {"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,YAAY,EAAc,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAIhF,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG;QACnE,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KAClC,CAAC;CACH;AAsBD,eAAO,MAAM,uBAAuB;;;iBAxBnB,OAAO,GAAG,SAAS;kDAiClC,CAAC"}
@@ -37,6 +37,7 @@ var ThreadPrimitiveViewportScrollable = (0, import_react.forwardRef)(({ autoScro
37
37
  const ref = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, autoScrollRef);
38
38
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...rest, ref, children });
39
39
  });
40
+ ThreadPrimitiveViewportScrollable.displayName = "ThreadPrimitive.ViewportScrollable";
40
41
  var ThreadPrimitiveViewport = (0, import_react.forwardRef)((props, ref) => {
41
42
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThreadViewportProvider.ThreadViewportProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThreadPrimitiveViewportScrollable, { ...props, ref }) });
42
43
  });