@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
@@ -29,9 +29,6 @@ var import_LazyMemoizeSubject = require("./subscribable/LazyMemoizeSubject.cjs")
29
29
  var import_AttachmentRuntime = require("./AttachmentRuntime.cjs");
30
30
  var import_ShallowMemoizeSubject = require("./subscribable/ShallowMemoizeSubject.cjs");
31
31
  var import_SKIP_UPDATE = require("./subscribable/SKIP_UPDATE.cjs");
32
- var METHOD_NOT_SUPPORTED = () => {
33
- throw new Error("Composer is not available");
34
- };
35
32
  var EMPTY_ARRAY = Object.freeze([]);
36
33
  var getThreadComposerState = (runtime) => {
37
34
  return Object.freeze({
@@ -42,18 +39,10 @@ var getThreadComposerState = (runtime) => {
42
39
  text: runtime?.text ?? "",
43
40
  attachments: runtime?.attachments ?? EMPTY_ARRAY,
44
41
  role: runtime?.role ?? "user",
45
- value: runtime?.text ?? "",
46
- setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
47
- setText: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
48
- // edit: beginEdit,
49
- send: runtime?.send.bind(runtime) ?? METHOD_NOT_SUPPORTED,
50
- cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED,
51
- reset: runtime?.reset.bind(runtime) ?? METHOD_NOT_SUPPORTED,
52
- addAttachment: runtime?.addAttachment.bind(runtime) ?? METHOD_NOT_SUPPORTED,
53
- removeAttachment: runtime?.removeAttachment.bind(runtime) ?? METHOD_NOT_SUPPORTED
42
+ value: runtime?.text ?? ""
54
43
  });
55
44
  };
56
- var getEditComposerState = (runtime, beginEdit) => {
45
+ var getEditComposerState = (runtime) => {
57
46
  return Object.freeze({
58
47
  type: "edit",
59
48
  isEditing: runtime?.isEditing ?? false,
@@ -62,12 +51,7 @@ var getEditComposerState = (runtime, beginEdit) => {
62
51
  text: runtime?.text ?? "",
63
52
  attachments: runtime?.attachments ?? EMPTY_ARRAY,
64
53
  role: runtime?.role ?? "user",
65
- value: runtime?.text ?? "",
66
- setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
67
- setText: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
68
- edit: beginEdit,
69
- send: runtime?.send.bind(runtime) ?? METHOD_NOT_SUPPORTED,
70
- cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED
54
+ value: runtime?.text ?? ""
71
55
  });
72
56
  };
73
57
  var ComposerRuntimeImpl = class {
@@ -77,48 +61,6 @@ var ComposerRuntimeImpl = class {
77
61
  get path() {
78
62
  return this._core.path;
79
63
  }
80
- /**
81
- * @deprecated Use `getState().isEditing` instead. This will be removed in 0.6.0.
82
- */
83
- get isEditing() {
84
- return this.getState().isEditing;
85
- }
86
- /**
87
- * @deprecated Use `getState().isEmpty` instead. This will be removed in 0.6.0.
88
- */
89
- get isEmpty() {
90
- return this.getState().isEmpty;
91
- }
92
- /**
93
- * @deprecated Use `getState().canCancel` instead. This will be removed in 0.6.0.
94
- */
95
- get canCancel() {
96
- return this.getState().canCancel;
97
- }
98
- /**
99
- * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.
100
- */
101
- get text() {
102
- return this.getState().text;
103
- }
104
- /**
105
- * @deprecated Use `getState().role` instead. This will be removed in 0.6.0.
106
- */
107
- get role() {
108
- return this.getState().role;
109
- }
110
- /**
111
- * @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.
112
- */
113
- get attachments() {
114
- return this.getState().attachments;
115
- }
116
- /**
117
- * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.
118
- */
119
- get value() {
120
- return this.text;
121
- }
122
64
  setText(text) {
123
65
  const core = this._core.getState();
124
66
  if (!core) throw new Error("Composer is not available");
@@ -132,17 +74,6 @@ var ComposerRuntimeImpl = class {
132
74
  if (!core) throw new Error("Composer is not available");
133
75
  return core.addAttachment(file);
134
76
  }
135
- /**
136
- * @deprecated Use `getAttachmentById(id).removeAttachment()` instead. This will be removed in 0.6.0.
137
- */
138
- removeAttachment(attachmentId) {
139
- const core = this._core.getState();
140
- if (!core) throw new Error("Composer is not available");
141
- return core.removeAttachment(attachmentId);
142
- }
143
- /**
144
- * @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.
145
- */
146
77
  reset() {
147
78
  const core = this._core.getState();
148
79
  if (!core) throw new Error("Composer is not available");
@@ -193,9 +124,6 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
193
124
  });
194
125
  this._getState = stateBinding.getState.bind(stateBinding);
195
126
  }
196
- get attachments() {
197
- return this.getState()?.attachments ?? EMPTY_ARRAY;
198
- }
199
127
  getState() {
200
128
  return this._getState();
201
129
  }
@@ -214,7 +142,6 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
214
142
  if (!attachment) return import_SKIP_UPDATE.SKIP_UPDATE;
215
143
  return {
216
144
  ...attachment,
217
- attachment,
218
145
  source: "thread-composer"
219
146
  };
220
147
  },
@@ -228,7 +155,7 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
228
155
  constructor(core, _beginEdit) {
229
156
  const stateBinding = new import_LazyMemoizeSubject.LazyMemoizeSubject({
230
157
  path: core.path,
231
- getState: () => getEditComposerState(core.getState(), this._beginEdit),
158
+ getState: () => getEditComposerState(core.getState()),
232
159
  subscribe: (callback) => core.subscribe(callback)
233
160
  });
234
161
  super({
@@ -252,12 +179,6 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
252
179
  beginEdit() {
253
180
  this._beginEdit();
254
181
  }
255
- /**
256
- * @deprecated Use `beginEdit()` instead. This will be removed in 0.6.0.
257
- */
258
- edit() {
259
- this.beginEdit();
260
- }
261
182
  getAttachmentByIndex(idx) {
262
183
  return new import_AttachmentRuntime.EditComposerAttachmentRuntimeImpl(
263
184
  new import_ShallowMemoizeSubject.ShallowMemoizeSubject({
@@ -273,7 +194,6 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
273
194
  if (!attachment) return import_SKIP_UPDATE.SKIP_UPDATE;
274
195
  return {
275
196
  ...attachment,
276
- attachment,
277
197
  source: "edit-composer"
278
198
  };
279
199
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/ComposerRuntime.ts"],"sourcesContent":["import { Attachment, PendingAttachment } from \"../types/AttachmentTypes\";\nimport {\n ComposerRuntimeCore,\n ThreadComposerRuntimeCore,\n} from \"../runtimes/core/ComposerRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n EditComposerAttachmentRuntimeImpl,\n ThreadComposerAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ComposerRuntimePath } from \"./RuntimePathTypes\";\nimport { MessageRole } from \"../types/AssistantTypes\";\n\nexport type ThreadComposerRuntimeCoreBinding = SubscribableWithState<\n ThreadComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"thread\" }\n>;\n\nexport type EditComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"edit\" }\n>;\n\nexport type ComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath\n>;\n\ntype LegacyEditComposerState = Readonly<{\n type: \"edit\";\n\n /** @deprecated Use `text` instead. This will be removed in 0.6.0. */\n value: string;\n /** @deprecated Use `useComposerRuntime().setText()` instead. This will be removed in 0.6.0. */\n setValue: (value: string) => void;\n\n text: string;\n /**\n * @deprecated Use `useComposerRuntime().setText()` instead. This will be removed in 0.6.0.\n */\n setText: (value: string) => void;\n\n canCancel: boolean;\n isEditing: boolean;\n isEmpty: boolean;\n\n /**\n * @deprecated Use useComposerRuntime().beginEdit() instead. This will be removed in 0.6.0.\n */\n edit: () => void;\n /**\n * @deprecated Use `useComposerRuntime().send()` instead. This will be removed in 0.6.0.\n */\n send: () => void;\n /**\n * @deprecated Use `useComposerRuntime().cancel()` instead. This will be removed in 0.6.0.\n */\n cancel: () => void;\n}>;\n\ntype LegacyThreadComposerState = Readonly<{\n type: \"thread\";\n\n /** @deprecated Use `text` instead. This will be removed in 0.6.0. */\n value: string;\n /** @deprecated Use `useComposerRuntime().setText` instead. This will be removed in 0.6.0. */\n setValue: (value: string) => void;\n\n attachments: readonly Attachment[];\n\n /** @deprecated Use `useComposerRuntime().addAttachment` instead. This will be removed in 0.6.0. */\n addAttachment: (file: File) => Promise<void>;\n /** @deprecated Use `useComposerRuntime().removeAttachment` instead. This will be removed in 0.6.0. */\n removeAttachment: (attachmentId: string) => Promise<void>;\n\n text: string;\n /** @deprecated Use `useComposerRuntime().setText` instead. This will be removed in 0.6.0. */\n setText: (value: string) => void;\n\n /** @deprecated Use `useComposerRuntime().reset` instead. This will be removed in 0.6.0. */\n reset: () => void;\n\n canCancel: boolean;\n isEditing: boolean;\n isEmpty: boolean;\n\n /**\n * @deprecated Use `useComposerRuntime().send` instead. This will be removed in 0.6.0.\n **/\n send: () => void;\n /** @deprecated Use `useComposerRuntime().cancel` instead. This will be removed in 0.6.0. */\n cancel: () => void;\n}>;\n\ntype BaseComposerState = {\n text: string;\n role: MessageRole;\n attachments: readonly Attachment[];\n\n canCancel: boolean;\n isEditing: boolean;\n isEmpty: boolean;\n};\n\nexport type ThreadComposerState = LegacyThreadComposerState &\n BaseComposerState & {\n type: \"thread\";\n\n attachments: readonly PendingAttachment[];\n };\n\nexport type EditComposerState = LegacyEditComposerState &\n BaseComposerState & {\n type: \"edit\";\n };\n\nexport type ComposerState = ThreadComposerState | EditComposerState;\n\nconst METHOD_NOT_SUPPORTED = () => {\n throw new Error(\"Composer is not available\");\n};\nconst EMPTY_ARRAY = Object.freeze([]);\nconst getThreadComposerState = (\n runtime: ThreadComposerRuntimeCore | undefined,\n): ThreadComposerState => {\n return Object.freeze({\n type: \"thread\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n text: runtime?.text ?? \"\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n role: runtime?.role ?? \"user\",\n\n value: runtime?.text ?? \"\",\n setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n setText: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n // edit: beginEdit,\n send: runtime?.send.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n reset: runtime?.reset.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n\n addAttachment: runtime?.addAttachment.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n removeAttachment:\n runtime?.removeAttachment.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n });\n};\n\nconst getEditComposerState = (\n runtime: ComposerRuntimeCore | undefined,\n beginEdit: () => void,\n): EditComposerState => {\n return Object.freeze({\n type: \"edit\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n text: runtime?.text ?? \"\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n role: runtime?.role ?? \"user\",\n\n value: runtime?.text ?? \"\",\n setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n setText: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n edit: beginEdit,\n send: runtime?.send.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n });\n};\n\nexport type ComposerRuntime = {\n path: ComposerRuntimePath;\n readonly type: \"edit\" | \"thread\";\n getState(): ComposerState;\n\n /** @deprecated Use `getState().isEditing` instead. This will be removed in 0.6.0. */\n readonly isEditing: boolean;\n\n /** @deprecated Use `getState().isEmpty` instead. This will be removed in 0.6.0. */\n readonly isEmpty: boolean;\n\n /** @deprecated Use `getState().canCancel` instead. This will be removed in 0.6.0. */\n readonly canCancel: boolean;\n\n /** @deprecated Use `getState().text` instead. This will be removed in 0.6.0. */\n readonly text: string;\n\n /** @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0. */\n readonly attachments: readonly Attachment[];\n\n /** @deprecated Use `getState().text` instead. This will be removed in 0.6.0. */\n readonly value: string;\n\n setText(text: string): void;\n setValue(text: string): void;\n\n getAttachmentAccept(): string;\n addAttachment(file: File): Promise<void>;\n\n /** @deprecated Use `getAttachmentById(id).removeAttachment()` instead. This will be removed in 0.6.0. */\n removeAttachment(attachmentId: string): Promise<void>;\n\n /** @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality. */\n reset(): void;\n\n send(): void;\n cancel(): void;\n subscribe(callback: () => void): Unsubscribe;\n getAttachmentByIndex(idx: number): AttachmentRuntime;\n};\n\nexport abstract class ComposerRuntimeImpl\n implements ComposerRuntimeCore, ComposerRuntime\n{\n public get path() {\n return this._core.path;\n }\n\n public abstract get type(): \"edit\" | \"thread\";\n\n constructor(protected _core: ComposerRuntimeCoreBinding) {}\n\n /**\n * @deprecated Use `getState().isEditing` instead. This will be removed in 0.6.0.\n */\n public get isEditing() {\n return this.getState().isEditing;\n }\n\n /**\n * @deprecated Use `getState().isEmpty` instead. This will be removed in 0.6.0.\n */\n public get isEmpty() {\n return this.getState().isEmpty;\n }\n\n /**\n * @deprecated Use `getState().canCancel` instead. This will be removed in 0.6.0.\n */\n public get canCancel() {\n return this.getState().canCancel;\n }\n\n /**\n * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.\n */\n public get text() {\n return this.getState().text;\n }\n\n /**\n * @deprecated Use `getState().role` instead. This will be removed in 0.6.0.\n */\n public get role() {\n return this.getState().role;\n }\n\n /**\n * @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.\n */\n public get attachments() {\n return this.getState().attachments;\n }\n\n /**\n * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.\n */\n public get value() {\n return this.text;\n }\n\n public abstract getState(): ComposerState;\n\n public setText(text: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setText(text);\n }\n\n public setValue(text: string) {\n this.setText(text);\n }\n\n public addAttachment(file: File) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.addAttachment(file);\n }\n\n /**\n * @deprecated Use `getAttachmentById(id).removeAttachment()` instead. This will be removed in 0.6.0.\n */\n public removeAttachment(attachmentId: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.removeAttachment(attachmentId);\n }\n\n /**\n * @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.\n */\n public reset() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.reset();\n }\n\n public send() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.send();\n }\n\n public cancel() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.cancel();\n }\n\n public setRole(role: MessageRole) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRole(role);\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getAttachmentAccept(): string {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.getAttachmentAccept();\n }\n\n public abstract getAttachmentByIndex(idx: number): AttachmentRuntime;\n}\n\nexport type ThreadComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"thread\" };\n readonly type: \"thread\";\n getState(): ThreadComposerState;\n\n /**\n * @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.\n */\n attachments: readonly PendingAttachment[];\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"thread-composer\" };\n};\n\nexport class ThreadComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements ThreadComposerRuntime, ThreadComposerState\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & {\n composerSource: \"thread\";\n };\n }\n\n public get type() {\n return \"thread\" as const;\n }\n\n private _getState;\n\n constructor(core: ThreadComposerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getThreadComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override get attachments() {\n return this.getState()?.attachments ?? EMPTY_ARRAY;\n }\n\n public override getState(): ThreadComposerState {\n return this._getState();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new ThreadComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"thread-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n attachment: attachment,\n source: \"thread-composer\",\n } satisfies AttachmentState & { source: \"thread-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n\nexport type EditComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"edit\" };\n readonly type: \"edit\";\n\n getState(): EditComposerState;\n beginEdit(): void;\n\n /**\n * @deprecated Use `beginEdit()` instead. This will be removed in 0.6.0.\n */\n edit(): void;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"edit-composer\" };\n};\n\nexport class EditComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements EditComposerRuntime, EditComposerState\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & { composerSource: \"edit\" };\n }\n\n public get type() {\n return \"edit\" as const;\n }\n\n private _getState;\n constructor(\n core: EditComposerRuntimeCoreBinding,\n private _beginEdit: () => void,\n ) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getEditComposerState(core.getState(), this._beginEdit),\n subscribe: (callback) => core.subscribe(callback),\n });\n\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override getState(): EditComposerState {\n return this._getState();\n }\n\n public beginEdit() {\n this._beginEdit();\n }\n\n /**\n * @deprecated Use `beginEdit()` instead. This will be removed in 0.6.0.\n */\n public edit() {\n this.beginEdit();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new EditComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"edit-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n attachment: attachment,\n source: \"edit-composer\",\n } satisfies AttachmentState & { source: \"edit-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,gCAAmC;AACnC,+BAKO;AACP,mCAAsC;AACtC,yBAA4B;AA6G5B,IAAM,uBAAuB,MAAM;AACjC,QAAM,IAAI,MAAM,2BAA2B;AAC7C;AACA,IAAM,cAAc,OAAO,OAAO,CAAC,CAAC;AACpC,IAAM,yBAAyB,CAC7B,YACwB;AACxB,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;AAAA,IAEN,WAAW,SAAS,aAAa;AAAA,IACjC,WAAW,SAAS,aAAa;AAAA,IACjC,SAAS,SAAS,WAAW;AAAA,IAC7B,MAAM,SAAS,QAAQ;AAAA,IACvB,aAAa,SAAS,eAAe;AAAA,IACrC,MAAM,SAAS,QAAQ;AAAA,IAEvB,OAAO,SAAS,QAAQ;AAAA,IACxB,UAAU,SAAS,QAAQ,KAAK,OAAO,KAAK;AAAA,IAC5C,SAAS,SAAS,QAAQ,KAAK,OAAO,KAAK;AAAA;AAAA,IAE3C,MAAM,SAAS,KAAK,KAAK,OAAO,KAAK;AAAA,IACrC,QAAQ,SAAS,OAAO,KAAK,OAAO,KAAK;AAAA,IACzC,OAAO,SAAS,MAAM,KAAK,OAAO,KAAK;AAAA,IAEvC,eAAe,SAAS,cAA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AG,gBAAgB,GAAG;AAAA,QAC1D;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,YAAY,GAAG;AAClC,cAAI,CAAC,WAAY,QAAO;AAExB,iBAAO;AAAA,YACL,GAAG;AAAA,YACH;AAAA,YACA,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/api/ComposerRuntime.ts"],"sourcesContent":["import { Attachment, PendingAttachment } from \"../types/AttachmentTypes\";\nimport {\n ComposerRuntimeCore,\n ThreadComposerRuntimeCore,\n} from \"../runtimes/core/ComposerRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n EditComposerAttachmentRuntimeImpl,\n ThreadComposerAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ComposerRuntimePath } from \"./RuntimePathTypes\";\nimport { MessageRole } from \"../types/AssistantTypes\";\n\nexport type ThreadComposerRuntimeCoreBinding = SubscribableWithState<\n ThreadComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"thread\" }\n>;\n\nexport type EditComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"edit\" }\n>;\n\nexport type ComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath\n>;\n\ntype BaseComposerState = {\n text: string;\n role: MessageRole;\n attachments: readonly Attachment[];\n\n canCancel: boolean;\n isEditing: boolean;\n isEmpty: boolean;\n};\n\nexport type ThreadComposerState = BaseComposerState & {\n type: \"thread\";\n\n attachments: readonly PendingAttachment[];\n};\n\nexport type EditComposerState = BaseComposerState & {\n type: \"edit\";\n};\n\nexport type ComposerState = ThreadComposerState | EditComposerState;\n\nconst EMPTY_ARRAY = Object.freeze([]);\nconst getThreadComposerState = (\n runtime: ThreadComposerRuntimeCore | undefined,\n): ThreadComposerState => {\n return Object.freeze({\n type: \"thread\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n text: runtime?.text ?? \"\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n role: runtime?.role ?? \"user\",\n\n value: runtime?.text ?? \"\",\n });\n};\n\nconst getEditComposerState = (\n runtime: ComposerRuntimeCore | undefined,\n): EditComposerState => {\n return Object.freeze({\n type: \"edit\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n text: runtime?.text ?? \"\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n role: runtime?.role ?? \"user\",\n\n value: runtime?.text ?? \"\",\n });\n};\n\nexport type ComposerRuntime = {\n path: ComposerRuntimePath;\n readonly type: \"edit\" | \"thread\";\n getState(): ComposerState;\n\n setText(text: string): void;\n setValue(text: string): void;\n\n getAttachmentAccept(): string;\n addAttachment(file: File): Promise<void>;\n\n reset(): void;\n send(): void;\n cancel(): void;\n subscribe(callback: () => void): Unsubscribe;\n getAttachmentByIndex(idx: number): AttachmentRuntime;\n};\n\nexport abstract class ComposerRuntimeImpl implements ComposerRuntime {\n public get path() {\n return this._core.path;\n }\n\n public abstract get type(): \"edit\" | \"thread\";\n\n constructor(protected _core: ComposerRuntimeCoreBinding) {}\n\n public abstract getState(): ComposerState;\n\n public setText(text: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setText(text);\n }\n\n public setValue(text: string) {\n this.setText(text);\n }\n\n public addAttachment(file: File) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.addAttachment(file);\n }\n\n public reset() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.reset();\n }\n\n public send() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.send();\n }\n\n public cancel() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.cancel();\n }\n\n public setRole(role: MessageRole) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRole(role);\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getAttachmentAccept(): string {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.getAttachmentAccept();\n }\n\n public abstract getAttachmentByIndex(idx: number): AttachmentRuntime;\n}\n\nexport type ThreadComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"thread\" };\n readonly type: \"thread\";\n getState(): ThreadComposerState;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"thread-composer\" };\n};\n\nexport class ThreadComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements ThreadComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & {\n composerSource: \"thread\";\n };\n }\n\n public get type() {\n return \"thread\" as const;\n }\n\n private _getState;\n\n constructor(core: ThreadComposerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getThreadComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override getState(): ThreadComposerState {\n return this._getState();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new ThreadComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"thread-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"thread-composer\",\n } satisfies AttachmentState & { source: \"thread-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n\nexport type EditComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"edit\" };\n readonly type: \"edit\";\n\n getState(): EditComposerState;\n beginEdit(): void;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"edit-composer\" };\n};\n\nexport class EditComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements EditComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & { composerSource: \"edit\" };\n }\n\n public get type() {\n return \"edit\" as const;\n }\n\n private _getState;\n constructor(\n core: EditComposerRuntimeCoreBinding,\n private _beginEdit: () => void,\n ) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getEditComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override getState(): EditComposerState {\n return this._getState();\n }\n\n public beginEdit() {\n this._beginEdit();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new EditComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"edit-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"edit-composer\",\n } satisfies AttachmentState & { source: \"edit-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,gCAAmC;AACnC,+BAKO;AACP,mCAAsC;AACtC,yBAA4B;AAyC5B,IAAM,cAAc,OAAO,OAAO,CAAC,CAAC;AACpC,IAAM,yBAAyB,CAC7B,YACwB;AACxB,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;AAAA,IAEN,WAAW,SAAS,aAAa;AAAA,IACjC,WAAW,SAAS,aAAa;AAAA,IACjC,SAAS,SAAS,WAAW;AAAA,IAC7B,MAAM,SAAS,QAAQ;AAAA,IACvB,aAAa,SAAS,eAAe;AAAA,IACrC,MAAM,SAAS,QAAQ;AAAA,IAEvB,OAAO,SAAS,QAAQ;AAAA,EAC1B,CAAC;AACH;AAEA,IAAM,uBAAuB,CAC3B,YACsB;AACtB,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;AAAA,IAEN,WAAW,SAAS,aAAa;AAAA,IACjC,WAAW,SAAS,aAAa;AAAA,IACjC,SAAS,SAAS,WAAW;AAAA,IAC7B,MAAM,SAAS,QAAQ;AAAA,IACvB,aAAa,SAAS,eAAe;AAAA,IACrC,MAAM,SAAS,QAAQ;AAAA,IAEvB,OAAO,SAAS,QAAQ;AAAA,EAC1B,CAAC;AACH;AAoBO,IAAe,sBAAf,MAA8D;AAAA,EAOnE,YAAsB,OAAmC;AAAnC;AAAA,EAAoC;AAAA,EAN1D,IAAW,OAAO;AAChB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAQO,QAAQ,MAAc;AAC3B,UAAM,OAAO,KAAK,MAAM,SAAS;AACjC,QAAI,CAAC,KAAM,OAAM,IAAI,MAAM,2BA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MACJ,MAAM,KAAK;AAAA,MACX,UAAU,MAAM,KAAK,SAAS;AAAA,MAC9B,WAAW,CAAC,aAAa,aAAa,UAAU,QAAQ;AAAA,IAC1D,CAAC;AAZO;AAcR,SAAK,YAAY,aAAa,SAAS,KAAK,YAAY;AAAA,EAC1D;AAAA,EA1BA,IAAoB,OAAO;AACzB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAEA,IAAW,OAAO;AAChB,WAAO;AAAA,EACT;AAAA,EAEQ;AAAA,EAoBQ,WAA8B;AAC5C,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEO,YAAY;AACjB,SAAK,WAAW;AAAA,EAClB;AAAA,EAEO,qBAAqB,KAAa;AACvC,WAAO,IAAI;AAAA,MACT,IAAI,mDAAsB;AAAA,QACxB,MAAM;AAAA,UACJ,GAAG,KAAK;AAAA,UACR,kBAAkB;AAAA,UAClB,oBAAoB,EAAE,MAAM,SAAS,OAAO,IAAI;AAAA,UAChD,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,KAAK,GAAG,gBAAgB,GAAG;AAAA,QAC1D;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,YAAY,GAAG;AAClC,cAAI,CAAC,WAAY,QAAO;AAExB,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
@@ -6,9 +6,6 @@ import {
6
6
  } from "./AttachmentRuntime.mjs";
7
7
  import { ShallowMemoizeSubject } from "./subscribable/ShallowMemoizeSubject.mjs";
8
8
  import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE.mjs";
9
- var METHOD_NOT_SUPPORTED = () => {
10
- throw new Error("Composer is not available");
11
- };
12
9
  var EMPTY_ARRAY = Object.freeze([]);
13
10
  var getThreadComposerState = (runtime) => {
14
11
  return Object.freeze({
@@ -19,18 +16,10 @@ var getThreadComposerState = (runtime) => {
19
16
  text: runtime?.text ?? "",
20
17
  attachments: runtime?.attachments ?? EMPTY_ARRAY,
21
18
  role: runtime?.role ?? "user",
22
- value: runtime?.text ?? "",
23
- setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
24
- setText: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
25
- // edit: beginEdit,
26
- send: runtime?.send.bind(runtime) ?? METHOD_NOT_SUPPORTED,
27
- cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED,
28
- reset: runtime?.reset.bind(runtime) ?? METHOD_NOT_SUPPORTED,
29
- addAttachment: runtime?.addAttachment.bind(runtime) ?? METHOD_NOT_SUPPORTED,
30
- removeAttachment: runtime?.removeAttachment.bind(runtime) ?? METHOD_NOT_SUPPORTED
19
+ value: runtime?.text ?? ""
31
20
  });
32
21
  };
33
- var getEditComposerState = (runtime, beginEdit) => {
22
+ var getEditComposerState = (runtime) => {
34
23
  return Object.freeze({
35
24
  type: "edit",
36
25
  isEditing: runtime?.isEditing ?? false,
@@ -39,12 +28,7 @@ var getEditComposerState = (runtime, beginEdit) => {
39
28
  text: runtime?.text ?? "",
40
29
  attachments: runtime?.attachments ?? EMPTY_ARRAY,
41
30
  role: runtime?.role ?? "user",
42
- value: runtime?.text ?? "",
43
- setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
44
- setText: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,
45
- edit: beginEdit,
46
- send: runtime?.send.bind(runtime) ?? METHOD_NOT_SUPPORTED,
47
- cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED
31
+ value: runtime?.text ?? ""
48
32
  });
49
33
  };
50
34
  var ComposerRuntimeImpl = class {
@@ -54,48 +38,6 @@ var ComposerRuntimeImpl = class {
54
38
  get path() {
55
39
  return this._core.path;
56
40
  }
57
- /**
58
- * @deprecated Use `getState().isEditing` instead. This will be removed in 0.6.0.
59
- */
60
- get isEditing() {
61
- return this.getState().isEditing;
62
- }
63
- /**
64
- * @deprecated Use `getState().isEmpty` instead. This will be removed in 0.6.0.
65
- */
66
- get isEmpty() {
67
- return this.getState().isEmpty;
68
- }
69
- /**
70
- * @deprecated Use `getState().canCancel` instead. This will be removed in 0.6.0.
71
- */
72
- get canCancel() {
73
- return this.getState().canCancel;
74
- }
75
- /**
76
- * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.
77
- */
78
- get text() {
79
- return this.getState().text;
80
- }
81
- /**
82
- * @deprecated Use `getState().role` instead. This will be removed in 0.6.0.
83
- */
84
- get role() {
85
- return this.getState().role;
86
- }
87
- /**
88
- * @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.
89
- */
90
- get attachments() {
91
- return this.getState().attachments;
92
- }
93
- /**
94
- * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.
95
- */
96
- get value() {
97
- return this.text;
98
- }
99
41
  setText(text) {
100
42
  const core = this._core.getState();
101
43
  if (!core) throw new Error("Composer is not available");
@@ -109,17 +51,6 @@ var ComposerRuntimeImpl = class {
109
51
  if (!core) throw new Error("Composer is not available");
110
52
  return core.addAttachment(file);
111
53
  }
112
- /**
113
- * @deprecated Use `getAttachmentById(id).removeAttachment()` instead. This will be removed in 0.6.0.
114
- */
115
- removeAttachment(attachmentId) {
116
- const core = this._core.getState();
117
- if (!core) throw new Error("Composer is not available");
118
- return core.removeAttachment(attachmentId);
119
- }
120
- /**
121
- * @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.
122
- */
123
54
  reset() {
124
55
  const core = this._core.getState();
125
56
  if (!core) throw new Error("Composer is not available");
@@ -170,9 +101,6 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
170
101
  });
171
102
  this._getState = stateBinding.getState.bind(stateBinding);
172
103
  }
173
- get attachments() {
174
- return this.getState()?.attachments ?? EMPTY_ARRAY;
175
- }
176
104
  getState() {
177
105
  return this._getState();
178
106
  }
@@ -191,7 +119,6 @@ var ThreadComposerRuntimeImpl = class extends ComposerRuntimeImpl {
191
119
  if (!attachment) return SKIP_UPDATE;
192
120
  return {
193
121
  ...attachment,
194
- attachment,
195
122
  source: "thread-composer"
196
123
  };
197
124
  },
@@ -205,7 +132,7 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
205
132
  constructor(core, _beginEdit) {
206
133
  const stateBinding = new LazyMemoizeSubject({
207
134
  path: core.path,
208
- getState: () => getEditComposerState(core.getState(), this._beginEdit),
135
+ getState: () => getEditComposerState(core.getState()),
209
136
  subscribe: (callback) => core.subscribe(callback)
210
137
  });
211
138
  super({
@@ -229,12 +156,6 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
229
156
  beginEdit() {
230
157
  this._beginEdit();
231
158
  }
232
- /**
233
- * @deprecated Use `beginEdit()` instead. This will be removed in 0.6.0.
234
- */
235
- edit() {
236
- this.beginEdit();
237
- }
238
159
  getAttachmentByIndex(idx) {
239
160
  return new EditComposerAttachmentRuntimeImpl(
240
161
  new ShallowMemoizeSubject({
@@ -250,7 +171,6 @@ var EditComposerRuntimeImpl = class extends ComposerRuntimeImpl {
250
171
  if (!attachment) return SKIP_UPDATE;
251
172
  return {
252
173
  ...attachment,
253
- attachment,
254
174
  source: "edit-composer"
255
175
  };
256
176
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/ComposerRuntime.ts"],"sourcesContent":["import { Attachment, PendingAttachment } from \"../types/AttachmentTypes\";\nimport {\n ComposerRuntimeCore,\n ThreadComposerRuntimeCore,\n} from \"../runtimes/core/ComposerRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n EditComposerAttachmentRuntimeImpl,\n ThreadComposerAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ComposerRuntimePath } from \"./RuntimePathTypes\";\nimport { MessageRole } from \"../types/AssistantTypes\";\n\nexport type ThreadComposerRuntimeCoreBinding = SubscribableWithState<\n ThreadComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"thread\" }\n>;\n\nexport type EditComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"edit\" }\n>;\n\nexport type ComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath\n>;\n\ntype LegacyEditComposerState = Readonly<{\n type: \"edit\";\n\n /** @deprecated Use `text` instead. This will be removed in 0.6.0. */\n value: string;\n /** @deprecated Use `useComposerRuntime().setText()` instead. This will be removed in 0.6.0. */\n setValue: (value: string) => void;\n\n text: string;\n /**\n * @deprecated Use `useComposerRuntime().setText()` instead. This will be removed in 0.6.0.\n */\n setText: (value: string) => void;\n\n canCancel: boolean;\n isEditing: boolean;\n isEmpty: boolean;\n\n /**\n * @deprecated Use useComposerRuntime().beginEdit() instead. This will be removed in 0.6.0.\n */\n edit: () => void;\n /**\n * @deprecated Use `useComposerRuntime().send()` instead. This will be removed in 0.6.0.\n */\n send: () => void;\n /**\n * @deprecated Use `useComposerRuntime().cancel()` instead. This will be removed in 0.6.0.\n */\n cancel: () => void;\n}>;\n\ntype LegacyThreadComposerState = Readonly<{\n type: \"thread\";\n\n /** @deprecated Use `text` instead. This will be removed in 0.6.0. */\n value: string;\n /** @deprecated Use `useComposerRuntime().setText` instead. This will be removed in 0.6.0. */\n setValue: (value: string) => void;\n\n attachments: readonly Attachment[];\n\n /** @deprecated Use `useComposerRuntime().addAttachment` instead. This will be removed in 0.6.0. */\n addAttachment: (file: File) => Promise<void>;\n /** @deprecated Use `useComposerRuntime().removeAttachment` instead. This will be removed in 0.6.0. */\n removeAttachment: (attachmentId: string) => Promise<void>;\n\n text: string;\n /** @deprecated Use `useComposerRuntime().setText` instead. This will be removed in 0.6.0. */\n setText: (value: string) => void;\n\n /** @deprecated Use `useComposerRuntime().reset` instead. This will be removed in 0.6.0. */\n reset: () => void;\n\n canCancel: boolean;\n isEditing: boolean;\n isEmpty: boolean;\n\n /**\n * @deprecated Use `useComposerRuntime().send` instead. This will be removed in 0.6.0.\n **/\n send: () => void;\n /** @deprecated Use `useComposerRuntime().cancel` instead. This will be removed in 0.6.0. */\n cancel: () => void;\n}>;\n\ntype BaseComposerState = {\n text: string;\n role: MessageRole;\n attachments: readonly Attachment[];\n\n canCancel: boolean;\n isEditing: boolean;\n isEmpty: boolean;\n};\n\nexport type ThreadComposerState = LegacyThreadComposerState &\n BaseComposerState & {\n type: \"thread\";\n\n attachments: readonly PendingAttachment[];\n };\n\nexport type EditComposerState = LegacyEditComposerState &\n BaseComposerState & {\n type: \"edit\";\n };\n\nexport type ComposerState = ThreadComposerState | EditComposerState;\n\nconst METHOD_NOT_SUPPORTED = () => {\n throw new Error(\"Composer is not available\");\n};\nconst EMPTY_ARRAY = Object.freeze([]);\nconst getThreadComposerState = (\n runtime: ThreadComposerRuntimeCore | undefined,\n): ThreadComposerState => {\n return Object.freeze({\n type: \"thread\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n text: runtime?.text ?? \"\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n role: runtime?.role ?? \"user\",\n\n value: runtime?.text ?? \"\",\n setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n setText: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n // edit: beginEdit,\n send: runtime?.send.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n reset: runtime?.reset.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n\n addAttachment: runtime?.addAttachment.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n removeAttachment:\n runtime?.removeAttachment.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n });\n};\n\nconst getEditComposerState = (\n runtime: ComposerRuntimeCore | undefined,\n beginEdit: () => void,\n): EditComposerState => {\n return Object.freeze({\n type: \"edit\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n text: runtime?.text ?? \"\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n role: runtime?.role ?? \"user\",\n\n value: runtime?.text ?? \"\",\n setValue: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n setText: runtime?.setText.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n edit: beginEdit,\n send: runtime?.send.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n cancel: runtime?.cancel.bind(runtime) ?? METHOD_NOT_SUPPORTED,\n });\n};\n\nexport type ComposerRuntime = {\n path: ComposerRuntimePath;\n readonly type: \"edit\" | \"thread\";\n getState(): ComposerState;\n\n /** @deprecated Use `getState().isEditing` instead. This will be removed in 0.6.0. */\n readonly isEditing: boolean;\n\n /** @deprecated Use `getState().isEmpty` instead. This will be removed in 0.6.0. */\n readonly isEmpty: boolean;\n\n /** @deprecated Use `getState().canCancel` instead. This will be removed in 0.6.0. */\n readonly canCancel: boolean;\n\n /** @deprecated Use `getState().text` instead. This will be removed in 0.6.0. */\n readonly text: string;\n\n /** @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0. */\n readonly attachments: readonly Attachment[];\n\n /** @deprecated Use `getState().text` instead. This will be removed in 0.6.0. */\n readonly value: string;\n\n setText(text: string): void;\n setValue(text: string): void;\n\n getAttachmentAccept(): string;\n addAttachment(file: File): Promise<void>;\n\n /** @deprecated Use `getAttachmentById(id).removeAttachment()` instead. This will be removed in 0.6.0. */\n removeAttachment(attachmentId: string): Promise<void>;\n\n /** @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality. */\n reset(): void;\n\n send(): void;\n cancel(): void;\n subscribe(callback: () => void): Unsubscribe;\n getAttachmentByIndex(idx: number): AttachmentRuntime;\n};\n\nexport abstract class ComposerRuntimeImpl\n implements ComposerRuntimeCore, ComposerRuntime\n{\n public get path() {\n return this._core.path;\n }\n\n public abstract get type(): \"edit\" | \"thread\";\n\n constructor(protected _core: ComposerRuntimeCoreBinding) {}\n\n /**\n * @deprecated Use `getState().isEditing` instead. This will be removed in 0.6.0.\n */\n public get isEditing() {\n return this.getState().isEditing;\n }\n\n /**\n * @deprecated Use `getState().isEmpty` instead. This will be removed in 0.6.0.\n */\n public get isEmpty() {\n return this.getState().isEmpty;\n }\n\n /**\n * @deprecated Use `getState().canCancel` instead. This will be removed in 0.6.0.\n */\n public get canCancel() {\n return this.getState().canCancel;\n }\n\n /**\n * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.\n */\n public get text() {\n return this.getState().text;\n }\n\n /**\n * @deprecated Use `getState().role` instead. This will be removed in 0.6.0.\n */\n public get role() {\n return this.getState().role;\n }\n\n /**\n * @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.\n */\n public get attachments() {\n return this.getState().attachments;\n }\n\n /**\n * @deprecated Use `getState().text` instead. This will be removed in 0.6.0.\n */\n public get value() {\n return this.text;\n }\n\n public abstract getState(): ComposerState;\n\n public setText(text: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setText(text);\n }\n\n public setValue(text: string) {\n this.setText(text);\n }\n\n public addAttachment(file: File) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.addAttachment(file);\n }\n\n /**\n * @deprecated Use `getAttachmentById(id).removeAttachment()` instead. This will be removed in 0.6.0.\n */\n public removeAttachment(attachmentId: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.removeAttachment(attachmentId);\n }\n\n /**\n * @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.\n */\n public reset() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.reset();\n }\n\n public send() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.send();\n }\n\n public cancel() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.cancel();\n }\n\n public setRole(role: MessageRole) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRole(role);\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getAttachmentAccept(): string {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.getAttachmentAccept();\n }\n\n public abstract getAttachmentByIndex(idx: number): AttachmentRuntime;\n}\n\nexport type ThreadComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"thread\" };\n readonly type: \"thread\";\n getState(): ThreadComposerState;\n\n /**\n * @deprecated Use `getState().attachments` instead. This will be removed in 0.6.0.\n */\n attachments: readonly PendingAttachment[];\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"thread-composer\" };\n};\n\nexport class ThreadComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements ThreadComposerRuntime, ThreadComposerState\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & {\n composerSource: \"thread\";\n };\n }\n\n public get type() {\n return \"thread\" as const;\n }\n\n private _getState;\n\n constructor(core: ThreadComposerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getThreadComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override get attachments() {\n return this.getState()?.attachments ?? EMPTY_ARRAY;\n }\n\n public override getState(): ThreadComposerState {\n return this._getState();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new ThreadComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"thread-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n attachment: attachment,\n source: \"thread-composer\",\n } satisfies AttachmentState & { source: \"thread-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n\nexport type EditComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"edit\" };\n readonly type: \"edit\";\n\n getState(): EditComposerState;\n beginEdit(): void;\n\n /**\n * @deprecated Use `beginEdit()` instead. This will be removed in 0.6.0.\n */\n edit(): void;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"edit-composer\" };\n};\n\nexport class EditComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements EditComposerRuntime, EditComposerState\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & { composerSource: \"edit\" };\n }\n\n public get type() {\n return \"edit\" as const;\n }\n\n private _getState;\n constructor(\n core: EditComposerRuntimeCoreBinding,\n private _beginEdit: () => void,\n ) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getEditComposerState(core.getState(), this._beginEdit),\n subscribe: (callback) => core.subscribe(callback),\n });\n\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override getState(): EditComposerState {\n return this._getState();\n }\n\n public beginEdit() {\n this._beginEdit();\n }\n\n /**\n * @deprecated Use `beginEdit()` instead. This will be removed in 0.6.0.\n */\n public edit() {\n this.beginEdit();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new EditComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"edit-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n attachment: attachment,\n source: \"edit-composer\",\n } satisfies AttachmentState & { source: \"edit-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n"],"mappings":";AAOA,SAAS,0BAA0B;AACnC;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AA6G5B,IAAM,uBAAuB,MAAM;AACjC,QAAM,IAAI,MAAM,2BAA2B;AAC7C;AACA,IAAM,cAAc,OAAO,OAAO,CAAC,CAAC;AACpC,IAAM,yBAAyB,CAC7B,YACwB;AACxB,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;AAAA,IAEN,WAAW,SAAS,aAAa;AAAA,IACjC,WAAW,SAAS,aAAa;AAAA,IACjC,SAAS,SAAS,WAAW;AAAA,IAC7B,MAAM,SAAS,QAAQ;AAAA,IACvB,aAAa,SAAS,eAAe;AAAA,IACrC,MAAM,SAAS,QAAQ;AAAA,IAEvB,OAAO,SAAS,QAAQ;AAAA,IACxB,UAAU,SAAS,QAAQ,KAAK,OAAO,KAAK;AAAA,IAC5C,SAAS,SAAS,QAAQ,KAAK,OAAO,KAAK;AAAA;AAAA,IAE3C,MAAM,SAAS,KAAK,KAAK,OAAO,KAAK;AAAA,IACrC,QAAQ,SAAS,OAAO,KAAK,OAAO,KAAK;AAAA,IACzC,OAAO,SAAS,MAAM,KAAK,OAAO,KAAK;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K,MAAM,GAAG,KAAK,KAAK,GAAG,gBAAgB,GAAG;AAAA,QAC1D;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,YAAY,GAAG;AAClC,cAAI,CAAC,WAAY,QAAO;AAExB,iBAAO;AAAA,YACL,GAAG;AAAA,YACH;AAAA,YACA,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/api/ComposerRuntime.ts"],"sourcesContent":["import { Attachment, PendingAttachment } from \"../types/AttachmentTypes\";\nimport {\n ComposerRuntimeCore,\n ThreadComposerRuntimeCore,\n} from \"../runtimes/core/ComposerRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n EditComposerAttachmentRuntimeImpl,\n ThreadComposerAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ComposerRuntimePath } from \"./RuntimePathTypes\";\nimport { MessageRole } from \"../types/AssistantTypes\";\n\nexport type ThreadComposerRuntimeCoreBinding = SubscribableWithState<\n ThreadComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"thread\" }\n>;\n\nexport type EditComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath & { composerSource: \"edit\" }\n>;\n\nexport type ComposerRuntimeCoreBinding = SubscribableWithState<\n ComposerRuntimeCore | undefined,\n ComposerRuntimePath\n>;\n\ntype BaseComposerState = {\n text: string;\n role: MessageRole;\n attachments: readonly Attachment[];\n\n canCancel: boolean;\n isEditing: boolean;\n isEmpty: boolean;\n};\n\nexport type ThreadComposerState = BaseComposerState & {\n type: \"thread\";\n\n attachments: readonly PendingAttachment[];\n};\n\nexport type EditComposerState = BaseComposerState & {\n type: \"edit\";\n};\n\nexport type ComposerState = ThreadComposerState | EditComposerState;\n\nconst EMPTY_ARRAY = Object.freeze([]);\nconst getThreadComposerState = (\n runtime: ThreadComposerRuntimeCore | undefined,\n): ThreadComposerState => {\n return Object.freeze({\n type: \"thread\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n text: runtime?.text ?? \"\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n role: runtime?.role ?? \"user\",\n\n value: runtime?.text ?? \"\",\n });\n};\n\nconst getEditComposerState = (\n runtime: ComposerRuntimeCore | undefined,\n): EditComposerState => {\n return Object.freeze({\n type: \"edit\",\n\n isEditing: runtime?.isEditing ?? false,\n canCancel: runtime?.canCancel ?? false,\n isEmpty: runtime?.isEmpty ?? true,\n text: runtime?.text ?? \"\",\n attachments: runtime?.attachments ?? EMPTY_ARRAY,\n role: runtime?.role ?? \"user\",\n\n value: runtime?.text ?? \"\",\n });\n};\n\nexport type ComposerRuntime = {\n path: ComposerRuntimePath;\n readonly type: \"edit\" | \"thread\";\n getState(): ComposerState;\n\n setText(text: string): void;\n setValue(text: string): void;\n\n getAttachmentAccept(): string;\n addAttachment(file: File): Promise<void>;\n\n reset(): void;\n send(): void;\n cancel(): void;\n subscribe(callback: () => void): Unsubscribe;\n getAttachmentByIndex(idx: number): AttachmentRuntime;\n};\n\nexport abstract class ComposerRuntimeImpl implements ComposerRuntime {\n public get path() {\n return this._core.path;\n }\n\n public abstract get type(): \"edit\" | \"thread\";\n\n constructor(protected _core: ComposerRuntimeCoreBinding) {}\n\n public abstract getState(): ComposerState;\n\n public setText(text: string) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setText(text);\n }\n\n public setValue(text: string) {\n this.setText(text);\n }\n\n public addAttachment(file: File) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.addAttachment(file);\n }\n\n public reset() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.reset();\n }\n\n public send() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.send();\n }\n\n public cancel() {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.cancel();\n }\n\n public setRole(role: MessageRole) {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n core.setRole(role);\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getAttachmentAccept(): string {\n const core = this._core.getState();\n if (!core) throw new Error(\"Composer is not available\");\n return core.getAttachmentAccept();\n }\n\n public abstract getAttachmentByIndex(idx: number): AttachmentRuntime;\n}\n\nexport type ThreadComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"thread\" };\n readonly type: \"thread\";\n getState(): ThreadComposerState;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"thread-composer\" };\n};\n\nexport class ThreadComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements ThreadComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & {\n composerSource: \"thread\";\n };\n }\n\n public get type() {\n return \"thread\" as const;\n }\n\n private _getState;\n\n constructor(core: ThreadComposerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getThreadComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override getState(): ThreadComposerState {\n return this._getState();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new ThreadComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"thread-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"thread-composer\",\n } satisfies AttachmentState & { source: \"thread-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n\nexport type EditComposerRuntime = Omit<\n ComposerRuntime,\n \"getState\" | \"getAttachmentByIndex\"\n> & {\n readonly path: ComposerRuntimePath & { composerSource: \"edit\" };\n readonly type: \"edit\";\n\n getState(): EditComposerState;\n beginEdit(): void;\n\n getAttachmentByIndex(\n idx: number,\n ): AttachmentRuntime & { source: \"edit-composer\" };\n};\n\nexport class EditComposerRuntimeImpl\n extends ComposerRuntimeImpl\n implements EditComposerRuntime\n{\n public override get path() {\n return this._core.path as ComposerRuntimePath & { composerSource: \"edit\" };\n }\n\n public get type() {\n return \"edit\" as const;\n }\n\n private _getState;\n constructor(\n core: EditComposerRuntimeCoreBinding,\n private _beginEdit: () => void,\n ) {\n const stateBinding = new LazyMemoizeSubject({\n path: core.path,\n getState: () => getEditComposerState(core.getState()),\n subscribe: (callback) => core.subscribe(callback),\n });\n\n super({\n path: core.path,\n getState: () => core.getState(),\n subscribe: (callback) => stateBinding.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public override getState(): EditComposerState {\n return this._getState();\n }\n\n public beginEdit() {\n this._beginEdit();\n }\n\n public getAttachmentByIndex(idx: number) {\n return new EditComposerAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n attachmentSource: \"edit-composer\",\n attachmentSelector: { type: \"index\", index: idx },\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n },\n getState: () => {\n const attachments = this.getState().attachments;\n const attachment = attachments[idx];\n if (!attachment) return SKIP_UPDATE;\n\n return {\n ...attachment,\n source: \"edit-composer\",\n } satisfies AttachmentState & { source: \"edit-composer\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n );\n }\n}\n"],"mappings":";AAOA,SAAS,0BAA0B;AACnC;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAyC5B,IAAM,cAAc,OAAO,OAAO,CAAC,CAAC;AACpC,IAAM,yBAAyB,CAC7B,YACwB;AACxB,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;AAAA,IAEN,WAAW,SAAS,aAAa;AAAA,IACjC,WAAW,SAAS,aAAa;AAAA,IACjC,SAAS,SAAS,WAAW;AAAA,IAC7B,MAAM,SAAS,QAAQ;AAAA,IACvB,aAAa,SAAS,eAAe;AAAA,IACrC,MAAM,SAAS,QAAQ;AAAA,IAEvB,OAAO,SAAS,QAAQ;AAAA,EAC1B,CAAC;AACH;AAEA,IAAM,uBAAuB,CAC3B,YACsB;AACtB,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;AAAA,IAEN,WAAW,SAAS,aAAa;AAAA,IACjC,WAAW,SAAS,aAAa;AAAA,IACjC,SAAS,SAAS,WAAW;AAAA,IAC7B,MAAM,SAAS,QAAQ;AAAA,IACvB,aAAa,SAAS,eAAe;AAAA,IACrC,MAAM,SAAS,QAAQ;AAAA,IAEvB,OAAO,SAAS,QAAQ;AAAA,EAC1B,CAAC;AACH;AAoBO,IAAe,sBAAf,MAA8D;AAAA,EAOnE,YAAsB,OAAmC;AAAnC;AAAA,EAAoC;AAAA,EAN1D,IAAW,OAAO;AAChB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAQO,QAAQ,MAAc;AAC3B,UAAM,OAAO,KAAK,MAAM,SAAS;AACjC,QAAI,CAAC,KAAM,OAAM,IAAI,M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M;AAAA,MACJ,MAAM,KAAK;AAAA,MACX,UAAU,MAAM,KAAK,SAAS;AAAA,MAC9B,WAAW,CAAC,aAAa,aAAa,UAAU,QAAQ;AAAA,IAC1D,CAAC;AAZO;AAcR,SAAK,YAAY,aAAa,SAAS,KAAK,YAAY;AAAA,EAC1D;AAAA,EA1BA,IAAoB,OAAO;AACzB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAEA,IAAW,OAAO;AAChB,WAAO;AAAA,EACT;AAAA,EAEQ;AAAA,EAoBQ,WAA8B;AAC5C,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEO,YAAY;AACjB,SAAK,WAAW;AAAA,EAClB;AAAA,EAEO,qBAAqB,KAAa;AACvC,WAAO,IAAI;AAAA,MACT,IAAI,sBAAsB;AAAA,QACxB,MAAM;AAAA,UACJ,GAAG,KAAK;AAAA,UACR,kBAAkB;AAAA,UAClB,oBAAoB,EAAE,MAAM,SAAS,OAAO,IAAI;AAAA,UAChD,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,KAAK,GAAG,gBAAgB,GAAG;AAAA,QAC1D;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,YAAY,GAAG;AAClC,cAAI,CAAC,WAAY,QAAO;AAExB,iBAAO;AAAA,YACL,GAAG;AAAA,YACH,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,MACD,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
@@ -5,10 +5,6 @@ import { SubscribableWithState } from "./subscribable/Subscribable";
5
5
  import { Unsubscribe } from "../types";
6
6
  import { ContentPartRuntimePath } from "./RuntimePathTypes";
7
7
  export type ContentPartState = (ThreadUserContentPart | ThreadAssistantContentPart) & {
8
- /**
9
- * @deprecated You can directly access content part fields in the state. Replace `.part.type` with `.type` etc. This will be removed in 0.6.0.
10
- */
11
- part: ThreadUserContentPart | ThreadAssistantContentPart;
12
8
  status: ContentPartStatus | ToolCallContentPartStatus;
13
9
  };
14
10
  type ContentPartSnapshotBinding = SubscribableWithState<ContentPartState, ContentPartRuntimePath>;
@@ -1 +1 @@
1
- {"version":3,"file":"ContentPartRuntime.d.ts","sourceRoot":"","sources":["../../src/api/ContentPartRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,gBAAgB,GAAG,CAC3B,qBAAqB,GACrB,0BAA0B,CAC7B,GAAG;IACF;;OAEG;IACH,IAAI,EAAE,qBAAqB,GAAG,0BAA0B,CAAC;IACzD,MAAM,EAAE,iBAAiB,GAAG,yBAAyB,CAAC;CACvD,CAAC;AAEF,KAAK,0BAA0B,GAAG,qBAAqB,CACrD,gBAAgB,EAChB,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,sBAAsB,CAAC;IAE7B,QAAQ,IAAI,gBAAgB,CAAC;IAC7B,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IACjC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;CAC9C,CAAC;AAEF,qBAAa,sBAAuB,YAAW,kBAAkB;IAM7D,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,SAAS;IAPn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d;gBAGS,cAAc,EAAE,0BAA0B,EAC1C,UAAU,EAAE,mBAAmB,EAC/B,SAAS,EAAE,wBAAwB;IAGtC,QAAQ;IAIR,aAAa,CAAC,MAAM,EAAE,GAAG;IAqBzB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI;CAGtC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/ContentPartRuntime.ts"],"sourcesContent":["import {\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { MessageStateBinding } from \"./MessageRuntime\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { Unsubscribe } from \"../types\";\nimport { ContentPartRuntimePath } from \"./RuntimePathTypes\";\n\nexport type ContentPartState = (\n | ThreadUserContentPart\n | ThreadAssistantContentPart\n) & {\n /**\n * @deprecated You can directly access content part fields in the state. Replace `.part.type` with `.type` etc. This will be removed in 0.6.0.\n */\n part: ThreadUserContentPart | ThreadAssistantContentPart;\n status: ContentPartStatus | ToolCallContentPartStatus;\n};\n\ntype ContentPartSnapshotBinding = SubscribableWithState<\n ContentPartState,\n ContentPartRuntimePath\n>;\n\nexport type ContentPartRuntime = {\n path: ContentPartRuntimePath;\n\n getState(): ContentPartState;\n addToolResult(result: any): void;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport class ContentPartRuntimeImpl implements ContentPartRuntime {\n public get path() {\n return this.contentBinding.path;\n }\n\n constructor(\n private contentBinding: ContentPartSnapshotBinding,\n private messageApi: MessageStateBinding,\n private threadApi: ThreadRuntimeCoreBinding,\n ) {}\n\n public getState() {\n return this.contentBinding.getState();\n }\n\n public addToolResult(result: any) {\n const message = this.messageApi.getState();\n if (!message) throw new Error(\"Message is not available\");\n\n const state = this.contentBinding.getState();\n if (!state) throw new Error(\"Content part is not available\");\n\n if (state.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result to non-tool content part\");\n\n const toolName = state.toolName;\n const toolCallId = state.toolCallId;\n\n this.threadApi.getState().addToolResult({\n messageId: message.id,\n toolName,\n toolCallId,\n result,\n });\n }\n\n public subscribe(callback: () => void) {\n return this.contentBinding.subscribe(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCO,IAAM,yBAAN,MAA2D;AAAA,EAKhE,YACU,gBACA,YACA,WACR;AAHQ;AACA;AACA;AAAA,EACP;AAAA,EARH,IAAW,OAAO;AAChB,WAAO,KAAK,eAAe;AAAA,EAC7B;AAAA,EAQO,WAAW;AAChB,WAAO,KAAK,eAAe,SAAS;AAAA,EACtC;AAAA,EAEO,cAAc,QAAa;AAChC,UAAM,UAAU,KAAK,WAAW,SAAS;AACzC,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,0BAA0B;AAExD,UAAM,QAAQ,KAAK,eAAe,SAAS;AAC3C,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,+BAA+B;AAE3D,QAAI,MAAM,SAAS;AACjB,YAAM,IAAI,MAAM,mDAAmD;AAErE,UAAM,WAAW,MAAM;AACvB,UAAM,aAAa,MAAM;AAEzB,SAAK,UAAU,SAAS,EAAE,cAAc;AAAA,MACtC,WAAW,QAAQ;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEO,UAAU,UAAsB;AACrC,WAAO,KAAK,eAAe,UAAU,QAAQ;AAAA,EAC/C;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/api/ContentPartRuntime.ts"],"sourcesContent":["import {\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { MessageStateBinding } from \"./MessageRuntime\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { Unsubscribe } from \"../types\";\nimport { ContentPartRuntimePath } from \"./RuntimePathTypes\";\n\nexport type ContentPartState = (\n | ThreadUserContentPart\n | ThreadAssistantContentPart\n) & {\n status: ContentPartStatus | ToolCallContentPartStatus;\n};\n\ntype ContentPartSnapshotBinding = SubscribableWithState<\n ContentPartState,\n ContentPartRuntimePath\n>;\n\nexport type ContentPartRuntime = {\n path: ContentPartRuntimePath;\n\n getState(): ContentPartState;\n addToolResult(result: any): void;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport class ContentPartRuntimeImpl implements ContentPartRuntime {\n public get path() {\n return this.contentBinding.path;\n }\n\n constructor(\n private contentBinding: ContentPartSnapshotBinding,\n private messageApi: MessageStateBinding,\n private threadApi: ThreadRuntimeCoreBinding,\n ) {}\n\n public getState() {\n return this.contentBinding.getState();\n }\n\n public addToolResult(result: any) {\n const message = this.messageApi.getState();\n if (!message) throw new Error(\"Message is not available\");\n\n const state = this.contentBinding.getState();\n if (!state) throw new Error(\"Content part is not available\");\n\n if (state.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result to non-tool content part\");\n\n const toolName = state.toolName;\n const toolCallId = state.toolCallId;\n\n this.threadApi.getState().addToolResult({\n messageId: message.id,\n toolName,\n toolCallId,\n result,\n });\n }\n\n public subscribe(callback: () => void) {\n return this.contentBinding.subscribe(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCO,IAAM,yBAAN,MAA2D;AAAA,EAKhE,YACU,gBACA,YACA,WACR;AAHQ;AACA;AACA;AAAA,EACP;AAAA,EARH,IAAW,OAAO;AAChB,WAAO,KAAK,eAAe;AAAA,EAC7B;AAAA,EAQO,WAAW;AAChB,WAAO,KAAK,eAAe,SAAS;AAAA,EACtC;AAAA,EAEO,cAAc,QAAa;AAChC,UAAM,UAAU,KAAK,WAAW,SAAS;AACzC,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,0BAA0B;AAExD,UAAM,QAAQ,KAAK,eAAe,SAAS;AAC3C,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,+BAA+B;AAE3D,QAAI,MAAM,SAAS;AACjB,YAAM,IAAI,MAAM,mDAAmD;AAErE,UAAM,WAAW,MAAM;AACvB,UAAM,aAAa,MAAM;AAEzB,SAAK,UAAU,SAAS,EAAE,cAAc;AAAA,MACtC,WAAW,QAAQ;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEO,UAAU,UAAsB;AACrC,WAAO,KAAK,eAAe,UAAU,QAAQ;AAAA,EAC/C;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/ContentPartRuntime.ts"],"sourcesContent":["import {\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { MessageStateBinding } from \"./MessageRuntime\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { Unsubscribe } from \"../types\";\nimport { ContentPartRuntimePath } from \"./RuntimePathTypes\";\n\nexport type ContentPartState = (\n | ThreadUserContentPart\n | ThreadAssistantContentPart\n) & {\n /**\n * @deprecated You can directly access content part fields in the state. Replace `.part.type` with `.type` etc. This will be removed in 0.6.0.\n */\n part: ThreadUserContentPart | ThreadAssistantContentPart;\n status: ContentPartStatus | ToolCallContentPartStatus;\n};\n\ntype ContentPartSnapshotBinding = SubscribableWithState<\n ContentPartState,\n ContentPartRuntimePath\n>;\n\nexport type ContentPartRuntime = {\n path: ContentPartRuntimePath;\n\n getState(): ContentPartState;\n addToolResult(result: any): void;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport class ContentPartRuntimeImpl implements ContentPartRuntime {\n public get path() {\n return this.contentBinding.path;\n }\n\n constructor(\n private contentBinding: ContentPartSnapshotBinding,\n private messageApi: MessageStateBinding,\n private threadApi: ThreadRuntimeCoreBinding,\n ) {}\n\n public getState() {\n return this.contentBinding.getState();\n }\n\n public addToolResult(result: any) {\n const message = this.messageApi.getState();\n if (!message) throw new Error(\"Message is not available\");\n\n const state = this.contentBinding.getState();\n if (!state) throw new Error(\"Content part is not available\");\n\n if (state.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result to non-tool content part\");\n\n const toolName = state.toolName;\n const toolCallId = state.toolCallId;\n\n this.threadApi.getState().addToolResult({\n messageId: message.id,\n toolName,\n toolCallId,\n result,\n });\n }\n\n public subscribe(callback: () => void) {\n return this.contentBinding.subscribe(callback);\n }\n}\n"],"mappings":";AAoCO,IAAM,yBAAN,MAA2D;AAAA,EAKhE,YACU,gBACA,YACA,WACR;AAHQ;AACA;AACA;AAAA,EACP;AAAA,EARH,IAAW,OAAO;AAChB,WAAO,KAAK,eAAe;AAAA,EAC7B;AAAA,EAQO,WAAW;AAChB,WAAO,KAAK,eAAe,SAAS;AAAA,EACtC;AAAA,EAEO,cAAc,QAAa;AAChC,UAAM,UAAU,KAAK,WAAW,SAAS;AACzC,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,0BAA0B;AAExD,UAAM,QAAQ,KAAK,eAAe,SAAS;AAC3C,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,+BAA+B;AAE3D,QAAI,MAAM,SAAS;AACjB,YAAM,IAAI,MAAM,mDAAmD;AAErE,UAAM,WAAW,MAAM;AACvB,UAAM,aAAa,MAAM;AAEzB,SAAK,UAAU,SAAS,EAAE,cAAc;AAAA,MACtC,WAAW,QAAQ;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEO,UAAU,UAAsB;AACrC,WAAO,KAAK,eAAe,UAAU,QAAQ;AAAA,EAC/C;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/api/ContentPartRuntime.ts"],"sourcesContent":["import {\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { MessageStateBinding } from \"./MessageRuntime\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { Unsubscribe } from \"../types\";\nimport { ContentPartRuntimePath } from \"./RuntimePathTypes\";\n\nexport type ContentPartState = (\n | ThreadUserContentPart\n | ThreadAssistantContentPart\n) & {\n status: ContentPartStatus | ToolCallContentPartStatus;\n};\n\ntype ContentPartSnapshotBinding = SubscribableWithState<\n ContentPartState,\n ContentPartRuntimePath\n>;\n\nexport type ContentPartRuntime = {\n path: ContentPartRuntimePath;\n\n getState(): ContentPartState;\n addToolResult(result: any): void;\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport class ContentPartRuntimeImpl implements ContentPartRuntime {\n public get path() {\n return this.contentBinding.path;\n }\n\n constructor(\n private contentBinding: ContentPartSnapshotBinding,\n private messageApi: MessageStateBinding,\n private threadApi: ThreadRuntimeCoreBinding,\n ) {}\n\n public getState() {\n return this.contentBinding.getState();\n }\n\n public addToolResult(result: any) {\n const message = this.messageApi.getState();\n if (!message) throw new Error(\"Message is not available\");\n\n const state = this.contentBinding.getState();\n if (!state) throw new Error(\"Content part is not available\");\n\n if (state.type !== \"tool-call\")\n throw new Error(\"Tried to add tool result to non-tool content part\");\n\n const toolName = state.toolName;\n const toolCallId = state.toolCallId;\n\n this.threadApi.getState().addToolResult({\n messageId: message.id,\n toolName,\n toolCallId,\n result,\n });\n }\n\n public subscribe(callback: () => void) {\n return this.contentBinding.subscribe(callback);\n }\n}\n"],"mappings":";AAgCO,IAAM,yBAAN,MAA2D;AAAA,EAKhE,YACU,gBACA,YACA,WACR;AAHQ;AACA;AACA;AAAA,EACP;AAAA,EARH,IAAW,OAAO;AAChB,WAAO,KAAK,eAAe;AAAA,EAC7B;AAAA,EAQO,WAAW;AAChB,WAAO,KAAK,eAAe,SAAS;AAAA,EACtC;AAAA,EAEO,cAAc,QAAa;AAChC,UAAM,UAAU,KAAK,WAAW,SAAS;AACzC,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,0BAA0B;AAExD,UAAM,QAAQ,KAAK,eAAe,SAAS;AAC3C,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,+BAA+B;AAE3D,QAAI,MAAM,SAAS;AACjB,YAAM,IAAI,MAAM,mDAAmD;AAErE,UAAM,WAAW,MAAM;AACvB,UAAM,aAAa,MAAM;AAEzB,SAAK,UAAU,SAAS,EAAE,cAAc;AAAA,MACtC,WAAW,QAAQ;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEO,UAAU,UAAsB;AACrC,WAAO,KAAK,eAAe,UAAU,QAAQ;AAAA,EAC/C;AACF;","names":[]}
@@ -8,21 +8,10 @@ import { MessageRuntimePath } from "./RuntimePathTypes";
8
8
  import { ThreadRuntimeCoreBinding } from "./ThreadRuntime";
9
9
  import { SubscribableWithState } from "./subscribable/Subscribable";
10
10
  export declare const toContentPartStatus: (message: ThreadMessage, partIndex: number, part: ThreadUserContentPart | ThreadAssistantContentPart) => ToolCallContentPartStatus;
11
- export declare const EMPTY_CONTENT: Readonly<{
12
- type: "text";
13
- text: "";
14
- }>;
11
+ export declare const EMPTY_CONTENT_SYMBOL: unique symbol;
15
12
  export type MessageState = ThreadMessage & {
16
- /**
17
- * @deprecated You can directly access message fields in the state. Replace `.message.content` with `.content` etc. This will be removed in 0.6.0.
18
- */
19
- message: ThreadMessage;
20
13
  parentId: string | null;
21
14
  isLast: boolean;
22
- /**
23
- * @deprecated Use `branchNumber` and `branchCount` instead. This will be removed in 0.6.0.
24
- */
25
- branches: readonly string[];
26
15
  branchNumber: number;
27
16
  branchCount: number;
28
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"MessageRuntime.d.ts","sourceRoot":"","sources":["../../src/api/MessageRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EAClB,MAAM,oCAAoC,CA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;IAmB3C,QAAQ,0BAAC;IAET,QAAQ;IAIR,MAAM;IAQN,KAAK;IAKL,YAAY;IAUZ,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CAAA;KAAE;IAQ1D,cAAc,CAAC,EACpB,QAAQ,EACR,QAAQ,GACT,EAAE;QACD,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;QAC3C,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC/B;IAqBM,oBAAoB;IAIpB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI;IAI9B,qBAAqB,CAAC,GAAG,EAAE,MAAM;IAmBjC,0BAA0B,CAAC,UAAU,EAAE,MAAM;IA0B7C,oBAAoB,CAAC,GAAG,EAAE,MAAM;CAuBxC"}
@@ -20,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/api/MessageRuntime.ts
21
21
  var MessageRuntime_exports = {};
22
22
  __export(MessageRuntime_exports, {
23
- EMPTY_CONTENT: () => EMPTY_CONTENT,
23
+ EMPTY_CONTENT_SYMBOL: () => EMPTY_CONTENT_SYMBOL,
24
24
  MessageRuntimeImpl: () => MessageRuntimeImpl,
25
25
  toContentPartStatus: () => toContentPartStatus
26
26
  });
@@ -48,7 +48,12 @@ var toContentPartStatus = (message, partIndex, part) => {
48
48
  if (message.status.type === "requires-action") return COMPLETE_STATUS;
49
49
  return isLastPart ? message.status : COMPLETE_STATUS;
50
50
  };
51
- var EMPTY_CONTENT = Object.freeze({ type: "text", text: "" });
51
+ var EMPTY_CONTENT_SYMBOL = Symbol("empty-content");
52
+ var EMPTY_CONTENT = Object.freeze({
53
+ type: "text",
54
+ text: "",
55
+ [EMPTY_CONTENT_SYMBOL]: true
56
+ });
52
57
  var getContentPartState = (message, partIndex) => {
53
58
  let part = message.content[partIndex];
54
59
  if (!part) {
@@ -61,7 +66,7 @@ var getContentPartState = (message, partIndex) => {
61
66
  part = EMPTY_CONTENT;
62
67
  }
63
68
  const status = toContentPartStatus(message, partIndex, part);
64
- return Object.freeze({ ...part, part, status });
69
+ return Object.freeze({ ...part, status });
65
70
  };
66
71
  var MessageRuntimeImpl = class {
67
72
  constructor(_core, _threadBinding) {
@@ -195,7 +200,6 @@ var MessageRuntimeImpl = class {
195
200
  if (!attachment) return import_SKIP_UPDATE.SKIP_UPDATE;
196
201
  return {
197
202
  ...attachment,
198
- attachment,
199
203
  source: "message"
200
204
  };
201
205
  },
@@ -206,7 +210,7 @@ var MessageRuntimeImpl = class {
206
210
  };
207
211
  // Annotate the CommonJS export names for ESM import in node:
208
212
  0 && (module.exports = {
209
- EMPTY_CONTENT,
213
+ EMPTY_CONTENT_SYMBOL,
210
214
  MessageRuntimeImpl,
211
215
  toContentPartStatus
212
216
  });