@assistant-ui/react 0.5.53 → 0.5.55
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-ZQNZLTZL.mjs → chunk-33TPUWEZ.mjs} +4 -3
- package/dist/{chunk-ZQNZLTZL.mjs.map → chunk-33TPUWEZ.mjs.map} +1 -1
- package/dist/{chunk-4LR4BB23.js → chunk-CWAZOKEW.js} +4 -3
- package/dist/{chunk-4LR4BB23.js.map → chunk-CWAZOKEW.js.map} +1 -1
- package/dist/edge.js +3 -2
- package/dist/edge.js.map +1 -1
- package/dist/edge.mjs +3 -2
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +961 -71
- package/dist/index.d.ts +961 -71
- package/dist/index.js +549 -435
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +516 -402
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +3 -1
- package/package.json +7 -7
package/dist/index.d.ts
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.js';
|
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.js';
|
5
|
-
import {
|
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> =
|
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
|
-
|
224
|
+
switchToNewThread(): LocalThreadRuntime;
|
225
|
+
switchToThread(threadId: string | null): void;
|
224
226
|
reset({ initialMessages, }?: {
|
225
227
|
initialMessages?: readonly CoreMessage[] | undefined;
|
226
228
|
}): void;
|
@@ -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
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
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
|
};
|
@@ -569,28 +619,121 @@ declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProvi
|
|
569
619
|
|
570
620
|
type AssistantActionsState = Readonly<{
|
571
621
|
switchToThread: (threadId: string | null) => void;
|
622
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
572
623
|
getRuntime: () => AssistantRuntime;
|
573
624
|
}>;
|
574
625
|
|
575
|
-
type AssistantModelConfigState = Readonly<ModelConfigProvider & {
|
576
|
-
registerModelConfigProvider: (provider: ModelConfigProvider) => () => void;
|
577
|
-
}>;
|
578
|
-
|
579
626
|
type AssistantToolUIsState = Readonly<{
|
580
627
|
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
581
628
|
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
582
629
|
}>;
|
583
630
|
|
584
631
|
type AssistantContextValue = {
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
632
|
+
useToolUIs: UseBoundStore<ReadonlyStore<AssistantToolUIsState>>;
|
633
|
+
useAssistantRuntime: UseBoundStore<ReadonlyStore<AssistantRuntime>>;
|
634
|
+
useAssistantActions: UseBoundStore<ReadonlyStore<AssistantActionsState>>;
|
635
|
+
};
|
636
|
+
declare const useAssistantContext: {
|
637
|
+
(options?: {
|
638
|
+
optional?: false | undefined;
|
639
|
+
} | undefined): AssistantContextValue;
|
640
|
+
(options?: {
|
641
|
+
optional?: boolean | undefined;
|
642
|
+
} | undefined): AssistantContextValue | null;
|
643
|
+
};
|
644
|
+
declare const useAssistantRuntime: {
|
645
|
+
(): AssistantRuntime;
|
646
|
+
<TSelected>(selector: (state: AssistantRuntime) => TSelected): TSelected;
|
647
|
+
(options: {
|
648
|
+
optional: true;
|
649
|
+
}): AssistantRuntime | null;
|
650
|
+
<TSelected>(options: {
|
651
|
+
optional: true;
|
652
|
+
selector?: (state: AssistantRuntime) => TSelected;
|
653
|
+
}): TSelected | null;
|
654
|
+
};
|
655
|
+
declare const useAssistantRuntimeStore: {
|
656
|
+
(): ReadonlyStore<AssistantRuntime>;
|
657
|
+
(options: {
|
658
|
+
optional: true;
|
659
|
+
}): ReadonlyStore<AssistantRuntime> | null;
|
660
|
+
};
|
661
|
+
declare const useToolUIs: {
|
662
|
+
(): Readonly<{
|
663
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
664
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
665
|
+
}>;
|
666
|
+
<TSelected>(selector: (state: Readonly<{
|
667
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
668
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
669
|
+
}>) => TSelected): TSelected;
|
670
|
+
(options: {
|
671
|
+
optional: true;
|
672
|
+
}): Readonly<{
|
673
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
674
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
675
|
+
}> | null;
|
676
|
+
<TSelected>(options: {
|
677
|
+
optional: true;
|
678
|
+
selector?: (state: Readonly<{
|
679
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
680
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
681
|
+
}>) => TSelected;
|
682
|
+
}): TSelected | null;
|
683
|
+
};
|
684
|
+
declare const useToolUIsStore: {
|
685
|
+
(): ReadonlyStore<Readonly<{
|
686
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
687
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
688
|
+
}>>;
|
689
|
+
(options: {
|
690
|
+
optional: true;
|
691
|
+
}): ReadonlyStore<Readonly<{
|
692
|
+
getToolUI: (toolName: string) => ToolCallContentPartComponent | null;
|
693
|
+
setToolUI: (toolName: string, render: ToolCallContentPartComponent) => () => void;
|
694
|
+
}>> | null;
|
695
|
+
};
|
696
|
+
declare const useAssistantActions: {
|
697
|
+
(): Readonly<{
|
698
|
+
switchToThread: (threadId: string | null) => void;
|
699
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
700
|
+
getRuntime: () => AssistantRuntime;
|
701
|
+
}>;
|
702
|
+
<TSelected>(selector: (state: Readonly<{
|
703
|
+
switchToThread: (threadId: string | null) => void;
|
704
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
705
|
+
getRuntime: () => AssistantRuntime;
|
706
|
+
}>) => TSelected): TSelected;
|
707
|
+
(options: {
|
708
|
+
optional: true;
|
709
|
+
}): Readonly<{
|
710
|
+
switchToThread: (threadId: string | null) => void;
|
711
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
712
|
+
getRuntime: () => AssistantRuntime;
|
713
|
+
}> | null;
|
714
|
+
<TSelected>(options: {
|
715
|
+
optional: true;
|
716
|
+
selector?: (state: Readonly<{
|
717
|
+
switchToThread: (threadId: string | null) => void;
|
718
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
719
|
+
getRuntime: () => AssistantRuntime;
|
720
|
+
}>) => TSelected;
|
721
|
+
}): TSelected | null;
|
722
|
+
};
|
723
|
+
declare const useAssistantActionsStore: {
|
724
|
+
(): ReadonlyStore<Readonly<{
|
725
|
+
switchToThread: (threadId: string | null) => void;
|
726
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
727
|
+
getRuntime: () => AssistantRuntime;
|
728
|
+
}>>;
|
729
|
+
(options: {
|
730
|
+
optional: true;
|
731
|
+
}): ReadonlyStore<Readonly<{
|
732
|
+
switchToThread: (threadId: string | null) => void;
|
733
|
+
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
734
|
+
getRuntime: () => AssistantRuntime;
|
735
|
+
}>> | null;
|
589
736
|
};
|
590
|
-
declare function useAssistantContext(): AssistantContextValue;
|
591
|
-
declare function useAssistantContext(options: {
|
592
|
-
optional: true;
|
593
|
-
}): AssistantContextValue | null;
|
594
737
|
|
595
738
|
type ThreadViewportState = Readonly<{
|
596
739
|
isAtBottom: boolean;
|
@@ -601,22 +744,340 @@ type ThreadViewportState = Readonly<{
|
|
601
744
|
type ThreadMessagesState = readonly ThreadMessage[];
|
602
745
|
|
603
746
|
type ThreadContextValue = {
|
604
|
-
useThread: ReadonlyStore<ThreadState
|
605
|
-
useThreadRuntime: ReadonlyStore<ThreadRuntimeStore
|
606
|
-
useThreadMessages: ReadonlyStore<ThreadMessagesState
|
607
|
-
useThreadActions: ReadonlyStore<ThreadActionsState
|
608
|
-
useComposer: ReadonlyStore<
|
609
|
-
useViewport: ReadonlyStore<ThreadViewportState
|
610
|
-
};
|
611
|
-
declare
|
612
|
-
|
613
|
-
|
614
|
-
}): ThreadContextValue
|
747
|
+
useThread: UseBoundStore<ReadonlyStore<ThreadState>>;
|
748
|
+
useThreadRuntime: UseBoundStore<ReadonlyStore<ThreadRuntimeStore>>;
|
749
|
+
useThreadMessages: UseBoundStore<ReadonlyStore<ThreadMessagesState>>;
|
750
|
+
useThreadActions: UseBoundStore<ReadonlyStore<ThreadActionsState>>;
|
751
|
+
useComposer: UseBoundStore<ReadonlyStore<ThreadComposerState>>;
|
752
|
+
useViewport: UseBoundStore<ReadonlyStore<ThreadViewportState>>;
|
753
|
+
};
|
754
|
+
declare const useThreadContext: {
|
755
|
+
(options?: {
|
756
|
+
optional?: false | undefined;
|
757
|
+
} | undefined): ThreadContextValue;
|
758
|
+
(options?: {
|
759
|
+
optional?: boolean | undefined;
|
760
|
+
} | undefined): ThreadContextValue | null;
|
761
|
+
};
|
762
|
+
declare const useThreadRuntime: {
|
763
|
+
(): ThreadRuntime;
|
764
|
+
<TSelected>(selector: (state: ThreadRuntime) => TSelected): TSelected;
|
765
|
+
(options: {
|
766
|
+
optional: true;
|
767
|
+
}): ThreadRuntime | null;
|
768
|
+
<TSelected>(options: {
|
769
|
+
optional: true;
|
770
|
+
selector?: (state: ThreadRuntime) => TSelected;
|
771
|
+
}): TSelected | null;
|
772
|
+
};
|
773
|
+
declare const useThreadRuntimeStore: {
|
774
|
+
(): ReadonlyStore<ThreadRuntime>;
|
775
|
+
(options: {
|
776
|
+
optional: true;
|
777
|
+
}): ReadonlyStore<ThreadRuntime> | null;
|
778
|
+
};
|
779
|
+
declare const useThread: {
|
780
|
+
(): Readonly<{
|
781
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
782
|
+
threadId: string;
|
783
|
+
isRunning: boolean;
|
784
|
+
isDisabled: boolean;
|
785
|
+
}>;
|
786
|
+
<TSelected>(selector: (state: Readonly<{
|
787
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
788
|
+
threadId: string;
|
789
|
+
isRunning: boolean;
|
790
|
+
isDisabled: boolean;
|
791
|
+
}>) => TSelected): TSelected;
|
792
|
+
(options: {
|
793
|
+
optional: true;
|
794
|
+
}): Readonly<{
|
795
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
796
|
+
threadId: string;
|
797
|
+
isRunning: boolean;
|
798
|
+
isDisabled: boolean;
|
799
|
+
}> | null;
|
800
|
+
<TSelected>(options: {
|
801
|
+
optional: true;
|
802
|
+
selector?: (state: Readonly<{
|
803
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
804
|
+
threadId: string;
|
805
|
+
isRunning: boolean;
|
806
|
+
isDisabled: boolean;
|
807
|
+
}>) => TSelected;
|
808
|
+
}): TSelected | null;
|
809
|
+
};
|
810
|
+
declare const useThreadStore: {
|
811
|
+
(): ReadonlyStore<Readonly<{
|
812
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
813
|
+
threadId: string;
|
814
|
+
isRunning: boolean;
|
815
|
+
isDisabled: boolean;
|
816
|
+
}>>;
|
817
|
+
(options: {
|
818
|
+
optional: true;
|
819
|
+
}): ReadonlyStore<Readonly<{
|
820
|
+
capabilities: Readonly<RuntimeCapabilities>;
|
821
|
+
threadId: string;
|
822
|
+
isRunning: boolean;
|
823
|
+
isDisabled: boolean;
|
824
|
+
}>> | null;
|
825
|
+
};
|
826
|
+
declare const useThreadMessages: {
|
827
|
+
(): ThreadMessagesState;
|
828
|
+
<TSelected>(selector: (state: ThreadMessagesState) => TSelected): TSelected;
|
829
|
+
(options: {
|
830
|
+
optional: true;
|
831
|
+
}): ThreadMessagesState | null;
|
832
|
+
<TSelected>(options: {
|
833
|
+
optional: true;
|
834
|
+
selector?: (state: ThreadMessagesState) => TSelected;
|
835
|
+
}): TSelected | null;
|
836
|
+
};
|
837
|
+
declare const useThreadMessagesStore: {
|
838
|
+
(): ReadonlyStore<ThreadMessagesState>;
|
839
|
+
(options: {
|
840
|
+
optional: true;
|
841
|
+
}): ReadonlyStore<ThreadMessagesState> | null;
|
842
|
+
};
|
843
|
+
declare const useThreadActions: {
|
844
|
+
(): Readonly<{
|
845
|
+
getBranches: (messageId: string) => readonly string[];
|
846
|
+
switchToBranch: (branchId: string) => void;
|
847
|
+
append: (message: AppendMessage) => void;
|
848
|
+
startRun: (parentId: string | null) => void;
|
849
|
+
cancelRun: () => void;
|
850
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
851
|
+
speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
|
852
|
+
}>;
|
853
|
+
<TSelected>(selector: (state: Readonly<{
|
854
|
+
getBranches: (messageId: string) => readonly string[];
|
855
|
+
switchToBranch: (branchId: string) => void;
|
856
|
+
append: (message: AppendMessage) => void;
|
857
|
+
startRun: (parentId: string | null) => void;
|
858
|
+
cancelRun: () => void;
|
859
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
860
|
+
speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
|
861
|
+
}>) => TSelected): TSelected;
|
862
|
+
(options: {
|
863
|
+
optional: true;
|
864
|
+
}): Readonly<{
|
865
|
+
getBranches: (messageId: string) => readonly string[];
|
866
|
+
switchToBranch: (branchId: string) => void;
|
867
|
+
append: (message: AppendMessage) => void;
|
868
|
+
startRun: (parentId: string | null) => void;
|
869
|
+
cancelRun: () => void;
|
870
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
871
|
+
speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
|
872
|
+
}> | null;
|
873
|
+
<TSelected>(options: {
|
874
|
+
optional: true;
|
875
|
+
selector?: (state: Readonly<{
|
876
|
+
getBranches: (messageId: string) => readonly string[];
|
877
|
+
switchToBranch: (branchId: string) => void;
|
878
|
+
append: (message: AppendMessage) => void;
|
879
|
+
startRun: (parentId: string | null) => void;
|
880
|
+
cancelRun: () => void;
|
881
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
882
|
+
speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
|
883
|
+
}>) => TSelected;
|
884
|
+
}): TSelected | null;
|
885
|
+
};
|
886
|
+
declare const useThreadActionsStore: {
|
887
|
+
(): ReadonlyStore<Readonly<{
|
888
|
+
getBranches: (messageId: string) => readonly string[];
|
889
|
+
switchToBranch: (branchId: string) => void;
|
890
|
+
append: (message: AppendMessage) => void;
|
891
|
+
startRun: (parentId: string | null) => void;
|
892
|
+
cancelRun: () => void;
|
893
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
894
|
+
speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
|
895
|
+
}>>;
|
896
|
+
(options: {
|
897
|
+
optional: true;
|
898
|
+
}): ReadonlyStore<Readonly<{
|
899
|
+
getBranches: (messageId: string) => readonly string[];
|
900
|
+
switchToBranch: (branchId: string) => void;
|
901
|
+
append: (message: AppendMessage) => void;
|
902
|
+
startRun: (parentId: string | null) => void;
|
903
|
+
cancelRun: () => void;
|
904
|
+
addToolResult: (options: AddToolResultOptions) => void;
|
905
|
+
speak: (messageId: string) => SpeechSynthesisAdapter.Utterance;
|
906
|
+
}>> | null;
|
907
|
+
};
|
908
|
+
declare const useThreadComposer: {
|
909
|
+
(): Readonly<{
|
910
|
+
type: "thread";
|
911
|
+
value: string;
|
912
|
+
setValue: (value: string) => void;
|
913
|
+
attachments: readonly ThreadComposerAttachment[];
|
914
|
+
addAttachment: (file: File) => void;
|
915
|
+
removeAttachment: (attachmentId: string) => void;
|
916
|
+
text: string;
|
917
|
+
setText: (value: string) => void;
|
918
|
+
reset: () => void;
|
919
|
+
canCancel: boolean;
|
920
|
+
isEditing: true;
|
921
|
+
isEmpty: boolean;
|
922
|
+
send: () => void;
|
923
|
+
cancel: () => void;
|
924
|
+
focus: () => void;
|
925
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
926
|
+
}>;
|
927
|
+
<TSelected>(selector: (state: Readonly<{
|
928
|
+
type: "thread";
|
929
|
+
value: string;
|
930
|
+
setValue: (value: string) => void;
|
931
|
+
attachments: readonly ThreadComposerAttachment[];
|
932
|
+
addAttachment: (file: File) => void;
|
933
|
+
removeAttachment: (attachmentId: string) => void;
|
934
|
+
text: string;
|
935
|
+
setText: (value: string) => void;
|
936
|
+
reset: () => void;
|
937
|
+
canCancel: boolean;
|
938
|
+
isEditing: true;
|
939
|
+
isEmpty: boolean;
|
940
|
+
send: () => void;
|
941
|
+
cancel: () => void;
|
942
|
+
focus: () => void;
|
943
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
944
|
+
}>) => TSelected): TSelected;
|
945
|
+
(options: {
|
946
|
+
optional: true;
|
947
|
+
}): Readonly<{
|
948
|
+
type: "thread";
|
949
|
+
value: string;
|
950
|
+
setValue: (value: string) => void;
|
951
|
+
attachments: readonly ThreadComposerAttachment[];
|
952
|
+
addAttachment: (file: File) => void;
|
953
|
+
removeAttachment: (attachmentId: string) => void;
|
954
|
+
text: string;
|
955
|
+
setText: (value: string) => void;
|
956
|
+
reset: () => void;
|
957
|
+
canCancel: boolean;
|
958
|
+
isEditing: true;
|
959
|
+
isEmpty: boolean;
|
960
|
+
send: () => void;
|
961
|
+
cancel: () => void;
|
962
|
+
focus: () => void;
|
963
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
964
|
+
}> | null;
|
965
|
+
<TSelected>(options: {
|
966
|
+
optional: true;
|
967
|
+
selector?: (state: Readonly<{
|
968
|
+
type: "thread";
|
969
|
+
value: string;
|
970
|
+
setValue: (value: string) => void;
|
971
|
+
attachments: readonly ThreadComposerAttachment[];
|
972
|
+
addAttachment: (file: File) => void;
|
973
|
+
removeAttachment: (attachmentId: string) => void;
|
974
|
+
text: string;
|
975
|
+
setText: (value: string) => void;
|
976
|
+
reset: () => void;
|
977
|
+
canCancel: boolean;
|
978
|
+
isEditing: true;
|
979
|
+
isEmpty: boolean;
|
980
|
+
send: () => void;
|
981
|
+
cancel: () => void;
|
982
|
+
focus: () => void;
|
983
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
984
|
+
}>) => TSelected;
|
985
|
+
}): TSelected | null;
|
986
|
+
};
|
987
|
+
declare const useThreadComposerStore: {
|
988
|
+
(): ReadonlyStore<Readonly<{
|
989
|
+
type: "thread";
|
990
|
+
value: string;
|
991
|
+
setValue: (value: string) => void;
|
992
|
+
attachments: readonly ThreadComposerAttachment[];
|
993
|
+
addAttachment: (file: File) => void;
|
994
|
+
removeAttachment: (attachmentId: string) => void;
|
995
|
+
text: string;
|
996
|
+
setText: (value: string) => void;
|
997
|
+
reset: () => void;
|
998
|
+
canCancel: boolean;
|
999
|
+
isEditing: true;
|
1000
|
+
isEmpty: boolean;
|
1001
|
+
send: () => void;
|
1002
|
+
cancel: () => void;
|
1003
|
+
focus: () => void;
|
1004
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
1005
|
+
}>>;
|
1006
|
+
(options: {
|
1007
|
+
optional: true;
|
1008
|
+
}): ReadonlyStore<Readonly<{
|
1009
|
+
type: "thread";
|
1010
|
+
value: string;
|
1011
|
+
setValue: (value: string) => void;
|
1012
|
+
attachments: readonly ThreadComposerAttachment[];
|
1013
|
+
addAttachment: (file: File) => void;
|
1014
|
+
removeAttachment: (attachmentId: string) => void;
|
1015
|
+
text: string;
|
1016
|
+
setText: (value: string) => void;
|
1017
|
+
reset: () => void;
|
1018
|
+
canCancel: boolean;
|
1019
|
+
isEditing: true;
|
1020
|
+
isEmpty: boolean;
|
1021
|
+
send: () => void;
|
1022
|
+
cancel: () => void;
|
1023
|
+
focus: () => void;
|
1024
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
1025
|
+
}>> | null;
|
1026
|
+
};
|
1027
|
+
declare const useThreadViewport: {
|
1028
|
+
(): Readonly<{
|
1029
|
+
isAtBottom: boolean;
|
1030
|
+
scrollToBottom: () => void;
|
1031
|
+
onScrollToBottom: (callback: () => void) => Unsubscribe;
|
1032
|
+
}>;
|
1033
|
+
<TSelected>(selector: (state: Readonly<{
|
1034
|
+
isAtBottom: boolean;
|
1035
|
+
scrollToBottom: () => void;
|
1036
|
+
onScrollToBottom: (callback: () => void) => Unsubscribe;
|
1037
|
+
}>) => TSelected): TSelected;
|
1038
|
+
(options: {
|
1039
|
+
optional: true;
|
1040
|
+
}): Readonly<{
|
1041
|
+
isAtBottom: boolean;
|
1042
|
+
scrollToBottom: () => void;
|
1043
|
+
onScrollToBottom: (callback: () => void) => Unsubscribe;
|
1044
|
+
}> | null;
|
1045
|
+
<TSelected>(options: {
|
1046
|
+
optional: true;
|
1047
|
+
selector?: (state: Readonly<{
|
1048
|
+
isAtBottom: boolean;
|
1049
|
+
scrollToBottom: () => void;
|
1050
|
+
onScrollToBottom: (callback: () => void) => Unsubscribe;
|
1051
|
+
}>) => TSelected;
|
1052
|
+
}): TSelected | null;
|
1053
|
+
};
|
1054
|
+
declare const useThreadViewportStore: {
|
1055
|
+
(): ReadonlyStore<Readonly<{
|
1056
|
+
isAtBottom: boolean;
|
1057
|
+
scrollToBottom: () => void;
|
1058
|
+
onScrollToBottom: (callback: () => void) => Unsubscribe;
|
1059
|
+
}>>;
|
1060
|
+
(options: {
|
1061
|
+
optional: true;
|
1062
|
+
}): ReadonlyStore<Readonly<{
|
1063
|
+
isAtBottom: boolean;
|
1064
|
+
scrollToBottom: () => void;
|
1065
|
+
onScrollToBottom: (callback: () => void) => Unsubscribe;
|
1066
|
+
}>> | null;
|
1067
|
+
};
|
1068
|
+
|
1069
|
+
type MessageState = Readonly<{
|
1070
|
+
message: Readonly<ThreadMessage>;
|
1071
|
+
parentId: string | null;
|
1072
|
+
branches: readonly string[];
|
1073
|
+
isLast: boolean;
|
1074
|
+
}>;
|
615
1075
|
|
616
1076
|
type EditComposerState = Readonly<{
|
617
|
-
|
1077
|
+
type: "edit";
|
1078
|
+
/** @deprecated Use `text` instead. This will be removed in 0.6.0. */
|
618
1079
|
value: string;
|
619
|
-
/** @deprecated Use `setText` instead. */
|
1080
|
+
/** @deprecated Use `setText` instead. This will be removed in 0.6.0. */
|
620
1081
|
setValue: (value: string) => void;
|
621
1082
|
text: string;
|
622
1083
|
setText: (value: string) => void;
|
@@ -628,19 +1089,6 @@ type EditComposerState = Readonly<{
|
|
628
1089
|
cancel: () => void;
|
629
1090
|
}>;
|
630
1091
|
|
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
1092
|
type MessageUtilsState = Readonly<{
|
645
1093
|
isCopied: boolean;
|
646
1094
|
setIsCopied: (value: boolean) => void;
|
@@ -652,24 +1100,466 @@ type MessageUtilsState = Readonly<{
|
|
652
1100
|
}>;
|
653
1101
|
|
654
1102
|
type MessageContextValue = {
|
655
|
-
useMessage: ReadonlyStore<MessageState
|
656
|
-
useMessageUtils: ReadonlyStore<MessageUtilsState
|
657
|
-
useEditComposer: ReadonlyStore<EditComposerState
|
1103
|
+
useMessage: UseBoundStore<ReadonlyStore<MessageState>>;
|
1104
|
+
useMessageUtils: UseBoundStore<ReadonlyStore<MessageUtilsState>>;
|
1105
|
+
useEditComposer: UseBoundStore<ReadonlyStore<EditComposerState>>;
|
1106
|
+
};
|
1107
|
+
declare const useMessageContext: {
|
1108
|
+
(options?: {
|
1109
|
+
optional?: false | undefined;
|
1110
|
+
} | undefined): MessageContextValue;
|
1111
|
+
(options?: {
|
1112
|
+
optional?: boolean | undefined;
|
1113
|
+
} | undefined): MessageContextValue | null;
|
1114
|
+
};
|
1115
|
+
declare const useMessage: {
|
1116
|
+
(): Readonly<{
|
1117
|
+
message: Readonly<ThreadMessage>;
|
1118
|
+
parentId: string | null;
|
1119
|
+
branches: readonly string[];
|
1120
|
+
isLast: boolean;
|
1121
|
+
}>;
|
1122
|
+
<TSelected>(selector: (state: Readonly<{
|
1123
|
+
message: Readonly<ThreadMessage>;
|
1124
|
+
parentId: string | null;
|
1125
|
+
branches: readonly string[];
|
1126
|
+
isLast: boolean;
|
1127
|
+
}>) => TSelected): TSelected;
|
1128
|
+
(options: {
|
1129
|
+
optional: true;
|
1130
|
+
}): Readonly<{
|
1131
|
+
message: Readonly<ThreadMessage>;
|
1132
|
+
parentId: string | null;
|
1133
|
+
branches: readonly string[];
|
1134
|
+
isLast: boolean;
|
1135
|
+
}> | null;
|
1136
|
+
<TSelected>(options: {
|
1137
|
+
optional: true;
|
1138
|
+
selector?: (state: Readonly<{
|
1139
|
+
message: Readonly<ThreadMessage>;
|
1140
|
+
parentId: string | null;
|
1141
|
+
branches: readonly string[];
|
1142
|
+
isLast: boolean;
|
1143
|
+
}>) => TSelected;
|
1144
|
+
}): TSelected | null;
|
1145
|
+
};
|
1146
|
+
declare const useMessageStore: {
|
1147
|
+
(): ReadonlyStore<Readonly<{
|
1148
|
+
message: Readonly<ThreadMessage>;
|
1149
|
+
parentId: string | null;
|
1150
|
+
branches: readonly string[];
|
1151
|
+
isLast: boolean;
|
1152
|
+
}>>;
|
1153
|
+
(options: {
|
1154
|
+
optional: true;
|
1155
|
+
}): ReadonlyStore<Readonly<{
|
1156
|
+
message: Readonly<ThreadMessage>;
|
1157
|
+
parentId: string | null;
|
1158
|
+
branches: readonly string[];
|
1159
|
+
isLast: boolean;
|
1160
|
+
}>> | null;
|
1161
|
+
};
|
1162
|
+
declare const useMessageUtils: {
|
1163
|
+
(): Readonly<{
|
1164
|
+
isCopied: boolean;
|
1165
|
+
setIsCopied: (value: boolean) => void;
|
1166
|
+
isHovering: boolean;
|
1167
|
+
setIsHovering: (value: boolean) => void;
|
1168
|
+
isSpeaking: boolean;
|
1169
|
+
stopSpeaking: () => void;
|
1170
|
+
addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
|
1171
|
+
}>;
|
1172
|
+
<TSelected>(selector: (state: 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
|
+
}>) => TSelected): TSelected;
|
1181
|
+
(options: {
|
1182
|
+
optional: true;
|
1183
|
+
}): Readonly<{
|
1184
|
+
isCopied: boolean;
|
1185
|
+
setIsCopied: (value: boolean) => void;
|
1186
|
+
isHovering: boolean;
|
1187
|
+
setIsHovering: (value: boolean) => void;
|
1188
|
+
isSpeaking: boolean;
|
1189
|
+
stopSpeaking: () => void;
|
1190
|
+
addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
|
1191
|
+
}> | null;
|
1192
|
+
<TSelected>(options: {
|
1193
|
+
optional: true;
|
1194
|
+
selector?: (state: Readonly<{
|
1195
|
+
isCopied: boolean;
|
1196
|
+
setIsCopied: (value: boolean) => void;
|
1197
|
+
isHovering: boolean;
|
1198
|
+
setIsHovering: (value: boolean) => void;
|
1199
|
+
isSpeaking: boolean;
|
1200
|
+
stopSpeaking: () => void;
|
1201
|
+
addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
|
1202
|
+
}>) => TSelected;
|
1203
|
+
}): TSelected | null;
|
1204
|
+
};
|
1205
|
+
declare const useMessageUtilsStore: {
|
1206
|
+
(): ReadonlyStore<Readonly<{
|
1207
|
+
isCopied: boolean;
|
1208
|
+
setIsCopied: (value: boolean) => void;
|
1209
|
+
isHovering: boolean;
|
1210
|
+
setIsHovering: (value: boolean) => void;
|
1211
|
+
isSpeaking: boolean;
|
1212
|
+
stopSpeaking: () => void;
|
1213
|
+
addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
|
1214
|
+
}>>;
|
1215
|
+
(options: {
|
1216
|
+
optional: true;
|
1217
|
+
}): ReadonlyStore<Readonly<{
|
1218
|
+
isCopied: boolean;
|
1219
|
+
setIsCopied: (value: boolean) => void;
|
1220
|
+
isHovering: boolean;
|
1221
|
+
setIsHovering: (value: boolean) => void;
|
1222
|
+
isSpeaking: boolean;
|
1223
|
+
stopSpeaking: () => void;
|
1224
|
+
addUtterance: (utterance: SpeechSynthesisAdapter.Utterance) => void;
|
1225
|
+
}>> | null;
|
1226
|
+
};
|
1227
|
+
declare const useEditComposer: {
|
1228
|
+
(): Readonly<{
|
1229
|
+
type: "edit";
|
1230
|
+
value: string;
|
1231
|
+
setValue: (value: string) => void;
|
1232
|
+
text: string;
|
1233
|
+
setText: (value: string) => void;
|
1234
|
+
canCancel: boolean;
|
1235
|
+
isEditing: boolean;
|
1236
|
+
isEmpty: boolean;
|
1237
|
+
edit: () => void;
|
1238
|
+
send: () => void;
|
1239
|
+
cancel: () => void;
|
1240
|
+
}>;
|
1241
|
+
<TSelected>(selector: (state: Readonly<{
|
1242
|
+
type: "edit";
|
1243
|
+
value: string;
|
1244
|
+
setValue: (value: string) => void;
|
1245
|
+
text: string;
|
1246
|
+
setText: (value: string) => void;
|
1247
|
+
canCancel: boolean;
|
1248
|
+
isEditing: boolean;
|
1249
|
+
isEmpty: boolean;
|
1250
|
+
edit: () => void;
|
1251
|
+
send: () => void;
|
1252
|
+
cancel: () => void;
|
1253
|
+
}>) => TSelected): TSelected;
|
1254
|
+
(options: {
|
1255
|
+
optional: true;
|
1256
|
+
}): Readonly<{
|
1257
|
+
type: "edit";
|
1258
|
+
value: string;
|
1259
|
+
setValue: (value: string) => void;
|
1260
|
+
text: string;
|
1261
|
+
setText: (value: string) => void;
|
1262
|
+
canCancel: boolean;
|
1263
|
+
isEditing: boolean;
|
1264
|
+
isEmpty: boolean;
|
1265
|
+
edit: () => void;
|
1266
|
+
send: () => void;
|
1267
|
+
cancel: () => void;
|
1268
|
+
}> | null;
|
1269
|
+
<TSelected>(options: {
|
1270
|
+
optional: true;
|
1271
|
+
selector?: (state: Readonly<{
|
1272
|
+
type: "edit";
|
1273
|
+
value: string;
|
1274
|
+
setValue: (value: string) => void;
|
1275
|
+
text: string;
|
1276
|
+
setText: (value: string) => void;
|
1277
|
+
canCancel: boolean;
|
1278
|
+
isEditing: boolean;
|
1279
|
+
isEmpty: boolean;
|
1280
|
+
edit: () => void;
|
1281
|
+
send: () => void;
|
1282
|
+
cancel: () => void;
|
1283
|
+
}>) => TSelected;
|
1284
|
+
}): TSelected | null;
|
1285
|
+
};
|
1286
|
+
declare const useEditComposerStore: {
|
1287
|
+
(): ReadonlyStore<Readonly<{
|
1288
|
+
type: "edit";
|
1289
|
+
value: string;
|
1290
|
+
setValue: (value: string) => void;
|
1291
|
+
text: string;
|
1292
|
+
setText: (value: string) => void;
|
1293
|
+
canCancel: boolean;
|
1294
|
+
isEditing: boolean;
|
1295
|
+
isEmpty: boolean;
|
1296
|
+
edit: () => void;
|
1297
|
+
send: () => void;
|
1298
|
+
cancel: () => void;
|
1299
|
+
}>>;
|
1300
|
+
(options: {
|
1301
|
+
optional: true;
|
1302
|
+
}): ReadonlyStore<Readonly<{
|
1303
|
+
type: "edit";
|
1304
|
+
value: string;
|
1305
|
+
setValue: (value: string) => void;
|
1306
|
+
text: string;
|
1307
|
+
setText: (value: string) => void;
|
1308
|
+
canCancel: boolean;
|
1309
|
+
isEditing: boolean;
|
1310
|
+
isEmpty: boolean;
|
1311
|
+
edit: () => void;
|
1312
|
+
send: () => void;
|
1313
|
+
cancel: () => void;
|
1314
|
+
}>> | null;
|
658
1315
|
};
|
659
|
-
declare function useMessageContext(): MessageContextValue;
|
660
|
-
declare function useMessageContext(options: {
|
661
|
-
optional: true;
|
662
|
-
}): MessageContextValue | null;
|
663
1316
|
|
664
1317
|
type ContentPartContextValue = {
|
665
|
-
useContentPart: ReadonlyStore<ContentPartState
|
1318
|
+
useContentPart: UseBoundStore<ReadonlyStore<ContentPartState>>;
|
1319
|
+
};
|
1320
|
+
declare const useContentPartContext: {
|
1321
|
+
(options?: {
|
1322
|
+
optional?: false | undefined;
|
1323
|
+
} | undefined): ContentPartContextValue;
|
1324
|
+
(options?: {
|
1325
|
+
optional?: boolean | undefined;
|
1326
|
+
} | undefined): ContentPartContextValue | null;
|
1327
|
+
};
|
1328
|
+
declare const useContentPart: {
|
1329
|
+
(): Readonly<{
|
1330
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1331
|
+
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1332
|
+
}>;
|
1333
|
+
<TSelected>(selector: (state: Readonly<{
|
1334
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1335
|
+
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1336
|
+
}>) => TSelected): TSelected;
|
1337
|
+
(options: {
|
1338
|
+
optional: true;
|
1339
|
+
}): Readonly<{
|
1340
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1341
|
+
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1342
|
+
}> | null;
|
1343
|
+
<TSelected>(options: {
|
1344
|
+
optional: true;
|
1345
|
+
selector?: (state: Readonly<{
|
1346
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1347
|
+
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1348
|
+
}>) => TSelected;
|
1349
|
+
}): TSelected | null;
|
1350
|
+
};
|
1351
|
+
declare const useContentPartStore: {
|
1352
|
+
(): ReadonlyStore<Readonly<{
|
1353
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1354
|
+
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1355
|
+
}>>;
|
1356
|
+
(options: {
|
1357
|
+
optional: true;
|
1358
|
+
}): ReadonlyStore<Readonly<{
|
1359
|
+
status: ContentPartStatus | ToolCallContentPartStatus;
|
1360
|
+
part: TextContentPart | ImageContentPart | UIContentPart | ToolCallContentPart;
|
1361
|
+
}>> | null;
|
1362
|
+
};
|
1363
|
+
|
1364
|
+
type ComposerContextValue = {
|
1365
|
+
useComposer: ReadonlyStore<EditComposerState | ThreadComposerState>;
|
1366
|
+
type: "edit" | "new";
|
1367
|
+
};
|
1368
|
+
declare const useComposerContext: () => ComposerContextValue;
|
1369
|
+
declare const useComposer: {
|
1370
|
+
(): Readonly<{
|
1371
|
+
type: "edit";
|
1372
|
+
value: string;
|
1373
|
+
setValue: (value: string) => void;
|
1374
|
+
text: string;
|
1375
|
+
setText: (value: string) => void;
|
1376
|
+
canCancel: boolean;
|
1377
|
+
isEditing: boolean;
|
1378
|
+
isEmpty: boolean;
|
1379
|
+
edit: () => void;
|
1380
|
+
send: () => void;
|
1381
|
+
cancel: () => void;
|
1382
|
+
}> | Readonly<{
|
1383
|
+
type: "thread";
|
1384
|
+
value: string;
|
1385
|
+
setValue: (value: string) => void;
|
1386
|
+
attachments: readonly ThreadComposerAttachment[];
|
1387
|
+
addAttachment: (file: File) => void;
|
1388
|
+
removeAttachment: (attachmentId: string) => void;
|
1389
|
+
text: string;
|
1390
|
+
setText: (value: string) => void;
|
1391
|
+
reset: () => void;
|
1392
|
+
canCancel: boolean;
|
1393
|
+
isEditing: true;
|
1394
|
+
isEmpty: boolean;
|
1395
|
+
send: () => void;
|
1396
|
+
cancel: () => void;
|
1397
|
+
focus: () => void;
|
1398
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
1399
|
+
}>;
|
1400
|
+
<TSelected>(selector: (state: Readonly<{
|
1401
|
+
type: "edit";
|
1402
|
+
value: string;
|
1403
|
+
setValue: (value: string) => void;
|
1404
|
+
text: string;
|
1405
|
+
setText: (value: string) => void;
|
1406
|
+
canCancel: boolean;
|
1407
|
+
isEditing: boolean;
|
1408
|
+
isEmpty: boolean;
|
1409
|
+
edit: () => void;
|
1410
|
+
send: () => void;
|
1411
|
+
cancel: () => void;
|
1412
|
+
}> | Readonly<{
|
1413
|
+
type: "thread";
|
1414
|
+
value: string;
|
1415
|
+
setValue: (value: string) => void;
|
1416
|
+
attachments: readonly ThreadComposerAttachment[];
|
1417
|
+
addAttachment: (file: File) => void;
|
1418
|
+
removeAttachment: (attachmentId: string) => void;
|
1419
|
+
text: string;
|
1420
|
+
setText: (value: string) => void;
|
1421
|
+
reset: () => void;
|
1422
|
+
canCancel: boolean;
|
1423
|
+
isEditing: true;
|
1424
|
+
isEmpty: boolean;
|
1425
|
+
send: () => void;
|
1426
|
+
cancel: () => void;
|
1427
|
+
focus: () => void;
|
1428
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
1429
|
+
}>) => TSelected): TSelected;
|
1430
|
+
(options: {
|
1431
|
+
optional: true;
|
1432
|
+
}): Readonly<{
|
1433
|
+
type: "edit";
|
1434
|
+
value: string;
|
1435
|
+
setValue: (value: string) => void;
|
1436
|
+
text: string;
|
1437
|
+
setText: (value: string) => void;
|
1438
|
+
canCancel: boolean;
|
1439
|
+
isEditing: boolean;
|
1440
|
+
isEmpty: boolean;
|
1441
|
+
edit: () => void;
|
1442
|
+
send: () => void;
|
1443
|
+
cancel: () => void;
|
1444
|
+
}> | Readonly<{
|
1445
|
+
type: "thread";
|
1446
|
+
value: string;
|
1447
|
+
setValue: (value: string) => void;
|
1448
|
+
attachments: readonly ThreadComposerAttachment[];
|
1449
|
+
addAttachment: (file: File) => void;
|
1450
|
+
removeAttachment: (attachmentId: string) => void;
|
1451
|
+
text: string;
|
1452
|
+
setText: (value: string) => void;
|
1453
|
+
reset: () => void;
|
1454
|
+
canCancel: boolean;
|
1455
|
+
isEditing: true;
|
1456
|
+
isEmpty: boolean;
|
1457
|
+
send: () => void;
|
1458
|
+
cancel: () => void;
|
1459
|
+
focus: () => void;
|
1460
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
1461
|
+
}> | null;
|
1462
|
+
<TSelected>(options: {
|
1463
|
+
optional: true;
|
1464
|
+
selector?: (state: Readonly<{
|
1465
|
+
type: "edit";
|
1466
|
+
value: string;
|
1467
|
+
setValue: (value: string) => void;
|
1468
|
+
text: string;
|
1469
|
+
setText: (value: string) => void;
|
1470
|
+
canCancel: boolean;
|
1471
|
+
isEditing: boolean;
|
1472
|
+
isEmpty: boolean;
|
1473
|
+
edit: () => void;
|
1474
|
+
send: () => void;
|
1475
|
+
cancel: () => void;
|
1476
|
+
}> | Readonly<{
|
1477
|
+
type: "thread";
|
1478
|
+
value: string;
|
1479
|
+
setValue: (value: string) => void;
|
1480
|
+
attachments: readonly ThreadComposerAttachment[];
|
1481
|
+
addAttachment: (file: File) => void;
|
1482
|
+
removeAttachment: (attachmentId: string) => void;
|
1483
|
+
text: string;
|
1484
|
+
setText: (value: string) => void;
|
1485
|
+
reset: () => void;
|
1486
|
+
canCancel: boolean;
|
1487
|
+
isEditing: true;
|
1488
|
+
isEmpty: boolean;
|
1489
|
+
send: () => void;
|
1490
|
+
cancel: () => void;
|
1491
|
+
focus: () => void;
|
1492
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
1493
|
+
}>) => TSelected;
|
1494
|
+
}): TSelected | null;
|
1495
|
+
};
|
1496
|
+
declare const useComposerStore: {
|
1497
|
+
(): ReadonlyStore<Readonly<{
|
1498
|
+
type: "edit";
|
1499
|
+
value: string;
|
1500
|
+
setValue: (value: string) => void;
|
1501
|
+
text: string;
|
1502
|
+
setText: (value: string) => void;
|
1503
|
+
canCancel: boolean;
|
1504
|
+
isEditing: boolean;
|
1505
|
+
isEmpty: boolean;
|
1506
|
+
edit: () => void;
|
1507
|
+
send: () => void;
|
1508
|
+
cancel: () => void;
|
1509
|
+
}> | Readonly<{
|
1510
|
+
type: "thread";
|
1511
|
+
value: string;
|
1512
|
+
setValue: (value: string) => void;
|
1513
|
+
attachments: readonly ThreadComposerAttachment[];
|
1514
|
+
addAttachment: (file: File) => void;
|
1515
|
+
removeAttachment: (attachmentId: string) => void;
|
1516
|
+
text: string;
|
1517
|
+
setText: (value: string) => void;
|
1518
|
+
reset: () => void;
|
1519
|
+
canCancel: boolean;
|
1520
|
+
isEditing: true;
|
1521
|
+
isEmpty: boolean;
|
1522
|
+
send: () => void;
|
1523
|
+
cancel: () => void;
|
1524
|
+
focus: () => void;
|
1525
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
1526
|
+
}>>;
|
1527
|
+
(options: {
|
1528
|
+
optional: true;
|
1529
|
+
}): ReadonlyStore<Readonly<{
|
1530
|
+
type: "edit";
|
1531
|
+
value: string;
|
1532
|
+
setValue: (value: string) => void;
|
1533
|
+
text: string;
|
1534
|
+
setText: (value: string) => void;
|
1535
|
+
canCancel: boolean;
|
1536
|
+
isEditing: boolean;
|
1537
|
+
isEmpty: boolean;
|
1538
|
+
edit: () => void;
|
1539
|
+
send: () => void;
|
1540
|
+
cancel: () => void;
|
1541
|
+
}> | Readonly<{
|
1542
|
+
type: "thread";
|
1543
|
+
value: string;
|
1544
|
+
setValue: (value: string) => void;
|
1545
|
+
attachments: readonly ThreadComposerAttachment[];
|
1546
|
+
addAttachment: (file: File) => void;
|
1547
|
+
removeAttachment: (attachmentId: string) => void;
|
1548
|
+
text: string;
|
1549
|
+
setText: (value: string) => void;
|
1550
|
+
reset: () => void;
|
1551
|
+
canCancel: boolean;
|
1552
|
+
isEditing: true;
|
1553
|
+
isEmpty: boolean;
|
1554
|
+
send: () => void;
|
1555
|
+
cancel: () => void;
|
1556
|
+
focus: () => void;
|
1557
|
+
onFocus: (listener: () => void) => Unsubscribe;
|
1558
|
+
}>> | null;
|
666
1559
|
};
|
667
|
-
declare function useContentPartContext(): ContentPartContextValue;
|
668
|
-
declare function useContentPartContext(options: {
|
669
|
-
optional: true;
|
670
|
-
}): ContentPartContextValue | null;
|
671
1560
|
|
672
|
-
type
|
1561
|
+
type ThreadComposerState = Readonly<{
|
1562
|
+
type: "thread";
|
673
1563
|
/** @deprecated Use `text` instead. */
|
674
1564
|
value: string;
|
675
1565
|
/** @deprecated Use `setText` instead. */
|
@@ -896,10 +1786,10 @@ declare const BranchPickerPrevious: react.ForwardRefExoticComponent<Omit<Omit<re
|
|
896
1786
|
asChild?: boolean;
|
897
1787
|
}, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
898
1788
|
|
899
|
-
type BranchPickerPrimitiveCountProps =
|
1789
|
+
type BranchPickerPrimitiveCountProps = Record<string, never>;
|
900
1790
|
declare const BranchPickerPrimitiveCount: FC<BranchPickerPrimitiveCountProps>;
|
901
1791
|
|
902
|
-
type BranchPickerPrimitiveNumberProps =
|
1792
|
+
type BranchPickerPrimitiveNumberProps = Record<string, never>;
|
903
1793
|
declare const BranchPickerPrimitiveNumber: FC<BranchPickerPrimitiveNumberProps>;
|
904
1794
|
|
905
1795
|
type PrimitiveDivProps$3 = ComponentPropsWithoutRef<typeof Primitive.div>;
|
@@ -992,8 +1882,8 @@ declare const ContentPartPrimitiveImage: react.ForwardRefExoticComponent<Omit<Om
|
|
992
1882
|
asChild?: boolean;
|
993
1883
|
}, "ref"> & react.RefAttributes<HTMLImageElement>>;
|
994
1884
|
|
995
|
-
type ContentPartPrimitiveDisplayProps =
|
996
|
-
declare const ContentPartPrimitiveDisplay: FC
|
1885
|
+
type ContentPartPrimitiveDisplayProps = Record<string, never>;
|
1886
|
+
declare const ContentPartPrimitiveDisplay: FC;
|
997
1887
|
|
998
1888
|
type ContentPartPrimitiveInProgressProps = PropsWithChildren;
|
999
1889
|
declare const ContentPartPrimitiveInProgress: FC<ContentPartPrimitiveInProgressProps>;
|
@@ -1030,7 +1920,7 @@ declare const MessagePrimitiveContent: FC<MessagePrimitiveContentProps>;
|
|
1030
1920
|
type PrimitiveSpanProps = ComponentPropsWithoutRef<typeof Primitive.span>;
|
1031
1921
|
type MessagePrimitiveInProgressProps = PrimitiveSpanProps;
|
1032
1922
|
/**
|
1033
|
-
* @deprecated Define a custom Text renderer via ContentPartPrimitiveInProgress instead.
|
1923
|
+
* @deprecated Define a custom Text renderer via ContentPartPrimitiveInProgress instead. This will be removed in 0.6.
|
1034
1924
|
*/
|
1035
1925
|
declare const MessagePrimitiveInProgress: FC<MessagePrimitiveInProgressProps>;
|
1036
1926
|
|
@@ -1434,4 +2324,4 @@ declare const exports: {
|
|
1434
2324
|
Text: FC;
|
1435
2325
|
};
|
1436
2326
|
|
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
|
2327
|
+
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 };
|