@assistant-ui/react 0.5.100 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (709) hide show
  1. package/dist/api/AssistantRuntime.d.ts +2 -52
  2. package/dist/api/AssistantRuntime.d.ts.map +1 -1
  3. package/dist/api/AssistantRuntime.js +0 -8
  4. package/dist/api/AssistantRuntime.js.map +1 -1
  5. package/dist/api/AssistantRuntime.mjs +0 -8
  6. package/dist/api/AssistantRuntime.mjs.map +1 -1
  7. package/dist/api/AttachmentRuntime.d.ts +0 -12
  8. package/dist/api/AttachmentRuntime.d.ts.map +1 -1
  9. package/dist/api/AttachmentRuntime.js.map +1 -1
  10. package/dist/api/AttachmentRuntime.mjs.map +1 -1
  11. package/dist/api/ComposerRuntime.d.ts +5 -121
  12. package/dist/api/ComposerRuntime.d.ts.map +1 -1
  13. package/dist/api/ComposerRuntime.js +4 -84
  14. package/dist/api/ComposerRuntime.js.map +1 -1
  15. package/dist/api/ComposerRuntime.mjs +4 -84
  16. package/dist/api/ComposerRuntime.mjs.map +1 -1
  17. package/dist/api/ContentPartRuntime.d.ts +0 -4
  18. package/dist/api/ContentPartRuntime.d.ts.map +1 -1
  19. package/dist/api/ContentPartRuntime.js.map +1 -1
  20. package/dist/api/ContentPartRuntime.mjs.map +1 -1
  21. package/dist/api/MessageRuntime.d.ts +1 -12
  22. package/dist/api/MessageRuntime.d.ts.map +1 -1
  23. package/dist/api/MessageRuntime.js +9 -5
  24. package/dist/api/MessageRuntime.js.map +1 -1
  25. package/dist/api/MessageRuntime.mjs +8 -4
  26. package/dist/api/MessageRuntime.mjs.map +1 -1
  27. package/dist/api/ThreadListItemRuntime.d.ts +9 -5
  28. package/dist/api/ThreadListItemRuntime.d.ts.map +1 -1
  29. package/dist/api/ThreadListItemRuntime.js +10 -6
  30. package/dist/api/ThreadListItemRuntime.js.map +1 -1
  31. package/dist/api/ThreadListItemRuntime.mjs +10 -6
  32. package/dist/api/ThreadListItemRuntime.mjs.map +1 -1
  33. package/dist/api/ThreadListRuntime.d.ts +5 -23
  34. package/dist/api/ThreadListRuntime.d.ts.map +1 -1
  35. package/dist/api/ThreadListRuntime.js +23 -26
  36. package/dist/api/ThreadListRuntime.js.map +1 -1
  37. package/dist/api/ThreadListRuntime.mjs +23 -26
  38. package/dist/api/ThreadListRuntime.mjs.map +1 -1
  39. package/dist/api/ThreadRuntime.d.ts +17 -164
  40. package/dist/api/ThreadRuntime.d.ts.map +1 -1
  41. package/dist/api/ThreadRuntime.js +2 -94
  42. package/dist/api/ThreadRuntime.js.map +1 -1
  43. package/dist/api/ThreadRuntime.mjs +2 -94
  44. package/dist/api/ThreadRuntime.mjs.map +1 -1
  45. package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
  46. package/dist/context/providers/AssistantRuntimeProvider.js +0 -1
  47. package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
  48. package/dist/context/providers/AssistantRuntimeProvider.mjs +0 -1
  49. package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
  50. package/dist/context/providers/TextContentPartProvider.d.ts.map +1 -1
  51. package/dist/context/providers/TextContentPartProvider.js +0 -2
  52. package/dist/context/providers/TextContentPartProvider.js.map +1 -1
  53. package/dist/context/providers/TextContentPartProvider.mjs +0 -2
  54. package/dist/context/providers/TextContentPartProvider.mjs.map +1 -1
  55. package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts +1 -4
  56. package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
  57. package/dist/context/providers/ThreadRuntimeProvider.d.ts.map +1 -1
  58. package/dist/context/providers/ThreadRuntimeProvider.js +1 -13
  59. package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
  60. package/dist/context/providers/ThreadRuntimeProvider.mjs +1 -13
  61. package/dist/context/providers/ThreadRuntimeProvider.mjs.map +1 -1
  62. package/dist/context/react/AssistantContext.d.ts +16 -88
  63. package/dist/context/react/AssistantContext.d.ts.map +1 -1
  64. package/dist/context/react/AssistantContext.js +0 -15
  65. package/dist/context/react/AssistantContext.js.map +1 -1
  66. package/dist/context/react/AssistantContext.mjs +0 -11
  67. package/dist/context/react/AssistantContext.mjs.map +1 -1
  68. package/dist/context/react/AttachmentContext.d.ts +16 -32
  69. package/dist/context/react/AttachmentContext.d.ts.map +1 -1
  70. package/dist/context/react/ComposerContext.d.ts +0 -5
  71. package/dist/context/react/ComposerContext.d.ts.map +1 -1
  72. package/dist/context/react/ComposerContext.js +3 -5
  73. package/dist/context/react/ComposerContext.js.map +1 -1
  74. package/dist/context/react/ComposerContext.mjs +2 -3
  75. package/dist/context/react/ComposerContext.mjs.map +1 -1
  76. package/dist/context/react/ContentPartContext.d.ts +0 -5
  77. package/dist/context/react/ContentPartContext.d.ts.map +1 -1
  78. package/dist/context/react/ContentPartContext.js +3 -5
  79. package/dist/context/react/ContentPartContext.js.map +1 -1
  80. package/dist/context/react/ContentPartContext.mjs +2 -3
  81. package/dist/context/react/ContentPartContext.mjs.map +1 -1
  82. package/dist/context/react/MessageContext.d.ts +0 -10
  83. package/dist/context/react/MessageContext.d.ts.map +1 -1
  84. package/dist/context/react/MessageContext.js +2 -6
  85. package/dist/context/react/MessageContext.js.map +1 -1
  86. package/dist/context/react/MessageContext.mjs +2 -4
  87. package/dist/context/react/MessageContext.mjs.map +1 -1
  88. package/dist/context/react/ThreadContext.d.ts +25 -1635
  89. package/dist/context/react/ThreadContext.d.ts.map +1 -1
  90. package/dist/context/react/ThreadContext.js +4 -30
  91. package/dist/context/react/ThreadContext.js.map +1 -1
  92. package/dist/context/react/ThreadContext.mjs +4 -22
  93. package/dist/context/react/ThreadContext.mjs.map +1 -1
  94. package/dist/context/react/ThreadListItemContext.d.ts +6 -24
  95. package/dist/context/react/ThreadListItemContext.d.ts.map +1 -1
  96. package/dist/context/react/index.d.ts +5 -101
  97. package/dist/context/react/index.d.ts.map +1 -1
  98. package/dist/context/react/index.js +0 -38
  99. package/dist/context/react/index.js.map +1 -1
  100. package/dist/context/react/index.mjs +5 -49
  101. package/dist/context/react/index.mjs.map +1 -1
  102. package/dist/index.d.ts +0 -1
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +0 -2
  105. package/dist/index.js.map +1 -1
  106. package/dist/index.mjs +0 -1
  107. package/dist/index.mjs.map +1 -1
  108. package/dist/internal.d.ts +1 -0
  109. package/dist/internal.d.ts.map +1 -1
  110. package/dist/internal.js +3 -0
  111. package/dist/internal.js.map +1 -1
  112. package/dist/internal.mjs +2 -0
  113. package/dist/internal.mjs.map +1 -1
  114. package/dist/model-config/useAssistantToolUI.d.ts.map +1 -1
  115. package/dist/model-config/useAssistantToolUI.js.map +1 -1
  116. package/dist/model-config/useAssistantToolUI.mjs.map +1 -1
  117. package/dist/primitive-hooks/contentPart/useContentPartDisplay.d.ts +0 -3
  118. package/dist/primitive-hooks/contentPart/useContentPartDisplay.d.ts.map +1 -1
  119. package/dist/primitive-hooks/contentPart/useContentPartDisplay.js.map +1 -1
  120. package/dist/primitive-hooks/contentPart/useContentPartDisplay.mjs.map +1 -1
  121. package/dist/primitive-hooks/contentPart/useContentPartImage.d.ts +0 -3
  122. package/dist/primitive-hooks/contentPart/useContentPartImage.d.ts.map +1 -1
  123. package/dist/primitive-hooks/contentPart/useContentPartImage.js.map +1 -1
  124. package/dist/primitive-hooks/contentPart/useContentPartImage.mjs.map +1 -1
  125. package/dist/primitive-hooks/contentPart/useContentPartText.d.ts +0 -3
  126. package/dist/primitive-hooks/contentPart/useContentPartText.d.ts.map +1 -1
  127. package/dist/primitive-hooks/contentPart/useContentPartText.js.map +1 -1
  128. package/dist/primitive-hooks/contentPart/useContentPartText.mjs.map +1 -1
  129. package/dist/primitive-hooks/index.d.ts +0 -5
  130. package/dist/primitive-hooks/index.d.ts.map +1 -1
  131. package/dist/primitive-hooks/index.js +1 -11
  132. package/dist/primitive-hooks/index.js.map +1 -1
  133. package/dist/primitive-hooks/index.mjs +0 -5
  134. package/dist/primitive-hooks/index.mjs.map +1 -1
  135. package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -5
  136. package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
  137. package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
  138. package/dist/primitives/actionBar/ActionBarCopy.mjs.map +1 -1
  139. package/dist/primitives/actionBar/ActionBarEdit.d.ts +0 -4
  140. package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
  141. package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
  142. package/dist/primitives/actionBar/ActionBarEdit.mjs.map +1 -1
  143. package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +0 -4
  144. package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
  145. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
  146. package/dist/primitives/actionBar/ActionBarFeedbackNegative.mjs.map +1 -1
  147. package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +0 -4
  148. package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
  149. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
  150. package/dist/primitives/actionBar/ActionBarFeedbackPositive.mjs.map +1 -1
  151. package/dist/primitives/actionBar/ActionBarReload.d.ts +0 -4
  152. package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
  153. package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
  154. package/dist/primitives/actionBar/ActionBarReload.mjs.map +1 -1
  155. package/dist/primitives/actionBar/ActionBarRoot.d.ts +0 -4
  156. package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
  157. package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
  158. package/dist/primitives/actionBar/ActionBarRoot.mjs.map +1 -1
  159. package/dist/primitives/actionBar/ActionBarSpeak.d.ts +0 -4
  160. package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
  161. package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
  162. package/dist/primitives/actionBar/ActionBarSpeak.mjs.map +1 -1
  163. package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts +0 -4
  164. package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
  165. package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
  166. package/dist/primitives/actionBar/ActionBarStopSpeaking.mjs.map +1 -1
  167. package/dist/primitives/assistantModal/AssistantModalContent.d.ts +0 -4
  168. package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
  169. package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
  170. package/dist/primitives/assistantModal/AssistantModalContent.mjs.map +1 -1
  171. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts +0 -4
  172. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
  173. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  174. package/dist/primitives/assistantModal/AssistantModalRoot.mjs.map +1 -1
  175. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts +0 -4
  176. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
  177. package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
  178. package/dist/primitives/assistantModal/AssistantModalTrigger.mjs.map +1 -1
  179. package/dist/primitives/branchPicker/BranchPickerCount.d.ts +0 -4
  180. package/dist/primitives/branchPicker/BranchPickerCount.d.ts.map +1 -1
  181. package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
  182. package/dist/primitives/branchPicker/BranchPickerCount.mjs.map +1 -1
  183. package/dist/primitives/branchPicker/BranchPickerNext.d.ts +0 -4
  184. package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
  185. package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
  186. package/dist/primitives/branchPicker/BranchPickerNext.mjs.map +1 -1
  187. package/dist/primitives/branchPicker/BranchPickerNumber.d.ts +0 -4
  188. package/dist/primitives/branchPicker/BranchPickerNumber.d.ts.map +1 -1
  189. package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
  190. package/dist/primitives/branchPicker/BranchPickerNumber.mjs.map +1 -1
  191. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +0 -4
  192. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
  193. package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
  194. package/dist/primitives/branchPicker/BranchPickerPrevious.mjs.map +1 -1
  195. package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +0 -4
  196. package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
  197. package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
  198. package/dist/primitives/branchPicker/BranchPickerRoot.mjs.map +1 -1
  199. package/dist/primitives/composer/ComposerAddAttachment.d.ts +1 -5
  200. package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
  201. package/dist/primitives/composer/ComposerAddAttachment.js +2 -2
  202. package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
  203. package/dist/primitives/composer/ComposerAddAttachment.mjs +1 -1
  204. package/dist/primitives/composer/ComposerAddAttachment.mjs.map +1 -1
  205. package/dist/primitives/composer/ComposerAttachments.d.ts +0 -4
  206. package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
  207. package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
  208. package/dist/primitives/composer/ComposerAttachments.mjs.map +1 -1
  209. package/dist/primitives/composer/ComposerCancel.d.ts +0 -4
  210. package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
  211. package/dist/primitives/composer/ComposerCancel.js.map +1 -1
  212. package/dist/primitives/composer/ComposerCancel.mjs.map +1 -1
  213. package/dist/primitives/composer/ComposerIf.d.ts +0 -4
  214. package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
  215. package/dist/primitives/composer/ComposerIf.js.map +1 -1
  216. package/dist/primitives/composer/ComposerIf.mjs.map +1 -1
  217. package/dist/primitives/composer/ComposerInput.d.ts +0 -4
  218. package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
  219. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  220. package/dist/primitives/composer/ComposerInput.mjs.map +1 -1
  221. package/dist/primitives/composer/ComposerRoot.d.ts +0 -1
  222. package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
  223. package/dist/primitives/composer/ComposerRoot.js +2 -2
  224. package/dist/primitives/composer/ComposerRoot.js.map +1 -1
  225. package/dist/primitives/composer/ComposerRoot.mjs +1 -1
  226. package/dist/primitives/composer/ComposerRoot.mjs.map +1 -1
  227. package/dist/primitives/composer/ComposerSend.d.ts +1 -5
  228. package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
  229. package/dist/primitives/composer/ComposerSend.js +2 -2
  230. package/dist/primitives/composer/ComposerSend.js.map +1 -1
  231. package/dist/primitives/composer/ComposerSend.mjs +1 -1
  232. package/dist/primitives/composer/ComposerSend.mjs.map +1 -1
  233. package/dist/primitives/contentPart/ContentPartDisplay.d.ts +0 -4
  234. package/dist/primitives/contentPart/ContentPartDisplay.d.ts.map +1 -1
  235. package/dist/primitives/contentPart/ContentPartDisplay.js.map +1 -1
  236. package/dist/primitives/contentPart/ContentPartDisplay.mjs.map +1 -1
  237. package/dist/primitives/contentPart/ContentPartImage.d.ts +0 -4
  238. package/dist/primitives/contentPart/ContentPartImage.d.ts.map +1 -1
  239. package/dist/primitives/contentPart/ContentPartImage.js.map +1 -1
  240. package/dist/primitives/contentPart/ContentPartImage.mjs.map +1 -1
  241. package/dist/primitives/contentPart/ContentPartInProgress.d.ts +0 -4
  242. package/dist/primitives/contentPart/ContentPartInProgress.d.ts.map +1 -1
  243. package/dist/primitives/contentPart/ContentPartInProgress.js.map +1 -1
  244. package/dist/primitives/contentPart/ContentPartInProgress.mjs.map +1 -1
  245. package/dist/primitives/contentPart/ContentPartText.d.ts +0 -4
  246. package/dist/primitives/contentPart/ContentPartText.d.ts.map +1 -1
  247. package/dist/primitives/contentPart/ContentPartText.js.map +1 -1
  248. package/dist/primitives/contentPart/ContentPartText.mjs.map +1 -1
  249. package/dist/primitives/index.d.ts +0 -7
  250. package/dist/primitives/index.d.ts.map +1 -1
  251. package/dist/primitives/index.js.map +1 -1
  252. package/dist/primitives/index.mjs.map +1 -1
  253. package/dist/primitives/message/MessageAttachments.d.ts +0 -4
  254. package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
  255. package/dist/primitives/message/MessageAttachments.js +2 -4
  256. package/dist/primitives/message/MessageAttachments.js.map +1 -1
  257. package/dist/primitives/message/MessageAttachments.mjs +2 -4
  258. package/dist/primitives/message/MessageAttachments.mjs.map +1 -1
  259. package/dist/primitives/message/MessageContent.d.ts +0 -4
  260. package/dist/primitives/message/MessageContent.d.ts.map +1 -1
  261. package/dist/primitives/message/MessageContent.js +6 -6
  262. package/dist/primitives/message/MessageContent.js.map +1 -1
  263. package/dist/primitives/message/MessageContent.mjs +7 -7
  264. package/dist/primitives/message/MessageContent.mjs.map +1 -1
  265. package/dist/primitives/message/MessageIf.d.ts +0 -4
  266. package/dist/primitives/message/MessageIf.d.ts.map +1 -1
  267. package/dist/primitives/message/MessageIf.js.map +1 -1
  268. package/dist/primitives/message/MessageIf.mjs.map +1 -1
  269. package/dist/primitives/message/MessageRoot.d.ts +0 -4
  270. package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
  271. package/dist/primitives/message/MessageRoot.js.map +1 -1
  272. package/dist/primitives/message/MessageRoot.mjs.map +1 -1
  273. package/dist/primitives/message/index.d.ts +0 -1
  274. package/dist/primitives/message/index.d.ts.map +1 -1
  275. package/dist/primitives/message/index.js +0 -3
  276. package/dist/primitives/message/index.js.map +1 -1
  277. package/dist/primitives/message/index.mjs +0 -2
  278. package/dist/primitives/message/index.mjs.map +1 -1
  279. package/dist/primitives/thread/ThreadEmpty.d.ts +0 -4
  280. package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
  281. package/dist/primitives/thread/ThreadEmpty.js +2 -2
  282. package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
  283. package/dist/primitives/thread/ThreadEmpty.mjs +1 -1
  284. package/dist/primitives/thread/ThreadEmpty.mjs.map +1 -1
  285. package/dist/primitives/thread/ThreadIf.d.ts +0 -4
  286. package/dist/primitives/thread/ThreadIf.d.ts.map +1 -1
  287. package/dist/primitives/thread/ThreadIf.js.map +1 -1
  288. package/dist/primitives/thread/ThreadIf.mjs.map +1 -1
  289. package/dist/primitives/thread/ThreadMessages.d.ts +0 -4
  290. package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
  291. package/dist/primitives/thread/ThreadMessages.js.map +1 -1
  292. package/dist/primitives/thread/ThreadMessages.mjs.map +1 -1
  293. package/dist/primitives/thread/ThreadRoot.d.ts +0 -4
  294. package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
  295. package/dist/primitives/thread/ThreadRoot.js.map +1 -1
  296. package/dist/primitives/thread/ThreadRoot.mjs.map +1 -1
  297. package/dist/primitives/thread/ThreadScrollToBottom.d.ts +0 -4
  298. package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
  299. package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
  300. package/dist/primitives/thread/ThreadScrollToBottom.mjs.map +1 -1
  301. package/dist/primitives/thread/ThreadSuggestion.d.ts +0 -4
  302. package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
  303. package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
  304. package/dist/primitives/thread/ThreadSuggestion.mjs.map +1 -1
  305. package/dist/primitives/thread/ThreadViewport.d.ts +0 -4
  306. package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
  307. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  308. package/dist/primitives/thread/ThreadViewport.mjs.map +1 -1
  309. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
  310. package/dist/primitives/threadListItem/ThreadListItemArchive.js +3 -2
  311. package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
  312. package/dist/primitives/threadListItem/ThreadListItemArchive.mjs +3 -2
  313. package/dist/primitives/threadListItem/ThreadListItemArchive.mjs.map +1 -1
  314. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +14 -0
  315. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -0
  316. package/dist/primitives/threadListItem/ThreadListItemRoot.js +47 -0
  317. package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -0
  318. package/dist/primitives/threadListItem/ThreadListItemRoot.mjs +23 -0
  319. package/dist/primitives/threadListItem/ThreadListItemRoot.mjs.map +1 -0
  320. package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts +8 -0
  321. package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -0
  322. package/dist/primitives/{message/MessageInProgress.js → threadListItem/ThreadListItemTitle.js} +13 -10
  323. package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -0
  324. package/dist/primitives/threadListItem/ThreadListItemTitle.mjs +14 -0
  325. package/dist/primitives/threadListItem/ThreadListItemTitle.mjs.map +1 -0
  326. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +13 -0
  327. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -0
  328. package/dist/{runtimes/core/subscribeToMainThread.js → primitives/threadListItem/ThreadListItemTrigger.js} +17 -22
  329. package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -0
  330. package/dist/primitives/threadListItem/ThreadListItemTrigger.mjs +21 -0
  331. package/dist/primitives/threadListItem/ThreadListItemTrigger.mjs.map +1 -0
  332. package/dist/primitives/threadListItem/index.d.ts +3 -0
  333. package/dist/primitives/threadListItem/index.d.ts.map +1 -1
  334. package/dist/primitives/threadListItem/index.js +9 -0
  335. package/dist/primitives/threadListItem/index.js.map +1 -1
  336. package/dist/primitives/threadListItem/index.mjs +6 -0
  337. package/dist/primitives/threadListItem/index.mjs.map +1 -1
  338. package/dist/runtimes/attachment/AttachmentAdapter.d.ts +3 -7
  339. package/dist/runtimes/attachment/AttachmentAdapter.d.ts.map +1 -1
  340. package/dist/runtimes/attachment/AttachmentAdapter.js.map +1 -1
  341. package/dist/runtimes/attachment/CompositeAttachmentAdapter.d.ts +2 -6
  342. package/dist/runtimes/attachment/CompositeAttachmentAdapter.d.ts.map +1 -1
  343. package/dist/runtimes/attachment/CompositeAttachmentAdapter.js +1 -2
  344. package/dist/runtimes/attachment/CompositeAttachmentAdapter.js.map +1 -1
  345. package/dist/runtimes/attachment/CompositeAttachmentAdapter.mjs +1 -2
  346. package/dist/runtimes/attachment/CompositeAttachmentAdapter.mjs.map +1 -1
  347. package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
  348. package/dist/runtimes/composer/BaseComposerRuntimeCore.js +0 -6
  349. package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
  350. package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +0 -6
  351. package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
  352. package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts +5 -4
  353. package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
  354. package/dist/runtimes/core/BaseThreadRuntimeCore.js +8 -4
  355. package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
  356. package/dist/runtimes/core/BaseThreadRuntimeCore.mjs +8 -4
  357. package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +1 -1
  358. package/dist/runtimes/core/ComposerRuntimeCore.d.ts +0 -3
  359. package/dist/runtimes/core/ComposerRuntimeCore.d.ts.map +1 -1
  360. package/dist/runtimes/core/ComposerRuntimeCore.js.map +1 -1
  361. package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +7 -10
  362. package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -1
  363. package/dist/runtimes/core/ThreadListRuntimeCore.js.map +1 -1
  364. package/dist/runtimes/core/ThreadRuntimeCore.d.ts +14 -1
  365. package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
  366. package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
  367. package/dist/runtimes/core/index.d.ts +1 -2
  368. package/dist/runtimes/core/index.d.ts.map +1 -1
  369. package/dist/runtimes/core/index.js +0 -12
  370. package/dist/runtimes/core/index.js.map +1 -1
  371. package/dist/runtimes/core/index.mjs +0 -5
  372. package/dist/runtimes/core/index.mjs.map +1 -1
  373. package/dist/runtimes/edge/converters/toCoreMessages.d.ts +1 -1
  374. package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
  375. package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
  376. package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
  377. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts +0 -4
  378. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts.map +1 -1
  379. package/dist/runtimes/edge/createEdgeRuntimeAPI.js +0 -2
  380. package/dist/runtimes/edge/createEdgeRuntimeAPI.js.map +1 -1
  381. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs +0 -2
  382. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs.map +1 -1
  383. package/dist/runtimes/edge/streams/runResultStream.js +0 -2
  384. package/dist/runtimes/edge/streams/runResultStream.js.map +1 -1
  385. package/dist/runtimes/edge/streams/runResultStream.mjs +0 -2
  386. package/dist/runtimes/edge/streams/runResultStream.mjs.map +1 -1
  387. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +3 -16
  388. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
  389. package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
  390. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
  391. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +0 -3
  392. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
  393. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +0 -3
  394. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
  395. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +9 -11
  396. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -1
  397. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +29 -7
  398. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
  399. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs +29 -7
  400. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -1
  401. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +0 -1
  402. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
  403. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +4 -3
  404. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
  405. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +4 -3
  406. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
  407. package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
  408. package/dist/runtimes/external-store/ThreadMessageLike.js +2 -0
  409. package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
  410. package/dist/runtimes/external-store/ThreadMessageLike.mjs +2 -0
  411. package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
  412. package/dist/runtimes/local/ChatModelAdapter.d.ts +0 -8
  413. package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
  414. package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
  415. package/dist/runtimes/local/LocalRuntimeOptions.d.ts +1 -6
  416. package/dist/runtimes/local/LocalRuntimeOptions.d.ts.map +1 -1
  417. package/dist/runtimes/local/LocalRuntimeOptions.js +1 -2
  418. package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
  419. package/dist/runtimes/local/LocalRuntimeOptions.mjs +1 -2
  420. package/dist/runtimes/local/LocalRuntimeOptions.mjs.map +1 -1
  421. package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts +16 -20
  422. package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -1
  423. package/dist/runtimes/local/LocalThreadListRuntimeCore.js +112 -72
  424. package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
  425. package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs +112 -72
  426. package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +1 -1
  427. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.d.ts +19 -0
  428. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.d.ts.map +1 -0
  429. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.js +87 -0
  430. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.js.map +1 -0
  431. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.mjs +62 -0
  432. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.mjs.map +1 -0
  433. package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +1 -1
  434. package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
  435. package/dist/runtimes/local/LocalThreadRuntimeCore.js +15 -11
  436. package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
  437. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +15 -11
  438. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
  439. package/dist/styles/index.css.map +1 -1
  440. package/dist/types/AssistantTypes.d.ts +1 -18
  441. package/dist/types/AssistantTypes.d.ts.map +1 -1
  442. package/dist/types/AssistantTypes.js.map +1 -1
  443. package/dist/types/AttachmentTypes.d.ts +1 -1
  444. package/dist/types/AttachmentTypes.d.ts.map +1 -1
  445. package/dist/types/AttachmentTypes.js.map +1 -1
  446. package/dist/types/ContentPartComponentTypes.d.ts +4 -28
  447. package/dist/types/ContentPartComponentTypes.d.ts.map +1 -1
  448. package/dist/types/ContentPartComponentTypes.js.map +1 -1
  449. package/dist/ui/assistant-message.d.ts +1 -10
  450. package/dist/ui/assistant-message.d.ts.map +1 -1
  451. package/dist/ui/assistant-message.js.map +1 -1
  452. package/dist/ui/assistant-message.mjs.map +1 -1
  453. package/dist/ui/composer.d.ts +1 -25
  454. package/dist/ui/composer.d.ts.map +1 -1
  455. package/dist/ui/composer.js.map +1 -1
  456. package/dist/ui/composer.mjs.map +1 -1
  457. package/dist/ui/index.d.ts +6 -14
  458. package/dist/ui/index.d.ts.map +1 -1
  459. package/dist/ui/index.js +0 -4
  460. package/dist/ui/index.js.map +1 -1
  461. package/dist/ui/index.mjs +14 -24
  462. package/dist/ui/index.mjs.map +1 -1
  463. package/dist/ui/thread-welcome.d.ts +5 -17
  464. package/dist/ui/thread-welcome.d.ts.map +1 -1
  465. package/dist/ui/thread-welcome.js.map +1 -1
  466. package/dist/ui/thread-welcome.mjs.map +1 -1
  467. package/dist/ui/thread.d.ts +1 -19
  468. package/dist/ui/thread.d.ts.map +1 -1
  469. package/dist/ui/thread.js.map +1 -1
  470. package/dist/ui/thread.mjs.map +1 -1
  471. package/dist/ui/user-message.d.ts +1 -18
  472. package/dist/ui/user-message.d.ts.map +1 -1
  473. package/dist/ui/user-message.js.map +1 -1
  474. package/dist/ui/user-message.mjs.map +1 -1
  475. package/dist/utils/smooth/SmoothContext.js +2 -2
  476. package/dist/utils/smooth/SmoothContext.js.map +1 -1
  477. package/dist/utils/smooth/SmoothContext.mjs +3 -3
  478. package/dist/utils/smooth/SmoothContext.mjs.map +1 -1
  479. package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
  480. package/dist/utils/smooth/useSmooth.js +0 -1
  481. package/dist/utils/smooth/useSmooth.js.map +1 -1
  482. package/dist/utils/smooth/useSmooth.mjs +0 -1
  483. package/dist/utils/smooth/useSmooth.mjs.map +1 -1
  484. package/package.json +5 -5
  485. package/src/api/AssistantRuntime.ts +1 -23
  486. package/src/api/AttachmentRuntime.ts +0 -12
  487. package/src/api/ComposerRuntime.ts +11 -207
  488. package/src/api/ContentPartRuntime.ts +0 -4
  489. package/src/api/MessageRuntime.ts +7 -11
  490. package/src/api/ThreadListItemRuntime.ts +16 -8
  491. package/src/api/ThreadListRuntime.ts +34 -53
  492. package/src/api/ThreadRuntime.ts +11 -203
  493. package/src/context/providers/AssistantRuntimeProvider.tsx +0 -1
  494. package/src/context/providers/TextContentPartProvider.tsx +0 -2
  495. package/src/context/providers/ThreadRuntimeProvider.tsx +1 -17
  496. package/src/context/react/AssistantContext.ts +0 -25
  497. package/src/context/react/ComposerContext.ts +1 -1
  498. package/src/context/react/ContentPartContext.ts +1 -1
  499. package/src/context/react/MessageContext.ts +2 -2
  500. package/src/context/react/ThreadContext.ts +5 -42
  501. package/src/context/react/index.ts +2 -125
  502. package/src/index.ts +0 -1
  503. package/src/internal.ts +1 -0
  504. package/src/model-config/useAssistantToolUI.tsx +0 -1
  505. package/src/primitive-hooks/contentPart/useContentPartDisplay.tsx +1 -1
  506. package/src/primitive-hooks/contentPart/useContentPartImage.tsx +1 -2
  507. package/src/primitive-hooks/contentPart/useContentPartText.tsx +1 -1
  508. package/src/primitive-hooks/index.ts +0 -5
  509. package/src/primitives/actionBar/ActionBarCopy.tsx +0 -5
  510. package/src/primitives/actionBar/ActionBarEdit.tsx +0 -5
  511. package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +0 -6
  512. package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +0 -6
  513. package/src/primitives/actionBar/ActionBarReload.tsx +0 -5
  514. package/src/primitives/actionBar/ActionBarRoot.tsx +0 -5
  515. package/src/primitives/actionBar/ActionBarSpeak.tsx +0 -5
  516. package/src/primitives/actionBar/ActionBarStopSpeaking.tsx +0 -6
  517. package/src/primitives/assistantModal/AssistantModalContent.tsx +1 -7
  518. package/src/primitives/assistantModal/AssistantModalRoot.tsx +0 -6
  519. package/src/primitives/assistantModal/AssistantModalTrigger.tsx +0 -6
  520. package/src/primitives/branchPicker/BranchPickerCount.tsx +0 -5
  521. package/src/primitives/branchPicker/BranchPickerNext.tsx +0 -6
  522. package/src/primitives/branchPicker/BranchPickerNumber.tsx +0 -5
  523. package/src/primitives/branchPicker/BranchPickerPrevious.tsx +1 -6
  524. package/src/primitives/branchPicker/BranchPickerRoot.tsx +0 -5
  525. package/src/primitives/composer/ComposerAddAttachment.tsx +2 -7
  526. package/src/primitives/composer/ComposerAttachments.tsx +0 -6
  527. package/src/primitives/composer/ComposerCancel.tsx +0 -5
  528. package/src/primitives/composer/ComposerIf.tsx +0 -5
  529. package/src/primitives/composer/ComposerInput.tsx +0 -5
  530. package/src/primitives/composer/ComposerRoot.tsx +1 -3
  531. package/src/primitives/composer/ComposerSend.tsx +2 -7
  532. package/src/primitives/contentPart/ContentPartDisplay.tsx +0 -6
  533. package/src/primitives/contentPart/ContentPartImage.tsx +0 -5
  534. package/src/primitives/contentPart/ContentPartInProgress.tsx +0 -6
  535. package/src/primitives/contentPart/ContentPartText.tsx +0 -5
  536. package/src/primitives/index.ts +0 -8
  537. package/src/primitives/message/MessageAttachments.tsx +2 -10
  538. package/src/primitives/message/MessageContent.tsx +7 -15
  539. package/src/primitives/message/MessageIf.tsx +0 -5
  540. package/src/primitives/message/MessageRoot.tsx +0 -5
  541. package/src/primitives/message/index.ts +0 -1
  542. package/src/primitives/thread/ThreadEmpty.tsx +1 -6
  543. package/src/primitives/thread/ThreadIf.tsx +0 -5
  544. package/src/primitives/thread/ThreadMessages.tsx +0 -5
  545. package/src/primitives/thread/ThreadRoot.tsx +0 -5
  546. package/src/primitives/thread/ThreadScrollToBottom.tsx +0 -6
  547. package/src/primitives/thread/ThreadSuggestion.tsx +0 -5
  548. package/src/primitives/thread/ThreadViewport.tsx +0 -5
  549. package/src/primitives/threadListItem/ThreadListItemArchive.ts +3 -2
  550. package/src/primitives/threadListItem/ThreadListItemRoot.tsx +29 -0
  551. package/src/primitives/threadListItem/ThreadListItemTitle.tsx +19 -0
  552. package/src/primitives/threadListItem/ThreadListItemTrigger.ts +25 -0
  553. package/src/primitives/threadListItem/index.ts +4 -1
  554. package/src/runtimes/attachment/AttachmentAdapter.ts +2 -12
  555. package/src/runtimes/attachment/CompositeAttachmentAdapter.ts +1 -1
  556. package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +0 -8
  557. package/src/runtimes/core/BaseThreadRuntimeCore.tsx +11 -5
  558. package/src/runtimes/core/ComposerRuntimeCore.tsx +0 -3
  559. package/src/runtimes/core/ThreadListRuntimeCore.tsx +7 -11
  560. package/src/runtimes/core/ThreadRuntimeCore.tsx +18 -1
  561. package/src/runtimes/core/index.ts +1 -2
  562. package/src/runtimes/edge/converters/toCoreMessages.ts +1 -1
  563. package/src/runtimes/edge/createEdgeRuntimeAPI.ts +0 -6
  564. package/src/runtimes/edge/streams/runResultStream.ts +0 -2
  565. package/src/runtimes/external-store/ExternalStoreAdapter.tsx +3 -17
  566. package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +0 -3
  567. package/src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx +39 -7
  568. package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +4 -3
  569. package/src/runtimes/external-store/ThreadMessageLike.tsx +4 -3
  570. package/src/runtimes/local/ChatModelAdapter.tsx +0 -9
  571. package/src/runtimes/local/LocalRuntimeOptions.tsx +1 -7
  572. package/src/runtimes/local/LocalThreadListRuntimeCore.tsx +140 -96
  573. package/src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx +79 -0
  574. package/src/runtimes/local/LocalThreadRuntimeCore.tsx +16 -11
  575. package/src/types/AssistantTypes.ts +1 -20
  576. package/src/types/AttachmentTypes.ts +1 -2
  577. package/src/types/ContentPartComponentTypes.tsx +4 -31
  578. package/src/ui/assistant-message.tsx +0 -5
  579. package/src/ui/composer.tsx +0 -5
  580. package/src/ui/index.ts +5 -23
  581. package/src/ui/thread-welcome.tsx +6 -9
  582. package/src/ui/thread.tsx +0 -5
  583. package/src/ui/user-message.tsx +2 -12
  584. package/src/utils/smooth/SmoothContext.tsx +3 -3
  585. package/src/utils/smooth/useSmooth.tsx +0 -1
  586. package/dist/hooks/index.d.ts +0 -3
  587. package/dist/hooks/index.d.ts.map +0 -1
  588. package/dist/hooks/index.js +0 -34
  589. package/dist/hooks/index.js.map +0 -1
  590. package/dist/hooks/index.mjs +0 -8
  591. package/dist/hooks/index.mjs.map +0 -1
  592. package/dist/hooks/useAppendMessage.d.ts +0 -6
  593. package/dist/hooks/useAppendMessage.d.ts.map +0 -1
  594. package/dist/hooks/useAppendMessage.js +0 -42
  595. package/dist/hooks/useAppendMessage.js.map +0 -1
  596. package/dist/hooks/useAppendMessage.mjs +0 -17
  597. package/dist/hooks/useAppendMessage.mjs.map +0 -1
  598. package/dist/hooks/useSwitchToNewThread.d.ts +0 -5
  599. package/dist/hooks/useSwitchToNewThread.d.ts.map +0 -1
  600. package/dist/hooks/useSwitchToNewThread.js +0 -39
  601. package/dist/hooks/useSwitchToNewThread.js.map +0 -1
  602. package/dist/hooks/useSwitchToNewThread.mjs +0 -14
  603. package/dist/hooks/useSwitchToNewThread.mjs.map +0 -1
  604. package/dist/primitive-hooks/actionBar/index.d.ts +0 -34
  605. package/dist/primitive-hooks/actionBar/index.d.ts.map +0 -1
  606. package/dist/primitive-hooks/actionBar/index.js +0 -49
  607. package/dist/primitive-hooks/actionBar/index.js.map +0 -1
  608. package/dist/primitive-hooks/actionBar/index.mjs +0 -20
  609. package/dist/primitive-hooks/actionBar/index.mjs.map +0 -1
  610. package/dist/primitive-hooks/branchPicker/index.d.ts +0 -17
  611. package/dist/primitive-hooks/branchPicker/index.d.ts.map +0 -1
  612. package/dist/primitive-hooks/branchPicker/index.js +0 -40
  613. package/dist/primitive-hooks/branchPicker/index.js.map +0 -1
  614. package/dist/primitive-hooks/branchPicker/index.mjs +0 -12
  615. package/dist/primitive-hooks/branchPicker/index.mjs.map +0 -1
  616. package/dist/primitive-hooks/composer/index.d.ts +0 -17
  617. package/dist/primitive-hooks/composer/index.d.ts.map +0 -1
  618. package/dist/primitive-hooks/composer/index.js +0 -40
  619. package/dist/primitive-hooks/composer/index.js.map +0 -1
  620. package/dist/primitive-hooks/composer/index.mjs +0 -12
  621. package/dist/primitive-hooks/composer/index.mjs.map +0 -1
  622. package/dist/primitive-hooks/message/index.d.ts +0 -5
  623. package/dist/primitive-hooks/message/index.d.ts.map +0 -1
  624. package/dist/primitive-hooks/message/index.js +0 -31
  625. package/dist/primitive-hooks/message/index.js.map +0 -1
  626. package/dist/primitive-hooks/message/index.mjs +0 -6
  627. package/dist/primitive-hooks/message/index.mjs.map +0 -1
  628. package/dist/primitive-hooks/thread/index.d.ts +0 -17
  629. package/dist/primitive-hooks/thread/index.d.ts.map +0 -1
  630. package/dist/primitive-hooks/thread/index.js +0 -40
  631. package/dist/primitive-hooks/thread/index.js.map +0 -1
  632. package/dist/primitive-hooks/thread/index.mjs +0 -12
  633. package/dist/primitive-hooks/thread/index.mjs.map +0 -1
  634. package/dist/primitives/actionBar/types.d.ts +0 -9
  635. package/dist/primitives/actionBar/types.d.ts.map +0 -1
  636. package/dist/primitives/actionBar/types.js +0 -19
  637. package/dist/primitives/actionBar/types.js.map +0 -1
  638. package/dist/primitives/actionBar/types.mjs +0 -1
  639. package/dist/primitives/actionBar/types.mjs.map +0 -1
  640. package/dist/primitives/assistantModal/types.d.ts +0 -4
  641. package/dist/primitives/assistantModal/types.d.ts.map +0 -1
  642. package/dist/primitives/assistantModal/types.js +0 -19
  643. package/dist/primitives/assistantModal/types.js.map +0 -1
  644. package/dist/primitives/assistantModal/types.mjs +0 -1
  645. package/dist/primitives/assistantModal/types.mjs.map +0 -1
  646. package/dist/primitives/attachment/types.d.ts +0 -1
  647. package/dist/primitives/attachment/types.d.ts.map +0 -1
  648. package/dist/primitives/attachment/types.js +0 -2
  649. package/dist/primitives/attachment/types.js.map +0 -1
  650. package/dist/primitives/attachment/types.mjs +0 -1
  651. package/dist/primitives/attachment/types.mjs.map +0 -1
  652. package/dist/primitives/branchPicker/types.d.ts +0 -6
  653. package/dist/primitives/branchPicker/types.d.ts.map +0 -1
  654. package/dist/primitives/branchPicker/types.js +0 -19
  655. package/dist/primitives/branchPicker/types.js.map +0 -1
  656. package/dist/primitives/branchPicker/types.mjs +0 -1
  657. package/dist/primitives/branchPicker/types.mjs.map +0 -1
  658. package/dist/primitives/composer/types.d.ts +0 -6
  659. package/dist/primitives/composer/types.d.ts.map +0 -1
  660. package/dist/primitives/composer/types.js +0 -19
  661. package/dist/primitives/composer/types.js.map +0 -1
  662. package/dist/primitives/composer/types.mjs +0 -1
  663. package/dist/primitives/composer/types.mjs.map +0 -1
  664. package/dist/primitives/contentPart/types.d.ts +0 -5
  665. package/dist/primitives/contentPart/types.d.ts.map +0 -1
  666. package/dist/primitives/contentPart/types.js +0 -19
  667. package/dist/primitives/contentPart/types.js.map +0 -1
  668. package/dist/primitives/contentPart/types.mjs +0 -1
  669. package/dist/primitives/contentPart/types.mjs.map +0 -1
  670. package/dist/primitives/message/MessageInProgress.d.ts +0 -13
  671. package/dist/primitives/message/MessageInProgress.d.ts.map +0 -1
  672. package/dist/primitives/message/MessageInProgress.js.map +0 -1
  673. package/dist/primitives/message/MessageInProgress.mjs +0 -11
  674. package/dist/primitives/message/MessageInProgress.mjs.map +0 -1
  675. package/dist/primitives/message/types.d.ts +0 -5
  676. package/dist/primitives/message/types.d.ts.map +0 -1
  677. package/dist/primitives/message/types.js +0 -19
  678. package/dist/primitives/message/types.js.map +0 -1
  679. package/dist/primitives/message/types.mjs +0 -1
  680. package/dist/primitives/message/types.mjs.map +0 -1
  681. package/dist/primitives/thread/types.d.ts +0 -8
  682. package/dist/primitives/thread/types.d.ts.map +0 -1
  683. package/dist/primitives/thread/types.js +0 -19
  684. package/dist/primitives/thread/types.js.map +0 -1
  685. package/dist/primitives/thread/types.mjs +0 -1
  686. package/dist/primitives/thread/types.mjs.map +0 -1
  687. package/dist/runtimes/core/subscribeToMainThread.d.ts +0 -6
  688. package/dist/runtimes/core/subscribeToMainThread.d.ts.map +0 -1
  689. package/dist/runtimes/core/subscribeToMainThread.js.map +0 -1
  690. package/dist/runtimes/core/subscribeToMainThread.mjs +0 -23
  691. package/dist/runtimes/core/subscribeToMainThread.mjs.map +0 -1
  692. package/src/hooks/index.ts +0 -2
  693. package/src/hooks/useAppendMessage.tsx +0 -19
  694. package/src/hooks/useSwitchToNewThread.tsx +0 -14
  695. package/src/primitive-hooks/actionBar/index.ts +0 -39
  696. package/src/primitive-hooks/branchPicker/index.ts +0 -18
  697. package/src/primitive-hooks/composer/index.ts +0 -17
  698. package/src/primitive-hooks/message/index.ts +0 -4
  699. package/src/primitive-hooks/thread/index.ts +0 -16
  700. package/src/primitives/actionBar/types.ts +0 -8
  701. package/src/primitives/assistantModal/types.ts +0 -3
  702. package/src/primitives/attachment/types.ts +0 -0
  703. package/src/primitives/branchPicker/types.ts +0 -5
  704. package/src/primitives/composer/types.ts +0 -5
  705. package/src/primitives/contentPart/types.ts +0 -4
  706. package/src/primitives/message/MessageInProgress.tsx +0 -22
  707. package/src/primitives/message/types.ts +0 -4
  708. package/src/primitives/thread/types.ts +0 -7
  709. package/src/runtimes/core/subscribeToMainThread.ts +0 -30
