@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,159 @@
1
+ import { LazyMemoizeSubject } from "./subscribable/LazyMemoizeSubject";
2
+ import {
3
+ ThreadListMetadata,
4
+ ThreadListRuntimeCore,
5
+ } from "../runtimes/core/ThreadListRuntimeCore";
6
+ import { Unsubscribe } from "../types";
7
+ import { ThreadListRuntimePath } from "./RuntimePathTypes";
8
+ import {
9
+ ThreadListItemRuntime,
10
+ ThreadListItemRuntimeImpl,
11
+ } from "./ThreadListItemRuntime";
12
+ import { SKIP_UPDATE } from "./subscribable/SKIP_UPDATE";
13
+
14
+ export type ThreadListState = Readonly<{
15
+ threads: readonly ThreadListMetadata[];
16
+ archivedThreads: readonly ThreadListMetadata[];
17
+ }>;
18
+
19
+ export type ThreadListRuntime = Readonly<{
20
+ path: ThreadListRuntimePath;
21
+ getState(): ThreadListState;
22
+
23
+ /**
24
+ * @deprecated Use `getThreadListItemById(idx).rename(newTitle)` instead. This will be removed in 0.6.0.
25
+ */
26
+ rename(threadId: string, newTitle: string): Promise<void>;
27
+ /**
28
+ * @deprecated Use `getThreadListItemById(idx).archive()` instead. This will be removed in 0.6.0.
29
+ */
30
+ archive(threadId: string): Promise<void>;
31
+ /**
32
+ * @deprecated Use `getThreadListItemById(idx).unarchive()` instead. This will be removed in 0.6.0.
33
+ */
34
+ unarchive(threadId: string): Promise<void>;
35
+ /**
36
+ * @deprecated Use `getThreadListItemById(idx).delete()` instead. This will be removed in 0.6.0.
37
+ */
38
+ delete(threadId: string): Promise<void>;
39
+
40
+ subscribe(callback: () => void): Unsubscribe;
41
+
42
+ getThreadListItemById(threadId: string): ThreadListItemRuntime;
43
+ getThreadListItemByIndex(idx: number): ThreadListItemRuntime;
44
+ getThreadListArchivedItemByIndex(idx: number): ThreadListItemRuntime;
45
+ }>;
46
+
47
+ const getThreadListState = (
48
+ threadList: ThreadListRuntimeCore,
49
+ ): ThreadListState => {
50
+ return {
51
+ threads: threadList.threads,
52
+ archivedThreads: threadList.archivedThreads,
53
+ };
54
+ };
55
+
56
+ const THREAD_MANAGER_PATH = {
57
+ ref: "ThreadList",
58
+ };
59
+
60
+ export type ThreadListRuntimeCoreBinding = ThreadListRuntimeCore;
61
+
62
+ export class ThreadListRuntimeImpl implements ThreadListRuntime {
63
+ public get path() {
64
+ return THREAD_MANAGER_PATH;
65
+ }
66
+
67
+ private _getState;
68
+ constructor(private _core: ThreadListRuntimeCoreBinding) {
69
+ const stateBinding = new LazyMemoizeSubject({
70
+ path: THREAD_MANAGER_PATH,
71
+ getState: () => getThreadListState(_core),
72
+ subscribe: (callback) => _core.subscribe(callback),
73
+ });
74
+
75
+ this._getState = stateBinding.getState.bind(stateBinding);
76
+ }
77
+
78
+ public getState(): ThreadListState {
79
+ return this._getState();
80
+ }
81
+
82
+ public rename(threadId: string, newTitle: string): Promise<void> {
83
+ return this._core.rename(threadId, newTitle);
84
+ }
85
+
86
+ public archive(threadId: string): Promise<void> {
87
+ return this._core.archive(threadId);
88
+ }
89
+
90
+ public unarchive(threadId: string): Promise<void> {
91
+ return this._core.unarchive(threadId);
92
+ }
93
+
94
+ public delete(threadId: string): Promise<void> {
95
+ return this._core.delete(threadId);
96
+ }
97
+
98
+ public subscribe(callback: () => void): Unsubscribe {
99
+ return this._core.subscribe(callback);
100
+ }
101
+
102
+ public getThreadListItemByIndex(idx: number) {
103
+ return new ThreadListItemRuntimeImpl(
104
+ new LazyMemoizeSubject({
105
+ path: {
106
+ ref: this.path.ref + `${this.path.ref}.threadItems[${idx}]`,
107
+ threadSelector: { type: "index", index: idx },
108
+ },
109
+ getState: () => {
110
+ const threads = this._core.threads;
111
+ const thread = threads[idx];
112
+ if (!thread) return SKIP_UPDATE;
113
+ return thread;
114
+ },
115
+ subscribe: (callback) => this._core.subscribe(callback),
116
+ }),
117
+ this._core,
118
+ );
119
+ }
120
+
121
+ public getThreadListArchivedItemByIndex(idx: number) {
122
+ return new ThreadListItemRuntimeImpl(
123
+ new LazyMemoizeSubject({
124
+ path: {
125
+ ref: this.path.ref + `${this.path.ref}.archivedThreadItems[${idx}]`,
126
+ threadSelector: { type: "archiveIndex", index: idx },
127
+ },
128
+ getState: () => {
129
+ const threads = this._core.archivedThreads;
130
+ const thread = threads[idx];
131
+ if (!thread) return SKIP_UPDATE;
132
+ return thread;
133
+ },
134
+ subscribe: (callback) => this._core.subscribe(callback),
135
+ }),
136
+ this._core,
137
+ );
138
+ }
139
+
140
+ public getThreadListItemById(threadId: string) {
141
+ return new ThreadListItemRuntimeImpl(
142
+ new LazyMemoizeSubject({
143
+ path: {
144
+ ref:
145
+ this.path.ref +
146
+ `${this.path.ref}.threadItems[threadId=${threadId}]`,
147
+ threadSelector: { type: "threadId", threadId },
148
+ },
149
+ getState: () => {
150
+ const threadItem = this._core.getThreadMetadataById(threadId);
151
+ if (!threadItem) return SKIP_UPDATE;
152
+ return threadItem;
153
+ },
154
+ subscribe: (callback) => this._core.subscribe(callback),
155
+ }),
156
+ this._core,
157
+ );
158
+ }
159
+ }
@@ -42,6 +42,7 @@ export type CreateAppendMessage =
42
42
  role?: AppendMessage["role"] | undefined;
