@assistant-ui/react 0.5.22 → 0.5.23

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -2273,6 +2273,25 @@ var MessageRepository = class {
2273
2273
  }
2274
2274
  }
2275
2275
  }
2276
+ export() {
2277
+ const exportItems = [];
2278
+ for (const [, message] of this.messages) {
2279
+ exportItems.push({
2280
+ message: message.current,
2281
+ parentId: message.prev?.current.id ?? null
2282
+ });
2283
+ }
2284
+ return {
2285
+ headId: this.head?.current.id ?? null,
2286
+ messages: exportItems
2287
+ };
2288
+ }
2289
+ import({ headId, messages }) {
2290
+ for (const { message, parentId } of messages) {
2291
+ this.addOrUpdateMessage(parentId, message);
2292
+ }
2293
+ this.resetHead(headId ?? messages.at(-1)?.message.id ?? null);
2294
+ }
2276
2295
  };
2277
2296
 
2278
2297
  // src/ui/base/tooltip-icon-button.tsx
@@ -2831,6 +2850,13 @@ var LocalThreadRuntime = class {
2831
2850
  this.performRoundtrip(parentId, message);
2832
2851
  }
2833
2852
  }
2853
+ export() {
2854
+ return this.repository.export();
2855
+ }
2856
+ import(data) {
2857
+ this.repository.import(data);
2858
+ this.notifySubscribers();
2859
+ }
2834
2860
  };
2835
2861
 
2836
2862
  // src/runtimes/local/LocalRuntime.tsx