@assistant-ui/react 0.10.1 → 0.10.3

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 (393) hide show
  1. package/dist/api/AssistantRuntime.js +5 -4
  2. package/dist/api/AssistantRuntime.js.map +1 -1
  3. package/dist/api/AttachmentRuntime.js +11 -10
  4. package/dist/api/AttachmentRuntime.js.map +1 -1
  5. package/dist/api/ComposerRuntime.js +16 -15
  6. package/dist/api/ComposerRuntime.js.map +1 -1
  7. package/dist/api/ContentPartRuntime.js +3 -2
  8. package/dist/api/ContentPartRuntime.js.map +1 -1
  9. package/dist/api/MessageRuntime.js +14 -13
  10. package/dist/api/MessageRuntime.js.map +1 -1
  11. package/dist/api/ThreadListItemRuntime.js +3 -2
  12. package/dist/api/ThreadListItemRuntime.js.map +1 -1
  13. package/dist/api/ThreadListRuntime.js +11 -10
  14. package/dist/api/ThreadListRuntime.js.map +1 -1
  15. package/dist/api/ThreadRuntime.js +14 -13
  16. package/dist/api/ThreadRuntime.js.map +1 -1
  17. package/dist/api/subscribable/BaseSubject.js +3 -2
  18. package/dist/api/subscribable/BaseSubject.js.map +1 -1
  19. package/dist/api/subscribable/EventSubscriptionSubject.js +4 -3
  20. package/dist/api/subscribable/EventSubscriptionSubject.js.map +1 -1
  21. package/dist/api/subscribable/LazyMemoizeSubject.js +5 -4
  22. package/dist/api/subscribable/LazyMemoizeSubject.js.map +1 -1
  23. package/dist/api/subscribable/NestedSubscriptionSubject.js +4 -3
  24. package/dist/api/subscribable/NestedSubscriptionSubject.js.map +1 -1
  25. package/dist/api/subscribable/SKIP_UPDATE.js +2 -1
  26. package/dist/api/subscribable/SKIP_UPDATE.js.map +1 -1
  27. package/dist/api/subscribable/ShallowMemoizeSubject.js +6 -5
  28. package/dist/api/subscribable/ShallowMemoizeSubject.js.map +1 -1
  29. package/dist/api/subscribable/shallowEqual.js +1 -0
  30. package/dist/api/subscribable/shallowEqual.js.map +1 -1
  31. package/dist/cloud/AssistantCloud.js +7 -6
  32. package/dist/cloud/AssistantCloud.js.map +1 -1
  33. package/dist/cloud/AssistantCloudAPI.js +6 -5
  34. package/dist/cloud/AssistantCloudAPI.js.map +1 -1
  35. package/dist/cloud/AssistantCloudAuthStrategy.js +9 -8
  36. package/dist/cloud/AssistantCloudAuthStrategy.js.map +1 -1
  37. package/dist/cloud/AssistantCloudAuthTokens.js +3 -2
  38. package/dist/cloud/AssistantCloudAuthTokens.js.map +1 -1
  39. package/dist/cloud/AssistantCloudRuns.js +3 -2
  40. package/dist/cloud/AssistantCloudRuns.js.map +1 -1
  41. package/dist/cloud/AssistantCloudThreadHistoryAdapter.js +6 -5
  42. package/dist/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
  43. package/dist/cloud/AssistantCloudThreadMessages.js +3 -2
  44. package/dist/cloud/AssistantCloudThreadMessages.js.map +1 -1
  45. package/dist/cloud/AssistantCloudThreads.js +4 -3
  46. package/dist/cloud/AssistantCloudThreads.js.map +1 -1
  47. package/dist/cloud/auiV0.js +5 -4
  48. package/dist/cloud/auiV0.js.map +1 -1
  49. package/dist/cloud/index.js +3 -2
  50. package/dist/cloud/index.js.map +1 -1
  51. package/dist/cloud/useCloudThreadListRuntime.js +5 -3
  52. package/dist/cloud/useCloudThreadListRuntime.js.map +1 -1
  53. package/dist/context/ReadonlyStore.js +2 -1
  54. package/dist/context/ReadonlyStore.js.map +1 -1
  55. package/dist/context/index.js +4 -3
  56. package/dist/context/index.js.map +1 -1
  57. package/dist/context/providers/AssistantRuntimeProvider.js +13 -11
  58. package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
  59. package/dist/context/providers/AttachmentRuntimeProvider.js +8 -6
  60. package/dist/context/providers/AttachmentRuntimeProvider.js.map +1 -1
  61. package/dist/context/providers/ContentPartRuntimeProvider.js +8 -6
  62. package/dist/context/providers/ContentPartRuntimeProvider.js.map +1 -1
  63. package/dist/context/providers/MessageRuntimeProvider.js +10 -8
  64. package/dist/context/providers/MessageRuntimeProvider.js.map +1 -1
  65. package/dist/context/providers/TextContentPartProvider.js +10 -8
  66. package/dist/context/providers/TextContentPartProvider.js.map +1 -1
  67. package/dist/context/providers/ThreadListItemRuntimeProvider.js +8 -6
  68. package/dist/context/providers/ThreadListItemRuntimeProvider.js.map +1 -1
  69. package/dist/context/providers/ThreadRuntimeProvider.js +10 -8
  70. package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
  71. package/dist/context/providers/ThreadViewportProvider.js +8 -6
  72. package/dist/context/providers/ThreadViewportProvider.js.map +1 -1
  73. package/dist/context/providers/index.js +3 -2
  74. package/dist/context/providers/index.js.map +1 -1
  75. package/dist/context/react/AssistantContext.js +10 -8
  76. package/dist/context/react/AssistantContext.js.map +1 -1
  77. package/dist/context/react/AttachmentContext.js +10 -8
  78. package/dist/context/react/AttachmentContext.js.map +1 -1
  79. package/dist/context/react/ComposerContext.js +6 -4
  80. package/dist/context/react/ComposerContext.js.map +1 -1
  81. package/dist/context/react/ContentPartContext.js +7 -5
  82. package/dist/context/react/ContentPartContext.js.map +1 -1
  83. package/dist/context/react/MessageContext.js +11 -9
  84. package/dist/context/react/MessageContext.js.map +1 -1
  85. package/dist/context/react/ThreadContext.js +9 -7
  86. package/dist/context/react/ThreadContext.js.map +1 -1
  87. package/dist/context/react/ThreadListItemContext.js +7 -5
  88. package/dist/context/react/ThreadListItemContext.js.map +1 -1
  89. package/dist/context/react/ThreadViewportContext.js +7 -5
  90. package/dist/context/react/ThreadViewportContext.js.map +1 -1
  91. package/dist/context/react/index.js +11 -9
  92. package/dist/context/react/index.js.map +1 -1
  93. package/dist/context/react/utils/createContextHook.js +2 -0
  94. package/dist/context/react/utils/createContextHook.js.map +1 -1
  95. package/dist/context/react/utils/createContextStoreHook.js +1 -0
  96. package/dist/context/react/utils/createContextStoreHook.js.map +1 -1
  97. package/dist/context/react/utils/createStateHookForRuntime.js +2 -1
  98. package/dist/context/react/utils/createStateHookForRuntime.js.map +1 -1
  99. package/dist/context/react/utils/ensureBinding.js +2 -21
  100. package/dist/context/react/utils/ensureBinding.js.map +1 -1
  101. package/dist/context/react/utils/useRuntimeState.js +3 -2
  102. package/dist/context/react/utils/useRuntimeState.js.map +1 -1
  103. package/dist/context/stores/AssistantToolUIs.js +2 -1
  104. package/dist/context/stores/AssistantToolUIs.js.map +1 -1
  105. package/dist/context/stores/MessageUtils.js +2 -1
  106. package/dist/context/stores/MessageUtils.js.map +1 -1
  107. package/dist/context/stores/ThreadViewport.js +3 -1
  108. package/dist/context/stores/ThreadViewport.js.map +1 -1
  109. package/dist/index.js +9 -8
  110. package/dist/index.js.map +1 -1
  111. package/dist/internal.js +12 -11
  112. package/dist/internal.js.map +1 -1
  113. package/dist/model-context/ModelContextTypes.js +2 -1
  114. package/dist/model-context/ModelContextTypes.js.map +1 -1
  115. package/dist/model-context/index.js +10 -9
  116. package/dist/model-context/index.js.map +1 -1
  117. package/dist/model-context/makeAssistantTool.js +4 -2
  118. package/dist/model-context/makeAssistantTool.js.map +1 -1
  119. package/dist/model-context/makeAssistantToolUI.js +4 -2
  120. package/dist/model-context/makeAssistantToolUI.js.map +1 -1
  121. package/dist/model-context/makeAssistantVisible.js +9 -7
  122. package/dist/model-context/makeAssistantVisible.js.map +1 -1
  123. package/dist/model-context/tool.d.ts +1 -10
  124. package/dist/model-context/tool.d.ts.map +1 -1
  125. package/dist/model-context/tool.js +1 -0
  126. package/dist/model-context/tool.js.map +1 -1
  127. package/dist/model-context/useAssistantInstructions.js +5 -3
  128. package/dist/model-context/useAssistantInstructions.js.map +1 -1
  129. package/dist/model-context/useAssistantTool.d.ts +0 -1
  130. package/dist/model-context/useAssistantTool.d.ts.map +1 -1
  131. package/dist/model-context/useAssistantTool.js +5 -4
  132. package/dist/model-context/useAssistantTool.js.map +1 -1
  133. package/dist/model-context/useAssistantToolUI.js +4 -2
  134. package/dist/model-context/useAssistantToolUI.js.map +1 -1
  135. package/dist/model-context/useInlineRender.js +3 -1
  136. package/dist/model-context/useInlineRender.js.map +1 -1
  137. package/dist/primitives/actionBar/ActionBarCopy.js +8 -6
  138. package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
  139. package/dist/primitives/actionBar/ActionBarEdit.js +6 -4
  140. package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
  141. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +7 -5
  142. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
  143. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +6 -4
  144. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
  145. package/dist/primitives/actionBar/ActionBarReload.js +8 -6
  146. package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
  147. package/dist/primitives/actionBar/ActionBarRoot.js +5 -3
  148. package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
  149. package/dist/primitives/actionBar/ActionBarSpeak.js +6 -4
  150. package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
  151. package/dist/primitives/actionBar/ActionBarStopSpeaking.js +6 -4
  152. package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
  153. package/dist/primitives/actionBar/index.js +9 -8
  154. package/dist/primitives/actionBar/index.js.map +1 -1
  155. package/dist/primitives/actionBar/useActionBarFloatStatus.js +6 -4
  156. package/dist/primitives/actionBar/useActionBarFloatStatus.js.map +1 -1
  157. package/dist/primitives/assistantModal/AssistantModalAnchor.js +5 -3
  158. package/dist/primitives/assistantModal/AssistantModalAnchor.js.map +1 -1
  159. package/dist/primitives/assistantModal/AssistantModalContent.js +5 -3
  160. package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
  161. package/dist/primitives/assistantModal/AssistantModalRoot.js +7 -5
  162. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  163. package/dist/primitives/assistantModal/AssistantModalTrigger.js +4 -3
  164. package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
  165. package/dist/primitives/assistantModal/index.js +5 -4
  166. package/dist/primitives/assistantModal/index.js.map +1 -1
  167. package/dist/primitives/assistantModal/scope.js +2 -1
  168. package/dist/primitives/assistantModal/scope.js.map +1 -1
  169. package/dist/primitives/attachment/AttachmentName.js +4 -2
  170. package/dist/primitives/attachment/AttachmentName.js.map +1 -1
  171. package/dist/primitives/attachment/AttachmentRemove.js +6 -4
  172. package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
  173. package/dist/primitives/attachment/AttachmentRoot.js +3 -2
  174. package/dist/primitives/attachment/AttachmentRoot.js.map +1 -1
  175. package/dist/primitives/attachment/AttachmentThumb.js +5 -3
  176. package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
  177. package/dist/primitives/attachment/index.js +5 -4
  178. package/dist/primitives/attachment/index.js.map +1 -1
  179. package/dist/primitives/branchPicker/BranchPickerCount.js +5 -3
  180. package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
  181. package/dist/primitives/branchPicker/BranchPickerNext.js +6 -4
  182. package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
  183. package/dist/primitives/branchPicker/BranchPickerNumber.js +5 -3
  184. package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
  185. package/dist/primitives/branchPicker/BranchPickerPrevious.js +6 -4
  186. package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
  187. package/dist/primitives/branchPicker/BranchPickerRoot.js +4 -3
  188. package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
  189. package/dist/primitives/branchPicker/index.js +6 -5
  190. package/dist/primitives/branchPicker/index.js.map +1 -1
  191. package/dist/primitives/composer/ComposerAddAttachment.js +6 -4
  192. package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
  193. package/dist/primitives/composer/ComposerAttachments.js +11 -9
  194. package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
  195. package/dist/primitives/composer/ComposerCancel.js +6 -4
  196. package/dist/primitives/composer/ComposerCancel.js.map +1 -1
  197. package/dist/primitives/composer/ComposerIf.js +5 -3
  198. package/dist/primitives/composer/ComposerIf.js.map +1 -1
  199. package/dist/primitives/composer/ComposerInput.js +8 -6
  200. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  201. package/dist/primitives/composer/ComposerRoot.js +5 -3
  202. package/dist/primitives/composer/ComposerRoot.js.map +1 -1
  203. package/dist/primitives/composer/ComposerSend.js +8 -6
  204. package/dist/primitives/composer/ComposerSend.js.map +1 -1
  205. package/dist/primitives/composer/index.js +8 -7
  206. package/dist/primitives/composer/index.js.map +1 -1
  207. package/dist/primitives/contentPart/ContentPartImage.js +5 -3
  208. package/dist/primitives/contentPart/ContentPartImage.js.map +1 -1
  209. package/dist/primitives/contentPart/ContentPartInProgress.js +4 -2
  210. package/dist/primitives/contentPart/ContentPartInProgress.js.map +1 -1
  211. package/dist/primitives/contentPart/ContentPartText.js +6 -4
  212. package/dist/primitives/contentPart/ContentPartText.js.map +1 -1
  213. package/dist/primitives/contentPart/index.js +4 -3
  214. package/dist/primitives/contentPart/index.js.map +1 -1
  215. package/dist/primitives/contentPart/useContentPartFile.js +4 -2
  216. package/dist/primitives/contentPart/useContentPartFile.js.map +1 -1
  217. package/dist/primitives/contentPart/useContentPartImage.js +4 -2
  218. package/dist/primitives/contentPart/useContentPartImage.js.map +1 -1
  219. package/dist/primitives/contentPart/useContentPartReasoning.js +4 -2
  220. package/dist/primitives/contentPart/useContentPartReasoning.js.map +1 -1
  221. package/dist/primitives/contentPart/useContentPartSource.js +4 -2
  222. package/dist/primitives/contentPart/useContentPartSource.js.map +1 -1
  223. package/dist/primitives/contentPart/useContentPartText.js +4 -2
  224. package/dist/primitives/contentPart/useContentPartText.js.map +1 -1
  225. package/dist/primitives/index.js +17 -16
  226. package/dist/primitives/index.js.map +1 -1
  227. package/dist/primitives/message/MessageAttachments.js +11 -9
  228. package/dist/primitives/message/MessageAttachments.js.map +1 -1
  229. package/dist/primitives/message/MessageContent.js +19 -17
  230. package/dist/primitives/message/MessageContent.js.map +1 -1
  231. package/dist/primitives/message/MessageIf.js +6 -4
  232. package/dist/primitives/message/MessageIf.js.map +1 -1
  233. package/dist/primitives/message/MessageRoot.js +7 -5
  234. package/dist/primitives/message/MessageRoot.js.map +1 -1
  235. package/dist/primitives/message/index.js +5 -4
  236. package/dist/primitives/message/index.js.map +1 -1
  237. package/dist/primitives/thread/ThreadEmpty.js +4 -2
  238. package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
  239. package/dist/primitives/thread/ThreadIf.js +5 -3
  240. package/dist/primitives/thread/ThreadIf.js.map +1 -1
  241. package/dist/primitives/thread/ThreadMessages.js +14 -12
  242. package/dist/primitives/thread/ThreadMessages.js.map +1 -1
  243. package/dist/primitives/thread/ThreadRoot.js +3 -2
  244. package/dist/primitives/thread/ThreadRoot.js.map +1 -1
  245. package/dist/primitives/thread/ThreadScrollToBottom.js +6 -4
  246. package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
  247. package/dist/primitives/thread/ThreadSuggestion.js +7 -5
  248. package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
  249. package/dist/primitives/thread/ThreadViewport.js +7 -5
  250. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  251. package/dist/primitives/thread/index.js +8 -7
  252. package/dist/primitives/thread/index.js.map +1 -1
  253. package/dist/primitives/thread/useThreadViewportAutoScroll.js +9 -7
  254. package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
  255. package/dist/primitives/threadList/ThreadListItems.js +8 -6
  256. package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
  257. package/dist/primitives/threadList/ThreadListNew.js +6 -4
  258. package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
  259. package/dist/primitives/threadList/ThreadListRoot.js +3 -2
  260. package/dist/primitives/threadList/ThreadListRoot.js.map +1 -1
  261. package/dist/primitives/threadList/index.js +4 -3
  262. package/dist/primitives/threadList/index.js.map +1 -1
  263. package/dist/primitives/threadListItem/ThreadListItemArchive.js +6 -4
  264. package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
  265. package/dist/primitives/threadListItem/ThreadListItemDelete.js +6 -4
  266. package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
  267. package/dist/primitives/threadListItem/ThreadListItemRoot.js +5 -3
  268. package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -1
  269. package/dist/primitives/threadListItem/ThreadListItemTitle.js +4 -2
  270. package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -1
  271. package/dist/primitives/threadListItem/ThreadListItemTrigger.js +6 -4
  272. package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
  273. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +6 -4
  274. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
  275. package/dist/primitives/threadListItem/index.js +7 -6
  276. package/dist/primitives/threadListItem/index.js.map +1 -1
  277. package/dist/runtimes/adapters/RuntimeAdapterProvider.js +5 -4
  278. package/dist/runtimes/adapters/RuntimeAdapterProvider.js.map +1 -1
  279. package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.js +3 -2
  280. package/dist/runtimes/adapters/attachment/CompositeAttachmentAdapter.js.map +1 -1
  281. package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.js +4 -3
  282. package/dist/runtimes/adapters/attachment/SimpleImageAttachmentAdapter.js.map +1 -1
  283. package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.js +4 -3
  284. package/dist/runtimes/adapters/attachment/SimpleTextAttachmentAdapter.js.map +1 -1
  285. package/dist/runtimes/adapters/attachment/index.js +4 -3
  286. package/dist/runtimes/adapters/attachment/index.js.map +1 -1
  287. package/dist/runtimes/adapters/index.js +5 -4
  288. package/dist/runtimes/adapters/index.js.map +1 -1
  289. package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.js +3 -2
  290. package/dist/runtimes/adapters/speech/WebSpeechSynthesisAdapter.js.map +1 -1
  291. package/dist/runtimes/adapters/speech/index.js +2 -1
  292. package/dist/runtimes/adapters/speech/index.js.map +1 -1
  293. package/dist/runtimes/composer/BaseComposerRuntimeCore.js +5 -4
  294. package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
  295. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +5 -4
  296. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
  297. package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js +4 -3
  298. package/dist/runtimes/composer/DefaultThreadComposerRuntimeCore.js.map +1 -1
  299. package/dist/runtimes/core/BaseAssistantRuntimeCore.js +4 -3
  300. package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
  301. package/dist/runtimes/core/BaseThreadRuntimeCore.js +7 -6
  302. package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
  303. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +7 -6
  304. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
  305. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +8 -7
  306. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
  307. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +11 -10
  308. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
  309. package/dist/runtimes/external-store/ThreadMessageConverter.js +3 -2
  310. package/dist/runtimes/external-store/ThreadMessageConverter.js.map +1 -1
  311. package/dist/runtimes/external-store/ThreadMessageLike.js +3 -2
  312. package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
  313. package/dist/runtimes/external-store/auto-status.js +5 -4
  314. package/dist/runtimes/external-store/auto-status.js.map +1 -1
  315. package/dist/runtimes/external-store/createMessageConverter.js +6 -4
  316. package/dist/runtimes/external-store/createMessageConverter.js.map +1 -1
  317. package/dist/runtimes/external-store/external-message-converter.js +11 -9
  318. package/dist/runtimes/external-store/external-message-converter.js.map +1 -1
  319. package/dist/runtimes/external-store/getExternalStoreMessage.js +6 -5
  320. package/dist/runtimes/external-store/getExternalStoreMessage.js.map +1 -1
  321. package/dist/runtimes/external-store/index.js +5 -4
  322. package/dist/runtimes/external-store/index.js.map +1 -1
  323. package/dist/runtimes/external-store/useExternalStoreRuntime.js +6 -4
  324. package/dist/runtimes/external-store/useExternalStoreRuntime.js.map +1 -1
  325. package/dist/runtimes/index.js +7 -6
  326. package/dist/runtimes/index.js.map +1 -1
  327. package/dist/runtimes/local/LocalRuntimeCore.js +7 -6
  328. package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
  329. package/dist/runtimes/local/LocalRuntimeOptions.js +2 -1
  330. package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
  331. package/dist/runtimes/local/LocalThreadListRuntimeCore.js +5 -4
  332. package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
  333. package/dist/runtimes/local/LocalThreadRuntimeCore.js +6 -5
  334. package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
  335. package/dist/runtimes/local/index.js +2 -1
  336. package/dist/runtimes/local/index.js.map +1 -1
  337. package/dist/runtimes/local/shouldContinue.js +2 -1
  338. package/dist/runtimes/local/shouldContinue.js.map +1 -1
  339. package/dist/runtimes/local/useLocalRuntime.js +9 -7
  340. package/dist/runtimes/local/useLocalRuntime.js.map +1 -1
  341. package/dist/runtimes/remote-thread-list/BaseSubscribable.js +3 -2
  342. package/dist/runtimes/remote-thread-list/BaseSubscribable.js.map +1 -1
  343. package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js +3 -2
  344. package/dist/runtimes/remote-thread-list/EMPTY_THREAD_CORE.js.map +1 -1
  345. package/dist/runtimes/remote-thread-list/OptimisticState.js +5 -4
  346. package/dist/runtimes/remote-thread-list/OptimisticState.js.map +1 -1
  347. package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js +9 -7
  348. package/dist/runtimes/remote-thread-list/RemoteThreadListHookInstanceManager.js.map +1 -1
  349. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js +13 -11
  350. package/dist/runtimes/remote-thread-list/RemoteThreadListThreadListRuntimeCore.js.map +1 -1
  351. package/dist/runtimes/remote-thread-list/adapter/cloud.js +9 -8
  352. package/dist/runtimes/remote-thread-list/adapter/cloud.js.map +1 -1
  353. package/dist/runtimes/remote-thread-list/adapter/in-memory.js +3 -2
  354. package/dist/runtimes/remote-thread-list/adapter/in-memory.js.map +1 -1
  355. package/dist/runtimes/remote-thread-list/index.js +3 -2
  356. package/dist/runtimes/remote-thread-list/index.js.map +1 -1
  357. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js +8 -6
  358. package/dist/runtimes/remote-thread-list/useRemoteThreadListRuntime.js.map +1 -1
  359. package/dist/runtimes/utils/MessageRepository.js +10 -9
  360. package/dist/runtimes/utils/MessageRepository.js.map +1 -1
  361. package/dist/tests/setup.js +2971 -3
  362. package/dist/tests/setup.js.map +1 -1
  363. package/dist/utils/CompositeContextProvider.js +4 -3
  364. package/dist/utils/CompositeContextProvider.js.map +1 -1
  365. package/dist/utils/combined/createCombinedStore.js +3 -1
  366. package/dist/utils/combined/createCombinedStore.js.map +1 -1
  367. package/dist/utils/combined/useCombinedStore.js +4 -2
  368. package/dist/utils/combined/useCombinedStore.js.map +1 -1
  369. package/dist/utils/createActionButton.js +3 -2
  370. package/dist/utils/createActionButton.js.map +1 -1
  371. package/dist/utils/getThreadMessageText.js +2 -1
  372. package/dist/utils/getThreadMessageText.js.map +1 -1
  373. package/dist/utils/hooks/useManagedRef.js +2 -1
  374. package/dist/utils/hooks/useManagedRef.js.map +1 -1
  375. package/dist/utils/hooks/useOnResizeContent.js +3 -2
  376. package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
  377. package/dist/utils/hooks/useOnScrollToBottom.js +4 -2
  378. package/dist/utils/hooks/useOnScrollToBottom.js.map +1 -1
  379. package/dist/utils/idUtils.js +5 -4
  380. package/dist/utils/idUtils.js.map +1 -1
  381. package/dist/utils/json/is-json.js +1 -0
  382. package/dist/utils/json/is-json.js.map +1 -1
  383. package/dist/utils/smooth/SmoothContext.js +10 -8
  384. package/dist/utils/smooth/SmoothContext.js.map +1 -1
  385. package/dist/utils/smooth/index.js +4 -2
  386. package/dist/utils/smooth/index.js.map +1 -1
  387. package/dist/utils/smooth/useSmooth.js +9 -7
  388. package/dist/utils/smooth/useSmooth.js.map +1 -1
  389. package/dist/utils/useToolArgsFieldStatus.js +4 -3
  390. package/dist/utils/useToolArgsFieldStatus.js.map +1 -1
  391. package/package.json +4 -4
  392. package/src/model-context/tool.ts +3 -16
  393. package/src/model-context/useAssistantTool.tsx +1 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/ThreadViewportProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { makeThreadViewportStore } from \"../stores/ThreadViewport\";\nimport {\n ThreadViewportContext,\n ThreadViewportContextValue,\n useThreadViewportStore,\n} from \"../react/ThreadViewportContext\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nconst useThreadViewportStoreValue = () => {\n const outerViewport = useThreadViewportStore({ optional: true });\n const [store] = useState(() => makeThreadViewportStore());\n\n useEffect(() => {\n return outerViewport?.getState().onScrollToBottom(() => {\n store.getState().scrollToBottom();\n });\n }, [outerViewport, store]);\n\n useEffect(() => {\n if (!outerViewport) return;\n return store.subscribe((state) => {\n if (outerViewport.getState().isAtBottom !== state.isAtBottom) {\n writableStore(outerViewport).setState({ isAtBottom: state.isAtBottom });\n }\n });\n }, [store, outerViewport]);\n\n return store;\n};\n\nexport const ThreadViewportProvider: FC<PropsWithChildren> = ({ children }) => {\n const useThreadViewport = useThreadViewportStoreValue();\n\n const [context] = useState<ThreadViewportContextValue>(() => {\n return {\n useThreadViewport,\n };\n });\n\n return (\n <ThreadViewportContext.Provider value={context}>\n {children}\n </ThreadViewportContext.Provider>\n );\n};\n"],"mappings":";AA4CI;AAzCJ,SAAS,WAAW,gBAAgB;AACpC,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,qBAAqB;AAE9B,MAAM,8BAA8B,MAAM;AACxC,QAAM,gBAAgB,uBAAuB,EAAE,UAAU,KAAK,CAAC;AAC/D,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,wBAAwB,CAAC;AAExD,YAAU,MAAM;AACd,WAAO,eAAe,SAAS,EAAE,iBAAiB,MAAM;AACtD,YAAM,SAAS,EAAE,eAAe;AAAA,IAClC,CAAC;AAAA,EACH,GAAG,CAAC,eAAe,KAAK,CAAC;AAEzB,YAAU,MAAM;AACd,QAAI,CAAC,cAAe;AACpB,WAAO,MAAM,UAAU,CAAC,UAAU;AAChC,UAAI,cAAc,SAAS,EAAE,eAAe,MAAM,YAAY;AAC5D,sBAAc,aAAa,EAAE,SAAS,EAAE,YAAY,MAAM,WAAW,CAAC;AAAA,MACxE;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,OAAO,aAAa,CAAC;AAEzB,SAAO;AACT;AAEO,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,oBAAoB,4BAA4B;AAEtD,QAAM,CAAC,OAAO,IAAI,SAAqC,MAAM;AAC3D,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF,CAAC;AAED,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,SACpC,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/ThreadViewportProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { makeThreadViewportStore } from \"../stores/ThreadViewport\";\nimport {\n ThreadViewportContext,\n ThreadViewportContextValue,\n useThreadViewportStore,\n} from \"../react/ThreadViewportContext\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nconst useThreadViewportStoreValue = () => {\n const outerViewport = useThreadViewportStore({ optional: true });\n const [store] = useState(() => makeThreadViewportStore());\n\n useEffect(() => {\n return outerViewport?.getState().onScrollToBottom(() => {\n store.getState().scrollToBottom();\n });\n }, [outerViewport, store]);\n\n useEffect(() => {\n if (!outerViewport) return;\n return store.subscribe((state) => {\n if (outerViewport.getState().isAtBottom !== state.isAtBottom) {\n writableStore(outerViewport).setState({ isAtBottom: state.isAtBottom });\n }\n });\n }, [store, outerViewport]);\n\n return store;\n};\n\nexport const ThreadViewportProvider: FC<PropsWithChildren> = ({ children }) => {\n const useThreadViewport = useThreadViewportStoreValue();\n\n const [context] = useState<ThreadViewportContextValue>(() => {\n return {\n useThreadViewport,\n };\n });\n\n return (\n <ThreadViewportContext.Provider value={context}>\n {children}\n </ThreadViewportContext.Provider>\n );\n};\n"],"mappings":";;;AAGA,SAAS,WAAW,gBAAgB;AACpC,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,qBAAqB;AAkC1B;AAhCJ,IAAM,8BAA8B,MAAM;AACxC,QAAM,gBAAgB,uBAAuB,EAAE,UAAU,KAAK,CAAC;AAC/D,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,wBAAwB,CAAC;AAExD,YAAU,MAAM;AACd,WAAO,eAAe,SAAS,EAAE,iBAAiB,MAAM;AACtD,YAAM,SAAS,EAAE,eAAe;AAAA,IAClC,CAAC;AAAA,EACH,GAAG,CAAC,eAAe,KAAK,CAAC;AAEzB,YAAU,MAAM;AACd,QAAI,CAAC,cAAe;AACpB,WAAO,MAAM,UAAU,CAAC,UAAU;AAChC,UAAI,cAAc,SAAS,EAAE,eAAe,MAAM,YAAY;AAC5D,sBAAc,aAAa,EAAE,SAAS,EAAE,YAAY,MAAM,WAAW,CAAC;AAAA,MACxE;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,OAAO,aAAa,CAAC;AAEzB,SAAO;AACT;AAEO,IAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,oBAAoB,4BAA4B;AAEtD,QAAM,CAAC,OAAO,IAAI,SAAqC,MAAM;AAC3D,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF,CAAC;AAED,SACE,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,SACpC,UACH;AAEJ;","names":[]}