@@ -31,7 +31,8 @@ var toAppendMessage = (messages, message) => {
31
31
  var getThreadState = (runtime) => {
32
32
  const lastMessage = runtime.messages.at(-1);
33
33
  return Object.freeze({
34
- threadId: runtime.threadId,
34
+ threadId: runtime.metadata.threadId,
35
+ metadata: runtime.metadata,
35
36
  capabilities: runtime.capabilities,
36
37
  isDisabled: runtime.isDisabled,
37
38
  isRunning: lastMessage?.role !== "assistant" ? false : lastMessage.status.type === "running",
@@ -45,54 +46,6 @@ var ThreadRuntimeImpl = class {
45
46
  get path() {
46
47
  return this._threadBinding.path;
47
48
  }
48
- /**
49
- * @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.
50
- */
51
- get threadId() {
52
- return this.getState().threadId;
53
- }
54
- /**
55
- * @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.
56
- */
57
- get isDisabled() {
58
- return this.getState().isDisabled;
59
- }
60
- /**
61
- * @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.
62
- */
63
- get isRunning() {
64
- return this.getState().isRunning;
65
- }
66
- /**
67
- * @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.
68
- */
69
- get capabilities() {
70
- return this.getState().capabilities;
71
- }
72
- /**
73
- * @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.
74
- */
75
- get extras() {
76
- return this._threadBinding.getState().extras;
77
- }
78
- /**
79
- * @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.
80
- */
81
- get suggestions() {
82
- return this._threadBinding.getState().suggestions;
83
- }
84
- /**
85
- * @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.
86
- */
87
- get messages() {
88
- return this._threadBinding.getState().messages;
89
- }
90
- /**
91
- * @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.
92
- */
93
- get speech() {
94
- return this._threadBinding.getState().speech;
95
- }
96
49
  unstable_getCore() {
97
50
  return this._threadBinding.getState();
98
51
  }
@@ -134,64 +87,21 @@ var ThreadRuntimeImpl = class {
134
87
  subscribe(callback) {
135
88
  return this._threadBinding.subscribe(callback);
136
89
  }
137
- /**
138
- * @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.
139
- */
140
- getBranches(messageId) {
141
- return this._threadBinding.getState().getBranches(messageId);
142
- }
143
90
  getModelConfig() {
144
91
  return this._threadBinding.getState().getModelConfig();
145
92
  }
146
- // TODO sometimes you want to continue when there is no child message
147
93
  startRun(parentId) {
148
94
  return this._threadBinding.getState().startRun(parentId);
149
95
  }
150
96
  cancelRun() {
151
97
  this._threadBinding.getState().cancelRun();
152
98
  }
153
- /**
154
- * @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.
155
- */
156
- addToolResult(options) {
157
- this._threadBinding.getState().addToolResult(options);
158
- }
159
- /**
160
- * @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.
161
- */
162
- switchToBranch(branchId) {
163
- return this._threadBinding.getState().switchToBranch(branchId);
164
- }
165
- /**
166
- * @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.
167
- */
168
- speak(messageId) {
169
- return this._threadBinding.getState().speak(messageId);
170
- }
171
99
  stopSpeaking() {
172
100
  return this._threadBinding.getState().stopSpeaking();
173
101
  }
174
102
  getSubmittedFeedback(messageId) {
175
103
  return this._threadBinding.getState().getSubmittedFeedback(messageId);
176
104
  }
177
- /**
178
- * @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.
179
- */
180
- submitFeedback(options) {
181
- return this._threadBinding.getState().submitFeedback(options);
182
- }
183
- /**
184
- * @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.
185
- */
186
- getEditComposer(messageId) {
187
- return this._threadBinding.getState().getEditComposer(messageId);
188
- }
189
- /**
190
- * @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.
191
- */
192
- beginEdit(messageId) {
193
- return this._threadBinding.getState().beginEdit(messageId);
194
- }
195
105
  export() {
196
106
  return this._threadBinding.getState().export();
197
107
  }
@@ -240,10 +150,8 @@ var ThreadRuntimeImpl = class {
240
150
  const submittedFeedback = thread.getSubmittedFeedback(message.id);
241
151
  return {
242
152
  ...message,
243
- message,
244
153
  isLast: messages.at(-1)?.id === message.id,
245
154
  parentId,
246
- branches,
247
155
  branchNumber: branches.indexOf(message.id) + 1,
248
156
  branchCount: branches.length,
249
157
  speech: speechState?.messageId === message.id ? speechState : void 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/ThreadRuntime.ts"],"sourcesContent":["import {\n AddToolResultOptions,\n ThreadSuggestion,\n RuntimeCapabilities,\n SubmitFeedbackOptions,\n ThreadRuntimeCore,\n SpeechState,\n SubmittedFeedback,\n ThreadRuntimeEventType,\n} from \"../runtimes/core/ThreadRuntimeCore\";\nimport { ExportedMessageRepository } from \"../runtimes/utils/MessageRepository\";\nimport {\n AppendMessage,\n ModelConfig,\n ThreadMessage,\n Unsubscribe,\n} from \"../types\";\nimport {\n MessageRuntime,\n MessageRuntimeImpl,\n MessageState,\n} from \"./MessageRuntime\";\nimport { NestedSubscriptionSubject } from \"./subscribable/NestedSubscriptionSubject\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport {\n Subscribable,\n SubscribableWithState,\n} from \"./subscribable/Subscribable\";\nimport {\n ThreadComposerRuntime,\n ThreadComposerRuntimeImpl,\n} from \"./ComposerRuntime\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ComposerRuntimeCore } from \"../runtimes/core/ComposerRuntimeCore\";\nimport { MessageRuntimePath, ThreadRuntimePath } from \"./RuntimePathTypes\";\n\nexport type CreateAppendMessage =\n | string\n | {\n parentId?: string | null | undefined;\n role?: AppendMessage[\"role\"] | undefined;\n content: AppendMessage[\"content\"];\n attachments?: AppendMessage[\"attachments\"] | undefined;\n startRun?: boolean | undefined;\n };\n\nconst toAppendMessage = (\n messages: readonly ThreadMessage[],\n message: CreateAppendMessage,\n): AppendMessage => {\n if (typeof message === \"string\") {\n return {\n parentId: messages.at(-1)?.id ?? null,\n role: \"user\",\n content: [{ type: \"text\", text: message }],\n attachments: [],\n };\n }\n\n if (message.role && message.parentId && message.attachments) {\n return message as AppendMessage;\n }\n\n return {\n ...message,\n parentId: message.parentId ?? messages.at(-1)?.id ?? null,\n role: message.role ?? \"user\",\n attachments: message.attachments ?? [],\n } as AppendMessage;\n};\n\nexport type ThreadRuntimeCoreBinding = SubscribableWithState<\n ThreadRuntimeCore,\n ThreadRuntimePath\n> & {\n outerSubscribe(callback: () => void): Unsubscribe;\n};\n\nexport type ThreadState = Readonly<{\n /**\n * The thread ID.\n */\n threadId: string;\n /**\n * Whether the thread is disabled. Disabled threads cannot receive new messages.\n */\n isDisabled: boolean;\n\n /**\n * Whether the thread is running. A thread is considered running when there is an active stream connection to the backend.\n */\n isRunning: boolean;\n\n /**\n * The capabilities of the thread, such as whether the thread supports editing, branch switching, etc.\n */\n capabilities: RuntimeCapabilities;\n\n /**\n * The messages in the currently selected branch of the thread.\n */\n messages: readonly ThreadMessage[];\n\n /**\n * Follow up message suggestions to show the user.\n */\n suggestions: readonly ThreadSuggestion[];\n\n /**\n * Custom extra information provided by the runtime.\n */\n extras: unknown;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speech: SpeechState | undefined;\n}>;\n\nexport const getThreadState = (runtime: ThreadRuntimeCore): ThreadState => {\n const lastMessage = runtime.messages.at(-1);\n return Object.freeze({\n threadId: runtime.threadId,\n capabilities: runtime.capabilities,\n isDisabled: runtime.isDisabled,\n isRunning:\n lastMessage?.role !== \"assistant\"\n ? false\n : lastMessage.status.type === \"running\",\n messages: runtime.messages,\n suggestions: runtime.suggestions,\n extras: runtime.extras,\n speech: runtime.speech,\n });\n};\n\nexport type ThreadRuntime = Readonly<{\n readonly path: ThreadRuntimePath;\n\n readonly composer: ThreadComposerRuntime;\n getState(): ThreadState;\n\n /**\n * @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.\n */\n unstable_getCore(): ThreadRuntimeCore;\n\n append(message: CreateAppendMessage): void;\n startRun(parentId: string | null): void;\n subscribe(callback: () => void): Unsubscribe;\n cancelRun(): void;\n getModelConfig(): ModelConfig;\n export(): ExportedMessageRepository;\n import(repository: ExportedMessageRepository): void;\n getMesssageByIndex(idx: number): MessageRuntime;\n getMesssageById(messageId: string): MessageRuntime;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking: () => void;\n\n unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;\n\n // Legacy methods with deprecations\n\n /**\n * @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.\n */\n capabilities: Readonly<RuntimeCapabilities>;\n\n /**\n * @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.\n */\n threadId: string;\n\n /**\n * @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.\n */\n isDisabled: boolean;\n\n /**\n * @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.\n */\n isRunning: boolean;\n\n /**\n * @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.\n */\n messages: readonly ThreadMessage[];\n\n /**\n * @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.\n */\n suggestions: readonly ThreadSuggestion[];\n\n /**\n * @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.\n */\n speech: SpeechState | undefined;\n\n /**\n * @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.\n */\n extras: unknown;\n\n /**\n * @deprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.\n */\n getBranches: (messageId: string) => readonly string[];\n\n /**\n * @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.\n */\n switchToBranch: (branchId: string) => void;\n\n /**\n * @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.\n */\n addToolResult: (options: AddToolResultOptions) => void;\n\n /**\n * @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.\n */\n speak: (messageId: string) => void;\n\n /**\n * @deprecated Use `getMesssageById(id).getState().submittedFeedback` instead. This will be removed in 0.6.0.\n */\n getSubmittedFeedback: (messageId: string) => SubmittedFeedback | undefined;\n\n /**\n * @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.\n */\n submitFeedback: (feedback: SubmitFeedbackOptions) => void;\n\n /**\n * @deprecated Use `getMesssageById(id).composer` instead. This will be removed in 0.6.0.\n */\n getEditComposer: (messageId: string) => ComposerRuntimeCore | undefined;\n\n /**\n * @deprecated Use `getMesssageById(id).composer.beginEdit()` instead. This will be removed in 0.6.0.\n */\n beginEdit: (messageId: string) => void;\n}>;\n\nexport class ThreadRuntimeImpl\n implements Omit<ThreadRuntimeCore, \"getMessageById\">, ThreadRuntime\n{\n public get path() {\n return this._threadBinding.path;\n }\n\n /**\n * @deprecated Use `getState().threadId` instead. This will be removed in 0.6.0.\n */\n public get threadId() {\n return this.getState().threadId;\n }\n\n /**\n * @deprecated Use `getState().isDisabled` instead. This will be removed in 0.6.0.\n */\n public get isDisabled() {\n return this.getState().isDisabled;\n }\n\n /**\n * @deprecated Use `getState().isRunning` instead. This will be removed in 0.6.0.\n */\n public get isRunning() {\n return this.getState().isRunning;\n }\n\n /**\n * @deprecated Use `getState().capabilities` instead. This will be removed in 0.6.0.\n */\n public get capabilities() {\n return this.getState().capabilities;\n }\n\n /**\n * @deprecated Use `getState().extras` instead. This will be removed in 0.6.0.\n */\n public get extras() {\n return this._threadBinding.getState().extras;\n }\n\n /**\n * @deprecated Use `getState().followupSuggestions` instead. This will be removed in 0.6.0.\n */\n public get suggestions() {\n return this._threadBinding.getState().suggestions;\n }\n\n /**\n * @deprecated Use `getState().messages` instead. This will be removed in 0.6.0.\n */\n public get messages() {\n return this._threadBinding.getState().messages;\n }\n\n /**\n * @deprecated Use `getState().speechState` instead. This will be removed in 0.6.0.\n */\n public get speech() {\n return this._threadBinding.getState().speech;\n }\n\n public unstable_getCore() {\n return this._threadBinding.getState();\n }\n\n private _threadBinding: ThreadRuntimeCoreBinding & {\n getStateState(): ThreadState;\n };\n\n constructor(threadBinding: ThreadRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: threadBinding.path,\n getState: () => getThreadState(threadBinding.getState()),\n subscribe: (callback) => threadBinding.subscribe(callback),\n });\n\n this._threadBinding = {\n path: threadBinding.path,\n getState: () => threadBinding.getState(),\n getStateState: () => stateBinding.getState(),\n outerSubscribe: (callback) => threadBinding.outerSubscribe(callback),\n subscribe: (callback) => threadBinding.subscribe(callback),\n };\n\n this.composer = new ThreadComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.composer`,\n composerSource: \"thread\",\n },\n getState: () => this._threadBinding.getState().composer,\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n );\n }\n\n public readonly composer;\n\n public getState() {\n return this._threadBinding.getStateState();\n }\n\n public append(message: CreateAppendMessage) {\n this._threadBinding\n .getState()\n .append(\n toAppendMessage(this._threadBinding.getState().messages, message),\n );\n }\n\n public subscribe(callback: () => void) {\n return this._threadBinding.subscribe(callback);\n }\n\n /**\n * @derprecated Use `getMesssageById(id).getState().branchNumber` / `getMesssageById(id).getState().branchCount` instead. This will be removed in 0.6.0.\n */\n public getBranches(messageId: string) {\n return this._threadBinding.getState().getBranches(messageId);\n }\n\n public getModelConfig() {\n return this._threadBinding.getState().getModelConfig();\n }\n\n // TODO sometimes you want to continue when there is no child message\n public startRun(parentId: string | null) {\n return this._threadBinding.getState().startRun(parentId);\n }\n\n public cancelRun() {\n this._threadBinding.getState().cancelRun();\n }\n\n /**\n * @deprecated Use `getMesssageById(id).getContentPartByToolCallId(toolCallId).addToolResult({ result })` instead. This will be removed in 0.6.0.\n */\n public addToolResult(options: AddToolResultOptions) {\n this._threadBinding.getState().addToolResult(options);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).switchToBranch({ options })` instead. This will be removed in 0.6.0.\n */\n public switchToBranch(branchId: string) {\n return this._threadBinding.getState().switchToBranch(branchId);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).speak()` instead. This will be removed in 0.6.0.\n */\n public speak(messageId: string) {\n return this._threadBinding.getState().speak(messageId);\n }\n\n public stopSpeaking() {\n return this._threadBinding.getState().stopSpeaking();\n }\n\n public getSubmittedFeedback(messageId: string) {\n return this._threadBinding.getState().getSubmittedFeedback(messageId);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).submitFeedback({ type })` instead. This will be removed in 0.6.0.\n */\n public submitFeedback(options: SubmitFeedbackOptions) {\n return this._threadBinding.getState().submitFeedback(options);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer` instead. This will be removed in 0.6.0.\n */\n public getEditComposer(messageId: string) {\n return this._threadBinding.getState().getEditComposer(messageId);\n }\n\n /**\n * @deprecated Use `getMesssageById(id).getMessageByIndex(idx).composer.beginEdit()` instead. This will be removed in 0.6.0.\n */\n public beginEdit(messageId: string) {\n return this._threadBinding.getState().beginEdit(messageId);\n }\n\n public export() {\n return this._threadBinding.getState().export();\n }\n\n public import(data: ExportedMessageRepository) {\n this._threadBinding.getState().import(data);\n }\n\n public getMesssageByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Message index must be >= 0\");\n\n return this._getMessageRuntime(\n {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.messages[${idx}]`,\n messageSelector: { type: \"index\", index: idx },\n },\n () => {\n const messages = this._threadBinding.getState().messages;\n const message = messages[idx];\n if (!message) return undefined;\n return {\n message,\n parentId: messages[idx - 1]?.id ?? null,\n };\n },\n );\n }\n\n public getMesssageById(messageId: string) {\n return this._getMessageRuntime(\n {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.messages[messageId=${JSON.stringify(messageId)}]`,\n messageSelector: { type: \"messageId\", messageId: messageId },\n },\n () => this._threadBinding.getState().getMessageById(messageId),\n );\n }\n\n private _getMessageRuntime(\n path: MessageRuntimePath,\n callback: () =>\n | { parentId: string | null; message: ThreadMessage }\n | undefined,\n ) {\n return new MessageRuntimeImpl(\n new ShallowMemoizeSubject({\n path,\n getState: () => {\n const { message, parentId } = callback() ?? {};\n\n const { messages, speech: speechState } =\n this._threadBinding.getState();\n\n if (!message || parentId === undefined) return SKIP_UPDATE;\n\n const thread = this._threadBinding.getState();\n\n const branches = thread.getBranches(message.id);\n const submittedFeedback = thread.getSubmittedFeedback(message.id);\n\n return {\n ...message,\n\n message,\n isLast: messages.at(-1)?.id === message.id,\n parentId,\n\n branches,\n branchNumber: branches.indexOf(message.id) + 1,\n branchCount: branches.length,\n\n speech:\n speechState?.messageId === message.id ? speechState : undefined,\n\n submittedFeedback,\n } satisfies MessageState;\n },\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n this._threadBinding,\n );\n }\n\n private _eventListenerNestedSubscriptions = new Map<\n string,\n NestedSubscriptionSubject<Subscribable, ThreadRuntimePath>\n >();\n\n public unstable_on(\n event: ThreadRuntimeEventType,\n callback: () => void,\n ): Unsubscribe {\n let subject = this._eventListenerNestedSubscriptions.get(event);\n if (!subject) {\n subject = new NestedSubscriptionSubject({\n path: this.path,\n getState: () => ({\n subscribe: (callback) =>\n this._threadBinding.getState().unstable_on(event, callback),\n }),\n subscribe: (callback) => this._threadBinding.outerSubscribe(callback),\n });\n this._eventListenerNestedSubscriptions.set(event, subject);\n }\n return subject.subscribe(callback);\n }\n}\n"],"mappings":";AAiBA;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AAKtC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAc5B,IAAM,kBAAkB,CACtB,UACA,YACkB;AAClB,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,MACL,UAAU,SAAS,GAAG,EAAE,GAAG,MAAM;AAAA,MACjC,MAAM;AAAA,MACN,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,QAAQ,CAAC;AAAA,MACzC,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AAEA,MAAI,QAAQ,QAAQ,QAAQ,YAAY,QAAQ,aAAa;AAC3D,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,UAAU,QAAQ,YAAY,SAAS,GAAG,EAAE,GA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E,GAAG,OAAO,QAAQ;AAAA,YACxC;AAAA,YAEA;AAAA,YACA,cAAc,SAAS,QAAQ,QAAQ,EAAE,IAAI;AAAA,YAC7C,aAAa,SAAS;AAAA,YAEtB,QACE,aAAa,cAAc,QAAQ,KAAK,cAAc;AAAA,YAExD;AAAA,UACF;AAAA,QACF;AAAA,QACA,WAAW,CAACA,cAAa,KAAK,eAAe,UAAUA,SAAQ;AAAA,MACjE,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EAEQ,oCAAoC,oBAAI,IAG9C;AAAA,EAEK,YACL,OACA,UACa;AACb,QAAI,UAAU,KAAK,kCAAkC,IAAI,KAAK;AAC9D,QAAI,CAAC,SAAS;AACZ,gBAAU,IAAI,0BAA0B;AAAA,QACtC,MAAM,KAAK;AAAA,QACX,UAAU,OAAO;AAAA,UACf,WAAW,CAACA,cACV,KAAK,eAAe,SAAS,EAAE,YAAY,OAAOA,SAAQ;AAAA,QAC9D;AAAA,QACA,WAAW,CAACA,cAAa,KAAK,eAAe,eAAeA,SAAQ;AAAA,MACtE,CAAC;AACD,WAAK,kCAAkC,IAAI,OAAO,OAAO;AAAA,IAC3D;AACA,WAAO,QAAQ,UAAU,QAAQ;AAAA,EACnC;AACF;","names":["callback"]}
1
+ {"version":3,"sources":["../../src/api/ThreadRuntime.ts"],"sourcesContent":["import {\n ThreadSuggestion,\n RuntimeCapabilities,\n ThreadRuntimeCore,\n SpeechState,\n ThreadRuntimeEventType,\n ThreadMetadata,\n} from \"../runtimes/core/ThreadRuntimeCore\";\nimport { ExportedMessageRepository } from \"../runtimes/utils/MessageRepository\";\nimport {\n AppendMessage,\n ModelConfig,\n ThreadMessage,\n Unsubscribe,\n} from \"../types\";\nimport {\n MessageRuntime,\n MessageRuntimeImpl,\n MessageState,\n} from \"./MessageRuntime\";\nimport { NestedSubscriptionSubject } from \"./subscribable/NestedSubscriptionSubject\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport {\n Subscribable,\n SubscribableWithState,\n} from \"./subscribable/Subscribable\";\nimport {\n ThreadComposerRuntime,\n ThreadComposerRuntimeImpl,\n} from \"./ComposerRuntime\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { MessageRuntimePath, ThreadRuntimePath } from \"./RuntimePathTypes\";\n\nexport type CreateAppendMessage =\n | string\n | {\n parentId?: string | null | undefined;\n role?: AppendMessage[\"role\"] | undefined;\n content: AppendMessage[\"content\"];\n attachments?: AppendMessage[\"attachments\"] | undefined;\n startRun?: boolean | undefined;\n };\n\nconst toAppendMessage = (\n messages: readonly ThreadMessage[],\n message: CreateAppendMessage,\n): AppendMessage => {\n if (typeof message === \"string\") {\n return {\n parentId: messages.at(-1)?.id ?? null,\n role: \"user\",\n content: [{ type: \"text\", text: message }],\n attachments: [],\n };\n }\n\n if (message.role && message.parentId && message.attachments) {\n return message as AppendMessage;\n }\n\n return {\n ...message,\n parentId: message.parentId ?? messages.at(-1)?.id ?? null,\n role: message.role ?? \"user\",\n attachments: message.attachments ?? [],\n } as AppendMessage;\n};\n\nexport type ThreadRuntimeCoreBinding = SubscribableWithState<\n ThreadRuntimeCore,\n ThreadRuntimePath\n> & {\n outerSubscribe(callback: () => void): Unsubscribe;\n};\n\nexport type ThreadState = Readonly<{\n /**\n * The thread ID.\n * @deprecated This field is deprecated and will be removed in 0.7.0. Use `metadata.threadId` instead. \n */\n threadId: string;\n\n /**\n * The thread metadata.\n */\n metadata: ThreadMetadata;\n\n /**\n * Whether the thread is disabled. Disabled threads cannot receive new messages.\n */\n isDisabled: boolean;\n\n /**\n * Whether the thread is running. A thread is considered running when there is an active stream connection to the backend.\n */\n isRunning: boolean;\n\n /**\n * The capabilities of the thread, such as whether the thread supports editing, branch switching, etc.\n */\n capabilities: RuntimeCapabilities;\n\n /**\n * The messages in the currently selected branch of the thread.\n */\n messages: readonly ThreadMessage[];\n\n /**\n * Follow up message suggestions to show the user.\n */\n suggestions: readonly ThreadSuggestion[];\n\n /**\n * Custom extra information provided by the runtime.\n */\n extras: unknown;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speech: SpeechState | undefined;\n}>;\n\nexport const getThreadState = (runtime: ThreadRuntimeCore): ThreadState => {\n const lastMessage = runtime.messages.at(-1);\n return Object.freeze({\n threadId: runtime.metadata.threadId,\n metadata: runtime.metadata,\n capabilities: runtime.capabilities,\n isDisabled: runtime.isDisabled,\n isRunning:\n lastMessage?.role !== \"assistant\"\n ? false\n : lastMessage.status.type === \"running\",\n messages: runtime.messages,\n suggestions: runtime.suggestions,\n extras: runtime.extras,\n speech: runtime.speech,\n });\n};\n\nexport type ThreadRuntime = Readonly<{\n readonly path: ThreadRuntimePath;\n\n readonly composer: ThreadComposerRuntime;\n getState(): ThreadState;\n\n append(message: CreateAppendMessage): void;\n startRun(parentId: string | null): void;\n subscribe(callback: () => void): Unsubscribe;\n cancelRun(): void;\n getModelConfig(): ModelConfig;\n export(): ExportedMessageRepository;\n import(repository: ExportedMessageRepository): void;\n getMesssageByIndex(idx: number): MessageRuntime;\n getMesssageById(messageId: string): MessageRuntime;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking: () => void;\n\n unstable_on(event: ThreadRuntimeEventType, callback: () => void): Unsubscribe;\n}>;\n\nexport class ThreadRuntimeImpl implements ThreadRuntime {\n public get path() {\n return this._threadBinding.path;\n }\n\n public unstable_getCore() {\n return this._threadBinding.getState();\n }\n\n private _threadBinding: ThreadRuntimeCoreBinding & {\n getStateState(): ThreadState;\n };\n\n constructor(threadBinding: ThreadRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: threadBinding.path,\n getState: () => getThreadState(threadBinding.getState()),\n subscribe: (callback) => threadBinding.subscribe(callback),\n });\n\n this._threadBinding = {\n path: threadBinding.path,\n getState: () => threadBinding.getState(),\n getStateState: () => stateBinding.getState(),\n outerSubscribe: (callback) => threadBinding.outerSubscribe(callback),\n subscribe: (callback) => threadBinding.subscribe(callback),\n };\n\n this.composer = new ThreadComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.composer`,\n composerSource: \"thread\",\n },\n getState: () => this._threadBinding.getState().composer,\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n );\n }\n\n public readonly composer;\n\n public getState() {\n return this._threadBinding.getStateState();\n }\n\n public append(message: CreateAppendMessage) {\n this._threadBinding\n .getState()\n .append(\n toAppendMessage(this._threadBinding.getState().messages, message),\n );\n }\n\n public subscribe(callback: () => void) {\n return this._threadBinding.subscribe(callback);\n }\n\n public getModelConfig() {\n return this._threadBinding.getState().getModelConfig();\n }\n\n public startRun(parentId: string | null) {\n return this._threadBinding.getState().startRun(parentId);\n }\n\n public cancelRun() {\n this._threadBinding.getState().cancelRun();\n }\n\n public stopSpeaking() {\n return this._threadBinding.getState().stopSpeaking();\n }\n\n public getSubmittedFeedback(messageId: string) {\n return this._threadBinding.getState().getSubmittedFeedback(messageId);\n }\n\n public export() {\n return this._threadBinding.getState().export();\n }\n\n public import(data: ExportedMessageRepository) {\n this._threadBinding.getState().import(data);\n }\n\n public getMesssageByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Message index must be >= 0\");\n\n return this._getMessageRuntime(\n {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.messages[${idx}]`,\n messageSelector: { type: \"index\", index: idx },\n },\n () => {\n const messages = this._threadBinding.getState().messages;\n const message = messages[idx];\n if (!message) return undefined;\n return {\n message,\n parentId: messages[idx - 1]?.id ?? null,\n };\n },\n );\n }\n\n public getMesssageById(messageId: string) {\n return this._getMessageRuntime(\n {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.messages[messageId=${JSON.stringify(messageId)}]`,\n messageSelector: { type: \"messageId\", messageId: messageId },\n },\n () => this._threadBinding.getState().getMessageById(messageId),\n );\n }\n\n private _getMessageRuntime(\n path: MessageRuntimePath,\n callback: () =>\n | { parentId: string | null; message: ThreadMessage }\n | undefined,\n ) {\n return new MessageRuntimeImpl(\n new ShallowMemoizeSubject({\n path,\n getState: () => {\n const { message, parentId } = callback() ?? {};\n\n const { messages, speech: speechState } =\n this._threadBinding.getState();\n\n if (!message || parentId === undefined) return SKIP_UPDATE;\n\n const thread = this._threadBinding.getState();\n\n const branches = thread.getBranches(message.id);\n const submittedFeedback = thread.getSubmittedFeedback(message.id);\n\n return {\n ...message,\n\n isLast: messages.at(-1)?.id === message.id,\n parentId,\n\n branchNumber: branches.indexOf(message.id) + 1,\n branchCount: branches.length,\n\n speech:\n speechState?.messageId === message.id ? speechState : undefined,\n\n submittedFeedback,\n } satisfies MessageState;\n },\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n this._threadBinding,\n );\n }\n\n private _eventListenerNestedSubscriptions = new Map<\n string,\n NestedSubscriptionSubject<Subscribable, ThreadRuntimePath>\n >();\n\n public unstable_on(\n event: ThreadRuntimeEventType,\n callback: () => void,\n ): Unsubscribe {\n let subject = this._eventListenerNestedSubscriptions.get(event);\n if (!subject) {\n subject = new NestedSubscriptionSubject({\n path: this.path,\n getState: () => ({\n subscribe: (callback) =>\n this._threadBinding.getState().unstable_on(event, callback),\n }),\n subscribe: (callback) => this._threadBinding.outerSubscribe(callback),\n });\n this._eventListenerNestedSubscriptions.set(event, subject);\n }\n return subject.subscribe(callback);\n }\n}\n"],"mappings":";AAeA;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AAKtC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAa5B,IAAM,kBAAkB,CACtB,UACA,YACkB;AAClB,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,MACL,UAAU,SAAS,GAAG,EAAE,GAAG,MAAM;AAAA,MACjC,MAAM;AAAA,MACN,SAAS,CAAC,EAAE,MAAM,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AAAA,YACL,GAAG;AAAA,YAEH,QAAQ,SAAS,GAAG,EAAE,GAAG,OAAO,QAAQ;AAAA,YACxC;AAAA,YAEA,cAAc,SAAS,QAAQ,QAAQ,EAAE,IAAI;AAAA,YAC7C,aAAa,SAAS;AAAA,YAEtB,QACE,aAAa,cAAc,QAAQ,KAAK,cAAc;AAAA,YAExD;AAAA,UACF;AAAA,QACF;AAAA,QACA,WAAW,CAACA,cAAa,KAAK,eAAe,UAAUA,SAAQ;AAAA,MACjE,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EAEQ,oCAAoC,oBAAI,IAG9C;AAAA,EAEK,YACL,OACA,UACa;AACb,QAAI,UAAU,KAAK,kCAAkC,IAAI,KAAK;AAC9D,QAAI,CAAC,SAAS;AACZ,gBAAU,IAAI,0BAA0B;AAAA,QACtC,MAAM,KAAK;AAAA,QACX,UAAU,OAAO;AAAA,UACf,WAAW,CAACA,cACV,KAAK,eAAe,SAAS,EAAE,YAAY,OAAOA,SAAQ;AAAA,QAC9D;AAAA,QACA,WAAW,CAACA,cAAa,KAAK,eAAe,eAAeA,SAAQ;AAAA,MACtE,CAAC;AACD,WAAK,kCAAkC,IAAI,OAAO,OAAO;AAAA,IAC3D;AACA,WAAO,QAAQ,UAAU,QAAQ;AAAA,EACnC;AACF;","names":["callback"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAI9D,yBAAiB,wBAAwB,CAAC;IACxC,KAAY,KAAK,GAAG,iBAAiB,CAAC;QACpC;;WAEG;QACH,OAAO,EAAE,gBAAgB,CAAC;KAC3B,CAAC,CAAC;CACJ;AA6BD,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,wBAAwB,CAAC,KAAK,CAqB/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,sEAAqC,CAAC"}
1
+ {"version":3,"file":"AssistantRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAI9D,yBAAiB,wBAAwB,CAAC;IACxC,KAAY,KAAK,GAAG,iBAAiB,CAAC;QACpC;;WAEG;QACH,OAAO,EAAE,gBAAgB,CAAC;KAC3B,CAAC,CAAC;CACJ;AA6BD,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,wBAAwB,CAAC,KAAK,CAoB/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,sEAAqC,CAAC"}
@@ -59,7 +59,6 @@ var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
59
59
  return {
60
60
  useToolUIs,
61
61
  useAssistantRuntime,
62
- useAssistantActions: useAssistantRuntime,
63
62
  useThreadList
64
63
  };
65
64
  }, [useAssistantRuntime, useToolUIs, useThreadList]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { memo, useEffect, useMemo, useState } from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst useThreadListStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime.threadList.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.threadList.getState(), true);\n updateState();\n return runtime.threadList.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const useThreadList = useThreadListStore(runtime);\n const context = useMemo(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n useAssistantActions: useAssistantRuntime,\n useThreadList,\n };\n }, [useAssistantRuntime, useToolUIs, useThreadList]);\n\n return (\n <AssistantContext.Provider value={context}>\n <ThreadRuntimeProvider runtime={runtime.thread}>\n {children}\n </ThreadRuntimeProvider>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAmD;AACnD,8BAAiC;AACjC,8BAA0C;AAC1C,mCAAsC;AAEtC,qBAAuB;AACvB,2BAA8B;AAuDxB;AA5CN,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,OAAO,CAAC;AAEpD,8BAAU,MAAM;AACd,4CAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,aAAO,sBAAQ,UAAM,mDAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,WAAW,SAAS,CAAC,CAAC;AAE1E,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,WAAW,SAAS,GAAG,IAAI;AACnE,gBAAY;AACZ,WAAO,QAAQ,WAAW,UAAU,WAAW;AAAA,EACjD,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,gBAAgB,mBAAmB,OAAO;AAChD,QAAM,cAAU,sBAAQ,MAAM;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,MACrB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,qBAAqB,YAAY,aAAa,CAAC;AAEnD,SACE,4CAAC,yCAAiB,UAAjB,EAA0B,OAAO,SAChC,sDAAC,sDAAsB,SAAS,QAAQ,QACrC,UACH,GACF;AAEJ;AAEO,IAAM,+BAA2B,mBAAK,4BAA4B;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { memo, useEffect, useMemo, useState } from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst useThreadListStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime.threadList.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.threadList.getState(), true);\n updateState();\n return runtime.threadList.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const useThreadList = useThreadListStore(runtime);\n const context = useMemo(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n useThreadList,\n };\n }, [useAssistantRuntime, useToolUIs, useThreadList]);\n\n return (\n <AssistantContext.Provider value={context}>\n <ThreadRuntimeProvider runtime={runtime.thread}>\n {children}\n </ThreadRuntimeProvider>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAmD;AACnD,8BAAiC;AACjC,8BAA0C;AAC1C,mCAAsC;AAEtC,qBAAuB;AACvB,2BAA8B;AAsDxB;AA3CN,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,OAAO,CAAC;AAEpD,8BAAU,MAAM;AACd,4CAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,aAAO,sBAAQ,UAAM,mDAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,WAAW,SAAS,CAAC,CAAC;AAE1E,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,WAAW,SAAS,GAAG,IAAI;AACnE,gBAAY;AACZ,WAAO,QAAQ,WAAW,UAAU,WAAW;AAAA,EACjD,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,gBAAgB,mBAAmB,OAAO;AAChD,QAAM,cAAU,sBAAQ,MAAM;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,qBAAqB,YAAY,aAAa,CAAC;AAEnD,SACE,4CAAC,yCAAiB,UAAjB,EAA0B,OAAO,SAChC,sDAAC,sDAAsB,SAAS,QAAQ,QACrC,UACH,GACF;AAEJ;AAEO,IAAM,+BAA2B,mBAAK,4BAA4B;","names":[]}
@@ -35,7 +35,6 @@ var AssistantRuntimeProviderImpl = ({ children, runtime }) => {
35
35
  return {
36
36
  useToolUIs,
37
37
  useAssistantRuntime,
38
- useAssistantActions: useAssistantRuntime,
39
38
  useThreadList
40
39
  };
41
40
  }, [useAssistantRuntime, useToolUIs, useThreadList]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { memo, useEffect, useMemo, useState } from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst useThreadListStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime.threadList.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.threadList.getState(), true);\n updateState();\n return runtime.threadList.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const useThreadList = useThreadListStore(runtime);\n const context = useMemo(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n useAssistantActions: useAssistantRuntime,\n useThreadList,\n };\n }, [useAssistantRuntime, useToolUIs, useThreadList]);\n\n return (\n <AssistantContext.Provider value={context}>\n <ThreadRuntimeProvider runtime={runtime.thread}>\n {children}\n </ThreadRuntimeProvider>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;AAGA,SAAS,MAAM,WAAW,SAAS,gBAAgB;AACnD,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AAEtC,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAuDxB;AA5CN,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,SAAO,QAAQ,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,QAAQ,WAAW,SAAS,CAAC,CAAC;AAE1E,YAAU,MAAM;AACd,UAAM,cAAc,MAClB,cAAc,KAAK,EAAE,SAAS,QAAQ,WAAW,SAAS,GAAG,IAAI;AACnE,gBAAY;AACZ,WAAO,QAAQ,WAAW,UAAU,WAAW;AAAA,EACjD,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,gBAAgB,mBAAmB,OAAO;AAChD,QAAM,UAAU,QAAQ,MAAM;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,MACrB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,qBAAqB,YAAY,aAAa,CAAC;AAEnD,SACE,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,SAChC,8BAAC,yBAAsB,SAAS,QAAQ,QACrC,UACH,GACF;AAEJ;AAEO,IAAM,2BAA2B,KAAK,4BAA4B;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/AssistantRuntimeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { memo, useEffect, useMemo, useState } from \"react\";\nimport { AssistantContext } from \"../react/AssistantContext\";\nimport { makeAssistantToolUIsStore } from \"../stores/AssistantToolUIs\";\nimport { ThreadRuntimeProvider } from \"./ThreadRuntimeProvider\";\nimport { AssistantRuntime } from \"../../api/AssistantRuntime\";\nimport { create } from \"zustand\";\nimport { writableStore } from \"../ReadonlyStore\";\n\nexport namespace AssistantRuntimeProvider {\n export type Props = PropsWithChildren<{\n /**\n * The runtime to provide to the rest of your app.\n */\n runtime: AssistantRuntime;\n }>;\n}\n\nconst useAssistantRuntimeStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useAssistantToolUIsStore = () => {\n return useMemo(() => makeAssistantToolUIsStore(), []);\n};\n\nconst useThreadListStore = (runtime: AssistantRuntime) => {\n const [store] = useState(() => create(() => runtime.threadList.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.threadList.getState(), true);\n updateState();\n return runtime.threadList.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const AssistantRuntimeProviderImpl: FC<\n AssistantRuntimeProvider.Props\n> = ({ children, runtime }) => {\n const useAssistantRuntime = useAssistantRuntimeStore(runtime);\n const useToolUIs = useAssistantToolUIsStore();\n const useThreadList = useThreadListStore(runtime);\n const context = useMemo(() => {\n return {\n useToolUIs,\n useAssistantRuntime,\n useThreadList,\n };\n }, [useAssistantRuntime, useToolUIs, useThreadList]);\n\n return (\n <AssistantContext.Provider value={context}>\n <ThreadRuntimeProvider runtime={runtime.thread}>\n {children}\n </ThreadRuntimeProvider>\n </AssistantContext.Provider>\n );\n};\n\nexport const AssistantRuntimeProvider = memo(AssistantRuntimeProviderImpl);\n"],"mappings":";;;AAGA,SAAS,MAAM,WAAW,SAAS,gBAAgB;AACnD,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,6BAA6B;AAEtC,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAsDxB;AA3CN,IAAM,2BAA2B,CAAC,YAA8B;AAC9D,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,2BAA2B,MAAM;AACrC,SAAO,QAAQ,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACtD;AAEA,IAAM,qBAAqB,CAAC,YAA8B;AACxD,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,QAAQ,WAAW,SAAS,CAAC,CAAC;AAE1E,YAAU,MAAM;AACd,UAAM,cAAc,MAClB,cAAc,KAAK,EAAE,SAAS,QAAQ,WAAW,SAAS,GAAG,IAAI;AACnE,gBAAY;AACZ,WAAO,QAAQ,WAAW,UAAU,WAAW;AAAA,EACjD,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,+BAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,sBAAsB,yBAAyB,OAAO;AAC5D,QAAM,aAAa,yBAAyB;AAC5C,QAAM,gBAAgB,mBAAmB,OAAO;AAChD,QAAM,UAAU,QAAQ,MAAM;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,qBAAqB,YAAY,aAAa,CAAC;AAEnD,SACE,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,SAChC,8BAAC,yBAAsB,SAAS,QAAQ,QACrC,UACH,GACF;AAEJ;AAEO,IAAM,2BAA2B,KAAK,4BAA4B;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextContentPartProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/TextContentPartProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAcnD,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,KAAK,GAAG,iBAAiB,CAAC;QACpC,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACjC,CAAC,CAAC;CACJ;AAUD,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,CA+CrE,CAAC"}
