@assistant-ui/react 0.5.53 → 0.5.56

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
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ComponentType, PropsWithChildren, FC, ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
3
3
  import { T as ThreadAssistantContentPart, M as MessageStatus, a as ThreadRoundtrip, b as ThreadMessage, c as ModelConfig, d as ModelConfigProvider, C as ContentPartStatus, e as TextContentPart, I as ImageContentPart, U as UIContentPart, f as ToolCallContentPart, g as ToolCallContentPartStatus, h as CoreMessage, i as ThreadComposerAttachment, j as MessageAttachment, A as AppendMessage, k as Tool, l as CoreToolCallContentPart, m as CreateEdgeRuntimeAPIOptions } from './edge-BJordJU0.mjs';
4
4
  export { s as CoreAssistantContentPart, v as CoreAssistantMessage, t as CoreSystemMessage, r as CoreUserContentPart, u as CoreUserMessage, E as EdgeRuntimeRequestOptions, p as ThreadAssistantMessage, o as ThreadSystemMessage, n as ThreadUserContentPart, q as ThreadUserMessage } from './edge-BJordJU0.mjs';
5
- import { UseBoundStore, StoreApi } from 'zustand';
5
+ import { StoreApi, UseBoundStore } from 'zustand';
6
6
  import { Primitive } from '@radix-ui/react-primitive';
7
7
  import * as PopoverPrimitive from '@radix-ui/react-popover';
8
8
  import * as react_textarea_autosize from 'react-textarea-autosize';
@@ -16,7 +16,7 @@ import 'zod';
16
16
 
17
17
  type Unsubscribe = () => void;
18
18
 
19
- type ReadonlyStore<T> = UseBoundStore<Omit<StoreApi<T>, "setState" | "destroy">>;
19
+ type ReadonlyStore<T> = Omit<StoreApi<T>, "setState" | "destroy">;
20
20
 