@@ -1,5 +1,6 @@
1
- import { AssistantRuntimeProvider } from "./AssistantRuntimeProvider";
2
- import { TextContentPartProvider } from "./TextContentPartProvider";
1
+ // src/context/providers/index.ts
2
+ import { AssistantRuntimeProvider } from "./AssistantRuntimeProvider.js";
3
+ import { TextContentPartProvider } from "./TextContentPartProvider.js";
3
4
  export {
4
5
  AssistantRuntimeProvider,
5
6
  TextContentPartProvider
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/index.ts"],"sourcesContent":["export { AssistantRuntimeProvider } from \"./AssistantRuntimeProvider\";\nexport { TextContentPartProvider } from \"./TextContentPartProvider\";\n"],"mappings":"AAAA,SAAS,gCAAgC;AACzC,SAAS,+BAA+B;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/index.ts"],"sourcesContent":["export { AssistantRuntimeProvider } from \"./AssistantRuntimeProvider\";\nexport { TextContentPartProvider } from \"./TextContentPartProvider\";\n"],"mappings":";AAAA,SAAS,gCAAgC;AACzC,SAAS,+BAA+B;","names":[]}
@@ -1,12 +1,14 @@
1
1
  "use client";
2
+
3
+ // src/context/react/AssistantContext.ts
2
4
  import { createContext } from "react";
