@assistant-ui/react 0.5.100 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (734) hide show
  1. package/dist/api/AssistantRuntime.d.ts +6 -86
  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 +4 -16
  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 +15 -131
  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 +2 -6
  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 +8 -19
  22. package/dist/api/MessageRuntime.d.ts.map +1 -1
  23. package/dist/api/MessageRuntime.js +11 -7
  24. package/dist/api/MessageRuntime.js.map +1 -1
  25. package/dist/api/MessageRuntime.mjs +10 -6
  26. package/dist/api/MessageRuntime.mjs.map +1 -1
  27. package/dist/api/RuntimePathTypes.d.ts +33 -33
  28. package/dist/api/RuntimePathTypes.d.ts.map +1 -1
  29. package/dist/api/RuntimePathTypes.js.map +1 -1
  30. package/dist/api/ThreadListItemRuntime.d.ts +12 -8
  31. package/dist/api/ThreadListItemRuntime.d.ts.map +1 -1
  32. package/dist/api/ThreadListItemRuntime.js +10 -6
  33. package/dist/api/ThreadListItemRuntime.js.map +1 -1
  34. package/dist/api/ThreadListItemRuntime.mjs +10 -6
  35. package/dist/api/ThreadListItemRuntime.mjs.map +1 -1
  36. package/dist/api/ThreadListRuntime.d.ts +10 -28
  37. package/dist/api/ThreadListRuntime.d.ts.map +1 -1
  38. package/dist/api/ThreadListRuntime.js +23 -26
  39. package/dist/api/ThreadListRuntime.js.map +1 -1
  40. package/dist/api/ThreadListRuntime.mjs +23 -26
  41. package/dist/api/ThreadListRuntime.mjs.map +1 -1
  42. package/dist/api/ThreadRuntime.d.ts +53 -211
  43. package/dist/api/ThreadRuntime.d.ts.map +1 -1
  44. package/dist/api/ThreadRuntime.js +2 -94
  45. package/dist/api/ThreadRuntime.js.map +1 -1
  46. package/dist/api/ThreadRuntime.mjs +2 -94
  47. package/dist/api/ThreadRuntime.mjs.map +1 -1
  48. package/dist/api/index.d.ts +1 -0
  49. package/dist/api/index.d.ts.map +1 -1
  50. package/dist/api/index.js.map +1 -1
  51. package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
  52. package/dist/context/providers/AssistantRuntimeProvider.js +0 -1
  53. package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
  54. package/dist/context/providers/AssistantRuntimeProvider.mjs +0 -1
  55. package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
  56. package/dist/context/providers/TextContentPartProvider.d.ts.map +1 -1
  57. package/dist/context/providers/TextContentPartProvider.js +0 -2
  58. package/dist/context/providers/TextContentPartProvider.js.map +1 -1
  59. package/dist/context/providers/TextContentPartProvider.mjs +0 -2
  60. package/dist/context/providers/TextContentPartProvider.mjs.map +1 -1
  61. package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts +1 -4
  62. package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -1
  63. package/dist/context/providers/ThreadRuntimeProvider.d.ts.map +1 -1
  64. package/dist/context/providers/ThreadRuntimeProvider.js +1 -13
  65. package/dist/context/providers/ThreadRuntimeProvider.js.map +1 -1
  66. package/dist/context/providers/ThreadRuntimeProvider.mjs +1 -13
  67. package/dist/context/providers/ThreadRuntimeProvider.mjs.map +1 -1
  68. package/dist/context/react/AssistantContext.d.ts +10 -120
  69. package/dist/context/react/AssistantContext.d.ts.map +1 -1
  70. package/dist/context/react/AssistantContext.js +0 -15
  71. package/dist/context/react/AssistantContext.js.map +1 -1
  72. package/dist/context/react/AssistantContext.mjs +0 -11
  73. package/dist/context/react/AssistantContext.mjs.map +1 -1
  74. package/dist/context/react/AttachmentContext.d.ts +32 -48
  75. package/dist/context/react/AttachmentContext.d.ts.map +1 -1
  76. package/dist/context/react/ComposerContext.d.ts +0 -5
  77. package/dist/context/react/ComposerContext.d.ts.map +1 -1
  78. package/dist/context/react/ComposerContext.js +3 -5
  79. package/dist/context/react/ComposerContext.js.map +1 -1
  80. package/dist/context/react/ComposerContext.mjs +2 -3
  81. package/dist/context/react/ComposerContext.mjs.map +1 -1
  82. package/dist/context/react/ContentPartContext.d.ts +0 -5
  83. package/dist/context/react/ContentPartContext.d.ts.map +1 -1
  84. package/dist/context/react/ContentPartContext.js +3 -5
  85. package/dist/context/react/ContentPartContext.js.map +1 -1
  86. package/dist/context/react/ContentPartContext.mjs +2 -3
  87. package/dist/context/react/ContentPartContext.mjs.map +1 -1
  88. package/dist/context/react/MessageContext.d.ts +6 -46
  89. package/dist/context/react/MessageContext.d.ts.map +1 -1
  90. package/dist/context/react/MessageContext.js +2 -6
  91. package/dist/context/react/MessageContext.js.map +1 -1
  92. package/dist/context/react/MessageContext.mjs +2 -4
  93. package/dist/context/react/MessageContext.mjs.map +1 -1
  94. package/dist/context/react/ThreadContext.d.ts +11 -1749
  95. package/dist/context/react/ThreadContext.d.ts.map +1 -1
  96. package/dist/context/react/ThreadContext.js +4 -30
  97. package/dist/context/react/ThreadContext.js.map +1 -1
  98. package/dist/context/react/ThreadContext.mjs +4 -22
  99. package/dist/context/react/ThreadContext.mjs.map +1 -1
  100. package/dist/context/react/ThreadListItemContext.d.ts +6 -24
  101. package/dist/context/react/ThreadListItemContext.d.ts.map +1 -1
  102. package/dist/context/react/index.d.ts +5 -101
  103. package/dist/context/react/index.d.ts.map +1 -1
  104. package/dist/context/react/index.js +0 -38
  105. package/dist/context/react/index.js.map +1 -1
  106. package/dist/context/react/index.mjs +5 -49
  107. package/dist/context/react/index.mjs.map +1 -1
  108. package/dist/context/stores/AssistantToolUIs.d.ts +9 -6
  109. package/dist/context/stores/AssistantToolUIs.d.ts.map +1 -1
  110. package/dist/context/stores/AssistantToolUIs.js.map +1 -1
  111. package/dist/context/stores/AssistantToolUIs.mjs.map +1 -1
  112. package/dist/context/stores/MessageUtils.d.ts +7 -12
  113. package/dist/context/stores/MessageUtils.d.ts.map +1 -1
  114. package/dist/context/stores/MessageUtils.js.map +1 -1
  115. package/dist/context/stores/MessageUtils.mjs.map +1 -1
  116. package/dist/context/stores/ThreadViewport.d.ts +6 -10
  117. package/dist/context/stores/ThreadViewport.d.ts.map +1 -1
  118. package/dist/context/stores/ThreadViewport.js +0 -1
  119. package/dist/context/stores/ThreadViewport.js.map +1 -1
  120. package/dist/context/stores/ThreadViewport.mjs +0 -2
  121. package/dist/context/stores/ThreadViewport.mjs.map +1 -1
  122. package/dist/index.d.ts +0 -1
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +0 -2
  125. package/dist/index.js.map +1 -1
  126. package/dist/index.mjs +0 -1
  127. package/dist/index.mjs.map +1 -1
  128. package/dist/internal.d.ts +1 -0
  129. package/dist/internal.d.ts.map +1 -1
  130. package/dist/internal.js +3 -0
  131. package/dist/internal.js.map +1 -1
  132. package/dist/internal.mjs +2 -0
  133. package/dist/internal.mjs.map +1 -1
  134. package/dist/model-config/useAssistantToolUI.d.ts.map +1 -1
  135. package/dist/model-config/useAssistantToolUI.js.map +1 -1
  136. package/dist/model-config/useAssistantToolUI.mjs.map +1 -1
  137. package/dist/primitive-hooks/contentPart/useContentPartDisplay.d.ts +1 -4
  138. package/dist/primitive-hooks/contentPart/useContentPartDisplay.d.ts.map +1 -1
  139. package/dist/primitive-hooks/contentPart/useContentPartDisplay.js.map +1 -1
  140. package/dist/primitive-hooks/contentPart/useContentPartDisplay.mjs.map +1 -1
  141. package/dist/primitive-hooks/contentPart/useContentPartImage.d.ts +1 -4
  142. package/dist/primitive-hooks/contentPart/useContentPartImage.d.ts.map +1 -1
  143. package/dist/primitive-hooks/contentPart/useContentPartImage.js.map +1 -1
  144. package/dist/primitive-hooks/contentPart/useContentPartImage.mjs.map +1 -1
  145. package/dist/primitive-hooks/contentPart/useContentPartText.d.ts +1 -4
  146. package/dist/primitive-hooks/contentPart/useContentPartText.d.ts.map +1 -1
  147. package/dist/primitive-hooks/contentPart/useContentPartText.js.map +1 -1
  148. package/dist/primitive-hooks/contentPart/useContentPartText.mjs.map +1 -1
  149. package/dist/primitive-hooks/index.d.ts +0 -5
  150. package/dist/primitive-hooks/index.d.ts.map +1 -1
  151. package/dist/primitive-hooks/index.js +1 -11
  152. package/dist/primitive-hooks/index.js.map +1 -1
  153. package/dist/primitive-hooks/index.mjs +0 -5
  154. package/dist/primitive-hooks/index.mjs.map +1 -1
  155. package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -5
  156. package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
  157. package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
  158. package/dist/primitives/actionBar/ActionBarCopy.mjs.map +1 -1
  159. package/dist/primitives/actionBar/ActionBarEdit.d.ts +0 -4
  160. package/dist/primitives/actionBar/ActionBarEdit.d.ts.map +1 -1
  161. package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
  162. package/dist/primitives/actionBar/ActionBarEdit.mjs.map +1 -1
  163. package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts +0 -4
  164. package/dist/primitives/actionBar/ActionBarFeedbackNegative.d.ts.map +1 -1
  165. package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
  166. package/dist/primitives/actionBar/ActionBarFeedbackNegative.mjs.map +1 -1
  167. package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts +0 -4
  168. package/dist/primitives/actionBar/ActionBarFeedbackPositive.d.ts.map +1 -1
  169. package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
  170. package/dist/primitives/actionBar/ActionBarFeedbackPositive.mjs.map +1 -1
  171. package/dist/primitives/actionBar/ActionBarReload.d.ts +0 -4
  172. package/dist/primitives/actionBar/ActionBarReload.d.ts.map +1 -1
  173. package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
  174. package/dist/primitives/actionBar/ActionBarReload.mjs.map +1 -1
  175. package/dist/primitives/actionBar/ActionBarRoot.d.ts +0 -4
  176. package/dist/primitives/actionBar/ActionBarRoot.d.ts.map +1 -1
  177. package/dist/primitives/actionBar/ActionBarRoot.js.map +1 -1
  178. package/dist/primitives/actionBar/ActionBarRoot.mjs.map +1 -1
  179. package/dist/primitives/actionBar/ActionBarSpeak.d.ts +0 -4
  180. package/dist/primitives/actionBar/ActionBarSpeak.d.ts.map +1 -1
  181. package/dist/primitives/actionBar/ActionBarSpeak.js.map +1 -1
  182. package/dist/primitives/actionBar/ActionBarSpeak.mjs.map +1 -1
  183. package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts +0 -4
  184. package/dist/primitives/actionBar/ActionBarStopSpeaking.d.ts.map +1 -1
  185. package/dist/primitives/actionBar/ActionBarStopSpeaking.js.map +1 -1
  186. package/dist/primitives/actionBar/ActionBarStopSpeaking.mjs.map +1 -1
  187. package/dist/primitives/assistantModal/AssistantModalContent.d.ts +0 -4
  188. package/dist/primitives/assistantModal/AssistantModalContent.d.ts.map +1 -1
  189. package/dist/primitives/assistantModal/AssistantModalContent.js.map +1 -1
  190. package/dist/primitives/assistantModal/AssistantModalContent.mjs.map +1 -1
  191. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts +0 -4
  192. package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
  193. package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
  194. package/dist/primitives/assistantModal/AssistantModalRoot.mjs.map +1 -1
  195. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts +0 -4
  196. package/dist/primitives/assistantModal/AssistantModalTrigger.d.ts.map +1 -1
  197. package/dist/primitives/assistantModal/AssistantModalTrigger.js.map +1 -1
  198. package/dist/primitives/assistantModal/AssistantModalTrigger.mjs.map +1 -1
  199. package/dist/primitives/branchPicker/BranchPickerCount.d.ts +0 -4
  200. package/dist/primitives/branchPicker/BranchPickerCount.d.ts.map +1 -1
  201. package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
  202. package/dist/primitives/branchPicker/BranchPickerCount.mjs.map +1 -1
  203. package/dist/primitives/branchPicker/BranchPickerNext.d.ts +0 -4
  204. package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
  205. package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
  206. package/dist/primitives/branchPicker/BranchPickerNext.mjs.map +1 -1
  207. package/dist/primitives/branchPicker/BranchPickerNumber.d.ts +0 -4
  208. package/dist/primitives/branchPicker/BranchPickerNumber.d.ts.map +1 -1
  209. package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
  210. package/dist/primitives/branchPicker/BranchPickerNumber.mjs.map +1 -1
  211. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts +0 -4
  212. package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
  213. package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
  214. package/dist/primitives/branchPicker/BranchPickerPrevious.mjs.map +1 -1
  215. package/dist/primitives/branchPicker/BranchPickerRoot.d.ts +0 -4
  216. package/dist/primitives/branchPicker/BranchPickerRoot.d.ts.map +1 -1
  217. package/dist/primitives/branchPicker/BranchPickerRoot.js.map +1 -1
  218. package/dist/primitives/branchPicker/BranchPickerRoot.mjs.map +1 -1
  219. package/dist/primitives/composer/ComposerAddAttachment.d.ts +1 -5
  220. package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
  221. package/dist/primitives/composer/ComposerAddAttachment.js +2 -2
  222. package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
  223. package/dist/primitives/composer/ComposerAddAttachment.mjs +1 -1
  224. package/dist/primitives/composer/ComposerAddAttachment.mjs.map +1 -1
  225. package/dist/primitives/composer/ComposerAttachments.d.ts +0 -4
  226. package/dist/primitives/composer/ComposerAttachments.d.ts.map +1 -1
  227. package/dist/primitives/composer/ComposerAttachments.js.map +1 -1
  228. package/dist/primitives/composer/ComposerAttachments.mjs.map +1 -1
  229. package/dist/primitives/composer/ComposerCancel.d.ts +0 -4
  230. package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
  231. package/dist/primitives/composer/ComposerCancel.js.map +1 -1
  232. package/dist/primitives/composer/ComposerCancel.mjs.map +1 -1
  233. package/dist/primitives/composer/ComposerIf.d.ts +0 -4
  234. package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
  235. package/dist/primitives/composer/ComposerIf.js.map +1 -1
  236. package/dist/primitives/composer/ComposerIf.mjs.map +1 -1
  237. package/dist/primitives/composer/ComposerInput.d.ts +0 -4
  238. package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
  239. package/dist/primitives/composer/ComposerInput.js.map +1 -1
  240. package/dist/primitives/composer/ComposerInput.mjs.map +1 -1
  241. package/dist/primitives/composer/ComposerRoot.d.ts +0 -1
  242. package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
  243. package/dist/primitives/composer/ComposerRoot.js +2 -2
  244. package/dist/primitives/composer/ComposerRoot.js.map +1 -1
  245. package/dist/primitives/composer/ComposerRoot.mjs +1 -1
  246. package/dist/primitives/composer/ComposerRoot.mjs.map +1 -1
  247. package/dist/primitives/composer/ComposerSend.d.ts +1 -5
  248. package/dist/primitives/composer/ComposerSend.d.ts.map +1 -1
  249. package/dist/primitives/composer/ComposerSend.js +2 -2
  250. package/dist/primitives/composer/ComposerSend.js.map +1 -1
  251. package/dist/primitives/composer/ComposerSend.mjs +1 -1
  252. package/dist/primitives/composer/ComposerSend.mjs.map +1 -1
  253. package/dist/primitives/contentPart/ContentPartDisplay.d.ts +0 -4
  254. package/dist/primitives/contentPart/ContentPartDisplay.d.ts.map +1 -1
  255. package/dist/primitives/contentPart/ContentPartDisplay.js.map +1 -1
  256. package/dist/primitives/contentPart/ContentPartDisplay.mjs.map +1 -1
  257. package/dist/primitives/contentPart/ContentPartImage.d.ts +0 -4
  258. package/dist/primitives/contentPart/ContentPartImage.d.ts.map +1 -1
  259. package/dist/primitives/contentPart/ContentPartImage.js.map +1 -1
  260. package/dist/primitives/contentPart/ContentPartImage.mjs.map +1 -1
  261. package/dist/primitives/contentPart/ContentPartInProgress.d.ts +0 -4
  262. package/dist/primitives/contentPart/ContentPartInProgress.d.ts.map +1 -1
  263. package/dist/primitives/contentPart/ContentPartInProgress.js.map +1 -1
  264. package/dist/primitives/contentPart/ContentPartInProgress.mjs.map +1 -1
  265. package/dist/primitives/contentPart/ContentPartText.d.ts +0 -4
  266. package/dist/primitives/contentPart/ContentPartText.d.ts.map +1 -1
  267. package/dist/primitives/contentPart/ContentPartText.js.map +1 -1
  268. package/dist/primitives/contentPart/ContentPartText.mjs.map +1 -1
  269. package/dist/primitives/index.d.ts +0 -7
  270. package/dist/primitives/index.d.ts.map +1 -1
  271. package/dist/primitives/index.js.map +1 -1
  272. package/dist/primitives/index.mjs.map +1 -1
  273. package/dist/primitives/message/MessageAttachments.d.ts +0 -4
  274. package/dist/primitives/message/MessageAttachments.d.ts.map +1 -1
  275. package/dist/primitives/message/MessageAttachments.js +2 -4
  276. package/dist/primitives/message/MessageAttachments.js.map +1 -1
  277. package/dist/primitives/message/MessageAttachments.mjs +2 -4
  278. package/dist/primitives/message/MessageAttachments.mjs.map +1 -1
  279. package/dist/primitives/message/MessageContent.d.ts +0 -4
  280. package/dist/primitives/message/MessageContent.d.ts.map +1 -1
  281. package/dist/primitives/message/MessageContent.js +6 -6
  282. package/dist/primitives/message/MessageContent.js.map +1 -1
  283. package/dist/primitives/message/MessageContent.mjs +7 -7
  284. package/dist/primitives/message/MessageContent.mjs.map +1 -1
  285. package/dist/primitives/message/MessageIf.d.ts +0 -4
  286. package/dist/primitives/message/MessageIf.d.ts.map +1 -1
  287. package/dist/primitives/message/MessageIf.js.map +1 -1
  288. package/dist/primitives/message/MessageIf.mjs.map +1 -1
  289. package/dist/primitives/message/MessageRoot.d.ts +0 -4
  290. package/dist/primitives/message/MessageRoot.d.ts.map +1 -1
  291. package/dist/primitives/message/MessageRoot.js.map +1 -1
  292. package/dist/primitives/message/MessageRoot.mjs.map +1 -1
  293. package/dist/primitives/message/index.d.ts +0 -1
  294. package/dist/primitives/message/index.d.ts.map +1 -1
  295. package/dist/primitives/message/index.js +0 -3
  296. package/dist/primitives/message/index.js.map +1 -1
  297. package/dist/primitives/message/index.mjs +0 -2
  298. package/dist/primitives/message/index.mjs.map +1 -1
  299. package/dist/primitives/thread/ThreadEmpty.d.ts +0 -4
  300. package/dist/primitives/thread/ThreadEmpty.d.ts.map +1 -1
  301. package/dist/primitives/thread/ThreadEmpty.js +2 -2
  302. package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
  303. package/dist/primitives/thread/ThreadEmpty.mjs +1 -1
  304. package/dist/primitives/thread/ThreadEmpty.mjs.map +1 -1
  305. package/dist/primitives/thread/ThreadIf.d.ts +0 -4
  306. package/dist/primitives/thread/ThreadIf.d.ts.map +1 -1
  307. package/dist/primitives/thread/ThreadIf.js.map +1 -1
  308. package/dist/primitives/thread/ThreadIf.mjs.map +1 -1
  309. package/dist/primitives/thread/ThreadMessages.d.ts +0 -4
  310. package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
  311. package/dist/primitives/thread/ThreadMessages.js.map +1 -1
  312. package/dist/primitives/thread/ThreadMessages.mjs.map +1 -1
  313. package/dist/primitives/thread/ThreadRoot.d.ts +0 -4
  314. package/dist/primitives/thread/ThreadRoot.d.ts.map +1 -1
  315. package/dist/primitives/thread/ThreadRoot.js.map +1 -1
  316. package/dist/primitives/thread/ThreadRoot.mjs.map +1 -1
  317. package/dist/primitives/thread/ThreadScrollToBottom.d.ts +0 -4
  318. package/dist/primitives/thread/ThreadScrollToBottom.d.ts.map +1 -1
  319. package/dist/primitives/thread/ThreadScrollToBottom.js.map +1 -1
  320. package/dist/primitives/thread/ThreadScrollToBottom.mjs.map +1 -1
  321. package/dist/primitives/thread/ThreadSuggestion.d.ts +0 -4
  322. package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
  323. package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
  324. package/dist/primitives/thread/ThreadSuggestion.mjs.map +1 -1
  325. package/dist/primitives/thread/ThreadViewport.d.ts +0 -4
  326. package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
  327. package/dist/primitives/thread/ThreadViewport.js.map +1 -1
  328. package/dist/primitives/thread/ThreadViewport.mjs.map +1 -1
  329. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
  330. package/dist/primitives/threadListItem/ThreadListItemArchive.js +3 -2
  331. package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
  332. package/dist/primitives/threadListItem/ThreadListItemArchive.mjs +3 -2
  333. package/dist/primitives/threadListItem/ThreadListItemArchive.mjs.map +1 -1
  334. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts +14 -0
  335. package/dist/primitives/threadListItem/ThreadListItemRoot.d.ts.map +1 -0
  336. package/dist/primitives/threadListItem/ThreadListItemRoot.js +47 -0
  337. package/dist/primitives/threadListItem/ThreadListItemRoot.js.map +1 -0
  338. package/dist/primitives/threadListItem/ThreadListItemRoot.mjs +23 -0
  339. package/dist/primitives/threadListItem/ThreadListItemRoot.mjs.map +1 -0
  340. package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts +8 -0
  341. package/dist/primitives/threadListItem/ThreadListItemTitle.d.ts.map +1 -0
  342. package/dist/primitives/{message/MessageInProgress.js → threadListItem/ThreadListItemTitle.js} +13 -10
  343. package/dist/primitives/threadListItem/ThreadListItemTitle.js.map +1 -0
  344. package/dist/primitives/threadListItem/ThreadListItemTitle.mjs +14 -0
  345. package/dist/primitives/threadListItem/ThreadListItemTitle.mjs.map +1 -0
  346. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +13 -0
  347. package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -0
  348. package/dist/{runtimes/core/subscribeToMainThread.js → primitives/threadListItem/ThreadListItemTrigger.js} +17 -22
  349. package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -0
  350. package/dist/primitives/threadListItem/ThreadListItemTrigger.mjs +21 -0
  351. package/dist/primitives/threadListItem/ThreadListItemTrigger.mjs.map +1 -0
  352. package/dist/primitives/threadListItem/index.d.ts +3 -0
  353. package/dist/primitives/threadListItem/index.d.ts.map +1 -1
  354. package/dist/primitives/threadListItem/index.js +9 -0
  355. package/dist/primitives/threadListItem/index.js.map +1 -1
  356. package/dist/primitives/threadListItem/index.mjs +6 -0
  357. package/dist/primitives/threadListItem/index.mjs.map +1 -1
  358. package/dist/runtimes/attachment/AttachmentAdapter.d.ts +3 -7
  359. package/dist/runtimes/attachment/AttachmentAdapter.d.ts.map +1 -1
  360. package/dist/runtimes/attachment/AttachmentAdapter.js.map +1 -1
  361. package/dist/runtimes/attachment/CompositeAttachmentAdapter.d.ts +2 -6
  362. package/dist/runtimes/attachment/CompositeAttachmentAdapter.d.ts.map +1 -1
  363. package/dist/runtimes/attachment/CompositeAttachmentAdapter.js +1 -2
  364. package/dist/runtimes/attachment/CompositeAttachmentAdapter.js.map +1 -1
  365. package/dist/runtimes/attachment/CompositeAttachmentAdapter.mjs +1 -2
  366. package/dist/runtimes/attachment/CompositeAttachmentAdapter.mjs.map +1 -1
  367. package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
  368. package/dist/runtimes/composer/BaseComposerRuntimeCore.js +0 -6
  369. package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
  370. package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +0 -6
  371. package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
  372. package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts +6 -7
  373. package/dist/runtimes/core/BaseThreadRuntimeCore.d.ts.map +1 -1
  374. package/dist/runtimes/core/BaseThreadRuntimeCore.js +8 -4
  375. package/dist/runtimes/core/BaseThreadRuntimeCore.js.map +1 -1
  376. package/dist/runtimes/core/BaseThreadRuntimeCore.mjs +8 -4
  377. package/dist/runtimes/core/BaseThreadRuntimeCore.mjs.map +1 -1
  378. package/dist/runtimes/core/ComposerRuntimeCore.d.ts +0 -3
  379. package/dist/runtimes/core/ComposerRuntimeCore.d.ts.map +1 -1
  380. package/dist/runtimes/core/ComposerRuntimeCore.js.map +1 -1
  381. package/dist/runtimes/core/ThreadListRuntimeCore.d.ts +7 -10
  382. package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -1
  383. package/dist/runtimes/core/ThreadListRuntimeCore.js.map +1 -1
  384. package/dist/runtimes/core/ThreadRuntimeCore.d.ts +30 -17
  385. package/dist/runtimes/core/ThreadRuntimeCore.d.ts.map +1 -1
  386. package/dist/runtimes/core/ThreadRuntimeCore.js.map +1 -1
  387. package/dist/runtimes/core/index.d.ts +1 -2
  388. package/dist/runtimes/core/index.d.ts.map +1 -1
  389. package/dist/runtimes/core/index.js +0 -12
  390. package/dist/runtimes/core/index.js.map +1 -1
  391. package/dist/runtimes/core/index.mjs +0 -5
  392. package/dist/runtimes/core/index.mjs.map +1 -1
  393. package/dist/runtimes/edge/converters/toCoreMessages.d.ts +1 -1
  394. package/dist/runtimes/edge/converters/toCoreMessages.d.ts.map +1 -1
  395. package/dist/runtimes/edge/converters/toCoreMessages.js.map +1 -1
  396. package/dist/runtimes/edge/converters/toCoreMessages.mjs.map +1 -1
  397. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts +0 -4
  398. package/dist/runtimes/edge/createEdgeRuntimeAPI.d.ts.map +1 -1
  399. package/dist/runtimes/edge/createEdgeRuntimeAPI.js +0 -2
  400. package/dist/runtimes/edge/createEdgeRuntimeAPI.js.map +1 -1
  401. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs +0 -2
  402. package/dist/runtimes/edge/createEdgeRuntimeAPI.mjs.map +1 -1
  403. package/dist/runtimes/edge/streams/runResultStream.js +0 -2
  404. package/dist/runtimes/edge/streams/runResultStream.js.map +1 -1
  405. package/dist/runtimes/edge/streams/runResultStream.mjs +0 -2
  406. package/dist/runtimes/edge/streams/runResultStream.mjs.map +1 -1
  407. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +3 -16
  408. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
  409. package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
  410. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
  411. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +0 -3
  412. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
  413. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +0 -3
  414. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
  415. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +10 -12
  416. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -1
  417. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js +29 -7
  418. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -1
  419. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs +29 -7
  420. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -1
  421. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +2 -12
  422. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
  423. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +4 -3
  424. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
  425. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +4 -3
  426. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
  427. package/dist/runtimes/external-store/ThreadMessageLike.d.ts.map +1 -1
  428. package/dist/runtimes/external-store/ThreadMessageLike.js +2 -0
  429. package/dist/runtimes/external-store/ThreadMessageLike.js.map +1 -1
  430. package/dist/runtimes/external-store/ThreadMessageLike.mjs +2 -0
  431. package/dist/runtimes/external-store/ThreadMessageLike.mjs.map +1 -1
  432. package/dist/runtimes/local/ChatModelAdapter.d.ts +0 -8
  433. package/dist/runtimes/local/ChatModelAdapter.d.ts.map +1 -1
  434. package/dist/runtimes/local/ChatModelAdapter.js.map +1 -1
  435. package/dist/runtimes/local/LocalRuntimeOptions.d.ts +1 -6
  436. package/dist/runtimes/local/LocalRuntimeOptions.d.ts.map +1 -1
  437. package/dist/runtimes/local/LocalRuntimeOptions.js +1 -2
  438. package/dist/runtimes/local/LocalRuntimeOptions.js.map +1 -1
  439. package/dist/runtimes/local/LocalRuntimeOptions.mjs +1 -2
  440. package/dist/runtimes/local/LocalRuntimeOptions.mjs.map +1 -1
  441. package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts +16 -20
  442. package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -1
  443. package/dist/runtimes/local/LocalThreadListRuntimeCore.js +112 -72
  444. package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -1
  445. package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs +112 -72
  446. package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +1 -1
  447. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.d.ts +19 -0
  448. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.d.ts.map +1 -0
  449. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.js +87 -0
  450. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.js.map +1 -0
  451. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.mjs +62 -0
  452. package/dist/runtimes/local/LocalThreadMetadataRuntimeCore.mjs.map +1 -0
  453. package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts +1 -1
  454. package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
  455. package/dist/runtimes/local/LocalThreadRuntimeCore.js +15 -11
  456. package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
  457. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +15 -11
  458. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
  459. package/dist/styles/index.css.map +1 -1
  460. package/dist/types/AssistantTypes.d.ts +1 -18
  461. package/dist/types/AssistantTypes.d.ts.map +1 -1
  462. package/dist/types/AssistantTypes.js.map +1 -1
  463. package/dist/types/AttachmentTypes.d.ts +1 -1
  464. package/dist/types/AttachmentTypes.d.ts.map +1 -1
  465. package/dist/types/AttachmentTypes.js.map +1 -1
  466. package/dist/types/ContentPartComponentTypes.d.ts +4 -28
  467. package/dist/types/ContentPartComponentTypes.d.ts.map +1 -1
  468. package/dist/types/ContentPartComponentTypes.js.map +1 -1
  469. package/dist/ui/assistant-message.d.ts +1 -10
  470. package/dist/ui/assistant-message.d.ts.map +1 -1
  471. package/dist/ui/assistant-message.js.map +1 -1
  472. package/dist/ui/assistant-message.mjs.map +1 -1
  473. package/dist/ui/composer.d.ts +1 -25
  474. package/dist/ui/composer.d.ts.map +1 -1
  475. package/dist/ui/composer.js.map +1 -1
  476. package/dist/ui/composer.mjs.map +1 -1
  477. package/dist/ui/index.d.ts +6 -14
  478. package/dist/ui/index.d.ts.map +1 -1
  479. package/dist/ui/index.js +0 -4
  480. package/dist/ui/index.js.map +1 -1
  481. package/dist/ui/index.mjs +14 -24
  482. package/dist/ui/index.mjs.map +1 -1
  483. package/dist/ui/thread-welcome.d.ts +5 -17
  484. package/dist/ui/thread-welcome.d.ts.map +1 -1
  485. package/dist/ui/thread-welcome.js.map +1 -1
  486. package/dist/ui/thread-welcome.mjs.map +1 -1
  487. package/dist/ui/thread.d.ts +1 -19
  488. package/dist/ui/thread.d.ts.map +1 -1
  489. package/dist/ui/thread.js.map +1 -1
  490. package/dist/ui/thread.mjs.map +1 -1
  491. package/dist/ui/user-message.d.ts +1 -18
  492. package/dist/ui/user-message.d.ts.map +1 -1
  493. package/dist/ui/user-message.js.map +1 -1
  494. package/dist/ui/user-message.mjs.map +1 -1
  495. package/dist/utils/smooth/SmoothContext.js +2 -2
  496. package/dist/utils/smooth/SmoothContext.js.map +1 -1
  497. package/dist/utils/smooth/SmoothContext.mjs +3 -3
  498. package/dist/utils/smooth/SmoothContext.mjs.map +1 -1
  499. package/dist/utils/smooth/useSmooth.d.ts.map +1 -1
  500. package/dist/utils/smooth/useSmooth.js +0 -1
  501. package/dist/utils/smooth/useSmooth.js.map +1 -1
  502. package/dist/utils/smooth/useSmooth.mjs +0 -1
  503. package/dist/utils/smooth/useSmooth.mjs.map +1 -1
  504. package/package.json +7 -7
  505. package/src/api/AssistantRuntime.ts +3 -25
  506. package/src/api/AttachmentRuntime.ts +4 -16
  507. package/src/api/ComposerRuntime.ts +18 -214
  508. package/src/api/ContentPartRuntime.ts +2 -6
  509. package/src/api/MessageRuntime.ts +16 -20
  510. package/src/api/RuntimePathTypes.ts +26 -26
  511. package/src/api/ThreadListItemRuntime.ts +19 -11
  512. package/src/api/ThreadListRuntime.ts +39 -58
  513. package/src/api/ThreadRuntime.ts +52 -213
  514. package/src/api/index.ts +4 -0
  515. package/src/context/providers/AssistantRuntimeProvider.tsx +0 -1
  516. package/src/context/providers/TextContentPartProvider.tsx +0 -2
  517. package/src/context/providers/ThreadRuntimeProvider.tsx +1 -17
  518. package/src/context/react/AssistantContext.ts +0 -25
  519. package/src/context/react/ComposerContext.ts +1 -1
  520. package/src/context/react/ContentPartContext.ts +1 -1
  521. package/src/context/react/MessageContext.ts +2 -2
  522. package/src/context/react/ThreadContext.ts +5 -42
  523. package/src/context/react/index.ts +2 -125
  524. package/src/context/stores/AssistantToolUIs.ts +9 -2
  525. package/src/context/stores/MessageUtils.ts +6 -6
  526. package/src/context/stores/ThreadViewport.tsx +5 -6
  527. package/src/index.ts +0 -1
  528. package/src/internal.ts +1 -0
  529. package/src/model-config/useAssistantToolUI.tsx +0 -1
  530. package/src/primitive-hooks/contentPart/useContentPartDisplay.tsx +1 -1
  531. package/src/primitive-hooks/contentPart/useContentPartImage.tsx +1 -2
  532. package/src/primitive-hooks/contentPart/useContentPartText.tsx +1 -1
  533. package/src/primitive-hooks/index.ts +0 -5
  534. package/src/primitives/actionBar/ActionBarCopy.tsx +0 -5
  535. package/src/primitives/actionBar/ActionBarEdit.tsx +0 -5
  536. package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +0 -6
  537. package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +0 -6
  538. package/src/primitives/actionBar/ActionBarReload.tsx +0 -5
  539. package/src/primitives/actionBar/ActionBarRoot.tsx +0 -5
  540. package/src/primitives/actionBar/ActionBarSpeak.tsx +0 -5
  541. package/src/primitives/actionBar/ActionBarStopSpeaking.tsx +0 -6
  542. package/src/primitives/assistantModal/AssistantModalContent.tsx +1 -7
  543. package/src/primitives/assistantModal/AssistantModalRoot.tsx +0 -6
  544. package/src/primitives/assistantModal/AssistantModalTrigger.tsx +0 -6
  545. package/src/primitives/branchPicker/BranchPickerCount.tsx +0 -5
  546. package/src/primitives/branchPicker/BranchPickerNext.tsx +0 -6
  547. package/src/primitives/branchPicker/BranchPickerNumber.tsx +0 -5
  548. package/src/primitives/branchPicker/BranchPickerPrevious.tsx +1 -6
  549. package/src/primitives/branchPicker/BranchPickerRoot.tsx +0 -5
  550. package/src/primitives/composer/ComposerAddAttachment.tsx +2 -7
  551. package/src/primitives/composer/ComposerAttachments.tsx +0 -6
  552. package/src/primitives/composer/ComposerCancel.tsx +0 -5
  553. package/src/primitives/composer/ComposerIf.tsx +0 -5
  554. package/src/primitives/composer/ComposerInput.tsx +0 -5
  555. package/src/primitives/composer/ComposerRoot.tsx +1 -3
  556. package/src/primitives/composer/ComposerSend.tsx +2 -7
  557. package/src/primitives/contentPart/ContentPartDisplay.tsx +0 -6
  558. package/src/primitives/contentPart/ContentPartImage.tsx +0 -5
  559. package/src/primitives/contentPart/ContentPartInProgress.tsx +0 -6
  560. package/src/primitives/contentPart/ContentPartText.tsx +0 -5
  561. package/src/primitives/index.ts +0 -8
  562. package/src/primitives/message/MessageAttachments.tsx +2 -10
  563. package/src/primitives/message/MessageContent.tsx +7 -15
  564. package/src/primitives/message/MessageIf.tsx +0 -5
  565. package/src/primitives/message/MessageRoot.tsx +0 -5
  566. package/src/primitives/message/index.ts +0 -1
  567. package/src/primitives/thread/ThreadEmpty.tsx +1 -6
  568. package/src/primitives/thread/ThreadIf.tsx +0 -5
  569. package/src/primitives/thread/ThreadMessages.tsx +0 -5
  570. package/src/primitives/thread/ThreadRoot.tsx +0 -5
  571. package/src/primitives/thread/ThreadScrollToBottom.tsx +0 -6
  572. package/src/primitives/thread/ThreadSuggestion.tsx +0 -5
  573. package/src/primitives/thread/ThreadViewport.tsx +0 -5
  574. package/src/primitives/threadListItem/ThreadListItemArchive.ts +3 -2
  575. package/src/primitives/threadListItem/ThreadListItemRoot.tsx +29 -0
  576. package/src/primitives/threadListItem/ThreadListItemTitle.tsx +19 -0
  577. package/src/primitives/threadListItem/ThreadListItemTrigger.ts +25 -0
  578. package/src/primitives/threadListItem/index.ts +4 -1
  579. package/src/runtimes/attachment/AttachmentAdapter.ts +2 -12
  580. package/src/runtimes/attachment/CompositeAttachmentAdapter.ts +1 -1
  581. package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +0 -8
  582. package/src/runtimes/core/BaseThreadRuntimeCore.tsx +11 -5
  583. package/src/runtimes/core/ComposerRuntimeCore.tsx +0 -3
  584. package/src/runtimes/core/ThreadListRuntimeCore.tsx +7 -11
  585. package/src/runtimes/core/ThreadRuntimeCore.tsx +33 -17
  586. package/src/runtimes/core/index.ts +1 -2
  587. package/src/runtimes/edge/converters/toCoreMessages.ts +1 -1
  588. package/src/runtimes/edge/createEdgeRuntimeAPI.ts +0 -6
  589. package/src/runtimes/edge/streams/runResultStream.ts +0 -2
  590. package/src/runtimes/external-store/ExternalStoreAdapter.tsx +3 -17
  591. package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +0 -3
  592. package/src/runtimes/external-store/ExternalStoreThreadListRuntimeCore.tsx +39 -7
  593. package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +4 -3
  594. package/src/runtimes/external-store/ThreadMessageLike.tsx +4 -3
  595. package/src/runtimes/local/ChatModelAdapter.tsx +0 -9
  596. package/src/runtimes/local/LocalRuntimeOptions.tsx +1 -7
  597. package/src/runtimes/local/LocalThreadListRuntimeCore.tsx +140 -96
  598. package/src/runtimes/local/LocalThreadMetadataRuntimeCore.tsx +79 -0
  599. package/src/runtimes/local/LocalThreadRuntimeCore.tsx +16 -11
  600. package/src/types/AssistantTypes.ts +1 -20
  601. package/src/types/AttachmentTypes.ts +1 -2
  602. package/src/types/ContentPartComponentTypes.tsx +4 -31
  603. package/src/ui/assistant-message.tsx +0 -5
  604. package/src/ui/composer.tsx +0 -5
  605. package/src/ui/index.ts +5 -23
  606. package/src/ui/thread-welcome.tsx +6 -9
  607. package/src/ui/thread.tsx +0 -5
  608. package/src/ui/user-message.tsx +2 -12
  609. package/src/utils/smooth/SmoothContext.tsx +3 -3
  610. package/src/utils/smooth/useSmooth.tsx +0 -1
  611. package/dist/hooks/index.d.ts +0 -3
  612. package/dist/hooks/index.d.ts.map +0 -1
  613. package/dist/hooks/index.js +0 -34
  614. package/dist/hooks/index.js.map +0 -1
  615. package/dist/hooks/index.mjs +0 -8
  616. package/dist/hooks/index.mjs.map +0 -1
  617. package/dist/hooks/useAppendMessage.d.ts +0 -6
  618. package/dist/hooks/useAppendMessage.d.ts.map +0 -1
  619. package/dist/hooks/useAppendMessage.js +0 -42
  620. package/dist/hooks/useAppendMessage.js.map +0 -1
  621. package/dist/hooks/useAppendMessage.mjs +0 -17
  622. package/dist/hooks/useAppendMessage.mjs.map +0 -1
  623. package/dist/hooks/useSwitchToNewThread.d.ts +0 -5
  624. package/dist/hooks/useSwitchToNewThread.d.ts.map +0 -1
  625. package/dist/hooks/useSwitchToNewThread.js +0 -39
  626. package/dist/hooks/useSwitchToNewThread.js.map +0 -1
  627. package/dist/hooks/useSwitchToNewThread.mjs +0 -14
  628. package/dist/hooks/useSwitchToNewThread.mjs.map +0 -1
  629. package/dist/primitive-hooks/actionBar/index.d.ts +0 -34
  630. package/dist/primitive-hooks/actionBar/index.d.ts.map +0 -1
  631. package/dist/primitive-hooks/actionBar/index.js +0 -49
  632. package/dist/primitive-hooks/actionBar/index.js.map +0 -1
  633. package/dist/primitive-hooks/actionBar/index.mjs +0 -20
  634. package/dist/primitive-hooks/actionBar/index.mjs.map +0 -1
  635. package/dist/primitive-hooks/branchPicker/index.d.ts +0 -17
  636. package/dist/primitive-hooks/branchPicker/index.d.ts.map +0 -1
  637. package/dist/primitive-hooks/branchPicker/index.js +0 -40
  638. package/dist/primitive-hooks/branchPicker/index.js.map +0 -1
  639. package/dist/primitive-hooks/branchPicker/index.mjs +0 -12
  640. package/dist/primitive-hooks/branchPicker/index.mjs.map +0 -1
  641. package/dist/primitive-hooks/composer/index.d.ts +0 -17
  642. package/dist/primitive-hooks/composer/index.d.ts.map +0 -1
  643. package/dist/primitive-hooks/composer/index.js +0 -40
  644. package/dist/primitive-hooks/composer/index.js.map +0 -1
  645. package/dist/primitive-hooks/composer/index.mjs +0 -12
  646. package/dist/primitive-hooks/composer/index.mjs.map +0 -1
  647. package/dist/primitive-hooks/message/index.d.ts +0 -5
  648. package/dist/primitive-hooks/message/index.d.ts.map +0 -1
  649. package/dist/primitive-hooks/message/index.js +0 -31
  650. package/dist/primitive-hooks/message/index.js.map +0 -1
  651. package/dist/primitive-hooks/message/index.mjs +0 -6
  652. package/dist/primitive-hooks/message/index.mjs.map +0 -1
  653. package/dist/primitive-hooks/thread/index.d.ts +0 -17
  654. package/dist/primitive-hooks/thread/index.d.ts.map +0 -1
  655. package/dist/primitive-hooks/thread/index.js +0 -40
  656. package/dist/primitive-hooks/thread/index.js.map +0 -1
  657. package/dist/primitive-hooks/thread/index.mjs +0 -12
  658. package/dist/primitive-hooks/thread/index.mjs.map +0 -1
  659. package/dist/primitives/actionBar/types.d.ts +0 -9
  660. package/dist/primitives/actionBar/types.d.ts.map +0 -1
  661. package/dist/primitives/actionBar/types.js +0 -19
  662. package/dist/primitives/actionBar/types.js.map +0 -1
  663. package/dist/primitives/actionBar/types.mjs +0 -1
  664. package/dist/primitives/actionBar/types.mjs.map +0 -1
  665. package/dist/primitives/assistantModal/types.d.ts +0 -4
  666. package/dist/primitives/assistantModal/types.d.ts.map +0 -1
  667. package/dist/primitives/assistantModal/types.js +0 -19
  668. package/dist/primitives/assistantModal/types.js.map +0 -1
  669. package/dist/primitives/assistantModal/types.mjs +0 -1
  670. package/dist/primitives/assistantModal/types.mjs.map +0 -1
  671. package/dist/primitives/attachment/types.d.ts +0 -1
  672. package/dist/primitives/attachment/types.d.ts.map +0 -1
  673. package/dist/primitives/attachment/types.js +0 -2
  674. package/dist/primitives/attachment/types.js.map +0 -1
  675. package/dist/primitives/attachment/types.mjs +0 -1
  676. package/dist/primitives/attachment/types.mjs.map +0 -1
  677. package/dist/primitives/branchPicker/types.d.ts +0 -6
  678. package/dist/primitives/branchPicker/types.d.ts.map +0 -1
  679. package/dist/primitives/branchPicker/types.js +0 -19
  680. package/dist/primitives/branchPicker/types.js.map +0 -1
  681. package/dist/primitives/branchPicker/types.mjs +0 -1
  682. package/dist/primitives/branchPicker/types.mjs.map +0 -1
  683. package/dist/primitives/composer/types.d.ts +0 -6
  684. package/dist/primitives/composer/types.d.ts.map +0 -1
  685. package/dist/primitives/composer/types.js +0 -19
  686. package/dist/primitives/composer/types.js.map +0 -1
  687. package/dist/primitives/composer/types.mjs +0 -1
  688. package/dist/primitives/composer/types.mjs.map +0 -1
  689. package/dist/primitives/contentPart/types.d.ts +0 -5
  690. package/dist/primitives/contentPart/types.d.ts.map +0 -1
  691. package/dist/primitives/contentPart/types.js +0 -19
  692. package/dist/primitives/contentPart/types.js.map +0 -1
  693. package/dist/primitives/contentPart/types.mjs +0 -1
  694. package/dist/primitives/contentPart/types.mjs.map +0 -1
  695. package/dist/primitives/message/MessageInProgress.d.ts +0 -13
  696. package/dist/primitives/message/MessageInProgress.d.ts.map +0 -1
  697. package/dist/primitives/message/MessageInProgress.js.map +0 -1
  698. package/dist/primitives/message/MessageInProgress.mjs +0 -11
  699. package/dist/primitives/message/MessageInProgress.mjs.map +0 -1
  700. package/dist/primitives/message/types.d.ts +0 -5
  701. package/dist/primitives/message/types.d.ts.map +0 -1
  702. package/dist/primitives/message/types.js +0 -19
  703. package/dist/primitives/message/types.js.map +0 -1
  704. package/dist/primitives/message/types.mjs +0 -1
  705. package/dist/primitives/message/types.mjs.map +0 -1
  706. package/dist/primitives/thread/types.d.ts +0 -8
  707. package/dist/primitives/thread/types.d.ts.map +0 -1
  708. package/dist/primitives/thread/types.js +0 -19
  709. package/dist/primitives/thread/types.js.map +0 -1
  710. package/dist/primitives/thread/types.mjs +0 -1
  711. package/dist/primitives/thread/types.mjs.map +0 -1
  712. package/dist/runtimes/core/subscribeToMainThread.d.ts +0 -6
  713. package/dist/runtimes/core/subscribeToMainThread.d.ts.map +0 -1
  714. package/dist/runtimes/core/subscribeToMainThread.js.map +0 -1
  715. package/dist/runtimes/core/subscribeToMainThread.mjs +0 -23
  716. package/dist/runtimes/core/subscribeToMainThread.mjs.map +0 -1
  717. package/src/hooks/index.ts +0 -2
  718. package/src/hooks/useAppendMessage.tsx +0 -19
  719. package/src/hooks/useSwitchToNewThread.tsx +0 -14
  720. package/src/primitive-hooks/actionBar/index.ts +0 -39
  721. package/src/primitive-hooks/branchPicker/index.ts +0 -18
  722. package/src/primitive-hooks/composer/index.ts +0 -17
  723. package/src/primitive-hooks/message/index.ts +0 -4
  724. package/src/primitive-hooks/thread/index.ts +0 -16
  725. package/src/primitives/actionBar/types.ts +0 -8
  726. package/src/primitives/assistantModal/types.ts +0 -3
  727. package/src/primitives/attachment/types.ts +0 -0
  728. package/src/primitives/branchPicker/types.ts +0 -5
  729. package/src/primitives/composer/types.ts +0 -5
  730. package/src/primitives/contentPart/types.ts +0 -4
  731. package/src/primitives/message/MessageInProgress.tsx +0 -22
  732. package/src/primitives/message/types.ts +0 -4
  733. package/src/primitives/thread/types.ts +0 -7
  734. package/src/runtimes/core/subscribeToMainThread.ts +0 -30
