@streamoji/aitwin 0.1.9 → 0.2.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.ts CHANGED
@@ -24,11 +24,21 @@ export declare class AiTwinNotFoundError extends Error {
24
24
  }
25
25
 
26
26
  export declare type AiTwinProps = {
27
- /** Twin id for getAiTwin (e.g. `olivia`). Omit when `assets` is set. */
27
+ /** Twin id for getAiTwin (e.g. `olivia`). Omit when `assets` or `avatarId`/`faceId` is set. */
28
28
  id?: string;
29
+ /**
30
+ * 64-char hex R2 custom-faces id (pipeline `avatarId`).
31
+ * Loads encrypted CDN assets directly; skips getAiTwin.
32
+ * Alias: `faceId`.
33
+ */
34
+ avatarId?: string;
35
+ /**
36
+ * Same as `avatarId` — R2 custom-faces/{faceId}/ bundle id from getAiTwin or the pipeline.
37
+ */
38
+ faceId?: string;
29
39
  /**
30
40
  * Preconfigured asset URLs (e.g. local `twins/blondelady`).
31
- * When set, skips getAiTwin.
41
+ * When set, skips getAiTwin and `avatarId`/`faceId`.
32
42
  */
33
43
  assets?: TwinAssetUrls;
34
44
  /**
@@ -36,7 +46,7 @@ export declare type AiTwinProps = {
36
46
  * When omitted, a dev token is fetched via getAuthToken.
37
47
  */
38
48
  authToken?: string;
39
- /** TTS engine when using `assets` (default: Google engine id). */
49
+ /** TTS engine when using `assets` or `avatarId`/`faceId` (default: Cartesia). */
40
50
  ttsEngineId?: TtsEngineId;
41
51
  /** TTS voice id override (engine-specific). */
42
52
  voiceId?: string;
@@ -113,6 +123,8 @@ export declare function createRealtimeVoiceLipsyncController(onStatus: (status:
113
123
 
114
124
  export declare const DEFAULT_TTS_ENGINE_ID: TtsEngineId;
115
125
 
126
+ export declare function faceAssetUrls(faceId: string, cdnBase?: string): TwinAssetUrls;
127
+
116
128
  export declare function fetchAiTwin(id: string, baseUrl?: string): Promise<AiTwinRecord>;
117
129
 
118
130
  /** Bearer token for /avatar_ttsWithPoses and /api/session-value. */
@@ -172,6 +184,9 @@ export declare type RealtimeVoiceOptions = VoiceConnectOptions & {
172
184
  onLipsyncDebug?: (snapshot: RealtimeLipsyncDebugSnapshot) => void;
173
185
  };
174
186
 
187
+ /** Resolve optional `avatarId` / `faceId` props (same R2 custom-faces hex id). */
188
+ export declare function resolveDirectFaceId(avatarId?: string, faceId?: string): string | undefined;
189
+
175
190
  /** Pick the active viseme at playback offset (latest vtime wins on overlap). */
176
191
  export declare function resolveVisemeAtTime(queue: VisemeQueueItem[], elapsedMs: number): string;
177
192
 
@@ -187,6 +202,8 @@ export declare interface SentenceEmotion {
187
202
  end_word: number;
188
203
  }
189
204
 
205
+ export declare function setActiveTwinAssets(urls: TwinAssetUrls): void;
206
+
190
207
  export declare const SPEAKING_RATE_MAX = 1.5;
191
208
 
192
209
  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.0",
4
4
  "description": "Embeddable React AI twin face with TTS lipsync",
5
5
  "type": "module",
6
6
  "main": "./dist/aitwin.cjs",