43
43
  content: AppendMessage["content"];
44
44
  attachments?: AppendMessage["attachments"] | undefined;
45
+ startRun?: boolean | undefined;
45
46
  };
46
47
 
47
48
  const toAppendMessage = (
@@ -62,9 +63,9 @@ const toAppendMessage = (
62
63
  }
63
64
 
64
65
  return {
66
+ ...message,
65
67
  parentId: message.parentId ?? messages.at(-1)?.id ?? null,
66
68
  role: message.role ?? "user",
67
- content: message.content,
68
69
  attachments: message.attachments ?? [],
69
70
  } as AppendMessage;
70
71
  };
package/src/api/index.ts CHANGED
@@ -14,7 +14,4 @@ export type {
14
14
  ComposerState,
15
15
  } from "./ComposerRuntime";
16
16
  export type { AttachmentRuntime, AttachmentState } from "./AttachmentRuntime";
17
- export type {
18
- ThreadManagerRuntime,
19
- ThreadManagerState,
20
- } from "./ThreadManagerRuntime";
17
+ export type { ThreadListRuntime, ThreadListState } from "./ThreadListRuntime";
@@ -32,16 +32,14 @@ const useAssistantToolUIsStore = () => {
32
32
  return useMemo(() => makeAssistantToolUIsStore(), []);
33
33
  };
34
34
 
