@superinterface/react 3.10.3 → 3.11.1

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
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, PlayArgs, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.cjs';
2
+ import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, PlayArgs, AudioRuntime, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.cjs';
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';
@@ -8,13 +8,11 @@ import * as _tanstack_query_core from '@tanstack/query-core';
8
8
  import * as react from 'react';
9
9
  import { Dispatch, SetStateAction } from 'react';
10
10
  import * as openai_resources from 'openai/resources';
11
- import * as react_use_audio_player from 'react-use-audio-player';
12
- import { UseAudioCaptureProps } from 'use-audio-capture';
13
11
  import OpenAI from 'openai';
14
12
  import remarkGfm from 'remark-gfm';
15
13
  import * as openai_resources_beta_threads_runs_steps from 'openai/resources/beta/threads/runs/steps';
16
14
 
17
- type Args$a = {
15
+ type Args$9 = {
18
16
  children: React.ReactNode;
19
17
  baseUrl?: string;
20
18
  variables?: {
@@ -26,7 +24,7 @@ type Args$a = {
26
24
  };
27
25
  threadIdStorageOptions?: ThreadStorageOptions | null;
28
26
  };
29
- declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$a) => react_jsx_runtime.JSX.Element;
27
+ declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$9) => react_jsx_runtime.JSX.Element;
30
28
 
