@assistant-ui/react 0.10.48 → 0.10.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "conversational-ui",
29
29
  "conversational-ai"
30
30
  ],
31
- "version": "0.10.48",
31
+ "version": "0.10.49",
32
32
  "license": "MIT",
33
33
  "type": "module",
34
34
  "exports": {
@@ -14,6 +14,12 @@ import {
14
14
  import { GenericThreadHistoryAdapter } from "../runtimes/adapters/thread-history/ThreadHistoryAdapter";
15
15
  import { ReadonlyJSONObject } from "assistant-stream/utils";
16
16
 
17
+ // Global WeakMap to store message ID mappings across adapter instances
18
+ const globalMessageIdMapping = new WeakMap<
19
+ ThreadListItemRuntime,
20
+ Record<string, string | Promise<string>>
21
+ >();
22
+
17
23
  class FormattedThreadHistoryAdapter<TMessage, TStorageFormat>
18
24
  implements GenericThreadHistoryAdapter<TMessage>
19
25
  {
@@ -52,7 +58,12 @@ class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
52
58
  private threadListItemRuntime: ThreadListItemRuntime,
53
59
  ) {}
54
60
 
55
- private _getIdForLocalId: Record<string, string | Promise<string>> = {};
61
+ private get _getIdForLocalId(): Record<string, string | Promise<string>> {
62
+ if (!globalMessageIdMapping.has(this.threadListItemRuntime)) {
63
+ globalMessageIdMapping.set(this.threadListItemRuntime, {});
64
+ }
65
+ return globalMessageIdMapping.get(this.threadListItemRuntime)!;
66
+ }
56
67
 
57
68
  withFormat<TMessage, TStorageFormat>(
58
69
  formatAdapter: MessageFormatAdapter<TMessage, TStorageFormat>,