@streamoji/aitwin 0.6.3 → 0.6.5

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
@@ -49,7 +49,9 @@ export declare type AiTwinHandle = {
49
49
  /** Mute/unmute bot audio output (TTS + voice). */
50
50
  setMuted: (muted: boolean) => void;
51
51
  isMuted: () => boolean;
52
- /** Persona / knowledge context id from getAiTwin (for /avatarReply). */
52
+ /** Brain id from getAiTwin (for /avatarReply and /ws/voice). */
53
+ getBrainId: () => string | null;
54
+ /** @deprecated Use `getBrainId`. */
53
55
  getPersonaId: () => string | null;
54
56
  };
55
57
 
@@ -153,7 +155,9 @@ export declare type AiTwinRecord = {
153
155
  voiceId?: string;
154
156
  /** Bearer JWT for TTS / voice WebSocket (same as `getAuthToken`). */
155
157
  authToken?: string;
156
- /** When set, passed as `personaId` on voice WebSocket connect. */
158
+ /** Redis brain id. Passed as `brainId` on `/ws/voice` and `/avatarReply`. */
159
+ brainId?: string;
160
+ /** @deprecated Use `brainId`. */
157
161
  knowledgeContextId?: string;
158
162
  gender?: string;
159
163
  createdAt?: string;
@@ -228,9 +232,11 @@ export declare type AiTwinWidgetProps = {
228
232
  */
229
233
  float?: boolean;
230
234
  /**
231
- * Persona / knowledge context id for /avatarReply (Text mode).
232
- * When omitted, uses getAiTwin `knowledgeContextId` if available.
235
+ * Brain id for /avatarReply (Text mode).
236
+ * When omitted, uses getAiTwin `brainId` if available.
233
237
  */
238
+ brainId?: string;
239
+ /** @deprecated Use `brainId`. */
234
240
  personaId?: string;
235
241
  /**
236
242
  * Optional poster shown (blurred) on `<AiTwin>` while sil/atlas/idle assets load.
@@ -346,6 +352,8 @@ export declare type FetchAvatarReplyOptions = {
346
352
  message: string;
347
353
  authToken: string;
348
354
  apiBase?: string;
355
+ brainId?: string;
356
+ /** @deprecated Use `brainId`. */
349
357
  personaId?: string;
350
358
  history?: AvatarReplyMessage[];
351
359
  /** Called as soon as spokenText arrives on the SSE stream. */
@@ -506,6 +514,9 @@ export declare type RealtimeVoiceOptions = VoiceConnectOptions & {
506
514
  /** Resolve optional `avatarId` / `faceId` props (same R2 custom-faces hex id). */
507
515
  export declare function resolveDirectFaceId(avatarId?: string, faceId?: string): string | undefined;
508
516
 
517
+ /** Canonical `brainId`, then legacy `knowledgeContextId`, then extra fallbacks. */
518
+ export declare function resolveTwinBrainId(source?: TwinBrainFields | string | null, ...fallbacks: Array<string | null | undefined>): string | undefined;
519
+
509
520
  /** Pick the active viseme at playback offset (latest vtime wins on overlap). */
510
521
  export declare function resolveVisemeAtTime(queue: VisemeQueueItem[], elapsedMs: number): string;
511
522
 
@@ -830,6 +841,12 @@ export declare type TwinAssetUrls = {
830
841
  encrypted: boolean;
831
842
  };
832
843
 
844
+ declare type TwinBrainFields = {
845
+ brainId?: string | null;
846
+ /** @deprecated Use `brainId`. Older getAiTwin responses still send this. */
847
+ knowledgeContextId?: string | null;
848
+ };
849
+
833
850
  export declare const VISEME_IDS: readonly ["aa", "E", "I", "O", "U", "PP", "FF", "DD", "SS", "TH", "CH", "RR", "kk", "nn"];
834
851
 
835
852
  /** Minimum gap (ms) between consecutive vtimes to keep a skippable viseme. */
@@ -868,7 +885,9 @@ export declare type VoiceConnectOptions = {
868
885
  * Sent as `language` on `/ws/voice` and redirected `/avatar_ttsWithPoses` calls.
869
886
  */
870
887
  language?: TtsLanguage;
871
- /** Persona / knowledge context id (from getAiTwin `knowledgeContextId`). */
888
+ /** Redis brain id (from getAiTwin `brainId`). Sent as `brainId` on `/ws/voice`. */
889
+ brainId?: string;
890
+ /** @deprecated Use `brainId`. */
872
891
  personaId?: string;
873
892
  speakingRate?: number;
874
893
  /** Default true — server streams TTS + avatar messages. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoji/aitwin",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "Embeddable React AI twin face with TTS lipsync",
5
5
  "type": "module",
6
6
  "main": "./dist/aitwin.cjs",