@streamoji/aitwin 0.1.9 → 0.2.1

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.ts CHANGED
@@ -2,6 +2,8 @@ import { CSSProperties } from 'react';
2
2
  import { ForwardRefExoticComponent } from 'react';
3
3
  import { RefAttributes } from 'react';
4
4
 
5
+ export declare const AI_TWIN_THUMBNAIL_FILENAME = "thumbnail.webp";
6
+
5
7
  export declare const AiTwin: ForwardRefExoticComponent<AiTwinProps & RefAttributes<AiTwinHandle>>;
6
8
 
7
9
  export declare type AiTwinHandle = {
@@ -24,11 +26,21 @@ export declare class AiTwinNotFoundError extends Error {
24
26
  }
25
27
 
26
28
  export declare type AiTwinProps = {
27
- /** Twin id for getAiTwin (e.g. `olivia`). Omit when `assets` is set. */
29
+ /** Twin id for getAiTwin (e.g. `olivia`). Omit when `assets` or `avatarId`/`faceId` is set. */
28
30
  id?: string;
31
+ /**
32
+ * 64-char hex R2 custom-faces id (pipeline `avatarId`).
33
+ * Loads encrypted CDN assets directly; skips getAiTwin.
34
+ * Alias: `faceId`.
35
+ */
36
+ avatarId?: string;
37
+ /**
38
+ * Same as `avatarId` — R2 custom-faces/{faceId}/ bundle id from getAiTwin or the pipeline.
39
+ */
40
+ faceId?: string;
29
41
  /**
30
42
  * Preconfigured asset URLs (e.g. local `twins/blondelady`).
31
- * When set, skips getAiTwin.
43
+ * When set, skips getAiTwin and `avatarId`/`faceId`.
32
44
  */
33
45
  assets?: TwinAssetUrls;
34
46
  /**
@@ -36,7 +48,7 @@ export declare type AiTwinProps = {
36
48
  * When omitted, a dev token is fetched via getAuthToken.
37
49
  */
38
50
  authToken?: string;
39
- /** TTS engine when using `assets` (default: Google engine id). */
51
+ /** TTS engine when using `assets` or `avatarId`/`faceId` (default: Cartesia). */
40
52
  ttsEngineId?: TtsEngineId;
41
53
  /** TTS voice id override (engine-specific). */
42
54
  voiceId?: string;
@@ -113,11 +125,16 @@ export declare function createRealtimeVoiceLipsyncController(onStatus: (status:
113
125
 
114
126
  export declare const DEFAULT_TTS_ENGINE_ID: TtsEngineId;
115
127
 
128
+ export declare function faceAssetUrls(faceId: string, cdnBase?: string): TwinAssetUrls;
129
+
116
130
  export declare function fetchAiTwin(id: string, baseUrl?: string): Promise<AiTwinRecord>;
117
131
 
118
132
  /** Bearer token for /avatar_ttsWithPoses and /api/session-value. */
119
133
  export declare function fetchDevAuthToken(): Promise<string>;
120
134
 
135
+ /** Public CDN thumbnail for custom-faces/{faceId}/ (same id as pipeline avatarId). */
136
+ export declare function getAiTwinThumbnailUrl(faceId: string, cdnBase?: string): string;
137
+
121
138
  export declare const MIC_SAMPLE_RATE = 16000;
122
139
 
123
140
  /** Google TTS streams Oculus viseme symbols; normalize casing and unknown ids. */
@@ -172,6 +189,9 @@ export declare type RealtimeVoiceOptions = VoiceConnectOptions & {
172
189
  onLipsyncDebug?: (snapshot: RealtimeLipsyncDebugSnapshot) => void;
173
190
  };
174
191
 
192
+ /** Resolve optional `avatarId` / `faceId` props (same R2 custom-faces hex id). */
193
+ export declare function resolveDirectFaceId(avatarId?: string, faceId?: string): string | undefined;
194
+
175
195
  /** Pick the active viseme at playback offset (latest vtime wins on overlap). */
176
196
  export declare function resolveVisemeAtTime(queue: VisemeQueueItem[], elapsedMs: number): string;
177
197
 
@@ -187,6 +207,8 @@ export declare interface SentenceEmotion {
187
207
  end_word: number;
188
208
  }
189
209
 
210
+ export declare function setActiveTwinAssets(urls: TwinAssetUrls): void;
211
+
190
212
  export declare const SPEAKING_RATE_MAX = 1.5;
191
213
 
192
214
  export declare const SPEAKING_RATE_MIN = 0.5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoji/aitwin",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "Embeddable React AI twin face with TTS lipsync",
5
5
  "type": "module",
6
6
  "main": "./dist/aitwin.cjs",