@assistant-ui/react 0.5.98 → 0.5.100

Sign up to get free protection for your applications and to get access to all the features.
Files changed (273) hide show
  1. package/dist/api/AssistantRuntime.d.ts +4 -4
  2. package/dist/api/AssistantRuntime.d.ts.map +1 -1
  3. package/dist/api/AssistantRuntime.js +7 -7
  4. package/dist/api/AssistantRuntime.js.map +1 -1
  5. package/dist/api/AssistantRuntime.mjs +7 -9
  6. package/dist/api/AssistantRuntime.mjs.map +1 -1
  7. package/dist/api/ComposerRuntime.d.ts +7 -0
  8. package/dist/api/ComposerRuntime.d.ts.map +1 -1
  9. package/dist/api/ComposerRuntime.js +13 -0
  10. package/dist/api/ComposerRuntime.js.map +1 -1
  11. package/dist/api/ComposerRuntime.mjs +13 -0
  12. package/dist/api/ComposerRuntime.mjs.map +1 -1
  13. package/dist/api/MessageRuntime.d.ts.map +1 -1
  14. package/dist/api/MessageRuntime.js +0 -5
  15. package/dist/api/MessageRuntime.js.map +1 -1
  16. package/dist/api/MessageRuntime.mjs +0 -5
  17. package/dist/api/MessageRuntime.mjs.map +1 -1
  18. package/dist/api/RuntimePathTypes.d.ts +16 -1
  19. package/dist/api/RuntimePathTypes.d.ts.map +1 -1
  20. package/dist/api/RuntimePathTypes.js.map +1 -1
  21. package/dist/api/ThreadListItemRuntime.d.ts +29 -0
  22. package/dist/api/ThreadListItemRuntime.d.ts.map +1 -0
  23. package/dist/api/ThreadListItemRuntime.js +61 -0
  24. package/dist/api/ThreadListItemRuntime.js.map +1 -0
  25. package/dist/api/ThreadListItemRuntime.mjs +36 -0
  26. package/dist/api/ThreadListItemRuntime.mjs.map +1 -0
  27. package/dist/api/ThreadListRuntime.d.ts +51 -0
  28. package/dist/api/ThreadListRuntime.d.ts.map +1 -0
  29. package/dist/api/ThreadListRuntime.js +128 -0
  30. package/dist/api/ThreadListRuntime.js.map +1 -0
  31. package/dist/api/ThreadListRuntime.mjs +105 -0
  32. package/dist/api/ThreadListRuntime.mjs.map +1 -0
  33. package/dist/api/ThreadRuntime.d.ts +3 -0
  34. package/dist/api/ThreadRuntime.d.ts.map +1 -1
  35. package/dist/api/ThreadRuntime.js +1 -1
  36. package/dist/api/ThreadRuntime.js.map +1 -1
  37. package/dist/api/ThreadRuntime.mjs +1 -1
  38. package/dist/api/ThreadRuntime.mjs.map +1 -1
  39. package/dist/api/index.d.ts +1 -1
  40. package/dist/api/index.d.ts.map +1 -1
  41. package/dist/api/index.js.map +1 -1
  42. package/dist/context/providers/AssistantRuntimeProvider.d.ts.map +1 -1
  43. package/dist/context/providers/AssistantRuntimeProvider.js +7 -9
  44. package/dist/context/providers/AssistantRuntimeProvider.js.map +1 -1
  45. package/dist/context/providers/AssistantRuntimeProvider.mjs +7 -9
  46. package/dist/context/providers/AssistantRuntimeProvider.mjs.map +1 -1
  47. package/dist/context/providers/AttachmentRuntimeProvider.d.ts +6 -5
  48. package/dist/context/providers/AttachmentRuntimeProvider.d.ts.map +1 -1
  49. package/dist/context/providers/AttachmentRuntimeProvider.js.map +1 -1
  50. package/dist/context/providers/AttachmentRuntimeProvider.mjs.map +1 -1
  51. package/dist/context/providers/ContentPartRuntimeProvider.d.ts +6 -5
  52. package/dist/context/providers/ContentPartRuntimeProvider.d.ts.map +1 -1
  53. package/dist/context/providers/ContentPartRuntimeProvider.js +1 -4
  54. package/dist/context/providers/ContentPartRuntimeProvider.js.map +1 -1
  55. package/dist/context/providers/ContentPartRuntimeProvider.mjs +1 -4
  56. package/dist/context/providers/ContentPartRuntimeProvider.mjs.map +1 -1
  57. package/dist/context/providers/MessageRuntimeProvider.d.ts +6 -5
  58. package/dist/context/providers/MessageRuntimeProvider.d.ts.map +1 -1
  59. package/dist/context/providers/MessageRuntimeProvider.js.map +1 -1
  60. package/dist/context/providers/MessageRuntimeProvider.mjs.map +1 -1
  61. package/dist/context/providers/TextContentPartProvider.d.ts +7 -6
  62. package/dist/context/providers/TextContentPartProvider.d.ts.map +1 -1
  63. package/dist/context/providers/TextContentPartProvider.js +5 -1
  64. package/dist/context/providers/TextContentPartProvider.js.map +1 -1
  65. package/dist/context/providers/TextContentPartProvider.mjs +5 -1
  66. package/dist/context/providers/TextContentPartProvider.mjs.map +1 -1
  67. package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts +13 -0
  68. package/dist/context/providers/ThreadListItemRuntimeProvider.d.ts.map +1 -0
  69. package/dist/context/providers/ThreadListItemRuntimeProvider.js +62 -0
  70. package/dist/context/providers/ThreadListItemRuntimeProvider.js.map +1 -0
  71. package/dist/context/providers/ThreadListItemRuntimeProvider.mjs +39 -0
  72. package/dist/context/providers/ThreadListItemRuntimeProvider.mjs.map +1 -0
  73. package/dist/context/react/AssistantContext.d.ts +35 -11
  74. package/dist/context/react/AssistantContext.d.ts.map +1 -1
  75. package/dist/context/react/AssistantContext.js +4 -4
  76. package/dist/context/react/AssistantContext.js.map +1 -1
  77. package/dist/context/react/AssistantContext.mjs +3 -3
  78. package/dist/context/react/AssistantContext.mjs.map +1 -1
  79. package/dist/context/react/ThreadListItemContext.d.ts +58 -0
  80. package/dist/context/react/ThreadListItemContext.d.ts.map +1 -0
  81. package/dist/context/react/ThreadListItemContext.js +53 -0
  82. package/dist/context/react/ThreadListItemContext.js.map +1 -0
  83. package/dist/context/react/ThreadListItemContext.mjs +25 -0
  84. package/dist/context/react/ThreadListItemContext.mjs.map +1 -0
  85. package/dist/context/react/index.d.ts +1 -1
  86. package/dist/context/react/index.d.ts.map +1 -1
  87. package/dist/context/react/index.js +2 -2
  88. package/dist/context/react/index.js.map +1 -1
  89. package/dist/context/react/index.mjs +2 -2
  90. package/dist/context/react/index.mjs.map +1 -1
  91. package/dist/internal.d.ts +1 -1
  92. package/dist/internal.d.ts.map +1 -1
  93. package/dist/internal.js.map +1 -1
  94. package/dist/internal.mjs.map +1 -1
  95. package/dist/primitives/index.d.ts +2 -0
  96. package/dist/primitives/index.d.ts.map +1 -1
  97. package/dist/primitives/index.js +6 -0
  98. package/dist/primitives/index.js.map +1 -1
  99. package/dist/primitives/index.mjs +4 -0
  100. package/dist/primitives/index.mjs.map +1 -1
  101. package/dist/primitives/threadList/ThreadListItems.d.ts +11 -0
  102. package/dist/primitives/threadList/ThreadListItems.d.ts.map +1 -0
  103. package/dist/primitives/threadList/ThreadListItems.js +72 -0
  104. package/dist/primitives/threadList/ThreadListItems.js.map +1 -0
  105. package/dist/primitives/threadList/ThreadListItems.mjs +48 -0
  106. package/dist/primitives/threadList/ThreadListItems.mjs.map +1 -0
  107. package/dist/primitives/threadList/ThreadListNew.d.ts +13 -0
  108. package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -0
  109. package/dist/primitives/threadList/ThreadListNew.js +43 -0
  110. package/dist/primitives/threadList/ThreadListNew.js.map +1 -0
  111. package/dist/primitives/threadList/ThreadListNew.mjs +21 -0
  112. package/dist/primitives/threadList/ThreadListNew.mjs.map +1 -0
  113. package/dist/primitives/threadList/index.d.ts +3 -0
  114. package/dist/primitives/threadList/index.d.ts.map +1 -0
  115. package/dist/primitives/threadList/index.js +34 -0
  116. package/dist/primitives/threadList/index.js.map +1 -0
  117. package/dist/primitives/threadList/index.mjs +8 -0
  118. package/dist/primitives/threadList/index.mjs.map +1 -0
  119. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +13 -0
  120. package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -0
  121. package/dist/primitives/threadListItem/ThreadListItemArchive.js +43 -0
  122. package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -0
  123. package/dist/primitives/threadListItem/ThreadListItemArchive.mjs +21 -0
  124. package/dist/primitives/threadListItem/ThreadListItemArchive.mjs.map +1 -0
  125. package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +13 -0
  126. package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -0
  127. package/dist/primitives/threadListItem/ThreadListItemDelete.js +43 -0
  128. package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -0
  129. package/dist/primitives/threadListItem/ThreadListItemDelete.mjs +21 -0
  130. package/dist/primitives/threadListItem/ThreadListItemDelete.mjs.map +1 -0
  131. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +13 -0
  132. package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -0
  133. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +43 -0
  134. package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -0
  135. package/dist/primitives/threadListItem/ThreadListItemUnarchive.mjs +21 -0
  136. package/dist/primitives/threadListItem/ThreadListItemUnarchive.mjs.map +1 -0
  137. package/dist/primitives/threadListItem/index.d.ts +4 -0
  138. package/dist/primitives/threadListItem/index.d.ts.map +1 -0
  139. package/dist/primitives/threadListItem/index.js +37 -0
  140. package/dist/primitives/threadListItem/index.js.map +1 -0
  141. package/dist/primitives/threadListItem/index.mjs +10 -0
  142. package/dist/primitives/threadListItem/index.mjs.map +1 -0
  143. package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts +5 -1
  144. package/dist/runtimes/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
  145. package/dist/runtimes/composer/BaseComposerRuntimeCore.js +14 -5
  146. package/dist/runtimes/composer/BaseComposerRuntimeCore.js.map +1 -1
  147. package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs +14 -5
  148. package/dist/runtimes/composer/BaseComposerRuntimeCore.mjs.map +1 -1
  149. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
  150. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js +2 -1
  151. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
  152. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs +2 -1
  153. package/dist/runtimes/composer/DefaultEditComposerRuntimeCore.mjs.map +1 -1
  154. package/dist/runtimes/core/AssistantRuntimeCore.d.ts +2 -2
  155. package/dist/runtimes/core/AssistantRuntimeCore.d.ts.map +1 -1
  156. package/dist/runtimes/core/AssistantRuntimeCore.js.map +1 -1
  157. package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts +2 -2
  158. package/dist/runtimes/core/BaseAssistantRuntimeCore.d.ts.map +1 -1
  159. package/dist/runtimes/core/BaseAssistantRuntimeCore.js.map +1 -1
  160. package/dist/runtimes/core/BaseAssistantRuntimeCore.mjs.map +1 -1
  161. package/dist/runtimes/core/ComposerRuntimeCore.d.ts +3 -0
  162. package/dist/runtimes/core/ComposerRuntimeCore.d.ts.map +1 -1
  163. package/dist/runtimes/core/ComposerRuntimeCore.js.map +1 -1
  164. package/dist/runtimes/core/{ThreadManagerRuntimeCore.d.ts → ThreadListRuntimeCore.d.ts} +7 -6
  165. package/dist/runtimes/core/ThreadListRuntimeCore.d.ts.map +1 -0
  166. package/dist/runtimes/core/{ThreadManagerRuntimeCore.js → ThreadListRuntimeCore.js} +4 -4
  167. package/dist/runtimes/core/ThreadListRuntimeCore.js.map +1 -0
  168. package/dist/runtimes/core/ThreadListRuntimeCore.mjs +1 -0
  169. package/dist/runtimes/core/subscribeToMainThread.js +2 -2
  170. package/dist/runtimes/core/subscribeToMainThread.js.map +1 -1
  171. package/dist/runtimes/core/subscribeToMainThread.mjs +2 -2
  172. package/dist/runtimes/core/subscribeToMainThread.mjs.map +1 -1
  173. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts +8 -8
  174. package/dist/runtimes/external-store/ExternalStoreAdapter.d.ts.map +1 -1
  175. package/dist/runtimes/external-store/ExternalStoreAdapter.js.map +1 -1
  176. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts +2 -2
  177. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.d.ts.map +1 -1
  178. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js +8 -8
  179. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.js.map +1 -1
  180. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs +8 -8
  181. package/dist/runtimes/external-store/ExternalStoreRuntimeCore.mjs.map +1 -1
  182. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts +35 -0
  183. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.d.ts.map +1 -0
  184. package/dist/runtimes/external-store/{ExternalStoreThreadManagementAdapter.js → ExternalStoreThreadListRuntimeCore.js} +21 -9
  185. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.js.map +1 -0
  186. package/dist/runtimes/external-store/{ExternalStoreThreadManagementAdapter.mjs → ExternalStoreThreadListRuntimeCore.mjs} +17 -5
  187. package/dist/runtimes/external-store/ExternalStoreThreadListRuntimeCore.mjs.map +1 -0
  188. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts +1 -1
  189. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
  190. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js +8 -3
  191. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
  192. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs +8 -3
  193. package/dist/runtimes/external-store/ExternalStoreThreadRuntimeCore.mjs.map +1 -1
  194. package/dist/runtimes/local/LocalRuntimeCore.d.ts +2 -2
  195. package/dist/runtimes/local/LocalRuntimeCore.d.ts.map +1 -1
  196. package/dist/runtimes/local/LocalRuntimeCore.js +7 -7
  197. package/dist/runtimes/local/LocalRuntimeCore.js.map +1 -1
  198. package/dist/runtimes/local/LocalRuntimeCore.mjs +7 -7
  199. package/dist/runtimes/local/LocalRuntimeCore.mjs.map +1 -1
  200. package/dist/runtimes/local/{LocalThreadManagerRuntimeCore.d.ts → LocalThreadListRuntimeCore.d.ts} +16 -6
  201. package/dist/runtimes/local/LocalThreadListRuntimeCore.d.ts.map +1 -0
  202. package/dist/runtimes/local/{LocalThreadManagerRuntimeCore.js → LocalThreadListRuntimeCore.js} +11 -8
  203. package/dist/runtimes/local/LocalThreadListRuntimeCore.js.map +1 -0
  204. package/dist/runtimes/local/{LocalThreadManagerRuntimeCore.mjs → LocalThreadListRuntimeCore.mjs} +7 -4
  205. package/dist/runtimes/local/LocalThreadListRuntimeCore.mjs.map +1 -0
  206. package/dist/runtimes/local/LocalThreadRuntimeCore.d.ts.map +1 -1
  207. package/dist/runtimes/local/LocalThreadRuntimeCore.js +2 -1
  208. package/dist/runtimes/local/LocalThreadRuntimeCore.js.map +1 -1
  209. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs +2 -1
  210. package/dist/runtimes/local/LocalThreadRuntimeCore.mjs.map +1 -1
  211. package/dist/types/AssistantTypes.d.ts +2 -0
  212. package/dist/types/AssistantTypes.d.ts.map +1 -1
  213. package/dist/types/AssistantTypes.js.map +1 -1
  214. package/package.json +7 -7
  215. package/src/api/AssistantRuntime.ts +9 -12
  216. package/src/api/ComposerRuntime.ts +17 -0
  217. package/src/api/MessageRuntime.ts +0 -9
  218. package/src/api/RuntimePathTypes.ts +10 -1
  219. package/src/api/ThreadListItemRuntime.ts +67 -0
  220. package/src/api/ThreadListRuntime.ts +159 -0
  221. package/src/api/ThreadRuntime.ts +2 -1
  222. package/src/api/index.ts +1 -4
  223. package/src/context/providers/AssistantRuntimeProvider.tsx +7 -9
  224. package/src/context/providers/AttachmentRuntimeProvider.tsx +6 -4
  225. package/src/context/providers/ContentPartRuntimeProvider.tsx +8 -7
  226. package/src/context/providers/MessageRuntimeProvider.tsx +6 -4
  227. package/src/context/providers/TextContentPartProvider.tsx +11 -7
  228. package/src/context/providers/ThreadListItemRuntimeProvider.tsx +54 -0
  229. package/src/context/react/AssistantContext.ts +4 -4
  230. package/src/context/react/ThreadListItemContext.ts +39 -0
  231. package/src/context/react/index.ts +2 -2
  232. package/src/internal.ts +1 -1
  233. package/src/primitives/index.ts +2 -0
  234. package/src/primitives/threadList/ThreadListItems.tsx +73 -0
  235. package/src/primitives/threadList/ThreadListNew.ts +25 -0
  236. package/src/primitives/threadList/index.ts +2 -0
  237. package/src/primitives/threadListItem/ThreadListItemArchive.ts +25 -0
  238. package/src/primitives/threadListItem/ThreadListItemDelete.ts +25 -0
  239. package/src/primitives/threadListItem/ThreadListItemUnarchive.ts +25 -0
  240. package/src/primitives/threadListItem/index.ts +3 -0
  241. package/src/runtimes/composer/BaseComposerRuntimeCore.tsx +19 -5
  242. package/src/runtimes/composer/DefaultEditComposerRuntimeCore.tsx +3 -2
  243. package/src/runtimes/core/AssistantRuntimeCore.tsx +2 -2
  244. package/src/runtimes/core/BaseAssistantRuntimeCore.tsx +2 -2
  245. package/src/runtimes/core/ComposerRuntimeCore.tsx +4 -0
  246. package/src/runtimes/core/{ThreadManagerRuntimeCore.tsx → ThreadListRuntimeCore.tsx} +7 -5
  247. package/src/runtimes/core/subscribeToMainThread.ts +2 -2
  248. package/src/runtimes/external-store/ExternalStoreAdapter.tsx +8 -8
  249. package/src/runtimes/external-store/ExternalStoreRuntimeCore.tsx +8 -8
  250. package/src/runtimes/external-store/{ExternalStoreThreadManagementAdapter.tsx → ExternalStoreThreadListRuntimeCore.tsx} +24 -9
  251. package/src/runtimes/external-store/ExternalStoreThreadRuntimeCore.tsx +8 -3
  252. package/src/runtimes/local/LocalRuntimeCore.tsx +7 -7
  253. package/src/runtimes/local/{LocalThreadManagerRuntimeCore.tsx → LocalThreadListRuntimeCore.tsx} +11 -7
  254. package/src/runtimes/local/LocalThreadRuntimeCore.tsx +2 -1
  255. package/src/types/AssistantTypes.ts +3 -0
  256. package/dist/api/ThreadManagerRuntime.d.ts +0 -32
  257. package/dist/api/ThreadManagerRuntime.d.ts.map +0 -1
  258. package/dist/api/ThreadManagerRuntime.js +0 -73
  259. package/dist/api/ThreadManagerRuntime.js.map +0 -1
  260. package/dist/api/ThreadManagerRuntime.mjs +0 -48
  261. package/dist/api/ThreadManagerRuntime.mjs.map +0 -1
  262. package/dist/runtimes/core/ThreadManagerRuntimeCore.d.ts.map +0 -1
  263. package/dist/runtimes/core/ThreadManagerRuntimeCore.js.map +0 -1
  264. package/dist/runtimes/core/ThreadManagerRuntimeCore.mjs +0 -1
  265. package/dist/runtimes/external-store/ExternalStoreThreadManagementAdapter.d.ts +0 -25
  266. package/dist/runtimes/external-store/ExternalStoreThreadManagementAdapter.d.ts.map +0 -1
  267. package/dist/runtimes/external-store/ExternalStoreThreadManagementAdapter.js.map +0 -1
  268. package/dist/runtimes/external-store/ExternalStoreThreadManagementAdapter.mjs.map +0 -1
  269. package/dist/runtimes/local/LocalThreadManagerRuntimeCore.d.ts.map +0 -1
  270. package/dist/runtimes/local/LocalThreadManagerRuntimeCore.js.map +0 -1
  271. package/dist/runtimes/local/LocalThreadManagerRuntimeCore.mjs.map +0 -1
  272. package/src/api/ThreadManagerRuntime.ts +0 -80
  273. /package/dist/runtimes/core/{ThreadManagerRuntimeCore.mjs.map → ThreadListRuntimeCore.mjs.map} +0 -0
