@navai/voice-frontend 0.1.1 → 0.1.3

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,4 +1,6 @@
1
1
  import { RealtimeAgent } from '@openai/agents/realtime';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { CSSProperties, ReactNode } from 'react';
2
4
 
3
5
  type NavaiFunctionPayload = Record<string, unknown>;
4
6
  type NavaiFunctionContext = {
@@ -104,6 +106,7 @@ type ResolveNavaiFrontendRuntimeConfigResult = {
104
106
  declare function resolveNavaiFrontendRuntimeConfig(options: ResolveNavaiFrontendRuntimeConfigOptions): Promise<ResolveNavaiFrontendRuntimeConfigResult>;
105
107
 
106
108
  type VoiceStatus = "idle" | "connecting" | "connected" | "error";
109
+ type AgentVoiceState = "idle" | "speaking";
107
110
  type NavaiFrontendEnv = Record<string, string | undefined>;
108
111
  type UseWebVoiceAgentOptions = {
109
112
  navigate: (path: string) => void;
@@ -119,12 +122,112 @@ type UseWebVoiceAgentOptions = {
119
122
  };
120
123
  type UseWebVoiceAgentResult = {
121
124
  status: VoiceStatus;
125
+ agentVoiceState: AgentVoiceState;
122
126
  error: string | null;
123
127
  isConnecting: boolean;
124
128
  isConnected: boolean;
129
+ isAgentSpeaking: boolean;
125
130
  start: () => Promise<void>;
126
131
  stop: () => void;
127
132
  };
128
133
  declare function useWebVoiceAgent(options: UseWebVoiceAgentOptions): UseWebVoiceAgentResult;
129
134
 
130
- export { type BuildNavaiAgentOptions, type BuildNavaiAgentResult, type CreateNavaiBackendClientOptions, type ExecuteNavaiBackendFunction, type ExecuteNavaiBackendFunctionInput, type NavaiBackendClient, type NavaiBackendFunctionDefinition, type NavaiFunctionContext, type NavaiFunctionDefinition, type NavaiFunctionModuleLoaders, type NavaiFunctionPayload, type NavaiFunctionsRegistry, type NavaiRoute, type ResolveNavaiFrontendRuntimeConfigOptions, type ResolveNavaiFrontendRuntimeConfigResult, type UseWebVoiceAgentOptions, type UseWebVoiceAgentResult, buildNavaiAgent, createNavaiBackendClient, getNavaiRoutePromptLines, loadNavaiFunctions, resolveNavaiFrontendRuntimeConfig, resolveNavaiRoute, useWebVoiceAgent };
135
+ type OrbProps = {
136
+ hue?: number;
137
+ autoHueShift?: boolean;
138
+ hueShiftMin?: number;
139
+ hueShiftMax?: number;
140
+ hueShiftHalfCycleSeconds?: number;
141
+ hoverIntensity?: number;
142
+ rotateOnHover?: boolean;
143
+ forceHoverState?: boolean;
144
+ enablePointerHover?: boolean;
145
+ backgroundColor?: string;
146
+ animate?: boolean;
147
+ };
148
+ declare function Orb({ hue, autoHueShift, hueShiftMin, hueShiftMax, hueShiftHalfCycleSeconds, hoverIntensity, rotateOnHover, forceHoverState, enablePointerHover, backgroundColor, animate }: OrbProps): react_jsx_runtime.JSX.Element;
149
+
150
+ type NavaiHeroOrbProps = {
151
+ className?: string;
152
+ backgroundColor?: string;
153
+ isAgentSpeaking?: boolean;
154
+ hoverIntensitySpeaking?: number;
155
+ hoverIntensityIdle?: number;
156
+ revealDelayMs?: number;
157
+ autoplayDelayMs?: number;
158
+ };
159
+ declare function clampNavaiOrbDelayMs(value: number, fallback: number): number;
160
+ declare function NavaiHeroOrb({ className, backgroundColor, isAgentSpeaking, hoverIntensitySpeaking, hoverIntensityIdle, revealDelayMs, autoplayDelayMs }: NavaiHeroOrbProps): react_jsx_runtime.JSX.Element | null;
161
+
162
+ type NavaiVoiceOrbThemeMode = "light" | "dark";
163
+ type NavaiVoiceOrbPlacement = "inline" | "bottom-right" | "bottom-left";
164
+ type NavaiWebVoiceAgentLike = Pick<UseWebVoiceAgentResult, "status" | "agentVoiceState" | "error" | "isConnecting" | "isConnected" | "isAgentSpeaking" | "start" | "stop">;
165
+ type NavaiVoiceOrbMessages = {
166
+ ariaStart: string;
167
+ ariaStop: string;
168
+ idle: string;
169
+ connecting: string;
170
+ listening: string;
171
+ speaking: string;
172
+ errorPrefix: string;
173
+ };
174
+ type NavaiVoiceOrbRuntimeSnapshot = {
175
+ status: UseWebVoiceAgentResult["status"];
176
+ agentVoiceState: UseWebVoiceAgentResult["agentVoiceState"];
177
+ isAgentSpeaking: boolean;
178
+ error: string | null;
179
+ };
180
+ type NavaiVoiceOrbBaseProps = {
181
+ className?: string;
182
+ style?: CSSProperties;
183
+ themeMode?: NavaiVoiceOrbThemeMode;
184
+ placement?: NavaiVoiceOrbPlacement;
185
+ backgroundColorLight?: string;
186
+ backgroundColorDark?: string;
187
+ showStatus?: boolean;
188
+ };
189
+
190
+ type NavaiMiniOrbDockProps = {
191
+ className?: string;
192
+ style?: CSSProperties;
193
+ themeMode?: NavaiVoiceOrbThemeMode;
194
+ placement?: NavaiVoiceOrbPlacement;
195
+ isActive?: boolean;
196
+ isConnected?: boolean;
197
+ isDisabled?: boolean;
198
+ isAgentSpeaking?: boolean;
199
+ animateOrb?: boolean;
200
+ backgroundColor?: string;
201
+ buttonAriaLabel: string;
202
+ buttonIcon?: ReactNode;
203
+ buttonType?: "button" | "submit" | "reset";
204
+ onButtonClick?: () => void;
205
+ statusMessage?: string;
206
+ isError?: boolean;
207
+ ariaMessage?: string;
208
+ };
209
+ declare function NavaiMiniOrbDock({ className, style, themeMode, placement, isActive, isConnected, isDisabled, isAgentSpeaking, animateOrb, backgroundColor, buttonAriaLabel, buttonIcon, buttonType, onButtonClick, statusMessage, isError, ariaMessage }: NavaiMiniOrbDockProps): react_jsx_runtime.JSX.Element;
210
+
211
+ type NavaiVoiceHeroOrbProps = Omit<NavaiHeroOrbProps, "backgroundColor" | "isAgentSpeaking"> & {
212
+ agent: NavaiWebVoiceAgentLike;
213
+ themeMode?: NavaiVoiceOrbThemeMode;
214
+ backgroundColorLight?: string;
215
+ backgroundColorDark?: string;
216
+ onRuntimeSnapshotChange?: (snapshot: NavaiVoiceOrbRuntimeSnapshot) => void;
217
+ };
218
+ declare function NavaiVoiceHeroOrb({ agent, themeMode, backgroundColorLight, backgroundColorDark, onRuntimeSnapshotChange, ...orbProps }: NavaiVoiceHeroOrbProps): react_jsx_runtime.JSX.Element;
219
+
220
+ declare function resolveNavaiVoiceOrbRuntimeSnapshot(agent: Pick<UseWebVoiceAgentResult, "status" | "agentVoiceState" | "isAgentSpeaking" | "error">): NavaiVoiceOrbRuntimeSnapshot;
221
+ type NavaiVoiceOrbDockProps = NavaiVoiceOrbBaseProps & {
222
+ agent: NavaiWebVoiceAgentLike;
223
+ messages?: Partial<NavaiVoiceOrbMessages>;
224
+ };
225
+ declare function NavaiVoiceOrbDock({ agent, className, style, themeMode, placement, backgroundColorLight, backgroundColorDark, showStatus, messages }: NavaiVoiceOrbDockProps): react_jsx_runtime.JSX.Element;
226
+
227
+ type NavaiVoiceOrbDockMicIconProps = {
228
+ isActive?: boolean;
229
+ size?: number;
230
+ };
231
+ declare function NavaiVoiceOrbDockMicIcon({ isActive, size }: NavaiVoiceOrbDockMicIconProps): react_jsx_runtime.JSX.Element;
232
+
233
+ export { type BuildNavaiAgentOptions, type BuildNavaiAgentResult, type CreateNavaiBackendClientOptions, type ExecuteNavaiBackendFunction, type ExecuteNavaiBackendFunctionInput, type NavaiBackendClient, type NavaiBackendFunctionDefinition, type NavaiFunctionContext, type NavaiFunctionDefinition, type NavaiFunctionModuleLoaders, type NavaiFunctionPayload, type NavaiFunctionsRegistry, NavaiHeroOrb, type NavaiHeroOrbProps, NavaiMiniOrbDock, type NavaiMiniOrbDockProps, type NavaiRoute, NavaiVoiceHeroOrb, type NavaiVoiceHeroOrbProps, type NavaiVoiceOrbBaseProps, NavaiVoiceOrbDock, NavaiVoiceOrbDockMicIcon, type NavaiVoiceOrbDockProps, type NavaiVoiceOrbMessages, type NavaiVoiceOrbPlacement, type NavaiVoiceOrbRuntimeSnapshot, type NavaiVoiceOrbThemeMode, type NavaiWebVoiceAgentLike, Orb, type OrbProps, type ResolveNavaiFrontendRuntimeConfigOptions, type ResolveNavaiFrontendRuntimeConfigResult, type UseWebVoiceAgentOptions, type UseWebVoiceAgentResult, buildNavaiAgent, clampNavaiOrbDelayMs, createNavaiBackendClient, getNavaiRoutePromptLines, loadNavaiFunctions, resolveNavaiFrontendRuntimeConfig, resolveNavaiRoute, resolveNavaiVoiceOrbRuntimeSnapshot, useWebVoiceAgent };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { RealtimeAgent } from '@openai/agents/realtime';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { CSSProperties, ReactNode } from 'react';
2
4
 
3
5
  type NavaiFunctionPayload = Record<string, unknown>;
4
6
  type NavaiFunctionContext = {
@@ -104,6 +106,7 @@ type ResolveNavaiFrontendRuntimeConfigResult = {
104
106
  declare function resolveNavaiFrontendRuntimeConfig(options: ResolveNavaiFrontendRuntimeConfigOptions): Promise<ResolveNavaiFrontendRuntimeConfigResult>;
105
107
 
106
108
  type VoiceStatus = "idle" | "connecting" | "connected" | "error";
109
+ type AgentVoiceState = "idle" | "speaking";
107
110
  type NavaiFrontendEnv = Record<string, string | undefined>;
108
111
  type UseWebVoiceAgentOptions = {
109
112
  navigate: (path: string) => void;
@@ -119,12 +122,112 @@ type UseWebVoiceAgentOptions = {
119
122
  };
120
123
  type UseWebVoiceAgentResult = {
121
124
  status: VoiceStatus;
125
+ agentVoiceState: AgentVoiceState;
122
126
  error: string | null;
123
127
  isConnecting: boolean;
124
128
  isConnected: boolean;
129
+ isAgentSpeaking: boolean;
125
130
  start: () => Promise<void>;
126
131
  stop: () => void;
127
132
  };
128
133
  declare function useWebVoiceAgent(options: UseWebVoiceAgentOptions): UseWebVoiceAgentResult;
129
134
 
130
- export { type BuildNavaiAgentOptions, type BuildNavaiAgentResult, type CreateNavaiBackendClientOptions, type ExecuteNavaiBackendFunction, type ExecuteNavaiBackendFunctionInput, type NavaiBackendClient, type NavaiBackendFunctionDefinition, type NavaiFunctionContext, type NavaiFunctionDefinition, type NavaiFunctionModuleLoaders, type NavaiFunctionPayload, type NavaiFunctionsRegistry, type NavaiRoute, type ResolveNavaiFrontendRuntimeConfigOptions, type ResolveNavaiFrontendRuntimeConfigResult, type UseWebVoiceAgentOptions, type UseWebVoiceAgentResult, buildNavaiAgent, createNavaiBackendClient, getNavaiRoutePromptLines, loadNavaiFunctions, resolveNavaiFrontendRuntimeConfig, resolveNavaiRoute, useWebVoiceAgent };
135
+ type OrbProps = {
136
+ hue?: number;
137
+ autoHueShift?: boolean;
138
+ hueShiftMin?: number;
139
+ hueShiftMax?: number;
140
+ hueShiftHalfCycleSeconds?: number;
141
+ hoverIntensity?: number;
142
+ rotateOnHover?: boolean;
143
+ forceHoverState?: boolean;
144
+ enablePointerHover?: boolean;
145
+ backgroundColor?: string;
146
+ animate?: boolean;
147
+ };
148
+ declare function Orb({ hue, autoHueShift, hueShiftMin, hueShiftMax, hueShiftHalfCycleSeconds, hoverIntensity, rotateOnHover, forceHoverState, enablePointerHover, backgroundColor, animate }: OrbProps): react_jsx_runtime.JSX.Element;
149
+
150
+ type NavaiHeroOrbProps = {
151
+ className?: string;
152
+ backgroundColor?: string;
153
+ isAgentSpeaking?: boolean;
154
+ hoverIntensitySpeaking?: number;
155
+ hoverIntensityIdle?: number;
156
+ revealDelayMs?: number;
157
+ autoplayDelayMs?: number;
158
+ };
159
+ declare function clampNavaiOrbDelayMs(value: number, fallback: number): number;
160
+ declare function NavaiHeroOrb({ className, backgroundColor, isAgentSpeaking, hoverIntensitySpeaking, hoverIntensityIdle, revealDelayMs, autoplayDelayMs }: NavaiHeroOrbProps): react_jsx_runtime.JSX.Element | null;
161
+
162
+ type NavaiVoiceOrbThemeMode = "light" | "dark";
163
+ type NavaiVoiceOrbPlacement = "inline" | "bottom-right" | "bottom-left";
164
+ type NavaiWebVoiceAgentLike = Pick<UseWebVoiceAgentResult, "status" | "agentVoiceState" | "error" | "isConnecting" | "isConnected" | "isAgentSpeaking" | "start" | "stop">;
165
+ type NavaiVoiceOrbMessages = {
166
+ ariaStart: string;
167
+ ariaStop: string;
168
+ idle: string;
169
+ connecting: string;
170
+ listening: string;
171
+ speaking: string;
172
+ errorPrefix: string;
173
+ };
174
+ type NavaiVoiceOrbRuntimeSnapshot = {
175
+ status: UseWebVoiceAgentResult["status"];
176
+ agentVoiceState: UseWebVoiceAgentResult["agentVoiceState"];
177
+ isAgentSpeaking: boolean;
178
+ error: string | null;
179
+ };
180
+ type NavaiVoiceOrbBaseProps = {
181
+ className?: string;
182
+ style?: CSSProperties;
183
+ themeMode?: NavaiVoiceOrbThemeMode;
184
+ placement?: NavaiVoiceOrbPlacement;
185
+ backgroundColorLight?: string;
186
+ backgroundColorDark?: string;
187
+ showStatus?: boolean;
188
+ };
189
+
190
+ type NavaiMiniOrbDockProps = {
191
+ className?: string;
192
+ style?: CSSProperties;
193
+ themeMode?: NavaiVoiceOrbThemeMode;
194
+ placement?: NavaiVoiceOrbPlacement;
195
+ isActive?: boolean;
196
+ isConnected?: boolean;
197
+ isDisabled?: boolean;
198
+ isAgentSpeaking?: boolean;
199
+ animateOrb?: boolean;
200
+ backgroundColor?: string;
201
+ buttonAriaLabel: string;
202
+ buttonIcon?: ReactNode;
203
+ buttonType?: "button" | "submit" | "reset";
204
+ onButtonClick?: () => void;
205
+ statusMessage?: string;
206
+ isError?: boolean;
207
+ ariaMessage?: string;
208
+ };
209
+ declare function NavaiMiniOrbDock({ className, style, themeMode, placement, isActive, isConnected, isDisabled, isAgentSpeaking, animateOrb, backgroundColor, buttonAriaLabel, buttonIcon, buttonType, onButtonClick, statusMessage, isError, ariaMessage }: NavaiMiniOrbDockProps): react_jsx_runtime.JSX.Element;
210
+
211
+ type NavaiVoiceHeroOrbProps = Omit<NavaiHeroOrbProps, "backgroundColor" | "isAgentSpeaking"> & {
212
+ agent: NavaiWebVoiceAgentLike;
213
+ themeMode?: NavaiVoiceOrbThemeMode;
214
+ backgroundColorLight?: string;
215
+ backgroundColorDark?: string;
216
+ onRuntimeSnapshotChange?: (snapshot: NavaiVoiceOrbRuntimeSnapshot) => void;
217
+ };
218
+ declare function NavaiVoiceHeroOrb({ agent, themeMode, backgroundColorLight, backgroundColorDark, onRuntimeSnapshotChange, ...orbProps }: NavaiVoiceHeroOrbProps): react_jsx_runtime.JSX.Element;
219
+
220
+ declare function resolveNavaiVoiceOrbRuntimeSnapshot(agent: Pick<UseWebVoiceAgentResult, "status" | "agentVoiceState" | "isAgentSpeaking" | "error">): NavaiVoiceOrbRuntimeSnapshot;
221
+ type NavaiVoiceOrbDockProps = NavaiVoiceOrbBaseProps & {
222
+ agent: NavaiWebVoiceAgentLike;
223
+ messages?: Partial<NavaiVoiceOrbMessages>;
224
+ };
225
+ declare function NavaiVoiceOrbDock({ agent, className, style, themeMode, placement, backgroundColorLight, backgroundColorDark, showStatus, messages }: NavaiVoiceOrbDockProps): react_jsx_runtime.JSX.Element;
226
+
227
+ type NavaiVoiceOrbDockMicIconProps = {
228
+ isActive?: boolean;
229
+ size?: number;
230
+ };
231
+ declare function NavaiVoiceOrbDockMicIcon({ isActive, size }: NavaiVoiceOrbDockMicIconProps): react_jsx_runtime.JSX.Element;
232
+
233
+ export { type BuildNavaiAgentOptions, type BuildNavaiAgentResult, type CreateNavaiBackendClientOptions, type ExecuteNavaiBackendFunction, type ExecuteNavaiBackendFunctionInput, type NavaiBackendClient, type NavaiBackendFunctionDefinition, type NavaiFunctionContext, type NavaiFunctionDefinition, type NavaiFunctionModuleLoaders, type NavaiFunctionPayload, type NavaiFunctionsRegistry, NavaiHeroOrb, type NavaiHeroOrbProps, NavaiMiniOrbDock, type NavaiMiniOrbDockProps, type NavaiRoute, NavaiVoiceHeroOrb, type NavaiVoiceHeroOrbProps, type NavaiVoiceOrbBaseProps, NavaiVoiceOrbDock, NavaiVoiceOrbDockMicIcon, type NavaiVoiceOrbDockProps, type NavaiVoiceOrbMessages, type NavaiVoiceOrbPlacement, type NavaiVoiceOrbRuntimeSnapshot, type NavaiVoiceOrbThemeMode, type NavaiWebVoiceAgentLike, Orb, type OrbProps, type ResolveNavaiFrontendRuntimeConfigOptions, type ResolveNavaiFrontendRuntimeConfigResult, type UseWebVoiceAgentOptions, type UseWebVoiceAgentResult, buildNavaiAgent, clampNavaiOrbDelayMs, createNavaiBackendClient, getNavaiRoutePromptLines, loadNavaiFunctions, resolveNavaiFrontendRuntimeConfig, resolveNavaiRoute, resolveNavaiVoiceOrbRuntimeSnapshot, useWebVoiceAgent };