3
- import { createContextHook } from "./utils/createContextHook";
4
- import { createContextStoreHook } from "./utils/createContextStoreHook";
5
- import { createStateHookForRuntime } from "./utils/createStateHookForRuntime";
6
- const AssistantContext = createContext(
5
+ import { createContextHook } from "./utils/createContextHook.js";
6
+ import { createContextStoreHook } from "./utils/createContextStoreHook.js";
7
+ import { createStateHookForRuntime } from "./utils/createStateHookForRuntime.js";
8
+ var AssistantContext = createContext(
7
9
  null
8
10
  );
9
- const useAssistantContext = createContextHook(
11
+ var useAssistantContext = createContextHook(
10
12
  AssistantContext,
11
13
  "AssistantRuntimeProvider"
12
14
  );
@@ -15,12 +17,12 @@ function useAssistantRuntime(options) {
15
17
  if (!context) return null;
16
18
  return context.useAssistantRuntime();
17
19
  }
18
- const { useToolUIs, useToolUIsStore } = createContextStoreHook(
20
+ var { useToolUIs, useToolUIsStore } = createContextStoreHook(
19
21
  useAssistantContext,
20
22
  "useToolUIs"
21
23
  );
22
- const useThreadListRuntime = (opt) => useAssistantRuntime(opt)?.threads ?? null;
23
- const useThreadList = createStateHookForRuntime(useThreadListRuntime);
24
+ var useThreadListRuntime = (opt) => useAssistantRuntime(opt)?.threads ?? null;
25
+ var useThreadList = createStateHookForRuntime(useThreadListRuntime);
24
26
  export {
25
27
  AssistantContext,
26
28
  useAssistantContext,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/AssistantContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport type { AssistantToolUIsState } from \"../stores/AssistantToolUIs\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { ThreadListRuntime } from \"../../api/ThreadListRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type AssistantContextValue = {\n useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;\n useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>;\n};\n\nexport const AssistantContext = createContext<AssistantContextValue | null>(\n null,\n);\n\nexport const useAssistantContext = createContextHook(\n AssistantContext,\n \"AssistantRuntimeProvider\",\n);\n\nexport function useAssistantRuntime(options?: {\n optional?: false | undefined;\n}): AssistantRuntime;\nexport function useAssistantRuntime(options?: {\n optional?: boolean | undefined;\n}): AssistantRuntime | null;\nexport function useAssistantRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useAssistantContext(options);\n if (!context) return null;\n return context.useAssistantRuntime();\n}\n\nexport const { useToolUIs, useToolUIsStore } = createContextStoreHook(\n useAssistantContext,\n \"useToolUIs\",\n);\n\nconst useThreadListRuntime = (opt: {\n optional: boolean | undefined;\n}): ThreadListRuntime | null => useAssistantRuntime(opt)?.threads ?? null;\nexport const useThreadList = createStateHookForRuntime(useThreadListRuntime);\n"],"mappings":";AAEA,SAAS,qBAAqB;AAG9B,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AAIvC,SAAS,iCAAiC;AAOnC,MAAM,mBAAmB;AAAA,EAC9B;AACF;AAEO,MAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AACF;AAQO,SAAS,oBAAoB,SAEjC;AACD,QAAM,UAAU,oBAAoB,OAAO;AAC3C,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,oBAAoB;AACrC;AAEO,MAAM,EAAE,YAAY,gBAAgB,IAAI;AAAA,EAC7C;AAAA,EACA;AACF;AAEA,MAAM,uBAAuB,CAAC,QAEE,oBAAoB,GAAG,GAAG,WAAW;AAC9D,MAAM,gBAAgB,0BAA0B,oBAAoB;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/AssistantContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport type { AssistantToolUIsState } from \"../stores/AssistantToolUIs\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { ThreadListRuntime } from \"../../api/ThreadListRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type AssistantContextValue = {\n useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;\n useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>;\n};\n\nexport const AssistantContext = createContext<AssistantContextValue | null>(\n null,\n);\n\nexport const useAssistantContext = createContextHook(\n AssistantContext,\n \"AssistantRuntimeProvider\",\n);\n\nexport function useAssistantRuntime(options?: {\n optional?: false | undefined;\n}): AssistantRuntime;\nexport function useAssistantRuntime(options?: {\n optional?: boolean | undefined;\n}): AssistantRuntime | null;\nexport function useAssistantRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useAssistantContext(options);\n if (!context) return null;\n return context.useAssistantRuntime();\n}\n\nexport const { useToolUIs, useToolUIsStore } = createContextStoreHook(\n useAssistantContext,\n \"useToolUIs\",\n);\n\nconst useThreadListRuntime = (opt: {\n optional: boolean | undefined;\n}): ThreadListRuntime | null => useAssistantRuntime(opt)?.threads ?? null;\nexport const useThreadList = createStateHookForRuntime(useThreadListRuntime);\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAG9B,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AAIvC,SAAS,iCAAiC;AAOnC,IAAM,mBAAmB;AAAA,EAC9B;AACF;AAEO,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AACF;AAQO,SAAS,oBAAoB,SAEjC;AACD,QAAM,UAAU,oBAAoB,OAAO;AAC3C,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,oBAAoB;AACrC;AAEO,IAAM,EAAE,YAAY,gBAAgB,IAAI;AAAA,EAC7C;AAAA,EACA;AACF;AAEA,IAAM,uBAAuB,CAAC,QAEE,oBAAoB,GAAG,GAAG,WAAW;AAC9D,IAAM,gBAAgB,0BAA0B,oBAAoB;","names":[]}
@@ -1,11 +1,13 @@
1
1
  "use client";
2
+
3
+ // src/context/react/AttachmentContext.ts
2
4
  import { createContext } from "react";
3
- import { createContextHook } from "./utils/createContextHook";
4
- import { createStateHookForRuntime } from "./utils/createStateHookForRuntime";
5
- const AttachmentContext = createContext(
5
+ import { createContextHook } from "./utils/createContextHook.js";
6
+ import { createStateHookForRuntime } from "./utils/createStateHookForRuntime.js";
7
+ var AttachmentContext = createContext(
6
8
  null
7
9
  );
8
- const useAttachmentContext = createContextHook(
10
+ var useAttachmentContext = createContextHook(
9
11
  AttachmentContext,
10
12
  "a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component"
11
13
  );
@@ -41,14 +43,14 @@ function useMessageAttachmentRuntime(options) {
41
43
  );
42
44
  return attachmentRuntime;
43
45
  }
44
- const useAttachment = createStateHookForRuntime(useAttachmentRuntime);
45
- const useThreadComposerAttachment = createStateHookForRuntime(
46
+ var useAttachment = createStateHookForRuntime(useAttachmentRuntime);
47
+ var useThreadComposerAttachment = createStateHookForRuntime(
46
48
  useThreadComposerAttachmentRuntime
47
49
  );
48
- const useEditComposerAttachment = createStateHookForRuntime(
50
+ var useEditComposerAttachment = createStateHookForRuntime(
49
51
  useEditComposerAttachmentRuntime
50
52
  );
51
- const useMessageAttachment = createStateHookForRuntime(
53
+ var useMessageAttachment = createStateHookForRuntime(
52
54
  useMessageAttachmentRuntime
53
55
  );
54
56
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/AttachmentContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { AttachmentRuntime } from \"../../api/AttachmentRuntime\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type AttachmentContextValue = {\n useAttachmentRuntime: UseBoundStore<ReadonlyStore<AttachmentRuntime>>;\n};\n\nexport const AttachmentContext = createContext<AttachmentContextValue | null>(\n null,\n);\n\nconst useAttachmentContext = createContextHook(\n AttachmentContext,\n \"a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component\",\n);\n\nexport function useAttachmentRuntime(options?: {\n optional?: false | undefined;\n}): AttachmentRuntime;\nexport function useAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime | null;\nexport function useAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime | null {\n const attachmentRuntime = useAttachmentContext(options);\n if (!attachmentRuntime) return null;\n return attachmentRuntime.useAttachmentRuntime();\n}\n\nexport function useThreadComposerAttachmentRuntime(options?: {\n optional?: false | undefined;\n}): AttachmentRuntime<\"thread-composer\">;\nexport function useThreadComposerAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"thread-composer\"> | null;\nexport function useThreadComposerAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"thread-composer\"> | null {\n const attachmentRuntime = useAttachmentRuntime(options);\n if (!attachmentRuntime) return null;\n if (attachmentRuntime.source !== \"thread-composer\")\n throw new Error(\n \"This component must be used within a thread's ComposerPrimitive.Attachments component.\",\n );\n return attachmentRuntime as AttachmentRuntime<\"thread-composer\">;\n}\n\nexport function useEditComposerAttachmentRuntime(options?: {\n optional?: false | undefined;\n}): AttachmentRuntime<\"edit-composer\">;\nexport function useEditComposerAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"edit-composer\"> | null;\nexport function useEditComposerAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"edit-composer\"> | null {\n const attachmentRuntime = useAttachmentRuntime(options);\n if (!attachmentRuntime) return null;\n if (attachmentRuntime.source !== \"edit-composer\")\n throw new Error(\n \"This component must be used within a message's ComposerPrimitive.Attachments component.\",\n );\n\n return attachmentRuntime as AttachmentRuntime<\"edit-composer\">;\n}\n\nexport function useMessageAttachmentRuntime(options?: {\n optional?: false | undefined;\n}): AttachmentRuntime<\"message\">;\nexport function useMessageAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"message\"> | null;\nexport function useMessageAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"message\"> | null {\n const attachmentRuntime = useAttachmentRuntime(options);\n if (!attachmentRuntime) return null;\n if (attachmentRuntime.source !== \"message\")\n throw new Error(\n \"This component must be used within a MessagePrimitive.Attachments component.\",\n );\n return attachmentRuntime as AttachmentRuntime<\"message\">;\n}\n\nexport const useAttachment = createStateHookForRuntime(useAttachmentRuntime);\n\nexport const useThreadComposerAttachment = createStateHookForRuntime(\n useThreadComposerAttachmentRuntime,\n);\nexport const useEditComposerAttachment = createStateHookForRuntime(\n useEditComposerAttachmentRuntime,\n);\nexport const useMessageAttachment = createStateHookForRuntime(\n useMessageAttachmentRuntime,\n);\n"],"mappings":";AAEA,SAAS,qBAAqB;AAI9B,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAMnC,MAAM,oBAAoB;AAAA,EAC/B;AACF;AAEA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AACF;AAQO,SAAS,qBAAqB,SAER;AAC3B,QAAM,oBAAoB,qBAAqB,OAAO;AACtD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,SAAO,kBAAkB,qBAAqB;AAChD;AAQO,SAAS,mCAAmC,SAEH;AAC9C,QAAM,oBAAoB,qBAAqB,OAAO;AACtD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,MAAI,kBAAkB,WAAW;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,SAAO;AACT;AAQO,SAAS,iCAAiC,SAEH;AAC5C,QAAM,oBAAoB,qBAAqB,OAAO;AACtD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,MAAI,kBAAkB,WAAW;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAEF,SAAO;AACT;AAQO,SAAS,4BAA4B,SAEJ;AACtC,QAAM,oBAAoB,qBAAqB,OAAO;AACtD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,MAAI,kBAAkB,WAAW;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,SAAO;AACT;AAEO,MAAM,gBAAgB,0BAA0B,oBAAoB;AAEpE,MAAM,8BAA8B;AAAA,EACzC;AACF;AACO,MAAM,4BAA4B;AAAA,EACvC;AACF;AACO,MAAM,uBAAuB;AAAA,EAClC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/AttachmentContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { AttachmentRuntime } from \"../../api/AttachmentRuntime\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type AttachmentContextValue = {\n useAttachmentRuntime: UseBoundStore<ReadonlyStore<AttachmentRuntime>>;\n};\n\nexport const AttachmentContext = createContext<AttachmentContextValue | null>(\n null,\n);\n\nconst useAttachmentContext = createContextHook(\n AttachmentContext,\n \"a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component\",\n);\n\nexport function useAttachmentRuntime(options?: {\n optional?: false | undefined;\n}): AttachmentRuntime;\nexport function useAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime | null;\nexport function useAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime | null {\n const attachmentRuntime = useAttachmentContext(options);\n if (!attachmentRuntime) return null;\n return attachmentRuntime.useAttachmentRuntime();\n}\n\nexport function useThreadComposerAttachmentRuntime(options?: {\n optional?: false | undefined;\n}): AttachmentRuntime<\"thread-composer\">;\nexport function useThreadComposerAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"thread-composer\"> | null;\nexport function useThreadComposerAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"thread-composer\"> | null {\n const attachmentRuntime = useAttachmentRuntime(options);\n if (!attachmentRuntime) return null;\n if (attachmentRuntime.source !== \"thread-composer\")\n throw new Error(\n \"This component must be used within a thread's ComposerPrimitive.Attachments component.\",\n );\n return attachmentRuntime as AttachmentRuntime<\"thread-composer\">;\n}\n\nexport function useEditComposerAttachmentRuntime(options?: {\n optional?: false | undefined;\n}): AttachmentRuntime<\"edit-composer\">;\nexport function useEditComposerAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"edit-composer\"> | null;\nexport function useEditComposerAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"edit-composer\"> | null {\n const attachmentRuntime = useAttachmentRuntime(options);\n if (!attachmentRuntime) return null;\n if (attachmentRuntime.source !== \"edit-composer\")\n throw new Error(\n \"This component must be used within a message's ComposerPrimitive.Attachments component.\",\n );\n\n return attachmentRuntime as AttachmentRuntime<\"edit-composer\">;\n}\n\nexport function useMessageAttachmentRuntime(options?: {\n optional?: false | undefined;\n}): AttachmentRuntime<\"message\">;\nexport function useMessageAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"message\"> | null;\nexport function useMessageAttachmentRuntime(options?: {\n optional?: boolean | undefined;\n}): AttachmentRuntime<\"message\"> | null {\n const attachmentRuntime = useAttachmentRuntime(options);\n if (!attachmentRuntime) return null;\n if (attachmentRuntime.source !== \"message\")\n throw new Error(\n \"This component must be used within a MessagePrimitive.Attachments component.\",\n );\n return attachmentRuntime as AttachmentRuntime<\"message\">;\n}\n\nexport const useAttachment = createStateHookForRuntime(useAttachmentRuntime);\n\nexport const useThreadComposerAttachment = createStateHookForRuntime(\n useThreadComposerAttachmentRuntime,\n);\nexport const useEditComposerAttachment = createStateHookForRuntime(\n useEditComposerAttachmentRuntime,\n);\nexport const useMessageAttachment = createStateHookForRuntime(\n useMessageAttachmentRuntime,\n);\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAI9B,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAMnC,IAAM,oBAAoB;AAAA,EAC/B;AACF;AAEA,IAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AACF;AAQO,SAAS,qBAAqB,SAER;AAC3B,QAAM,oBAAoB,qBAAqB,OAAO;AACtD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,SAAO,kBAAkB,qBAAqB;AAChD;AAQO,SAAS,mCAAmC,SAEH;AAC9C,QAAM,oBAAoB,qBAAqB,OAAO;AACtD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,MAAI,kBAAkB,WAAW;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,SAAO;AACT;AAQO,SAAS,iCAAiC,SAEH;AAC5C,QAAM,oBAAoB,qBAAqB,OAAO;AACtD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,MAAI,kBAAkB,WAAW;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAEF,SAAO;AACT;AAQO,SAAS,4BAA4B,SAEJ;AACtC,QAAM,oBAAoB,qBAAqB,OAAO;AACtD,MAAI,CAAC,kBAAmB,QAAO;AAC/B,MAAI,kBAAkB,WAAW;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,SAAO;AACT;AAEO,IAAM,gBAAgB,0BAA0B,oBAAoB;AAEpE,IAAM,8BAA8B;AAAA,EACzC;AACF;AACO,IAAM,4BAA4B;AAAA,EACvC;AACF;AACO,IAAM,uBAAuB;AAAA,EAClC;AACF;","names":[]}
@@ -1,13 +1,15 @@
1
1
  "use client";
2
- import { useMessageRuntime } from "./MessageContext";
3
- import { useThreadRuntime } from "./ThreadContext";
4
- import { createStateHookForRuntime } from "./utils/createStateHookForRuntime";
2
+
3
+ // src/context/react/ComposerContext.ts
4
+ import { useMessageRuntime } from "./MessageContext.js";
5
+ import { useThreadRuntime } from "./ThreadContext.js";
6
+ import { createStateHookForRuntime } from "./utils/createStateHookForRuntime.js";
5
7
  function useComposerRuntime(options) {
6
8
  const messageRuntime = useMessageRuntime({ optional: true });
7
9
  const threadRuntime = useThreadRuntime(options);
8
10
  return messageRuntime ? messageRuntime.composer : threadRuntime?.composer ?? null;
9
11
  }
10
- const useComposer = createStateHookForRuntime(useComposerRuntime);
12
+ var useComposer = createStateHookForRuntime(useComposerRuntime);
11
13
  export {
12
14
  useComposer,
13
15
  useComposerRuntime
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/ComposerContext.ts"],"sourcesContent":["\"use client\";\n\nimport { useMessageRuntime } from \"./MessageContext\";\nimport { useThreadRuntime } from \"./ThreadContext\";\nimport { ComposerRuntime } from \"../../api/ComposerRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport function useComposerRuntime(options?: {\n optional?: false | undefined;\n}): ComposerRuntime;\nexport function useComposerRuntime(options?: {\n optional?: boolean | undefined;\n}): ComposerRuntime | null;\nexport function useComposerRuntime(options?: {\n optional?: boolean | undefined;\n}): ComposerRuntime | null {\n const messageRuntime = useMessageRuntime({ optional: true });\n const threadRuntime = useThreadRuntime(options);\n return messageRuntime\n ? messageRuntime.composer\n : (threadRuntime?.composer ?? null);\n}\n\nexport const useComposer = createStateHookForRuntime(useComposerRuntime);\n"],"mappings":";AAEA,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AAEjC,SAAS,iCAAiC;AAQnC,SAAS,mBAAmB,SAER;AACzB,QAAM,iBAAiB,kBAAkB,EAAE,UAAU,KAAK,CAAC;AAC3D,QAAM,gBAAgB,iBAAiB,OAAO;AAC9C,SAAO,iBACH,eAAe,WACd,eAAe,YAAY;AAClC;AAEO,MAAM,cAAc,0BAA0B,kBAAkB;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/ComposerContext.ts"],"sourcesContent":["\"use client\";\n\nimport { useMessageRuntime } from \"./MessageContext\";\nimport { useThreadRuntime } from \"./ThreadContext\";\nimport { ComposerRuntime } from \"../../api/ComposerRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport function useComposerRuntime(options?: {\n optional?: false | undefined;\n}): ComposerRuntime;\nexport function useComposerRuntime(options?: {\n optional?: boolean | undefined;\n}): ComposerRuntime | null;\nexport function useComposerRuntime(options?: {\n optional?: boolean | undefined;\n}): ComposerRuntime | null {\n const messageRuntime = useMessageRuntime({ optional: true });\n const threadRuntime = useThreadRuntime(options);\n return messageRuntime\n ? messageRuntime.composer\n : (threadRuntime?.composer ?? null);\n}\n\nexport const useComposer = createStateHookForRuntime(useComposerRuntime);\n"],"mappings":";;;AAEA,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AAEjC,SAAS,iCAAiC;AAQnC,SAAS,mBAAmB,SAER;AACzB,QAAM,iBAAiB,kBAAkB,EAAE,UAAU,KAAK,CAAC;AAC3D,QAAM,gBAAgB,iBAAiB,OAAO;AAC9C,SAAO,iBACH,eAAe,WACd,eAAe,YAAY;AAClC;AAEO,IAAM,cAAc,0BAA0B,kBAAkB;","names":[]}
@@ -1,11 +1,13 @@
1
1
  "use client";
2
+
3
+ // src/context/react/ContentPartContext.ts
2
4
  import { createContext } from "react";
3
- import { createContextHook } from "./utils/createContextHook";
4
- import { createStateHookForRuntime } from "./utils/createStateHookForRuntime";
5
- const ContentPartContext = createContext(
5
+ import { createContextHook } from "./utils/createContextHook.js";
6
+ import { createStateHookForRuntime } from "./utils/createStateHookForRuntime.js";
7
+ var ContentPartContext = createContext(
6
8
  null
7
9
  );
8
- const useContentPartContext = createContextHook(
10
+ var useContentPartContext = createContextHook(
9
11
  ContentPartContext,
10
12
  "a component passed to <MessagePrimitive.Content components={...}>"
11
13
  );
@@ -14,7 +16,7 @@ function useContentPartRuntime(options) {
14
16
  if (!context) return null;
15
17
  return context.useContentPartRuntime();
16
18
  }
17
- const useContentPart = createStateHookForRuntime(useContentPartRuntime);
19
+ var useContentPart = createStateHookForRuntime(useContentPartRuntime);
18
20
  export {
19
21
  ContentPartContext,
20
22
  useContentPart,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/ContentPartContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ContentPartRuntime } from \"../../api/ContentPartRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type ContentPartContextValue = {\n useContentPartRuntime: UseBoundStore<ReadonlyStore<ContentPartRuntime>>;\n};\n\nexport const ContentPartContext = createContext<ContentPartContextValue | null>(\n null,\n);\n\nconst useContentPartContext = createContextHook(\n ContentPartContext,\n \"a component passed to <MessagePrimitive.Content components={...}>\",\n);\n\nexport function useContentPartRuntime(options?: {\n optional?: false | undefined;\n}): ContentPartRuntime;\nexport function useContentPartRuntime(options?: {\n optional?: boolean | undefined;\n}): ContentPartRuntime | null;\nexport function useContentPartRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useContentPartContext(options);\n if (!context) return null;\n return context.useContentPartRuntime();\n}\n\nexport const useContentPart = createStateHookForRuntime(useContentPartRuntime);\n"],"mappings":";AAEA,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAGlC,SAAS,iCAAiC;AAMnC,MAAM,qBAAqB;AAAA,EAChC;AACF;AAEA,MAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AACF;AAQO,SAAS,sBAAsB,SAEnC;AACD,QAAM,UAAU,sBAAsB,OAAO;AAC7C,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,sBAAsB;AACvC;AAEO,MAAM,iBAAiB,0BAA0B,qBAAqB;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/ContentPartContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ContentPartRuntime } from \"../../api/ContentPartRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type ContentPartContextValue = {\n useContentPartRuntime: UseBoundStore<ReadonlyStore<ContentPartRuntime>>;\n};\n\nexport const ContentPartContext = createContext<ContentPartContextValue | null>(\n null,\n);\n\nconst useContentPartContext = createContextHook(\n ContentPartContext,\n \"a component passed to <MessagePrimitive.Content components={...}>\",\n);\n\nexport function useContentPartRuntime(options?: {\n optional?: false | undefined;\n}): ContentPartRuntime;\nexport function useContentPartRuntime(options?: {\n optional?: boolean | undefined;\n}): ContentPartRuntime | null;\nexport function useContentPartRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useContentPartContext(options);\n if (!context) return null;\n return context.useContentPartRuntime();\n}\n\nexport const useContentPart = createStateHookForRuntime(useContentPartRuntime);\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAGlC,SAAS,iCAAiC;AAMnC,IAAM,qBAAqB;AAAA,EAChC;AACF;AAEA,IAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AACF;AAQO,SAAS,sBAAsB,SAEnC;AACD,QAAM,UAAU,sBAAsB,OAAO;AAC7C,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,sBAAsB;AACvC;AAEO,IAAM,iBAAiB,0BAA0B,qBAAqB;","names":[]}
@@ -1,10 +1,12 @@
1
1
  "use client";
2
+
3
+ // src/context/react/MessageContext.ts
2
4
  import { createContext } from "react";
3
- import { createContextHook } from "./utils/createContextHook";
4
- import { createContextStoreHook } from "./utils/createContextStoreHook";
5
- import { createStateHookForRuntime } from "./utils/createStateHookForRuntime";
6
- const MessageContext = createContext(null);
7
- const useMessageContext = createContextHook(
5
+ import { createContextHook } from "./utils/createContextHook.js";
6
+ import { createContextStoreHook } from "./utils/createContextStoreHook.js";
7
+ import { createStateHookForRuntime } from "./utils/createStateHookForRuntime.js";
8
+ var MessageContext = createContext(null);
9
+ var useMessageContext = createContextHook(
8
10
  MessageContext,
9
11
  "a component passed to <ThreadPrimitive.Messages components={...} />"
10
12
  );
@@ -13,12 +15,12 @@ function useMessageRuntime(options) {
13
15
  if (!context) return null;
14
16
  return context.useMessageRuntime();
15
17
  }
16
- const useMessage = createStateHookForRuntime(useMessageRuntime);
17
- const useEditComposerRuntime = (opt) => useMessageRuntime(opt)?.composer ?? null;
18
- const useEditComposer = createStateHookForRuntime(
18
+ var useMessage = createStateHookForRuntime(useMessageRuntime);
19
+ var useEditComposerRuntime = (opt) => useMessageRuntime(opt)?.composer ?? null;
20
+ var useEditComposer = createStateHookForRuntime(
19
21
  useEditComposerRuntime
20
22
  );
21
- const { useMessageUtils, useMessageUtilsStore } = createContextStoreHook(
23
+ var { useMessageUtils, useMessageUtilsStore } = createContextStoreHook(
22
24
  useMessageContext,
23
25
  "useMessageUtils"
24
26
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/MessageContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { MessageUtilsState } from \"../stores/MessageUtils\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { MessageRuntime } from \"../../api/MessageRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\nimport { EditComposerRuntime } from \"../../api\";\n\nexport type MessageContextValue = {\n useMessageRuntime: UseBoundStore<ReadonlyStore<MessageRuntime>>;\n useMessageUtils: UseBoundStore<ReadonlyStore<MessageUtilsState>>;\n};\n\nexport const MessageContext = createContext<MessageContextValue | null>(null);\n\nconst useMessageContext = createContextHook(\n MessageContext,\n \"a component passed to <ThreadPrimitive.Messages components={...} />\",\n);\n\nexport function useMessageRuntime(options?: {\n optional?: false | undefined;\n}): MessageRuntime;\nexport function useMessageRuntime(options?: {\n optional?: boolean | undefined;\n}): MessageRuntime | null;\nexport function useMessageRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useMessageContext(options);\n if (!context) return null;\n return context.useMessageRuntime();\n}\n\nexport const useMessage = createStateHookForRuntime(useMessageRuntime);\n\nconst useEditComposerRuntime = (opt: {\n optional: boolean | undefined;\n}): EditComposerRuntime | null => useMessageRuntime(opt)?.composer ?? null;\nexport const useEditComposer = createStateHookForRuntime(\n useEditComposerRuntime,\n);\n\nexport const { useMessageUtils, useMessageUtilsStore } = createContextStoreHook(\n useMessageContext,\n \"useMessageUtils\",\n);\n"],"mappings":";AAEA,SAAS,qBAAqB;AAG9B,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AAGvC,SAAS,iCAAiC;AAQnC,MAAM,iBAAiB,cAA0C,IAAI;AAE5E,MAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AACF;AAQO,SAAS,kBAAkB,SAE/B;AACD,QAAM,UAAU,kBAAkB,OAAO;AACzC,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,kBAAkB;AACnC;AAEO,MAAM,aAAa,0BAA0B,iBAAiB;AAErE,MAAM,yBAAyB,CAAC,QAEE,kBAAkB,GAAG,GAAG,YAAY;AAC/D,MAAM,kBAAkB;AAAA,EAC7B;AACF;AAEO,MAAM,EAAE,iBAAiB,qBAAqB,IAAI;AAAA,EACvD;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/MessageContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { MessageUtilsState } from \"../stores/MessageUtils\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { MessageRuntime } from \"../../api/MessageRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\nimport { EditComposerRuntime } from \"../../api\";\n\nexport type MessageContextValue = {\n useMessageRuntime: UseBoundStore<ReadonlyStore<MessageRuntime>>;\n useMessageUtils: UseBoundStore<ReadonlyStore<MessageUtilsState>>;\n};\n\nexport const MessageContext = createContext<MessageContextValue | null>(null);\n\nconst useMessageContext = createContextHook(\n MessageContext,\n \"a component passed to <ThreadPrimitive.Messages components={...} />\",\n);\n\nexport function useMessageRuntime(options?: {\n optional?: false | undefined;\n}): MessageRuntime;\nexport function useMessageRuntime(options?: {\n optional?: boolean | undefined;\n}): MessageRuntime | null;\nexport function useMessageRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useMessageContext(options);\n if (!context) return null;\n return context.useMessageRuntime();\n}\n\nexport const useMessage = createStateHookForRuntime(useMessageRuntime);\n\nconst useEditComposerRuntime = (opt: {\n optional: boolean | undefined;\n}): EditComposerRuntime | null => useMessageRuntime(opt)?.composer ?? null;\nexport const useEditComposer = createStateHookForRuntime(\n useEditComposerRuntime,\n);\n\nexport const { useMessageUtils, useMessageUtilsStore } = createContextStoreHook(\n useMessageContext,\n \"useMessageUtils\",\n);\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAG9B,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AAGvC,SAAS,iCAAiC;AAQnC,IAAM,iBAAiB,cAA0C,IAAI;AAE5E,IAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AACF;AAQO,SAAS,kBAAkB,SAE/B;AACD,QAAM,UAAU,kBAAkB,OAAO;AACzC,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,kBAAkB;AACnC;AAEO,IAAM,aAAa,0BAA0B,iBAAiB;AAErE,IAAM,yBAAyB,CAAC,QAEE,kBAAkB,GAAG,GAAG,YAAY;AAC/D,IAAM,kBAAkB;AAAA,EAC7B;AACF;AAEO,IAAM,EAAE,iBAAiB,qBAAqB,IAAI;AAAA,EACvD;AAAA,EACA;AACF;","names":[]}
@@ -1,9 +1,11 @@
1
1
  "use client";
2
+
3
+ // src/context/react/ThreadContext.ts
2
4
  import { createContext, useEffect, useState } from "react";
3
- import { createContextHook } from "./utils/createContextHook";
4
- import { createStateHookForRuntime } from "./utils/createStateHookForRuntime";
5
- const ThreadContext = createContext(null);
6
- const useThreadContext = createContextHook(
5
+ import { createContextHook } from "./utils/createContextHook.js";
6
+ import { createStateHookForRuntime } from "./utils/createStateHookForRuntime.js";
7
+ var ThreadContext = createContext(null);
8
+ var useThreadContext = createContextHook(
7
9
  ThreadContext,
8
10
  "AssistantRuntimeProvider"
9
11
  );
@@ -12,9 +14,9 @@ function useThreadRuntime(options) {
12
14
  if (!context) return null;
13
15
  return context.useThreadRuntime();
14
16
  }
15
- const useThread = createStateHookForRuntime(useThreadRuntime);
16
- const useThreadComposerRuntime = (opt) => useThreadRuntime(opt)?.composer ?? null;
17
- const useThreadComposer = createStateHookForRuntime(
17
+ var useThread = createStateHookForRuntime(useThreadRuntime);
18
+ var useThreadComposerRuntime = (opt) => useThreadRuntime(opt)?.composer ?? null;
19
+ var useThreadComposer = createStateHookForRuntime(
18
20
  useThreadComposerRuntime
19
21
  );
20
22
  function useThreadModelContext(options) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/ThreadContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext, useEffect, useState } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\nimport { ModelContext } from \"../../model-context\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\nimport { ThreadComposerRuntime } from \"../../api\";\n\nexport type ThreadContextValue = {\n useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntime>>;\n};\n\nexport const ThreadContext = createContext<ThreadContextValue | null>(null);\n\nconst useThreadContext = createContextHook(\n ThreadContext,\n \"AssistantRuntimeProvider\",\n);\n\nexport function useThreadRuntime(options?: {\n optional?: false | undefined;\n}): ThreadRuntime;\nexport function useThreadRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadRuntime | null;\nexport function useThreadRuntime(options?: { optional?: boolean | undefined }) {\n const context = useThreadContext(options);\n if (!context) return null;\n return context.useThreadRuntime();\n}\n\nexport const useThread = createStateHookForRuntime(useThreadRuntime);\n\nconst useThreadComposerRuntime = (opt: {\n optional: boolean | undefined;\n}): ThreadComposerRuntime | null => useThreadRuntime(opt)?.composer ?? null;\nexport const useThreadComposer = createStateHookForRuntime(\n useThreadComposerRuntime,\n);\n\nexport function useThreadModelContext(options?: {\n optional?: false | undefined;\n}): ModelContext;\nexport function useThreadModelContext(options?: {\n optional?: boolean | undefined;\n}): ModelContext | null;\nexport function useThreadModelContext(options?: {\n optional?: boolean | undefined;\n}): ModelContext | null {\n const [, rerender] = useState({});\n\n const runtime = useThreadRuntime(options);\n useEffect(() => {\n return runtime?.unstable_on(\"model-context-update\", () => rerender({}));\n }, [runtime]);\n\n if (!runtime) return null;\n return runtime?.getModelContext();\n}\n"],"mappings":";AAEA,SAAS,eAAe,WAAW,gBAAgB;AAGnD,SAAS,yBAAyB;AAGlC,SAAS,iCAAiC;AAOnC,MAAM,gBAAgB,cAAyC,IAAI;AAE1E,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AACF;AAQO,SAAS,iBAAiB,SAA8C;AAC7E,QAAM,UAAU,iBAAiB,OAAO;AACxC,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,iBAAiB;AAClC;AAEO,MAAM,YAAY,0BAA0B,gBAAgB;AAEnE,MAAM,2BAA2B,CAAC,QAEE,iBAAiB,GAAG,GAAG,YAAY;AAChE,MAAM,oBAAoB;AAAA,EAC/B;AACF;AAQO,SAAS,sBAAsB,SAEd;AACtB,QAAM,CAAC,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC;AAEhC,QAAM,UAAU,iBAAiB,OAAO;AACxC,YAAU,MAAM;AACd,WAAO,SAAS,YAAY,wBAAwB,MAAM,SAAS,CAAC,CAAC,CAAC;AAAA,EACxE,GAAG,CAAC,OAAO,CAAC;AAEZ,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,SAAS,gBAAgB;AAClC;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/ThreadContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext, useEffect, useState } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\nimport { ModelContext } from \"../../model-context\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\nimport { ThreadComposerRuntime } from \"../../api\";\n\nexport type ThreadContextValue = {\n useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntime>>;\n};\n\nexport const ThreadContext = createContext<ThreadContextValue | null>(null);\n\nconst useThreadContext = createContextHook(\n ThreadContext,\n \"AssistantRuntimeProvider\",\n);\n\nexport function useThreadRuntime(options?: {\n optional?: false | undefined;\n}): ThreadRuntime;\nexport function useThreadRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadRuntime | null;\nexport function useThreadRuntime(options?: { optional?: boolean | undefined }) {\n const context = useThreadContext(options);\n if (!context) return null;\n return context.useThreadRuntime();\n}\n\nexport const useThread = createStateHookForRuntime(useThreadRuntime);\n\nconst useThreadComposerRuntime = (opt: {\n optional: boolean | undefined;\n}): ThreadComposerRuntime | null => useThreadRuntime(opt)?.composer ?? null;\nexport const useThreadComposer = createStateHookForRuntime(\n useThreadComposerRuntime,\n);\n\nexport function useThreadModelContext(options?: {\n optional?: false | undefined;\n}): ModelContext;\nexport function useThreadModelContext(options?: {\n optional?: boolean | undefined;\n}): ModelContext | null;\nexport function useThreadModelContext(options?: {\n optional?: boolean | undefined;\n}): ModelContext | null {\n const [, rerender] = useState({});\n\n const runtime = useThreadRuntime(options);\n useEffect(() => {\n return runtime?.unstable_on(\"model-context-update\", () => rerender({}));\n }, [runtime]);\n\n if (!runtime) return null;\n return runtime?.getModelContext();\n}\n"],"mappings":";;;AAEA,SAAS,eAAe,WAAW,gBAAgB;AAGnD,SAAS,yBAAyB;AAGlC,SAAS,iCAAiC;AAOnC,IAAM,gBAAgB,cAAyC,IAAI;AAE1E,IAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AACF;AAQO,SAAS,iBAAiB,SAA8C;AAC7E,QAAM,UAAU,iBAAiB,OAAO;AACxC,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,iBAAiB;AAClC;AAEO,IAAM,YAAY,0BAA0B,gBAAgB;AAEnE,IAAM,2BAA2B,CAAC,QAEE,iBAAiB,GAAG,GAAG,YAAY;AAChE,IAAM,oBAAoB;AAAA,EAC/B;AACF;AAQO,SAAS,sBAAsB,SAEd;AACtB,QAAM,CAAC,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC;AAEhC,QAAM,UAAU,iBAAiB,OAAO;AACxC,YAAU,MAAM;AACd,WAAO,SAAS,YAAY,wBAAwB,MAAM,SAAS,CAAC,CAAC,CAAC;AAAA,EACxE,GAAG,CAAC,OAAO,CAAC;AAEZ,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,SAAS,gBAAgB;AAClC;","names":[]}
@@ -1,9 +1,11 @@
1
1
  "use client";
2
+
3
+ // src/context/react/ThreadListItemContext.ts
2
4
  import { createContext } from "react";
3
- import { createContextHook } from "./utils/createContextHook";
4
- import { createStateHookForRuntime } from "./utils/createStateHookForRuntime";
5
- const ThreadListItemContext = createContext(null);
6
- const useThreadListItemContext = createContextHook(
5
+ import { createContextHook } from "./utils/createContextHook.js";
6
+ import { createStateHookForRuntime } from "./utils/createStateHookForRuntime.js";
7
+ var ThreadListItemContext = createContext(null);
8
+ var useThreadListItemContext = createContextHook(
7
9
  ThreadListItemContext,
8
10
  "a component passed to <ThreadListPrimitive.Items components={...}>"
9
11
  );
@@ -12,7 +14,7 @@ function useThreadListItemRuntime(options) {
12
14
  if (!context) return null;
13
15
  return context.useThreadListItemRuntime();
14
16
  }
15
- const useThreadListItem = createStateHookForRuntime(
17
+ var useThreadListItem = createStateHookForRuntime(
16
18
  useThreadListItemRuntime
17
19
  );
18
20
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/ThreadListItemContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type ThreadListItemContextValue = {\n useThreadListItemRuntime: UseBoundStore<ReadonlyStore<ThreadListItemRuntime>>;\n};\n\nexport const ThreadListItemContext =\n createContext<ThreadListItemContextValue | null>(null);\n\nconst useThreadListItemContext = createContextHook(\n ThreadListItemContext,\n \"a component passed to <ThreadListPrimitive.Items components={...}>\",\n);\n\nexport function useThreadListItemRuntime(options?: {\n optional?: false | undefined;\n}): ThreadListItemRuntime;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadListItemRuntime | null;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useThreadListItemContext(options);\n if (!context) return null;\n return context.useThreadListItemRuntime();\n}\n\nexport const useThreadListItem = createStateHookForRuntime(\n useThreadListItemRuntime,\n);\n"],"mappings":";AAEA,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAGlC,SAAS,iCAAiC;AAMnC,MAAM,wBACX,cAAiD,IAAI;AAEvD,MAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AACF;AAQO,SAAS,yBAAyB,SAEtC;AACD,QAAM,UAAU,yBAAyB,OAAO;AAChD,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,yBAAyB;AAC1C;AAEO,MAAM,oBAAoB;AAAA,EAC/B;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/ThreadListItemContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { UseBoundStore } from \"zustand\";\nimport { ThreadListItemRuntime } from \"../../api/ThreadListItemRuntime\";\nimport { createStateHookForRuntime } from \"./utils/createStateHookForRuntime\";\n\nexport type ThreadListItemContextValue = {\n useThreadListItemRuntime: UseBoundStore<ReadonlyStore<ThreadListItemRuntime>>;\n};\n\nexport const ThreadListItemContext =\n createContext<ThreadListItemContextValue | null>(null);\n\nconst useThreadListItemContext = createContextHook(\n ThreadListItemContext,\n \"a component passed to <ThreadListPrimitive.Items components={...}>\",\n);\n\nexport function useThreadListItemRuntime(options?: {\n optional?: false | undefined;\n}): ThreadListItemRuntime;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}): ThreadListItemRuntime | null;\nexport function useThreadListItemRuntime(options?: {\n optional?: boolean | undefined;\n}) {\n const context = useThreadListItemContext(options);\n if (!context) return null;\n return context.useThreadListItemRuntime();\n}\n\nexport const useThreadListItem = createStateHookForRuntime(\n useThreadListItemRuntime,\n);\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAE9B,SAAS,yBAAyB;AAGlC,SAAS,iCAAiC;AAMnC,IAAM,wBACX,cAAiD,IAAI;AAEvD,IAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AACF;AAQO,SAAS,yBAAyB,SAEtC;AACD,QAAM,UAAU,yBAAyB,OAAO;AAChD,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,yBAAyB;AAC1C;AAEO,IAAM,oBAAoB;AAAA,EAC/B;AACF;","names":[]}
@@ -1,13 +1,15 @@
1
1
  "use client";
2
+
3
+ // src/context/react/ThreadViewportContext.ts
2
4
  import { createContext } from "react";
3
- import { createContextHook } from "./utils/createContextHook";
4
- import { createContextStoreHook } from "./utils/createContextStoreHook";
5
- const ThreadViewportContext = createContext(null);
6
- const useThreadViewportContext = createContextHook(
5
+ import { createContextHook } from "./utils/createContextHook.js";
6
+ import { createContextStoreHook } from "./utils/createContextStoreHook.js";
7
+ var ThreadViewportContext = createContext(null);
8
+ var useThreadViewportContext = createContextHook(
7
9
  ThreadViewportContext,
8
10
  "ThreadPrimitive.Viewport"
9
11
  );
10
- const { useThreadViewport, useThreadViewportStore } = createContextStoreHook(useThreadViewportContext, "useThreadViewport");
12
+ var { useThreadViewport, useThreadViewportStore } = createContextStoreHook(useThreadViewportContext, "useThreadViewport");
11
13
  export {
12
14
  ThreadViewportContext,
13
15
  useThreadViewport,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/ThreadViewportContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { ThreadViewportState } from \"../stores\";\n\nexport type ThreadViewportContextValue = {\n useThreadViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;\n};\n\nexport const ThreadViewportContext =\n createContext<ThreadViewportContextValue | null>(null);\n\nconst useThreadViewportContext = createContextHook(\n ThreadViewportContext,\n \"ThreadPrimitive.Viewport\",\n);\n\nexport const { useThreadViewport, useThreadViewportStore } =\n createContextStoreHook(useThreadViewportContext, \"useThreadViewport\");\n"],"mappings":";AAEA,SAAS,qBAAqB;AAG9B,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AAOhC,MAAM,wBACX,cAAiD,IAAI;AAEvD,MAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AACF;AAEO,MAAM,EAAE,mBAAmB,uBAAuB,IACvD,uBAAuB,0BAA0B,mBAAmB;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/react/ThreadViewportContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\nimport { ReadonlyStore } from \"../ReadonlyStore\";\nimport { UseBoundStore } from \"zustand\";\nimport { createContextHook } from \"./utils/createContextHook\";\nimport { createContextStoreHook } from \"./utils/createContextStoreHook\";\nimport { ThreadViewportState } from \"../stores\";\n\nexport type ThreadViewportContextValue = {\n useThreadViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;\n};\n\nexport const ThreadViewportContext =\n createContext<ThreadViewportContextValue | null>(null);\n\nconst useThreadViewportContext = createContextHook(\n ThreadViewportContext,\n \"ThreadPrimitive.Viewport\",\n);\n\nexport const { useThreadViewport, useThreadViewportStore } =\n createContextStoreHook(useThreadViewportContext, \"useThreadViewport\");\n"],"mappings":";;;AAEA,SAAS,qBAAqB;AAG9B,SAAS,yBAAyB;AAClC,SAAS,8BAA8B;AAOhC,IAAM,wBACX,cAAiD,IAAI;AAEvD,IAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AACF;AAEO,IAAM,EAAE,mBAAmB,uBAAuB,IACvD,uBAAuB,0BAA0B,mBAAmB;","names":[]}
@@ -1,39 +1,41 @@
1
1
  "use client";
2
+
3
+ // src/context/react/index.ts
2
4
  import {
3
5
  useAssistantRuntime,
4
6
  useThreadList,
5
7
  useToolUIs,
6
8
  useToolUIsStore
7
- } from "./AssistantContext";
9
+ } from "./AssistantContext.js";
8
10
  import {
9
11
  useThreadRuntime,
10
12
  useThread,
11
13
  useThreadComposer,
12
14
  useThreadModelContext,
13
15
  useThreadModelContext as useThreadModelContext2
14
- } from "./ThreadContext";
16
+ } from "./ThreadContext.js";
15
17
  import {
16
18
  useThreadViewport,
17
19
  useThreadViewportStore
18
- } from "./ThreadViewportContext";
20
+ } from "./ThreadViewportContext.js";
19
21
  import {
20
22
  useThreadListItemRuntime,
21
23
  useThreadListItem
22
- } from "./ThreadListItemContext";
24
+ } from "./ThreadListItemContext.js";
23
25
  import {
24
26
  useMessageRuntime,
25
27
  useMessage,
26
28
  useEditComposer,
27
29
  useMessageUtils,
28
30
  useMessageUtilsStore
29
- } from "./MessageContext";
30
- import { useContentPartRuntime, useContentPart } from "./ContentPartContext";
31
- import { useComposerRuntime, useComposer } from "./ComposerContext";
31
+ } from "./MessageContext.js";
32
+ import { useContentPartRuntime, useContentPart } from "./ContentPartContext.js";
33
+ import { useComposerRuntime, useComposer } from "./ComposerContext.js";
32
34
  import {
33
35
  useAttachment,
34
36
  useAttachmentRuntime
35
- } from "./AttachmentContext";
36
- import { useRuntimeState } from "./utils/useRuntimeState";
37
+ } from "./AttachmentContext.js";
38
+ import { useRuntimeState } from "./utils/useRuntimeState.js";
37
39
  export {
38
40
  useAssistantRuntime,
39
41
  useAttachment,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["\"use client\";\n// TODO createContextStoreHook does not work well with server-side nextjs bundler\n// use client necessary here for now\n\nexport {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelContext,\n /**\n * @deprecated This method was renamed to `useThreadModelContext`.\n */\n useThreadModelContext as useThreadModelConfig,\n} from \"./ThreadContext\";\n\nexport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"./ThreadViewportContext\";\n\nexport {\n useThreadListItemRuntime,\n useThreadListItem,\n} from \"./ThreadListItemContext\";\n\nexport {\n useMessageRuntime,\n useMessage,\n useEditComposer,\n useMessageUtils,\n useMessageUtilsStore,\n} from \"./MessageContext\";\nexport { useContentPartRuntime, useContentPart } from \"./ContentPartContext\";\nexport { useComposerRuntime, useComposer } from \"./ComposerContext\";\n\nexport {\n useAttachment,\n useAttachmentRuntime,\n\n // TODO decide if we want to export/drop these?\n // useEditComposerAttachment,\n // useEditComposerAttachmentRuntime,\n // useMessageAttachment,\n // useMessageAttachmentRuntime,\n // useThreadComposerAttachment,\n // useThreadComposerAttachmentRuntime,\n} from \"./AttachmentContext\";\n\nexport { useRuntimeState } from \"./utils/useRuntimeState\";\n"],"mappings":";AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIyB,yBAAzBA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB,sBAAsB;AACtD,SAAS,oBAAoB,mBAAmB;AAEhD;AAAA,EACE;AAAA,EACA;AAAA,OASK;AAEP,SAAS,uBAAuB;","names":["useThreadModelContext"]}