@@ -0,0 +1,21 @@
1
+ "use client";
2
+
3
+ // src/primitives/threadList/ThreadListNew.ts
4
+ import {
5
+ createActionButton
6
+ } from "../../utils/createActionButton.mjs";
7
+ import { useAssistantRuntime } from "../../context/index.mjs";
8
+ var useThreadListNew = () => {
9
+ const runtime = useAssistantRuntime();
10
+ return () => {
11
+ runtime.switchToNewThread();
12
+ };
13
+ };
14
+ var ThreadListPrimitiveNew = createActionButton(
15
+ "ThreadListPrimitive.New",
16
+ useThreadListNew
17
+ );
18
+ export {
19
+ ThreadListPrimitiveNew
20
+ };
21
+ //# sourceMappingURL=ThreadListNew.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadList/ThreadListNew.ts"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useAssistantRuntime } from \"../../context\";\n\nconst useThreadListNew = () => {\n const runtime = useAssistantRuntime();\n return () => {\n runtime.switchToNewThread();\n };\n};\n\nexport namespace ThreadListPrimitiveNew {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListNew>;\n}\n\nexport const ThreadListPrimitiveNew = createActionButton(\n \"ThreadListPrimitive.New\",\n useThreadListNew,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,2BAA2B;AAEpC,IAAM,mBAAmB,MAAM;AAC7B,QAAM,UAAU,oBAAoB;AACpC,SAAO,MAAM;AACX,YAAQ,kBAAkB;AAAA,EAC5B;AACF;AAOO,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ export { ThreadListPrimitiveNew as New } from "./ThreadListNew";
2
+ export { ThreadListPrimitiveItems as Items } from "./ThreadListItems";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,IAAI,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,wBAAwB,IAAI,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/primitives/threadList/index.ts
21
+ var threadList_exports = {};
22
+ __export(threadList_exports, {
23
+ Items: () => import_ThreadListItems.ThreadListPrimitiveItems,
24
+ New: () => import_ThreadListNew.ThreadListPrimitiveNew
25
+ });
26
+ module.exports = __toCommonJS(threadList_exports);
27
+ var import_ThreadListNew = require("./ThreadListNew.cjs");
28
+ var import_ThreadListItems = require("./ThreadListItems.cjs");
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ Items,
32
+ New
33
+ });
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadList/index.ts"],"sourcesContent":["export { ThreadListPrimitiveNew as New } from \"./ThreadListNew\";\nexport { ThreadListPrimitiveItems as Items } from \"./ThreadListItems\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA8C;AAC9C,6BAAkD;","names":[]}
@@ -0,0 +1,8 @@
1
+ // src/primitives/threadList/index.ts
2
+ import { ThreadListPrimitiveNew } from "./ThreadListNew.mjs";
3
+ import { ThreadListPrimitiveItems } from "./ThreadListItems.mjs";
4
+ export {
5
+ ThreadListPrimitiveItems as Items,
6
+ ThreadListPrimitiveNew as New
7
+ };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadList/index.ts"],"sourcesContent":["export { ThreadListPrimitiveNew as New } from \"./ThreadListNew\";\nexport { ThreadListPrimitiveItems as Items } from \"./ThreadListItems\";\n"],"mappings":";AAAA,SAAmC,8BAAW;AAC9C,SAAqC,gCAAa;","names":[]}
@@ -0,0 +1,13 @@
1
+ import { ActionButtonElement, ActionButtonProps } from "../../utils/createActionButton";
2
+ declare const useThreadListItemArchive: () => () => void;
3
+ export declare namespace ThreadListItemPrimitiveArchive {
4
+ type Element = ActionButtonElement;
5
+ type Props = ActionButtonProps<typeof useThreadListItemArchive>;
6
+ }
7
+ export declare const ThreadListItemPrimitiveArchive: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
8
+ ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
9
+ } & {
10
+ asChild?: boolean;
11
+ }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
12
+ export {};
13
+ //# sourceMappingURL=ThreadListItemArchive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThreadListItemArchive.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,wBAAwB,kBAK7B,CAAC;AAEF,yBAAiB,8BAA8B,CAAC;IAC9C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,wBAAwB,CAAC,CAAC;CACxE;AAED,eAAO,MAAM,8BAA8B;;;;6DAG1C,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/primitives/threadListItem/ThreadListItemArchive.ts
22
+ var ThreadListItemArchive_exports = {};
23
+ __export(ThreadListItemArchive_exports, {
24
+ ThreadListItemPrimitiveArchive: () => ThreadListItemPrimitiveArchive
25
+ });
26
+ module.exports = __toCommonJS(ThreadListItemArchive_exports);
27
+ var import_createActionButton = require("../../utils/createActionButton.cjs");
28
+ var import_ThreadListItemContext = require("../../context/react/ThreadListItemContext.cjs");
29
+ var useThreadListItemArchive = () => {
30
+ const runtime = (0, import_ThreadListItemContext.useThreadListItemRuntime)();
31
+ return () => {
32
+ runtime.archive();
33
+ };
34
+ };
35
+ var ThreadListItemPrimitiveArchive = (0, import_createActionButton.createActionButton)(
36
+ "ThreadListItemPrimitive.Archive",
37
+ useThreadListItemArchive
38
+ );
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ThreadListItemPrimitiveArchive
42
+ });
43
+ //# sourceMappingURL=ThreadListItemArchive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nconst useThreadListItemArchive = () => {\n const runtime = useThreadListItemRuntime();\n return () => {\n runtime.archive();\n };\n};\n\nexport namespace ThreadListItemPrimitiveArchive {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemArchive>;\n}\n\nexport const ThreadListItemPrimitiveArchive = createActionButton(\n \"ThreadListItemPrimitive.Archive\",\n useThreadListItemArchive,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mCAAyC;AAEzC,IAAM,2BAA2B,MAAM;AACrC,QAAM,cAAU,uDAAyB;AACzC,SAAO,MAAM;AACX,YAAQ,QAAQ;AAAA,EAClB;AACF;AAOO,IAAM,qCAAiC;AAAA,EAC5C;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,21 @@
1
+ "use client";
2
+
3
+ // src/primitives/threadListItem/ThreadListItemArchive.ts
4
+ import {
5
+ createActionButton
6
+ } from "../../utils/createActionButton.mjs";
7
+ import { useThreadListItemRuntime } from "../../context/react/ThreadListItemContext.mjs";
8
+ var useThreadListItemArchive = () => {
9
+ const runtime = useThreadListItemRuntime();
10
+ return () => {
11
+ runtime.archive();
12
+ };
13
+ };
14
+ var ThreadListItemPrimitiveArchive = createActionButton(
15
+ "ThreadListItemPrimitive.Archive",
16
+ useThreadListItemArchive
17
+ );
18
+ export {
19
+ ThreadListItemPrimitiveArchive
20
+ };
21
+ //# sourceMappingURL=ThreadListItemArchive.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadListItem/ThreadListItemArchive.ts"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nconst useThreadListItemArchive = () => {\n const runtime = useThreadListItemRuntime();\n return () => {\n runtime.archive();\n };\n};\n\nexport namespace ThreadListItemPrimitiveArchive {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemArchive>;\n}\n\nexport const ThreadListItemPrimitiveArchive = createActionButton(\n \"ThreadListItemPrimitive.Archive\",\n useThreadListItemArchive,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,gCAAgC;AAEzC,IAAM,2BAA2B,MAAM;AACrC,QAAM,UAAU,yBAAyB;AACzC,SAAO,MAAM;AACX,YAAQ,QAAQ;AAAA,EAClB;AACF;AAOO,IAAM,iCAAiC;AAAA,EAC5C;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,13 @@
1
+ import { ActionButtonElement, ActionButtonProps } from "../../utils/createActionButton";
2
+ declare const useThreadListItemDelete: () => () => void;
3
+ export declare namespace ThreadListItemPrimitiveDelete {
4
+ type Element = ActionButtonElement;
5
+ type Props = ActionButtonProps<typeof useThreadListItemDelete>;
6
+ }
7
+ export declare const ThreadListItemPrimitiveDelete: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
8
+ ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
9
+ } & {
10
+ asChild?: boolean;
11
+ }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
12
+ export {};
13
+ //# sourceMappingURL=ThreadListItemDelete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThreadListItemDelete.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,uBAAuB,kBAK5B,CAAC;AAEF,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,uBAAuB,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,6BAA6B;;;;6DAGzC,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/primitives/threadListItem/ThreadListItemDelete.ts
22
+ var ThreadListItemDelete_exports = {};
23
+ __export(ThreadListItemDelete_exports, {
24
+ ThreadListItemPrimitiveDelete: () => ThreadListItemPrimitiveDelete
25
+ });
26
+ module.exports = __toCommonJS(ThreadListItemDelete_exports);
27
+ var import_createActionButton = require("../../utils/createActionButton.cjs");
28
+ var import_ThreadListItemContext = require("../../context/react/ThreadListItemContext.cjs");
29
+ var useThreadListItemDelete = () => {
30
+ const runtime = (0, import_ThreadListItemContext.useThreadListItemRuntime)();
31
+ return () => {
32
+ runtime.delete();
33
+ };
34
+ };
35
+ var ThreadListItemPrimitiveDelete = (0, import_createActionButton.createActionButton)(
36
+ "ThreadListItemPrimitive.Delete",
37
+ useThreadListItemDelete
38
+ );
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ThreadListItemPrimitiveDelete
42
+ });
43
+ //# sourceMappingURL=ThreadListItemDelete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nconst useThreadListItemDelete = () => {\n const runtime = useThreadListItemRuntime();\n return () => {\n runtime.delete();\n };\n};\n\nexport namespace ThreadListItemPrimitiveDelete {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemDelete>;\n}\n\nexport const ThreadListItemPrimitiveDelete = createActionButton(\n \"ThreadListItemPrimitive.Delete\",\n useThreadListItemDelete,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mCAAyC;AAEzC,IAAM,0BAA0B,MAAM;AACpC,QAAM,cAAU,uDAAyB;AACzC,SAAO,MAAM;AACX,YAAQ,OAAO;AAAA,EACjB;AACF;AAOO,IAAM,oCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,21 @@
1
+ "use client";
2
+
3
+ // src/primitives/threadListItem/ThreadListItemDelete.ts
4
+ import {
5
+ createActionButton
6
+ } from "../../utils/createActionButton.mjs";
7
+ import { useThreadListItemRuntime } from "../../context/react/ThreadListItemContext.mjs";
8
+ var useThreadListItemDelete = () => {
9
+ const runtime = useThreadListItemRuntime();
10
+ return () => {
11
+ runtime.delete();
12
+ };
13
+ };
14
+ var ThreadListItemPrimitiveDelete = createActionButton(
15
+ "ThreadListItemPrimitive.Delete",
16
+ useThreadListItemDelete
17
+ );
18
+ export {
19
+ ThreadListItemPrimitiveDelete
20
+ };
21
+ //# sourceMappingURL=ThreadListItemDelete.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadListItem/ThreadListItemDelete.ts"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nconst useThreadListItemDelete = () => {\n const runtime = useThreadListItemRuntime();\n return () => {\n runtime.delete();\n };\n};\n\nexport namespace ThreadListItemPrimitiveDelete {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemDelete>;\n}\n\nexport const ThreadListItemPrimitiveDelete = createActionButton(\n \"ThreadListItemPrimitive.Delete\",\n useThreadListItemDelete,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,gCAAgC;AAEzC,IAAM,0BAA0B,MAAM;AACpC,QAAM,UAAU,yBAAyB;AACzC,SAAO,MAAM;AACX,YAAQ,OAAO;AAAA,EACjB;AACF;AAOO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,13 @@
1
+ import { ActionButtonElement, ActionButtonProps } from "../../utils/createActionButton";
2
+ declare const useThreadListItemUnarchive: () => () => void;
3
+ export declare namespace ThreadListItemPrimitiveUnarchive {
4
+ type Element = ActionButtonElement;
5
+ type Props = ActionButtonProps<typeof useThreadListItemUnarchive>;
6
+ }
7
+ export declare const ThreadListItemPrimitiveUnarchive: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
8
+ ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
9
+ } & {
10
+ asChild?: boolean;
11
+ }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
12
+ export {};
13
+ //# sourceMappingURL=ThreadListItemUnarchive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThreadListItemUnarchive.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAGxC,QAAA,MAAM,0BAA0B,kBAK/B,CAAC;AAEF,yBAAiB,gCAAgC,CAAC;IAChD,KAAY,OAAO,GAAG,mBAAmB,CAAC;IAC1C,KAAY,KAAK,GAAG,iBAAiB,CAAC,OAAO,0BAA0B,CAAC,CAAC;CAC1E;AAED,eAAO,MAAM,gCAAgC;;;;6DAG5C,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/primitives/threadListItem/ThreadListItemUnarchive.ts
22
+ var ThreadListItemUnarchive_exports = {};
23
+ __export(ThreadListItemUnarchive_exports, {
24
+ ThreadListItemPrimitiveUnarchive: () => ThreadListItemPrimitiveUnarchive
25
+ });
26
+ module.exports = __toCommonJS(ThreadListItemUnarchive_exports);
27
+ var import_createActionButton = require("../../utils/createActionButton.cjs");
28
+ var import_ThreadListItemContext = require("../../context/react/ThreadListItemContext.cjs");
29
+ var useThreadListItemUnarchive = () => {
30
+ const runtime = (0, import_ThreadListItemContext.useThreadListItemRuntime)();
31
+ return () => {
32
+ runtime.unarchive();
33
+ };
34
+ };
35
+ var ThreadListItemPrimitiveUnarchive = (0, import_createActionButton.createActionButton)(
36
+ "ThreadListItemPrimitive.Unarchive",
37
+ useThreadListItemUnarchive
38
+ );
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ ThreadListItemPrimitiveUnarchive
42
+ });
43
+ //# sourceMappingURL=ThreadListItemUnarchive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nconst useThreadListItemUnarchive = () => {\n const runtime = useThreadListItemRuntime();\n return () => {\n runtime.unarchive();\n };\n};\n\nexport namespace ThreadListItemPrimitiveUnarchive {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemUnarchive>;\n}\n\nexport const ThreadListItemPrimitiveUnarchive = createActionButton(\n \"ThreadListItemPrimitive.Unarchive\",\n useThreadListItemUnarchive,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAIO;AACP,mCAAyC;AAEzC,IAAM,6BAA6B,MAAM;AACvC,QAAM,cAAU,uDAAyB;AACzC,SAAO,MAAM;AACX,YAAQ,UAAU;AAAA,EACpB;AACF;AAOO,IAAM,uCAAmC;AAAA,EAC9C;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,21 @@
1
+ "use client";
2
+
3
+ // src/primitives/threadListItem/ThreadListItemUnarchive.ts
4
+ import {
5
+ createActionButton
6
+ } from "../../utils/createActionButton.mjs";
7
+ import { useThreadListItemRuntime } from "../../context/react/ThreadListItemContext.mjs";
8
+ var useThreadListItemUnarchive = () => {
9
+ const runtime = useThreadListItemRuntime();
10
+ return () => {
11
+ runtime.unarchive();
12
+ };
13
+ };
14
+ var ThreadListItemPrimitiveUnarchive = createActionButton(
15
+ "ThreadListItemPrimitive.Unarchive",
16
+ useThreadListItemUnarchive
17
+ );
18
+ export {
19
+ ThreadListItemPrimitiveUnarchive
20
+ };
21
+ //# sourceMappingURL=ThreadListItemUnarchive.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadListItem/ThreadListItemUnarchive.ts"],"sourcesContent":["\"use client\";\n\nimport {\n ActionButtonElement,\n ActionButtonProps,\n createActionButton,\n} from \"../../utils/createActionButton\";\nimport { useThreadListItemRuntime } from \"../../context/react/ThreadListItemContext\";\n\nconst useThreadListItemUnarchive = () => {\n const runtime = useThreadListItemRuntime();\n return () => {\n runtime.unarchive();\n };\n};\n\nexport namespace ThreadListItemPrimitiveUnarchive {\n export type Element = ActionButtonElement;\n export type Props = ActionButtonProps<typeof useThreadListItemUnarchive>;\n}\n\nexport const ThreadListItemPrimitiveUnarchive = createActionButton(\n \"ThreadListItemPrimitive.Unarchive\",\n useThreadListItemUnarchive,\n);\n"],"mappings":";;;AAEA;AAAA,EAGE;AAAA,OACK;AACP,SAAS,gCAAgC;AAEzC,IAAM,6BAA6B,MAAM;AACvC,QAAM,UAAU,yBAAyB;AACzC,SAAO,MAAM;AACX,YAAQ,UAAU;AAAA,EACpB;AACF;AAOO,IAAM,mCAAmC;AAAA,EAC9C;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,4 @@
1
+ export { ThreadListItemPrimitiveArchive as Archive } from "./ThreadListItemArchive";
2
+ export { ThreadListItemPrimitiveUnarchive as Unarchive } from "./ThreadListItemUnarchive";
3
+ export { ThreadListItemPrimitiveDelete as Delete } from "./ThreadListItemDelete";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/threadListItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,gCAAgC,IAAI,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,6BAA6B,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/primitives/threadListItem/index.ts
21
+ var threadListItem_exports = {};
22
+ __export(threadListItem_exports, {
23
+ Archive: () => import_ThreadListItemArchive.ThreadListItemPrimitiveArchive,
24
+ Delete: () => import_ThreadListItemDelete.ThreadListItemPrimitiveDelete,
25
+ Unarchive: () => import_ThreadListItemUnarchive.ThreadListItemPrimitiveUnarchive
26
+ });
27
+ module.exports = __toCommonJS(threadListItem_exports);
28
+ var import_ThreadListItemArchive = require("./ThreadListItemArchive.cjs");
29
+ var import_ThreadListItemUnarchive = require("./ThreadListItemUnarchive.cjs");
30
+ var import_ThreadListItemDelete = require("./ThreadListItemDelete.cjs");
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ Archive,
34
+ Delete,
35
+ Unarchive
36
+ });
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadListItem/index.ts"],"sourcesContent":["export { ThreadListItemPrimitiveArchive as Archive } from \"./ThreadListItemArchive\";\nexport { ThreadListItemPrimitiveUnarchive as Unarchive } from \"./ThreadListItemUnarchive\";\nexport { ThreadListItemPrimitiveDelete as Delete } from \"./ThreadListItemDelete\";"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA0D;AAC1D,qCAA8D;AAC9D,kCAAwD;","names":[]}
@@ -0,0 +1,10 @@
1
+ // src/primitives/threadListItem/index.ts
2
+ import { ThreadListItemPrimitiveArchive } from "./ThreadListItemArchive.mjs";
3
+ import { ThreadListItemPrimitiveUnarchive } from "./ThreadListItemUnarchive.mjs";
4
+ import { ThreadListItemPrimitiveDelete } from "./ThreadListItemDelete.mjs";
5
+ export {
6
+ ThreadListItemPrimitiveArchive as Archive,
7
+ ThreadListItemPrimitiveDelete as Delete,
8
+ ThreadListItemPrimitiveUnarchive as Unarchive
9
+ };
10
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/threadListItem/index.ts"],"sourcesContent":["export { ThreadListItemPrimitiveArchive as Archive } from \"./ThreadListItemArchive\";\nexport { ThreadListItemPrimitiveUnarchive as Unarchive } from \"./ThreadListItemUnarchive\";\nexport { ThreadListItemPrimitiveDelete as Delete } from \"./ThreadListItemDelete\";"],"mappings":";AAAA,SAA2C,sCAAe;AAC1D,SAA6C,wCAAiB;AAC9D,SAA0C,qCAAc;","names":[]}
@@ -2,17 +2,21 @@ import { Attachment } from "../../types/AttachmentTypes";
2
2
  import { AppendMessage, Unsubscribe } from "../../types";