1
+ {"version":3,"file":"TextContentPartProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/TextContentPartProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAcnD,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,KAAK,GAAG,iBAAiB,CAAC;QACpC,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACjC,CAAC,CAAC;CACJ;AAUD,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,CA6CrE,CAAC"}
@@ -48,7 +48,6 @@ var TextContentPartProvider = ({
48
48
  );
49
49
  const useContentPart = (0, import_zustand.create)(() => ({
50
50
  status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,
51
- part: { type: "text", text },
52
51
  type: "text",
53
52
  text
54
53
  }));
@@ -64,7 +63,6 @@ var TextContentPartProvider = ({
64
63
  {
65
64
  type: "text",
66
65
  text,
67
- part: { type: "text", text },
68
66
  status: targetStatus
69
67
  },
70
68
  true
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/TextContentPartProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport {\n ContentPartContext,\n ContentPartContextValue,\n} from \"../react/ContentPartContext\";\nimport { ContentPartStatus, TextContentPart } from \"../../types/AssistantTypes\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport {\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"../../api/ContentPartRuntime\";\n\nexport namespace TextContentPartProvider {\n export type Props = PropsWithChildren<{\n text: string;\n isRunning?: boolean | undefined;\n }>;\n}\n\nconst COMPLETE_STATUS: ContentPartStatus = {\n type: \"complete\",\n};\n\nconst RUNNING_STATUS: ContentPartStatus = {\n type: \"running\",\n};\n\nexport const TextContentPartProvider: FC<TextContentPartProvider.Props> = ({\n children,\n text,\n isRunning,\n}) => {\n const [context] = useState<ContentPartContextValue>(() => {\n const useContentPartRuntime = create(\n // TODO\n () => new ContentPartRuntimeImpl(null as any, null as any, null as any),\n );\n const useContentPart = create<ContentPartState>(() => ({\n status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,\n part: { type: \"text\", text },\n type: \"text\",\n text,\n }));\n\n return { useContentPartRuntime, useContentPart };\n });\n\n useEffect(() => {\n const state = context.useContentPart.getState() as ContentPartState & {\n type: \"text\";\n };\n\n const textUpdated = (state as TextContentPart).text !== text;\n const targetStatus = isRunning ? RUNNING_STATUS : COMPLETE_STATUS;\n const statusUpdated = state.status !== targetStatus;\n\n if (!textUpdated && !statusUpdated) return;\n\n writableStore(context.useContentPart).setState(\n {\n type: \"text\",\n text,\n part: { type: \"text\", text },\n status: targetStatus,\n } satisfies ContentPartState,\n true,\n );\n }, [context, isRunning, text]);\n\n return (\n <ContentPartContext.Provider value={context}>\n {children}\n </ContentPartContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAoC;AACpC,qBAAuB;AACvB,gCAGO;AAEP,2BAA8B;AAC9B,gCAGO;AA4DH;AAnDJ,IAAM,kBAAqC;AAAA,EACzC,MAAM;AACR;AAEA,IAAM,iBAAoC;AAAA,EACxC,MAAM;AACR;AAEO,IAAM,0BAA6D,CAAC;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAI,uBAAkC,MAAM;AACxD,UAAM,4BAAwB;AAAA;AAAA,MAE5B,MAAM,IAAI,iDAAuB,MAAa,MAAa,IAAW;AAAA,IACxE;AACA,UAAM,qBAAiB,uBAAyB,OAAO;AAAA,MACrD,QAAQ,YAAY,iBAAiB;AAAA,MACrC,MAAM,EAAE,MAAM,QAAQ,KAAK;AAAA,MAC3B,MAAM;AAAA,MACN;AAAA,IACF,EAAE;AAEF,WAAO,EAAE,uBAAuB,eAAe;AAAA,EACjD,CAAC;AAED,8BAAU,MAAM;AACd,UAAM,QAAQ,QAAQ,eAAe,SAAS;AAI9C,UAAM,cAAe,MAA0B,SAAS;AACxD,UAAM,eAAe,YAAY,iBAAiB;AAClD,UAAM,gBAAgB,MAAM,WAAW;AAEvC,QAAI,CAAC,eAAe,CAAC,cAAe;AAEpC,4CAAc,QAAQ,cAAc,EAAE;AAAA,MACpC;AAAA,QACE,MAAM;AAAA,QACN;AAAA,QACA,MAAM,EAAE,MAAM,QAAQ,KAAK;AAAA,QAC3B,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,WAAW,IAAI,CAAC;AAE7B,SACE,4CAAC,6CAAmB,UAAnB,EAA4B,OAAO,SACjC,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/TextContentPartProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport {\n ContentPartContext,\n ContentPartContextValue,\n} from \"../react/ContentPartContext\";\nimport { ContentPartStatus, TextContentPart } from \"../../types/AssistantTypes\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport {\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"../../api/ContentPartRuntime\";\n\nexport namespace TextContentPartProvider {\n export type Props = PropsWithChildren<{\n text: string;\n isRunning?: boolean | undefined;\n }>;\n}\n\nconst COMPLETE_STATUS: ContentPartStatus = {\n type: \"complete\",\n};\n\nconst RUNNING_STATUS: ContentPartStatus = {\n type: \"running\",\n};\n\nexport const TextContentPartProvider: FC<TextContentPartProvider.Props> = ({\n children,\n text,\n isRunning,\n}) => {\n const [context] = useState<ContentPartContextValue>(() => {\n const useContentPartRuntime = create(\n // TODO\n () => new ContentPartRuntimeImpl(null as any, null as any, null as any),\n );\n const useContentPart = create<ContentPartState>(() => ({\n status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,\n type: \"text\",\n text,\n }));\n\n return { useContentPartRuntime, useContentPart };\n });\n\n useEffect(() => {\n const state = context.useContentPart.getState() as ContentPartState & {\n type: \"text\";\n };\n\n const textUpdated = (state as TextContentPart).text !== text;\n const targetStatus = isRunning ? RUNNING_STATUS : COMPLETE_STATUS;\n const statusUpdated = state.status !== targetStatus;\n\n if (!textUpdated && !statusUpdated) return;\n\n writableStore(context.useContentPart).setState(\n {\n type: \"text\",\n text,\n status: targetStatus,\n } satisfies ContentPartState,\n true,\n );\n }, [context, isRunning, text]);\n\n return (\n <ContentPartContext.Provider value={context}>\n {children}\n </ContentPartContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAoC;AACpC,qBAAuB;AACvB,gCAGO;AAEP,2BAA8B;AAC9B,gCAGO;AA0DH;AAjDJ,IAAM,kBAAqC;AAAA,EACzC,MAAM;AACR;AAEA,IAAM,iBAAoC;AAAA,EACxC,MAAM;AACR;AAEO,IAAM,0BAA6D,CAAC;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAI,uBAAkC,MAAM;AACxD,UAAM,4BAAwB;AAAA;AAAA,MAE5B,MAAM,IAAI,iDAAuB,MAAa,MAAa,IAAW;AAAA,IACxE;AACA,UAAM,qBAAiB,uBAAyB,OAAO;AAAA,MACrD,QAAQ,YAAY,iBAAiB;AAAA,MACrC,MAAM;AAAA,MACN;AAAA,IACF,EAAE;AAEF,WAAO,EAAE,uBAAuB,eAAe;AAAA,EACjD,CAAC;AAED,8BAAU,MAAM;AACd,UAAM,QAAQ,QAAQ,eAAe,SAAS;AAI9C,UAAM,cAAe,MAA0B,SAAS;AACxD,UAAM,eAAe,YAAY,iBAAiB;AAClD,UAAM,gBAAgB,MAAM,WAAW;AAEvC,QAAI,CAAC,eAAe,CAAC,cAAe;AAEpC,4CAAc,QAAQ,cAAc,EAAE;AAAA,MACpC;AAAA,QACE,MAAM;AAAA,QACN;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,WAAW,IAAI,CAAC;AAE7B,SACE,4CAAC,6CAAmB,UAAnB,EAA4B,OAAO,SACjC,UACH;AAEJ;","names":[]}
@@ -29,7 +29,6 @@ var TextContentPartProvider = ({
29
29
  );
30
30
  const useContentPart = create(() => ({
31
31
  status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,
32
- part: { type: "text", text },
33
32
  type: "text",
34
33
  text
35
34
  }));
@@ -45,7 +44,6 @@ var TextContentPartProvider = ({
45
44
  {
46
45
  type: "text",
47
46
  text,
48
- part: { type: "text", text },
49
47
  status: targetStatus
50
48
  },
51
49
  true
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/TextContentPartProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport {\n ContentPartContext,\n ContentPartContextValue,\n} from \"../react/ContentPartContext\";\nimport { ContentPartStatus, TextContentPart } from \"../../types/AssistantTypes\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport {\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"../../api/ContentPartRuntime\";\n\nexport namespace TextContentPartProvider {\n export type Props = PropsWithChildren<{\n text: string;\n isRunning?: boolean | undefined;\n }>;\n}\n\nconst COMPLETE_STATUS: ContentPartStatus = {\n type: \"complete\",\n};\n\nconst RUNNING_STATUS: ContentPartStatus = {\n type: \"running\",\n};\n\nexport const TextContentPartProvider: FC<TextContentPartProvider.Props> = ({\n children,\n text,\n isRunning,\n}) => {\n const [context] = useState<ContentPartContextValue>(() => {\n const useContentPartRuntime = create(\n // TODO\n () => new ContentPartRuntimeImpl(null as any, null as any, null as any),\n );\n const useContentPart = create<ContentPartState>(() => ({\n status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,\n part: { type: \"text\", text },\n type: \"text\",\n text,\n }));\n\n return { useContentPartRuntime, useContentPart };\n });\n\n useEffect(() => {\n const state = context.useContentPart.getState() as ContentPartState & {\n type: \"text\";\n };\n\n const textUpdated = (state as TextContentPart).text !== text;\n const targetStatus = isRunning ? RUNNING_STATUS : COMPLETE_STATUS;\n const statusUpdated = state.status !== targetStatus;\n\n if (!textUpdated && !statusUpdated) return;\n\n writableStore(context.useContentPart).setState(\n {\n type: \"text\",\n text,\n part: { type: \"text\", text },\n status: targetStatus,\n } satisfies ContentPartState,\n true,\n );\n }, [context, isRunning, text]);\n\n return (\n <ContentPartContext.Provider value={context}>\n {children}\n </ContentPartContext.Provider>\n );\n};\n"],"mappings":";;;AAGA,SAAS,WAAW,gBAAgB;AACpC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,OAEK;AA4DH;AAnDJ,IAAM,kBAAqC;AAAA,EACzC,MAAM;AACR;AAEA,IAAM,iBAAoC;AAAA,EACxC,MAAM;AACR;AAEO,IAAM,0BAA6D,CAAC;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,IAAI,SAAkC,MAAM;AACxD,UAAM,wBAAwB;AAAA;AAAA,MAE5B,MAAM,IAAI,uBAAuB,MAAa,MAAa,IAAW;AAAA,IACxE;AACA,UAAM,iBAAiB,OAAyB,OAAO;AAAA,MACrD,QAAQ,YAAY,iBAAiB;AAAA,MACrC,MAAM,EAAE,MAAM,QAAQ,KAAK;AAAA,MAC3B,MAAM;AAAA,MACN;AAAA,IACF,EAAE;AAEF,WAAO,EAAE,uBAAuB,eAAe;AAAA,EACjD,CAAC;AAED,YAAU,MAAM;AACd,UAAM,QAAQ,QAAQ,eAAe,SAAS;AAI9C,UAAM,cAAe,MAA0B,SAAS;AACxD,UAAM,eAAe,YAAY,iBAAiB;AAClD,UAAM,gBAAgB,MAAM,WAAW;AAEvC,QAAI,CAAC,eAAe,CAAC,cAAe;AAEpC,kBAAc,QAAQ,cAAc,EAAE;AAAA,MACpC;AAAA,QACE,MAAM;AAAA,QACN;AAAA,QACA,MAAM,EAAE,MAAM,QAAQ,KAAK;AAAA,QAC3B,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,WAAW,IAAI,CAAC;AAE7B,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/TextContentPartProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { create } from \"zustand\";\nimport {\n ContentPartContext,\n ContentPartContextValue,\n} from \"../react/ContentPartContext\";\nimport { ContentPartStatus, TextContentPart } from \"../../types/AssistantTypes\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport {\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"../../api/ContentPartRuntime\";\n\nexport namespace TextContentPartProvider {\n export type Props = PropsWithChildren<{\n text: string;\n isRunning?: boolean | undefined;\n }>;\n}\n\nconst COMPLETE_STATUS: ContentPartStatus = {\n type: \"complete\",\n};\n\nconst RUNNING_STATUS: ContentPartStatus = {\n type: \"running\",\n};\n\nexport const TextContentPartProvider: FC<TextContentPartProvider.Props> = ({\n children,\n text,\n isRunning,\n}) => {\n const [context] = useState<ContentPartContextValue>(() => {\n const useContentPartRuntime = create(\n // TODO\n () => new ContentPartRuntimeImpl(null as any, null as any, null as any),\n );\n const useContentPart = create<ContentPartState>(() => ({\n status: isRunning ? RUNNING_STATUS : COMPLETE_STATUS,\n type: \"text\",\n text,\n }));\n\n return { useContentPartRuntime, useContentPart };\n });\n\n useEffect(() => {\n const state = context.useContentPart.getState() as ContentPartState & {\n type: \"text\";\n };\n\n const textUpdated = (state as TextContentPart).text !== text;\n const targetStatus = isRunning ? RUNNING_STATUS : COMPLETE_STATUS;\n const statusUpdated = state.status !== targetStatus;\n\n if (!textUpdated && !statusUpdated) return;\n\n writableStore(context.useContentPart).setState(\n {\n type: \"text\",\n text,\n status: targetStatus,\n } satisfies ContentPartState,\n true,\n );\n }, [context, isRunning, text]);\n\n return (\n <ContentPartContext.Provider value={context}>\n {children}\n </ContentPartContext.Provider>\n );\n};\n"],"mappings":";;;AAGA,SAAS,WAAW,gBAAgB;AACpC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,OAEK;AA0DH;AAjDJ,IAAM,kBAAqC;AAAA,EACzC,MAAM;AACR;AAEA,IAAM,iBAAoC;AAAA,EACxC,MAAM;AACR;AAEO,IAAM,0BAA6D,CAAC;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,IAAI,SAAkC,MAAM;AACxD,UAAM,wBAAwB;AAAA;AAAA,MAE5B,MAAM,IAAI,uBAAuB,MAAa,MAAa,IAAW;AAAA,IACxE;AACA,UAAM,iBAAiB,OAAyB,OAAO;AAAA,MACrD,QAAQ,YAAY,iBAAiB;AAAA,MACrC,MAAM;AAAA,MACN;AAAA,IACF,EAAE;AAEF,WAAO,EAAE,uBAAuB,eAAe;AAAA,EACjD,CAAC;AAED,YAAU,MAAM;AACd,UAAM,QAAQ,QAAQ,eAAe,SAAS;AAI9C,UAAM,cAAe,MAA0B,SAAS;AACxD,UAAM,eAAe,YAAY,iBAAiB;AAClD,UAAM,gBAAgB,MAAM,WAAW;AAEvC,QAAI,CAAC,eAAe,CAAC,cAAe;AAEpC,kBAAc,QAAQ,cAAc,EAAE;AAAA,MACpC;AAAA,QACE,MAAM;AAAA,QACN;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,WAAW,IAAI,CAAC;AAE7B,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,UACH;AAEJ;","names":[]}
@@ -5,9 +5,6 @@ export declare namespace ThreadListItemRuntimeProvider {
5
5
  runtime: ThreadListItemRuntime;
6
6
  }>;
7
7
  }
8
- export declare const useThreadListItemStore: (runtime: ThreadListItemRuntime) => import("zustand").UseBoundStore<import("zustand").StoreApi<Readonly<{
9
- threadId: string;
10
- title?: string;
11
- }>>>;
8
+ export declare const useThreadListItemStore: (runtime: ThreadListItemRuntime) => import("zustand").UseBoundStore<import("zustand").StoreApi<import("../../api/ThreadListItemRuntime").ThreadListItemState>>;
12
9
  export declare const ThreadListItemRuntimeProvider: FC<ThreadListItemRuntimeProvider.Props>;
13
10
  //# sourceMappingURL=ThreadListItemRuntimeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListItemRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/ThreadListItemRuntimeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAO7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,KAAK,GAAG,iBAAiB,CAAC;QACpC,OAAO,EAAE,qBAAqB,CAAC;KAChC,CAAC,CAAC;CACJ;AAYD,eAAO,MAAM,sBAAsB,YAAa,qBAAqB;;;IAUpE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,EAAE,CAC5C,6BAA6B,CAAC,KAAK,CAapC,CAAC"}
1
+ {"version":3,"file":"ThreadListItemRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/ThreadListItemRuntimeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAO7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,KAAK,GAAG,iBAAiB,CAAC;QACpC,OAAO,EAAE,qBAAqB,CAAC;KAChC,CAAC,CAAC;CACJ;AAYD,eAAO,MAAM,sBAAsB,YAAa,qBAAqB,+HAUpE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,EAAE,CAC5C,6BAA6B,CAAC,KAAK,CAapC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/ThreadRuntimeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAMnD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAkDF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CACpC,iBAAiB,CAAC,mBAAmB,CAAC,CAuBvC,CAAC"}
1
+ {"version":3,"file":"ThreadRuntimeProvider.d.ts","sourceRoot":"","sources":["../../../src/context/providers/ThreadRuntimeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAMnD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAqCF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CACpC,iBAAiB,CAAC,mBAAmB,CAAC,CAoBvC,CAAC"}
@@ -45,15 +45,6 @@ var useThreadStore = (runtime) => {
45
45
  }, [runtime, store]);
46
46
  return store;
47
47
  };