1
+ {"version":3,"sources":["../../../src/context/react/index.ts"],"sourcesContent":["\"use client\";\n// TODO createContextStoreHook does not work well with server-side nextjs bundler\n// use client necessary here for now\n\nexport {\n useAssistantRuntime,\n useThreadList,\n useToolUIs,\n useToolUIsStore,\n} from \"./AssistantContext\";\n\nexport {\n useThreadRuntime,\n useThread,\n useThreadComposer,\n useThreadModelContext,\n /**\n * @deprecated This method was renamed to `useThreadModelContext`.\n */\n useThreadModelContext as useThreadModelConfig,\n} from \"./ThreadContext\";\n\nexport {\n useThreadViewport,\n useThreadViewportStore,\n} from \"./ThreadViewportContext\";\n\nexport {\n useThreadListItemRuntime,\n useThreadListItem,\n} from \"./ThreadListItemContext\";\n\nexport {\n useMessageRuntime,\n useMessage,\n useEditComposer,\n useMessageUtils,\n useMessageUtilsStore,\n} from \"./MessageContext\";\nexport { useContentPartRuntime, useContentPart } from \"./ContentPartContext\";\nexport { useComposerRuntime, useComposer } from \"./ComposerContext\";\n\nexport {\n useAttachment,\n useAttachmentRuntime,\n\n // TODO decide if we want to export/drop these?\n // useEditComposerAttachment,\n // useEditComposerAttachmentRuntime,\n // useMessageAttachment,\n // useMessageAttachmentRuntime,\n // useThreadComposerAttachment,\n // useThreadComposerAttachmentRuntime,\n} from \"./AttachmentContext\";\n\nexport { useRuntimeState } from \"./utils/useRuntimeState\";\n"],"mappings":";;;AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAIyB,yBAAzBA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB,sBAAsB;AACtD,SAAS,oBAAoB,mBAAmB;AAEhD;AAAA,EACE;AAAA,EACA;AAAA,OASK;AAEP,SAAS,uBAAuB;","names":["useThreadModelContext"]}
@@ -1,4 +1,6 @@
1
1
  "use client";
