@assistant-ui/react 0.5.84 → 0.5.86

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -4100,9 +4100,6 @@ var streamUtils = {
4100
4100
  streamPartDecoderStream
4101
4101
  };
4102
4102
 
4103
- // src/runtimes/edge/useEdgeRuntime.ts
4104
-
4105
-
4106
4103
  // src/runtimes/edge/streams/assistantDecoderStream.ts
4107
4104
  function assistantDecoderStream() {
4108
4105
  const toolCallNames = /* @__PURE__ */ new Map();
@@ -4282,8 +4279,10 @@ var splitLocalRuntimeOptions = (options) => {
4282
4279
  // src/runtimes/edge/useEdgeRuntime.ts
4283
4280
  var useEdgeRuntime = (options) => {
4284
4281
  const { localRuntimeOptions, otherOptions } = splitLocalRuntimeOptions(options);
4285
- const [adapter] = _react.useState.call(void 0, () => new EdgeChatAdapter(otherOptions));
4286
- return useLocalRuntime(adapter, localRuntimeOptions);
4282
+ return useLocalRuntime(
4283
+ new EdgeChatAdapter(otherOptions),
4284
+ localRuntimeOptions
4285
+ );
4287
4286
  };
4288
4287
 
4289
4288
  // src/runtimes/local/shouldContinue.tsx
@@ -4651,7 +4650,14 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
4651
4650
  var LocalThreadManagerRuntimeCore = (_class13 = class {
4652
4651
  constructor(_threadFactory) {;_class13.prototype.__init31.call(this);_class13.prototype.__init32.call(this);_class13.prototype.__init33.call(this);_class13.prototype.__init34.call(this);
4653
4652
  this._threadFactory = _threadFactory;
4654
- this._mainThread = this._threadFactory(generateId(), { messages: [] });
4653
+ const threadId = generateId();
4654
+ this._threadData.set(threadId, {
4655
+ data: { messages: [] },
4656
+ metadata: { threadId },
4657
+ isArchived: false
4658
+ });
4659
+ this._threads = [{ threadId }];
4660
+ this._mainThread = this._threadFactory(threadId, { messages: [] });
4655
4661
  }
4656
4662
  __init31() {this._threadData = /* @__PURE__ */ new Map()}
4657
4663
  __init32() {this._threads = []}
@@ -4674,17 +4680,21 @@ var LocalThreadManagerRuntimeCore = (_class13 = class {
4674
4680
  this._performThreadSwitch(thread);
4675
4681
  }
4676
4682
  switchToNewThread() {
4677
- if (!this._mainThread) return;
4678
- const thread = this._threadFactory(generateId(), { messages: [] });
4683
+ const threadId = generateId();
4684
+ this._threadData.set(threadId, {
4685
+ data: { messages: [] },
4686
+ metadata: { threadId },
4687
+ isArchived: false
4688
+ });
4689
+ this._threads = [{ threadId }];
4690
+ const thread = this._threadFactory(threadId, { messages: [] });
4679
4691
  this._performThreadSwitch(thread);
4680
4692
  }
4681
4693
  _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
- }
4694
+ const data = this._threadData.get(this._mainThread.threadId);
4695
+ if (!data) throw new Error("Thread not found");
4696
+ const exprt = this._mainThread.export();
4697
+ data.data = exprt;
4688
4698
  this._mainThread._notifyEventSubscribers("switched-away");
4689
4699
  this._mainThread = newThreadCore;
4690
4700
  newThreadCore._notifyEventSubscribers("switched-to");