35
- const useThreadManagerStore = (runtime: AssistantRuntime) => {
36
- const [store] = useState(() =>
37
- create(() => runtime.threadManager.getState()),
38
- );
35
+ const useThreadListStore = (runtime: AssistantRuntime) => {
36
+ const [store] = useState(() => create(() => runtime.threadList.getState()));
39
37
 
40
38
  useEffect(() => {
41
39
  const updateState = () =>
42
- writableStore(store).setState(runtime.threadManager.getState(), true);
40
+ writableStore(store).setState(runtime.threadList.getState(), true);
43
41
  updateState();
44
- return runtime.threadManager.subscribe(updateState);
42
+ return runtime.threadList.subscribe(updateState);
45
43
  }, [runtime, store]);
46
44
 
47
45
  return store;
@@ -52,15 +50,15 @@ export const AssistantRuntimeProviderImpl: FC<
52
50
  > = ({ children, runtime }) => {
53
51
  const useAssistantRuntime = useAssistantRuntimeStore(runtime);
54
52
  const useToolUIs = useAssistantToolUIsStore();
55
- const useThreadManager = useThreadManagerStore(runtime);
53
+ const useThreadList = useThreadListStore(runtime);
56
54
  const context = useMemo(() => {
57
55
  return {
58
56
  useToolUIs,
59
57
  useAssistantRuntime,
60
58
  useAssistantActions: useAssistantRuntime,
61
- useThreadManager,
59
+ useThreadList,
62
60
  };
63
- }, [useAssistantRuntime, useToolUIs, useThreadManager]);
61
+ }, [useAssistantRuntime, useToolUIs, useThreadList]);
64
62
 
65
63
  return (
66
64
  <AssistantContext.Provider value={context}>
@@ -12,9 +12,11 @@ import { AttachmentContext } from "../react/AttachmentContext";
12
12
  import { writableStore } from "../ReadonlyStore";
13
13
  import { AttachmentRuntime } from "../../api/AttachmentRuntime";
14
14
 
15
- type AttachmentRuntimeProviderProps = PropsWithChildren<{
16
- runtime: AttachmentRuntime;
17
- }>;
15
+ export namespace AttachmentRuntimeProvider {
16
+ export type Props = PropsWithChildren<{
17
+ runtime: AttachmentRuntime;
18
+ }>;
19
+ }
18
20
 
19
21
  const useAttachmentRuntimeStore = (runtime: AttachmentRuntime) => {
20
22
  const [store] = useState(() => create(() => runtime));
@@ -37,7 +39,7 @@ const useAttachmentStore = (runtime: AttachmentRuntime) => {
37
39
  return store;
38
40
  };
39
41
 
40
- export const AttachmentRuntimeProvider: FC<AttachmentRuntimeProviderProps> = ({
42
+ export const AttachmentRuntimeProvider: FC<AttachmentRuntimeProvider.Props> = ({
41
43
  runtime,
42
44
  children,
43
45
  }) => {
@@ -7,9 +7,11 @@ import type { ContentPartContextValue } from "../react/ContentPartContext";
7
7
  import { writableStore } from "../ReadonlyStore";
8
8
  import { ContentPartRuntime } from "../../api/ContentPartRuntime";
9
9
 
10
- type ContentPartProviderProps = PropsWithChildren<{
11
- runtime: ContentPartRuntime;
12
- }>;
10
+ export namespace ContentPartRuntimeProvider {
11
+ export type Props = PropsWithChildren<{
12
+ runtime: ContentPartRuntime;
13
+ }>;
14
+ }
13
15
 
14
16
  const useContentPartRuntimeStore = (runtime: ContentPartRuntime) => {
15
17
  const [store] = useState(() => create(() => runtime));
@@ -33,10 +35,9 @@ export const useContentPartStore = (runtime: ContentPartRuntime) => {
33
35
  return store;
34
36
  };
35
37
 
36
- export const ContentPartRuntimeProvider: FC<ContentPartProviderProps> = ({
37
- runtime,
38
- children,
39
- }) => {
38
+ export const ContentPartRuntimeProvider: FC<
39
+ ContentPartRuntimeProvider.Props
40
+ > = ({ runtime, children }) => {
40
41
  const useContentPartRuntime = useContentPartRuntimeStore(runtime);
41
42
  const useContentPart = useContentPartStore(runtime);
42
43
  const [context] = useState<ContentPartContextValue>(() => {
@@ -8,9 +8,11 @@ import { makeMessageUtilsStore } from "../stores/MessageUtils";
8
8
  import { ReadonlyStore, writableStore } from "../ReadonlyStore";
9
9
  import { MessageRuntime } from "../../api/MessageRuntime";
10
10
 
11
- type MessageProviderProps = PropsWithChildren<{
12
- runtime: MessageRuntime;
13
- }>;
11
+ export namespace MessageRuntimeProvider {
12
+ export type Props = PropsWithChildren<{
13
+ runtime: MessageRuntime;
14
+ }>;
15
+ }
14
16
 
15
17
  const useMessageRuntimeStore = (runtime: MessageRuntime) => {
16
18
  const [store] = useState(() => create(() => runtime));
@@ -54,7 +56,7 @@ const useEditComposerStore = (
54
56
  return store;
55
57
  };
56
58
 
57
- export const MessageRuntimeProvider: FC<MessageProviderProps> = ({
59
+ export const MessageRuntimeProvider: FC<MessageRuntimeProvider.Props> = ({
58
60
  runtime,
59
61
  children,
60
62
  }) => {
@@ -14,10 +14,12 @@ import {
14
14
  ContentPartState,
15
15
  } from "../../api/ContentPartRuntime";
16
16
 
17
- type TextContentPartProviderProps = {
18
- text: string;
19
- isRunning?: boolean | undefined;
20
- };
17
+ export namespace TextContentPartProvider {
18
+ export type Props = PropsWithChildren<{
19
+ text: string;
20
+ isRunning?: boolean | undefined;
21
+ }>;
22
+ }
21
23
 
22
24
  const COMPLETE_STATUS: ContentPartStatus = {
23
25
  type: "complete",
@@ -27,9 +29,11 @@ const RUNNING_STATUS: ContentPartStatus = {
27
29
  type: "running",
28
30
  };
29
31
 
30
- export const TextContentPartProvider: FC<
31
- PropsWithChildren<TextContentPartProviderProps>
32
- > = ({ children, text, isRunning }) => {
32
+ export const TextContentPartProvider: FC<TextContentPartProvider.Props> = ({
33
+ children,
34
+ text,
35
+ isRunning,
36
+ }) => {
33
37
  const [context] = useState<ContentPartContextValue>(() => {
34
38
  const useContentPartRuntime = create(
35
39
  // TODO
@@ -0,0 +1,54 @@
1
+ "use client";
2
+
3
+ import { type FC, type PropsWithChildren, useEffect, useState } from "react";
4
+ import { create } from "zustand";
5
+ import {
6
+ ThreadListItemContext,
7
+ type ThreadListItemContextValue,
8
+ } from "../react/ThreadListItemContext";
9
+ import { writableStore } from "../ReadonlyStore";
10
+ import { ThreadListItemRuntime } from "../../api/ThreadListItemRuntime";
11
+
12
+ export namespace ThreadListItemRuntimeProvider {
13
+ export type Props = PropsWithChildren<{
14
+ runtime: ThreadListItemRuntime;
15
+ }>;
16
+ }
17
+
18
+ const useThreadListItemRuntimeStore = (runtime: ThreadListItemRuntime) => {
19
+ const [store] = useState(() => create(() => runtime));
20
+
21
+ useEffect(() => {
22
+ writableStore(store).setState(runtime, true);
23
+ }, [runtime, store]);
24
+
25
+ return store;
26
+ };
27
+
28
+ export const useThreadListItemStore = (runtime: ThreadListItemRuntime) => {
29
+ const [store] = useState(() => create(() => runtime.getState()));
30
+ useEffect(() => {
31
+ const updateState = () =>
32
+ writableStore(store).setState(runtime.getState(), true);
33
+ updateState();
34
+ return runtime.subscribe(updateState);
35
+ }, [runtime, store]);
36
+
37
+ return store;
38
+ };
39
+
40
+ export const ThreadListItemRuntimeProvider: FC<
41
+ ThreadListItemRuntimeProvider.Props
42
+ > = ({ runtime, children }) => {
43
+ const useThreadListItemRuntime = useThreadListItemRuntimeStore(runtime);
44
+ const useThreadListItem = useThreadListItemStore(runtime);
45
+ const [context] = useState<ThreadListItemContextValue>(() => {
46
+ return { useThreadListItemRuntime, useThreadListItem };
47
+ });
48
+
49
+ return (
50
+ <ThreadListItemContext.Provider value={context}>
51
+ {children}
52
+ </ThreadListItemContext.Provider>
53
+ );
54
+ };
@@ -7,12 +7,12 @@ import { createContextHook } from "./utils/createContextHook";
7
7
  import { createContextStoreHook } from "./utils/createContextStoreHook";
8
8
  import { UseBoundStore } from "zustand";
9
9
  import { AssistantRuntime } from "../../api/AssistantRuntime";
10
- import { ThreadManagerState } from "../../api/ThreadManagerRuntime";
10
+ import { ThreadListState } from "../../api/ThreadListRuntime";
11
11
 
12
12
  export type AssistantContextValue = {
13
13
  useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>;
14
14
  useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
15
- useThreadManager: UseBoundStore<ReadonlyStore<ThreadManagerState>>;
15
+ useThreadList: UseBoundStore<ReadonlyStore<ThreadListState>>;
16
16
 
17
17
  /**
18
18
  * @deprecated Use `useAssistantRuntime` instead. This will be removed in 0.6.0.
@@ -68,7 +68,7 @@ export const { useToolUIs, useToolUIsStore } = createContextStoreHook(
68
68
  "useToolUIs",
69
69
  );
70
70
 
71
- export const { useThreadManager } = createContextStoreHook(
71
+ export const { useThreadList } = createContextStoreHook(
72
72
  useAssistantContext,
73
- "useThreadManager",
73
+ "useThreadList",
74
74
  );
@@ -0,0 +1,39 @@
1
+ "use client";
2
+
3
+ import { createContext } from "react";
4
+ import { ReadonlyStore } from "../ReadonlyStore";
5
+ import { createContextStoreHook } from "./utils/createContextStoreHook";
6
+ import { createContextHook } from "./utils/createContextHook";
7
+ import { UseBoundStore } from "zustand";
8
+ import { ThreadListItemRuntime } from "../../api/ThreadListItemRuntime";
9
+ import { ThreadListItemState } from "../../api/ThreadListItemRuntime";
10
+
11
+ export type ThreadListItemContextValue = {
12
+ useThreadListItemRuntime: UseBoundStore<ReadonlyStore<ThreadListItemRuntime>>;
13
+ useThreadListItem: UseBoundStore<ReadonlyStore<ThreadListItemState>>;
14
+ };
15
+
16
+ export const ThreadListItemContext =
17
+ createContext<ThreadListItemContextValue | null>(null);
18
+
19
+ export const useThreadListItemContext = createContextHook(
20
+ ThreadListItemContext,
21
+ "a component passed to <ThreadListPrimitive.Items components={...}>",
22
+ );
23
+
24
+ export function useThreadListItemRuntime(options?: {
25
+ optional?: false | undefined;
26
+ }): ThreadListItemRuntime;
27
+ export function useThreadListItemRuntime(options?: {
28
+ optional?: boolean | undefined;
29
+ }): ThreadListItemRuntime | null;
30
+ export function useThreadListItemRuntime(options?: {
31
+ optional?: boolean | undefined;
32
+ }) {
33
+ const context = useThreadListItemContext(options);
34
+ if (!context) return null;
35
+ return context.useThreadListItemRuntime();
36
+ }
37
+
38
+ export const { useThreadListItem, useThreadListItemStore } =
39
+ createContextStoreHook(useThreadListItemContext, "useThreadListItem");
@@ -1,6 +1,6 @@
1
1
  export {
2
2
  useAssistantRuntime,
3
- useThreadManager,
3
+ useThreadList,
4
4
  useToolUIs,
5
5
  useToolUIsStore,
6
6
 
@@ -150,7 +150,7 @@ export {
150
150
  useAttachment,
151
151
  useAttachmentRuntime,
152
152
 
153
- // TODO decide if we want to export/drop these?
153
+ // TODO decide if we want to export/drop these?
154
154
  // useEditComposerAttachment,
155
155
  // useEditComposerAttachmentRuntime,
156
156
  // useMessageAttachment,
package/src/internal.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { ThreadRuntimeCore } from "./runtimes/core/ThreadRuntimeCore";
2
- export type { ThreadManagerRuntimeCore } from "./runtimes/core/ThreadManagerRuntimeCore";
2
+ export type { ThreadListRuntimeCore } from "./runtimes/core/ThreadListRuntimeCore";
3
3
  export { DefaultThreadComposerRuntimeCore } from "./runtimes/composer/DefaultThreadComposerRuntimeCore";
4
4
  export { ProxyConfigProvider } from "./utils/ProxyConfigProvider";
5
5
  export { MessageRepository } from "./runtimes/utils/MessageRepository";
@@ -6,6 +6,8 @@ export * as ComposerPrimitive from "./composer";
6
6
  export * as ContentPartPrimitive from "./contentPart";
7
7
  export * as MessagePrimitive from "./message";
8
8
  export * as ThreadPrimitive from "./thread";
9
+ export * as ThreadListPrimitive from "./threadList";
10
+ export * as ThreadListItemPrimitive from "./threadListItem";
9
11
 
10
12
  export type * from "./actionBar/types";
11
13
  export type * from "./assistantModal/types";
@@ -0,0 +1,73 @@
1
+ "use client";
2
+
3
+ import { ComponentType, FC, memo, useMemo } from "react";
4
+ import { ThreadListItemRuntimeProvider } from "../../context/providers/ThreadListItemRuntimeProvider";
5
+ import { useAssistantRuntime, useThreadList } from "../../context";
6
+
7
+ export namespace MessagePrimitiveContent {
8
+ export type Props = {
9
+ archived?: boolean | undefined;
10
+ components: {
11
+ ThreadListItem: ComponentType;
12
+ };
13
+ };
14
+ }
15
+
16
+ type ThreadListItemProps = {
17
+ partIndex: number;
18
+ archived: boolean;
19
+ components: MessagePrimitiveContent.Props["components"];
20
+ };
21
+
22
+ const ThreadListItemImpl: FC<ThreadListItemProps> = ({
23
+ partIndex,
24
+ archived,
25
+ components,
26
+ }) => {
27
+ const assistantRuntime = useAssistantRuntime();
28
+ const runtime = useMemo(
29
+ () =>
30
+ archived
31
+ ? assistantRuntime.threadList.getThreadListArchivedItemByIndex(
32
+ partIndex,
33
+ )
34
+ : assistantRuntime.threadList.getThreadListItemByIndex(partIndex),
35
+ [assistantRuntime, partIndex],
36
+ );
37
+
38
+ const ThreadListItemComponent = components.ThreadListItem;
39
+
40
+ return (
41
+ <ThreadListItemRuntimeProvider runtime={runtime}>
42
+ <ThreadListItemComponent />
43
+ </ThreadListItemRuntimeProvider>
44
+ );
45
+ };
46
+
47
+ const ThreadListItem = memo(
48
+ ThreadListItemImpl,
49
+ (prev, next) =>
50
+ prev.partIndex === next.partIndex &&
51
+ prev.archived === next.archived &&
52
+ prev.components.ThreadListItem === next.components.ThreadListItem,
53
+ );
54
+
55
+ export const ThreadListPrimitiveItems: FC<MessagePrimitiveContent.Props> = ({
56
+ archived = false,
57
+ components,
58
+ }) => {
59
+ const contentLength = useThreadList((s) =>
60
+ archived ? s.archivedThreads.length : s.threads.length,
61
+ );
62
+
63
+ return Array.from({ length: contentLength }, (_, index) => (
64
+ <ThreadListItem
65
+ key={index}
66
+ partIndex={index}
67
+ archived={archived}
68
+ components={components}
69
+ />
70
+ ));
71
+ };
72
+
73
+ ThreadListPrimitiveItems.displayName = "ThreadListPrimitive.Items";
@@ -0,0 +1,25 @@
1
+ "use client";
2
+
3
+ import {
4
+ ActionButtonElement,
5
+ ActionButtonProps,
6
+ createActionButton,
7
+ } from "../../utils/createActionButton";
8
+ import { useAssistantRuntime } from "../../context";
9
+
10
+ const useThreadListNew = () => {
11
+ const runtime = useAssistantRuntime();
12
+ return () => {
13
+ runtime.switchToNewThread();
14
+ };
15
+ };
16
+
17
+ export namespace ThreadListPrimitiveNew {
18
+ export type Element = ActionButtonElement;
19
+ export type Props = ActionButtonProps<typeof useThreadListNew>;
20
+ }
21
+
22
+ export const ThreadListPrimitiveNew = createActionButton(
23
+ "ThreadListPrimitive.New",
24
+ useThreadListNew,
25
+ );
@@ -0,0 +1,2 @@
1
+ export { ThreadListPrimitiveNew as New } from "./ThreadListNew";
2
+ export { ThreadListPrimitiveItems as Items } from "./ThreadListItems";
@@ -0,0 +1,25 @@
1
+ "use client";
2
+
3
+ import {
4
+ ActionButtonElement,
5
+ ActionButtonProps,
6
+ createActionButton,
7
+ } from "../../utils/createActionButton";
8
+ import { useThreadListItemRuntime } from "../../context/react/ThreadListItemContext";
9
+
10
+ const useThreadListItemArchive = () => {
11
+ const runtime = useThreadListItemRuntime();
12
+ return () => {
13
+ runtime.archive();
14
+ };
15
+ };
16
+
17
+ export namespace ThreadListItemPrimitiveArchive {
18
+ export type Element = ActionButtonElement;
19
+ export type Props = ActionButtonProps<typeof useThreadListItemArchive>;
20
+ }
21
+
22
+ export const ThreadListItemPrimitiveArchive = createActionButton(
23
+ "ThreadListItemPrimitive.Archive",
24
+ useThreadListItemArchive,
25
+ );
@@ -0,0 +1,25 @@
1
+ "use client";
2
+
3
+ import {
4
+ ActionButtonElement,
5
+ ActionButtonProps,
6
+ createActionButton,
7
+ } from "../../utils/createActionButton";
8
+ import { useThreadListItemRuntime } from "../../context/react/ThreadListItemContext";
9
+
10
+ const useThreadListItemDelete = () => {
11
+ const runtime = useThreadListItemRuntime();
12
+ return () => {
13
+ runtime.delete();
14
+ };
15
+ };
16
+
17
+ export namespace ThreadListItemPrimitiveDelete {
18
+ export type Element = ActionButtonElement;
19
+ export type Props = ActionButtonProps<typeof useThreadListItemDelete>;
20
+ }
21
+
22
+ export const ThreadListItemPrimitiveDelete = createActionButton(
23
+ "ThreadListItemPrimitive.Delete",
24
+ useThreadListItemDelete,
25
+ );
@@ -0,0 +1,25 @@
1
+ "use client";
2
+
3
+ import {
4
+ ActionButtonElement,
5
+ ActionButtonProps,
6
+ createActionButton,
7
+ } from "../../utils/createActionButton";
8
+ import { useThreadListItemRuntime } from "../../context/react/ThreadListItemContext";
9
+
10
+ const useThreadListItemUnarchive = () => {
11
+ const runtime = useThreadListItemRuntime();
12
+ return () => {
13
+ runtime.unarchive();
14
+ };
15
+ };
16
+
17
+ export namespace ThreadListItemPrimitiveUnarchive {
18
+ export type Element = ActionButtonElement;
19
+ export type Props = ActionButtonProps<typeof useThreadListItemUnarchive>;
20
+ }
21
+
22
+ export const ThreadListItemPrimitiveUnarchive = createActionButton(
23
+ "ThreadListItemPrimitive.Unarchive",
24
+ useThreadListItemUnarchive,
25
+ );