2
+
3
+ // src/context/react/utils/createContextHook.ts
2
4
  import { useContext } from "react";
3
5
  function createContextHook(context, providerName) {
4
6
  function useContextHook(options) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/context/react/utils/createContextHook.ts"],"sourcesContent":["\"use client\";\n\nimport { useContext, Context } from \"react\";\n\n/**\n * Creates a context hook with optional support.\n * @param context - The React context to consume.\n * @param providerName - The name of the provider for error messages.\n * @returns A hook function that provides the context value.\n */\nexport function createContextHook<T>(\n context: Context<T | null>,\n providerName: string,\n) {\n function useContextHook(options?: {\n optional?: boolean | undefined;\n }): T | null {\n const contextValue = useContext(context);\n if (!options?.optional && !contextValue) {\n throw new Error(`This component must be used within ${providerName}.`);\n }\n return contextValue;\n }\n\n return useContextHook;\n}\n"],"mappings":";AAEA,SAAS,kBAA2B;AAQ7B,SAAS,kBACd,SACA,cACA;AACA,WAAS,eAAe,SAEX;AACX,UAAM,eAAe,WAAW,OAAO;AACvC,QAAI,CAAC,SAAS,YAAY,CAAC,cAAc;AACvC,YAAM,IAAI,MAAM,sCAAsC,YAAY,GAAG;AAAA,IACvE;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/context/react/utils/createContextHook.ts"],"sourcesContent":["\"use client\";\n\nimport { useContext, Context } from \"react\";\n\n/**\n * Creates a context hook with optional support.\n * @param context - The React context to consume.\n * @param providerName - The name of the provider for error messages.\n * @returns A hook function that provides the context value.\n */\nexport function createContextHook<T>(\n context: Context<T | null>,\n providerName: string,\n) {\n function useContextHook(options?: {\n optional?: boolean | undefined;\n }): T | null {\n const contextValue = useContext(context);\n if (!options?.optional && !contextValue) {\n throw new Error(`This component must be used within ${providerName}.`);\n }\n return contextValue;\n }\n\n return useContextHook;\n}\n"],"mappings":";;;AAEA,SAAS,kBAA2B;AAQ7B,SAAS,kBACd,SACA,cACA;AACA,WAAS,eAAe,SAEX;AACX,UAAM,eAAe,WAAW,OAAO;AACvC,QAAI,CAAC,SAAS,YAAY,CAAC,cAAc;AACvC,YAAM,IAAI,MAAM,sCAAsC,YAAY,GAAG;AAAA,IACvE;AACA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
