@superinterface/react 5.0.0-beta.2 → 5.0.0

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.cts CHANGED
@@ -3,11 +3,11 @@ import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseC
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
5
5
  import * as react_hook_form from 'react-hook-form';
6
+ import * as openai_resources_files from 'openai/resources/files';
6
7
  import * as openai_resources_beta_threads_messages from 'openai/resources/beta/threads/messages';
7
8
  import * as _tanstack_query_core from '@tanstack/query-core';
8
9
  import * as react from 'react';
9
10
  import { Dispatch, SetStateAction } from 'react';
10
- import * as openai_resources_files from 'openai/resources/files';
11
11
  import * as unified from 'unified';
12
12
  import OpenAI from 'openai';
13
13
  import remarkGfm from 'remark-gfm';
@@ -57,7 +57,7 @@ declare const Thread: {
57
57
  Message: ({ message, className, style }: {
58
58
  message: SerializedMessage;
59
59
  } & StyleProps) => react_jsx_runtime.JSX.Element;
60
- NextPageSkeleton: () => react_jsx_runtime.JSX.Element | null;
60
+ NextPageSkeleton: () => react_jsx_runtime.JSX.Element;
61
61
  Content: () => react_jsx_runtime.JSX.Element;
62
62
  };
63
63
  MessageForm: {
@@ -68,8 +68,9 @@ declare const Thread: {
68
68
  content: string;
69
69
  attachments?: openai_resources_beta_threads_messages.Message.Attachment[];
70
70
  } & {
71
- reset: any;
72
- createMessage: any;
71
+ reset: () => void;
72
+ createMessage: ReturnType<typeof useCreateMessage>["createMessage"];
73
+ files: openai_resources_files.FileObject[];
73
74
  }>;
74
75
  isDisabled?: boolean;
75
76
  } & StyleProps) => react_jsx_runtime.JSX.Element;
@@ -88,7 +89,7 @@ declare const Thread: {
88
89
  }) => react_jsx_runtime.JSX.Element;
89
90
  };
90
91
  Files: {
91
- Preview: (props: StyleProps) => react_jsx_runtime.JSX.Element | null;
92
+ Preview: (props: StyleProps) => react_jsx_runtime.JSX.Element;
92
93
  Control: (props: StyleProps) => react_jsx_runtime.JSX.Element;
93
94
  };
94
95
  };