@@ -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
  });
@@ -32,9 +32,9 @@ var import_ContentPartRuntime = require("./ContentPartRuntime.cjs");
32
32
  var import_NestedSubscriptionSubject = require("./subscribable/NestedSubscriptionSubject.cjs");
33
33
  var import_SKIP_UPDATE = require("./subscribable/SKIP_UPDATE.cjs");
34
34
  var import_ShallowMemoizeSubject = require("./subscribable/ShallowMemoizeSubject.cjs");
35
- var COMPLETE_STATUS = {
35
+ var COMPLETE_STATUS = Object.freeze({
36
36
  type: "complete"
37
- };
37
+ });
38
38
  var toContentPartStatus = (message, partIndex, part) => {
39
39
  if (message.role !== "assistant") return COMPLETE_STATUS;
40
40
  if (part.type === "tool-call") {
@@ -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
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/MessageRuntime.ts"],"sourcesContent":["import {\n SpeechState,\n SubmittedFeedback,\n} from \"../runtimes/core/ThreadRuntimeCore\";\nimport {\n ThreadMessage,\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n Unsubscribe,\n} from \"../types\";\nimport {\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { getThreadMessageText } from \"../utils/getThreadMessageText\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n MessageAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport {\n EditComposerRuntime,\n EditComposerRuntimeImpl,\n} from \"./ComposerRuntime\";\nimport {\n ContentPartRuntime,\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"./ContentPartRuntime\";\nimport { MessageRuntimePath } from \"./RuntimePathTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { NestedSubscriptionSubject } from \"./subscribable/NestedSubscriptionSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\n\nconst COMPLETE_STATUS: ContentPartStatus = {\n type: \"complete\",\n};\n\nexport const toContentPartStatus = (\n message: ThreadMessage,\n partIndex: number,\n part: ThreadUserContentPart | ThreadAssistantContentPart,\n): ToolCallContentPartStatus => {\n if (message.role !== \"assistant\") return COMPLETE_STATUS;\n\n if (part.type === \"tool-call\") {\n if (!part.result) {\n return message.status as ToolCallContentPartStatus;\n } else {\n return COMPLETE_STATUS;\n }\n }\n\n const isLastPart = partIndex === Math.max(0, message.content.length - 1);\n if (message.status.type === \"requires-action\") return COMPLETE_STATUS;\n return isLastPart ? (message.status as ContentPartStatus) : COMPLETE_STATUS;\n};\n\nexport const EMPTY_CONTENT = Object.freeze({ type: \"text\", text: \"\" });\n\nconst getContentPartState = (\n message: MessageState,\n partIndex: number,\n): ContentPartState | SKIP_UPDATE => {\n let part = message.content[partIndex];\n if (!part) {\n // for empty messages, show an empty text content part\n if (message.content.length === 0 && partIndex === 0) {\n part = EMPTY_CONTENT;\n } else {\n return SKIP_UPDATE;\n }\n } else if (\n message.content.length === 1 &&\n part.type === \"text\" &&\n part.text.length === 0\n ) {\n // ensure reference equality for equivalent empty text parts\n part = EMPTY_CONTENT;\n }\n\n // if the content part is the same, don't update\n const status = toContentPartStatus(message, partIndex, part);\n return Object.freeze({ ...part, part, status });\n};\n\nexport type MessageState = ThreadMessage & {\n /**\n * @deprecated You can directly access message fields in the state. Replace `.message.content` with `.content` etc. This will be removed in 0.6.0.\n */\n message: ThreadMessage;\n parentId: string | null;\n isLast: boolean;\n /**\n * @deprecated Use `branchNumber` and `branchCount` instead. This will be removed in 0.6.0.\n */\n branches: readonly string[];\n\n branchNumber: number;\n branchCount: number;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speech: SpeechState | undefined;\n submittedFeedback: SubmittedFeedback | undefined;\n};\n\nexport type MessageStateBinding = SubscribableWithState<\n MessageState,\n MessageRuntimePath\n>;\n\nexport type MessageRuntime = {\n readonly path: MessageRuntimePath;\n\n readonly composer: EditComposerRuntime;\n\n getState(): MessageState;\n reload(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speak(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking(): void;\n submitFeedback({ type }: { type: \"positive\" | \"negative\" }): void;\n switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }): void;\n unstable_getCopyText(): string;\n\n subscribe(callback: () => void): Unsubscribe;\n\n getContentPartByIndex(idx: number): ContentPartRuntime;\n getContentPartByToolCallId(toolCallId: string): ContentPartRuntime;\n\n getAttachmentByIndex(idx: number): AttachmentRuntime & { source: \"message\" };\n};\n\nexport class MessageRuntimeImpl implements MessageRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: MessageStateBinding,\n private _threadBinding: ThreadRuntimeCoreBinding,\n ) {\n this.composer = new EditComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.composer`,\n composerSource: \"edit\",\n },\n getState: () =>\n this._threadBinding\n .getState()\n .getEditComposer(this._core.getState().id),\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n () => this._threadBinding.getState().beginEdit(this._core.getState().id),\n );\n }\n\n public composer;\n\n public getState() {\n return this._core.getState();\n }\n\n public reload() {\n const state = this._core.getState();\n if (state.role !== \"assistant\")\n throw new Error(\"Can only reload assistant messages\");\n\n this._threadBinding.getState().startRun(state.parentId);\n }\n\n public speak() {\n const state = this._core.getState();\n return this._threadBinding.getState().speak(state.id);\n }\n\n public stopSpeaking() {\n const state = this._core.getState();\n const thread = this._threadBinding.getState();\n if (thread.speech?.messageId === state.id) {\n this._threadBinding.getState().stopSpeaking();\n } else {\n throw new Error(\"Message is not being spoken\");\n }\n }\n\n public submitFeedback({ type }: { type: \"positive\" | \"negative\" }) {\n const state = this._core.getState();\n this._threadBinding.getState().submitFeedback({\n messageId: state.id,\n type,\n });\n }\n\n public switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }) {\n const state = this._core.getState();\n if (branchId && position) {\n throw new Error(\"May not specify both branchId and position\");\n } else if (!branchId && !position) {\n throw new Error(\"Must specify either branchId or position\");\n }\n\n const thread = this._threadBinding.getState();\n const branches = thread.getBranches(state.id);\n let targetBranch = branchId;\n if (position === \"previous\") {\n targetBranch = branches[state.branchNumber - 2];\n } else if (position === \"next\") {\n targetBranch = branches[state.branchNumber];\n }\n if (!targetBranch) throw new Error(\"Branch not found\");\n\n this._threadBinding.getState().switchToBranch(targetBranch);\n }\n\n public unstable_getCopyText() {\n return getThreadMessageText(this.getState());\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getContentPartByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Content part index must be >= 0\");\n return new ContentPartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.content[${idx}]`,\n contentPartSelector: { type: \"index\", index: idx },\n },\n getState: () => {\n return getContentPartState(this.getState(), idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getContentPartByToolCallId(toolCallId: string) {\n return new ContentPartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.content[toolCallId=${JSON.stringify(toolCallId)}]`,\n contentPartSelector: { type: \"toolCallId\", toolCallId },\n },\n getState: () => {\n const state = this._core.getState();\n const idx = state.content.findIndex(\n (part) =>\n part.type === \"tool-call\" && part.toolCallId === toolCallId,\n );\n if (idx === -1) return SKIP_UPDATE;\n return getContentPartState(state, idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getAttachmentByIndex(idx: number) {\n return new MessageAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n attachmentSource: \"message\",\n attachmentSelector: { type: \"index\", index: 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: \"message\",\n } satisfies AttachmentState & { source: \"message\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,kCAAqC;AACrC,+BAIO;AACP,6BAGO;AACP,gCAIO;AAGP,uCAA0C;AAC1C,yBAA4B;AAC5B,mCAAsC;AAGtC,IAAM,kBAAqC;AAAA,EACzC,MAAM;AACR;AAEO,IAAM,sBAAsB,CACjC,SACA,WACA,SAC8B;AAC9B,MAAI,QAAQ,SAAS,YAAa,QAAO;AAEzC,MAAI,KAAK,SAAS,aAAa;AAC7B,QAAI,CAAC,KAAK,QAAQ;AAChB,aAAO,QAAQ;AAAA,IACjB,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,aAAa,cAAc,KAAK,IAAI,GAAG,QAAQ,QAAQ,SAAS,CAAC;AACvE,MAAI,QAAQ,OAAO,SAAS,kBAAmB,QAAO;AACtD,SAAO,aAAc,QAAQ,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K;AAAA,IACP;AAAA,EACF;AAAA,EAEO,qBAAqB,KAAa;AACvC,WAAO,IAAI;AAAA,MACT,IAAI,mDAAsB;AAAA,QACxB,MAAM;AAAA,UACJ,GAAG,KAAK;AAAA,UACR,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,KAAK,GAAG,gBAAgB,GAAG;AAAA,UACxD,kBAAkB;AAAA,UAClB,oBAAoB,EAAE,MAAM,SAAS,OAAO,IAAI;AAAA,QAClD;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,cAAc,GAAG;AACpC,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,IACH;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/api/MessageRuntime.ts"],"sourcesContent":["import {\n SpeechState,\n SubmittedFeedback,\n} from \"../runtimes/core/ThreadRuntimeCore\";\nimport {\n ThreadMessage,\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n Unsubscribe,\n} from \"../types\";\nimport {\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { getThreadMessageText } from \"../utils/getThreadMessageText\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n MessageAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport {\n EditComposerRuntime,\n EditComposerRuntimeImpl,\n} from \"./ComposerRuntime\";\nimport {\n ContentPartRuntime,\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"./ContentPartRuntime\";\nimport { MessageRuntimePath } from \"./RuntimePathTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { NestedSubscriptionSubject } from \"./subscribable/NestedSubscriptionSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\n\nconst COMPLETE_STATUS: ContentPartStatus = Object.freeze({\n type: \"complete\",\n});\n\nexport const toContentPartStatus = (\n message: ThreadMessage,\n partIndex: number,\n part: ThreadUserContentPart | ThreadAssistantContentPart,\n): ToolCallContentPartStatus => {\n if (message.role !== \"assistant\") return COMPLETE_STATUS;\n\n if (part.type === \"tool-call\") {\n if (!part.result) {\n return message.status as ToolCallContentPartStatus;\n } else {\n return COMPLETE_STATUS;\n }\n }\n\n const isLastPart = partIndex === Math.max(0, message.content.length - 1);\n if (message.status.type === \"requires-action\") return COMPLETE_STATUS;\n return isLastPart ? (message.status as ContentPartStatus) : COMPLETE_STATUS;\n};\n\nexport const EMPTY_CONTENT_SYMBOL = Symbol(\"empty-content\");\nconst EMPTY_CONTENT = Object.freeze({\n type: \"text\",\n text: \"\",\n [EMPTY_CONTENT_SYMBOL]: true,\n});\n\nconst getContentPartState = (\n message: MessageState,\n partIndex: number,\n): ContentPartState | SKIP_UPDATE => {\n let part = message.content[partIndex];\n if (!part) {\n // for empty messages, show an empty text content part\n if (message.content.length === 0 && partIndex === 0) {\n part = EMPTY_CONTENT;\n } else {\n return SKIP_UPDATE;\n }\n } else if (\n message.content.length === 1 &&\n part.type === \"text\" &&\n part.text.length === 0\n ) {\n // ensure reference equality for equivalent empty text parts\n part = EMPTY_CONTENT;\n }\n\n // if the content part is the same, don't update\n const status = toContentPartStatus(message, partIndex, part);\n return Object.freeze({ ...part, status });\n};\n\nexport type MessageState = ThreadMessage & {\n readonly parentId: string | null;\n readonly isLast: boolean;\n\n readonly branchNumber: number;\n readonly branchCount: number;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n readonly speech: SpeechState | undefined;\n readonly submittedFeedback: SubmittedFeedback | undefined;\n};\n\nexport type MessageStateBinding = SubscribableWithState<\n MessageState,\n MessageRuntimePath\n>;\n\nexport type MessageRuntime = {\n readonly path: MessageRuntimePath;\n\n readonly composer: EditComposerRuntime;\n\n getState(): MessageState;\n reload(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speak(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking(): void;\n submitFeedback({ type }: { type: \"positive\" | \"negative\" }): void;\n switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }): void;\n unstable_getCopyText(): string;\n\n subscribe(callback: () => void): Unsubscribe;\n\n getContentPartByIndex(idx: number): ContentPartRuntime;\n getContentPartByToolCallId(toolCallId: string): ContentPartRuntime;\n\n getAttachmentByIndex(idx: number): AttachmentRuntime & { source: \"message\" };\n};\n\nexport class MessageRuntimeImpl implements MessageRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: MessageStateBinding,\n private _threadBinding: ThreadRuntimeCoreBinding,\n ) {\n this.composer = new EditComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.composer`,\n composerSource: \"edit\",\n },\n getState: () =>\n this._threadBinding\n .getState()\n .getEditComposer(this._core.getState().id),\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n () => this._threadBinding.getState().beginEdit(this._core.getState().id),\n );\n }\n\n public readonly composer;\n\n public getState() {\n return this._core.getState();\n }\n\n public reload() {\n const state = this._core.getState();\n if (state.role !== \"assistant\")\n throw new Error(\"Can only reload assistant messages\");\n\n this._threadBinding.getState().startRun(state.parentId);\n }\n\n public speak() {\n const state = this._core.getState();\n return this._threadBinding.getState().speak(state.id);\n }\n\n public stopSpeaking() {\n const state = this._core.getState();\n const thread = this._threadBinding.getState();\n if (thread.speech?.messageId === state.id) {\n this._threadBinding.getState().stopSpeaking();\n } else {\n throw new Error(\"Message is not being spoken\");\n }\n }\n\n public submitFeedback({ type }: { type: \"positive\" | \"negative\" }) {\n const state = this._core.getState();\n this._threadBinding.getState().submitFeedback({\n messageId: state.id,\n type,\n });\n }\n\n public switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }) {\n const state = this._core.getState();\n if (branchId && position) {\n throw new Error(\"May not specify both branchId and position\");\n } else if (!branchId && !position) {\n throw new Error(\"Must specify either branchId or position\");\n }\n\n const thread = this._threadBinding.getState();\n const branches = thread.getBranches(state.id);\n let targetBranch = branchId;\n if (position === \"previous\") {\n targetBranch = branches[state.branchNumber - 2];\n } else if (position === \"next\") {\n targetBranch = branches[state.branchNumber];\n }\n if (!targetBranch) throw new Error(\"Branch not found\");\n\n this._threadBinding.getState().switchToBranch(targetBranch);\n }\n\n public unstable_getCopyText() {\n return getThreadMessageText(this.getState());\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getContentPartByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Content part index must be >= 0\");\n return new ContentPartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.content[${idx}]`,\n contentPartSelector: { type: \"index\", index: idx },\n },\n getState: () => {\n return getContentPartState(this.getState(), idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getContentPartByToolCallId(toolCallId: string) {\n return new ContentPartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.content[toolCallId=${JSON.stringify(toolCallId)}]`,\n contentPartSelector: { type: \"toolCallId\", toolCallId },\n },\n getState: () => {\n const state = this._core.getState();\n const idx = state.content.findIndex(\n (part) =>\n part.type === \"tool-call\" && part.toolCallId === toolCallId,\n );\n if (idx === -1) return SKIP_UPDATE;\n return getContentPartState(state, idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getAttachmentByIndex(idx: number) {\n return new MessageAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n attachmentSource: \"message\",\n attachmentSelector: { type: \"index\", index: 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: \"message\",\n } satisfies AttachmentState & { source: \"message\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA,kCAAqC;AACrC,+BAIO;AACP,6BAGO;AACP,gCAIO;AAGP,uCAA0C;AAC1C,yBAA4B;AAC5B,mCAAsC;AAGtC,IAAM,kBAAqC,OAAO,OAAO;AAAA,EACvD,MAAM;AACR,CAAC;AAEM,IAAM,sBAAsB,CACjC,SACA,WACA,SAC8B;AAC9B,MAAI,QAAQ,SAAS,YAAa,QAAO;AAEzC,MAAI,KAAK,SAAS,aAAa;AAC7B,QAAI,CAAC,KAAK,QAAQ;AAChB,aAAO,QAAQ;AAAA,IACjB,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,aAAa,cAAc,KAAK,IAAI,GAAG,QAAQ,QAAQ,SAAS,CAAC;AACvE,MAAI,QAAQ,OAAO,SAAS,kBAAmB,QAAO;AACtD,SAAO,aAAc,QAAQ,SAA+B;AAC9D;AAEO,IAAM,uBAAuB,OAAO,eAAe;AAC1D,IAAM,gBAAgB,OAAO,OAAO;AAAA,EAClC,MAAM;AAAA,EACN,MAAM;AAAA,EACN,CAAC,oBAAoB,GAAG;AAC1B,CAAC;AAED,IAAM,sBAAsB,CAC1B,SACA,cACmC;AACnC,MAAI,OAAO,QAAQ,QAAQ,SAAS;AACpC,MAAI,CAAC,MAAM;AAET,QAAI,QAAQ,QAAQ,WAAW,KAAK,cAAc,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A,UAClB,oBAAoB,EAAE,MAAM,SAAS,OAAO,IAAI;AAAA,QAClD;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,cAAc,GAAG;AACpC,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,IACH;AAAA,EACF;AACF;","names":[]}
@@ -12,9 +12,9 @@ import {
12
12
  import { NestedSubscriptionSubject } from "./subscribable/NestedSubscriptionSubject.mjs";
13
13
  import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE.mjs";
14
14
  import { ShallowMemoizeSubject } from "./subscribable/ShallowMemoizeSubject.mjs";
15
- var COMPLETE_STATUS = {
15
+ var COMPLETE_STATUS = Object.freeze({
16
16
  type: "complete"
17
- };
17
+ });
18
18
  var toContentPartStatus = (message, partIndex, part) => {
19
19
  if (message.role !== "assistant") return COMPLETE_STATUS;
20
20
  if (part.type === "tool-call") {
@@ -28,7 +28,12 @@ var toContentPartStatus = (message, partIndex, part) => {
28
28
  if (message.status.type === "requires-action") return COMPLETE_STATUS;
29
29
  return isLastPart ? message.status : COMPLETE_STATUS;
30
30
  };
31
- var EMPTY_CONTENT = Object.freeze({ type: "text", text: "" });
31
+ var EMPTY_CONTENT_SYMBOL = Symbol("empty-content");
32
+ var EMPTY_CONTENT = Object.freeze({
33
+ type: "text",
34
+ text: "",
35
+ [EMPTY_CONTENT_SYMBOL]: true
36
+ });
32
37
  var getContentPartState = (message, partIndex) => {
33
38
  let part = message.content[partIndex];
34
39
  if (!part) {
@@ -41,7 +46,7 @@ var getContentPartState = (message, partIndex) => {
41
46
  part = EMPTY_CONTENT;
42
47
  }
43
48
  const status = toContentPartStatus(message, partIndex, part);
44
- return Object.freeze({ ...part, part, status });
49
+ return Object.freeze({ ...part, status });
45
50
  };
46
51
  var MessageRuntimeImpl = class {
47
52
  constructor(_core, _threadBinding) {
@@ -175,7 +180,6 @@ var MessageRuntimeImpl = class {
175
180
  if (!attachment) return SKIP_UPDATE;
176
181
  return {
177
182
  ...attachment,
178
- attachment,
179
183
  source: "message"
180
184
  };
181
185
  },
@@ -185,7 +189,7 @@ var MessageRuntimeImpl = class {
185
189
  }
186
190
  };
187
191
  export {
188
- EMPTY_CONTENT,
192
+ EMPTY_CONTENT_SYMBOL,
189
193
  MessageRuntimeImpl,
190
194
  toContentPartStatus
191
195
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/MessageRuntime.ts"],"sourcesContent":["import {\n SpeechState,\n SubmittedFeedback,\n} from \"../runtimes/core/ThreadRuntimeCore\";\nimport {\n ThreadMessage,\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n Unsubscribe,\n} from \"../types\";\nimport {\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { getThreadMessageText } from \"../utils/getThreadMessageText\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n MessageAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport {\n EditComposerRuntime,\n EditComposerRuntimeImpl,\n} from \"./ComposerRuntime\";\nimport {\n ContentPartRuntime,\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"./ContentPartRuntime\";\nimport { MessageRuntimePath } from \"./RuntimePathTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { NestedSubscriptionSubject } from \"./subscribable/NestedSubscriptionSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\n\nconst COMPLETE_STATUS: ContentPartStatus = {\n type: \"complete\",\n};\n\nexport const toContentPartStatus = (\n message: ThreadMessage,\n partIndex: number,\n part: ThreadUserContentPart | ThreadAssistantContentPart,\n): ToolCallContentPartStatus => {\n if (message.role !== \"assistant\") return COMPLETE_STATUS;\n\n if (part.type === \"tool-call\") {\n if (!part.result) {\n return message.status as ToolCallContentPartStatus;\n } else {\n return COMPLETE_STATUS;\n }\n }\n\n const isLastPart = partIndex === Math.max(0, message.content.length - 1);\n if (message.status.type === \"requires-action\") return COMPLETE_STATUS;\n return isLastPart ? (message.status as ContentPartStatus) : COMPLETE_STATUS;\n};\n\nexport const EMPTY_CONTENT = Object.freeze({ type: \"text\", text: \"\" });\n\nconst getContentPartState = (\n message: MessageState,\n partIndex: number,\n): ContentPartState | SKIP_UPDATE => {\n let part = message.content[partIndex];\n if (!part) {\n // for empty messages, show an empty text content part\n if (message.content.length === 0 && partIndex === 0) {\n part = EMPTY_CONTENT;\n } else {\n return SKIP_UPDATE;\n }\n } else if (\n message.content.length === 1 &&\n part.type === \"text\" &&\n part.text.length === 0\n ) {\n // ensure reference equality for equivalent empty text parts\n part = EMPTY_CONTENT;\n }\n\n // if the content part is the same, don't update\n const status = toContentPartStatus(message, partIndex, part);\n return Object.freeze({ ...part, part, status });\n};\n\nexport type MessageState = ThreadMessage & {\n /**\n * @deprecated You can directly access message fields in the state. Replace `.message.content` with `.content` etc. This will be removed in 0.6.0.\n */\n message: ThreadMessage;\n parentId: string | null;\n isLast: boolean;\n /**\n * @deprecated Use `branchNumber` and `branchCount` instead. This will be removed in 0.6.0.\n */\n branches: readonly string[];\n\n branchNumber: number;\n branchCount: number;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speech: SpeechState | undefined;\n submittedFeedback: SubmittedFeedback | undefined;\n};\n\nexport type MessageStateBinding = SubscribableWithState<\n MessageState,\n MessageRuntimePath\n>;\n\nexport type MessageRuntime = {\n readonly path: MessageRuntimePath;\n\n readonly composer: EditComposerRuntime;\n\n getState(): MessageState;\n reload(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speak(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking(): void;\n submitFeedback({ type }: { type: \"positive\" | \"negative\" }): void;\n switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }): void;\n unstable_getCopyText(): string;\n\n subscribe(callback: () => void): Unsubscribe;\n\n getContentPartByIndex(idx: number): ContentPartRuntime;\n getContentPartByToolCallId(toolCallId: string): ContentPartRuntime;\n\n getAttachmentByIndex(idx: number): AttachmentRuntime & { source: \"message\" };\n};\n\nexport class MessageRuntimeImpl implements MessageRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: MessageStateBinding,\n private _threadBinding: ThreadRuntimeCoreBinding,\n ) {\n this.composer = new EditComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.composer`,\n composerSource: \"edit\",\n },\n getState: () =>\n this._threadBinding\n .getState()\n .getEditComposer(this._core.getState().id),\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n () => this._threadBinding.getState().beginEdit(this._core.getState().id),\n );\n }\n\n public composer;\n\n public getState() {\n return this._core.getState();\n }\n\n public reload() {\n const state = this._core.getState();\n if (state.role !== \"assistant\")\n throw new Error(\"Can only reload assistant messages\");\n\n this._threadBinding.getState().startRun(state.parentId);\n }\n\n public speak() {\n const state = this._core.getState();\n return this._threadBinding.getState().speak(state.id);\n }\n\n public stopSpeaking() {\n const state = this._core.getState();\n const thread = this._threadBinding.getState();\n if (thread.speech?.messageId === state.id) {\n this._threadBinding.getState().stopSpeaking();\n } else {\n throw new Error(\"Message is not being spoken\");\n }\n }\n\n public submitFeedback({ type }: { type: \"positive\" | \"negative\" }) {\n const state = this._core.getState();\n this._threadBinding.getState().submitFeedback({\n messageId: state.id,\n type,\n });\n }\n\n public switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }) {\n const state = this._core.getState();\n if (branchId && position) {\n throw new Error(\"May not specify both branchId and position\");\n } else if (!branchId && !position) {\n throw new Error(\"Must specify either branchId or position\");\n }\n\n const thread = this._threadBinding.getState();\n const branches = thread.getBranches(state.id);\n let targetBranch = branchId;\n if (position === \"previous\") {\n targetBranch = branches[state.branchNumber - 2];\n } else if (position === \"next\") {\n targetBranch = branches[state.branchNumber];\n }\n if (!targetBranch) throw new Error(\"Branch not found\");\n\n this._threadBinding.getState().switchToBranch(targetBranch);\n }\n\n public unstable_getCopyText() {\n return getThreadMessageText(this.getState());\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getContentPartByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Content part index must be >= 0\");\n return new ContentPartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.content[${idx}]`,\n contentPartSelector: { type: \"index\", index: idx },\n },\n getState: () => {\n return getContentPartState(this.getState(), idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getContentPartByToolCallId(toolCallId: string) {\n return new ContentPartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.content[toolCallId=${JSON.stringify(toolCallId)}]`,\n contentPartSelector: { type: \"toolCallId\", toolCallId },\n },\n getState: () => {\n const state = this._core.getState();\n const idx = state.content.findIndex(\n (part) =>\n part.type === \"tool-call\" && part.toolCallId === toolCallId,\n );\n if (idx === -1) return SKIP_UPDATE;\n return getContentPartState(state, idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getAttachmentByIndex(idx: number) {\n return new MessageAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n attachmentSource: \"message\",\n attachmentSelector: { type: \"index\", index: 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: \"message\",\n } satisfies AttachmentState & { source: \"message\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n );\n }\n}\n"],"mappings":";AAcA,SAAS,4BAA4B;AACrC;AAAA,EAGE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OAEK;AAGP,SAAS,iCAAiC;AAC1C,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AAGtC,IAAM,kBAAqC;AAAA,EACzC,MAAM;AACR;AAEO,IAAM,sBAAsB,CACjC,SACA,WACA,SAC8B;AAC9B,MAAI,QAAQ,SAAS,YAAa,QAAO;AAEzC,MAAI,KAAK,SAAS,aAAa;AAC7B,QAAI,CAAC,KAAK,QAAQ;AAChB,aAAO,QAAQ;AAAA,IACjB,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AAEA,QAAM,aAAa,cAAc,KAAK,IAAI,GAAG,QAAQ,QAAQ,SAAS,CAAC;AACvE,MAAI,QAAQ,OAAO,SAAS,kBAAmB,QAAO;AACtD,SAAO,aAAc,QAAQ,SAA+B;AAC9D;AAEO,IAAM,gBAAgB,OAAO,OAAO,EAAE,MAAM,QAAQ,MAAM,GAAG,CAAC;AAErE,IAAM,sBAAsB,CAC1B,SACA,cACmC;AACnC,MAAI,OAAO,QAAQ,QAAQ,SAAS;AACpC,MAAI,CAAC,MAAM;AAET,QAAI,QAAQ,QAAQ,WAAW,KAAK,cAAc,GAAG;AACnD,aAAO;AAAA,IACT,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF,WACE,QAAQ,QAAQ,WAAW,KAC3B,KAAK,SAAS,UACd,KAAK,KAAK,WAAW,GACrB;AAEA,WAAO;AAAA,EACT;AAGA,QAAM,SAAS,oBAAoB,SAAS,WAAW,IAAI;AAC3D,SAAO,OAAO,OAAO,EAAE,GAAG,MAAM,MAA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AAA,QACF;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/api/MessageRuntime.ts"],"sourcesContent":["import {\n SpeechState,\n SubmittedFeedback,\n} from \"../runtimes/core/ThreadRuntimeCore\";\nimport {\n ThreadMessage,\n ThreadAssistantContentPart,\n ThreadUserContentPart,\n Unsubscribe,\n} from \"../types\";\nimport {\n ContentPartStatus,\n ToolCallContentPartStatus,\n} from \"../types/AssistantTypes\";\nimport { getThreadMessageText } from \"../utils/getThreadMessageText\";\nimport {\n AttachmentRuntime,\n AttachmentState,\n MessageAttachmentRuntimeImpl,\n} from \"./AttachmentRuntime\";\nimport {\n EditComposerRuntime,\n EditComposerRuntimeImpl,\n} from \"./ComposerRuntime\";\nimport {\n ContentPartRuntime,\n ContentPartRuntimeImpl,\n ContentPartState,\n} from \"./ContentPartRuntime\";\nimport { MessageRuntimePath } from \"./RuntimePathTypes\";\nimport { ThreadRuntimeCoreBinding } from \"./ThreadRuntime\";\nimport { NestedSubscriptionSubject } from \"./subscribable/NestedSubscriptionSubject\";\nimport { SKIP_UPDATE } from \"./subscribable/SKIP_UPDATE\";\nimport { ShallowMemoizeSubject } from \"./subscribable/ShallowMemoizeSubject\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\n\nconst COMPLETE_STATUS: ContentPartStatus = Object.freeze({\n type: \"complete\",\n});\n\nexport const toContentPartStatus = (\n message: ThreadMessage,\n partIndex: number,\n part: ThreadUserContentPart | ThreadAssistantContentPart,\n): ToolCallContentPartStatus => {\n if (message.role !== \"assistant\") return COMPLETE_STATUS;\n\n if (part.type === \"tool-call\") {\n if (!part.result) {\n return message.status as ToolCallContentPartStatus;\n } else {\n return COMPLETE_STATUS;\n }\n }\n\n const isLastPart = partIndex === Math.max(0, message.content.length - 1);\n if (message.status.type === \"requires-action\") return COMPLETE_STATUS;\n return isLastPart ? (message.status as ContentPartStatus) : COMPLETE_STATUS;\n};\n\nexport const EMPTY_CONTENT_SYMBOL = Symbol(\"empty-content\");\nconst EMPTY_CONTENT = Object.freeze({\n type: \"text\",\n text: \"\",\n [EMPTY_CONTENT_SYMBOL]: true,\n});\n\nconst getContentPartState = (\n message: MessageState,\n partIndex: number,\n): ContentPartState | SKIP_UPDATE => {\n let part = message.content[partIndex];\n if (!part) {\n // for empty messages, show an empty text content part\n if (message.content.length === 0 && partIndex === 0) {\n part = EMPTY_CONTENT;\n } else {\n return SKIP_UPDATE;\n }\n } else if (\n message.content.length === 1 &&\n part.type === \"text\" &&\n part.text.length === 0\n ) {\n // ensure reference equality for equivalent empty text parts\n part = EMPTY_CONTENT;\n }\n\n // if the content part is the same, don't update\n const status = toContentPartStatus(message, partIndex, part);\n return Object.freeze({ ...part, status });\n};\n\nexport type MessageState = ThreadMessage & {\n readonly parentId: string | null;\n readonly isLast: boolean;\n\n readonly branchNumber: number;\n readonly branchCount: number;\n\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n readonly speech: SpeechState | undefined;\n readonly submittedFeedback: SubmittedFeedback | undefined;\n};\n\nexport type MessageStateBinding = SubscribableWithState<\n MessageState,\n MessageRuntimePath\n>;\n\nexport type MessageRuntime = {\n readonly path: MessageRuntimePath;\n\n readonly composer: EditComposerRuntime;\n\n getState(): MessageState;\n reload(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n speak(): void;\n /**\n * @deprecated This API is still under active development and might change without notice.\n */\n stopSpeaking(): void;\n submitFeedback({ type }: { type: \"positive\" | \"negative\" }): void;\n switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }): void;\n unstable_getCopyText(): string;\n\n subscribe(callback: () => void): Unsubscribe;\n\n getContentPartByIndex(idx: number): ContentPartRuntime;\n getContentPartByToolCallId(toolCallId: string): ContentPartRuntime;\n\n getAttachmentByIndex(idx: number): AttachmentRuntime & { source: \"message\" };\n};\n\nexport class MessageRuntimeImpl implements MessageRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: MessageStateBinding,\n private _threadBinding: ThreadRuntimeCoreBinding,\n ) {\n this.composer = new EditComposerRuntimeImpl(\n new NestedSubscriptionSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.composer`,\n composerSource: \"edit\",\n },\n getState: () =>\n this._threadBinding\n .getState()\n .getEditComposer(this._core.getState().id),\n subscribe: (callback) => this._threadBinding.subscribe(callback),\n }),\n () => this._threadBinding.getState().beginEdit(this._core.getState().id),\n );\n }\n\n public readonly composer;\n\n public getState() {\n return this._core.getState();\n }\n\n public reload() {\n const state = this._core.getState();\n if (state.role !== \"assistant\")\n throw new Error(\"Can only reload assistant messages\");\n\n this._threadBinding.getState().startRun(state.parentId);\n }\n\n public speak() {\n const state = this._core.getState();\n return this._threadBinding.getState().speak(state.id);\n }\n\n public stopSpeaking() {\n const state = this._core.getState();\n const thread = this._threadBinding.getState();\n if (thread.speech?.messageId === state.id) {\n this._threadBinding.getState().stopSpeaking();\n } else {\n throw new Error(\"Message is not being spoken\");\n }\n }\n\n public submitFeedback({ type }: { type: \"positive\" | \"negative\" }) {\n const state = this._core.getState();\n this._threadBinding.getState().submitFeedback({\n messageId: state.id,\n type,\n });\n }\n\n public switchToBranch({\n position,\n branchId,\n }: {\n position?: \"previous\" | \"next\" | undefined;\n branchId?: string | undefined;\n }) {\n const state = this._core.getState();\n if (branchId && position) {\n throw new Error(\"May not specify both branchId and position\");\n } else if (!branchId && !position) {\n throw new Error(\"Must specify either branchId or position\");\n }\n\n const thread = this._threadBinding.getState();\n const branches = thread.getBranches(state.id);\n let targetBranch = branchId;\n if (position === \"previous\") {\n targetBranch = branches[state.branchNumber - 2];\n } else if (position === \"next\") {\n targetBranch = branches[state.branchNumber];\n }\n if (!targetBranch) throw new Error(\"Branch not found\");\n\n this._threadBinding.getState().switchToBranch(targetBranch);\n }\n\n public unstable_getCopyText() {\n return getThreadMessageText(this.getState());\n }\n\n public subscribe(callback: () => void) {\n return this._core.subscribe(callback);\n }\n\n public getContentPartByIndex(idx: number) {\n if (idx < 0) throw new Error(\"Content part index must be >= 0\");\n return new ContentPartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.content[${idx}]`,\n contentPartSelector: { type: \"index\", index: idx },\n },\n getState: () => {\n return getContentPartState(this.getState(), idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getContentPartByToolCallId(toolCallId: string) {\n return new ContentPartRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref:\n this.path.ref +\n `${this.path.ref}.content[toolCallId=${JSON.stringify(toolCallId)}]`,\n contentPartSelector: { type: \"toolCallId\", toolCallId },\n },\n getState: () => {\n const state = this._core.getState();\n const idx = state.content.findIndex(\n (part) =>\n part.type === \"tool-call\" && part.toolCallId === toolCallId,\n );\n if (idx === -1) return SKIP_UPDATE;\n return getContentPartState(state, idx);\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n this._core,\n this._threadBinding,\n );\n }\n\n public getAttachmentByIndex(idx: number) {\n return new MessageAttachmentRuntimeImpl(\n new ShallowMemoizeSubject({\n path: {\n ...this.path,\n ref: this.path.ref + `${this.path.ref}.attachments[${idx}]`,\n attachmentSource: \"message\",\n attachmentSelector: { type: \"index\", index: 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: \"message\",\n } satisfies AttachmentState & { source: \"message\" };\n },\n subscribe: (callback) => this._core.subscribe(callback),\n }),\n );\n }\n}\n"],"mappings":";AAcA,SAAS,4BAA4B;AACrC;AAAA,EAGE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OAEK;AAGP,SAAS,iCAAiC;AAC1C,S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AA,QACxB,MAAM;AAAA,UACJ,GAAG,KAAK;AAAA,UACR,KACE,KAAK,KAAK,MACV,GAAG,KAAK,KAAK,GAAG,uBAAuB,KAAK,UAAU,UAAU,CAAC;AAAA,UACnE,qBAAqB,EAAE,MAAM,cAAc,WAAW;AAAA,QACxD;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,QAAQ,KAAK,MAAM,SAAS;AAClC,gBAAM,MAAM,MAAM,QAAQ;AAAA,YACxB,CAAC,SACC,KAAK,SAAS,eAAe,KAAK,eAAe;AAAA,UACrD;AACA,cAAI,QAAQ,GAAI,QAAO;AACvB,iBAAO,oBAAoB,OAAO,GAAG;AAAA,QACvC;AAAA,QACA,WAAW,CAAC,aAAa,KAAK,MAAM,UAAU,QAAQ;AAAA,MACxD,CAAC;AAAA,MACD,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EAEO,qBAAqB,KAAa;AACvC,WAAO,IAAI;AAAA,MACT,IAAI,sBAAsB;AAAA,QACxB,MAAM;AAAA,UACJ,GAAG,KAAK;AAAA,UACR,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,KAAK,GAAG,gBAAgB,GAAG;AAAA,UACxD,kBAAkB;AAAA,UAClB,oBAAoB,EAAE,MAAM,SAAS,OAAO,IAAI;AAAA,QAClD;AAAA,QACA,UAAU,MAAM;AACd,gBAAM,cAAc,KAAK,SAAS,EAAE;AACpC,gBAAM,aAAa,cAAc,GAAG;AACpC,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,IACH;AAAA,EACF;AACF;","names":[]}
@@ -1,64 +1,64 @@
1
1
  export type ThreadListRuntimePath = {
2
- ref: string;
2
+ readonly ref: string;
3
3
  };
4
4
  export type ThreadListItemRuntimePath = {
5
- ref: string;
6
- threadSelector: {
7
- type: "main";
5
+ readonly ref: string;
6
+ readonly threadSelector: {
7
+ readonly type: "main";
8
8
  } | {
9
- type: "index";
10
- index: number;
9
+ readonly type: "index";
10
+ readonly index: number;
11
11
  } | {
12
- type: "archiveIndex";
13
- index: number;
12
+ readonly type: "archiveIndex";
13
+ readonly index: number;
14
14
  } | {
15
- type: "threadId";
16
- threadId: string;
15
+ readonly type: "threadId";
16
+ readonly threadId: string;
17
17
  };
18
18
  };
19
19
  export type ThreadRuntimePath = {
20
- ref: string;
21
- threadSelector: {
20
+ readonly ref: string;
21
+ readonly threadSelector: {
22
22
  type: "main";
23
23
  };
24
24
  };
25
25
  export type MessageRuntimePath = ThreadRuntimePath & {
26
- messageSelector: {
27
- type: "messageId";
28
- messageId: string;
26
+ readonly messageSelector: {
27
+ readonly type: "messageId";
28
+ readonly messageId: string;
29
29
  } | {
30
- type: "index";
31
- index: number;
30
+ readonly type: "index";
31
+ readonly index: number;
32
32
  };
33
33
  };
34
34
  export type ContentPartRuntimePath = MessageRuntimePath & {
35
- contentPartSelector: {
36
- type: "index";
37
- index: number;
35
+ readonly contentPartSelector: {
36
+ readonly type: "index";
37
+ readonly index: number;
38
38
  } | {
39
- type: "toolCallId";
40
- toolCallId: string;
39
+ readonly type: "toolCallId";
40
+ readonly toolCallId: string;
41
41
  };
42
42
  };
43
43
  export type AttachmentRuntimePath = ((MessageRuntimePath & {
44
- attachmentSource: "message" | "edit-composer";
44
+ readonly attachmentSource: "message" | "edit-composer";
45
45
  }) | (ThreadRuntimePath & {
46
- attachmentSource: "thread-composer";
46
+ readonly attachmentSource: "thread-composer";
47
47
  })) & {
48
- attachmentSelector: {
49
- type: "index";
50
- index: number;
48
+ readonly attachmentSelector: {
49
+ readonly type: "index";
50
+ readonly index: number;
51
51
  } | {
52
- type: "index";
53
- index: number;
52
+ readonly type: "index";
53
+ readonly index: number;
54
54
  } | {
55
- type: "index";
56
- index: number;
55
+ readonly type: "index";
56
+ readonly index: number;
57
57
  };
58
58
  };
59
59
  export type ComposerRuntimePath = (ThreadRuntimePath & {
60
- composerSource: "thread";
60
+ readonly composerSource: "thread";
61
61
  }) | (MessageRuntimePath & {
62
- composerSource: "edit";
62
+ readonly composerSource: "edit";
63
63
  });
64
64
  //# sourceMappingURL=RuntimePathTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RuntimePathTypes.d.ts","sourceRoot":"","sources":["../../src/api/RuntimePathTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EACV;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAChB;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAChC;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACvC;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG;IACnD,eAAe,EACX;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GACxC;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,mBAAmB,EACf;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAChC;QAAE,IAAI,EAA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ACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,GACD;QACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,CAAC;CACP,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B,CAAC,iBAAiB,GAAG;IACnB,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC;CACnC,CAAC,GACF,CAAC,kBAAkB,GAAG;IACpB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/RuntimePathTypes.ts"],"sourcesContent":["export type ThreadListRuntimePath = {\n ref: string;\n};\n\nexport type ThreadListItemRuntimePath = {\n ref: string;\n threadSelector:\n | { type: \"main\" }\n | { type: \"index\"; index: number }\n | { type: \"archiveIndex\"; index: number }\n | { type: \"threadId\"; threadId: string };\n};\n\nexport type ThreadRuntimePath = {\n ref: string;\n threadSelector: { type: \"main\" };\n};\n\nexport type MessageRuntimePath = ThreadRuntimePath & {\n messageSelector:\n | { type: \"messageId\"; messageId: string }\n | { type: \"index\"; index: number };\n};\n\nexport type ContentPartRuntimePath = MessageRuntimePath & {\n contentPartSelector:\n | { type: \"index\"; index: number }\n | { type: \"toolCallId\"; toolCallId: string };\n};\n\nexport type AttachmentRuntimePath = (\n | (MessageRuntimePath & {\n attachmentSource: \"message\" | \"edit-composer\";\n })\n | (ThreadRuntimePath & {\n attachmentSource: \"thread-composer\";\n })\n) & {\n attachmentSelector:\n | {\n type: \"index\";\n index: number;\n }\n | {\n type: \"index\";\n index: number;\n }\n | {\n type: \"index\";\n index: number;\n };\n};\n\nexport type ComposerRuntimePath =\n | (ThreadRuntimePath & {\n composerSource: \"thread\";\n })\n | (MessageRuntimePath & {\n composerSource: \"edit\";\n });\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/api/RuntimePathTypes.ts"],"sourcesContent":["export type ThreadListRuntimePath = {\n readonly ref: string;\n};\n\nexport type ThreadListItemRuntimePath = {\n readonly ref: string;\n readonly threadSelector:\n | { readonly type: \"main\" }\n | { readonly type: \"index\"; readonly index: number }\n | { readonly type: \"archiveIndex\"; readonly index: number }\n | { readonly type: \"threadId\"; readonly threadId: string };\n};\n\nexport type ThreadRuntimePath = {\n readonly ref: string;\n readonly threadSelector: { type: \"main\" };\n};\n\nexport type MessageRuntimePath = ThreadRuntimePath & {\n readonly messageSelector:\n | { readonly type: \"messageId\"; readonly messageId: string }\n | { readonly type: \"index\"; readonly index: number };\n};\n\nexport type ContentPartRuntimePath = MessageRuntimePath & {\n readonly contentPartSelector:\n | { readonly type: \"index\"; readonly index: number }\n | { readonly type: \"toolCallId\"; readonly toolCallId: string };\n};\n\nexport type AttachmentRuntimePath = (\n | (MessageRuntimePath & {\n readonly attachmentSource: \"message\" | \"edit-composer\";\n })\n | (ThreadRuntimePath & {\n readonly attachmentSource: \"thread-composer\";\n })\n) & {\n readonly attachmentSelector:\n | {\n readonly type: \"index\";\n readonly index: number;\n }\n | {\n readonly type: \"index\";\n readonly index: number;\n }\n | {\n readonly type: \"index\";\n readonly index: number;\n };\n};\n\nexport type ComposerRuntimePath =\n | (ThreadRuntimePath & {\n readonly composerSource: \"thread\";\n })\n | (MessageRuntimePath & {\n readonly composerSource: \"edit\";\n });\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,25 +1,29 @@
1
- import { ThreadListMetadata } from "../runtimes/core/ThreadListRuntimeCore";
1
+ import { ThreadMetadata } from "../runtimes/core/ThreadRuntimeCore";
2
2
  import { Unsubscribe } from "../types";
3
3
  import { ThreadListItemRuntimePath } from "./RuntimePathTypes";
4
4
  import { SubscribableWithState } from "./subscribable/Subscribable";
5
5
  import { ThreadListRuntimeCoreBinding } from "./ThreadListRuntime";
6
- export type ThreadListItemState = ThreadListMetadata;
7
- export type ThreadListItemRuntime = Readonly<{
8
- path: ThreadListItemRuntimePath;
9
- getState(): ThreadListMetadata;
6
+ export type ThreadListItemState = ThreadMetadata & {
7
+ readonly isMain: boolean;
8
+ };
9
+ export type ThreadListItemRuntime = {
10
+ readonly path: ThreadListItemRuntimePath;
11
+ getState(): ThreadListItemState;
12
+ switchTo(): Promise<void>;
10
13
  rename(newTitle: string): Promise<void>;
11
14
  archive(): Promise<void>;
12
15
  unarchive(): Promise<void>;
13
16
  delete(): Promise<void>;
14
17
  subscribe(callback: () => void): Unsubscribe;
15
- }>;
18
+ };
16
19
  export type ThreadListItemStateBinding = SubscribableWithState<ThreadListItemState, ThreadListItemRuntimePath>;
17
20
  export declare class ThreadListItemRuntimeImpl implements ThreadListItemRuntime {
18
21
  private _core;
19
- private _ThreadListBinding;
22
+ private _threadListBinding;
20
23
  get path(): ThreadListItemRuntimePath;
21
- constructor(_core: ThreadListItemStateBinding, _ThreadListBinding: ThreadListRuntimeCoreBinding);
24
+ constructor(_core: ThreadListItemStateBinding, _threadListBinding: ThreadListRuntimeCoreBinding);
22
25
  getState(): ThreadListItemState;
26
+ switchTo(): Promise<void>;
23
27
  rename(newTitle: string): Promise<void>;
24
28
  archive(): Promise<void>;
25
29
  unarchive(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListItemRuntime.d.ts","sourceRoot":"","sources":["../../src/api/ThreadListItemRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAErD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC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
24
  });
25
25
  module.exports = __toCommonJS(ThreadListItemRuntime_exports);
26
26
  var ThreadListItemRuntimeImpl = class {
27
- constructor(_core, _ThreadListBinding) {
27
+ constructor(_core, _threadListBinding) {
28
28
  this._core = _core;
29
- this._ThreadListBinding = _ThreadListBinding;
29
+ this._threadListBinding = _threadListBinding;
30
30
  }
31
31
  get path() {
32
32
  return this._core.path;
@@ -34,21 +34,25 @@ var ThreadListItemRuntimeImpl = class {
34
34
  getState() {
35
35
  return this._core.getState();
36
36
  }
37
+ switchTo() {
38
+ const state = this._core.getState();
39
+ return this._threadListBinding.switchToThread(state.threadId);
40
+ }
37
41
  rename(newTitle) {
38
42
  const state = this._core.getState();
39
- return this._ThreadListBinding.rename(state.threadId, newTitle);
43
+ return this._threadListBinding.rename(state.threadId, newTitle);
40
44
  }
41
45
  archive() {
42
46
  const state = this._core.getState();
43
- return this._ThreadListBinding.archive(state.threadId);
47
+ return this._threadListBinding.archive(state.threadId);
44
48
  }
45
49
  unarchive() {
46
50
  const state = this._core.getState();
47
- return this._ThreadListBinding.unarchive(state.threadId);
51
+ return this._threadListBinding.unarchive(state.threadId);
48
52
  }
49
53
  delete() {
50
54
  const state = this._core.getState();
51
- return this._ThreadListBinding.delete(state.threadId);
55
+ return this._threadListBinding.delete(state.threadId);
52
56
  }
53
57
  subscribe(callback) {
54
58
  return this._core.subscribe(callback);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/ThreadListItemRuntime.ts"],"sourcesContent":["import { ThreadListMetadata } from \"../runtimes/core/ThreadListRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListItemRuntimePath } from \"./RuntimePathTypes\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { ThreadListRuntimeCoreBinding } from \"./ThreadListRuntime\";\n\nexport type ThreadListItemState = ThreadListMetadata;\n\nexport type ThreadListItemRuntime = Readonly<{\n path: ThreadListItemRuntimePath;\n getState(): ThreadListMetadata;\n\n rename(newTitle: string): Promise<void>;\n archive(): Promise<void>;\n unarchive(): Promise<void>;\n delete(): Promise<void>;\n\n subscribe(callback: () => void): Unsubscribe;\n}>;\n\nexport type ThreadListItemStateBinding = SubscribableWithState<\n ThreadListItemState,\n ThreadListItemRuntimePath\n>;\n\nexport class ThreadListItemRuntimeImpl implements ThreadListItemRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: ThreadListItemStateBinding,\n private _ThreadListBinding: ThreadListRuntimeCoreBinding,\n ) {}\n\n public getState(): ThreadListItemState {\n return this._core.getState();\n }\n\n public rename(newTitle: string): Promise<void> {\n const state = this._core.getState();\n\n return this._ThreadListBinding.rename(state.threadId, newTitle);\n }\n\n public archive(): Promise<void> {\n const state = this._core.getState();\n\n return this._ThreadListBinding.archive(state.threadId);\n }\n\n public unarchive(): Promise<void> {\n const state = this._core.getState();\n\n return this._ThreadListBinding.unarchive(state.threadId);\n }\n\n public delete(): Promise<void> {\n const state = this._core.getState();\n\n return this._ThreadListBinding.delete(state.threadId);\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBO,IAAM,4BAAN,MAAiE;AAAA,EAKtE,YACU,OACA,oBACR;AAFQ;AACA;AAAA,EACP;AAAA,EAPH,IAAW,OAAO;AAChB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAOO,WAAgC;AACrC,WAAO,KAAK,MAAM,SAAS;AAAA,EAC7B;AAAA,EAEO,OAAO,UAAiC;AAC7C,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,OAAO,MAAM,UAAU,QAAQ;AAAA,EAChE;AAAA,EAEO,UAAyB;AAC9B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,QAAQ,MAAM,QAAQ;AAAA,EACvD;AAAA,EAEO,YAA2B;AAChC,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,UAAU,MAAM,QAAQ;AAAA,EACzD;AAAA,EAEO,SAAwB;AAC7B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,OAAO,MAAM,QAAQ;AAAA,EACtD;AAAA,EAEO,UAAU,UAAmC;AAClD,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/api/ThreadListItemRuntime.ts"],"sourcesContent":["import { ThreadMetadata } from \"../runtimes/core/ThreadRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListItemRuntimePath } from \"./RuntimePathTypes\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { ThreadListRuntimeCoreBinding } from \"./ThreadListRuntime\";\n\nexport type ThreadListItemState = ThreadMetadata & {\n readonly isMain: boolean;\n};\n\nexport type ThreadListItemRuntime = {\n readonly path: ThreadListItemRuntimePath;\n getState(): ThreadListItemState;\n\n switchTo(): Promise<void>;\n rename(newTitle: string): Promise<void>;\n archive(): Promise<void>;\n unarchive(): Promise<void>;\n delete(): Promise<void>;\n\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport type ThreadListItemStateBinding = SubscribableWithState<\n ThreadListItemState,\n ThreadListItemRuntimePath\n>;\n\nexport class ThreadListItemRuntimeImpl implements ThreadListItemRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: ThreadListItemStateBinding,\n private _threadListBinding: ThreadListRuntimeCoreBinding,\n ) {}\n\n public getState(): ThreadListItemState {\n return this._core.getState();\n }\n\n public switchTo(): Promise<void> {\n const state = this._core.getState();\n return this._threadListBinding.switchToThread(state.threadId);\n }\n\n public rename(newTitle: string): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.rename(state.threadId, newTitle);\n }\n\n public archive(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.archive(state.threadId);\n }\n\n public unarchive(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.unarchive(state.threadId);\n }\n\n public delete(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.delete(state.threadId);\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BO,IAAM,4BAAN,MAAiE;AAAA,EAKtE,YACU,OACA,oBACR;AAFQ;AACA;AAAA,EACP;AAAA,EAPH,IAAW,OAAO;AAChB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAOO,WAAgC;AACrC,WAAO,KAAK,MAAM,SAAS;AAAA,EAC7B;AAAA,EAEO,WAA0B;AAC/B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAClC,WAAO,KAAK,mBAAmB,eAAe,MAAM,QAAQ;AAAA,EAC9D;AAAA,EAEO,OAAO,UAAiC;AAC7C,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,OAAO,MAAM,UAAU,QAAQ;AAAA,EAChE;AAAA,EAEO,UAAyB;AAC9B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,QAAQ,MAAM,QAAQ;AAAA,EACvD;AAAA,EAEO,YAA2B;AAChC,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,UAAU,MAAM,QAAQ;AAAA,EACzD;AAAA,EAEO,SAAwB;AAC7B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,OAAO,MAAM,QAAQ;AAAA,EACtD;AAAA,EAEO,UAAU,UAAmC;AAClD,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AACF;","names":[]}
@@ -1,8 +1,8 @@
1
1
  // src/api/ThreadListItemRuntime.ts
2
2
  var ThreadListItemRuntimeImpl = class {
3
- constructor(_core, _ThreadListBinding) {
3
+ constructor(_core, _threadListBinding) {
4
4
  this._core = _core;
5
- this._ThreadListBinding = _ThreadListBinding;
5
+ this._threadListBinding = _threadListBinding;
6
6
  }
7
7
  get path() {
8
8
  return this._core.path;
@@ -10,21 +10,25 @@ var ThreadListItemRuntimeImpl = class {
10
10
  getState() {
11
11
  return this._core.getState();
12
12
  }
13
+ switchTo() {
14
+ const state = this._core.getState();
15
+ return this._threadListBinding.switchToThread(state.threadId);
16
+ }
13
17
  rename(newTitle) {
14
18
  const state = this._core.getState();
15
- return this._ThreadListBinding.rename(state.threadId, newTitle);
19
+ return this._threadListBinding.rename(state.threadId, newTitle);
16
20
  }
17
21
  archive() {
18
22
  const state = this._core.getState();
19
- return this._ThreadListBinding.archive(state.threadId);
23
+ return this._threadListBinding.archive(state.threadId);
20
24
  }
21
25
  unarchive() {
22
26
  const state = this._core.getState();
23
- return this._ThreadListBinding.unarchive(state.threadId);
27
+ return this._threadListBinding.unarchive(state.threadId);
24
28
  }
25
29
  delete() {
26
30
  const state = this._core.getState();
27
- return this._ThreadListBinding.delete(state.threadId);
31
+ return this._threadListBinding.delete(state.threadId);
28
32
  }
29
33
  subscribe(callback) {
30
34
  return this._core.subscribe(callback);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/ThreadListItemRuntime.ts"],"sourcesContent":["import { ThreadListMetadata } from \"../runtimes/core/ThreadListRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListItemRuntimePath } from \"./RuntimePathTypes\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { ThreadListRuntimeCoreBinding } from \"./ThreadListRuntime\";\n\nexport type ThreadListItemState = ThreadListMetadata;\n\nexport type ThreadListItemRuntime = Readonly<{\n path: ThreadListItemRuntimePath;\n getState(): ThreadListMetadata;\n\n rename(newTitle: string): Promise<void>;\n archive(): Promise<void>;\n unarchive(): Promise<void>;\n delete(): Promise<void>;\n\n subscribe(callback: () => void): Unsubscribe;\n}>;\n\nexport type ThreadListItemStateBinding = SubscribableWithState<\n ThreadListItemState,\n ThreadListItemRuntimePath\n>;\n\nexport class ThreadListItemRuntimeImpl implements ThreadListItemRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: ThreadListItemStateBinding,\n private _ThreadListBinding: ThreadListRuntimeCoreBinding,\n ) {}\n\n public getState(): ThreadListItemState {\n return this._core.getState();\n }\n\n public rename(newTitle: string): Promise<void> {\n const state = this._core.getState();\n\n return this._ThreadListBinding.rename(state.threadId, newTitle);\n }\n\n public archive(): Promise<void> {\n const state = this._core.getState();\n\n return this._ThreadListBinding.archive(state.threadId);\n }\n\n public unarchive(): Promise<void> {\n const state = this._core.getState();\n\n return this._ThreadListBinding.unarchive(state.threadId);\n }\n\n public delete(): Promise<void> {\n const state = this._core.getState();\n\n return this._ThreadListBinding.delete(state.threadId);\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n}\n"],"mappings":";AAyBO,IAAM,4BAAN,MAAiE;AAAA,EAKtE,YACU,OACA,oBACR;AAFQ;AACA;AAAA,EACP;AAAA,EAPH,IAAW,OAAO;AAChB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAOO,WAAgC;AACrC,WAAO,KAAK,MAAM,SAAS;AAAA,EAC7B;AAAA,EAEO,OAAO,UAAiC;AAC7C,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,OAAO,MAAM,UAAU,QAAQ;AAAA,EAChE;AAAA,EAEO,UAAyB;AAC9B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,QAAQ,MAAM,QAAQ;AAAA,EACvD;AAAA,EAEO,YAA2B;AAChC,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,UAAU,MAAM,QAAQ;AAAA,EACzD;AAAA,EAEO,SAAwB;AAC7B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,OAAO,MAAM,QAAQ;AAAA,EACtD;AAAA,EAEO,UAAU,UAAmC;AAClD,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/api/ThreadListItemRuntime.ts"],"sourcesContent":["import { ThreadMetadata } from \"../runtimes/core/ThreadRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadListItemRuntimePath } from \"./RuntimePathTypes\";\nimport { SubscribableWithState } from \"./subscribable/Subscribable\";\nimport { ThreadListRuntimeCoreBinding } from \"./ThreadListRuntime\";\n\nexport type ThreadListItemState = ThreadMetadata & {\n readonly isMain: boolean;\n};\n\nexport type ThreadListItemRuntime = {\n readonly path: ThreadListItemRuntimePath;\n getState(): ThreadListItemState;\n\n switchTo(): Promise<void>;\n rename(newTitle: string): Promise<void>;\n archive(): Promise<void>;\n unarchive(): Promise<void>;\n delete(): Promise<void>;\n\n subscribe(callback: () => void): Unsubscribe;\n};\n\nexport type ThreadListItemStateBinding = SubscribableWithState<\n ThreadListItemState,\n ThreadListItemRuntimePath\n>;\n\nexport class ThreadListItemRuntimeImpl implements ThreadListItemRuntime {\n public get path() {\n return this._core.path;\n }\n\n constructor(\n private _core: ThreadListItemStateBinding,\n private _threadListBinding: ThreadListRuntimeCoreBinding,\n ) {}\n\n public getState(): ThreadListItemState {\n return this._core.getState();\n }\n\n public switchTo(): Promise<void> {\n const state = this._core.getState();\n return this._threadListBinding.switchToThread(state.threadId);\n }\n\n public rename(newTitle: string): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.rename(state.threadId, newTitle);\n }\n\n public archive(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.archive(state.threadId);\n }\n\n public unarchive(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.unarchive(state.threadId);\n }\n\n public delete(): Promise<void> {\n const state = this._core.getState();\n\n return this._threadListBinding.delete(state.threadId);\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n}\n"],"mappings":";AA4BO,IAAM,4BAAN,MAAiE;AAAA,EAKtE,YACU,OACA,oBACR;AAFQ;AACA;AAAA,EACP;AAAA,EAPH,IAAW,OAAO;AAChB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA,EAOO,WAAgC;AACrC,WAAO,KAAK,MAAM,SAAS;AAAA,EAC7B;AAAA,EAEO,WAA0B;AAC/B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAClC,WAAO,KAAK,mBAAmB,eAAe,MAAM,QAAQ;AAAA,EAC9D;AAAA,EAEO,OAAO,UAAiC;AAC7C,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,OAAO,MAAM,UAAU,QAAQ;AAAA,EAChE;AAAA,EAEO,UAAyB;AAC9B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,QAAQ,MAAM,QAAQ;AAAA,EACvD;AAAA,EAEO,YAA2B;AAChC,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,UAAU,MAAM,QAAQ;AAAA,EACzD;AAAA,EAEO,SAAwB;AAC7B,UAAM,QAAQ,KAAK,MAAM,SAAS;AAElC,WAAO,KAAK,mBAAmB,OAAO,MAAM,QAAQ;AAAA,EACtD;AAAA,EAEO,UAAU,UAAmC;AAClD,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AACF;","names":[]}
@@ -1,35 +1,21 @@
1
- import { ThreadListMetadata, ThreadListRuntimeCore } from "../runtimes/core/ThreadListRuntimeCore";
1
+ import { ThreadListRuntimeCore } from "../runtimes/core/ThreadListRuntimeCore";
2
2
  import { Unsubscribe } from "../types";
3
3
  import { ThreadListRuntimePath } from "./RuntimePathTypes";
4
4
  import { ThreadListItemRuntime, ThreadListItemRuntimeImpl } from "./ThreadListItemRuntime";
5
- export type ThreadListState = Readonly<{
6
- threads: readonly ThreadListMetadata[];
7
- archivedThreads: readonly ThreadListMetadata[];
8
- }>;
9
- export type ThreadListRuntime = Readonly<{
10
- path: ThreadListRuntimePath;
5
+ export type ThreadListState = {
6
+ readonly mainThreadId: string;
7
+ readonly newThread: string | undefined;
8
+ readonly threads: readonly string[];
9
+ readonly archivedThreads: readonly string[];
10
+ };
11
+ export type ThreadListRuntime = {
12
+ readonly path: ThreadListRuntimePath;
11
13
  getState(): ThreadListState;
12
- /**
13
- * @deprecated Use `getThreadListItemById(idx).rename(newTitle)` instead. This will be removed in 0.6.0.
14
- */
15
- rename(threadId: string, newTitle: string): Promise<void>;
16
- /**
17
- * @deprecated Use `getThreadListItemById(idx).archive()` instead. This will be removed in 0.6.0.
18
- */
19
- archive(threadId: string): Promise<void>;
20
- /**
21
- * @deprecated Use `getThreadListItemById(idx).unarchive()` instead. This will be removed in 0.6.0.
22
- */
23
- unarchive(threadId: string): Promise<void>;
24
- /**
25
- * @deprecated Use `getThreadListItemById(idx).delete()` instead. This will be removed in 0.6.0.
26
- */
27
- delete(threadId: string): Promise<void>;
28
14
  subscribe(callback: () => void): Unsubscribe;
29
15
  getThreadListItemById(threadId: string): ThreadListItemRuntime;
30
16
  getThreadListItemByIndex(idx: number): ThreadListItemRuntime;
31
17
  getThreadListArchivedItemByIndex(idx: number): ThreadListItemRuntime;
32
- }>;
18
+ };
33
19
  export type ThreadListRuntimeCoreBinding = ThreadListRuntimeCore;
34
20
  export declare class ThreadListRuntimeImpl implements ThreadListRuntime {
35
21
  private _core;
@@ -39,10 +25,6 @@ export declare class ThreadListRuntimeImpl implements ThreadListRuntime {
39
25
  private _getState;
40
26
  constructor(_core: ThreadListRuntimeCoreBinding);
41
27
  getState(): ThreadListState;
42
- rename(threadId: string, newTitle: string): Promise<void>;
43
- archive(threadId: string): Promise<void>;
44
- unarchive(threadId: string): Promise<void>;
45
- delete(threadId: string): Promise<void>;
46
28
  subscribe(callback: () => void): Unsubscribe;
47
29
  getThreadListItemByIndex(idx: number): ThreadListItemRuntimeImpl;
48
30
  getThreadListArchivedItemByIndex(idx: number): ThreadListItemRuntimeImpl;
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadListRuntime.d.ts","sourceRoot":"","sources":["../../src/api/ThreadListRuntime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvC,eAAe,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAChD,CAAC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,QAAQ,IAAI,eAAe,CAAC;IAE5B;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;IAE7C,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,qBAAqB,CAAC;IAC/D,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC;IAC7D,gCAAgC,CAAC,GAA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