@@ -1,3 +1,4 @@
1
+ // src/context/react/utils/createContextStoreHook.ts
1
2
  function createContextStoreHook(contextHook, contextKey) {
2
3
  function useStoreStoreHook(options) {
3
4
  const context = contextHook(options);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/context/react/utils/createContextStoreHook.ts"],"sourcesContent":["import { UseBoundStore } from \"zustand\";\nimport { ReadonlyStore } from \"../../ReadonlyStore\";\n\n/**\n * Creates hooks for accessing a store within a context.\n * @param contextHook - The hook to access the context.\n * @param contextKey - The key of the store in the context.\n * @returns An object containing the hooks: `use...` and `use...Store`.\n */\nexport function createContextStoreHook<T, K extends keyof T & string>(\n contextHook: (options?: { optional?: boolean }) => T | null,\n contextKey: K,\n) {\n type StoreType = T[K];\n type StateType = StoreType extends ReadonlyStore<infer S> ? S : never;\n\n // Define useStoreStoreHook with overloads\n function useStoreStoreHook(): ReadonlyStore<StateType>;\n function useStoreStoreHook(options: {\n optional: true;\n }): ReadonlyStore<StateType> | null;\n function useStoreStoreHook(options?: {\n optional?: boolean;\n }): ReadonlyStore<StateType> | null {\n const context = contextHook(options);\n if (!context) return null;\n return context[contextKey] as ReadonlyStore<StateType>;\n }\n\n // Define useStoreHook with overloads\n function useStoreHook(): StateType;\n function useStoreHook<TSelected>(\n selector: (state: StateType) => TSelected,\n ): TSelected;\n function useStoreHook(options: { optional: true }): StateType | null;\n function useStoreHook<TSelected>(options: {\n optional: true;\n selector?: (state: StateType) => TSelected;\n }): TSelected | null;\n function useStoreHook<TSelected>(\n param?:\n | ((state: StateType) => TSelected)\n | {\n optional?: boolean;\n selector?: (state: StateType) => TSelected;\n },\n ): TSelected | StateType | null {\n let optional = false;\n let selector: ((state: StateType) => TSelected) | undefined;\n\n if (typeof param === \"function\") {\n selector = param;\n } else if (param && typeof param === \"object\") {\n optional = !!param.optional;\n selector = param.selector;\n }\n\n const store = useStoreStoreHook({\n optional,\n } as any) as UseBoundStore<ReadonlyStore<StateType>>;\n if (!store) return null;\n return selector ? store(selector) : store();\n }\n\n // Return an object with keys based on contextKey\n return {\n [contextKey]: useStoreHook,\n [`${contextKey}Store`]: useStoreStoreHook,\n } as {\n [P in K]: typeof useStoreHook;\n } & {\n [P in `${K}Store`]: typeof useStoreStoreHook;\n };\n}\n"],"mappings":"AASO,SAAS,uBACd,aACA,YACA;AASA,WAAS,kBAAkB,SAES;AAClC,UAAM,UAAU,YAAY,OAAO;AACnC,QAAI,CAAC,QAAS,QAAO;AACrB,WAAO,QAAQ,UAAU;AAAA,EAC3B;AAYA,WAAS,aACP,OAM8B;AAC9B,QAAI,WAAW;AACf,QAAI;AAEJ,QAAI,OAAO,UAAU,YAAY;AAC/B,iBAAW;AAAA,IACb,WAAW,SAAS,OAAO,UAAU,UAAU;AAC7C,iBAAW,CAAC,CAAC,MAAM;AACnB,iBAAW,MAAM;AAAA,IACnB;AAEA,UAAM,QAAQ,kBAAkB;AAAA,MAC9B;AAAA,IACF,CAAQ;AACR,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,WAAW,MAAM,QAAQ,IAAI,MAAM;AAAA,EAC5C;AAGA,SAAO;AAAA,IACL,CAAC,UAAU,GAAG;AAAA,IACd,CAAC,GAAG,UAAU,OAAO,GAAG;AAAA,EAC1B;AAKF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/context/react/utils/createContextStoreHook.ts"],"sourcesContent":["import { UseBoundStore } from \"zustand\";\nimport { ReadonlyStore } from \"../../ReadonlyStore\";\n\n/**\n * Creates hooks for accessing a store within a context.\n * @param contextHook - The hook to access the context.\n * @param contextKey - The key of the store in the context.\n * @returns An object containing the hooks: `use...` and `use...Store`.\n */\nexport function createContextStoreHook<T, K extends keyof T & string>(\n contextHook: (options?: { optional?: boolean }) => T | null,\n contextKey: K,\n) {\n type StoreType = T[K];\n type StateType = StoreType extends ReadonlyStore<infer S> ? S : never;\n\n // Define useStoreStoreHook with overloads\n function useStoreStoreHook(): ReadonlyStore<StateType>;\n function useStoreStoreHook(options: {\n optional: true;\n }): ReadonlyStore<StateType> | null;\n function useStoreStoreHook(options?: {\n optional?: boolean;\n }): ReadonlyStore<StateType> | null {\n const context = contextHook(options);\n if (!context) return null;\n return context[contextKey] as ReadonlyStore<StateType>;\n }\n\n // Define useStoreHook with overloads\n function useStoreHook(): StateType;\n function useStoreHook<TSelected>(\n selector: (state: StateType) => TSelected,\n ): TSelected;\n function useStoreHook(options: { optional: true }): StateType | null;\n function useStoreHook<TSelected>(options: {\n optional: true;\n selector?: (state: StateType) => TSelected;\n }): TSelected | null;\n function useStoreHook<TSelected>(\n param?:\n | ((state: StateType) => TSelected)\n | {\n optional?: boolean;\n selector?: (state: StateType) => TSelected;\n },\n ): TSelected | StateType | null {\n let optional = false;\n let selector: ((state: StateType) => TSelected) | undefined;\n\n if (typeof param === \"function\") {\n selector = param;\n } else if (param && typeof param === \"object\") {\n optional = !!param.optional;\n selector = param.selector;\n }\n\n const store = useStoreStoreHook({\n optional,\n } as any) as UseBoundStore<ReadonlyStore<StateType>>;\n if (!store) return null;\n return selector ? store(selector) : store();\n }\n\n // Return an object with keys based on contextKey\n return {\n [contextKey]: useStoreHook,\n [`${contextKey}Store`]: useStoreStoreHook,\n } as {\n [P in K]: typeof useStoreHook;\n } & {\n [P in `${K}Store`]: typeof useStoreStoreHook;\n };\n}\n"],"mappings":";AASO,SAAS,uBACd,aACA,YACA;AASA,WAAS,kBAAkB,SAES;AAClC,UAAM,UAAU,YAAY,OAAO;AACnC,QAAI,CAAC,QAAS,QAAO;AACrB,WAAO,QAAQ,UAAU;AAAA,EAC3B;AAYA,WAAS,aACP,OAM8B;AAC9B,QAAI,WAAW;AACf,QAAI;AAEJ,QAAI,OAAO,UAAU,YAAY;AAC/B,iBAAW;AAAA,IACb,WAAW,SAAS,OAAO,UAAU,UAAU;AAC7C,iBAAW,CAAC,CAAC,MAAM;AACnB,iBAAW,MAAM;AAAA,IACnB;AAEA,UAAM,QAAQ,kBAAkB;AAAA,MAC9B;AAAA,IACF,CAAQ;AACR,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,WAAW,MAAM,QAAQ,IAAI,MAAM;AAAA,EAC5C;AAGA,SAAO;AAAA,IACL,CAAC,UAAU,GAAG;AAAA,IACd,CAAC,GAAG,UAAU,OAAO,GAAG;AAAA,EAC1B;AAKF;","names":[]}