48
- var useThreadMessagesStore = (runtime) => {
49
- const [store] = (0, import_react.useState)(() => (0, import_zustand.create)(() => runtime.messages));
50
- (0, import_react.useEffect)(() => {
51
- const updateState = () => (0, import_ReadonlyStore.writableStore)(store).setState(runtime.messages, true);
52
- updateState();
53
- return runtime.subscribe(updateState);
54
- }, [runtime, store]);
55
- return store;
56
- };
57
48
  var useThreadComposerStore = (runtime) => {
58
49
  const [store] = (0, import_react.useState)(() => (0, import_zustand.create)(() => runtime.getState()));
59
50
  (0, import_react.useEffect)(() => {
@@ -66,19 +57,16 @@ var useThreadComposerStore = (runtime) => {
66
57
  var ThreadRuntimeProvider = ({ children, runtime }) => {
67
58
  const useThreadRuntime = useThreadRuntimeStore(runtime);
68
59
  const useThread = useThreadStore(runtime);
69
- const useThreadMessages = useThreadMessagesStore(runtime);
70
60
  const useThreadComposer = useThreadComposerStore(runtime.composer);
71
61
  const context = (0, import_react.useMemo)(() => {
72
62
  const useViewport = (0, import_ThreadViewport.makeThreadViewportStore)();
73
63
  return {
74
64
  useThread,
75
65
  useThreadRuntime,
76
- useThreadMessages,
77
- useThreadActions: useThreadRuntime,
78
66
  useComposer: useThreadComposer,
79
67
  useViewport
80
68
  };
81
- }, [useThread, useThreadRuntime, useThreadMessages, useThreadComposer]);
69
+ }, [useThread, useThreadRuntime, useThreadComposer]);
82
70
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThreadContext.ThreadContext.Provider, { value: context, children });
83
71
  };
84
72
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/ThreadRuntimeProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { ThreadContextValue } from \"../react/ThreadContext\";\nimport { ThreadContext } from \"../react/ThreadContext\";\nimport { makeThreadViewportStore } from \"../stores/ThreadViewport\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\nimport { create } from \"zustand\";\nimport { ThreadComposerRuntime } from \"../../api/ComposerRuntime\";\n\ntype ThreadProviderProps = {\n runtime: ThreadRuntime;\n};\n\nconst useThreadRuntimeStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime.getState()));\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.getState(), true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadMessagesStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime.messages));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.messages, true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadComposerStore = (runtime: ThreadComposerRuntime) => {\n const [store] = useState(() => create(() => runtime.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.getState(), true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ThreadRuntimeProvider: FC<\n PropsWithChildren<ThreadProviderProps>\n> = ({ children, runtime }) => {\n const useThreadRuntime = useThreadRuntimeStore(runtime);\n const useThread = useThreadStore(runtime);\n const useThreadMessages = useThreadMessagesStore(runtime);\n const useThreadComposer = useThreadComposerStore(runtime.composer);\n\n const context = useMemo<ThreadContextValue>(() => {\n const useViewport = makeThreadViewportStore();\n\n return {\n useThread,\n useThreadRuntime,\n useThreadMessages,\n useThreadActions: useThreadRuntime,\n useComposer: useThreadComposer,\n useViewport,\n };\n }, [useThread, useThreadRuntime, useThreadMessages, useThreadComposer]);\n\n return (\n <ThreadContext.Provider value={context}>{children}</ThreadContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA6C;AAE7C,2BAA8B;AAC9B,4BAAwC;AACxC,2BAA8B;AAE9B,qBAAuB;AA6EnB;AAtEJ,IAAM,wBAAwB,CAAC,YAA2B;AACxD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,OAAO,CAAC;AAEpD,8BAAU,MAAM;AACd,4CAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,iBAAiB,CAAC,YAA2B;AACjD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,SAAS,CAAC,CAAC;AAC/D,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,SAAS,GAAG,IAAI;AACxD,gBAAY;AACZ,WAAO,QAAQ,UAAU,WAAW;AAAA,EACtC,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,yBAAyB,CAAC,YAA2B;AACzD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,QAAQ,CAAC;AAE7D,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,UAAU,IAAI;AACtD,gBAAY;AACZ,WAAO,QAAQ,UAAU,WAAW;AAAA,EACtC,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,yBAAyB,CAAC,YAAmC;AACjE,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,SAAS,CAAC,CAAC;AAE/D,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,SAAS,GAAG,IAAI;AACxD,gBAAY;AACZ,WAAO,QAAQ,UAAU,WAAW;AAAA,EACtC,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,wBAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,mBAAmB,sBAAsB,OAAO;AACtD,QAAM,YAAY,eAAe,OAAO;AACxC,QAAM,oBAAoB,uBAAuB,OAAO;AACxD,QAAM,oBAAoB,uBAAuB,QAAQ,QAAQ;AAEjE,QAAM,cAAU,sBAA4B,MAAM;AAChD,UAAM,kBAAc,+CAAwB;AAE5C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB,aAAa;AAAA,MACb;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,kBAAkB,mBAAmB,iBAAiB,CAAC;AAEtE,SACE,4CAAC,mCAAc,UAAd,EAAuB,OAAO,SAAU,UAAS;AAEtD;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/ThreadRuntimeProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { ThreadContextValue } from \"../react/ThreadContext\";\nimport { ThreadContext } from \"../react/ThreadContext\";\nimport { makeThreadViewportStore } from \"../stores/ThreadViewport\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\nimport { create } from \"zustand\";\nimport { ThreadComposerRuntime } from \"../../api/ComposerRuntime\";\n\ntype ThreadProviderProps = {\n runtime: ThreadRuntime;\n};\n\nconst useThreadRuntimeStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime.getState()));\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.getState(), true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadComposerStore = (runtime: ThreadComposerRuntime) => {\n const [store] = useState(() => create(() => runtime.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.getState(), true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ThreadRuntimeProvider: FC<\n PropsWithChildren<ThreadProviderProps>\n> = ({ children, runtime }) => {\n const useThreadRuntime = useThreadRuntimeStore(runtime);\n const useThread = useThreadStore(runtime);\n const useThreadComposer = useThreadComposerStore(runtime.composer);\n\n const context = useMemo<ThreadContextValue>(() => {\n const useViewport = makeThreadViewportStore();\n\n return {\n useThread,\n useThreadRuntime,\n useComposer: useThreadComposer,\n useViewport,\n };\n }, [useThread, useThreadRuntime, useThreadComposer]);\n\n return (\n <ThreadContext.Provider value={context}>{children}</ThreadContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA6C;AAE7C,2BAA8B;AAC9B,4BAAwC;AACxC,2BAA8B;AAE9B,qBAAuB;AA6DnB;AAtDJ,IAAM,wBAAwB,CAAC,YAA2B;AACxD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,OAAO,CAAC;AAEpD,8BAAU,MAAM;AACd,4CAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,iBAAiB,CAAC,YAA2B;AACjD,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,SAAS,CAAC,CAAC;AAC/D,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,SAAS,GAAG,IAAI;AACxD,gBAAY;AACZ,WAAO,QAAQ,UAAU,WAAW;AAAA,EACtC,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,yBAAyB,CAAC,YAAmC;AACjE,QAAM,CAAC,KAAK,QAAI,uBAAS,UAAM,uBAAO,MAAM,QAAQ,SAAS,CAAC,CAAC;AAE/D,8BAAU,MAAM;AACd,UAAM,cAAc,UAClB,oCAAc,KAAK,EAAE,SAAS,QAAQ,SAAS,GAAG,IAAI;AACxD,gBAAY;AACZ,WAAO,QAAQ,UAAU,WAAW;AAAA,EACtC,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,wBAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,mBAAmB,sBAAsB,OAAO;AACtD,QAAM,YAAY,eAAe,OAAO;AACxC,QAAM,oBAAoB,uBAAuB,QAAQ,QAAQ;AAEjE,QAAM,cAAU,sBAA4B,MAAM;AAChD,UAAM,kBAAc,+CAAwB;AAE5C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,kBAAkB,iBAAiB,CAAC;AAEnD,SACE,4CAAC,mCAAc,UAAd,EAAuB,OAAO,SAAU,UAAS;AAEtD;","names":[]}
@@ -21,15 +21,6 @@ var useThreadStore = (runtime) => {
21
21
  }, [runtime, store]);