3
3
  import { AttachmentAdapter } from "../attachment";
4
4
  import { ComposerRuntimeCore } from "../core/ComposerRuntimeCore";
5
+ import { MessageRole } from "../../types/AssistantTypes";
5
6
  export declare abstract class BaseComposerRuntimeCore implements ComposerRuntimeCore {
6
7
  readonly isEditing = true;
7
8
  protected abstract getAttachmentAdapter(): AttachmentAdapter | undefined;
8
9
  getAttachmentAccept(): string;
9
10
  private _attachments;
10
- protected set attachments(value: readonly Attachment[]);
11
11
  get attachments(): readonly Attachment[];
12
+ protected setAttachments(value: readonly Attachment[]): void;
12
13
  abstract get canCancel(): boolean;
13
14
  get isEmpty(): boolean;
14
15
  private _text;
15
16
  get text(): string;
17
+ private _role;
18
+ get role(): MessageRole;
19
+ setRole(role: MessageRole): void;
16
20
  setText(value: string): void;
17
21
  reset(): void;
18
22
  send(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseComposerRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/composer/BaseComposerRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAKlE,8BAAsB,uBAAwB,YAAW,mBAAmB;IAC1E,SAAgB,SAAS,QAAQ;IAEjC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAEjE,mBAAmB,IAAI,MAAM;IAIpC,OAAO,CAAC,YAAY,CAA6B;IACjD,SAAS,KAAK,WAAW,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAGrD;IACD,IAAW,WAAW,IAJW,SAAS,UAAU,EAAE,CAMrD;IAED,aAAoB,SAAS,IAAI,OAAO,CAAC;IAEzC,IAAW,OAAO,YAEjB;IAED,OAAO,CAAC,KAAK,CAAM;IAEnB,IAAI,IAAI,WAEP;IAED,OAAO,CAAC,KAAK,EAAE,MAAM;IAKrB,KAAK;IAMQ,IAAI;aA0BD,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG,IAAI;aAC1D,MAAM,IAAI,IAAI;IAExB,aAAa,CAAC,IAAI,EAAE,IAAI;IAcxB,gBAAgB,CAAC,YAAY,EAAE,MAAM;IAc3C,OAAO,CAAC,cAAc,CAAyB;IAC/C,SAAS,CAAC,iBAAiB;IAIpB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW;CAIpD"}
1
+ {"version":3,"file":"BaseComposerRuntimeCore.d.ts","sourceRoot":"","sources":["../../../src/runtimes/composer/BaseComposerRuntimeCore.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKzD,8BAAsB,uBAAwB,YAAW,mBAAmB;IAC1E,SAAgB,SAAS,QAAQ;IAEjC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAEjE,mBAAmB,IAAI,MAAM;IAIpC,OAAO,CAAC,YAAY,CAA6B;IACjD,IAAW,WAAW,0BAErB;IAED,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE;IAKrD,aAAoB,SAAS,IAAI,OAAO,CAAC;IAEzC,IAAW,OAAO,YAEjB;IAED,OAAO,CAAC,KAAK,CAAM;IAEnB,IAAI,IAAI,WAEP;IAED,OAAO,CAAC,KAAK,CAAuB;IAEpC,IAAI,IAAI,gBAEP;IAED,OAAO,CAAC,IAAI,EAAE,WAAW;IAKzB,OAAO,CAAC,KAAK,EAAE,MAAM;IAKrB,KAAK;IAOQ,IAAI;aA0BD,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG,IAAI;aAC1D,MAAM,IAAI,IAAI;IAExB,aAAa,CAAC,IAAI,EAAE,IAAI;IAcxB,gBAAgB,CAAC,YAAY,EAAE,MAAM;IAc3C,OAAO,CAAC,cAAc,CAAyB;IAC/C,SAAS,CAAC,iBAAiB;IAIpB,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW;CAIpD"}
@@ -30,13 +30,13 @@ var BaseComposerRuntimeCore = class {
30
30
  return this.getAttachmentAdapter()?.accept ?? "*";
31
31
  }
32
32
  _attachments = [];
33
- set attachments(value) {
34
- this._attachments = value;
35
- this.notifySubscribers();
36
- }
37
33
  get attachments() {
38
34
  return this._attachments;
39
35
  }
36
+ setAttachments(value) {
37
+ this._attachments = value;
38
+ this.notifySubscribers();
39
+ }
40
40
  get isEmpty() {
41
41
  return !this.text.trim() && !this.attachments.length;
42
42
  }
@@ -44,12 +44,21 @@ var BaseComposerRuntimeCore = class {
44
44
  get text() {
45
45
  return this._text;
46
46
  }
47
+ _role = "user";
48
+ get role() {
49
+ return this._role;
50
+ }
51
+ setRole(role) {
52
+ this._role = role;
53
+ this.notifySubscribers();
54
+ }
47
55
  setText(value) {
48
56
  this._text = value;
49
57
  this.notifySubscribers();
50
58
  }
51
59
  reset() {
52
60
  this._text = "";
61
+ this._role = "user";
53
62
  this._attachments = [];
54
63
  this.notifySubscribers();
55
64
  }
@@ -66,7 +75,7 @@ var BaseComposerRuntimeCore = class {
66
75
  })
67
76
  ) : [];
68
77
  const message = {
69
- role: "user",
78
+ role: this.role,
70
79
  content: this.text ? [{ type: "text", text: this.text }] : [],
71
80
  attachments
72
81
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtimes/composer/BaseComposerRuntimeCore.tsx"],"sourcesContent":["import {\n Attachment,\n CompleteAttachment,\n PendingAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AppendMessage, Unsubscribe } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ComposerRuntimeCore } from \"../core/ComposerRuntimeCore\";\n\nconst isAttachmentComplete = (a: Attachment): a is CompleteAttachment =>\n a.status.type === \"complete\";\n\nexport abstract class BaseComposerRuntimeCore implements ComposerRuntimeCore {\n public readonly isEditing = true;\n\n protected abstract getAttachmentAdapter(): AttachmentAdapter | undefined;\n\n public getAttachmentAccept(): string {\n return this.getAttachmentAdapter()?.accept ?? \"*\";\n }\n\n private _attachments: readonly Attachment[] = [];\n protected set attachments(value: readonly Attachment[]) {\n this._attachments = value;\n this.notifySubscribers();\n }\n public get attachments() {\n return this._attachments;\n }\n\n public abstract get canCancel(): boolean;\n\n public get isEmpty() {\n return !this.text.trim() && !this.attachments.length;\n }\n\n private _text = \"\";\n\n get text() {\n return this._text;\n }\n\n setText(value: string) {\n this._text = value;\n this.notifySubscribers();\n }\n\n reset() {\n this._text = \"\";\n this._attachments = [];\n this.notifySubscribers();\n }\n\n public async send() {\n const adapter = this.getAttachmentAdapter();\n const attachments =\n adapter && this.attachments.length > 0\n ? await Promise.all(\n this.attachments.map(async (a) => {\n if (isAttachmentComplete(a)) return a;\n const result = await adapter.send(a);\n // TODO remove after 0.6.0\n if (result.status?.type !== \"complete\") {\n result.status = { type: \"complete\" };\n }\n return result as CompleteAttachment;\n }),\n )\n : [];\n\n const message: Omit<AppendMessage, \"parentId\"> = {\n role: \"user\",\n content: this.text ? [{ type: \"text\", text: this.text }] : [],\n attachments,\n };\n this.reset();\n\n this.handleSend(message);\n }\n public abstract handleSend(message: Omit<AppendMessage, \"parentId\">): void;\n public abstract cancel(): void;\n\n async addAttachment(file: File) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n const attachment = await adapter.add({ file });\n // TODO remove after 0.6.0\n if (attachment.status === undefined) {\n attachment.status = { type: \"requires-action\", reason: \"composer-send\" };\n }\n\n this._attachments = [...this._attachments, attachment as PendingAttachment];\n this.notifySubscribers();\n }\n\n async removeAttachment(attachmentId: string) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n const index = this._attachments.findIndex((a) => a.id === attachmentId);\n if (index === -1) throw new Error(\"Attachment not found\");\n const attachment = this._attachments[index]!;\n\n await adapter.remove(attachment);\n\n this._attachments = this._attachments.toSpliced(index, 1);\n this.notifySubscribers();\n }\n\n private _subscriptions = new Set<() => void>();\n protected notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,IAAM,uBAAuB,CAAC,MAC5B,EAAE,OAAO,SAAS;AAEb,IAAe,0BAAf,MAAsE;AAAA,EAC3D,YAAY;AAAA,EAIrB,sBAA8B;AACnC,WAAO,KAAK,qBAAqB,GAAG,UAAU;AAAA,EAChD;AAAA,EAEQ,eAAsC,CAAC;AAAA,EAC/C,IAAc,YAAY,OAA8B;AACtD,SAAK,eAAe;AACpB,SAAK,kBAAkB;AAAA,EACzB;AAAA,EACA,IAAW,cAAc;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAIA,IAAW,UAAU;AACnB,WAAO,CAAC,KAAK,KAAK,KAAK,KAAK,CAAC,KAAK,YAAY;AAAA,EAChD;AAAA,EAEQ,QAAQ;AAAA,EAEhB,IAAI,OAAO;AACT,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,QAAQ,OAAe;AACrB,SAAK,QAAQ;AACb,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,QAAQ;AACN,SAAK,QAAQ;AACb,SAAK,eAAe,CAAC;AACrB,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,MAAa,OAAO;AAClB,UAAM,UAAU,KAAK,qBAAqB;AAC1C,UAAM,cACJ,WAAW,KAAK,YAAY,SAAS,IACjC,MAAM,QAAQ;AAAA,MACZ,KAAK,YAAY,IAAI,OAAO,MAAM;AAChC,YAAI,qBAAqB,CAAC,EAAG,QAAO;AACpC,cAAM,SAAS,MAAM,QAAQ,KAAK,CAAC;AAEnC,YAAI,OAAO,QAAQ,SAAS,YAAY;AACtC,iBAAO,SAAS,EAAE,MAAM,WAAW;AAAA,QACrC;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH,IACA,CAAC;AAEP,UAAM,UAA2C;AAAA,MAC/C,MAAM;AAAA,MACN,SAAS,KAAK,OAAO,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC;AAAA,MAC5D;AAAA,IACF;AACA,SAAK,MAAM;AAEX,SAAK,WAAW,OAAO;AAAA,EACzB;AAAA,EAIA,MAAM,cAAc,MAAY;AAC9B,UAAM,UAAU,KAAK,qBAAqB;AAC1C,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,+BAA+B;AAE7D,UAAM,aAAa,MAAM,QAAQ,IAAI,EAAE,KAAK,CAAC;AAE7C,QAAI,WAAW,WAAW,QAAW;AACnC,iBAAW,SAAS,EAAE,MAAM,mBAAmB,QAAQ,gBAAgB;AAAA,IACzE;AAEA,SAAK,eAAe,CAAC,GAAG,KAAK,cAAc,UAA+B;AAC1E,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,MAAM,iBAAiB,cAAsB;AAC3C,UAAM,UAAU,KAAK,qBAAqB;AAC1C,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,+BAA+B;AAE7D,UAAM,QAAQ,KAAK,aAAa,UAAU,CAAC,MAAM,EAAE,OAAO,YAAY;AACtE,QAAI,UAAU,GAAI,OAAM,IAAI,MAAM,sBAAsB;AACxD,UAAM,aAAa,KAAK,aAAa,KAAK;AAE1C,UAAM,QAAQ,OAAO,UAAU;AAE/B,SAAK,eAAe,KAAK,aAAa,UAAU,OAAO,CAAC;AACxD,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEQ,iBAAiB,oBAAI,IAAgB;AAAA,EACnC,oBAAoB;AAC5B,eAAW,YAAY,KAAK,eAAgB,UAAS;AAAA,EACvD;AAAA,EAEO,UAAU,UAAmC;AAClD,SAAK,eAAe,IAAI,QAAQ;AAChC,WAAO,MAAM,KAAK,eAAe,OAAO,QAAQ;AAAA,EAClD;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/runtimes/composer/BaseComposerRuntimeCore.tsx"],"sourcesContent":["import {\n Attachment,\n CompleteAttachment,\n PendingAttachment,\n} from \"../../types/AttachmentTypes\";\nimport { AppendMessage, Unsubscribe } from \"../../types\";\nimport { AttachmentAdapter } from \"../attachment\";\nimport { ComposerRuntimeCore } from \"../core/ComposerRuntimeCore\";\nimport { MessageRole } from \"../../types/AssistantTypes\";\n\nconst isAttachmentComplete = (a: Attachment): a is CompleteAttachment =>\n a.status.type === \"complete\";\n\nexport abstract class BaseComposerRuntimeCore implements ComposerRuntimeCore {\n public readonly isEditing = true;\n\n protected abstract getAttachmentAdapter(): AttachmentAdapter | undefined;\n\n public getAttachmentAccept(): string {\n return this.getAttachmentAdapter()?.accept ?? \"*\";\n }\n\n private _attachments: readonly Attachment[] = [];\n public get attachments() {\n return this._attachments;\n }\n\n protected setAttachments(value: readonly Attachment[]) {\n this._attachments = value;\n this.notifySubscribers();\n }\n\n public abstract get canCancel(): boolean;\n\n public get isEmpty() {\n return !this.text.trim() && !this.attachments.length;\n }\n\n private _text = \"\";\n\n get text() {\n return this._text;\n }\n\n private _role: MessageRole = \"user\";\n\n get role() {\n return this._role;\n }\n\n setRole(role: MessageRole) {\n this._role = role;\n this.notifySubscribers();\n }\n\n setText(value: string) {\n this._text = value;\n this.notifySubscribers();\n }\n\n reset() {\n this._text = \"\";\n this._role = \"user\";\n this._attachments = [];\n this.notifySubscribers();\n }\n\n public async send() {\n const adapter = this.getAttachmentAdapter();\n const attachments =\n adapter && this.attachments.length > 0\n ? await Promise.all(\n this.attachments.map(async (a) => {\n if (isAttachmentComplete(a)) return a;\n const result = await adapter.send(a);\n // TODO remove after 0.6.0\n if (result.status?.type !== \"complete\") {\n result.status = { type: \"complete\" };\n }\n return result as CompleteAttachment;\n }),\n )\n : [];\n\n const message: Omit<AppendMessage, \"parentId\"> = {\n role: this.role,\n content: this.text ? [{ type: \"text\", text: this.text }] : [],\n attachments,\n };\n this.reset();\n\n this.handleSend(message);\n }\n public abstract handleSend(message: Omit<AppendMessage, \"parentId\">): void;\n public abstract cancel(): void;\n\n async addAttachment(file: File) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n const attachment = await adapter.add({ file });\n // TODO remove after 0.6.0\n if (attachment.status === undefined) {\n attachment.status = { type: \"requires-action\", reason: \"composer-send\" };\n }\n\n this._attachments = [...this._attachments, attachment as PendingAttachment];\n this.notifySubscribers();\n }\n\n async removeAttachment(attachmentId: string) {\n const adapter = this.getAttachmentAdapter();\n if (!adapter) throw new Error(\"Attachments are not supported\");\n\n const index = this._attachments.findIndex((a) => a.id === attachmentId);\n if (index === -1) throw new Error(\"Attachment not found\");\n const attachment = this._attachments[index]!;\n\n await adapter.remove(attachment);\n\n this._attachments = this._attachments.toSpliced(index, 1);\n this.notifySubscribers();\n }\n\n private _subscriptions = new Set<() => void>();\n protected notifySubscribers() {\n for (const callback of this._subscriptions) callback();\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n this._subscriptions.add(callback);\n return () => this._subscriptions.delete(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,uBAAuB,CAAC,MAC5B,EAAE,OAAO,SAAS;AAEb,IAAe,0BAAf,MAAsE;AAAA,EAC3D,YAAY;AAAA,EAIrB,sBAA8B;AACnC,WAAO,KAAK,qBAAqB,GAAG,UAAU;AAAA,EAChD;AAAA,EAEQ,eAAsC,CAAC;AAAA,EAC/C,IAAW,cAAc;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAEU,eAAe,OAA8B;AACrD,SAAK,eAAe;AACpB,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAIA,IAAW,UAAU;AACnB,WAAO,CAAC,KAAK,KAAK,KAAK,KAAK,CAAC,KAAK,YAAY;AAAA,EAChD;AAAA,EAEQ,QAAQ;AAAA,EAEhB,IAAI,OAAO;AACT,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,QAAqB;AAAA,EAE7B,IAAI,OAAO;AACT,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,QAAQ,MAAmB;AACzB,SAAK,QAAQ;AACb,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,QAAQ,OAAe;AACrB,SAAK,QAAQ;AACb,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,QAAQ;AACN,SAAK,QAAQ;AACb,SAAK,QAAQ;AACb,SAAK,eAAe,CAAC;AACrB,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,MAAa,OAAO;AAClB,UAAM,UAAU,KAAK,qBAAqB;AAC1C,UAAM,cACJ,WAAW,KAAK,YAAY,SAAS,IACjC,MAAM,QAAQ;AAAA,MACZ,KAAK,YAAY,IAAI,OAAO,MAAM;AAChC,YAAI,qBAAqB,CAAC,EAAG,QAAO;AACpC,cAAM,SAAS,MAAM,QAAQ,KAAK,CAAC;AAEnC,YAAI,OAAO,QAAQ,SAAS,YAAY;AACtC,iBAAO,SAAS,EAAE,MAAM,WAAW;AAAA,QACrC;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH,IACA,CAAC;AAEP,UAAM,UAA2C;AAAA,MAC/C,MAAM,KAAK;AAAA,MACX,SAAS,KAAK,OAAO,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC;AAAA,MAC5D;AAAA,IACF;AACA,SAAK,MAAM;AAEX,SAAK,WAAW,OAAO;AAAA,EACzB;AAAA,EAIA,MAAM,cAAc,MAAY;AAC9B,UAAM,UAAU,KAAK,qBAAqB;AAC1C,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,+BAA+B;AAE7D,UAAM,aAAa,MAAM,QAAQ,IAAI,EAAE,KAAK,CAAC;AAE7C,QAAI,WAAW,WAAW,QAAW;AACnC,iBAAW,SAAS,EAAE,MAAM,mBAAmB,QAAQ,gBAAgB;AAAA,IACzE;AAEA,SAAK,eAAe,CAAC,GAAG,KAAK,cAAc,UAA+B;AAC1E,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEA,MAAM,iBAAiB,cAAsB;AAC3C,UAAM,UAAU,KAAK,qBAAqB;AAC1C,QAAI,CAAC,QAAS,OAAM,IAAI,MAAM,+BAA+B;AAE7D,UAAM,QAAQ,KAAK,aAAa,UAAU,CAAC,MAAM,EAAE,OAAO,YAAY;AACtE,QAAI,UAAU,GAAI,OAAM,IAAI,MAAM,sBAAsB;AACxD,UAAM,aAAa,KAAK,aAAa,KAAK;AAE1C,UAAM,QAAQ,OAAO,UAAU;AAE/B,SAAK,eAAe,KAAK,aAAa,UAAU,OAAO,CAAC;AACxD,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEQ,iBAAiB,oBAAI,IAAgB;AAAA,EACnC,oBAAoB;AAC5B,eAAW,YAAY,KAAK,eAAgB,UAAS;AAAA,EACvD;AAAA,EAEO,UAAU,UAAmC;AAClD,SAAK,eAAe,IAAI,QAAQ;AAChC,WAAO,MAAM,KAAK,eAAe,OAAO,QAAQ;AAAA,EAClD;AACF;","names":[]}
@@ -6,13 +6,13 @@ var BaseComposerRuntimeCore = class {
6
6
  return this.getAttachmentAdapter()?.accept ?? "*";
7
7
  }
8
8
  _attachments = [];
9
- set attachments(value) {
10
- this._attachments = value;
11
- this.notifySubscribers();
12
- }
13
9
  get attachments() {
14
10
  return this._attachments;
15
11
  }
12
+ setAttachments(value) {
13
+ this._attachments = value;
14
+ this.notifySubscribers();
15
+ }
16
16
  get isEmpty() {
17
17
  return !this.text.trim() && !this.attachments.length;
18
18
  }
@@ -20,12 +20,21 @@ var BaseComposerRuntimeCore = class {
20
20
  get text() {
21
21
  return this._text;
22
22
  }
23
+ _role = "user";
24
+ get role() {
25
+ return this._role;
26
+ }
27
+ setRole(role) {
28
+ this._role = role;
29
+ this.notifySubscribers();
30
+ }
23
31
  setText(value) {
24
32
  this._text = value;
25
33
  this.notifySubscribers();
26
34
  }
27
35
  reset() {
28
36
  this._text = "";
37
+ this._role = "user";
29
38
  this._attachments = [];
30
39
  this.notifySubscribers();
31
40
  }
@@ -42,7 +51,7 @@ var BaseComposerRuntimeCore = class {
42
51
  })
43
52
  ) : [];
44
53
  const message = {
45
- role: "user",
54
+ role: this.role,
46
55
  content: this.text ? [{ type: "text", text: this.text }] : [],
47
56
  attachments
48
57
  };