@streamoji/aitwin 0.6.4 → 0.6.7

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
@@ -53,6 +53,8 @@ export declare type AiTwinHandle = {
53
53
  getBrainId: () => string | null;
54
54
  /** @deprecated Use `getBrainId`. */
55
55
  getPersonaId: () => string | null;
56
+ /** Client SSE brain URL from getAiTwin (for /ws/voice). */
57
+ getBrainUrl: () => string | null;
56
58
  };
57
59
 
58
60
  export declare class AiTwinNotFoundError extends Error {
@@ -159,6 +161,8 @@ export declare type AiTwinRecord = {
159
161
  brainId?: string;
160
162
  /** @deprecated Use `brainId`. */
161
163
  knowledgeContextId?: string;
164
+ /** Client SSE brain URL. Passed as `brainUrl` on `/ws/voice`. */
165
+ brainUrl?: string;
162
166
  gender?: string;
163
167
  createdAt?: string;
164
168
  updatedAt?: string;
@@ -232,12 +236,17 @@ export declare type AiTwinWidgetProps = {
232
236
  */
233
237
  float?: boolean;
234
238
  /**
235
- * Brain id for /avatarReply (Text mode).
239
+ * Brain id for /avatarReply (Text mode) and `/ws/voice`.
236
240
  * When omitted, uses getAiTwin `brainId` if available.
237
241
  */
238
242
  brainId?: string;
239
243
  /** @deprecated Use `brainId`. */
240
244
  personaId?: string;
245
+ /**
246
+ * Client SSE brain URL for `/ws/voice`.
247
+ * When omitted, uses getAiTwin `brainUrl` if available.
248
+ */
249
+ brainUrl?: string;
241
250
  /**
242
251
  * Optional poster shown (blurred) on `<AiTwin>` while sil/atlas/idle assets load.
243
252
  * When omitted, AiTwin derives it from `faceId`/`avatarId`.
@@ -454,6 +463,12 @@ export declare function parsePackedVoiceId(raw?: string): {
454
463
  voiceId?: string;
455
464
  };
456
465
 
466
+ /**
467
+ * Validate a client SSE brain URL. Empty/whitespace is unset.
468
+ * Must be http(s) with a host and no fragment — same rules as `/ws/voice`.
469
+ */
470
+ export declare function parseTwinBrainUrl(value?: string | null): string | undefined;
471
+
457
472
  export declare const PLAYBACK_SAMPLE_RATE = 16000;
458
473
 
459
474
  declare type RawVisemeTransition = {
@@ -517,6 +532,8 @@ export declare function resolveDirectFaceId(avatarId?: string, faceId?: string):
517
532
  /** Canonical `brainId`, then legacy `knowledgeContextId`, then extra fallbacks. */
518
533
  export declare function resolveTwinBrainId(source?: TwinBrainFields | string | null, ...fallbacks: Array<string | null | undefined>): string | undefined;
519
534
 
535
+ export declare function resolveTwinBrainUrl(source?: TwinBrainFields | string | null, ...fallbacks: Array<string | null | undefined>): string | undefined;
536
+
520
537
  /** Pick the active viseme at playback offset (latest vtime wins on overlap). */
521
538
  export declare function resolveVisemeAtTime(queue: VisemeQueueItem[], elapsedMs: number): string;
522
539
 
@@ -845,6 +862,8 @@ declare type TwinBrainFields = {
845
862
  brainId?: string | null;
846
863
  /** @deprecated Use `brainId`. Older getAiTwin responses still send this. */
847
864
  knowledgeContextId?: string | null;
865
+ /** Client SSE brain URL. When set, `/ws/voice` skips hosted brainId / Grok / OpenAI. */
866
+ brainUrl?: string | null;
848
867
  };
849
868
 
850
869
  export declare const VISEME_IDS: readonly ["aa", "E", "I", "O", "U", "PP", "FF", "DD", "SS", "TH", "CH", "RR", "kk", "nn"];
@@ -889,6 +908,11 @@ export declare type VoiceConnectOptions = {
889
908
  brainId?: string;
890
909
  /** @deprecated Use `brainId`. */
891
910
  personaId?: string;
911
+ /**
912
+ * Client SSE brain URL. When set, `/ws/voice` skips hosted brainId / Grok / OpenAI
913
+ * and GETs this URL with socket query params plus `text=<user turn>`.
914
+ */
915
+ brainUrl?: string;
892
916
  speakingRate?: number;
893
917
  /** Default true — server streams TTS + avatar messages. */
894
918
  ttsStream?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoji/aitwin",
3
- "version": "0.6.4",
3
+ "version": "0.6.7",
4
4
  "description": "Embeddable React AI twin face with TTS lipsync",
5
5
  "type": "module",
6
6
  "main": "./dist/aitwin.cjs",