@charivo/core 0.31.0 → 0.33.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/dist/index.d.cts CHANGED
@@ -50,6 +50,7 @@ type RealtimeTransportKind = "webrtc" | "websocket";
50
50
  type RealtimeToolChoice = "auto" | "none" | "required";
51
51
  declare const OPENAI_REALTIME_ADAPTER = "openai-webrtc";
52
52
  declare const OPENAI_REALTIME_AGENTS_ADAPTER = "openai-agents-webrtc";
53
+ declare const GEMINI_LIVE_ADAPTER = "gemini-live-websocket";
53
54
  interface ToolDefinition {
54
55
  type: "function";
55
56
  name: string;
@@ -96,6 +97,12 @@ interface RealtimeSessionConfig {
96
97
  maxTokens?: number;
97
98
  tools?: ToolDefinition[];
98
99
  toolChoice?: RealtimeToolChoice;
100
+ /**
101
+ * Off unless asked, on every provider. `{ enabled: true }` turns it on with
102
+ * the provider's default transcription model; a `model` implies on where the
103
+ * provider offers a choice (OpenAI) and is rejected where it does not
104
+ * (Gemini); `{ enabled: false }` turns it off.
105
+ */
99
106
  inputAudioTranscription?: {
100
107
  model?: string;
101
108
  enabled?: boolean;
@@ -381,6 +388,17 @@ interface TTSManager {
381
388
  /** Final resource release; call stop() first - dispose() does not stop playback. */
382
389
  dispose?(): Promise<void>;
383
390
  }
391
+ /**
392
+ * `TTSManager` with the members the built-in manager always provides required
393
+ * instead of optional. A third-party `TTSManager` may omit audio preparation,
394
+ * event wiring, or disposal; the manager returned by `createTTSManager` never
395
+ * does, so callers of the factory should not have to narrow them.
396
+ */
397
+ interface BuiltInTTSManager extends TTSManager {
398
+ prepareAudio(): Promise<void>;
399
+ setEventEmitter(eventEmitter: CharivoEventEmitter): void;
400
+ dispose(): Promise<void>;
401
+ }
384
402
  interface STTOptions {
385
403
  language?: string;
386
404
  }
@@ -400,6 +418,13 @@ interface STTManager {
400
418
  isRecording(): boolean;
401
419
  setEventEmitter?(eventEmitter: CharivoEventEmitter): void;
402
420
  }
421
+ /**
422
+ * `STTManager` with event wiring required instead of optional — the manager
423
+ * returned by `createSTTManager` always provides it.
424
+ */
425
+ interface BuiltInSTTManager extends STTManager {
426
+ setEventEmitter(eventEmitter: CharivoEventEmitter): void;
427
+ }
403
428
  interface RealtimeManager {
404
429
  setCharacter(character: Character): void;
405
430
  getState(): RealtimeState;
@@ -415,6 +440,14 @@ interface RealtimeManager {
415
440
  getRegisteredTools(): ToolDefinition[];
416
441
  setEventEmitter?(eventEmitter: CharivoEventEmitter): void;
417
442
  }
443
+ /**
444
+ * `RealtimeManager` with the members the built-in manager always provides
445
+ * required instead of optional — `createRealtimeManager` implements both.
446
+ */
447
+ interface BuiltInRealtimeManager extends RealtimeManager {
448
+ prepareAudio(config?: RealtimeSessionConfig): Promise<void>;
449
+ setEventEmitter(eventEmitter: CharivoEventEmitter): void;
450
+ }
418
451
  /**
419
452
  * An interface (not a type alias) so third-party packages can extend it via
420
453
  * declaration merging — a custom renderer or manager declares its own events
@@ -974,4 +1007,4 @@ interface CharivoOptions {
974
1007
  */
975
1008
  declare function createCharivo(options?: CharivoOptions): Charivo;
976
1009
 
977
- export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, type EventMap, type FetchWithTimeoutOptions, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMCallOptions, type LLMClient, type LLMManager, type LLMManagerWithTools, type LLMMessage, type LLMProvider, type LLMToolCall, type LLMToolResponse, type LipSyncAnalyzer, type LipSyncAnalyzerOptions, type Message, type MotionSelection, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, type RealtimeConnectionState, type RealtimeManager, type RealtimeProvider, type RealtimeReconnectCause, type RealtimeResponseStatus, type RealtimeSessionBootstrap, type RealtimeSessionConfig, type RealtimeSessionRequest, type RealtimeSessionStatus, type RealtimeSessionTransitionReason, type RealtimeState, type RealtimeToolChoice, type RealtimeTransportKind, type RealtimeUsageEvent, type RenderManager, type Renderer, type STTManager, type STTOptions, type STTProvider, type STTTranscriber, type TTSManager, type TTSOptions, type TTSPlaybackMode, type TTSPlayer, type TTSProvider, type ToolContext, type ToolDefinition, type ToolHandler, type ToolRegistration, type ToolRegistry, type ToolResultProjector, type ToolResultProjectorContext, type ToolResultSnapshot, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
1010
+ export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type BuiltInRealtimeManager, type BuiltInSTTManager, type BuiltInTTSManager, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, type EventMap, type FetchWithTimeoutOptions, GEMINI_LIVE_ADAPTER, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMCallOptions, type LLMClient, type LLMManager, type LLMManagerWithTools, type LLMMessage, type LLMProvider, type LLMToolCall, type LLMToolResponse, type LipSyncAnalyzer, type LipSyncAnalyzerOptions, type Message, type MotionSelection, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, type RealtimeConnectionState, type RealtimeManager, type RealtimeProvider, type RealtimeReconnectCause, type RealtimeResponseStatus, type RealtimeSessionBootstrap, type RealtimeSessionConfig, type RealtimeSessionRequest, type RealtimeSessionStatus, type RealtimeSessionTransitionReason, type RealtimeState, type RealtimeToolChoice, type RealtimeTransportKind, type RealtimeUsageEvent, type RenderManager, type Renderer, type STTManager, type STTOptions, type STTProvider, type STTTranscriber, type TTSManager, type TTSOptions, type TTSPlaybackMode, type TTSPlayer, type TTSProvider, type ToolContext, type ToolDefinition, type ToolHandler, type ToolRegistration, type ToolRegistry, type ToolResultProjector, type ToolResultProjectorContext, type ToolResultSnapshot, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
package/dist/index.d.ts CHANGED
@@ -50,6 +50,7 @@ type RealtimeTransportKind = "webrtc" | "websocket";
50
50
  type RealtimeToolChoice = "auto" | "none" | "required";
51
51
  declare const OPENAI_REALTIME_ADAPTER = "openai-webrtc";
52
52
  declare const OPENAI_REALTIME_AGENTS_ADAPTER = "openai-agents-webrtc";
53
+ declare const GEMINI_LIVE_ADAPTER = "gemini-live-websocket";
53
54
  interface ToolDefinition {
54
55
  type: "function";
55
56
  name: string;
@@ -96,6 +97,12 @@ interface RealtimeSessionConfig {
96
97
  maxTokens?: number;
97
98
  tools?: ToolDefinition[];
98
99
  toolChoice?: RealtimeToolChoice;
100
+ /**
101
+ * Off unless asked, on every provider. `{ enabled: true }` turns it on with
102
+ * the provider's default transcription model; a `model` implies on where the
103
+ * provider offers a choice (OpenAI) and is rejected where it does not
104
+ * (Gemini); `{ enabled: false }` turns it off.
105
+ */
99
106
  inputAudioTranscription?: {
100
107
  model?: string;
101
108
  enabled?: boolean;
@@ -381,6 +388,17 @@ interface TTSManager {
381
388
  /** Final resource release; call stop() first - dispose() does not stop playback. */
382
389
  dispose?(): Promise<void>;
383
390
  }
391
+ /**
392
+ * `TTSManager` with the members the built-in manager always provides required
393
+ * instead of optional. A third-party `TTSManager` may omit audio preparation,
394
+ * event wiring, or disposal; the manager returned by `createTTSManager` never
395
+ * does, so callers of the factory should not have to narrow them.
396
+ */
397
+ interface BuiltInTTSManager extends TTSManager {
398
+ prepareAudio(): Promise<void>;
399
+ setEventEmitter(eventEmitter: CharivoEventEmitter): void;
400
+ dispose(): Promise<void>;
401
+ }
384
402
  interface STTOptions {
385
403
  language?: string;
386
404
  }
@@ -400,6 +418,13 @@ interface STTManager {
400
418
  isRecording(): boolean;
401
419
  setEventEmitter?(eventEmitter: CharivoEventEmitter): void;
402
420
  }
421
+ /**
422
+ * `STTManager` with event wiring required instead of optional — the manager
423
+ * returned by `createSTTManager` always provides it.
424
+ */
425
+ interface BuiltInSTTManager extends STTManager {
426
+ setEventEmitter(eventEmitter: CharivoEventEmitter): void;
427
+ }
403
428
  interface RealtimeManager {
404
429
  setCharacter(character: Character): void;
405
430
  getState(): RealtimeState;
@@ -415,6 +440,14 @@ interface RealtimeManager {
415
440
  getRegisteredTools(): ToolDefinition[];
416
441
  setEventEmitter?(eventEmitter: CharivoEventEmitter): void;
417
442
  }
443
+ /**
444
+ * `RealtimeManager` with the members the built-in manager always provides
445
+ * required instead of optional — `createRealtimeManager` implements both.
446
+ */
447
+ interface BuiltInRealtimeManager extends RealtimeManager {
448
+ prepareAudio(config?: RealtimeSessionConfig): Promise<void>;
449
+ setEventEmitter(eventEmitter: CharivoEventEmitter): void;
450
+ }
418
451
  /**
419
452
  * An interface (not a type alias) so third-party packages can extend it via
420
453
  * declaration merging — a custom renderer or manager declares its own events
@@ -974,4 +1007,4 @@ interface CharivoOptions {
974
1007
  */
975
1008
  declare function createCharivo(options?: CharivoOptions): Charivo;
976
1009
 
977
- export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, type EventMap, type FetchWithTimeoutOptions, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMCallOptions, type LLMClient, type LLMManager, type LLMManagerWithTools, type LLMMessage, type LLMProvider, type LLMToolCall, type LLMToolResponse, type LipSyncAnalyzer, type LipSyncAnalyzerOptions, type Message, type MotionSelection, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, type RealtimeConnectionState, type RealtimeManager, type RealtimeProvider, type RealtimeReconnectCause, type RealtimeResponseStatus, type RealtimeSessionBootstrap, type RealtimeSessionConfig, type RealtimeSessionRequest, type RealtimeSessionStatus, type RealtimeSessionTransitionReason, type RealtimeState, type RealtimeToolChoice, type RealtimeTransportKind, type RealtimeUsageEvent, type RenderManager, type Renderer, type STTManager, type STTOptions, type STTProvider, type STTTranscriber, type TTSManager, type TTSOptions, type TTSPlaybackMode, type TTSPlayer, type TTSProvider, type ToolContext, type ToolDefinition, type ToolHandler, type ToolRegistration, type ToolRegistry, type ToolResultProjector, type ToolResultProjectorContext, type ToolResultSnapshot, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
1010
+ export { type AvatarControlCatalog, type BrowserLifecycleCallbacks, type BuiltInRealtimeManager, type BuiltInSTTManager, type BuiltInTTSManager, type Character, Charivo, CharivoDisposeError, CharivoError, type CharivoErrorCode, type CharivoErrorKind, type CharivoErrorOptions, type CharivoEventBus, type CharivoEventEmitter, type CharivoOptions, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, type EventMap, type FetchWithTimeoutOptions, GEMINI_LIVE_ADAPTER, type GazeCoordinates, type GenerateResponseOptions, type HistoryRollback, type LLMAdapter, type LLMCallOptions, type LLMClient, type LLMManager, type LLMManagerWithTools, type LLMMessage, type LLMProvider, type LLMToolCall, type LLMToolResponse, type LipSyncAnalyzer, type LipSyncAnalyzerOptions, type Message, type MotionSelection, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, type RealtimeConnectionState, type RealtimeManager, type RealtimeProvider, type RealtimeReconnectCause, type RealtimeResponseStatus, type RealtimeSessionBootstrap, type RealtimeSessionConfig, type RealtimeSessionRequest, type RealtimeSessionStatus, type RealtimeSessionTransitionReason, type RealtimeState, type RealtimeToolChoice, type RealtimeTransportKind, type RealtimeUsageEvent, type RenderManager, type Renderer, type STTManager, type STTOptions, type STTProvider, type STTTranscriber, type TTSManager, type TTSOptions, type TTSPlaybackMode, type TTSPlayer, type TTSProvider, type ToolContext, type ToolDefinition, type ToolHandler, type ToolRegistration, type ToolRegistry, type ToolResultProjector, type ToolResultProjectorContext, type ToolResultSnapshot, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
package/dist/index.js CHANGED
@@ -151,6 +151,7 @@ function toCharivoError(kind, error, fallbackMessage) {
151
151
  // src/types.ts
152
152
  var OPENAI_REALTIME_ADAPTER = "openai-webrtc";
153
153
  var OPENAI_REALTIME_AGENTS_ADAPTER = "openai-agents-webrtc";
154
+ var GEMINI_LIVE_ADAPTER = "gemini-live-websocket";
154
155
 
155
156
  // src/browser-lifecycle.ts
156
157
  var subscribers = /* @__PURE__ */ new Set();
@@ -1226,6 +1227,6 @@ function createCharivo(options = {}) {
1226
1227
  return charivo;
1227
1228
  }
1228
1229
 
1229
- export { Charivo, CharivoDisposeError, CharivoError, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
1230
+ export { Charivo, CharivoDisposeError, CharivoError, CharivoProviderError, CharivoStateError, CharivoTimeoutError, CharivoTransportError, DEFAULT_FETCH_TIMEOUT_MS, GEMINI_LIVE_ADAPTER, OPENAI_REALTIME_ADAPTER, OPENAI_REALTIME_AGENTS_ADAPTER, assertToolResultObject, createCharivo, createLipSyncAnalyzer, createToolFailureOutput, createToolRegistry, fetchWithTimeout, getErrorMessage, isCharivoError, snapshotToolResult, subscribeBrowserLifecycle, toCharivoError, validateToolArguments, withToolTimeout };
1230
1231
  //# sourceMappingURL=index.js.map
1231
1232
  //# sourceMappingURL=index.js.map