@@ -1,6 +1,7 @@
1
+ // src/context/react/utils/createStateHookForRuntime.ts
1
2
  import {
2
3
  useRuntimeStateInternal
3
- } from "./useRuntimeState";
4
+ } from "./useRuntimeState.js";
4
5
  function createStateHookForRuntime(useRuntime) {
5
6
  function useStoreHook(param) {
6
7
  let optional = false;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/context/react/utils/createStateHookForRuntime.ts"],"sourcesContent":["import {\n SubscribableRuntime,\n useRuntimeStateInternal,\n} from \"./useRuntimeState\";\n\nexport function createStateHookForRuntime<TState>(\n useRuntime: (options: {\n optional: boolean | undefined;\n }) => SubscribableRuntime<TState> | null,\n) {\n // empty\n function useStoreHook(): TState;\n\n // selector\n function useStoreHook<TSelected>(\n selector: (state: TState) => TSelected,\n ): TSelected;\n\n // selector?\n function useStoreHook<TSelected>(\n selector: ((state: TState) => TSelected) | undefined,\n ): TSelected | TState;\n\n // optional=false\n function useStoreHook(options: { optional?: false | undefined }): TState;\n\n // optional?\n function useStoreHook(options: {\n optional?: boolean | undefined;\n }): TState | null;\n\n // optional=false, selector\n function useStoreHook<TSelected>(options: {\n optional?: false | undefined;\n selector: (state: TState) => TSelected;\n }): TSelected;\n\n // optional=false, selector?\n function useStoreHook<TSelected>(options: {\n optional?: false | undefined;\n selector: ((state: TState) => TSelected) | undefined;\n }): TSelected | TState;\n\n // optional?, selector\n function useStoreHook<TSelected>(options: {\n optional?: boolean | undefined;\n selector: (state: TState) => TSelected;\n }): TSelected | null;\n\n // optional?, selector?\n function useStoreHook<TSelected>(options: {\n optional?: boolean | undefined;\n selector: ((state: TState) => TSelected) | undefined;\n }): TSelected | TState | null;\n\n function useStoreHook<TSelected>(\n param?:\n | ((state: TState) => TSelected)\n | {\n optional?: boolean | undefined;\n selector?: ((state: TState) => TSelected) | undefined;\n },\n ): TSelected | TState | null {\n let optional = false;\n let selector: ((state: TState) => TSelected) | undefined;\n\n if (typeof param === \"function\") {\n selector = param;\n } else if (param) {\n optional = !!param.optional;\n selector = param.selector;\n }\n\n const store = useRuntime({ optional });\n if (!store) return null;\n\n // it is ok to call useRuntimeStateInternal conditionally because it will never become null if its available\n // eslint-ignore-next-line react-hooks/rules-of-hooks\n return useRuntimeStateInternal(store, selector);\n }\n\n return useStoreHook;\n}\n"],"mappings":"AAAA;AAAA,EAEE;AAAA,OACK;AAEA,SAAS,0BACd,YAGA;AA8CA,WAAS,aACP,OAM2B;AAC3B,QAAI,WAAW;AACf,QAAI;AAEJ,QAAI,OAAO,UAAU,YAAY;AAC/B,iBAAW;AAAA,IACb,WAAW,OAAO;AAChB,iBAAW,CAAC,CAAC,MAAM;AACnB,iBAAW,MAAM;AAAA,IACnB;AAEA,UAAM,QAAQ,WAAW,EAAE,SAAS,CAAC;AACrC,QAAI,CAAC,MAAO,QAAO;AAInB,WAAO,wBAAwB,OAAO,QAAQ;AAAA,EAChD;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/context/react/utils/createStateHookForRuntime.ts"],"sourcesContent":["import {\n SubscribableRuntime,\n useRuntimeStateInternal,\n} from \"./useRuntimeState\";\n\nexport function createStateHookForRuntime<TState>(\n useRuntime: (options: {\n optional: boolean | undefined;\n }) => SubscribableRuntime<TState> | null,\n) {\n // empty\n function useStoreHook(): TState;\n\n // selector\n function useStoreHook<TSelected>(\n selector: (state: TState) => TSelected,\n ): TSelected;\n\n // selector?\n function useStoreHook<TSelected>(\n selector: ((state: TState) => TSelected) | undefined,\n ): TSelected | TState;\n\n // optional=false\n function useStoreHook(options: { optional?: false | undefined }): TState;\n\n // optional?\n function useStoreHook(options: {\n optional?: boolean | undefined;\n }): TState | null;\n\n // optional=false, selector\n function useStoreHook<TSelected>(options: {\n optional?: false | undefined;\n selector: (state: TState) => TSelected;\n }): TSelected;\n\n // optional=false, selector?\n function useStoreHook<TSelected>(options: {\n optional?: false | undefined;\n selector: ((state: TState) => TSelected) | undefined;\n }): TSelected | TState;\n\n // optional?, selector\n function useStoreHook<TSelected>(options: {\n optional?: boolean | undefined;\n selector: (state: TState) => TSelected;\n }): TSelected | null;\n\n // optional?, selector?\n function useStoreHook<TSelected>(options: {\n optional?: boolean | undefined;\n selector: ((state: TState) => TSelected) | undefined;\n }): TSelected | TState | null;\n\n function useStoreHook<TSelected>(\n param?:\n | ((state: TState) => TSelected)\n | {\n optional?: boolean | undefined;\n selector?: ((state: TState) => TSelected) | undefined;\n },\n ): TSelected | TState | null {\n let optional = false;\n let selector: ((state: TState) => TSelected) | undefined;\n\n if (typeof param === \"function\") {\n selector = param;\n } else if (param) {\n optional = !!param.optional;\n selector = param.selector;\n }\n\n const store = useRuntime({ optional });\n if (!store) return null;\n\n // it is ok to call useRuntimeStateInternal conditionally because it will never become null if its available\n // eslint-ignore-next-line react-hooks/rules-of-hooks\n return useRuntimeStateInternal(store, selector);\n }\n\n return useStoreHook;\n}\n"],"mappings":";AAAA;AAAA,EAEE;AAAA,OACK;AAEA,SAAS,0BACd,YAGA;AA8CA,WAAS,aACP,OAM2B;AAC3B,QAAI,WAAW;AACf,QAAI;AAEJ,QAAI,OAAO,UAAU,YAAY;AAC/B,iBAAW;AAAA,IACb,WAAW,OAAO;AAChB,iBAAW,CAAC,CAAC,MAAM;AACnB,iBAAW,MAAM;AAAA,IACnB;AAEA,UAAM,QAAQ,WAAW,EAAE,SAAS,CAAC;AACrC,QAAI,CAAC,MAAO,QAAO;AAInB,WAAO,wBAAwB,OAAO,QAAQ;AAAA,EAChD;AAEA,SAAO;AACT;","names":[]}
