orb-ui 0.6.1 → 0.8.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/README.md +99 -37
- package/dist/adapters/audio-level.d.ts +57 -20
- package/dist/adapters/elevenlabs/index.d.ts +13 -2
- package/dist/adapters/gemini-live/index.d.ts +9 -5
- package/dist/adapters/index.d.ts +3 -2
- package/dist/adapters/livekit/browser.d.ts +9 -5
- package/dist/adapters/livekit/index.d.ts +9 -5
- package/dist/adapters/openai-realtime/index.d.ts +9 -5
- package/dist/adapters/pipecat/index.d.ts +9 -5
- package/dist/adapters/types.d.ts +0 -5
- package/dist/adapters/vapi/index.d.ts +29 -3
- package/dist/adapters/volume-presets.d.ts +35 -0
- package/dist/adapters.cjs +1 -1
- package/dist/adapters.js +405 -457
- package/dist/components/Orb/Orb.d.ts +1 -1
- package/dist/components/Orb/Orb.types.d.ts +92 -15
- package/dist/components/Orb/OrbThemeProvider.d.ts +16 -0
- package/dist/components/Orb/index.d.ts +6 -1
- package/dist/components/Orb/signals.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/livekit-7Re8E7By.js +394 -0
- package/dist/livekit-C36Kmz6s.cjs +1 -0
- package/dist/livekit-adapter.cjs +1 -1
- package/dist/livekit-adapter.js +6 -4
- package/dist/orb-ui.cjs +96 -4
- package/dist/orb-ui.js +1461 -407
- package/dist/themes/bars/BarsTheme.d.ts +8 -4
- package/dist/themes/circle/CircleTheme.d.ts +8 -4
- package/dist/themes/cloud/CloudTheme.d.ts +8 -4
- package/dist/themes/config.d.ts +151 -0
- package/dist/themes/css-variables.d.ts +5 -0
- package/dist/themes/debug/DebugTheme.d.ts +11 -6
- package/dist/themes/index.d.ts +1 -0
- package/dist/themes/radial/RadialTheme.d.ts +19 -0
- package/dist/themes/radial/index.d.ts +1 -0
- package/dist/themes/slots.d.ts +4 -0
- package/package.json +3 -2
- package/dist/livekit-CukEeYFK.js +0 -316
- package/dist/livekit-Dt-QZ6Gs.cjs +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# orb-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Voice agent UI that feels alive.**
|
|
4
|
+
|
|
5
|
+
Expressive, accessible React components for realtime voice agents. Connect Vapi, ElevenLabs, LiveKit, Pipecat, OpenAI Realtime, Gemini Live, or your own voice stack through one consistent UI layer.
|
|
4
6
|
|
|
5
7
|
<p align="center">
|
|
6
8
|
<a href="https://orb-ui.com">
|
|
7
|
-
<img src="
|
|
9
|
+
<img src="demo/public/og-image-v2.jpg" alt="orb-ui — Voice agent UI that feels alive" width="900" />
|
|
8
10
|
</a>
|
|
9
11
|
</p>
|
|
10
12
|
|
|
11
13
|
<p align="center">
|
|
12
|
-
<a href="https://orb-ui.com">Live
|
|
14
|
+
<a href="https://orb-ui.com">Live demo</a> · <a href="https://orb-ui.com/docs">Documentation</a> · <a href="https://orb-ui.com/playground">Playground</a> · <a href="https://www.npmjs.com/package/orb-ui">npm</a> · <a href="https://github.com/alexanderqchen/orb-ui">Star on GitHub</a>
|
|
13
15
|
</p>
|
|
14
16
|
|
|
15
17
|
```jsx
|
|
@@ -25,6 +27,9 @@ export function VoiceOrb() {
|
|
|
25
27
|
}
|
|
26
28
|
```
|
|
27
29
|
|
|
30
|
+
Vapi uses its existing microphone track for listening motion and its assistant audio events for
|
|
31
|
+
speaking motion. The adapter keeps microphone and output calibration separate.
|
|
32
|
+
|
|
28
33
|
## Install
|
|
29
34
|
|
|
30
35
|
Install the component package:
|
|
@@ -67,20 +72,23 @@ Every provider ends at the same React API:
|
|
|
67
72
|
|
|
68
73
|
The only difference is how the adapter obtains a provider session:
|
|
69
74
|
|
|
70
|
-
| Provider
|
|
71
|
-
|
|
|
72
|
-
| Vapi
|
|
73
|
-
| ElevenLabs
|
|
74
|
-
| LiveKit
|
|
75
|
-
| Pipecat
|
|
76
|
-
| OpenAI Realtime | Return a fresh short-lived client secret from `getClientSecret` |
|
|
77
|
-
| Gemini Live
|
|
75
|
+
| Provider | Required browser setup |
|
|
76
|
+
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
77
|
+
| [Vapi guide](https://orb-ui.com/docs/adapters/vapi) | Pass a configured Vapi client plus `assistantId` |
|
|
78
|
+
| [ElevenLabs guide](https://orb-ui.com/docs/adapters/elevenlabs) | Pass `Conversation` plus an `agentId`, signed URL, or conversation token |
|
|
79
|
+
| [LiveKit guide](https://orb-ui.com/docs/adapters/livekit) | Provide a token endpoint and optional agent name |
|
|
80
|
+
| [Pipecat guide](https://orb-ui.com/docs/adapters/pipecat) | Pass a configured `PipecatClient` plus its connect callback |
|
|
81
|
+
| [OpenAI Realtime guide](https://orb-ui.com/docs/adapters/openai-realtime) | Return a fresh short-lived client secret from `getClientSecret` |
|
|
82
|
+
| [Gemini Live guide](https://orb-ui.com/docs/adapters/gemini-live) | Open the official Google Live session in `connect` |
|
|
78
83
|
|
|
79
84
|
The adapter owns provider event mapping and emits one consistent `OrbSignal`. OpenAI and Gemini
|
|
80
85
|
standard API keys, and LiveKit participant-token signing, stay on your server. See the
|
|
81
86
|
[adapter overview](https://orb-ui.com/docs/adapters/overview) for the responsibility boundary and
|
|
82
87
|
advanced setup shapes.
|
|
83
88
|
|
|
89
|
+
For an app-owned WebRTC, WebSocket, telephony, or speech runtime, follow the
|
|
90
|
+
[custom integration guide](https://orb-ui.com/docs/adapters/custom).
|
|
91
|
+
|
|
84
92
|
## Quick Start
|
|
85
93
|
|
|
86
94
|
Use orb-ui as a React voice AI component when you need a first-party provider voice UI or a custom animated voice orb for another realtime voice agent stack.
|
|
@@ -212,7 +220,16 @@ function App() {
|
|
|
212
220
|
const [state, setState] = useState('idle')
|
|
213
221
|
const [volume, setVolume] = useState(0)
|
|
214
222
|
|
|
215
|
-
return
|
|
223
|
+
return (
|
|
224
|
+
<Orb
|
|
225
|
+
signal={{
|
|
226
|
+
state,
|
|
227
|
+
inputVolume: state === 'listening' ? volume : 0,
|
|
228
|
+
outputVolume: state === 'speaking' ? volume : 0,
|
|
229
|
+
}}
|
|
230
|
+
theme="circle"
|
|
231
|
+
/>
|
|
232
|
+
)
|
|
216
233
|
}
|
|
217
234
|
```
|
|
218
235
|
|
|
@@ -226,6 +243,44 @@ function App() {
|
|
|
226
243
|
}
|
|
227
244
|
```
|
|
228
245
|
|
|
246
|
+
### Theme presets and overrides
|
|
247
|
+
|
|
248
|
+
Theme strings keep the current balanced behavior. Choose `calm` or `expressive`, then override only
|
|
249
|
+
the theme-specific values your product needs:
|
|
250
|
+
|
|
251
|
+
```jsx
|
|
252
|
+
<Orb
|
|
253
|
+
signal={signal}
|
|
254
|
+
theme={{
|
|
255
|
+
name: 'circle',
|
|
256
|
+
preset: 'calm',
|
|
257
|
+
appearance: { colors: { listening: '#8b9cff', speaking: '#f4f7ff' } },
|
|
258
|
+
motion: { responseExponent: 0.9, activityRiseMs: 80, activityFallMs: 180 },
|
|
259
|
+
}}
|
|
260
|
+
/>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
See the [theme customization guide](https://orb-ui.com/docs/themes/customization) for every
|
|
264
|
+
theme-specific appearance, geometry, and motion field.
|
|
265
|
+
|
|
266
|
+
For application-wide defaults, stable internal slots, responsive CSS variables, or completely
|
|
267
|
+
custom artwork, use the advanced customization layer:
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
import { Orb, OrbThemeProvider } from 'orb-ui'
|
|
271
|
+
;<OrbThemeProvider theme={{ name: 'circle', preset: 'calm' }}>
|
|
272
|
+
<Orb
|
|
273
|
+
adapter={adapter}
|
|
274
|
+
style={{ '--orb-ui-size': 'clamp(180px, 32vw, 320px)' }}
|
|
275
|
+
slotProps={{ surface: { className: 'brand-orb__surface' } }}
|
|
276
|
+
/>
|
|
277
|
+
</OrbThemeProvider>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Pass `renderTheme` when your product needs entirely custom DOM, SVG, canvas, or WebGL artwork. Its
|
|
281
|
+
renderer receives normalized input/output activity plus accessible root/control props, while Orb
|
|
282
|
+
continues to manage provider subscription and session start/stop behavior.
|
|
283
|
+
|
|
229
284
|
### External session controls
|
|
230
285
|
|
|
231
286
|
Keep the orb as a passive visual when start and stop controls belong elsewhere in your layout.
|
|
@@ -247,30 +302,37 @@ function VoiceExperience({ adapter }) {
|
|
|
247
302
|
|
|
248
303
|
| Theme | Description |
|
|
249
304
|
| -------- | ----------------------------------------------------------------------------- |
|
|
305
|
+
| `radial` | Four-lobe radial field with input-reactive rim and output-reactive twisting. |
|
|
250
306
|
| `cloud` | Atmospheric sphere with inverse listening scale and faster speaking motion. |
|
|
251
307
|
| `debug` | State + volume display with start/stop. Use to verify your integration works. |
|
|
252
308
|
| `circle` | Pulsing circle that reacts to volume. |
|
|
253
309
|
| `bars` | Five bars that animate with voice. |
|
|
254
310
|
|
|
255
|
-
When an adapter or `onStart`/`onStop` handler is provided, visual themes
|
|
311
|
+
When an adapter or `onStart`/`onStop` handler is provided, visual themes include keyboard-accessible `<button type="button">` controls. `radial` places its phone control below the artwork while the other clickable themes use the visual itself. Pass `interactive={false}` to keep the theme passive and call `adapter.start()` or `adapter.stop()` from external controls instead.
|
|
312
|
+
|
|
313
|
+
The radial phone control uses a small cutout that defaults to white. Match it to the surface behind
|
|
314
|
+
the orb with the typed style variable:
|
|
315
|
+
|
|
316
|
+
```tsx
|
|
317
|
+
<Orb adapter={adapter} theme="radial" style={{ '--orb-ui-radial-control-surround': '#101010' }} />
|
|
318
|
+
```
|
|
256
319
|
|
|
257
320
|
## Props
|
|
258
321
|
|
|
259
|
-
| Prop | Type
|
|
260
|
-
| ------------- |
|
|
261
|
-
| `theme` | `'debug' \| 'circle' \| 'bars' \| 'cloud'` | `'debug'` | Visual theme |
|
|
262
|
-
| `signal` | `OrbSignal`
|
|
263
|
-
| `state` | `OrbState`
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
268
|
-
| `
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
271
|
-
| `
|
|
272
|
-
| `
|
|
273
|
-
| `onStop` | `() => void` | — | Custom stop handler (overrides adapter.stop()) |
|
|
322
|
+
| Prop | Type | Default | Description |
|
|
323
|
+
| ------------- | ------------------------------------------------------ | --------- | ------------------------------------------------------- |
|
|
324
|
+
| `theme` | `'debug' \| 'circle' \| 'bars' \| 'cloud' \| 'radial'` | `'debug'` | Visual theme |
|
|
325
|
+
| `signal` | `OrbSignal` | — | Controlled signal with state and directional volumes |
|
|
326
|
+
| `state` | `OrbState` | `'idle'` | Conversation state (controlled mode) |
|
|
327
|
+
| `adapter` | `OrbAdapter` | — | Provider adapter (manages signal updates automatically) |
|
|
328
|
+
| `size` | `number` | `200` | Size in pixels |
|
|
329
|
+
| `className` | `string` | — | Optional class name for the rendered theme |
|
|
330
|
+
| `style` | `OrbStyle` | — | Inline styles, including radial control surround color |
|
|
331
|
+
| `disabled` | `boolean` | `false` | Disables clickable themes and debug start/stop controls |
|
|
332
|
+
| `interactive` | `boolean` | `true` | Allows the theme control to start and stop a session |
|
|
333
|
+
| `aria-label` | `string` | generated | Accessible label for clickable visual themes |
|
|
334
|
+
| `onStart` | `() => void` | — | Custom start handler (overrides adapter.start()) |
|
|
335
|
+
| `onStop` | `() => void` | — | Custom stop handler (overrides adapter.stop()) |
|
|
274
336
|
|
|
275
337
|
## States
|
|
276
338
|
|
|
@@ -278,15 +340,15 @@ When an adapter or `onStart`/`onStop` handler is provided, visual themes render
|
|
|
278
340
|
|
|
279
341
|
## Supported Providers
|
|
280
342
|
|
|
281
|
-
| Provider | Adapter
|
|
282
|
-
| ------------------------------------------------------------------------- |
|
|
283
|
-
| [Vapi](https://vapi.ai) | `createVapiAdapter` from `orb-ui/adapters`
|
|
284
|
-
| [ElevenLabs](https://elevenlabs.io/conversational-ai) | `createElevenLabsAdapter` from `orb-ui/adapters`
|
|
285
|
-
| [LiveKit](https://livekit.io) | `createLiveKitAdapter` from `orb-ui/adapters`
|
|
286
|
-
| [Pipecat](https://pipecat.ai) | `createPipecatAdapter` from `orb-ui/adapters`
|
|
287
|
-
| [OpenAI Realtime](https://developers.openai.com/api/docs/guides/realtime) | `createOpenAIRealtimeAdapter` from `orb-ui/adapters`
|
|
288
|
-
| [Gemini Live](https://ai.google.dev/gemini-api/docs/live-api) | `createGeminiLiveAdapter` from `orb-ui/adapters`
|
|
289
|
-
| Custom | Use controlled mode
|
|
343
|
+
| Provider | Adapter |
|
|
344
|
+
| ------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
345
|
+
| [Vapi](https://vapi.ai) | `createVapiAdapter` from `orb-ui/adapters` |
|
|
346
|
+
| [ElevenLabs](https://elevenlabs.io/conversational-ai) | `createElevenLabsAdapter` from `orb-ui/adapters` |
|
|
347
|
+
| [LiveKit](https://livekit.io) | `createLiveKitAdapter` from `orb-ui/adapters` |
|
|
348
|
+
| [Pipecat](https://pipecat.ai) | `createPipecatAdapter` from `orb-ui/adapters` |
|
|
349
|
+
| [OpenAI Realtime](https://developers.openai.com/api/docs/guides/realtime) | `createOpenAIRealtimeAdapter` from `orb-ui/adapters` |
|
|
350
|
+
| [Gemini Live](https://ai.google.dev/gemini-api/docs/live-api) | `createGeminiLiveAdapter` from `orb-ui/adapters` |
|
|
351
|
+
| Custom | Use controlled mode with a directional `signal` or build an adapter |
|
|
290
352
|
|
|
291
353
|
## Development
|
|
292
354
|
|
|
@@ -1,28 +1,65 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
/** Raw
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
export interface VolumeAmplitudeCalibration {
|
|
2
|
+
/** Raw values at or below this level are treated as silence. */
|
|
3
|
+
silenceFloor: number;
|
|
4
|
+
/** Raw value representing ordinary conversational speech. Maps to 0.5. */
|
|
5
|
+
speechReference: number;
|
|
6
|
+
/** Raw value representing a strong, uncommon speech peak. Maps to 1. */
|
|
7
|
+
speechPeak: number;
|
|
8
|
+
}
|
|
9
|
+
export interface VolumeEnvelopeCalibration {
|
|
10
|
+
/** Milliseconds to move 90% toward a rising target. */
|
|
11
|
+
riseTimeMs: number;
|
|
12
|
+
/** Milliseconds to move 90% toward a falling target. */
|
|
13
|
+
fallTimeMs: number;
|
|
14
|
+
}
|
|
15
|
+
export interface VolumeCalibration {
|
|
16
|
+
amplitude: VolumeAmplitudeCalibration;
|
|
17
|
+
envelope: VolumeEnvelopeCalibration;
|
|
18
|
+
}
|
|
19
|
+
export interface VolumeCalibrationOverrides {
|
|
20
|
+
amplitude?: Partial<VolumeAmplitudeCalibration>;
|
|
21
|
+
envelope?: Partial<VolumeEnvelopeCalibration>;
|
|
22
|
+
}
|
|
23
|
+
export type VolumeCalibrationSource = VolumeCalibrationOverrides | (() => VolumeCalibrationOverrides);
|
|
24
|
+
export interface VolumeSample {
|
|
25
|
+
/** Unmodified value measured from the provider audio source. */
|
|
16
26
|
raw: number;
|
|
17
|
-
/** Value after
|
|
18
|
-
|
|
19
|
-
/**
|
|
27
|
+
/** Value after silence, reference, and peak mapping. */
|
|
28
|
+
mapped: number;
|
|
29
|
+
/** Stable envelope after elapsed-time rise/fall processing. */
|
|
20
30
|
normalized: number;
|
|
31
|
+
/** Elapsed time used for this envelope update. */
|
|
32
|
+
elapsedMs: number;
|
|
33
|
+
}
|
|
34
|
+
export interface VolumeCalibrationCapture {
|
|
35
|
+
silence: number[];
|
|
36
|
+
quiet: number[];
|
|
37
|
+
normal: number[];
|
|
38
|
+
energetic: number[];
|
|
39
|
+
}
|
|
40
|
+
export interface VolumeCalibrationMetrics {
|
|
41
|
+
silenceP99: number;
|
|
42
|
+
quietMedian: number;
|
|
43
|
+
normalMedian: number;
|
|
44
|
+
energeticMedian: number;
|
|
45
|
+
speechP99: number;
|
|
46
|
+
saturationRatio: number;
|
|
47
|
+
}
|
|
48
|
+
export interface VolumeCalibrationFit {
|
|
49
|
+
calibration: VolumeCalibration;
|
|
50
|
+
metrics: VolumeCalibrationMetrics;
|
|
51
|
+
}
|
|
52
|
+
export interface VolumeNormalizer {
|
|
53
|
+
sample(rawValue: number, timestampMs?: number): VolumeSample;
|
|
54
|
+
reset(value?: number): void;
|
|
21
55
|
}
|
|
22
56
|
export interface MediaStreamTrackVolumeMeter {
|
|
23
57
|
stop(): Promise<void>;
|
|
24
58
|
}
|
|
25
59
|
export type AudioContextSource = () => AudioContext | undefined;
|
|
26
|
-
export declare const
|
|
27
|
-
export declare function
|
|
60
|
+
export declare const DEFAULT_VOLUME_CALIBRATION: VolumeCalibration;
|
|
61
|
+
export declare function mapVolumeAmplitude(rawValue: number, calibration: VolumeAmplitudeCalibration): number;
|
|
62
|
+
export declare function calibrateVolume(rawValue: number, previous: number, elapsedMs: number, defaults?: VolumeCalibration, source?: VolumeCalibrationSource): VolumeSample;
|
|
63
|
+
export declare function createVolumeNormalizer(defaults?: VolumeCalibration, source?: VolumeCalibrationSource): VolumeNormalizer;
|
|
64
|
+
export declare function fitVolumeCalibration(capture: VolumeCalibrationCapture, envelope?: VolumeEnvelopeCalibration): VolumeCalibrationFit;
|
|
28
65
|
export declare function createMediaStreamTrackVolumeMeter(track: MediaStreamTrack, createAudioContext: AudioContextSource, onVolume: (volume: number) => void): MediaStreamTrackVolumeMeter | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OrbAdapter } from '../types.js';
|
|
2
|
+
import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
|
|
2
3
|
export type ElevenLabsMode = 'speaking' | 'listening';
|
|
3
4
|
export type ElevenLabsStatus = 'disconnected' | 'connecting' | 'connected' | 'disconnecting';
|
|
4
5
|
export type ElevenLabsConnectionType = 'websocket' | 'webrtc';
|
|
@@ -41,13 +42,23 @@ type ElevenLabsSessionAuth = {
|
|
|
41
42
|
signedUrl?: never;
|
|
42
43
|
connectionType?: 'webrtc';
|
|
43
44
|
};
|
|
44
|
-
|
|
45
|
+
type ElevenLabsSessionConfig = ElevenLabsSessionAuth & {
|
|
45
46
|
/** orb-ui expects a voice conversation, so text-only sessions are intentionally unsupported. */
|
|
46
47
|
textOnly?: false;
|
|
47
48
|
/** Allow @elevenlabs/client startSession options that orb-ui does not inspect. */
|
|
48
49
|
[key: string]: unknown;
|
|
49
50
|
};
|
|
50
|
-
export type
|
|
51
|
+
export type ElevenLabsConfig = ElevenLabsSessionConfig & {
|
|
52
|
+
/** Optional live-tunable input calibration overrides. */
|
|
53
|
+
inputVolumeCalibration?: VolumeCalibrationSource;
|
|
54
|
+
/** Optional live-tunable output calibration overrides. */
|
|
55
|
+
outputVolumeCalibration?: VolumeCalibrationSource;
|
|
56
|
+
/** Receives raw, mapped, and normalized input levels for diagnostics. */
|
|
57
|
+
onInputVolumeSample?: (sample: VolumeSample) => void;
|
|
58
|
+
/** Receives raw, mapped, and normalized output levels for diagnostics. */
|
|
59
|
+
onOutputVolumeSample?: (sample: VolumeSample) => void;
|
|
60
|
+
};
|
|
61
|
+
export type ElevenLabsStartSessionOptions = ElevenLabsSessionConfig & ElevenLabsCallbacks;
|
|
51
62
|
export interface ElevenLabsConversationClass {
|
|
52
63
|
startSession(options: ElevenLabsStartSessionOptions): Promise<ElevenLabsConversation>;
|
|
53
64
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrbAdapter } from '../types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
|
|
3
3
|
export interface GeminiLiveInlineData {
|
|
4
4
|
data?: string;
|
|
5
5
|
mimeType?: string;
|
|
@@ -53,10 +53,14 @@ export interface GeminiLiveAdapterConfig {
|
|
|
53
53
|
getUserMedia?: (constraints: MediaStreamConstraints) => Promise<MediaStream>;
|
|
54
54
|
/** Runtime override for tests or custom browser wrappers. */
|
|
55
55
|
createAudioContext?: () => AudioContext;
|
|
56
|
-
/** Optional live-tunable
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
|
|
56
|
+
/** Optional live-tunable input calibration overrides. */
|
|
57
|
+
inputVolumeCalibration?: VolumeCalibrationSource;
|
|
58
|
+
/** Optional live-tunable output calibration overrides. */
|
|
59
|
+
outputVolumeCalibration?: VolumeCalibrationSource;
|
|
60
|
+
/** Receives raw, mapped, and normalized input levels for diagnostics. */
|
|
61
|
+
onInputVolumeSample?: (sample: VolumeSample) => void;
|
|
62
|
+
/** Receives raw, mapped, and normalized output levels for diagnostics. */
|
|
63
|
+
onOutputVolumeSample?: (sample: VolumeSample) => void;
|
|
60
64
|
}
|
|
61
65
|
export interface GeminiLiveOrbAdapter extends OrbAdapter {
|
|
62
66
|
start(): Promise<void>;
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { createVapiAdapter } from './vapi/index.js';
|
|
1
|
+
export { createVapiAdapter, type VapiAdapterOptions } from './vapi/index.js';
|
|
2
2
|
export { createElevenLabsAdapter, type ElevenLabsCallbacks, type ElevenLabsConfig, type ElevenLabsConnectionType, type ElevenLabsConversation, type ElevenLabsConversationClass, type ElevenLabsMode, type ElevenLabsOrbAdapter, type ElevenLabsStartSessionOptions, type ElevenLabsStatus, } from './elevenlabs/index.js';
|
|
3
3
|
export { createLiveKitAdapter, type LiveKitAdapterConfig, type LiveKitConnectionDetails, type LiveKitOrbAdapter, type LiveKitResolvedTokenOptions, type LiveKitTokenOptions, type LiveKitTokenSource, } from './livekit/index.js';
|
|
4
4
|
export { createPipecatAdapter, type PipecatAdapterOptions, type PipecatClientLike, type PipecatOrbAdapter, type PipecatParticipantLike, type PipecatTracksLike, } from './pipecat/index.js';
|
|
5
5
|
export { createOpenAIRealtimeAdapter, type OpenAIRealtimeAdapterConfig, type OpenAIRealtimeClientSecret, type OpenAIRealtimeOrbAdapter, } from './openai-realtime/index.js';
|
|
6
6
|
export { createGeminiLiveAdapter, type GeminiLiveAdapterConfig, type GeminiLiveCallbacks, type GeminiLiveInlineData, type GeminiLiveOrbAdapter, type GeminiLiveServerMessage, type GeminiLiveSession, } from './gemini-live/index.js';
|
|
7
|
-
export {
|
|
7
|
+
export { DEFAULT_VOLUME_CALIBRATION, calibrateVolume, createVolumeNormalizer, fitVolumeCalibration, mapVolumeAmplitude, type VolumeAmplitudeCalibration, type VolumeCalibration, type VolumeCalibrationCapture, type VolumeCalibrationFit, type VolumeCalibrationMetrics, type VolumeCalibrationOverrides, type VolumeCalibrationSource, type VolumeEnvelopeCalibration, type VolumeNormalizer, type VolumeSample, } from './audio-level.js';
|
|
8
|
+
export { PROVIDER_VOLUME_CALIBRATIONS, type DirectionalVolumeCalibration } from './volume-presets.js';
|
|
8
9
|
export type { OrbAdapter, OrbSignal, OrbSignalListener, OrbState } from './types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LiveKitOrbAdapter, LiveKitTokenOptions } from './index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
|
|
3
3
|
interface LiveKitBrowserAdapterBase extends Omit<LiveKitTokenOptions, 'agentName' | 'roomName'> {
|
|
4
4
|
/** Agent dispatched into the room. Required for LiveKit Cloud sandbox sessions. */
|
|
5
5
|
agentName?: LiveKitTokenOptions['agentName'];
|
|
@@ -9,10 +9,14 @@ interface LiveKitBrowserAdapterBase extends Omit<LiveKitTokenOptions, 'agentName
|
|
|
9
9
|
connectOptions?: Record<string, unknown>;
|
|
10
10
|
/** Enable the local microphone after connecting. Defaults to true. */
|
|
11
11
|
enableMicrophone?: boolean;
|
|
12
|
-
/** Optional live-tunable
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
12
|
+
/** Optional live-tunable input calibration overrides. */
|
|
13
|
+
inputVolumeCalibration?: VolumeCalibrationSource;
|
|
14
|
+
/** Optional live-tunable output calibration overrides. */
|
|
15
|
+
outputVolumeCalibration?: VolumeCalibrationSource;
|
|
16
|
+
/** Receives raw, mapped, and normalized input levels for diagnostics. */
|
|
17
|
+
onInputVolumeSample?: (sample: VolumeSample) => void;
|
|
18
|
+
/** Receives raw, mapped, and normalized output levels for diagnostics. */
|
|
19
|
+
onOutputVolumeSample?: (sample: VolumeSample) => void;
|
|
16
20
|
}
|
|
17
21
|
export type LiveKitTokenEndpointOptions = Omit<RequestInit, 'body'>;
|
|
18
22
|
export interface LiveKitSandboxOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrbAdapter } from '../types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
|
|
3
3
|
interface LKAnalyserResult {
|
|
4
4
|
calculateVolume: () => number;
|
|
5
5
|
cleanup: () => Promise<void>;
|
|
@@ -69,10 +69,14 @@ export interface LiveKitTokenSource {
|
|
|
69
69
|
fetch(options?: LiveKitResolvedTokenOptions, force?: boolean): Promise<LiveKitConnectionDetails>;
|
|
70
70
|
}
|
|
71
71
|
interface LiveKitVolumeConfig {
|
|
72
|
-
/** Optional live-tunable
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
|
|
72
|
+
/** Optional live-tunable input calibration overrides. */
|
|
73
|
+
inputVolumeCalibration?: VolumeCalibrationSource;
|
|
74
|
+
/** Optional live-tunable output calibration overrides. */
|
|
75
|
+
outputVolumeCalibration?: VolumeCalibrationSource;
|
|
76
|
+
/** Receives raw, mapped, and normalized input levels for diagnostics. */
|
|
77
|
+
onInputVolumeSample?: (sample: VolumeSample) => void;
|
|
78
|
+
/** Receives raw, mapped, and normalized output levels for diagnostics. */
|
|
79
|
+
onOutputVolumeSample?: (sample: VolumeSample) => void;
|
|
76
80
|
}
|
|
77
81
|
interface LiveKitManagedBaseConfig<TTrack = unknown> extends LiveKitVolumeConfig {
|
|
78
82
|
/** The createAudioAnalyser function from livekit-client. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrbAdapter } from '../types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
|
|
3
3
|
export interface OpenAIRealtimeClientSecret {
|
|
4
4
|
value: string;
|
|
5
5
|
}
|
|
@@ -20,10 +20,14 @@ export interface OpenAIRealtimeAdapterConfig {
|
|
|
20
20
|
createAudioElement?: () => HTMLAudioElement;
|
|
21
21
|
/** Return undefined to disable browser-side volume metering. */
|
|
22
22
|
createAudioContext?: () => AudioContext | undefined;
|
|
23
|
-
/** Optional live-tunable
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
23
|
+
/** Optional live-tunable input calibration overrides. */
|
|
24
|
+
inputVolumeCalibration?: VolumeCalibrationSource;
|
|
25
|
+
/** Optional live-tunable output calibration overrides. */
|
|
26
|
+
outputVolumeCalibration?: VolumeCalibrationSource;
|
|
27
|
+
/** Receives raw, mapped, and normalized input levels for diagnostics. */
|
|
28
|
+
onInputVolumeSample?: (sample: VolumeSample) => void;
|
|
29
|
+
/** Receives raw, mapped, and normalized output levels for diagnostics. */
|
|
30
|
+
onOutputVolumeSample?: (sample: VolumeSample) => void;
|
|
27
31
|
}
|
|
28
32
|
export interface OpenAIRealtimeOrbAdapter extends OrbAdapter {
|
|
29
33
|
start(): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OrbAdapter } from '../types.js';
|
|
2
|
-
import { AudioContextSource,
|
|
2
|
+
import { AudioContextSource, VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
|
|
3
3
|
type PipecatListener = (...args: unknown[]) => void;
|
|
4
4
|
/** Minimal PipecatClient surface used by orb-ui. */
|
|
5
5
|
export interface PipecatClientLike {
|
|
@@ -43,10 +43,14 @@ export interface PipecatAdapterOptions {
|
|
|
43
43
|
createAudioElement?: () => HTMLAudioElement;
|
|
44
44
|
/** Return undefined to disable browser-track volume metering. */
|
|
45
45
|
createAudioContext?: AudioContextSource;
|
|
46
|
-
/** Optional live-tunable
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
46
|
+
/** Optional live-tunable input calibration overrides. */
|
|
47
|
+
inputVolumeCalibration?: VolumeCalibrationSource;
|
|
48
|
+
/** Optional live-tunable output calibration overrides. */
|
|
49
|
+
outputVolumeCalibration?: VolumeCalibrationSource;
|
|
50
|
+
/** Receives raw, mapped, and normalized input levels for diagnostics. */
|
|
51
|
+
onInputVolumeSample?: (sample: VolumeSample) => void;
|
|
52
|
+
/** Receives raw, mapped, and normalized output levels for diagnostics. */
|
|
53
|
+
onOutputVolumeSample?: (sample: VolumeSample) => void;
|
|
50
54
|
}
|
|
51
55
|
export interface PipecatOrbAdapter extends OrbAdapter {
|
|
52
56
|
start(): Promise<void>;
|
package/dist/adapters/types.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
import { OrbAdapter, OrbSignal, OrbSignalListener, OrbState } from '../components/Orb/Orb.types.js';
|
|
2
2
|
export type { OrbAdapter, OrbSignal, OrbSignalListener, OrbState };
|
|
3
|
-
/**
|
|
4
|
-
* Shared mic volume curve — rescale real-world mic range to 0–1 with pow shaping
|
|
5
|
-
* for custom provider adapters that need browser-side input metering.
|
|
6
|
-
*/
|
|
7
|
-
export declare function normalizeMicVolume(v: number): number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OrbAdapter } from '../types.js';
|
|
2
|
+
import { AudioContextSource, VolumeCalibrationSource, VolumeSample } from '../audio-level.js';
|
|
2
3
|
interface VapiClient {
|
|
3
4
|
on(event: 'call-start', listener: () => void): void;
|
|
4
5
|
on(event: 'call-end', listener: () => void): void;
|
|
@@ -10,6 +11,20 @@ interface VapiClient {
|
|
|
10
11
|
removeListener(event: string, listener: (...args: unknown[]) => void): void;
|
|
11
12
|
start(...args: any[]): Promise<unknown>;
|
|
12
13
|
stop(): void;
|
|
14
|
+
/** Public SDK access to the existing call's microphone; no second capture. */
|
|
15
|
+
getDailyCallObject?(): {
|
|
16
|
+
participants(): {
|
|
17
|
+
local?: {
|
|
18
|
+
tracks?: {
|
|
19
|
+
audio?: {
|
|
20
|
+
state?: string;
|
|
21
|
+
persistentTrack?: MediaStreamTrack;
|
|
22
|
+
track?: MediaStreamTrack;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
} | null;
|
|
13
28
|
}
|
|
14
29
|
interface VapiMessage {
|
|
15
30
|
type: string;
|
|
@@ -28,15 +43,26 @@ interface VapiMessage {
|
|
|
28
43
|
* call-end → 'idle'
|
|
29
44
|
* error → 'error'
|
|
30
45
|
*
|
|
31
|
-
* Volume: raw Vapi values are
|
|
32
|
-
* as outputVolume while the assistant is speaking.
|
|
46
|
+
* Volume: raw Vapi values are mapped through the provider profile and emitted
|
|
47
|
+
* as a stable normalized outputVolume envelope while the assistant is speaking.
|
|
48
|
+
* Input: meters the SDK-owned local audio track when getDailyCallObject exists.
|
|
33
49
|
*
|
|
34
50
|
* @param client - A Vapi instance from @vapi-ai/web
|
|
35
51
|
* @param options - Optional config (e.g. assistantId to pass to vapi.start())
|
|
36
52
|
*/
|
|
37
|
-
interface VapiAdapterOptions {
|
|
53
|
+
export interface VapiAdapterOptions {
|
|
38
54
|
/** Assistant ID passed to vapi.start() when the orb is clicked. */
|
|
39
55
|
assistantId?: string;
|
|
56
|
+
/** Return undefined to disable metering of the SDK-owned microphone track. */
|
|
57
|
+
createAudioContext?: AudioContextSource;
|
|
58
|
+
/** Optional live-tunable input calibration overrides. */
|
|
59
|
+
inputVolumeCalibration?: VolumeCalibrationSource;
|
|
60
|
+
/** Optional live-tunable output calibration overrides. */
|
|
61
|
+
outputVolumeCalibration?: VolumeCalibrationSource;
|
|
62
|
+
/** Receives raw microphone RMS, mapped, and normalized input levels. */
|
|
63
|
+
onInputVolumeSample?: (sample: VolumeSample) => void;
|
|
64
|
+
/** Receives raw, mapped, and normalized output levels for diagnostics. */
|
|
65
|
+
onOutputVolumeSample?: (sample: VolumeSample) => void;
|
|
40
66
|
}
|
|
41
67
|
export declare function createVapiAdapter(client: VapiClient, options?: VapiAdapterOptions): OrbAdapter;
|
|
42
68
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { VolumeCalibration } from './audio-level.js';
|
|
2
|
+
export interface DirectionalVolumeCalibration {
|
|
3
|
+
input?: VolumeCalibration;
|
|
4
|
+
output?: VolumeCalibration;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Shipped provider baselines. The playground calibration runner generates
|
|
8
|
+
* replacements from guided raw-level captures without requiring manual sliders.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PROVIDER_VOLUME_CALIBRATIONS: {
|
|
11
|
+
readonly vapi: {
|
|
12
|
+
readonly input: VolumeCalibration;
|
|
13
|
+
readonly output: VolumeCalibration;
|
|
14
|
+
};
|
|
15
|
+
readonly elevenlabs: {
|
|
16
|
+
readonly input: VolumeCalibration;
|
|
17
|
+
readonly output: VolumeCalibration;
|
|
18
|
+
};
|
|
19
|
+
readonly livekit: {
|
|
20
|
+
readonly input: VolumeCalibration;
|
|
21
|
+
readonly output: VolumeCalibration;
|
|
22
|
+
};
|
|
23
|
+
readonly pipecat: {
|
|
24
|
+
readonly input: VolumeCalibration;
|
|
25
|
+
readonly output: VolumeCalibration;
|
|
26
|
+
};
|
|
27
|
+
readonly openai: {
|
|
28
|
+
readonly input: VolumeCalibration;
|
|
29
|
+
readonly output: VolumeCalibration;
|
|
30
|
+
};
|
|
31
|
+
readonly gemini: {
|
|
32
|
+
readonly input: VolumeCalibration;
|
|
33
|
+
readonly output: VolumeCalibration;
|
|
34
|
+
};
|
|
35
|
+
};
|