21
21
  type ReactThreadRuntime = ThreadRuntime & {
22
22
  unstable_synchronizer?: ComponentType;
@@ -54,6 +54,7 @@ declare abstract class BaseAssistantRuntime<TThreadRuntime extends ReactThreadRu
54
54
  constructor(_thread: TThreadRuntime);
55
55
  get thread(): TThreadRuntime;
56
56
  set thread(thread: TThreadRuntime);
57
+ abstract switchToNewThread(): void;
57
58
  abstract registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe;
58
59
  abstract switchToThread(threadId: string | null): void;
59
60
  private _subscriptions;
@@ -220,7 +221,8 @@ declare class LocalRuntime extends BaseAssistantRuntime<LocalThreadRuntime> {
220
221
  set adapter(adapter: ChatModelAdapter);
221
222
  set options(options: LocalRuntimeOptions);
222
223
  registerModelConfigProvider(provider: ModelConfigProvider): () => void;
223
- switchToThread(threadId: string | null): LocalThreadRuntime;
224
+ switchToNewThread(): LocalThreadRuntime;
225
+ switchToThread(threadId: string | null): void;
224
226
  reset({ initialMessages, }?: {
225
227
  initialMessages?: readonly CoreMessage[] | undefined;
226
228
  }): void;
@@ -339,9 +341,9 @@ type ExternalStoreAdapterBase<T> = {
339
341
  onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;
340
342
  onReload?: ((parentId: string | null) => Promise<void>) | undefined;
341
343
  onCancel?: (() => Promise<void>) | undefined;
342
- onNewThread?: (() => Promise<void> | void) | undefined;
343
344
  onAddToolResult?: ((options: AddToolResultOptions) => Promise<void> | void) | undefined;
344
- onSwitchThread?: ((threadId: string | null) => Promise<void> | void) | undefined;
345
+ onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
346
+ onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
345
347
  onSpeak?: ((message: ThreadMessage) => SpeechSynthesisAdapter.Utterance) | undefined;
346
348
  convertMessage?: ExternalStoreMessageConverter<T> | undefined;
347
349
  adapters?: {
@@ -371,17 +373,60 @@ type ContentPartState = Readonly<{
371
373
  declare const useSmooth: (state: TextContentPartState, smooth?: boolean) => TextContentPartState;
372
374
 
373
375
  declare const withSmoothContextProvider: <C extends React.ComponentType<any>>(Component: C) => C;
374
- declare const useSmoothStatus: () => {
375
- type: "running";
376
- } | {
377
- type: "complete";
378
- } | {
379
- type: "incomplete";
380
- reason: "cancelled" | "length" | "content-filter" | "other" | "error";
381
- error?: unknown;
382
- } | {
383
- type: "requires-action";
384
- reason: "tool-calls";
376
+ declare const useSmoothStatus: {
377
+ (): {
378
+ type: "running";
379
+ } | {
380
+ type: "complete";
381
+ } | {
382
+ type: "incomplete";
383
+ reason: "cancelled" | "length" | "content-filter" | "other" | "error";
384
+ error?: unknown;
385
+ } | {
386
+ type: "requires-action";
387
+ reason: "tool-calls";
388
+ };
389
+ <TSelected>(selector: (state: {
390
+ type: "running";
391
+ } | {
392
+ type: "complete";
393
+ } | {
394
+ type: "incomplete";
395
+ reason: "cancelled" | "length" | "content-filter" | "other" | "error";
396
+ error?: unknown;
397
+ } | {
398
+ type: "requires-action";
399
+ reason: "tool-calls";
400
+ }) => TSelected): TSelected;
401
+ (options: {
402
+ optional: true;
403
+ }): {
404
+ type: "running";
405
+ } | {
406
+ type: "complete";
407
+ } | {
408
+ type: "incomplete";
409
+ reason: "cancelled" | "length" | "content-filter" | "other" | "error";
410
+ error?: unknown;
411
+ } | {
412
+ type: "requires-action";
413
+ reason: "tool-calls";
414
+ } | null;
415
+ <TSelected>(options: {
416
+ optional: true;
417
+ selector?: (state: {
418
+ type: "running";
419
+ } | {
420
+ type: "complete";
421
+ } | {
422
+ type: "incomplete";
423
+ reason: "cancelled" | "length" | "content-filter" | "other" | "error";
424
+ error?: unknown;
425
+ } | {
426
+ type: "requires-action";
427
+ reason: "tool-calls";
428
+ }) => TSelected;
429
+ }): TSelected | null;
385
430
  };
386
431
 
387
432
  declare const buttonVariants: (props?: ({
@@ -465,6 +510,7 @@ declare class ExternalStoreRuntime extends BaseAssistantRuntime<ExternalStoreThr
465
510
  set store(store: ExternalStoreAdapter<any>);
466
511
  getModelConfig(): ModelConfig;
467
512
  registerModelConfigProvider(provider: ModelConfigProvider): () => void;
513
+ switchToNewThread(): Promise<void>;
468
514
  switchToThread(threadId: string | null): Promise<void>;
469
515
  }
470
516
 
@@ -553,6 +599,10 @@ type ThreadRuntimeWithSubscribe = {
553
599
  subscribe: (callback: () => void) => Unsubscribe;
554
600
  };
555
601
  type AssistantRuntime = ThreadRuntimeWithSubscribe & {
602
+ switchToNewThread: () => void;
603
+ /**
604
+ * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
605
+ */
556
606
  switchToThread: (threadId: string | null) => void;
557
607
  registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
558
608
  };
@@ -568,12 +618,12 @@ type TextContentPartProviderProps = {
568
618
  declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
569
619
 
570
620
  type AssistantActionsState = Readonly<{
621
+ /**
622
+ * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
623
+ */
571
624
  switchToThread: (threadId: string | null) => void;
572
- getRuntime: () => AssistantRuntime;
573
- }>;
574
-
575
- type AssistantModelConfigState = Readonly<ModelConfigProvider & {
576
- registerModelConfigProvider: (provider: ModelConfigProvider) => () => void;
625
+ switchToNewThread: () => void;
626
+ registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
577
627
  }>;
578
628
 
579
629
  type AssistantToolUIsState = Readonly<{
@@ -582,15 +632,111 @@ type AssistantToolUIsState = Readonly<{
582
632
  }>;
583
633
 
584
634
  type AssistantContextValue = {
585
- useModelConfig: ReadonlyStore<AssistantModelConfigState>;
586
- useToolUIs: ReadonlyStore<AssistantToolUIsState>;
587
- useAssistantRuntime: ReadonlyStore<AssistantRuntime>;
588
- useAssistantActions: ReadonlyStore<AssistantActionsState>;
635
+ useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>;
636
+ useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
637
+ useAssistantActions: UseBoundStore<ReadonlyStore<AssistantActionsState>>;
638
+ };
639
+ declare const useAssistantContext: {
640
+ (options?: {
641
+ optional?: false | undefined;
642
+ } | undefined): AssistantContextValue;
643
+ (options?: {
644
+ optional?: boolean | undefined;
645
+ } | undefined): AssistantContextValue | null;
646
+ };
647
+ declare const useAssistantRuntime: {
648
+ (): AssistantRuntime;
649
+ <TSelected>(selector: (state: AssistantRuntime) => TSelected): TSelected;
650
+ (options: {
651
+ optional: true;
652
+ }): AssistantRuntime | null;
653
+ <TSelected>(options: {
654
+ optional: true;
655
+ selector?: (state: AssistantRuntime) => TSelected;
656
+ }): TSelected | null;
657
+ };
658
+ declare const useAssistantRuntimeStore: {
659
+ (): ReadonlyStore<AssistantRuntime>;
660
+ (options: {
661
+ optional: true;
662
+ }): ReadonlyStore<AssistantRuntime> | null;
663
+ };
664
+ declare const useToolUIs: {
665
+ (): Readonly<{
666
+ getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
667
+ setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
668
+ }>;
669
+ <TSelected>(selector: (state: Readonly<{
670
+ getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
671
+ setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
672
+ }>) => TSelected): TSelected;
673
+ (options: {
674
+ optional: true;
675
+ }): Readonly<{
676
+ getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
677
+ setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
678
+ }> | null;
679
+ <TSelected>(options: {
680
+ optional: true;
681
+ selector?: (state: Readonly<{
682
+ getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
683
+ setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
684
+ }>) => TSelected;
685
+ }): TSelected | null;
686
+ };
687
+ declare const useToolUIsStore: {
688
+ (): ReadonlyStore<Readonly<{
689
+ getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
690
+ setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
691
+ }>>;
692
+ (options: {
693
+ optional: true;
694
+ }): ReadonlyStore<Readonly<{
695
+ getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
696
+ setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
697
+ }>> | null;
698
+ };
699
+ declare const useAssistantActions: {
700
+ (): Readonly<{
701
+ switchToThread: (threadId: string | null) => void;
702
+ switchToNewThread: () => void;
703
+ registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
704
+ }>;
705
+ <TSelected>(selector: (state: Readonly<{
706
+ switchToThread: (threadId: string | null) => void;
707
+ switchToNewThread: () => void;
708
+ registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
709
+ }>) => TSelected): TSelected;
710
+ (options: {
711
+ optional: true;
712
+ }): Readonly<{
713
+ switchToThread: (threadId: string | null) => void;
714
+ switchToNewThread: () => void;
715
+ registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
716
+ }> | null;
717
+ <TSelected>(options: {
718
+ optional: true;
719
+ selector?: (state: Readonly<{
720
+ switchToThread: (threadId: string | null) => void;
721
+ switchToNewThread: () => void;
722
+ registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
723
+ }>) => TSelected;
724
+ }): TSelected | null;
725
+ };
726
+ declare const useAssistantActionsStore: {
727
+ (): ReadonlyStore<Readonly<{
728
+ switchToThread: (threadId: string | null) => void;
729
+ switchToNewThread: () => void;
730
+ registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
731
+ }>>;
732
+ (options: {
733
+ optional: true;
734
+ }): ReadonlyStore<Readonly<{
735
+ switchToThread: (threadId: string | null) => void;
736
+ switchToNewThread: () => void;
737
+ registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
738
+ }>> | null;
589
739
  };
590
- declare function useAssistantContext(): AssistantContextValue;
591
- declare function useAssistantContext(options: {
592
- optional: true;
593
- }): AssistantContextValue | null;
594
740
 
595
741
  type ThreadViewportState = Readonly<{
596
742
  isAtBottom: boolean;
@@ -601,22 +747,346 @@ type ThreadViewportState = Readonly<{
601
747
  type ThreadMessagesState = readonly ThreadMessage[];
602
748
 
603
749
  type ThreadContextValue = {
604
- useThread: ReadonlyStore<ThreadState>;
605
- useThreadRuntime: ReadonlyStore<ThreadRuntimeStore>;
606
- useThreadMessages: ReadonlyStore<ThreadMessagesState>;
607
- useThreadActions: ReadonlyStore<ThreadActionsState>;
608
- useComposer: ReadonlyStore<ComposerState>;
609
- useViewport: ReadonlyStore<ThreadViewportState>;
610
- };
611
- declare function useThreadContext(): ThreadContextValue;
612
- declare function useThreadContext(options: {
613
- optional: true;
614
- }): ThreadContextValue | null;
750
+ useThread: UseBoundStore<ReadonlyStore<ThreadState>>;
751
+ useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntimeStore>>;
752
+ useThreadMessages: UseBoundStore<ReadonlyStore<ThreadMessagesState>>;
753
+ useThreadActions: UseBoundStore<ReadonlyStore<ThreadActionsState>>;
754
+ useComposer: UseBoundStore<ReadonlyStore<ThreadComposerState>>;
755
+ useViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;
756
+ };
757
+ declare const useThreadContext: {
758
+ (options?: {
759
+ optional?: false | undefined;
760
+ } | undefined): ThreadContextValue;
761
+ (options?: {
762
+ optional?: boolean | undefined;
763
+ } | undefined): ThreadContextValue | null;
764
+ };
765
+ declare const useThreadRuntime: {
766
+ (): ThreadRuntime;
767
+ <TSelected>(selector: (state: ThreadRuntime) => TSelected): TSelected;
768
+ (options: {
769
+ optional: true;
770
+ }): ThreadRuntime | null;
771
+ <TSelected>(options: {
772
+ optional: true;
773
+ selector?: (state: ThreadRuntime) => TSelected;
774
+ }): TSelected | null;
775
+ };
776
+ declare const useThreadRuntimeStore: {
777
+ (): ReadonlyStore<ThreadRuntime>;
778
+ (options: {
779
+ optional: true;
780
+ }): ReadonlyStore<ThreadRuntime> | null;
781
+ };
782
+ declare const useThread: {
783
+ (): Readonly<{
784
+ capabilities: Readonly<RuntimeCapabilities>;
785
+ threadId: string;
786
+ isRunning: boolean;
787
+ isDisabled: boolean;
788
+ }>;
789
+ <TSelected>(selector: (state: Readonly<{
790
+ capabilities: Readonly<RuntimeCapabilities>;
791
+ threadId: string;
792
+ isRunning: boolean;
793
+ isDisabled: boolean;
794
+ }>) => TSelected): TSelected;
795
+ (options: {
796
+ optional: true;
797
+ }): Readonly<{
798
+ capabilities: Readonly<RuntimeCapabilities>;
799
+ threadId: string;
800
+ isRunning: boolean;
801
+ isDisabled: boolean;
802
+ }> | null;
803
+ <TSelected>(options: {
804
+ optional: true;
805
+ selector?: (state: Readonly<{
806
+ capabilities: Readonly<RuntimeCapabilities>;
807
+ threadId: string;
808
+ isRunning: boolean;
809
+ isDisabled: boolean;
810
+ }>) => TSelected;
811
+ }): TSelected | null;
812
+ };
813
+ declare const useThreadStore: {
814
+ (): ReadonlyStore<Readonly<{
815
+ capabilities: Readonly<RuntimeCapabilities>;
816
+ threadId: string;
817
+ isRunning: boolean;
818
+ isDisabled: boolean;
819
+ }>>;
820
+ (options: {
821
+ optional: true;
822
+ }): ReadonlyStore<Readonly<{
823
+ capabilities: Readonly<RuntimeCapabilities>;
824
+ threadId: string;
825
+ isRunning: boolean;
826
+ isDisabled: boolean;
827
+ }>> | null;
828
+ };
829
+ declare const useThreadMessages: {
830
+ (): ThreadMessagesState;
831
+ <TSelected>(selector: (state: ThreadMessagesState) => TSelected): TSelected;
832
+ (options: {
833
+ optional: true;
834
+ }): ThreadMessagesState | null;
835
+ <TSelected>(options: {
836
+ optional: true;
837
+ selector?: (state: ThreadMessagesState) => TSelected;
838
+ }): TSelected | null;
839
+ };
840
+ declare const useThreadMessagesStore: {
841
+ (): ReadonlyStore<ThreadMessagesState>;
842
+ (options: {
843
+ optional: true;
844
+ }): ReadonlyStore<ThreadMessagesState> | null;
845
+ };
846
+ declare const useThreadActions: {
847
+ (): Readonly<{
848
+ getBranches: (messageId: string) => readonly string[];
849
+ switchToBranch: (branchId: string) => void;
850
+ append: (message: AppendMessage) => void;
851
+ startRun: (parentId: string | null) => void;
852
+ cancelRun: () => void;
853
+ addToolResult: (options: AddToolResultOptions) => void;
854
+ speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
855
+ }>;
856
+ <TSelected>(selector: (state: Readonly<{
857
+ getBranches: (messageId: string) => readonly string[];
858
+ switchToBranch: (branchId: string) => void;
859
+ append: (message: AppendMessage) => void;
860
+ startRun: (parentId: string | null) => void;
861
+ cancelRun: () => void;
862
+ addToolResult: (options: AddToolResultOptions) => void;
863
+ speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
864
+ }>) => TSelected): TSelected;
865
+ (options: {
866
+ optional: true;
867
+ }): Readonly<{
868
+ getBranches: (messageId: string) => readonly string[];
869
+ switchToBranch: (branchId: string) => void;
870
+ append: (message: AppendMessage) => void;
871
+ startRun: (parentId: string | null) => void;
872
+ cancelRun: () => void;
873
+ addToolResult: (options: AddToolResultOptions) => void;
874
+ speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
875
+ }> | null;
876
+ <TSelected>(options: {
877
+ optional: true;
878
+ selector?: (state: Readonly<{
879
+ getBranches: (messageId: string) => readonly string[];
880
+ switchToBranch: (branchId: string) => void;
881
+ append: (message: AppendMessage) => void;
882
+ startRun: (parentId: string | null) => void;
883
+ cancelRun: () => void;
884
+ addToolResult: (options: AddToolResultOptions) => void;
885
+ speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
886
+ }>) => TSelected;
887
+ }): TSelected | null;
888
+ };
889
+ declare const useThreadActionsStore: {
890
+ (): ReadonlyStore<Readonly<{
891
+ getBranches: (messageId: string) => readonly string[];
892
+ switchToBranch: (branchId: string) => void;
893
+ append: (message: AppendMessage) => void;
894
+ startRun: (parentId: string | null) => void;
895
+ cancelRun: () => void;
896
+ addToolResult: (options: AddToolResultOptions) => void;
897
+ speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
898
+ }>>;
899
+ (options: {
900
+ optional: true;
901
+ }): ReadonlyStore<Readonly<{
902
+ getBranches: (messageId: string) => readonly string[];
903
+ switchToBranch: (branchId: string) => void;
904
+ append: (message: AppendMessage) => void;
905
+ startRun: (parentId: string | null) => void;
906
+ cancelRun: () => void;
907
+ addToolResult: (options: AddToolResultOptions) => void;
908
+ speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
909
+ }>> | null;
910
+ };
911
+ declare const useThreadComposer: {
912
+ (): Readonly<{
913
+ type: "thread";
914
+ value: string;
915
+ setValue: (value: string) => void;
916
+ attachmentAccept: string;
917
+ attachments: readonly ThreadComposerAttachment[];
918
+ addAttachment: (file: File) => void;
919
+ removeAttachment: (attachmentId: string) => void;
920
+ text: string;
921
+ setText: (value: string) => void;
922
+ reset: () => void;
923
+ canCancel: boolean;
924
+ isEditing: true;
925
+ isEmpty: boolean;
926
+ send: () => void;
927
+ cancel: () => void;
928
+ focus: () => void;
929
+ onFocus: (listener: () => void) => Unsubscribe;
930
+ }>;
931
+ <TSelected>(selector: (state: Readonly<{
932
+ type: "thread";
933
+ value: string;
934
+ setValue: (value: string) => void;
935
+ attachmentAccept: string;
936
+ attachments: readonly ThreadComposerAttachment[];
937
+ addAttachment: (file: File) => void;
938
+ removeAttachment: (attachmentId: string) => void;
939
+ text: string;
940
+ setText: (value: string) => void;
941
+ reset: () => void;
942
+ canCancel: boolean;
943
+ isEditing: true;
944
+ isEmpty: boolean;
945
+ send: () => void;
946
+ cancel: () => void;
947
+ focus: () => void;
948
+ onFocus: (listener: () => void) => Unsubscribe;
949
+ }>) => TSelected): TSelected;
950
+ (options: {
951
+ optional: true;
952
+ }): Readonly<{
953
+ type: "thread";
954
+ value: string;
955
+ setValue: (value: string) => void;
956
+ attachmentAccept: string;
957
+ attachments: readonly ThreadComposerAttachment[];
958
+ addAttachment: (file: File) => void;
959
+ removeAttachment: (attachmentId: string) => void;
960
+ text: string;
961
+ setText: (value: string) => void;
962
+ reset: () => void;
963
+ canCancel: boolean;
964
+ isEditing: true;
965
+ isEmpty: boolean;
966
+ send: () => void;
967
+ cancel: () => void;
968
+ focus: () => void;
969
+ onFocus: (listener: () => void) => Unsubscribe;
970
+ }> | null;
971
+ <TSelected>(options: {
972
+ optional: true;
973
+ selector?: (state: Readonly<{
974
+ type: "thread";
975
+ value: string;
976
+ setValue: (value: string) => void;
977
+ attachmentAccept: string;
978
+ attachments: readonly ThreadComposerAttachment[];
979
+ addAttachment: (file: File) => void;
980
+ removeAttachment: (attachmentId: string) => void;
981
+ text: string;
982
+ setText: (value: string) => void;
983
+ reset: () => void;
984
+ canCancel: boolean;
985
+ isEditing: true;
986
+ isEmpty: boolean;
987
+ send: () => void;
988
+ cancel: () => void;
989
+ focus: () => void;
990
+ onFocus: (listener: () => void) => Unsubscribe;
991
+ }>) => TSelected;
992
+ }): TSelected | null;
993
+ };
994
+ declare const useThreadComposerStore: {
995
+ (): ReadonlyStore<Readonly<{
996
+ type: "thread";
997
+ value: string;
998
+ setValue: (value: string) => void;
999
+ attachmentAccept: string;
1000
+ attachments: readonly ThreadComposerAttachment[];
1001
+ addAttachment: (file: File) => void;
1002
+ removeAttachment: (attachmentId: string) => void;
1003
+ text: string;
1004
+ setText: (value: string) => void;
1005
+ reset: () => void;
1006
+ canCancel: boolean;
1007
+ isEditing: true;
1008
+ isEmpty: boolean;
1009
+ send: () => void;
1010
+ cancel: () => void;
1011
+ focus: () => void;
1012
+ onFocus: (listener: () => void) => Unsubscribe;
1013
+ }>>;
1014
+ (options: {
1015
+ optional: true;
1016
+ }): ReadonlyStore<Readonly<{
1017
+ type: "thread";
1018
+ value: string;
1019
+ setValue: (value: string) => void;
1020
+ attachmentAccept: string;
1021
+ attachments: readonly ThreadComposerAttachment[];
1022
+ addAttachment: (file: File) => void;
1023
+ removeAttachment: (attachmentId: string) => void;
1024
+ text: string;
1025
+ setText: (value: string) => void;
1026
+ reset: () => void;
1027
+ canCancel: boolean;
1028
+ isEditing: true;
1029
+ isEmpty: boolean;
1030
+ send: () => void;
1031
+ cancel: () => void;
1032
+ focus: () => void;
1033
+ onFocus: (listener: () => void) => Unsubscribe;
1034
+ }>> | null;
1035
+ };
1036
+ declare const useThreadViewport: {
1037
+ (): Readonly<{
1038
+ isAtBottom: boolean;
1039
+ scrollToBottom: () => void;
1040
+ onScrollToBottom: (callback: () => void) => Unsubscribe;
1041
+ }>;
1042
+ <TSelected>(selector: (state: Readonly<{
1043
+ isAtBottom: boolean;
1044
+ scrollToBottom: () => void;
1045
+ onScrollToBottom: (callback: () => void) => Unsubscribe;
1046
+ }>) => TSelected): TSelected;
1047
+ (options: {
1048
+ optional: true;
1049
+ }): Readonly<{
1050
+ isAtBottom: boolean;
1051
+ scrollToBottom: () => void;
1052
+ onScrollToBottom: (callback: () => void) => Unsubscribe;
1053
+ }> | null;
1054
+ <TSelected>(options: {
1055
+ optional: true;
1056
+ selector?: (state: Readonly<{
1057
+ isAtBottom: boolean;
1058
+ scrollToBottom: () => void;
1059
+ onScrollToBottom: (callback: () => void) => Unsubscribe;
1060
+ }>) => TSelected;
1061
+ }): TSelected | null;
1062
+ };
1063
+ declare const useThreadViewportStore: {
1064
+ (): ReadonlyStore<Readonly<{
1065
+ isAtBottom: boolean;
1066
+ scrollToBottom: () => void;
1067
+ onScrollToBottom: (callback: () => void) => Unsubscribe;
1068
+ }>>;
1069
+ (options: {
1070
+ optional: true;
1071
+ }): ReadonlyStore<Readonly<{
1072
+ isAtBottom: boolean;
1073
+ scrollToBottom: () => void;
1074
+ onScrollToBottom: (callback: () => void) => Unsubscribe;
1075
+ }>> | null;
1076
+ };
1077
+
1078
+ type MessageState = Readonly<{
1079
+ message: Readonly<ThreadMessage>;
1080
+ parentId: string | null;
1081
+ branches: readonly string[];
1082
+ isLast: boolean;
1083
+ }>;
615
1084
 
616
1085
  type EditComposerState = Readonly<{
617
- /** @deprecated Use `text` instead. */
1086
+ type: "edit";
1087
+ /** @deprecated Use `text` instead. This will be removed in 0.6.0. */
618
1088
  value: string;
619
- /** @deprecated Use `setText` instead. */
1089
+ /** @deprecated Use `setText` instead. This will be removed in 0.6.0. */
620
1090
  setValue: (value: string) => void;
621
1091
  text: string;
622
1092
  setText: (value: string) => void;
@@ -628,19 +1098,6 @@ type EditComposerState = Readonly<{
628
1098
  cancel: () => void;
629
1099
  }>;
630
1100
 
631
- type ComposerContextValue = {
632
- useComposer: ReadonlyStore<EditComposerState | ComposerState>;
633
- type: "edit" | "new";
634
- };
635
- declare const useComposerContext: () => ComposerContextValue;
636
-
637
- type MessageState = Readonly<{
638
- message: Readonly<ThreadMessage>;
639
- parentId: string | null;
640
- branches: readonly string[];
641
- isLast: boolean;
642
- }>;
643
-
644
1101
  type MessageUtilsState = Readonly<{
645
1102
  isCopied: boolean;
646
1103
  setIsCopied: (value: boolean) => void;
@@ -652,28 +1109,477 @@ type MessageUtilsState = Readonly<{
652
1109
  }>;
653
1110
 
654
1111
  type MessageContextValue = {
655
- useMessage: ReadonlyStore<MessageState>;
656
- useMessageUtils: ReadonlyStore<MessageUtilsState>;
657
- useEditComposer: ReadonlyStore<EditComposerState>;
1112
+ useMessage: UseBoundStore<ReadonlyStore<MessageState>>;
1113
+ useMessageUtils: UseBoundStore<ReadonlyStore<MessageUtilsState>>;
1114
+ useEditComposer: UseBoundStore<ReadonlyStore<EditComposerState>>;
1115
+ };
1116
+ declare const useMessageContext: {
1117
+ (options?: {
1118
+ optional?: false | undefined;
1119
+ } | undefined): MessageContextValue;
1120
+ (options?: {
1121
+ optional?: boolean | undefined;
1122
+ } | undefined): MessageContextValue | null;
1123
+ };
1124
+ declare const useMessage: {
1125
+ (): Readonly<{
1126
+ message: Readonly<ThreadMessage>;
1127
+ parentId: string | null;
1128
+ branches: readonly string[];
1129
+ isLast: boolean;
1130
+ }>;
1131
+ <TSelected>(selector: (state: Readonly<{
1132
+ message: Readonly<ThreadMessage>;
1133
+ parentId: string | null;
1134
+ branches: readonly string[];
1135
+ isLast: boolean;
1136
+ }>) => TSelected): TSelected;
1137
+ (options: {
1138
+ optional: true;
1139
+ }): Readonly<{
1140
+ message: Readonly<ThreadMessage>;
1141
+ parentId: string | null;
1142
+ branches: readonly string[];
1143
+ isLast: boolean;
1144
+ }> | null;
1145
+ <TSelected>(options: {
1146
+ optional: true;
1147
+ selector?: (state: Readonly<{
1148
+ message: Readonly<ThreadMessage>;
1149
+ parentId: string | null;
1150
+ branches: readonly string[];
1151
+ isLast: boolean;
1152
+ }>) => TSelected;
1153
+ }): TSelected | null;
1154
+ };
1155
+ declare const useMessageStore: {
1156
+ (): ReadonlyStore<Readonly<{
1157
+ message: Readonly<ThreadMessage>;
1158
+ parentId: string | null;
1159
+ branches: readonly string[];
1160
+ isLast: boolean;
1161
+ }>>;
1162
+ (options: {
1163
+ optional: true;
1164
+ }): ReadonlyStore<Readonly<{
1165
+ message: Readonly<ThreadMessage>;
1166
+ parentId: string | null;
1167
+ branches: readonly string[];
1168
+ isLast: boolean;
1169
+ }>> | null;
1170
+ };
1171
+ declare const useMessageUtils: {
1172
+ (): Readonly<{
1173
+ isCopied: boolean;
1174
+ setIsCopied: (value: boolean) => void;
1175
+ isHovering: boolean;
1176
+ setIsHovering: (value: boolean) => void;
1177
+ isSpeaking: boolean;
1178
+ stopSpeaking: () => void;
1179
+ addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
1180
+ }>;
1181
+ <TSelected>(selector: (state: Readonly<{
1182
+ isCopied: boolean;
1183
+ setIsCopied: (value: boolean) => void;
1184
+ isHovering: boolean;
1185
+ setIsHovering: (value: boolean) => void;
1186
+ isSpeaking: boolean;
1187
+ stopSpeaking: () => void;
1188
+ addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
1189
+ }>) => TSelected): TSelected;
1190
+ (options: {
1191
+ optional: true;
1192
+ }): Readonly<{
1193
+ isCopied: boolean;
1194
+ setIsCopied: (value: boolean) => void;
1195
+ isHovering: boolean;
1196
+ setIsHovering: (value: boolean) => void;
1197
+ isSpeaking: boolean;
1198
+ stopSpeaking: () => void;
1199
+ addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
1200
+ }> | null;
1201
+ <TSelected>(options: {
1202
+ optional: true;
1203
+ selector?: (state: Readonly<{
1204
+ isCopied: boolean;
1205
+ setIsCopied: (value: boolean) => void;
1206
+ isHovering: boolean;
1207
+ setIsHovering: (value: boolean) => void;
1208
+ isSpeaking: boolean;
1209
+ stopSpeaking: () => void;
1210
+ addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
1211
+ }>) => TSelected;
1212
+ }): TSelected | null;
1213
+ };
1214
+ declare const useMessageUtilsStore: {
1215
+ (): ReadonlyStore<Readonly<{
1216
+ isCopied: boolean;
1217
+ setIsCopied: (value: boolean) => void;
1218
+ isHovering: boolean;
1219
+ setIsHovering: (value: boolean) => void;
1220
+ isSpeaking: boolean;
1221
+ stopSpeaking: () => void;
1222
+ addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
1223
+ }>>;
1224
+ (options: {
1225
+ optional: true;
1226
+ }): ReadonlyStore<Readonly<{
1227
+ isCopied: boolean;
1228
+ setIsCopied: (value: boolean) => void;
1229
+ isHovering: boolean;
1230
+ setIsHovering: (value: boolean) => void;
1231
+ isSpeaking: boolean;
1232
+ stopSpeaking: () => void;
1233
+ addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
1234
+ }>> | null;
1235
+ };
1236
+ declare const useEditComposer: {
1237
+ (): Readonly<{
1238
+ type: "edit";
1239
+ value: string;
1240
+ setValue: (value: string) => void;
1241
+ text: string;
1242
+ setText: (value: string) => void;
1243
+ canCancel: boolean;
1244
+ isEditing: boolean;
1245
+ isEmpty: boolean;
1246
+ edit: () => void;
1247
+ send: () => void;
1248
+ cancel: () => void;
1249
+ }>;
1250
+ <TSelected>(selector: (state: Readonly<{
1251
+ type: "edit";
1252
+ value: string;
1253
+ setValue: (value: string) => void;
1254
+ text: string;
1255
+ setText: (value: string) => void;
1256
+ canCancel: boolean;
1257
+ isEditing: boolean;
1258
+ isEmpty: boolean;
1259
+ edit: () => void;
1260
+ send: () => void;
1261
+ cancel: () => void;
1262
+ }>) => TSelected): TSelected;
1263
+ (options: {
1264
+ optional: true;
1265
+ }): Readonly<{
1266
+ type: "edit";
1267
+ value: string;
1268
+ setValue: (value: string) => void;
1269
+ text: string;
1270
+ setText: (value: string) => void;
1271
+ canCancel: boolean;
1272
+ isEditing: boolean;
1273
+ isEmpty: boolean;
1274
+ edit: () => void;
1275
+ send: () => void;
1276
+ cancel: () => void;
1277
+ }> | null;
1278
+ <TSelected>(options: {
1279
+ optional: true;
1280
+ selector?: (state: Readonly<{
1281
+ type: "edit";
1282
+ value: string;
1283
+ setValue: (value: string) => void;
1284
+ text: string;
1285
+ setText: (value: string) => void;
1286
+ canCancel: boolean;
1287
+ isEditing: boolean;
1288
+ isEmpty: boolean;
1289
+ edit: () => void;
1290
+ send: () => void;
1291
+ cancel: () => void;
1292
+ }>) => TSelected;
1293
+ }): TSelected | null;
1294
+ };
1295
+ declare const useEditComposerStore: {
1296
+ (): ReadonlyStore<Readonly<{
1297
+ type: "edit";
1298
+ value: string;
1299
+ setValue: (value: string) => void;
1300
+ text: string;
1301
+ setText: (value: string) => void;
1302
+ canCancel: boolean;
1303
+ isEditing: boolean;
1304
+ isEmpty: boolean;
1305
+ edit: () => void;
1306
+ send: () => void;
1307
+ cancel: () => void;
1308
+ }>>;
1309
+ (options: {
1310
+ optional: true;
1311
+ }): ReadonlyStore<Readonly<{
1312
+ type: "edit";
1313
+ value: string;
1314
+ setValue: (value: string) => void;
1315
+ text: string;
1316
+ setText: (value: string) => void;
1317
+ canCancel: boolean;
1318
+ isEditing: boolean;
1319
+ isEmpty: boolean;
1320
+ edit: () => void;
1321
+ send: () => void;
1322
+ cancel: () => void;
1323
+ }>> | null;
658
1324
  };
659
- declare function useMessageContext(): MessageContextValue;
660
- declare function useMessageContext(options: {
661
- optional: true;
662
- }): MessageContextValue | null;
663
1325
 
664
1326
  type ContentPartContextValue = {
665
- useContentPart: ReadonlyStore<ContentPartState>;
1327
+ useContentPart: UseBoundStore<ReadonlyStore<ContentPartState>>;
1328
+ };
1329
+ declare const useContentPartContext: {
1330
+ (options?: {
1331
+ optional?: false | undefined;
1332
+ } | undefined): ContentPartContextValue;
1333
+ (options?: {
1334
+ optional?: boolean | undefined;
1335
+ } | undefined): ContentPartContextValue | null;
1336
+ };
1337
+ declare const useContentPart: {
1338
+ (): Readonly<{
1339
+ status: ContentPartStatus | ToolCallContentPartStatus;
1340
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
1341
+ }>;
1342
+ <TSelected>(selector: (state: Readonly<{
1343
+ status: ContentPartStatus | ToolCallContentPartStatus;
1344
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
1345
+ }>) => TSelected): TSelected;
1346
+ (options: {
1347
+ optional: true;
1348
+ }): Readonly<{
1349
+ status: ContentPartStatus | ToolCallContentPartStatus;
1350
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
1351
+ }> | null;
1352
+ <TSelected>(options: {
1353
+ optional: true;
1354
+ selector?: (state: Readonly<{
1355
+ status: ContentPartStatus | ToolCallContentPartStatus;
1356
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
1357
+ }>) => TSelected;
1358
+ }): TSelected | null;
1359
+ };
1360
+ declare const useContentPartStore: {
1361
+ (): ReadonlyStore<Readonly<{
1362
+ status: ContentPartStatus | ToolCallContentPartStatus;
1363
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
1364
+ }>>;
1365
+ (options: {
1366
+ optional: true;
1367
+ }): ReadonlyStore<Readonly<{
1368
+ status: ContentPartStatus | ToolCallContentPartStatus;
1369
+ part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
1370
+ }>> | null;
1371
+ };
1372
+
1373
+ type ComposerContextValue = {
1374
+ useComposer: ReadonlyStore<EditComposerState | ThreadComposerState>;
1375
+ type: "edit" | "new";
1376
+ };
1377
+ declare const useComposerContext: () => ComposerContextValue;
1378
+ declare const useComposer: {
1379
+ (): Readonly<{
1380
+ type: "edit";
1381
+ value: string;
1382
+ setValue: (value: string) => void;
1383
+ text: string;
1384
+ setText: (value: string) => void;
1385
+ canCancel: boolean;
1386
+ isEditing: boolean;
1387
+ isEmpty: boolean;
1388
+ edit: () => void;
1389
+ send: () => void;
1390
+ cancel: () => void;
1391
+ }> | Readonly<{
1392
+ type: "thread";
1393
+ value: string;
1394
+ setValue: (value: string) => void;
1395
+ attachmentAccept: string;
1396
+ attachments: readonly ThreadComposerAttachment[];
1397
+ addAttachment: (file: File) => void;
1398
+ removeAttachment: (attachmentId: string) => void;
1399
+ text: string;
1400
+ setText: (value: string) => void;
1401
+ reset: () => void;
1402
+ canCancel: boolean;
1403
+ isEditing: true;
1404
+ isEmpty: boolean;
1405
+ send: () => void;
1406
+ cancel: () => void;
1407
+ focus: () => void;
1408
+ onFocus: (listener: () => void) => Unsubscribe;
1409
+ }>;
1410
+ <TSelected>(selector: (state: Readonly<{
1411
+ type: "edit";
1412
+ value: string;
1413
+ setValue: (value: string) => void;
1414
+ text: string;
1415
+ setText: (value: string) => void;
1416
+ canCancel: boolean;
1417
+ isEditing: boolean;
1418
+ isEmpty: boolean;
1419
+ edit: () => void;
1420
+ send: () => void;
1421
+ cancel: () => void;
1422
+ }> | Readonly<{
1423
+ type: "thread";
1424
+ value: string;
1425
+ setValue: (value: string) => void;
1426
+ attachmentAccept: string;
1427
+ attachments: readonly ThreadComposerAttachment[];
1428
+ addAttachment: (file: File) => void;
1429
+ removeAttachment: (attachmentId: string) => void;
1430
+ text: string;
1431
+ setText: (value: string) => void;
1432
+ reset: () => void;
1433
+ canCancel: boolean;
1434
+ isEditing: true;
1435
+ isEmpty: boolean;
1436
+ send: () => void;
1437
+ cancel: () => void;
1438
+ focus: () => void;
1439
+ onFocus: (listener: () => void) => Unsubscribe;
1440
+ }>) => TSelected): TSelected;
1441
+ (options: {
1442
+ optional: true;
1443
+ }): Readonly<{
1444
+ type: "edit";
1445
+ value: string;
1446
+ setValue: (value: string) => void;
1447
+ text: string;
1448
+ setText: (value: string) => void;
1449
+ canCancel: boolean;
1450
+ isEditing: boolean;
1451
+ isEmpty: boolean;
1452
+ edit: () => void;
1453
+ send: () => void;
1454
+ cancel: () => void;
1455
+ }> | Readonly<{
1456
+ type: "thread";
1457
+ value: string;
1458
+ setValue: (value: string) => void;
1459
+ attachmentAccept: string;
1460
+ attachments: readonly ThreadComposerAttachment[];
1461
+ addAttachment: (file: File) => void;
1462
+ removeAttachment: (attachmentId: string) => void;
1463
+ text: string;
1464
+ setText: (value: string) => void;
1465
+ reset: () => void;
1466
+ canCancel: boolean;
1467
+ isEditing: true;
1468
+ isEmpty: boolean;
1469
+ send: () => void;
1470
+ cancel: () => void;
1471
+ focus: () => void;
1472
+ onFocus: (listener: () => void) => Unsubscribe;
1473
+ }> | null;
1474
+ <TSelected>(options: {
1475
+ optional: true;
1476
+ selector?: (state: Readonly<{
1477
+ type: "edit";
1478
+ value: string;
1479
+ setValue: (value: string) => void;
1480
+ text: string;
1481
+ setText: (value: string) => void;
1482
+ canCancel: boolean;
1483
+ isEditing: boolean;
1484
+ isEmpty: boolean;
1485
+ edit: () => void;
1486
+ send: () => void;
1487
+ cancel: () => void;
1488
+ }> | Readonly<{
1489
+ type: "thread";
1490
+ value: string;
1491
+ setValue: (value: string) => void;
1492
+ attachmentAccept: string;
1493
+ attachments: readonly ThreadComposerAttachment[];
1494
+ addAttachment: (file: File) => void;
1495
+ removeAttachment: (attachmentId: string) => void;
1496
+ text: string;
1497
+ setText: (value: string) => void;
1498
+ reset: () => void;
1499
+ canCancel: boolean;
1500
+ isEditing: true;
1501
+ isEmpty: boolean;
1502
+ send: () => void;
1503
+ cancel: () => void;
1504
+ focus: () => void;
1505
+ onFocus: (listener: () => void) => Unsubscribe;
1506
+ }>) => TSelected;
1507
+ }): TSelected | null;
1508
+ };
1509
+ declare const useComposerStore: {
1510
+ (): ReadonlyStore<Readonly<{
1511
+ type: "edit";
1512
+ value: string;
1513
+ setValue: (value: string) => void;
1514
+ text: string;
1515
+ setText: (value: string) => void;
1516
+ canCancel: boolean;
1517
+ isEditing: boolean;
1518
+ isEmpty: boolean;
1519
+ edit: () => void;
1520
+ send: () => void;
1521
+ cancel: () => void;
1522
+ }> | Readonly<{
1523
+ type: "thread";
1524
+ value: string;
1525
+ setValue: (value: string) => void;
1526
+ attachmentAccept: string;
1527
+ attachments: readonly ThreadComposerAttachment[];
1528
+ addAttachment: (file: File) => void;
1529
+ removeAttachment: (attachmentId: string) => void;
1530
+ text: string;
1531
+ setText: (value: string) => void;
1532
+ reset: () => void;
1533
+ canCancel: boolean;
1534
+ isEditing: true;
1535
+ isEmpty: boolean;
1536
+ send: () => void;
1537
+ cancel: () => void;
1538
+ focus: () => void;
1539
+ onFocus: (listener: () => void) => Unsubscribe;
1540
+ }>>;
1541
+ (options: {
1542
+ optional: true;
1543
+ }): ReadonlyStore<Readonly<{
1544
+ type: "edit";
1545
+ value: string;
1546
+ setValue: (value: string) => void;
1547
+ text: string;
1548
+ setText: (value: string) => void;
1549
+ canCancel: boolean;
1550
+ isEditing: boolean;
1551
+ isEmpty: boolean;
1552
+ edit: () => void;
1553
+ send: () => void;
1554
+ cancel: () => void;
1555
+ }> | Readonly<{
1556
+ type: "thread";
1557
+ value: string;
1558
+ setValue: (value: string) => void;
1559
+ attachmentAccept: string;
1560
+ attachments: readonly ThreadComposerAttachment[];
1561
+ addAttachment: (file: File) => void;
1562
+ removeAttachment: (attachmentId: string) => void;
1563
+ text: string;
1564
+ setText: (value: string) => void;
1565
+ reset: () => void;
1566
+ canCancel: boolean;
1567
+ isEditing: true;
1568
+ isEmpty: boolean;
1569
+ send: () => void;
1570
+ cancel: () => void;
1571
+ focus: () => void;
1572
+ onFocus: (listener: () => void) => Unsubscribe;
1573
+ }>> | null;
666
1574
  };
667
- declare function useContentPartContext(): ContentPartContextValue;
668
- declare function useContentPartContext(options: {
669
- optional: true;
670
- }): ContentPartContextValue | null;
671
1575
 
672
- type ComposerState = Readonly<{
1576
+ type ThreadComposerState = Readonly<{
1577
+ type: "thread";
673
1578
  /** @deprecated Use `text` instead. */
674
1579
  value: string;
675
1580
  /** @deprecated Use `setText` instead. */
676
1581
  setValue: (value: string) => void;
1582
+ attachmentAccept: string;
677
1583
  attachments: readonly ThreadComposerAttachment[];
678
1584
  addAttachment: (file: File) => void;
679
1585
  removeAttachment: (attachmentId: string) => void;
@@ -697,6 +1603,9 @@ type CreateAppendMessage = string | {
697
1603
  };
698
1604
  declare const useAppendMessage: () => (message: CreateAppendMessage) => void;
699
1605
 
1606
+ /**
1607
+ * @deprecated Use `useRuntimeActions().switchToNewThread()` instead. This will be removed in 0.6.0.
1608
+ */
700
1609
  declare const useSwitchToNewThread: () => () => void;
701
1610
 
702
1611
  type AssistantToolProps<TArgs extends Record<string, unknown>, TResult> = Tool<TArgs, TResult> & {
@@ -896,10 +1805,10 @@ declare const BranchPickerPrevious: react.ForwardRefExoticComponent<Omit<Omit<re
896
1805
  asChild?: boolean;
897
1806
  }, "ref"> & react.RefAttributes<HTMLButtonElement>>;
898
1807
 
899
- type BranchPickerPrimitiveCountProps = {};
1808
+ type BranchPickerPrimitiveCountProps = Record<string, never>;
900
1809
  declare const BranchPickerPrimitiveCount: FC<BranchPickerPrimitiveCountProps>;
901
1810
 
902
- type BranchPickerPrimitiveNumberProps = {};
1811
+ type BranchPickerPrimitiveNumberProps = Record<string, never>;
903
1812
  declare const BranchPickerPrimitiveNumber: FC<BranchPickerPrimitiveNumberProps>;
904
1813
 
905
1814
  type PrimitiveDivProps$3 = ComponentPropsWithoutRef<typeof Primitive.div>;
@@ -992,8 +1901,8 @@ declare const ContentPartPrimitiveImage: react.ForwardRefExoticComponent<Omit<Om
992
1901
  asChild?: boolean;
993
1902
  }, "ref"> & react.RefAttributes<HTMLImageElement>>;
994
1903
 
995
- type ContentPartPrimitiveDisplayProps = {};
996
- declare const ContentPartPrimitiveDisplay: FC<ContentPartPrimitiveDisplayProps>;
1904
+ type ContentPartPrimitiveDisplayProps = Record<string, never>;
1905
+ declare const ContentPartPrimitiveDisplay: FC;
997
1906
 
998
1907
  type ContentPartPrimitiveInProgressProps = PropsWithChildren;
999
1908
  declare const ContentPartPrimitiveInProgress: FC<ContentPartPrimitiveInProgressProps>;
@@ -1030,7 +1939,7 @@ declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
1030
1939
  type PrimitiveSpanProps = ComponentPropsWithoutRef<typeof Primitive.span>;
1031
1940
  type MessagePrimitiveInProgressProps = PrimitiveSpanProps;
1032
1941
  /**
1033
- * @deprecated Define a custom Text renderer via ContentPartPrimitiveInProgress instead.
1942
+ * @deprecated Define a custom Text renderer via ContentPartPrimitiveInProgress instead. This will be removed in 0.6.
1034
1943
  */
1035
1944
  declare const MessagePrimitiveInProgress: FC<MessagePrimitiveInProgressProps>;
1036
1945
 
@@ -1434,4 +2343,4 @@ declare const exports: {
1434
2343
  Text: FC;
1435
2344
  };
1436
2345
 
1437
- export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$b as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantModelConfigState, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, type AttachmentAdapter, _default$8 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$7 as Composer, _default$6 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, type ComposerState, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, type EditComposerState, type EmptyContentPartComponent, type EmptyContentPartProps, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, TextContentPartProvider, _default$4 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$2 as UserActionBar, _default$3 as UserMessage, _default$1 as UserMessageAttachment, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantContext, useAssistantInstructions, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposerAddAttachment, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessageContext, useMessageIf, useSwitchToNewThread, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadScrollToBottom, useThreadSuggestion };
2346
+ export { index$6 as ActionBarPrimitive, type ActionBarPrimitiveCopyProps, type ActionBarPrimitiveEditProps, type ActionBarPrimitiveReloadProps, type ActionBarPrimitiveRootProps, type ActionBarPrimitiveSpeakProps, type ActionBarPrimitiveStopSpeakingProps, type AddToolResultOptions, AppendMessage, _default$b as AssistantActionBar, type AssistantActionsState, type AssistantContextValue, _default$a as AssistantMessage, type AssistantMessageConfig, type AssistantMessageContentProps, _default$9 as AssistantModal, index$5 as AssistantModalPrimitive, type AssistantModalPrimitiveContentProps, type AssistantModalPrimitiveRootProps, type AssistantModalPrimitiveTriggerProps, type AssistantRuntime, AssistantRuntimeProvider, type AssistantTool, type AssistantToolProps, type AssistantToolUI, type AssistantToolUIProps, type AssistantToolUIsState, type AttachmentAdapter, _default$8 as BranchPicker, index$4 as BranchPickerPrimitive, type BranchPickerPrimitiveCountProps, type BranchPickerPrimitiveNextProps, type BranchPickerPrimitiveNumberProps, type BranchPickerPrimitivePreviousProps, type BranchPickerPrimitiveRootProps, type ChatModelAdapter, type ChatModelRunOptions, type ChatModelRunResult, type ChatModelRunUpdate, _default$7 as Composer, _default$6 as ComposerAttachment, type ComposerContextValue, type ComposerInputProps, index$3 as ComposerPrimitive, type ComposerPrimitiveCancelProps, type ComposerPrimitiveIfProps, type ComposerPrimitiveInputProps, type ComposerPrimitiveRootProps, type ComposerPrimitiveSendProps, CompositeAttachmentAdapter, exports as ContentPart, type ContentPartContextValue, index$2 as ContentPartPrimitive, type ContentPartPrimitiveDisplayProps, type ContentPartPrimitiveImageProps, type ContentPartPrimitiveInProgressProps, type ContentPartPrimitiveTextProps, type ContentPartState, CoreMessage, type DangerousInBrowserRuntimeOptions, EdgeChatAdapter, type EdgeRuntimeOptions, _default$5 as EditComposer, type EditComposerState, type EmptyContentPartComponent, type EmptyContentPartProps, type ExternalStoreAdapter, type ExternalStoreMessageConverter, ExternalStoreRuntime, internal as INTERNAL, ImageContentPart, type ImageContentPartComponent, type ImageContentPartProps, type LocalRuntimeOptions, type MessageContextValue, index$1 as MessagePrimitive, type MessagePrimitiveContentProps, type MessagePrimitiveIfProps, type MessagePrimitiveInProgressProps, type MessagePrimitiveRootProps, type MessageState, MessageStatus, type MessageUtilsState, ModelConfig, ModelConfigProvider, type ReactThreadRuntime, SimpleImageAttachmentAdapter, SimpleTextAttachmentAdapter, SpeechSynthesisAdapter, StreamUtils, type StringsConfig, type SuggestionConfig, TextContentPart, type TextContentPartComponent, type TextContentPartProps, TextContentPartProvider, _default$4 as Thread, type ThreadActionsState, ThreadAssistantContentPart, type ThreadComposerState, type ThreadConfig, ThreadConfigProvider, type ThreadConfigProviderProps, type ThreadContextValue, ThreadMessage, type ThreadMessageLike, type ThreadMessagesState, index as ThreadPrimitive, type ThreadPrimitiveEmptyProps, type ThreadPrimitiveIfProps, type ThreadPrimitiveMessagesProps, type ThreadPrimitiveRootProps, type ThreadPrimitiveScrollToBottomProps, type ThreadPrimitiveSuggestionProps, type ThreadPrimitiveViewportProps, type ThreadRootProps, ThreadRuntime, type ThreadState, type ThreadViewportState, _default as ThreadWelcome, type ThreadWelcomeConfig, type ThreadWelcomeMessageProps, type ThreadWelcomeSuggestionProps, Tool, ToolCallContentPart, type ToolCallContentPartComponent, type ToolCallContentPartProps, UIContentPart, type UIContentPartComponent, type UIContentPartProps, type Unsubscribe, type UseActionBarCopyProps, _default$2 as UserActionBar, _default$3 as UserMessage, _default$1 as UserMessageAttachment, type UserMessageConfig, type UserMessageContentProps, WebSpeechSynthesisAdapter, fromCoreMessage, fromCoreMessages, fromLanguageModelMessages, fromLanguageModelTools, getExternalStoreMessage, makeAssistantTool, makeAssistantToolUI, streamUtils, subscribeToMainThread, toCoreMessage, toCoreMessages, toLanguageModelMessages, toLanguageModelTools, useActionBarCopy, useActionBarEdit, useActionBarReload, useActionBarSpeak, useActionBarStopSpeaking, useAppendMessage, useAssistantActions, useAssistantActionsStore, useAssistantContext, useAssistantInstructions, useAssistantRuntime, useAssistantRuntimeStore, useAssistantTool, useAssistantToolUI, useBranchPickerCount, useBranchPickerNext, useBranchPickerNumber, useBranchPickerPrevious, useComposer, useComposerAddAttachment, useComposerCancel, useComposerContext, useComposerIf, useComposerSend, useComposerStore, useContentPart, useContentPartContext, useContentPartDisplay, useContentPartImage, useContentPartStore, useContentPartText, useDangerousInBrowserRuntime, useEdgeRuntime, useEditComposer, useEditComposerStore, useExternalMessageConverter, useExternalStoreRuntime, useLocalRuntime, useMessage, useMessageContext, useMessageIf, useMessageStore, useMessageUtils, useMessageUtilsStore, useSwitchToNewThread, useThread, useThreadActions, useThreadActionsStore, useThreadComposer, useThreadComposerStore, useThreadConfig, useThreadContext, useThreadEmpty, useThreadIf, useThreadMessages, useThreadMessagesStore, useThreadRuntime, useThreadRuntimeStore, useThreadScrollToBottom, useThreadStore, useThreadSuggestion, useThreadViewport, useThreadViewportStore, useToolUIs, useToolUIsStore };