22
22
  return store;
23
23
  };
24
- var useThreadMessagesStore = (runtime) => {
25
- const [store] = useState(() => create(() => runtime.messages));
26
- useEffect(() => {
27
- const updateState = () => writableStore(store).setState(runtime.messages, true);
28
- updateState();
29
- return runtime.subscribe(updateState);
30
- }, [runtime, store]);
31
- return store;
32
- };
33
24
  var useThreadComposerStore = (runtime) => {
34
25
  const [store] = useState(() => create(() => runtime.getState()));
35
26
  useEffect(() => {
@@ -42,19 +33,16 @@ var useThreadComposerStore = (runtime) => {
42
33
  var ThreadRuntimeProvider = ({ children, runtime }) => {
43
34
  const useThreadRuntime = useThreadRuntimeStore(runtime);
44
35
  const useThread = useThreadStore(runtime);
45
- const useThreadMessages = useThreadMessagesStore(runtime);
46
36
  const useThreadComposer = useThreadComposerStore(runtime.composer);
47
37
  const context = useMemo(() => {
48
38
  const useViewport = makeThreadViewportStore();
49
39
  return {
50
40
  useThread,
51
41
  useThreadRuntime,
52
- useThreadMessages,
53
- useThreadActions: useThreadRuntime,
54
42
  useComposer: useThreadComposer,
55
43
  useViewport
56
44
  };
57
- }, [useThread, useThreadRuntime, useThreadMessages, useThreadComposer]);
45
+ }, [useThread, useThreadRuntime, useThreadComposer]);
58
46
  return /* @__PURE__ */ jsx(ThreadContext.Provider, { value: context, children });
59
47
  };
60
48
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/context/providers/ThreadRuntimeProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { ThreadContextValue } from \"../react/ThreadContext\";\nimport { ThreadContext } from \"../react/ThreadContext\";\nimport { makeThreadViewportStore } from \"../stores/ThreadViewport\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\nimport { create } from \"zustand\";\nimport { ThreadComposerRuntime } from \"../../api/ComposerRuntime\";\n\ntype ThreadProviderProps = {\n runtime: ThreadRuntime;\n};\n\nconst useThreadRuntimeStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime.getState()));\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.getState(), true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadMessagesStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime.messages));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.messages, true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadComposerStore = (runtime: ThreadComposerRuntime) => {\n const [store] = useState(() => create(() => runtime.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.getState(), true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ThreadRuntimeProvider: FC<\n PropsWithChildren<ThreadProviderProps>\n> = ({ children, runtime }) => {\n const useThreadRuntime = useThreadRuntimeStore(runtime);\n const useThread = useThreadStore(runtime);\n const useThreadMessages = useThreadMessagesStore(runtime);\n const useThreadComposer = useThreadComposerStore(runtime.composer);\n\n const context = useMemo<ThreadContextValue>(() => {\n const useViewport = makeThreadViewportStore();\n\n return {\n useThread,\n useThreadRuntime,\n useThreadMessages,\n useThreadActions: useThreadRuntime,\n useComposer: useThreadComposer,\n useViewport,\n };\n }, [useThread, useThreadRuntime, useThreadMessages, useThreadComposer]);\n\n return (\n <ThreadContext.Provider value={context}>{children}</ThreadContext.Provider>\n );\n};\n"],"mappings":";AACA,SAAS,WAAW,SAAS,gBAAgB;AAE7C,SAAS,qBAAqB;AAC9B,SAAS,+BAA+B;AACxC,SAAS,qBAAqB;AAE9B,SAAS,cAAc;AA6EnB;AAtEJ,IAAM,wBAAwB,CAAC,YAA2B;AACxD,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,iBAAiB,CAAC,YAA2B;AACjD,QAAM,CAAC,KAAK,IAAI,SAAS,MA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BAAkB,mBAAmB,iBAAiB,CAAC;AAEtE,SACE,oBAAC,cAAc,UAAd,EAAuB,OAAO,SAAU,UAAS;AAEtD;","names":[]}
1
+ {"version":3,"sources":["../../../src/context/providers/ThreadRuntimeProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { ThreadContextValue } from \"../react/ThreadContext\";\nimport { ThreadContext } from \"../react/ThreadContext\";\nimport { makeThreadViewportStore } from \"../stores/ThreadViewport\";\nimport { writableStore } from \"../ReadonlyStore\";\nimport { ThreadRuntime } from \"../../api/ThreadRuntime\";\nimport { create } from \"zustand\";\nimport { ThreadComposerRuntime } from \"../../api/ComposerRuntime\";\n\ntype ThreadProviderProps = {\n runtime: ThreadRuntime;\n};\n\nconst useThreadRuntimeStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime));\n\n useEffect(() => {\n writableStore(store).setState(runtime, true);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadStore = (runtime: ThreadRuntime) => {\n const [store] = useState(() => create(() => runtime.getState()));\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.getState(), true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nconst useThreadComposerStore = (runtime: ThreadComposerRuntime) => {\n const [store] = useState(() => create(() => runtime.getState()));\n\n useEffect(() => {\n const updateState = () =>\n writableStore(store).setState(runtime.getState(), true);\n updateState();\n return runtime.subscribe(updateState);\n }, [runtime, store]);\n\n return store;\n};\n\nexport const ThreadRuntimeProvider: FC<\n PropsWithChildren<ThreadProviderProps>\n> = ({ children, runtime }) => {\n const useThreadRuntime = useThreadRuntimeStore(runtime);\n const useThread = useThreadStore(runtime);\n const useThreadComposer = useThreadComposerStore(runtime.composer);\n\n const context = useMemo<ThreadContextValue>(() => {\n const useViewport = makeThreadViewportStore();\n\n return {\n useThread,\n useThreadRuntime,\n useComposer: useThreadComposer,\n useViewport,\n };\n }, [useThread, useThreadRuntime, useThreadComposer]);\n\n return (\n <ThreadContext.Provider value={context}>{children}</ThreadContext.Provider>\n );\n};\n"],"mappings":";AACA,SAAS,WAAW,SAAS,gBAAgB;AAE7C,SAAS,qBAAqB;AAC9B,SAAS,+BAA+B;AACxC,SAAS,qBAAqB;AAE9B,SAAS,cAAc;AA6DnB;AAtDJ,IAAM,wBAAwB,CAAC,YAA2B;AACxD,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,OAAO,CAAC;AAEpD,YAAU,MAAM;AACd,kBAAc,KAAK,EAAE,SAAS,SAAS,IAAI;AAAA,EAC7C,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,iBAAiB,CAAC,YAA2B;AACjD,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,QAAQ,SAAS,CAAC,CAAC;AAC/D,YAAU,MAAM;AACd,UAAM,cAAc,MAClB,cAAc,KAAK,EAAE,SAAS,QAAQ,SAAS,GAAG,IAAI;AACxD,gBAAY;AACZ,WAAO,QAAQ,UAAU,WAAW;AAAA,EACtC,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEA,IAAM,yBAAyB,CAAC,YAAmC;AACjE,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,MAAM,QAAQ,SAAS,CAAC,CAAC;AAE/D,YAAU,MAAM;AACd,UAAM,cAAc,MAClB,cAAc,KAAK,EAAE,SAAS,QAAQ,SAAS,GAAG,IAAI;AACxD,gBAAY;AACZ,WAAO,QAAQ,UAAU,WAAW;AAAA,EACtC,GAAG,CAAC,SAAS,KAAK,CAAC;AAEnB,SAAO;AACT;AAEO,IAAM,wBAET,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC7B,QAAM,mBAAmB,sBAAsB,OAAO;AACtD,QAAM,YAAY,eAAe,OAAO;AACxC,QAAM,oBAAoB,uBAAuB,QAAQ,QAAQ;AAEjE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