@superinterface/react 3.7.0 → 3.7.2

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, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.cjs';
2
+ import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, 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,11 +8,13 @@ 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';
11
13
  import OpenAI from 'openai';
12
14
  import remarkGfm from 'remark-gfm';
13
15
  import * as openai_resources_beta_threads_runs_steps from 'openai/resources/beta/threads/runs/steps';
14
16
 
15
- type Args$9 = {
17
+ type Args$a = {
16
18
  children: React.ReactNode;
17
19
  baseUrl?: string;
18
20
  variables?: {
@@ -24,7 +26,7 @@ type Args$9 = {
24
26
  };
25
27
  threadIdStorageOptions?: ThreadStorageOptions | null;
26
28
  };
27
- declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$9) => react_jsx_runtime.JSX.Element;
29
+ declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$a) => react_jsx_runtime.JSX.Element;
28
30
 
29
31
  declare const useSuperinterfaceContext: () => {
30
32
  baseUrl: string | null;
@@ -37,14 +39,14 @@ declare const useSuperinterfaceContext: () => {
37
39
  createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
38
40
  };
39
41
 
40
- type Args$8 = Args$9;
42
+ type Args$9 = Args$a;
41
43
 
42
- type Args$7 = Args$8 & StyleProps;
44
+ type Args$8 = Args$9 & StyleProps;
43
45
 
44
- type Args$6 = Omit<Args$7, 'children'>;
46
+ type Args$7 = Omit<Args$8, 'children'>;
45
47
  declare const Thread: {
46
- (props: Args$6): react_jsx_runtime.JSX.Element;
47
- Root: ({ children, style, className, ...rest }: Args$7) => react_jsx_runtime.JSX.Element;
48
+ (props: Args$7): react_jsx_runtime.JSX.Element;
49
+ Root: ({ children, style, className, ...rest }: Args$8) => react_jsx_runtime.JSX.Element;
48
50
  Messages: {
49
51
  ({ children, className, style, }: {
50
52
  children?: React.ReactNode;
@@ -252,7 +254,7 @@ declare const useLatestMessage: () => {
252
254
  declare const useCreateMessage: ({ onError, }?: {
253
255
  onError?: (error: unknown) => void;
254
256
  }) => {
255
- createMessage: (restobj: Omit<any, string>) => Promise<any>;
257
+ createMessage: (variables: UseCreateMessageVariables) => Promise<any>;
256
258
  data: undefined;
257
259
  variables: undefined;
258
260
  error: null;
@@ -270,7 +272,7 @@ declare const useCreateMessage: ({ onError, }?: {
270
272
  submittedAt: number;
271
273
  mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
272
274
  } | {
273
- createMessage: (restobj: Omit<any, string>) => Promise<any>;
275
+ createMessage: (variables: UseCreateMessageVariables) => Promise<any>;
274
276
  data: undefined;
275
277
  variables: any;
276
278
  error: null;
@@ -288,7 +290,7 @@ declare const useCreateMessage: ({ onError, }?: {
288
290
  submittedAt: number;
289
291
  mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
290
292
  } | {
291
- createMessage: (restobj: Omit<any, string>) => Promise<any>;
293
+ createMessage: (variables: UseCreateMessageVariables) => Promise<any>;
292
294
  data: undefined;
293
295
  error: any;
294
296
  variables: any;
@@ -306,7 +308,7 @@ declare const useCreateMessage: ({ onError, }?: {
306
308
  submittedAt: number;
307
309
  mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
308
310
  } | {
309
- createMessage: (restobj: Omit<any, string>) => Promise<any>;
311
+ createMessage: (variables: UseCreateMessageVariables) => Promise<any>;
310
312
  data: any;
311
313
  error: null;
312
314
  variables: any;
@@ -336,10 +338,10 @@ declare const useMessageFormContext: () => {
336
338
 
337
339
  declare const useIsMutatingMessage: () => boolean;
338
340
 
339
- type Args$5 = {
341
+ type Args$6 = {
340
342
  assistantId: string;
341
343
  };
342
- declare const useAssistant: ({ assistantId, }: Args$5) => {
344
+ declare const useAssistant: ({ assistantId, }: Args$6) => {
343
345
  assistant: any;
344
346
  data: any;
345
347
  error: Error;
@@ -533,14 +535,14 @@ declare const AudioThreadDialog: {
533
535
  };
534
536
  };
535
537
 
536
- type Args$4 = {
538
+ type Args$5 = {
537
539
  children: React.ReactNode;
538
540
  } & StyleProps;
539
541
 
540
- type Args$3 = Omit<Args$4, 'children'>;
542
+ type Args$4 = Omit<Args$5, 'children'>;
541
543
  declare const AudioThread: {
542
- (props: Args$3): react_jsx_runtime.JSX.Element;
543
- Root: ({ children, ...rest }: Args$4) => react_jsx_runtime.JSX.Element;
544
+ (props: Args$4): react_jsx_runtime.JSX.Element;
545
+ Root: ({ children, ...rest }: Args$5) => react_jsx_runtime.JSX.Element;
544
546
  Visualization: (props: StyleProps) => react_jsx_runtime.JSX.Element;
545
547
  Status: (props: StyleProps) => react_jsx_runtime.JSX.Element;
546
548
  Form: (props: StyleProps) => react_jsx_runtime.JSX.Element;
@@ -551,6 +553,70 @@ declare const useThreadDialogContext: () => {
551
553
  setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
552
554
  };
553
555
 
556
+ declare const useMessageAudio: ({ onEnd, }: {
557
+ onEnd: () => void;
558
+ }) => {
559
+ visualizationAnalyser: AnalyserNode | null;
560
+ play: () => void;
561
+ pause: () => void;
562
+ togglePlayPause: () => void;
563
+ stop: () => void;
564
+ setVolume: (volume: number) => void;
565
+ fade: (from: number, to: number, duration: number) => void;
566
+ setRate: (speed: number) => void;
567
+ seek: (seconds: number) => void;
568
+ mute: (muteOnOff: boolean) => void;
569
+ loop: (loopOnOff: boolean) => void;
570
+ getPosition: () => number;
571
+ load: (...args: react_use_audio_player.LoadArguments) => void;
572
+ src: string | null;
573
+ looping: boolean;
574
+ isReady: boolean;
575
+ isLoading: boolean;
576
+ paused: boolean;
577
+ stopped: boolean;
578
+ playing: boolean;
579
+ duration: number;
580
+ muted: boolean;
581
+ rate: number;
582
+ volume: number;
583
+ error: string | null;
584
+ cleanup: VoidFunction;
585
+ isPending: boolean;
586
+ isAudioPlayed: boolean;
587
+ };
588
+
589
+ type Args$3 = UseAudioCaptureProps & {
590
+ isStopOnSilence: boolean;
591
+ };
592
+ declare const useRecorder: ({ isStopOnSilence, onStart, onStop, }: Args$3) => {
593
+ status: "paused" | "idle" | "recording" | "stopped";
594
+ visualizationAnalyser: AnalyserNode | null;
595
+ start: () => Promise<void>;
596
+ stop: () => Promise<void>;
597
+ pause: () => Promise<void>;
598
+ resume: () => Promise<void>;
599
+ };
600
+
601
+ declare const statusMessages: {
602
+ recording: string;
603
+ creatingMessage: string;
604
+ runActive: string;
605
+ playing: string;
606
+ loading: string;
607
+ idle: string;
608
+ recorderPaused: string;
609
+ playerPaused: string;
610
+ acquiringMedia: string;
611
+ other: string;
612
+ };
613
+
614
+ declare const useAudioThreadContext: () => {
615
+ status: keyof typeof statusMessages;
616
+ recorderProps: ReturnType<typeof useRecorder>;
617
+ messageAudioProps: ReturnType<typeof useMessageAudio>;
618
+ };
619
+
554
620
  declare const Suggestions: {
555
621
  ({ children, className, style, }: {
556
622
  children: React.ReactNode;
@@ -664,4 +730,4 @@ type Args = {
664
730
  };
665
731
  declare const AssistantProvider: ({ children, }: Args) => react_jsx_runtime.JSX.Element;
666
732
 
667
- export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
733
+ export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
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, Avatar as Avatar$1, SerializedRunStep, ToolCall } from './types/index.js';
2
+ import { MessagesPage, ThreadStorageOptions, StyleProps, SerializedMessage, UseCreateMessageVariables, 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,11 +8,13 @@ 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';
11
13
  import OpenAI from 'openai';
12
14
  import remarkGfm from 'remark-gfm';
13
15
  import * as openai_resources_beta_threads_runs_steps from 'openai/resources/beta/threads/runs/steps';
14
16
 
15
- type Args$9 = {
17
+ type Args$a = {
16
18
  children: React.ReactNode;
17
19
  baseUrl?: string;
18
20
  variables?: {
@@ -24,7 +26,7 @@ type Args$9 = {
24
26
  };
25
27
  threadIdStorageOptions?: ThreadStorageOptions | null;
26
28
  };
27
- declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$9) => react_jsx_runtime.JSX.Element;
29
+ declare const SuperinterfaceProvider: ({ children, baseUrl, variables, defaultOptions, threadIdStorageOptions, }: Args$a) => react_jsx_runtime.JSX.Element;
28
30
 
29
31
  declare const useSuperinterfaceContext: () => {
30
32
  baseUrl: string | null;
@@ -37,14 +39,14 @@ declare const useSuperinterfaceContext: () => {
37
39
  createMessageAbortControllerRef: React.MutableRefObject<AbortController | null>;
38
40
  };
39
41
 
40
- type Args$8 = Args$9;
42
+ type Args$9 = Args$a;
41
43
 
42
- type Args$7 = Args$8 & StyleProps;
44
+ type Args$8 = Args$9 & StyleProps;
43
45
 
44
- type Args$6 = Omit<Args$7, 'children'>;
46
+ type Args$7 = Omit<Args$8, 'children'>;
45
47
  declare const Thread: {
46
- (props: Args$6): react_jsx_runtime.JSX.Element;
47
- Root: ({ children, style, className, ...rest }: Args$7) => react_jsx_runtime.JSX.Element;
48
+ (props: Args$7): react_jsx_runtime.JSX.Element;
49
+ Root: ({ children, style, className, ...rest }: Args$8) => react_jsx_runtime.JSX.Element;
48
50
  Messages: {
49
51
  ({ children, className, style, }: {
50
52
  children?: React.ReactNode;
@@ -252,7 +254,7 @@ declare const useLatestMessage: () => {
252
254
  declare const useCreateMessage: ({ onError, }?: {
253
255
  onError?: (error: unknown) => void;
254
256
  }) => {
255
- createMessage: (restobj: Omit<any, string>) => Promise<any>;
257
+ createMessage: (variables: UseCreateMessageVariables) => Promise<any>;
256
258
  data: undefined;
257
259
  variables: undefined;
258
260
  error: null;
@@ -270,7 +272,7 @@ declare const useCreateMessage: ({ onError, }?: {
270
272
  submittedAt: number;
271
273
  mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
272
274
  } | {
273
- createMessage: (restobj: Omit<any, string>) => Promise<any>;
275
+ createMessage: (variables: UseCreateMessageVariables) => Promise<any>;
274
276
  data: undefined;
275
277
  variables: any;
276
278
  error: null;
@@ -288,7 +290,7 @@ declare const useCreateMessage: ({ onError, }?: {
288
290
  submittedAt: number;
289
291
  mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
290
292
  } | {
291
- createMessage: (restobj: Omit<any, string>) => Promise<any>;
293
+ createMessage: (variables: UseCreateMessageVariables) => Promise<any>;
292
294
  data: undefined;
293
295
  error: any;
294
296
  variables: any;
@@ -306,7 +308,7 @@ declare const useCreateMessage: ({ onError, }?: {
306
308
  submittedAt: number;
307
309
  mutateAsync: _tanstack_react_query.UseMutateAsyncFunction<any, any, any, any>;
308
310
  } | {
309
- createMessage: (restobj: Omit<any, string>) => Promise<any>;
311
+ createMessage: (variables: UseCreateMessageVariables) => Promise<any>;
310
312
  data: any;
311
313
  error: null;
312
314
  variables: any;
@@ -336,10 +338,10 @@ declare const useMessageFormContext: () => {
336
338
 
337
339
  declare const useIsMutatingMessage: () => boolean;
338
340
 
339
- type Args$5 = {
341
+ type Args$6 = {
340
342
  assistantId: string;
341
343
  };
342
- declare const useAssistant: ({ assistantId, }: Args$5) => {
344
+ declare const useAssistant: ({ assistantId, }: Args$6) => {
343
345
  assistant: any;
344
346
  data: any;
345
347
  error: Error;
@@ -533,14 +535,14 @@ declare const AudioThreadDialog: {
533
535
  };
534
536
  };
535
537
 
536
- type Args$4 = {
538
+ type Args$5 = {
537
539
  children: React.ReactNode;
538
540
  } & StyleProps;
539
541
 
540
- type Args$3 = Omit<Args$4, 'children'>;
542
+ type Args$4 = Omit<Args$5, 'children'>;
541
543
  declare const AudioThread: {
542
- (props: Args$3): react_jsx_runtime.JSX.Element;
543
- Root: ({ children, ...rest }: Args$4) => react_jsx_runtime.JSX.Element;
544
+ (props: Args$4): react_jsx_runtime.JSX.Element;
545
+ Root: ({ children, ...rest }: Args$5) => react_jsx_runtime.JSX.Element;
544
546
  Visualization: (props: StyleProps) => react_jsx_runtime.JSX.Element;
545
547
  Status: (props: StyleProps) => react_jsx_runtime.JSX.Element;
546
548
  Form: (props: StyleProps) => react_jsx_runtime.JSX.Element;
@@ -551,6 +553,70 @@ declare const useThreadDialogContext: () => {
551
553
  setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
552
554
  };
553
555
 
556
+ declare const useMessageAudio: ({ onEnd, }: {
557
+ onEnd: () => void;
558
+ }) => {
559
+ visualizationAnalyser: AnalyserNode | null;
560
+ play: () => void;
561
+ pause: () => void;
562
+ togglePlayPause: () => void;
563
+ stop: () => void;
564
+ setVolume: (volume: number) => void;
565
+ fade: (from: number, to: number, duration: number) => void;
566
+ setRate: (speed: number) => void;
567
+ seek: (seconds: number) => void;
568
+ mute: (muteOnOff: boolean) => void;
569
+ loop: (loopOnOff: boolean) => void;
570
+ getPosition: () => number;
571
+ load: (...args: react_use_audio_player.LoadArguments) => void;
572
+ src: string | null;
573
+ looping: boolean;
574
+ isReady: boolean;
575
+ isLoading: boolean;
576
+ paused: boolean;
577
+ stopped: boolean;
578
+ playing: boolean;
579
+ duration: number;
580
+ muted: boolean;
581
+ rate: number;
582
+ volume: number;
583
+ error: string | null;
584
+ cleanup: VoidFunction;
585
+ isPending: boolean;
586
+ isAudioPlayed: boolean;
587
+ };
588
+
589
+ type Args$3 = UseAudioCaptureProps & {
590
+ isStopOnSilence: boolean;
591
+ };
592
+ declare const useRecorder: ({ isStopOnSilence, onStart, onStop, }: Args$3) => {
593
+ status: "paused" | "idle" | "recording" | "stopped";
594
+ visualizationAnalyser: AnalyserNode | null;
595
+ start: () => Promise<void>;
596
+ stop: () => Promise<void>;
597
+ pause: () => Promise<void>;
598
+ resume: () => Promise<void>;
599
+ };
600
+
601
+ declare const statusMessages: {
602
+ recording: string;
603
+ creatingMessage: string;
604
+ runActive: string;
605
+ playing: string;
606
+ loading: string;
607
+ idle: string;
608
+ recorderPaused: string;
609
+ playerPaused: string;
610
+ acquiringMedia: string;
611
+ other: string;
612
+ };
613
+
614
+ declare const useAudioThreadContext: () => {
615
+ status: keyof typeof statusMessages;
616
+ recorderProps: ReturnType<typeof useRecorder>;
617
+ messageAudioProps: ReturnType<typeof useMessageAudio>;
618
+ };
619
+
554
620
  declare const Suggestions: {
555
621
  ({ children, className, style, }: {
556
622
  children: React.ReactNode;
@@ -664,4 +730,4 @@ type Args = {
664
730
  };
665
731
  declare const AssistantProvider: ({ children, }: Args) => react_jsx_runtime.JSX.Element;
666
732
 
667
- export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };
733
+ export { AssistantAvatarContext, AssistantNameContext, AssistantProvider, AudioThread, AudioThreadDialog, Avatar, ComponentsProvider, FunctionBase, FunctionComponentsContext, MarkdownContext, MarkdownProvider, RunStep, Suggestions, SuperinterfaceProvider, Thread, ThreadDialog, ThreadDialogContext, UserAvatarContext, useAssistant, useAudioThreadContext, useComponents, useCreateMessage, useIsMutatingMessage, useLatestMessage, useMarkdownContext, useMessageContext, useMessageFormContext, useMessages, useSuperinterfaceContext, useSuperinterfaceContext as useThreadContext, useThreadDialogContext };