@assistant-ui/react 0.5.84 → 0.5.85

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/dist/index.js CHANGED
@@ -4651,7 +4651,14 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
4651
4651
  var LocalThreadManagerRuntimeCore = (_class13 = class {
4652
4652
  constructor(_threadFactory) {;_class13.prototype.__init31.call(this);_class13.prototype.__init32.call(this);_class13.prototype.__init33.call(this);_class13.prototype.__init34.call(this);
4653
4653
  this._threadFactory = _threadFactory;
4654
- this._mainThread = this._threadFactory(generateId(), { messages: [] });
4654
+ const threadId = generateId();
4655
+ this._threadData.set(threadId, {
4656
+ data: { messages: [] },
4657
+ metadata: { threadId },
4658
+ isArchived: false
4659
+ });
4660
+ this._threads = [{ threadId }];
4661
+ this._mainThread = this._threadFactory(threadId, { messages: [] });
4655
4662
  }
4656
4663
  __init31() {this._threadData = /* @__PURE__ */ new Map()}
4657
4664
  __init32() {this._threads = []}
@@ -4674,17 +4681,21 @@ var LocalThreadManagerRuntimeCore = (_class13 = class {
4674
4681
  this._performThreadSwitch(thread);
4675
4682
  }
4676
4683
  switchToNewThread() {
4677
- if (!this._mainThread) return;
4678
- const thread = this._threadFactory(generateId(), { messages: [] });
4684
+ const threadId = generateId();
4685
+ this._threadData.set(threadId, {
4686
+ data: { messages: [] },
4687
+ metadata: { threadId },
4688
+ isArchived: false
4689
+ });
4690
+ this._threads = [{ threadId }];
4691
+ const thread = this._threadFactory(threadId, { messages: [] });
4679
4692
  this._performThreadSwitch(thread);
4680
4693
  }
4681
4694
  _performThreadSwitch(newThreadCore) {
4682
- if (this._mainThread) {
4683
- const data = this._threadData.get(this._mainThread.threadId);
4684
- if (!data) throw new Error("Thread not found");
4685
- const exprt = this._mainThread.export();
4686
- data.data = exprt;
4687
- }
4695
+ const data = this._threadData.get(this._mainThread.threadId);
4696
+ if (!data) throw new Error("Thread not found");
4697
+ const exprt = this._mainThread.export();
4698
+ data.data = exprt;
4688
4699
  this._mainThread._notifyEventSubscribers("switched-away");
4689
4700
  this._mainThread = newThreadCore;
4690
4701
  newThreadCore._notifyEventSubscribers("switched-to");