@@ -1,24 +1,5 @@
1
- const debugVerifyPrototype = (runtime, prototype) => {
2
- const unboundMethods = Object.getOwnPropertyNames(prototype).filter(
3
- (methodStr) => {
4
- const descriptor = Object.getOwnPropertyDescriptor(prototype, methodStr);
5
- const isMethod = descriptor && typeof descriptor.value === "function";
6
- if (!isMethod) return false;
7
- const methodName = methodStr;
8
- return isMethod && !methodName.startsWith("_") && methodName !== "constructor" && prototype[methodName] === runtime[methodName];
9
- }
10
- );
11
- if (unboundMethods.length > 0) {
12
- throw new Error(
13
- "The following methods are not bound: " + JSON.stringify(unboundMethods)
14
- );
15
- }
16
- const prototypePrototype = Object.getPrototypeOf(prototype);
17
- if (prototypePrototype && prototypePrototype !== Object.prototype) {
18
- debugVerifyPrototype(runtime, prototypePrototype);
19
- }
20
- };
21
- const ensureBinding = (r) => {
1
+ // src/context/react/utils/ensureBinding.ts
2
+ var ensureBinding = (r) => {
22
3
  const runtime = r;
23
4
  if (runtime.__isBound) return;
24
5
  runtime.__internal_bindMethods?.();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/context/react/utils/ensureBinding.ts"],"sourcesContent":["type Bindable = {\n __internal_bindMethods?: () => void;\n __isBound?: boolean;\n};\nconst debugVerifyPrototype = (\n runtime: Record<string, unknown>,\n prototype: any,\n) => {\n const unboundMethods = Object.getOwnPropertyNames(prototype).filter(\n (methodStr) => {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, methodStr);\n const isMethod = descriptor && typeof descriptor.value === \"function\";\n if (!isMethod) return false;\n\n const methodName = methodStr as keyof typeof runtime | \"constructor\";\n return (\n isMethod &&\n !methodName.startsWith(\"_\") &&\n methodName !== \"constructor\" &&\n prototype[methodName] === runtime[methodName]\n );\n },\n );\n\n if (unboundMethods.length > 0) {\n throw new Error(\n \"The following methods are not bound: \" + JSON.stringify(unboundMethods),\n );\n }\n\n const prototypePrototype = Object.getPrototypeOf(prototype);\n if (prototypePrototype && prototypePrototype !== Object.prototype) {\n debugVerifyPrototype(runtime, prototypePrototype);\n }\n};\nexport const ensureBinding = (r: unknown) => {\n const runtime = r as Bindable;\n if (runtime.__isBound) return;\n\n runtime.__internal_bindMethods?.();\n runtime.__isBound = true;\n\n // @ts-expect-error - strip this out in production build\n DEV: debugVerifyPrototype(runtime, Object.getPrototypeOf(runtime));\n};\n"],"mappings":"AAIA,MAAM,uBAAuB,CAC3B,SACA,cACG;AACH,QAAM,iBAAiB,OAAO,oBAAoB,SAAS,EAAE;AAAA,IAC3D,CAAC,cAAc;AACb,YAAM,aAAa,OAAO,yBAAyB,WAAW,SAAS;AACvE,YAAM,WAAW,cAAc,OAAO,WAAW,UAAU;AAC3D,UAAI,CAAC,SAAU,QAAO;AAEtB,YAAM,aAAa;AACnB,aACE,YACA,CAAC,WAAW,WAAW,GAAG,KAC1B,eAAe,iBACf,UAAU,UAAU,MAAM,QAAQ,UAAU;AAAA,IAEhD;AAAA,EACF;AAEA,MAAI,eAAe,SAAS,GAAG;AAC7B,UAAM,IAAI;AAAA,MACR,0CAA0C,KAAK,UAAU,cAAc;AAAA,IACzE;AAAA,EACF;AAEA,QAAM,qBAAqB,OAAO,eAAe,SAAS;AAC1D,MAAI,sBAAsB,uBAAuB,OAAO,WAAW;AACjE,yBAAqB,SAAS,kBAAkB;AAAA,EAClD;AACF;AACO,MAAM,gBAAgB,CAAC,MAAe;AAC3C,QAAM,UAAU;AAChB,MAAI,QAAQ,UAAW;AAEvB,UAAQ,yBAAyB;AACjC,UAAQ,YAAY;AAItB;","names":[]}
1
+ {"version":3,"sources":["../../../../src/context/react/utils/ensureBinding.ts"],"sourcesContent":["type Bindable = {\n __internal_bindMethods?: () => void;\n __isBound?: boolean;\n};\nconst debugVerifyPrototype = (\n runtime: Record<string, unknown>,\n prototype: any,\n) => {\n const unboundMethods = Object.getOwnPropertyNames(prototype).filter(\n (methodStr) => {\n const descriptor = Object.getOwnPropertyDescriptor(prototype, methodStr);\n const isMethod = descriptor && typeof descriptor.value === \"function\";\n if (!isMethod) return false;\n\n const methodName = methodStr as keyof typeof runtime | \"constructor\";\n return (\n isMethod &&\n !methodName.startsWith(\"_\") &&\n methodName !== \"constructor\" &&\n prototype[methodName] === runtime[methodName]\n );\n },\n );\n\n if (unboundMethods.length > 0) {\n throw new Error(\n \"The following methods are not bound: \" + JSON.stringify(unboundMethods),\n );\n }\n\n const prototypePrototype = Object.getPrototypeOf(prototype);\n if (prototypePrototype && prototypePrototype !== Object.prototype) {\n debugVerifyPrototype(runtime, prototypePrototype);\n }\n};\nexport const ensureBinding = (r: unknown) => {\n const runtime = r as Bindable;\n if (runtime.__isBound) return;\n\n runtime.__internal_bindMethods?.();\n runtime.__isBound = true;\n\n // @ts-expect-error - strip this out in production build\n DEV: debugVerifyPrototype(runtime, Object.getPrototypeOf(runtime));\n};\n"],"mappings":";AAmCO,IAAM,gBAAgB,CAAC,MAAe;AAC3C,QAAM,UAAU;AAChB,MAAI,QAAQ,UAAW;AAEvB,UAAQ,yBAAyB;AACjC,UAAQ,YAAY;AAItB;","names":[]}
@@ -1,5 +1,6 @@
1
+ // src/context/react/utils/useRuntimeState.ts
1
2
  import { useDebugValue, useSyncExternalStore } from "react";
2
- import { ensureBinding } from "./ensureBinding";
3
+ import { ensureBinding } from "./ensureBinding.js";
3
4
  function useRuntimeStateInternal(runtime, selector = identity) {
4
5
  ensureBinding(runtime);
5
6
  const slice = useSyncExternalStore(
@@ -10,7 +11,7 @@ function useRuntimeStateInternal(runtime, selector = identity) {
10
11
  useDebugValue(slice);
11
12
  return slice;
12
13
  }
13
- const identity = (arg) => arg;
14
+ var identity = (arg) => arg;
14
15
  function useRuntimeState(runtime, selector) {
15
16
  return useRuntimeStateInternal(runtime, selector);
16
17
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/context/react/utils/useRuntimeState.ts"],"sourcesContent":["import { useDebugValue, useSyncExternalStore } from \"react\";\nimport { Unsubscribe } from \"../../../types\";\nimport { ensureBinding } from \"./ensureBinding\";\n\nexport type SubscribableRuntime<TState> = {\n getState: () => TState;\n subscribe: (callback: () => void) => Unsubscribe;\n};\n\nexport function useRuntimeStateInternal<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected | TState) | undefined = identity,\n): TSelected | TState {\n // TODO move to useRuntimeState\n ensureBinding(runtime);\n\n const slice = useSyncExternalStore(\n runtime.subscribe,\n () => selector(runtime.getState()),\n () => selector(runtime.getState()),\n );\n useDebugValue(slice);\n return slice;\n}\n\nconst identity = <T>(arg: T): T => arg;\nexport function useRuntimeState<TState>(\n runtime: SubscribableRuntime<TState>,\n): TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: (state: TState) => TSelected,\n): TSelected;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected) | undefined,\n): TSelected | TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector?: ((state: TState) => TSelected) | undefined,\n): TSelected | TState {\n // ensure that the runtime is bound\n // ensureBinding(runtime);\n\n return useRuntimeStateInternal(runtime, selector);\n}\n"],"mappings":"AAAA,SAAS,eAAe,4BAA4B;AAEpD,SAAS,qBAAqB;AAOvB,SAAS,wBACd,SACA,WAAgE,UAC5C;AAEpB,gBAAc,OAAO;AAErB,QAAM,QAAQ;AAAA,IACZ,QAAQ;AAAA,IACR,MAAM,SAAS,QAAQ,SAAS,CAAC;AAAA,IACjC,MAAM,SAAS,QAAQ,SAAS,CAAC;AAAA,EACnC;AACA,gBAAc,KAAK;AACnB,SAAO;AACT;AAEA,MAAM,WAAW,CAAI,QAAc;AAY5B,SAAS,gBACd,SACA,UACoB;AAIpB,SAAO,wBAAwB,SAAS,QAAQ;AAClD;","names":[]}
1
+ {"version":3,"sources":["../../../../src/context/react/utils/useRuntimeState.ts"],"sourcesContent":["import { useDebugValue, useSyncExternalStore } from \"react\";\nimport { Unsubscribe } from \"../../../types\";\nimport { ensureBinding } from \"./ensureBinding\";\n\nexport type SubscribableRuntime<TState> = {\n getState: () => TState;\n subscribe: (callback: () => void) => Unsubscribe;\n};\n\nexport function useRuntimeStateInternal<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected | TState) | undefined = identity,\n): TSelected | TState {\n // TODO move to useRuntimeState\n ensureBinding(runtime);\n\n const slice = useSyncExternalStore(\n runtime.subscribe,\n () => selector(runtime.getState()),\n () => selector(runtime.getState()),\n );\n useDebugValue(slice);\n return slice;\n}\n\nconst identity = <T>(arg: T): T => arg;\nexport function useRuntimeState<TState>(\n runtime: SubscribableRuntime<TState>,\n): TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: (state: TState) => TSelected,\n): TSelected;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector: ((state: TState) => TSelected) | undefined,\n): TSelected | TState;\nexport function useRuntimeState<TState, TSelected>(\n runtime: SubscribableRuntime<TState>,\n selector?: ((state: TState) => TSelected) | undefined,\n): TSelected | TState {\n // ensure that the runtime is bound\n // ensureBinding(runtime);\n\n return useRuntimeStateInternal(runtime, selector);\n}\n"],"mappings":";AAAA,SAAS,eAAe,4BAA4B;AAEpD,SAAS,qBAAqB;AAOvB,SAAS,wBACd,SACA,WAAgE,UAC5C;AAEpB,gBAAc,OAAO;AAErB,QAAM,QAAQ;AAAA,IACZ,QAAQ;AAAA,IACR,MAAM,SAAS,QAAQ,SAAS,CAAC;AAAA,IACjC,MAAM,SAAS,QAAQ,SAAS,CAAC;AAAA,EACnC;AACA,gBAAc,KAAK;AACnB,SAAO;AACT;AAEA,IAAM,WAAW,CAAI,QAAc;AAY5B,SAAS,gBACd,SACA,UACoB;AAIpB,SAAO,wBAAwB,SAAS,QAAQ;AAClD;","names":[]}
@@ -1,5 +1,6 @@
1
+ // src/context/stores/AssistantToolUIs.ts
1
2
  import { create } from "zustand";
2
- const makeAssistantToolUIsStore = () => create((set) => {
3
+ var makeAssistantToolUIsStore = () => create((set) => {
3
4
  const renderers = /* @__PURE__ */ new Map();
4
5
  return Object.freeze({
5
6
  getToolUI: (name) => {