orb-ui 0.2.3 → 0.3.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.
@@ -0,0 +1,14 @@
1
+ import { CSSProperties } from 'react';
2
+ import { OrbHtmlAttributes, OrbState } from '../../components/Orb/Orb.types.js';
3
+ interface BarsThemeProps extends OrbHtmlAttributes {
4
+ state: OrbState;
5
+ volume: number;
6
+ size: number;
7
+ className?: string;
8
+ style?: CSSProperties;
9
+ disabled?: boolean;
10
+ interactive?: boolean;
11
+ onClick?: () => void;
12
+ }
13
+ export declare function BarsTheme({ state, volume, size, className, style, disabled, interactive, onClick, ...controlProps }: BarsThemeProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1 @@
1
+ export { BarsTheme } from './BarsTheme.js';
@@ -0,0 +1,14 @@
1
+ import { CSSProperties } from 'react';
2
+ import { OrbHtmlAttributes, OrbState } from '../../components/Orb/Orb.types.js';
3
+ interface CircleThemeProps extends OrbHtmlAttributes {
4
+ state: OrbState;
5
+ volume: number;
6
+ size: number;
7
+ className?: string;
8
+ style?: CSSProperties;
9
+ disabled?: boolean;
10
+ interactive?: boolean;
11
+ onClick?: () => void;
12
+ }
13
+ export declare function CircleTheme({ state, volume, size, className, style, disabled, interactive, onClick, ...controlProps }: CircleThemeProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1 @@
1
+ export { CircleTheme } from './CircleTheme.js';
@@ -0,0 +1,15 @@
1
+ import { CSSProperties, HTMLAttributes } from 'react';
2
+ import { OrbState } from '../../components/Orb/Orb.types.js';
3
+ type DebugThemeRootProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className' | 'style'>;
4
+ interface DebugThemeProps extends DebugThemeRootProps {
5
+ state: OrbState;
6
+ volume: number;
7
+ size: number;
8
+ className?: string;
9
+ style?: CSSProperties;
10
+ disabled?: boolean;
11
+ onStart?: () => void;
12
+ onStop?: () => void;
13
+ }
14
+ export declare function DebugTheme({ state, volume, size, className, style, disabled, onStart, onStop, ...rootProps }: DebugThemeProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1 @@
1
+ export { DebugTheme } from './DebugTheme.js';
@@ -0,0 +1,3 @@
1
+ export { DebugTheme } from './debug/index.js';
2
+ export { CircleTheme } from './circle/index.js';
3
+ export { BarsTheme } from './bars/index.js';
package/package.json CHANGED
@@ -1,60 +1,69 @@
1
1
  {
2
2
  "name": "orb-ui",
3
- "version": "0.2.3",
4
- "description": "The simplest way to add voice UI to your React app. One install, one component, works with Vapi and ElevenLabs out of the box.",
3
+ "version": "0.3.0",
4
+ "description": "React voice agent UI components with animated voice orbs, audio-reactive themes, and adapters for Vapi, ElevenLabs, LiveKit, and custom realtime voice AI apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/orb-ui.cjs",
7
7
  "module": "./dist/orb-ui.js",
8
- "types": "./dist/orb-ui.d.ts",
8
+ "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
+ "types": "./dist/index.d.ts",
11
12
  "import": "./dist/orb-ui.js",
12
- "require": "./dist/orb-ui.cjs",
13
- "types": "./dist/orb-ui.d.ts"
13
+ "require": "./dist/orb-ui.cjs"
14
14
  },
15
15
  "./adapters": {
16
+ "types": "./dist/adapters/index.d.ts",
16
17
  "import": "./dist/adapters.js",
17
- "require": "./dist/adapters.cjs",
18
- "types": "./dist/adapters.d.ts"
18
+ "require": "./dist/adapters.cjs"
19
19
  }
20
20
  },
21
21
  "files": [
22
22
  "dist"
23
23
  ],
24
- "scripts": {
25
- "build": "tsc && vite build",
26
- "dev": "vite build --watch",
27
- "typecheck": "tsc --noEmit",
28
- "lint": "eslint src",
29
- "test": "vitest"
30
- },
31
24
  "peerDependencies": {
32
25
  "react": ">=18.0.0",
33
26
  "react-dom": ">=18.0.0"
34
27
  },
35
28
  "devDependencies": {
36
- "@types/react": "^18.3.0",
37
- "@types/react-dom": "^18.3.0",
38
- "@typescript-eslint/eslint-plugin": "^7.0.0",
39
- "@typescript-eslint/parser": "^7.0.0",
40
- "@vitejs/plugin-react": "^4.3.0",
41
- "eslint": "^8.57.0",
42
- "typescript": "^5.4.0",
43
- "vite": "^5.3.0",
44
- "vite-plugin-dts": "^3.9.0",
45
- "vitest": "^1.6.0"
29
+ "@changesets/cli": "^2.31.0",
30
+ "@elevenlabs/client": "1.9.0",
31
+ "@eslint/js": "^10.0.1",
32
+ "@types/react": "^18.3.29",
33
+ "@types/react-dom": "^18.3.7",
34
+ "@vapi-ai/web": "2.5.2",
35
+ "@vitejs/plugin-react": "^6.0.2",
36
+ "eslint": "^10.4.0",
37
+ "globals": "^17.6.0",
38
+ "livekit-client": "2.20.0",
39
+ "prettier": "^3.8.3",
40
+ "react": "^18.3.1",
41
+ "react-dom": "^18.3.1",
42
+ "typescript": "^5.9.3",
43
+ "typescript-eslint": "^8.59.4",
44
+ "vite": "^8.0.14",
45
+ "vite-plugin-dts": "^5.0.1",
46
+ "vitest": "^4.1.7"
46
47
  },
47
48
  "keywords": [
48
49
  "voice",
49
50
  "voice-ui",
50
51
  "voice-agent",
52
+ "voice-agent-ui",
53
+ "voice-ai-ui",
54
+ "react-voice-ai",
55
+ "react-voice-component",
51
56
  "ai",
52
57
  "react",
53
58
  "animation",
54
59
  "component",
60
+ "orb",
61
+ "voice-orb",
62
+ "realtime-voice",
55
63
  "state-machine",
56
64
  "vapi",
57
- "elevenlabs"
65
+ "elevenlabs",
66
+ "livekit"
58
67
  ],
59
68
  "license": "MIT",
60
69
  "author": "Alexander Chen",
@@ -63,12 +72,29 @@
63
72
  "type": "git",
64
73
  "url": "https://github.com/alexanderqchen/orb-ui.git"
65
74
  },
66
- "dependencies": {},
67
75
  "typesVersions": {
68
76
  "*": {
69
77
  "adapters": [
70
- "./dist/adapters.d.ts"
78
+ "./dist/adapters/index.d.ts"
71
79
  ]
72
80
  }
81
+ },
82
+ "scripts": {
83
+ "build": "tsc && vite build",
84
+ "build:demo": "pnpm --filter orb-ui-demo build",
85
+ "changeset": "changeset",
86
+ "check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm typecheck:examples && pnpm test && pnpm build && pnpm typecheck:package && pnpm typecheck:demo && pnpm build:demo",
87
+ "dev": "vite build --watch",
88
+ "dev:demo": "pnpm --filter orb-ui-demo dev",
89
+ "format": "prettier . --write",
90
+ "format:check": "prettier . --check",
91
+ "typecheck": "tsc --noEmit",
92
+ "typecheck:demo": "pnpm --filter orb-ui-demo typecheck",
93
+ "typecheck:examples": "tsc -p tsconfig.type-tests.json --noEmit",
94
+ "typecheck:package": "tsc -p tsconfig.package-types.json --noEmit",
95
+ "lint": "eslint .",
96
+ "release": "pnpm build && changeset publish",
97
+ "test": "vitest run --passWithNoTests",
98
+ "test:watch": "vitest"
73
99
  }
74
- }
100
+ }
@@ -1,145 +0,0 @@
1
- export declare interface AdapterCallbacks {
2
- onStateChange: (state: OrbState) => void;
3
- onVolumeChange: (volume: number) => void;
4
- }
5
-
6
- /**
7
- * Creates an OrbAdapter for ElevenLabs Conversational AI.
8
- *
9
- * Unlike createVapiAdapter, this adapter owns the session lifecycle because
10
- * ElevenLabs requires callbacks to be injected at Conversation.startSession()
11
- * time. Use the returned start() and stop() methods with Orb's props.
12
- *
13
- * @param ConversationClass - The Conversation class from @elevenlabs/client
14
- * @param config - agentId / signedUrl + any other startSession options
15
- *
16
- * @example
17
- * import { Conversation } from '@elevenlabs/client'
18
- * import { Orb } from 'orb-ui'
19
- * import { createElevenLabsAdapter } from 'orb-ui/adapters'
20
- *
21
- * const adapter = createElevenLabsAdapter(Conversation, {
22
- * agentId: 'your-agent-id',
23
- * })
24
- *
25
- * function App() {
26
- * return (
27
- * <Orb
28
- * adapter={adapter}
29
- * theme="circle"
30
- * onStart={() => adapter.start()}
31
- * onStop={() => adapter.stop()}
32
- * />
33
- * )
34
- * }
35
- */
36
- export declare function createElevenLabsAdapter(ConversationClass: ElevenLabsConversationClass, config: ElevenLabsConfig): ElevenLabsOrbAdapter;
37
-
38
- export declare function createVapiAdapter(client: VapiClient, options?: VapiAdapterOptions): OrbAdapter;
39
-
40
- declare interface ElevenLabsCallbacks {
41
- onConnect?: (props: {
42
- conversationId: string;
43
- }) => void;
44
- onDisconnect?: (details: unknown) => void;
45
- onError?: (message: string, context?: unknown) => void;
46
- onModeChange?: (prop: {
47
- mode: ElevenLabsMode;
48
- }) => void;
49
- onStatusChange?: (prop: {
50
- status: ElevenLabsStatus;
51
- }) => void;
52
- onVadScore?: (props: {
53
- vadScore: number;
54
- }) => void;
55
- }
56
-
57
- declare type ElevenLabsConfig = {
58
- agentId?: string;
59
- signedUrl?: string;
60
- [key: string]: unknown;
61
- };
62
-
63
- declare interface ElevenLabsConversation {
64
- endSession(): Promise<void>;
65
- getInputVolume(): number;
66
- getOutputVolume(): number;
67
- getInputByteFrequencyData(): Uint8Array;
68
- getOutputByteFrequencyData(): Uint8Array;
69
- }
70
-
71
- declare interface ElevenLabsConversationClass {
72
- startSession(options: ElevenLabsConfig & ElevenLabsCallbacks): Promise<ElevenLabsConversation>;
73
- }
74
-
75
- declare type ElevenLabsMode = 'speaking' | 'listening';
76
-
77
- export declare interface ElevenLabsOrbAdapter extends OrbAdapter {
78
- /** Call this from Orb's onStart prop to begin a conversation. */
79
- start(): Promise<void>;
80
- /** Call this from Orb's onStop prop to end the current conversation. */
81
- stop(): Promise<void>;
82
- }
83
-
84
- declare type ElevenLabsStatus = 'disconnected' | 'connecting' | 'connected' | 'disconnecting';
85
-
86
- export declare interface OrbAdapter {
87
- /**
88
- * Subscribe to state and volume changes from a voice provider.
89
- * Returns an unsubscribe function to clean up listeners.
90
- */
91
- subscribe(callbacks: {
92
- onStateChange: (state: OrbState) => void;
93
- onVolumeChange: (volume: number) => void;
94
- }): () => void;
95
- /** Start the voice session. Called internally by Orb on click. */
96
- start?: () => void | Promise<void>;
97
- /** Stop the voice session. Called internally by Orb on click. */
98
- stop?: () => void | Promise<void>;
99
- }
100
-
101
- export declare type OrbState = 'idle' | 'connecting' | 'listening' | 'speaking' | 'error';
102
-
103
- /**
104
- * Creates an OrbAdapter for Vapi voice agents.
105
- *
106
- * State mapping:
107
- * vapi.start() called (intercepted) → 'connecting'
108
- * call-start → 'listening'
109
- * speech-start → 'speaking'
110
- * speech-end → 'listening' (debounced 350 ms)
111
- * call-end → 'idle'
112
- * error → 'error'
113
- *
114
- * Volume: raw Vapi values are normalized (noise gate + EMA) before being
115
- * passed to onVolumeChange, so themes receive a clean 0–1 signal.
116
- *
117
- * @param client - A Vapi instance from @vapi-ai/web
118
- * @param options - Optional config (e.g. assistantId to pass to vapi.start())
119
- */
120
- declare interface VapiAdapterOptions {
121
- /** Assistant ID passed to vapi.start() when the orb is clicked. */
122
- assistantId?: string;
123
- }
124
-
125
- declare interface VapiClient {
126
- on(event: 'call-start', listener: () => void): void;
127
- on(event: 'call-end', listener: () => void): void;
128
- on(event: 'speech-start', listener: () => void): void;
129
- on(event: 'speech-end', listener: () => void): void;
130
- on(event: 'volume-level', listener: (volume: number) => void): void;
131
- on(event: 'message', listener: (message: VapiMessage) => void): void;
132
- on(event: 'error', listener: (error: unknown) => void): void;
133
- removeListener(event: string, listener: (...args: unknown[]) => void): void;
134
- start(...args: any[]): Promise<unknown>;
135
- stop(): void;
136
- }
137
-
138
- declare interface VapiMessage {
139
- type: string;
140
- role?: string;
141
- transcriptType?: 'partial' | 'final';
142
- transcript?: string;
143
- }
144
-
145
- export { }
package/dist/orb-ui.d.ts DELETED
@@ -1,56 +0,0 @@
1
- import { JSX as JSX_2 } from 'react/jsx-runtime';
2
-
3
- declare function Orb({ state: stateProp, volume: volumeProp, adapter, theme, size, className, style, onStart, onStop, }: OrbProps): JSX_2.Element;
4
- export { Orb }
5
- export { Orb as VoiceOrb }
6
-
7
- export declare interface OrbAdapter {
8
- /**
9
- * Subscribe to state and volume changes from a voice provider.
10
- * Returns an unsubscribe function to clean up listeners.
11
- */
12
- subscribe(callbacks: {
13
- onStateChange: (state: OrbState) => void;
14
- onVolumeChange: (volume: number) => void;
15
- }): () => void;
16
- /** Start the voice session. Called internally by Orb on click. */
17
- start?: () => void | Promise<void>;
18
- /** Stop the voice session. Called internally by Orb on click. */
19
- stop?: () => void | Promise<void>;
20
- }
21
-
22
- declare interface OrbProps {
23
- /**
24
- * Current conversation state. Required in controlled mode (no adapter).
25
- * Overrides adapter state if both are provided.
26
- */
27
- state?: OrbState;
28
- /**
29
- * Current audio volume, normalized 0–1.
30
- * Overrides adapter volume if both are provided.
31
- */
32
- volume?: number;
33
- /**
34
- * Provider adapter (Vapi, ElevenLabs, etc.).
35
- * Handles state and volume automatically from the SDK.
36
- */
37
- adapter?: OrbAdapter;
38
- /** Visual theme. Defaults to 'debug'. */
39
- theme?: OrbTheme;
40
- /** Size in pixels. Defaults to 200. */
41
- size?: number;
42
- className?: string;
43
- style?: React.CSSProperties;
44
- /** Called when the Start button is clicked (debug theme only). */
45
- onStart?: () => void;
46
- /** Called when the Stop button is clicked (debug theme only). */
47
- onStop?: () => void;
48
- }
49
- export { OrbProps }
50
- export { OrbProps as VoiceOrbProps }
51
-
52
- export declare type OrbState = 'idle' | 'connecting' | 'listening' | 'speaking' | 'error';
53
-
54
- export declare type OrbTheme = 'debug' | 'circle' | 'bars';
55
-
56
- export { }