@@ -125,7 +126,7 @@ declare const useMessages: () => {
125
126
  dataUpdatedAt: number;
126
127
  errorUpdatedAt: number;
127
128
  failureCount: number;
128
- failureReason: Error | null;
129
+ failureReason: Error;
129
130
  errorUpdateCount: number;
130
131
  isFetched: boolean;
131
132
  isFetchedAfterMount: boolean;
@@ -134,6 +135,7 @@ declare const useMessages: () => {
134
135
  isPaused: boolean;
135
136
  isRefetching: boolean;
136
137
  isStale: boolean;
138
+ isEnabled: boolean;
137
139
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<InfiniteData<TQueryFnData, unknown>, Error>>;
138
140
  fetchStatus: _tanstack_react_query.FetchStatus;
139
141
  promise: Promise<InfiniteData<TQueryFnData, unknown>>;
@@ -160,7 +162,7 @@ declare const useMessages: () => {
160
162
  dataUpdatedAt: number;
161
163
  errorUpdatedAt: number;
162
164
  failureCount: number;
163
- failureReason: Error | null;
165
+ failureReason: Error;
164
166
  errorUpdateCount: number;
165
167
  isFetched: boolean;
166
168
  isFetchedAfterMount: boolean;
@@ -169,6 +171,7 @@ declare const useMessages: () => {
169
171
  isPaused: boolean;
170
172
  isRefetching: boolean;
171
173
  isStale: boolean;
174
+ isEnabled: boolean;
172
175
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<InfiniteData<TQueryFnData, unknown>, Error>>;
173
176
  fetchStatus: _tanstack_react_query.FetchStatus;
174
177
  promise: Promise<InfiniteData<TQueryFnData, unknown>>;
@@ -202,7 +205,7 @@ declare const useLatestMessage: () => {
202
205
  dataUpdatedAt: number;
203
206
  errorUpdatedAt: number;
204
207
  failureCount: number;
205
- failureReason: Error | null;
208
+ failureReason: Error;
206
209
  errorUpdateCount: number;
207
210
  isFetched: boolean;
208
211
  isFetchedAfterMount: boolean;
@@ -211,6 +214,7 @@ declare const useLatestMessage: () => {
211
214
  isPaused: boolean;
212
215
  isRefetching: boolean;
213
216
  isStale: boolean;
217
+ isEnabled: boolean;
214
218
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<_tanstack_query_core.InfiniteData<TQueryFnData, unknown>, Error>>;
215
219
  fetchStatus: _tanstack_query_core.FetchStatus;
216
220
  promise: Promise<_tanstack_query_core.InfiniteData<TQueryFnData, unknown>>;
@@ -238,7 +242,7 @@ declare const useLatestMessage: () => {
238
242
  dataUpdatedAt: number;
239
243
  errorUpdatedAt: number;
240
244
  failureCount: number;
241
- failureReason: Error | null;
245
+ failureReason: Error;
242
246
  errorUpdateCount: number;
243
247
  isFetched: boolean;
244
248
  isFetchedAfterMount: boolean;
@@ -247,6 +251,7 @@ declare const useLatestMessage: () => {
247
251
  isPaused: boolean;
248
252
  isRefetching: boolean;
249
253
  isStale: boolean;
254
+ isEnabled: boolean;
250
255
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<_tanstack_query_core.InfiniteData<TQueryFnData, unknown>, Error>>;
251
256
  fetchStatus: _tanstack_query_core.FetchStatus;
252
257
  promise: Promise<_tanstack_query_core.InfiniteData<TQueryFnData, unknown>>;
@@ -357,7 +362,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
357
362
  dataUpdatedAt: number;
358
363
  errorUpdatedAt: number;
359
364
  failureCount: number;
360
- failureReason: Error | null;
365
+ failureReason: Error;
361
366
  errorUpdateCount: number;
362
367
  isFetched: boolean;
363
368
  isFetchedAfterMount: boolean;
@@ -366,6 +371,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
366
371
  isPaused: boolean;
367
372
  isRefetching: boolean;
368
373
  isStale: boolean;
374
+ isEnabled: boolean;
369
375
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
370
376
  fetchStatus: _tanstack_react_query.FetchStatus;
371
377
  promise: Promise<any>;
@@ -384,7 +390,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
384
390
  dataUpdatedAt: number;
385
391
  errorUpdatedAt: number;
386
392
  failureCount: number;
387
- failureReason: Error | null;
393
+ failureReason: Error;
388
394
  errorUpdateCount: number;
389
395
  isFetched: boolean;
390
396
  isFetchedAfterMount: boolean;
@@ -393,6 +399,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
393
399
  isPaused: boolean;
394
400
  isRefetching: boolean;
395
401
  isStale: boolean;
402
+ isEnabled: boolean;
396
403
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
397
404
  fetchStatus: _tanstack_react_query.FetchStatus;
398
405
  promise: Promise<any>;
@@ -411,7 +418,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
411
418
  dataUpdatedAt: number;
412
419
  errorUpdatedAt: number;
413
420
  failureCount: number;
414
- failureReason: Error | null;
421
+ failureReason: Error;
415
422
  errorUpdateCount: number;
416
423
  isFetched: boolean;
417
424
  isFetchedAfterMount: boolean;
@@ -420,6 +427,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
420
427
  isPaused: boolean;
421
428
  isRefetching: boolean;
422
429
  isStale: boolean;
430
+ isEnabled: boolean;
423
431
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
424
432
  fetchStatus: _tanstack_react_query.FetchStatus;
425
433
  promise: Promise<any>;
@@ -438,7 +446,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
438
446
  dataUpdatedAt: number;
439
447
  errorUpdatedAt: number;
440
448
  failureCount: number;
441
- failureReason: Error | null;
449
+ failureReason: Error;
442
450
  errorUpdateCount: number;
443
451
  isFetched: boolean;
444
452
  isFetchedAfterMount: boolean;
@@ -447,6 +455,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
447
455
  isPaused: boolean;
448
456
  isRefetching: boolean;
449
457
  isStale: boolean;
458
+ isEnabled: boolean;
450
459
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
451
460
  fetchStatus: _tanstack_react_query.FetchStatus;
452
461
  promise: Promise<any>;
@@ -464,7 +473,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
464
473
  dataUpdatedAt: number;
465
474
  errorUpdatedAt: number;
466
475
  failureCount: number;
467
- failureReason: Error | null;
476
+ failureReason: Error;
468
477
  errorUpdateCount: number;
469
478
  isFetched: boolean;
470
479
  isFetchedAfterMount: boolean;
@@ -474,6 +483,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
474
483
  isPaused: boolean;
475
484
  isRefetching: boolean;
476
485
  isStale: boolean;
486
+ isEnabled: boolean;
477
487
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
478
488
  fetchStatus: _tanstack_react_query.FetchStatus;
479
489
  promise: Promise<any>;
@@ -492,7 +502,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
492
502
  dataUpdatedAt: number;
493
503
  errorUpdatedAt: number;
494
504
  failureCount: number;
495
- failureReason: Error | null;
505
+ failureReason: Error;
496
506
  errorUpdateCount: number;
497
507
  isFetched: boolean;
498
508
  isFetchedAfterMount: boolean;
@@ -501,6 +511,7 @@ declare const useAssistant: ({ assistantId, }: Args$7) => {
501
511
  isPaused: boolean;
502
512
  isRefetching: boolean;
503
513
  isStale: boolean;
514
+ isEnabled: boolean;
504
515
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
505
516
  fetchStatus: _tanstack_react_query.FetchStatus;
506
517
  promise: Promise<any>;
@@ -524,7 +535,7 @@ declare const ThreadDialog: {
524
535
  (props: StyleProps): react_jsx_runtime.JSX.Element;
525
536
  Root: ({ children, className, style, }: {
526
537
  children: React.ReactNode;
527
- } & StyleProps) => react_jsx_runtime.JSX.Element | null;
538
+ } & StyleProps) => react_jsx_runtime.JSX.Element;
528
539
  Messages: ({ className, style, }: StyleProps) => react_jsx_runtime.JSX.Element;
529
540
  FormContainer: ({ children, className, style, }: {
530
541
  children: React.ReactNode;
@@ -560,7 +571,7 @@ declare const AudioThreadDialog: {
560
571
  (props: StyleProps): react_jsx_runtime.JSX.Element;
561
572
  Root: ({ children, className, style, }: {
562
573
  children: React.ReactNode;
563
- } & StyleProps) => react_jsx_runtime.JSX.Element | null;
574
+ } & StyleProps) => react_jsx_runtime.JSX.Element;
564
575
  Messages: ({ className, style, }: StyleProps) => react_jsx_runtime.JSX.Element;
565
576
  FormContainer: ({ children, className, style, }: {
566
577
  children: React.ReactNode;
@@ -571,13 +582,14 @@ declare const AudioThreadDialog: {
571
582
  type Args$6 = {
572
583
  children: React.ReactNode;
573
584
  play?: (args: PlayArgs) => void;
585
+ onEnd?: () => void;
574
586
  audioRuntime?: AudioRuntime;
575
587
  } & StyleProps;
576
588
 
577
589
  type Args$5 = Omit<Args$6, 'children'>;
578
590
  declare const AudioThread: {
579
591
  (props: Args$5): react_jsx_runtime.JSX.Element;
580
- Root: ({ children, play, className, style, ...rest }: Args$6) => react_jsx_runtime.JSX.Element;
592
+ Root: ({ children, play, onEnd, className, style, ...rest }: Args$6) => react_jsx_runtime.JSX.Element;
581
593
  Visualization: {
582
594
  (props: StyleProps): react_jsx_runtime.JSX.Element;
583
595
  Root: ({ children, ...rest }: {
@@ -611,15 +623,17 @@ declare const useAudioThreadContext: () => {
611
623
  audioRuntime: AudioRuntime | null;
612
624
  };
613
625
 
614
- declare const useTtsAudioRuntime: ({ play, }: {
626
+ declare const useTtsAudioRuntime: ({ play, onEnd: passedOnEnd, }: {
615
627
  play?: (args: PlayArgs) => void;
628
+ onEnd?: () => void;
616
629
  }) => {
617
630
  ttsAudioRuntime: AudioRuntime;
618
631
  };
619
632
 
620
- declare const TtsAudioRuntimeProvider: ({ children, play, }: {
633
+ declare const TtsAudioRuntimeProvider: ({ children, play, onEnd, }: {
621
634
  children: React.ReactNode;
622
635
  play?: (args: PlayArgs) => void;
636
+ onEnd?: () => void;
623
637
  }) => react_jsx_runtime.JSX.Element;
624
638
 
625
639
  declare const useWebrtcAudioRuntime: () => {
@@ -630,20 +644,20 @@ declare const useWebrtcAudioRuntime: () => {
630
644
  resume: () => Promise<void>;
631
645
  stop: () => Promise<void>;
632
646
  isPending: boolean;
633
- visualizationAnalyser: AnalyserNode | null;
647
+ visualizationAnalyser: AnalyserNode;
634
648
  rawStatus: "paused" | "idle" | "recording" | "stopped";
635
649
  };
636
650
  assistant: {
637
651
  play: () => Promise<void>;
638
652
  pause: () => Promise<void>;
639
653
  stop: () => Promise<void>;
640
- visualizationAnalyser: AnalyserNode | null;
654
+ visualizationAnalyser: AnalyserNode;
641
655
  playing: boolean;
642
656
  paused: boolean;
643
657
  isPending: boolean;
644
658
  isReady: boolean;
645
659
  isAudioPlayed: boolean;
646
- rawStatus: undefined;
660
+ rawStatus: any;
647
661
  };
648
662
  };
649
663
  };
@@ -657,7 +671,7 @@ declare const Gui: () => react_jsx_runtime.JSX.Element;
657
671
  declare const Suggestions: {
658
672
  ({ children, className, style, }: {
659
673
  children: React.ReactNode;
660
- } & StyleProps): react_jsx_runtime.JSX.Element | null;
674
+ } & StyleProps): react_jsx_runtime.JSX.Element;
661
675
  Item: {
662
676
  ({ suggestion, isDisabled, className, style, }: {
663
677
  suggestion: string;
@@ -693,7 +707,7 @@ declare const useMarkdownContext: () => MarkdownContextType;
693
707
  declare const SourceAnnotation: ({ children, ...rest }: {
694
708
  children: React.ReactNode;
695
709
  ["data-annotation"]: string;
696
- }) => react_jsx_runtime.JSX.Element | null;
710
+ }) => react_jsx_runtime.JSX.Element;
697
711
 
698
712
  declare const AssistantAvatarContext: react.Context<react_jsx_runtime.JSX.Element>;
699
713
 
@@ -728,7 +742,7 @@ declare const useComponents: () => {
728
742
  RunStep: {
729
743
  ({ runStep, className, style, }: {
730
744
  runStep: SerializedRunStep;
731
- } & StyleProps): react_jsx_runtime.JSX.Element | null;
745
+ } & StyleProps): react_jsx_runtime.JSX.Element;
732
746
  ToolCalls: {
733
747
  ({ stepDetails, runStep, className, style, }: {
734
748
  stepDetails: openai_resources_beta_threads_runs_steps.ToolCallsStepDetails;
@@ -797,7 +811,7 @@ declare const useComponents: () => {
797
811
  };
798
812
  MessageAttachments: ({ message, }: {
799
813
  message: SerializedMessage;
800
- }) => react_jsx_runtime.JSX.Element | null;
814
+ }) => react_jsx_runtime.JSX.Element;
801
815
  StartingSkeleton: {
802
816
  ({ children, }: {
803
817
  children?: React.ReactNode;
@@ -816,7 +830,7 @@ type Args$3 = {
816
830
  runStep: SerializedRunStep;
817
831
  } & StyleProps;
818
832
  declare const RunStep: {
819
- ({ runStep, className, style, }: Args$3): react_jsx_runtime.JSX.Element | null;
833
+ ({ runStep, className, style, }: Args$3): react_jsx_runtime.JSX.Element;
820
834
  ToolCalls: {
821
835
  ({ stepDetails, runStep, className, style, }: {
822
836
  stepDetails: openai_resources_beta_threads_runs_steps.ToolCallsStepDetails;
@@ -891,101 +905,68 @@ declare const useCreateFile: ({ onError, }?: {
891
905
  isPending: false;
892
906
  isSuccess: false;
893
907
  status: "idle";
894
- mutate: _tanstack_react_query.UseMutateFunction<any, any, {
895
- [key: string]: any;
896
- content: string;
897
- }, any>;
908
+ mutate: _tanstack_react_query.UseMutateFunction<any, any, any, any>;
898
909
  reset: () => void;
899
910
  context: any;
900
911
  failureCount: number;
901
912
  failureReason: any;
902
913
  isPaused: boolean;
903
914
  submittedAt: number;
904
- mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, {
905
- [key: string]: any;
906
- content: string;
907
- }, any>;
915
+ mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
908
916
  } | {
909
917
  createFile: (...args: any[]) => Promise<any>;
910
918
  data: undefined;
911
- variables: {
912
- [key: string]: any;
913
- content: string;
914
- };
919
+ variables: any;
915
920
  error: null;
916
921
  isError: false;
917
922
  isIdle: false;
918
923
  isPending: true;
919
924
  isSuccess: false;
920
925
  status: "pending";
921
- mutate: _tanstack_react_query.UseMutateFunction<any, any, {
922
- [key: string]: any;
923
- content: string;
924
- }, any>;
926
+ mutate: _tanstack_react_query.UseMutateFunction<any, any, any, any>;
925
927
  reset: () => void;
926
928
  context: any;
927
929
  failureCount: number;
928
930
  failureReason: any;
929
931
  isPaused: boolean;
930
932
  submittedAt: number;
931
- mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, {
932
- [key: string]: any;
933
- content: string;
934
- }, any>;
933
+ mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
935
934
  } | {
936
935
  createFile: (...args: any[]) => Promise<any>;
937
936
  data: undefined;
938
937
  error: any;
939
- variables: {
940
- [key: string]: any;
941
- content: string;
942
- };
938
+ variables: any;
943
939
  isError: true;
944
940
  isIdle: false;
945
941
  isPending: false;
946
942
  isSuccess: false;
947
943
  status: "error";
948
- mutate: _tanstack_react_query.UseMutateFunction<any, any, {
949
- [key: string]: any;
950
- content: string;
951
- }, any>;
944
+ mutate: _tanstack_react_query.UseMutateFunction<any, any, any, any>;
952
945
  reset: () => void;
953
946
  context: any;
954
947
  failureCount: number;
955
948
  failureReason: any;
956
949
  isPaused: boolean;
957
950
  submittedAt: number;
958
- mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, {
959
- [key: string]: any;
960
- content: string;
961
- }, any>;
951
+ mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
962
952
  } | {
963
953
  createFile: (...args: any[]) => Promise<any>;
964
954
  data: any;
965
955
  error: null;
966
- variables: {
967
- [key: string]: any;
968
- content: string;
969
- };
956
+ variables: any;
970
957
  isError: false;
971
958
  isIdle: false;
972
959
  isPending: false;
973
960
  isSuccess: true;
974
961
  status: "success";
975
- mutate: _tanstack_react_query.UseMutateFunction<any, any, {
976
- [key: string]: any;
977
- content: string;
978
- }, any>;
962
+ mutate: _tanstack_react_query.UseMutateFunction<any, any, any, any>;
979
963
  reset: () => void;
980
964
  context: any;
981
965
  failureCount: number;
982
966
  failureReason: any;
983
967
  isPaused: boolean;
984
968
  submittedAt: number;
985
- mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, {
986
- [key: string]: any;
987
- content: string;
988
- }, any>;
969
+ mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
989
970
  };
990
971
 
991
972
  declare const useChangeFilesField: () => {