@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,3 @@
1
+ export { ThreadListItemPrimitiveArchive as Archive } from "./ThreadListItemArchive";
2
+ export { ThreadListItemPrimitiveUnarchive as Unarchive } from "./ThreadListItemUnarchive";
3
+ export { ThreadListItemPrimitiveDelete as Delete } from "./ThreadListItemDelete";
@@ -6,6 +6,7 @@ import {
6
6
  import { AppendMessage, Unsubscribe } from "../../types";
7
7
  import { AttachmentAdapter } from "../attachment";
8
8
  import { ComposerRuntimeCore } from "../core/ComposerRuntimeCore";
9
+ import { MessageRole } from "../../types/AssistantTypes";
9
10
 
10
11
  const isAttachmentComplete = (a: Attachment): a is CompleteAttachment =>
11
12
  a.status.type === "complete";
@@ -20,14 +21,15 @@ export abstract class BaseComposerRuntimeCore implements ComposerRuntimeCore {
20
21
  }
21
22
 
22
23
  private _attachments: readonly Attachment[] = [];
23
- protected set attachments(value: readonly Attachment[]) {
24
- this._attachments = value;
25
- this.notifySubscribers();
26
- }
27
24
  public get attachments() {
28
25
  return this._attachments;
29
26
  }
30
27
 
28
+ protected setAttachments(value: readonly Attachment[]) {
29
+ this._attachments = value;
30
+ this.notifySubscribers();
31
+ }
32
+
31
33
  public abstract get canCancel(): boolean;
32
34
 
33
35
  public get isEmpty() {
@@ -40,6 +42,17 @@ export abstract class BaseComposerRuntimeCore implements ComposerRuntimeCore {
40
42
  return this._text;
41
43
  }
42
44
 
45
+ private _role: MessageRole = "user";
46
+
47
+ get role() {
48
+ return this._role;
49
+ }
50
+
51
+ setRole(role: MessageRole) {
52
+ this._role = role;
53
+ this.notifySubscribers();
54
+ }
55
+
43
56
  setText(value: string) {
44
57
  this._text = value;
45
58
  this.notifySubscribers();
@@ -47,6 +60,7 @@ export abstract class BaseComposerRuntimeCore implements ComposerRuntimeCore {
47
60
 
48
61
  reset() {
49
62
  this._text = "";
63
+ this._role = "user";
50
64
  this._attachments = [];
51
65
  this.notifySubscribers();
52
66
  }
@@ -69,7 +83,7 @@ export abstract class BaseComposerRuntimeCore implements ComposerRuntimeCore {
69
83
  : [];
70
84
 
71
85
  const message: Omit<AppendMessage, "parentId"> = {
72
- role: "user",
86
+ role: this.role,
73
87
  content: this.text ? [{ type: "text", text: this.text }] : [],
74
88
  attachments,
75
89
  };
@@ -28,11 +28,12 @@ export class DefaultEditComposerRuntimeCore extends BaseComposerRuntimeCore {
28
28
  this._previousText = getThreadMessageText(message);
29
29
  this.setText(this._previousText);
30
30
 
31
+ this.setRole(message.role);
32
+ this.setAttachments(message.attachments ?? []);
33
+
31
34
  this._nonTextParts = message.content.filter(
32
35
  (part) => part.type !== "text" && part.type !== "ui",
33
36
  );
34
-
35
- this.attachments = message.attachments ?? [];
36
37
  }
37
38
 
38
39
  public async handleSend(message: Omit<AppendMessage, "parentId">) {
@@ -1,9 +1,9 @@
1
1
  import type { ModelConfigProvider } from "../../types/ModelConfigTypes";
2
2
  import type { Unsubscribe } from "../../types/Unsubscribe";
3
- import { ThreadManagerRuntimeCore } from "./ThreadManagerRuntimeCore";
3
+ import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
4
4
 
5
5
  export type AssistantRuntimeCore = {
6
- readonly threadManager: ThreadManagerRuntimeCore;
6
+ readonly threadList: ThreadListRuntimeCore;
7
7
 
8
8
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
9
9
  };
@@ -2,11 +2,11 @@ import { type ModelConfigProvider } from "../../types/ModelConfigTypes";
2
2
  import type { Unsubscribe } from "../../types/Unsubscribe";
3
3
  import type { AssistantRuntimeCore } from "./AssistantRuntimeCore";
4
4
  import { ProxyConfigProvider } from "../../utils/ProxyConfigProvider";
5
- import { ThreadManagerRuntimeCore } from "./ThreadManagerRuntimeCore";
5
+ import { ThreadListRuntimeCore } from "./ThreadListRuntimeCore";
6
6
 
7
7
  export abstract class BaseAssistantRuntimeCore implements AssistantRuntimeCore {
8
8
  protected readonly _proxyConfigProvider = new ProxyConfigProvider();
9
- public abstract get threadManager(): ThreadManagerRuntimeCore;
9
+ public abstract get threadList(): ThreadListRuntimeCore;
10
10
 
11
11
  constructor() {}
12
12
 
@@ -1,4 +1,5 @@
1
1
  import type { Attachment, PendingAttachment, Unsubscribe } from "../../types";
2
+ import { MessageRole } from "../../types/AssistantTypes";
2
3
 
3
4
  export type ComposerRuntimeCore = Readonly<{
4
5
  attachments: readonly Attachment[];
@@ -15,6 +16,9 @@ export type ComposerRuntimeCore = Readonly<{
15
16
  text: string;
16
17
  setText: (value: string) => void;
17
18
 
19
+ role: MessageRole;
20
+ setRole: (role: MessageRole) => void;
21
+
18
22
  /**
19
23
  * @deprecated This method will be removed in 0.6.0. Submit feedback if you need this functionality.
20
24
  */
@@ -1,16 +1,18 @@
1
1
  import { Unsubscribe } from "../../types";
2
2
  import { ThreadRuntimeCore } from "./ThreadRuntimeCore";
3
3
 
4
- export type ThreadManagerMetadata = {
4
+ export type ThreadListMetadata = Readonly<{
5
5
  threadId: string;
6
6
  title?: string;
7
- };
7
+ }>;
8
8
 
9
- export type ThreadManagerRuntimeCore = {
9
+ export type ThreadListRuntimeCore = {
10
10
  mainThread: ThreadRuntimeCore;
11
11
 
12
- threads: readonly ThreadManagerMetadata[];
13
- archivedThreads: readonly ThreadManagerMetadata[];
12
+ threads: readonly ThreadListMetadata[];
13
+ archivedThreads: readonly ThreadListMetadata[];
14
+
15
+ getThreadMetadataById(threadId: string): ThreadListMetadata | undefined;
14
16
 
15
17
  switchToThread(threadId: string): void;
16
18
  switchToNewThread(): void;
@@ -12,7 +12,7 @@ export const subscribeToMainThread = (
12
12
  let cleanup: Unsubscribe | undefined;
13
13
  const inner = () => {
14
14
  cleanup?.();
15
- cleanup = runtime.threadManager.mainThread.subscribe(callback);
15
+ cleanup = runtime.threadList.mainThread.subscribe(callback);
16
16
 
17
17
  if (!first) {
18
18
  callback();
@@ -20,7 +20,7 @@ export const subscribeToMainThread = (
20
20
  first = false;
21
21
  };
22
22
 
23
- const unsubscribe = runtime.threadManager.mainThread.subscribe(inner);
23
+ const unsubscribe = runtime.threadList.mainThread.subscribe(inner);
24
24
  inner();
25
25
 
26
26
  return () => {
@@ -6,13 +6,13 @@ import {
6
6
  } from "../core/ThreadRuntimeCore";
7
7
  import { FeedbackAdapter } from "../feedback/FeedbackAdapter";
8
8
  import { SpeechSynthesisAdapter } from "../speech/SpeechAdapterTypes";
9
- import { ThreadManagerMetadata } from "../core/ThreadManagerRuntimeCore";
9
+ import { ThreadListMetadata } from "../core/ThreadListRuntimeCore";
10
10
  import { ThreadMessageLike } from "./ThreadMessageLike";
11
11
 
12
- export type ExternalStoreThreadManagerAdapter = {
12
+ export type ExternalStoreThreadListAdapter = {
13
13
  threadId?: string | undefined;
14
- threads?: readonly ThreadManagerMetadata[] | undefined;
15
- archivedThreads?: readonly ThreadManagerMetadata[] | undefined;
14
+ threads?: readonly ThreadListMetadata[] | undefined;
15
+ archivedThreads?: readonly ThreadListMetadata[] | undefined;
16
16
  onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
17
17
  onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
18
18
  onRename?: (
@@ -35,16 +35,16 @@ type ExternalStoreMessageConverterAdapter<T> = {
35
35
 
36
36
  type ExternalStoreAdapterBase<T> = {
37
37
  /**
38
- * @deprecated Use `adapters.threadManager.threadId` instead. This will be removed in 0.6.0.
38
+ * @deprecated Use `adapterst.threadList.threadId` instead. This will be removed in 0.6.0.
39
39
  */
40
40
  threadId?: string | undefined;
41
41
 
42
42
  /**
43
- * @deprecated Use `adapters.threadManager.onSwitchToThread` instead. This will be removed in 0.6.0.
43
+ * @deprecated Use `adapters..threadList.onSwitchToThread` instead. This will be removed in 0.6.0.
44
44
  */
45
45
  onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
46
46
  /**
47
- * @deprecated Use `adapters.threadManager.onSwitchToNewThread` instead. This will be removed in 0.6.0.
47
+ * @deprecated Use `adapters.threadList.onSwitchToNewThread` instead. This will be removed in 0.6.0.
48
48
  */
49
49
  onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
50
50
 
@@ -68,7 +68,7 @@ type ExternalStoreAdapterBase<T> = {
68
68
  attachments?: AttachmentAdapter | undefined;
69
69
  speech?: SpeechSynthesisAdapter | undefined;
70
70
  feedback?: FeedbackAdapter | undefined;
71
- threadManager?: ExternalStoreThreadManagerAdapter | undefined;
71
+ threadList?: ExternalStoreThreadListAdapter | undefined;
72
72
  }
73
73
  | undefined;
74
74
  unstable_capabilities?:
@@ -1,27 +1,27 @@
1
1
  import { BaseAssistantRuntimeCore } from "../../internal";
2
- import { ExternalStoreThreadManagerRuntimeCore } from "./ExternalStoreThreadManagementAdapter";
2
+ import { ExternalStoreThreadListRuntimeCore } from "./ExternalStoreThreadListRuntimeCore";
3
3
  import { ExternalStoreAdapter } from "./ExternalStoreAdapter";
4
4
  import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
5
5
 
6
- const getThreadManagerAdapter = (store: ExternalStoreAdapter<any>) => {
6
+ const getThreadListAdapter = (store: ExternalStoreAdapter<any>) => {
7
7
  return {
8
8
  threadId: store.threadId,
9
9
  onSwitchToNewThread: store.onSwitchToNewThread,
10
10
  onSwitchToThread: store.onSwitchToThread,
11
- ...store.adapters?.threadManager,
11
+ ...store.adapters?.threadList,
12
12
  };
13
13
  };
14
14
 
15
15
  export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
16
- public readonly threadManager;
16
+ public readonly threadList;
17
17
 
18
18
  private _store: ExternalStoreAdapter<any>;
19
19
 
20
20
  constructor(store: ExternalStoreAdapter<any>) {
21
21
  super();
22
22
  this._store = store;
23
- this.threadManager = new ExternalStoreThreadManagerRuntimeCore(
24
- getThreadManagerAdapter(store),
23
+ this.threadList = new ExternalStoreThreadListRuntimeCore(
24
+ getThreadListAdapter(store),
25
25
  (threadId) =>
26
26
  new ExternalStoreThreadRuntimeCore(
27
27
  this._proxyConfigProvider,
@@ -33,7 +33,7 @@ export class ExternalStoreRuntimeCore extends BaseAssistantRuntimeCore {
33
33
 
34
34
  public setStore(store: ExternalStoreAdapter<any>) {
35
35
  this._store = store;
36
- this.threadManager.setAdapter(getThreadManagerAdapter(store));
37
- this.threadManager.mainThread.setStore(store);
36
+ this.threadList.setAdapter(getThreadListAdapter(store));
37
+ this.threadList.mainThread.setStore(store);
38
38
  }
39
39
  }
@@ -1,7 +1,7 @@
1
1
  import type { Unsubscribe } from "../../types";
2
2
  import { ExternalStoreThreadRuntimeCore } from "./ExternalStoreThreadRuntimeCore";
3
- import { ThreadManagerRuntimeCore } from "../core/ThreadManagerRuntimeCore";
4
- import { ExternalStoreThreadManagerAdapter } from "./ExternalStoreAdapter";
3
+ import { ThreadListRuntimeCore } from "../core/ThreadListRuntimeCore";
4
+ import { ExternalStoreThreadListAdapter } from "./ExternalStoreAdapter";
5
5
 
6
6
  export type ExternalStoreThreadFactory = (
7
7
  threadId: string,
@@ -10,8 +10,8 @@ export type ExternalStoreThreadFactory = (
10
10
  const EMPTY_ARRAY = Object.freeze([]);
11
11
  const DEFAULT_THREAD_ID = "DEFAULT_THREAD_ID";
12
12
 
13
- export class ExternalStoreThreadManagerRuntimeCore
14
- implements ThreadManagerRuntimeCore
13
+ export class ExternalStoreThreadListRuntimeCore
14
+ implements ThreadListRuntimeCore
15
15
  {
16
16
  public get threads() {
17
17
  return this.adapter.threads ?? EMPTY_ARRAY;
@@ -28,13 +28,23 @@ export class ExternalStoreThreadManagerRuntimeCore
28
28
  }
29
29
 
30
30
  constructor(
31
- private adapter: ExternalStoreThreadManagerAdapter = {},
31
+ private adapter: ExternalStoreThreadListAdapter = {},
32
32
  private threadFactory: ExternalStoreThreadFactory,
33
33
  ) {
34
34
  this._mainThread = this.threadFactory(DEFAULT_THREAD_ID);
35
35
  }
36
36
 
37
- public setAdapter(adapter: ExternalStoreThreadManagerAdapter) {
37
+ public getThreadMetadataById(threadId: string) {
38
+ for (const thread of this.threads) {
39
+ if (thread.threadId === threadId) return thread;
40
+ }
41
+ for (const thread of this.archivedThreads) {
42
+ if (thread.threadId === threadId) return thread;
43
+ }
44
+ return undefined;
45
+ }
46
+
47
+ public setAdapter(adapter: ExternalStoreThreadListAdapter) {
38
48
  const previousAdapter = this.adapter;
39
49
  this.adapter = adapter;
40
50
 
@@ -42,10 +52,15 @@ export class ExternalStoreThreadManagerRuntimeCore
42
52
  const newThreads = adapter.threads ?? EMPTY_ARRAY;
43
53
  const newArchivedThreads = adapter.archivedThreads ?? EMPTY_ARRAY;
44
54
 
55
+ const previousThreadId = previousAdapter.threadId ?? DEFAULT_THREAD_ID;
56
+ const previousThreads = previousAdapter.threads ?? EMPTY_ARRAY;
57
+ const previousArchivedThreads =
58
+ previousAdapter.archivedThreads ?? EMPTY_ARRAY;
59
+
45
60
  if (
46
- previousAdapter.threadId === newThreadId &&
47
- previousAdapter.threads === newThreads &&
48
- previousAdapter.archivedThreads === newArchivedThreads
61
+ previousThreadId === newThreadId &&
62
+ previousThreads === newThreads &&
63
+ previousArchivedThreads === newArchivedThreads
49
64
  ) {
50
65
  return;
51
66
  }
@@ -239,8 +239,13 @@ export class ExternalStoreThreadRuntimeCore
239
239
  }
240
240
 
241
241
  private updateMessages = (messages: ThreadMessage[]) => {
242
- this._store.setMessages?.(
243
- messages.flatMap(getExternalStoreMessage).filter((m) => m != null),
244
- );
242
+ const hasConverter = this._store.convertMessage !== undefined;
243
+ if (hasConverter) {
244
+ this._store.setMessages?.(
245
+ messages.flatMap(getExternalStoreMessage).filter((m) => m != null),
246
+ );
247
+ } else {
248
+ this._store.setMessages?.(messages);
249
+ }
245
250
  };
246
251
  }
@@ -3,7 +3,7 @@ import { BaseAssistantRuntimeCore } from "../core/BaseAssistantRuntimeCore";
3
3
  import { LocalThreadRuntimeCore } from "./LocalThreadRuntimeCore";
4
4
  import { LocalRuntimeOptionsBase } from "./LocalRuntimeOptions";
5
5
  import { fromCoreMessages } from "../edge/converters/fromCoreMessage";
6
- import { LocalThreadManagerRuntimeCore } from "./LocalThreadManagerRuntimeCore";
6
+ import { LocalThreadListRuntimeCore } from "./LocalThreadListRuntimeCore";
7
7
  import { ExportedMessageRepository } from "../utils/MessageRepository";
8
8
 
9
9
  const getExportFromInitialMessages = (
@@ -19,7 +19,7 @@ const getExportFromInitialMessages = (
19
19
  };
20
20
 
21
21
  export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
22
- public readonly threadManager;
22
+ public readonly threadList;
23
23
 
24
24
  private _options: LocalRuntimeOptionsBase;
25
25
 
@@ -31,7 +31,7 @@ export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
31
31
 
32
32
  this._options = options;
33
33
 
34
- this.threadManager = new LocalThreadManagerRuntimeCore((threadId, data) => {
34
+ this.threadList = new LocalThreadListRuntimeCore((threadId, data) => {
35
35
  const thread = new LocalThreadRuntimeCore(
36
36
  this._proxyConfigProvider,
37
37
  threadId,
@@ -42,7 +42,7 @@ export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
42
42
  });
43
43
 
44
44
  if (initialMessages) {
45
- this.threadManager.mainThread.import(
45
+ this.threadList.mainThread.import(
46
46
  getExportFromInitialMessages(initialMessages),
47
47
  );
48
48
  }
@@ -51,7 +51,7 @@ export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
51
51
  public setOptions(options: LocalRuntimeOptionsBase) {
52
52
  this._options = options;
53
53
 
54
- this.threadManager.mainThread.setOptions(options);
54
+ this.threadList.mainThread.setOptions(options);
55
55
  }
56
56
 
57
57
  public reset({
@@ -59,10 +59,10 @@ export class LocalRuntimeCore extends BaseAssistantRuntimeCore {
59
59
  }: {
60
60
  initialMessages?: readonly CoreMessage[] | undefined;
61
61
  } = {}) {
62
- this.threadManager.switchToNewThread();
62
+ this.threadList.switchToNewThread();
63
63
  if (!initialMessages) return;
64
64
 
65
- this.threadManager.mainThread.import(
65
+ this.threadList.mainThread.import(
66
66
  getExportFromInitialMessages(initialMessages),
67
67
  );
68
68
  }
@@ -1,15 +1,15 @@
1
1
  import type { Unsubscribe } from "../../types";
2
2
  import {
3
- ThreadManagerMetadata,
4
- ThreadManagerRuntimeCore,
5
- } from "../core/ThreadManagerRuntimeCore";
3
+ ThreadListMetadata,
4
+ ThreadListRuntimeCore,
5
+ } from "../core/ThreadListRuntimeCore";
6
6
  import { ExportedMessageRepository } from "../utils/MessageRepository";
7
7
  import { generateId } from "../../utils/idUtils";
8
8
  import { LocalThreadRuntimeCore } from "./LocalThreadRuntimeCore";
9
9
 
10
10
  export type LocalThreadData = {
11
11
  data: ExportedMessageRepository;
12
- metadata: ThreadManagerMetadata;
12
+ metadata: ThreadListMetadata;
13
13
  isArchived: boolean;
14
14
  };
15
15
 
@@ -18,11 +18,11 @@ export type LocalThreadFactory = (
18
18
  data: ExportedMessageRepository,
19
19
  ) => LocalThreadRuntimeCore;
20
20
 
21
- export class LocalThreadManagerRuntimeCore implements ThreadManagerRuntimeCore {
21
+ export class LocalThreadListRuntimeCore implements ThreadListRuntimeCore {
22
22
  private _threadData = new Map<string, LocalThreadData>();
23
23
 
24
- private _threads: readonly ThreadManagerMetadata[] = [];
25
- private _archivedThreads: readonly ThreadManagerMetadata[] = [];
24
+ private _threads: readonly ThreadListMetadata[] = [];
25
+ private _archivedThreads: readonly ThreadListMetadata[] = [];
26
26
 
27
27
  public get threads() {
28
28
  return this._threads;
@@ -49,6 +49,10 @@ export class LocalThreadManagerRuntimeCore implements ThreadManagerRuntimeCore {
49
49
  this._mainThread = this._threadFactory(threadId, { messages: [] });
50
50
  }
51
51
 
52
+ public getThreadMetadataById(threadId: string) {
53
+ return this._threadData.get(threadId)?.metadata;
54
+ }
55
+
52
56
  public switchToThread(threadId: string): void {
53
57
  if (this._mainThread.threadId === threadId) return;
54
58
 
@@ -89,7 +89,8 @@ export class LocalThreadRuntimeCore
89
89
  });
90
90
  this.repository.addOrUpdateMessage(message.parentId, newMessage);
91
91
 
92
- if (message.role === "user") {
92
+ const startRun = message.startRun ?? message.role === "user";
93
+ if (startRun) {
93
94
  await this.startRun(newMessage.id);
94
95
  } else {
95
96
  this.repository.resetHead(newMessage.id);
@@ -2,6 +2,8 @@ import { LanguageModelV1LogProbs } from "@ai-sdk/provider";
2
2
  import type { ReactNode } from "react";
3
3
  import { CompleteAttachment } from "./AttachmentTypes";
4
4
 
5
+ export type MessageRole = "user" | "assistant" | "system";
6
+
5
7
  export type TextContentPart = {
6
8
  type: "text";
7
9
  text: string;
@@ -156,6 +158,7 @@ export type AppendMessage = CoreMessage & {
156
158
  parentId: string | null;
157
159
  // TODO make required in the next major version
158
160
  attachments?: readonly CompleteAttachment[] | undefined;
161
+ startRun?: boolean | undefined;
159
162
  };
160
163
 
161
164
  type BaseThreadMessage = {
@@ -1,32 +0,0 @@
1
- import { ThreadManagerMetadata, ThreadManagerRuntimeCore } from "../runtimes/core/ThreadManagerRuntimeCore";
2
- import { Unsubscribe } from "../types";
3
- import { ThreadManagerRuntimePath } from "./RuntimePathTypes";
4
- export type ThreadManagerState = Readonly<{
5
- threads: readonly ThreadManagerMetadata[];
6
- archivedThreads: readonly ThreadManagerMetadata[];
7
- }>;
8
- export type ThreadManagerRuntime = Readonly<{
9
- path: ThreadManagerRuntimePath;
10
- getState(): ThreadManagerState;
11
- rename(threadId: string, newTitle: string): Promise<void>;
12
- archive(threadId: string): Promise<void>;
13
- unarchive(threadId: string): Promise<void>;
14
- delete(threadId: string): Promise<void>;
15
- subscribe(callback: () => void): Unsubscribe;
16
- }>;
17
- export type ThreadManagerRuntimeCoreBinding = ThreadManagerRuntimeCore;
18
- export declare class ThreadManagerRuntimeImpl implements ThreadManagerRuntime {
19
- private _core;
20
- get path(): {
21
- ref: string;
22
- };
23
- private _getState;
24
- constructor(_core: ThreadManagerRuntimeCoreBinding);
25
- getState(): ThreadManagerState;
26
- rename(threadId: string, newTitle: string): Promise<void>;
27
- archive(threadId: string): Promise<void>;
28
- unarchive(threadId: string): Promise<void>;
29
- delete(threadId: string): Promise<void>;
30
- subscribe(callback: () => void): Unsubscribe;
31
- }
32
- //# sourceMappingURL=ThreadManagerRuntime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThreadManagerRuntime.d.ts","sourceRoot":"","sources":["../../src/api/ThreadManagerRuntime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC1C,eAAe,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACnD,CAAC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C,IAAI,EAAE,wBAAwB,CAAC;IAC/B,QAAQ,IAAI,kBAAkB,CAAC;IAE/B,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;CAC9C,CAAC,CAAC;AAeH,MAAM,MAAM,+BAA+B,GAAG,wBAAwB,CAAC;AAEvE,qBAAa,wBAAyB,YAAW,oBAAoB;IAMvD,OAAO,CAAC,KAAK;IALzB,IAAW,IAAI;;MAEd;IAED,OAAO,CAAC,SAAS,CAAC;gBACE,KAAK,EAAE,+BAA+B;IAUnD,QAAQ,IAAI,kBAAkB;IAI9B,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,WAAW;CAGpD"}
@@ -1,73 +0,0 @@
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/api/ThreadManagerRuntime.ts
21
- var ThreadManagerRuntime_exports = {};
22
- __export(ThreadManagerRuntime_exports, {
23
- ThreadManagerRuntimeImpl: () => ThreadManagerRuntimeImpl
24
- });
25
- module.exports = __toCommonJS(ThreadManagerRuntime_exports);
26
- var import_LazyMemoizeSubject = require("./subscribable/LazyMemoizeSubject.cjs");
27
- var getThreadManagerState = (threadManager) => {
28
- return {
29
- threads: threadManager.threads,
30
- archivedThreads: threadManager.archivedThreads
31
- };
32
- };
33
- var THREAD_MANAGER_PATH = {
34
- ref: "threadManager"
35
- };
36
- var ThreadManagerRuntimeImpl = class {
37
- constructor(_core) {
38
- this._core = _core;
39
- const stateBinding = new import_LazyMemoizeSubject.LazyMemoizeSubject({
40
- path: THREAD_MANAGER_PATH,
41
- getState: () => getThreadManagerState(_core),
42
- subscribe: (callback) => _core.subscribe(callback)
43
- });
44
- this._getState = stateBinding.getState.bind(stateBinding);
45
- }
46
- get path() {
47
- return THREAD_MANAGER_PATH;
48
- }
49
- _getState;
50
- getState() {
51
- return this._getState();
52
- }
53
- rename(threadId, newTitle) {
54
- return this._core.rename(threadId, newTitle);
55
- }
56
- archive(threadId) {
57
- return this._core.archive(threadId);
58
- }
59
- unarchive(threadId) {
60
- return this._core.unarchive(threadId);
61
- }
62
- delete(threadId) {
63
- return this._core.delete(threadId);
64
- }
65
- subscribe(callback) {
66
- return this._core.subscribe(callback);
67
- }
68
- };
69
- // Annotate the CommonJS export names for ESM import in node:
70
- 0 && (module.exports = {
71
- ThreadManagerRuntimeImpl
72
- });
73
- //# sourceMappingURL=ThreadManagerRuntime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/api/ThreadManagerRuntime.ts"],"sourcesContent":["import { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {\n ThreadManagerMetadata,\n ThreadManagerRuntimeCore,\n} from \"../runtimes/core/ThreadManagerRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadManagerRuntimePath } from \"./RuntimePathTypes\";\n\nexport type ThreadManagerState = Readonly<{\n threads: readonly ThreadManagerMetadata[];\n archivedThreads: readonly ThreadManagerMetadata[];\n}>;\n\nexport type ThreadManagerRuntime = Readonly<{\n path: ThreadManagerRuntimePath;\n getState(): ThreadManagerState;\n\n rename(threadId: string, newTitle: string): Promise<void>;\n archive(threadId: string): Promise<void>;\n unarchive(threadId: string): Promise<void>;\n delete(threadId: string): Promise<void>;\n\n subscribe(callback: () => void): Unsubscribe;\n}>;\n\nconst getThreadManagerState = (\n threadManager: ThreadManagerRuntimeCore,\n): ThreadManagerState => {\n return {\n threads: threadManager.threads,\n archivedThreads: threadManager.archivedThreads,\n };\n};\n\nconst THREAD_MANAGER_PATH = {\n ref: \"threadManager\",\n};\n\nexport type ThreadManagerRuntimeCoreBinding = ThreadManagerRuntimeCore;\n\nexport class ThreadManagerRuntimeImpl implements ThreadManagerRuntime {\n public get path() {\n return THREAD_MANAGER_PATH;\n }\n\n private _getState;\n constructor(private _core: ThreadManagerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: THREAD_MANAGER_PATH,\n getState: () => getThreadManagerState(_core),\n subscribe: (callback) => _core.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public getState(): ThreadManagerState {\n return this._getState();\n }\n\n public rename(threadId: string, newTitle: string): Promise<void> {\n return this._core.rename(threadId, newTitle);\n }\n\n public archive(threadId: string): Promise<void> {\n return this._core.archive(threadId);\n }\n\n public unarchive(threadId: string): Promise<void> {\n return this._core.unarchive(threadId);\n }\n\n public delete(threadId: string): Promise<void> {\n return this._core.delete(threadId);\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAmC;AAyBnC,IAAM,wBAAwB,CAC5B,kBACuB;AACvB,SAAO;AAAA,IACL,SAAS,cAAc;AAAA,IACvB,iBAAiB,cAAc;AAAA,EACjC;AACF;AAEA,IAAM,sBAAsB;AAAA,EAC1B,KAAK;AACP;AAIO,IAAM,2BAAN,MAA+D;AAAA,EAMpE,YAAoB,OAAwC;AAAxC;AAClB,UAAM,eAAe,IAAI,6CAAmB;AAAA,MAC1C,MAAM;AAAA,MACN,UAAU,MAAM,sBAAsB,KAAK;AAAA,MAC3C,WAAW,CAAC,aAAa,MAAM,UAAU,QAAQ;AAAA,IACnD,CAAC;AAED,SAAK,YAAY,aAAa,SAAS,KAAK,YAAY;AAAA,EAC1D;AAAA,EAbA,IAAW,OAAO;AAChB,WAAO;AAAA,EACT;AAAA,EAEQ;AAAA,EAWD,WAA+B;AACpC,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEO,OAAO,UAAkB,UAAiC;AAC/D,WAAO,KAAK,MAAM,OAAO,UAAU,QAAQ;AAAA,EAC7C;AAAA,EAEO,QAAQ,UAAiC;AAC9C,WAAO,KAAK,MAAM,QAAQ,QAAQ;AAAA,EACpC;AAAA,EAEO,UAAU,UAAiC;AAChD,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AAAA,EAEO,OAAO,UAAiC;AAC7C,WAAO,KAAK,MAAM,OAAO,QAAQ;AAAA,EACnC;AAAA,EAEO,UAAU,UAAmC;AAClD,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AACF;","names":[]}
@@ -1,48 +0,0 @@
1
- // src/api/ThreadManagerRuntime.ts
2
- import { LazyMemoizeSubject } from "./subscribable/LazyMemoizeSubject.mjs";
3
- var getThreadManagerState = (threadManager) => {
4
- return {
5
- threads: threadManager.threads,
6
- archivedThreads: threadManager.archivedThreads
7
- };
8
- };
9
- var THREAD_MANAGER_PATH = {
10
- ref: "threadManager"
11
- };
12
- var ThreadManagerRuntimeImpl = class {
13
- constructor(_core) {
14
- this._core = _core;
15
- const stateBinding = new LazyMemoizeSubject({
16
- path: THREAD_MANAGER_PATH,
17
- getState: () => getThreadManagerState(_core),
18
- subscribe: (callback) => _core.subscribe(callback)
19
- });
20
- this._getState = stateBinding.getState.bind(stateBinding);
21
- }
22
- get path() {
23
- return THREAD_MANAGER_PATH;
24
- }
25
- _getState;
26
- getState() {
27
- return this._getState();
28
- }
29
- rename(threadId, newTitle) {
30
- return this._core.rename(threadId, newTitle);
31
- }
32
- archive(threadId) {
33
- return this._core.archive(threadId);
34
- }
35
- unarchive(threadId) {
36
- return this._core.unarchive(threadId);
37
- }
38
- delete(threadId) {
39
- return this._core.delete(threadId);
40
- }
41
- subscribe(callback) {
42
- return this._core.subscribe(callback);
43
- }
44
- };
45
- export {
46
- ThreadManagerRuntimeImpl
47
- };
48
- //# sourceMappingURL=ThreadManagerRuntime.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/api/ThreadManagerRuntime.ts"],"sourcesContent":["import { LazyMemoizeSubject } from \"./subscribable/LazyMemoizeSubject\";\nimport {\n ThreadManagerMetadata,\n ThreadManagerRuntimeCore,\n} from \"../runtimes/core/ThreadManagerRuntimeCore\";\nimport { Unsubscribe } from \"../types\";\nimport { ThreadManagerRuntimePath } from \"./RuntimePathTypes\";\n\nexport type ThreadManagerState = Readonly<{\n threads: readonly ThreadManagerMetadata[];\n archivedThreads: readonly ThreadManagerMetadata[];\n}>;\n\nexport type ThreadManagerRuntime = Readonly<{\n path: ThreadManagerRuntimePath;\n getState(): ThreadManagerState;\n\n rename(threadId: string, newTitle: string): Promise<void>;\n archive(threadId: string): Promise<void>;\n unarchive(threadId: string): Promise<void>;\n delete(threadId: string): Promise<void>;\n\n subscribe(callback: () => void): Unsubscribe;\n}>;\n\nconst getThreadManagerState = (\n threadManager: ThreadManagerRuntimeCore,\n): ThreadManagerState => {\n return {\n threads: threadManager.threads,\n archivedThreads: threadManager.archivedThreads,\n };\n};\n\nconst THREAD_MANAGER_PATH = {\n ref: \"threadManager\",\n};\n\nexport type ThreadManagerRuntimeCoreBinding = ThreadManagerRuntimeCore;\n\nexport class ThreadManagerRuntimeImpl implements ThreadManagerRuntime {\n public get path() {\n return THREAD_MANAGER_PATH;\n }\n\n private _getState;\n constructor(private _core: ThreadManagerRuntimeCoreBinding) {\n const stateBinding = new LazyMemoizeSubject({\n path: THREAD_MANAGER_PATH,\n getState: () => getThreadManagerState(_core),\n subscribe: (callback) => _core.subscribe(callback),\n });\n\n this._getState = stateBinding.getState.bind(stateBinding);\n }\n\n public getState(): ThreadManagerState {\n return this._getState();\n }\n\n public rename(threadId: string, newTitle: string): Promise<void> {\n return this._core.rename(threadId, newTitle);\n }\n\n public archive(threadId: string): Promise<void> {\n return this._core.archive(threadId);\n }\n\n public unarchive(threadId: string): Promise<void> {\n return this._core.unarchive(threadId);\n }\n\n public delete(threadId: string): Promise<void> {\n return this._core.delete(threadId);\n }\n\n public subscribe(callback: () => void): Unsubscribe {\n return this._core.subscribe(callback);\n }\n}\n"],"mappings":";AAAA,SAAS,0BAA0B;AAyBnC,IAAM,wBAAwB,CAC5B,kBACuB;AACvB,SAAO;AAAA,IACL,SAAS,cAAc;AAAA,IACvB,iBAAiB,cAAc;AAAA,EACjC;AACF;AAEA,IAAM,sBAAsB;AAAA,EAC1B,KAAK;AACP;AAIO,IAAM,2BAAN,MAA+D;AAAA,EAMpE,YAAoB,OAAwC;AAAxC;AAClB,UAAM,eAAe,IAAI,mBAAmB;AAAA,MAC1C,MAAM;AAAA,MACN,UAAU,MAAM,sBAAsB,KAAK;AAAA,MAC3C,WAAW,CAAC,aAAa,MAAM,UAAU,QAAQ;AAAA,IACnD,CAAC;AAED,SAAK,YAAY,aAAa,SAAS,KAAK,YAAY;AAAA,EAC1D;AAAA,EAbA,IAAW,OAAO;AAChB,WAAO;AAAA,EACT;AAAA,EAEQ;AAAA,EAWD,WAA+B;AACpC,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEO,OAAO,UAAkB,UAAiC;AAC/D,WAAO,KAAK,MAAM,OAAO,UAAU,QAAQ;AAAA,EAC7C;AAAA,EAEO,QAAQ,UAAiC;AAC9C,WAAO,KAAK,MAAM,QAAQ,QAAQ;AAAA,EACpC;AAAA,EAEO,UAAU,UAAiC;AAChD,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AAAA,EAEO,OAAO,UAAiC;AAC7C,WAAO,KAAK,MAAM,OAAO,QAAQ;AAAA,EACnC;AAAA,EAEO,UAAU,UAAmC;AAClD,WAAO,KAAK,MAAM,UAAU,QAAQ;AAAA,EACtC;AACF;","names":[]}