31
29
  declare const useSuperinterfaceContext: () => {
32
30
  baseUrl: string | null;
@@ -39,14 +37,14 @@ declare const useSuperinterfaceContext: () => {
39
37
  createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
40
38
  };
41
39
 
42
- type Args$9 = Args$a;
40
+ type Args$8 = Args$9;
43
41
 
44
- type Args$8 = Args$9 & StyleProps;
42
+ type Args$7 = Args$8 & StyleProps;
45
43
 
46
- type Args$7 = Omit<Args$8, 'children'>;
44
+ type Args$6 = Omit<Args$7, 'children'>;
47
45
  declare const Thread: {
48
- (props: Args$7): react_jsx_runtime.JSX.Element;
49
- Root: ({ children, style, className, ...rest }: Args$8) => react_jsx_runtime.JSX.Element;
46
+ (props: Args$6): react_jsx_runtime.JSX.Element;
47
+ Root: ({ children, style, className, ...rest }: Args$7) => react_jsx_runtime.JSX.Element;
50
48
  Messages: {
51
49
  ({ children, className, style, }: {
52
50
  children?: React.ReactNode;
@@ -338,10 +336,10 @@ declare const useMessageFormContext: () => {
338
336
 
339
337
  declare const useIsMutatingMessage: () => boolean;
340
338
 
341
- type Args$6 = {
339
+ type Args$5 = {
342
340
  assistantId: string;
343
341
  };
344
- declare const useAssistant: ({ assistantId, }: Args$6) => {
342
+ declare const useAssistant: ({ assistantId, }: Args$5) => {
345
343
  assistant: any;
346
344
  data: any;
347
345
  error: Error;
@@ -509,6 +507,11 @@ declare const ThreadDialogContext: react.Context<{
509
507
  setIsOpen: Dispatch<SetStateAction<boolean>>;
510
508
  }>;
511
509
 
510
+ declare const useThreadDialogContext: () => {
511
+ isOpen: boolean;
512
+ setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
513
+ };
514
+
512
515
  declare const AudioThreadDialog: {
513
516
  (props: StyleProps): react_jsx_runtime.JSX.Element;
514
517
  Root: ({ children, }: {
@@ -535,88 +538,55 @@ declare const AudioThreadDialog: {
535
538
  };
536
539
  };
537
540
 
538
- type Args$5 = {
541
+ type Args$4 = {
539
542
  children: React.ReactNode;
540
543
  play?: (args: PlayArgs) => void;
544
+ audioRuntime?: AudioRuntime;
541
545
  } & StyleProps;
542
546
 
543
- type Args$4 = Omit<Args$5, 'children'>;
547
+ type Args$3 = Omit<Args$4, 'children'>;
544
548
  declare const AudioThread: {
545
- (props: Args$4): react_jsx_runtime.JSX.Element;
546
- Root: ({ children, ...rest }: Args$5) => react_jsx_runtime.JSX.Element;
549
+ (props: Args$3): react_jsx_runtime.JSX.Element;
550
+ Root: ({ children, play, className, style, ...rest }: Args$4) => react_jsx_runtime.JSX.Element;
547
551
  Visualization: (props: StyleProps) => react_jsx_runtime.JSX.Element;
548
552
  Status: (props: StyleProps) => react_jsx_runtime.JSX.Element;
549
553
  Form: (props: StyleProps) => react_jsx_runtime.JSX.Element;
550
554
  };
551
555
 
552
- declare const useThreadDialogContext: () => {
553
- isOpen: boolean;
554
- setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
556
+ declare const useAudioThreadContext: () => {
557
+ audioRuntime: AudioRuntime | null;
555
558
  };
556
559
 
557
- declare const useMessageAudio: ({ onEnd, play: passedPlay, }: {
558
- onEnd: () => void;
560
+ declare const useTtsAudioRuntime: ({ play, }: {
559
561
  play?: (args: PlayArgs) => void;
560
562
  }) => {
561
- visualizationAnalyser: AnalyserNode | null;
562
- play: () => void;
563
- pause: () => void;
564
- togglePlayPause: () => void;
565
- stop: () => void;
566
- setVolume: (volume: number) => void;
567
- fade: (from: number, to: number, duration: number) => void;
568
- setRate: (speed: number) => void;
569
- seek: (seconds: number) => void;
570
- mute: (muteOnOff: boolean) => void;
571
- loop: (loopOnOff: boolean) => void;
572
- getPosition: () => number;
573
- load: (...args: react_use_audio_player.LoadArguments) => void;
574
- src: string | null;
575
- looping: boolean;
576
- isReady: boolean;
577
- isLoading: boolean;
578
- paused: boolean;
579
- stopped: boolean;
580
- playing: boolean;
581
- duration: number;
582
- muted: boolean;
583
- rate: number;
584
- volume: number;
585
- error: string | null;
586
- cleanup: VoidFunction;
587
- isPending: boolean;
588
- isAudioPlayed: boolean;
563
+ ttsAudioRuntime: AudioRuntime;
589
564
  };
590
565
 
591
- type Args$3 = UseAudioCaptureProps & {
592
- isStopOnSilence: boolean;
593
- };
594
- declare const useRecorder: ({ isStopOnSilence, onStart, onStop, }: Args$3) => {
595
- status: "paused" | "idle" | "recording" | "stopped";
596
- visualizationAnalyser: AnalyserNode | null;
597
- start: () => Promise<void>;
598
- stop: () => Promise<void>;
599
- pause: () => Promise<void>;
600
- resume: () => Promise<void>;
601
- };
602
-
603
- declare const statusMessages: {
604
- recording: string;
605
- creatingMessage: string;
606
- runActive: string;
607
- playing: string;
608
- loading: string;
609
- idle: string;
610
- recorderPaused: string;
611
- playerPaused: string;
612
- acquiringMedia: string;
613
- other: string;
614
- };
615
-
616
- declare const useAudioThreadContext: () => {
617
- status: keyof typeof statusMessages;
618
- recorderProps: ReturnType<typeof useRecorder>;
619
- messageAudioProps: ReturnType<typeof useMessageAudio>;
566
+ declare const useRealtimeWebRTCAudioRuntime: () => {
567
+ realtimeWebRTCAudioRuntime: {
568
+ user: {
569
+ start: () => Promise<void>;
570
+ pause: () => Promise<void>;
571
+ resume: () => Promise<void>;
572
+ stop: () => Promise<void>;
573
+ isPending: boolean;
574
+ visualizationAnalyser: AnalyserNode | null;
575
+ rawStatus: "paused" | "idle" | "recording" | "stopped";
576
+ };
577
+ assistant: {
578
+ play: () => Promise<void>;
579
+ pause: () => Promise<void>;
580
+ stop: () => Promise<void>;
581
+ visualizationAnalyser: AnalyserNode | null;
582
+ playing: boolean;
583
+ paused: boolean;
584
+ isPending: boolean;
585
+ isReady: boolean;
586
+ isAudioPlayed: boolean;
587
+ rawStatus: undefined;
588
+ };
589
+ };
620
590
  };
621
591
 
622
592
  declare const Suggestions: {
@@ -737,4 +707,4 @@ type Args = {
737
707
  };
738
708
  declare const AssistantProvider: ({ children, }: Args) => react_jsx_runtime.JSX.Element;
739
709
 
740
- export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, SourceAnnotation, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
710
+ export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, SourceAnnotation, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useRealtimeWebRTCAudioRuntime, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext, useTtsAudioRuntime };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, PlayArgs, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.js';
2
+ import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, PlayArgs, AudioRuntime, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.js';
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';
@@ -8,13 +8,11 @@ import * as _tanstack_query_core from '@tanstack/query-core';
8
8
  import * as react from 'react';
9
9
  import { Dispatch, SetStateAction } from 'react';
10
10
  import * as openai_resources from 'openai/resources';
11
- import * as react_use_audio_player from 'react-use-audio-player';
12
- import { UseAudioCaptureProps } from 'use-audio-capture';
13
11
  import OpenAI from 'openai';
14
12
  import remarkGfm from 'remark-gfm';
15
13
  import * as openai_resources_beta_threads_runs_steps from 'openai/resources/beta/threads/runs/steps';
16
14
 
17
- type Args$a = {
15
+ type Args$9 = {
18
16
  children: React.ReactNode;
19
17
  baseUrl?: string;
20
18
  variables?: {
@@ -26,7 +24,7 @@ type Args$a = {
26
24
  };
27
25
  threadIdStorageOptions?: ThreadStorageOptions | null;
28
26
  };
29
- declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$a) => react_jsx_runtime.JSX.Element;
27
+ declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$9) => react_jsx_runtime.JSX.Element;
30
28
 
31
29
  declare const useSuperinterfaceContext: () => {
32
30
  baseUrl: string | null;
@@ -39,14 +37,14 @@ declare const useSuperinterfaceContext: () => {
39
37
  createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
40
38
  };
41
39
 
42
- type Args$9 = Args$a;
40
+ type Args$8 = Args$9;
43
41
 
44
- type Args$8 = Args$9 & StyleProps;
42
+ type Args$7 = Args$8 & StyleProps;
45
43
 
46
- type Args$7 = Omit<Args$8, 'children'>;
44
+ type Args$6 = Omit<Args$7, 'children'>;
47
45
  declare const Thread: {
48
- (props: Args$7): react_jsx_runtime.JSX.Element;
49
- Root: ({ children, style, className, ...rest }: Args$8) => react_jsx_runtime.JSX.Element;
46
+ (props: Args$6): react_jsx_runtime.JSX.Element;
47
+ Root: ({ children, style, className, ...rest }: Args$7) => react_jsx_runtime.JSX.Element;
50
48
  Messages: {
51
49
  ({ children, className, style, }: {
52
50
  children?: React.ReactNode;
@@ -338,10 +336,10 @@ declare const useMessageFormContext: () => {
338
336
 
339
337
  declare const useIsMutatingMessage: () => boolean;
340
338
 
341
- type Args$6 = {
339
+ type Args$5 = {
342
340
  assistantId: string;
343
341
  };
344
- declare const useAssistant: ({ assistantId, }: Args$6) => {
342
+ declare const useAssistant: ({ assistantId, }: Args$5) => {
345
343
  assistant: any;
346
344
  data: any;
347
345
  error: Error;
@@ -509,6 +507,11 @@ declare const ThreadDialogContext: react.Context<{
509
507
  setIsOpen: Dispatch<SetStateAction<boolean>>;
510
508
  }>;
511
509
 
510
+ declare const useThreadDialogContext: () => {
511
+ isOpen: boolean;
512
+ setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
513
+ };
514
+
512
515
  declare const AudioThreadDialog: {
513
516
  (props: StyleProps): react_jsx_runtime.JSX.Element;
514
517
  Root: ({ children, }: {
@@ -535,88 +538,55 @@ declare const AudioThreadDialog: {
535
538
  };
536
539
  };
537
540
 
538
- type Args$5 = {
541
+ type Args$4 = {
539
542
  children: React.ReactNode;
540
543
  play?: (args: PlayArgs) => void;
544
+ audioRuntime?: AudioRuntime;
541
545
  } & StyleProps;
542
546
 
543
- type Args$4 = Omit<Args$5, 'children'>;
547
+ type Args$3 = Omit<Args$4, 'children'>;
544
548
  declare const AudioThread: {
545
- (props: Args$4): react_jsx_runtime.JSX.Element;
546
- Root: ({ children, ...rest }: Args$5) => react_jsx_runtime.JSX.Element;
549
+ (props: Args$3): react_jsx_runtime.JSX.Element;
550
+ Root: ({ children, play, className, style, ...rest }: Args$4) => react_jsx_runtime.JSX.Element;
547
551
  Visualization: (props: StyleProps) => react_jsx_runtime.JSX.Element;
548
552
  Status: (props: StyleProps) => react_jsx_runtime.JSX.Element;
549
553
  Form: (props: StyleProps) => react_jsx_runtime.JSX.Element;
550
554
  };
551
555
 
552
- declare const useThreadDialogContext: () => {
553
- isOpen: boolean;
554
- setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
556
+ declare const useAudioThreadContext: () => {
557
+ audioRuntime: AudioRuntime | null;
555
558
  };
556
559
 
557
- declare const useMessageAudio: ({ onEnd, play: passedPlay, }: {
558
- onEnd: () => void;
560
+ declare const useTtsAudioRuntime: ({ play, }: {
559
561
  play?: (args: PlayArgs) => void;
560
562
  }) => {
561
- visualizationAnalyser: AnalyserNode | null;
562
- play: () => void;
563
- pause: () => void;
564
- togglePlayPause: () => void;
565
- stop: () => void;
566
- setVolume: (volume: number) => void;
567
- fade: (from: number, to: number, duration: number) => void;
568
- setRate: (speed: number) => void;
569
- seek: (seconds: number) => void;
570
- mute: (muteOnOff: boolean) => void;
571
- loop: (loopOnOff: boolean) => void;
572
- getPosition: () => number;
573
- load: (...args: react_use_audio_player.LoadArguments) => void;
574
- src: string | null;
575
- looping: boolean;
576
- isReady: boolean;
577
- isLoading: boolean;
578
- paused: boolean;
579
- stopped: boolean;
580
- playing: boolean;
581
- duration: number;
582
- muted: boolean;
583
- rate: number;
584
- volume: number;
585
- error: string | null;
586
- cleanup: VoidFunction;
587
- isPending: boolean;
588
- isAudioPlayed: boolean;
563
+ ttsAudioRuntime: AudioRuntime;
589
564
  };
590
565
 
591
- type Args$3 = UseAudioCaptureProps & {
592
- isStopOnSilence: boolean;
593
- };
594
- declare const useRecorder: ({ isStopOnSilence, onStart, onStop, }: Args$3) => {
595
- status: "paused" | "idle" | "recording" | "stopped";
596
- visualizationAnalyser: AnalyserNode | null;
597
- start: () => Promise<void>;
598
- stop: () => Promise<void>;
599
- pause: () => Promise<void>;
600
- resume: () => Promise<void>;
601
- };
602
-
603
- declare const statusMessages: {
604
- recording: string;
605
- creatingMessage: string;
606
- runActive: string;
607
- playing: string;
608
- loading: string;
609
- idle: string;
610
- recorderPaused: string;
611
- playerPaused: string;
612
- acquiringMedia: string;
613
- other: string;
614
- };
615
-
616
- declare const useAudioThreadContext: () => {
617
- status: keyof typeof statusMessages;
618
- recorderProps: ReturnType<typeof useRecorder>;
619
- messageAudioProps: ReturnType<typeof useMessageAudio>;
566
+ declare const useRealtimeWebRTCAudioRuntime: () => {
567
+ realtimeWebRTCAudioRuntime: {
568
+ user: {
569
+ start: () => Promise<void>;
570
+ pause: () => Promise<void>;
571
+ resume: () => Promise<void>;
572
+ stop: () => Promise<void>;
573
+ isPending: boolean;
574
+ visualizationAnalyser: AnalyserNode | null;
575
+ rawStatus: "paused" | "idle" | "recording" | "stopped";
576
+ };
577
+ assistant: {
578
+ play: () => Promise<void>;
579
+ pause: () => Promise<void>;
580
+ stop: () => Promise<void>;
581
+ visualizationAnalyser: AnalyserNode | null;
582
+ playing: boolean;
583
+ paused: boolean;
584
+ isPending: boolean;
585
+ isReady: boolean;
586
+ isAudioPlayed: boolean;
587
+ rawStatus: undefined;
588
+ };
589
+ };
620
590
  };
621
591
 
622
592
  declare const Suggestions: {
@@ -737,4 +707,4 @@ type Args = {
737
707
  };
738
708
  declare const AssistantProvider: ({ children, }: Args) => react_jsx_runtime.JSX.Element;
739
709
 
740
- export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, SourceAnnotation, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
710
+ export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, SourceAnnotation, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useRealtimeWebRTCAudioRuntime, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext, useTtsAudioRuntime };