@assistant-ui/react 0.5.56 → 0.5.57

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.d.mts CHANGED
@@ -603,7 +603,8 @@ type AssistantRuntime = ThreadRuntimeWithSubscribe & {
603
603
  /**
604
604
  * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
605
605
  */
606
- switchToThread: (threadId: string | null) => void;
606
+ switchToThread(threadId: null): void;
607
+ switchToThread(threadId: string): void;
607
608
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
608
609
  };
609
610
 
@@ -621,7 +622,8 @@ type AssistantActionsState = Readonly<{
621
622
  /**
622
623
  * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
623
624
  */
624
- switchToThread: (threadId: string | null) => void;
625
+ switchToThread(threadId: null): void;
626
+ switchToThread(threadId: string): void;
625
627
  switchToNewThread: () => void;
626
628
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
627
629
  }>;
@@ -698,26 +700,30 @@ declare const useToolUIsStore: {
698
700
  };
699
701
  declare const useAssistantActions: {
700
702
  (): Readonly<{
701
- switchToThread: (threadId: string | null) => void;
703
+ switchToThread(threadId: null): void;
704
+ switchToThread(threadId: string): void;
702
705
  switchToNewThread: () => void;
703
706
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
704
707
  }>;
705
708
  <TSelected>(selector: (state: Readonly<{
706
- switchToThread: (threadId: string | null) => void;
709
+ switchToThread(threadId: null): void;
710
+ switchToThread(threadId: string): void;
707
711
  switchToNewThread: () => void;
708
712
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
709
713
  }>) => TSelected): TSelected;
710
714
  (options: {
711
715
  optional: true;
712
716
  }): Readonly<{
713
- switchToThread: (threadId: string | null) => void;
717
+ switchToThread(threadId: null): void;
718
+ switchToThread(threadId: string): void;
714
719
  switchToNewThread: () => void;
715
720
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
716
721
  }> | null;
717
722
  <TSelected>(options: {
718
723
  optional: true;
719
724
  selector?: (state: Readonly<{
720
- switchToThread: (threadId: string | null) => void;
725
+ switchToThread(threadId: null): void;
726
+ switchToThread(threadId: string): void;
721
727
  switchToNewThread: () => void;
722
728
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
723
729
  }>) => TSelected;
@@ -725,14 +731,16 @@ declare const useAssistantActions: {
725
731
  };
726
732
  declare const useAssistantActionsStore: {
727
733
  (): ReadonlyStore<Readonly<{
728
- switchToThread: (threadId: string | null) => void;
734
+ switchToThread(threadId: null): void;
735
+ switchToThread(threadId: string): void;
729
736
  switchToNewThread: () => void;
730
737
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
731
738
  }>>;
732
739
  (options: {
733
740
  optional: true;
734
741
  }): ReadonlyStore<Readonly<{
735
- switchToThread: (threadId: string | null) => void;
742
+ switchToThread(threadId: null): void;
743
+ switchToThread(threadId: string): void;
736
744
  switchToNewThread: () => void;
737
745
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
738
746
  }>> | null;
package/dist/index.d.ts CHANGED
@@ -603,7 +603,8 @@ type AssistantRuntime = ThreadRuntimeWithSubscribe & {
603
603
  /**
604
604
  * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
605
605
  */
606
- switchToThread: (threadId: string | null) => void;
606
+ switchToThread(threadId: null): void;
607
+ switchToThread(threadId: string): void;
607
608
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
608
609
  };
609
610
 
@@ -621,7 +622,8 @@ type AssistantActionsState = Readonly<{
621
622
  /**
622
623
  * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
623
624
  */
624
- switchToThread: (threadId: string | null) => void;
625
+ switchToThread(threadId: null): void;
626
+ switchToThread(threadId: string): void;
625
627
  switchToNewThread: () => void;
626
628
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
627
629
  }>;
@@ -698,26 +700,30 @@ declare const useToolUIsStore: {
698
700
  };
699
701
  declare const useAssistantActions: {
700
702
  (): Readonly<{
701
- switchToThread: (threadId: string | null) => void;
703
+ switchToThread(threadId: null): void;
704
+ switchToThread(threadId: string): void;
702
705
  switchToNewThread: () => void;
703
706
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
704
707
  }>;
705
708
  <TSelected>(selector: (state: Readonly<{
706
- switchToThread: (threadId: string | null) => void;
709
+ switchToThread(threadId: null): void;
710
+ switchToThread(threadId: string): void;
707
711
  switchToNewThread: () => void;
708
712
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
709
713
  }>) => TSelected): TSelected;
710
714
  (options: {
711
715
  optional: true;
712
716
  }): Readonly<{
713
- switchToThread: (threadId: string | null) => void;
717
+ switchToThread(threadId: null): void;
718
+ switchToThread(threadId: string): void;
714
719
  switchToNewThread: () => void;
715
720
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
716
721
  }> | null;
717
722
  <TSelected>(options: {
718
723
  optional: true;
719
724
  selector?: (state: Readonly<{
720
- switchToThread: (threadId: string | null) => void;
725
+ switchToThread(threadId: null): void;
726
+ switchToThread(threadId: string): void;
721
727
  switchToNewThread: () => void;
722
728
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
723
729
  }>) => TSelected;
@@ -725,14 +731,16 @@ declare const useAssistantActions: {
725
731
  };
726
732
  declare const useAssistantActionsStore: {
727
733
  (): ReadonlyStore<Readonly<{
728
- switchToThread: (threadId: string | null) => void;
734
+ switchToThread(threadId: null): void;
735
+ switchToThread(threadId: string): void;
729
736
  switchToNewThread: () => void;
730
737
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
731
738
  }>>;
732
739
  (options: {
733
740
  optional: true;
734
741
  }): ReadonlyStore<Readonly<{
735
- switchToThread: (threadId: string | null) => void;
742
+ switchToThread(threadId: null): void;
743
+ switchToThread(threadId: string): void;
736
744
  switchToNewThread: () => void;
737
745
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
738
746
  }>> | null;
package/dist/index.js CHANGED
@@ -1839,8 +1839,8 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
1839
1839
  if (!this.store.onSwitchToNewThread)
1840
1840
  throw new Error("Runtime does not support switching to new threads.");
1841
1841
  this.thread = new ExternalStoreThreadRuntime({
1842
- messages: [],
1843
- onNew: this.store.onNew
1842
+ ...this.store,
1843
+ messages: []
1844
1844
  });
1845
1845
  await this.store.onSwitchToNewThread();
1846
1846
  }
@@ -1849,8 +1849,9 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
1849
1849
  if (!this.store.onSwitchToThread)
1850
1850
  throw new Error("Runtime does not support switching threads.");
1851
1851
  this.thread = new ExternalStoreThreadRuntime({
1852
- messages: [],
1853
- onNew: this.store.onNew
1852
+ ...this.store,
1853
+ messages: []
1854
+ // ignore messages until rerender
1854
1855
  });
1855
1856
  this.store.onSwitchToThread(threadId);
1856
1857
  } else {