@devvibex/aiflow 1.4.0 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvibex/aiflow",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "First-party LLM gateway SDK for apps generated on the VibeX platform — chat, streaming, image, video, music (Lyria), sound effects (ElevenLabs), embeddings and real-time speech translation (Gemini Live) without shipping any third-party API key.",
5
5
  "keywords": [
6
6
  "ai",
package/src/index.d.ts CHANGED
@@ -411,6 +411,7 @@ export interface LiveAudioOut {
411
411
 
412
412
  export interface LiveTurnComplete {
413
413
  interrupted: boolean;
414
+ turnComplete: boolean;
414
415
  }
415
416
 
416
417
  export interface LiveError {
@@ -441,6 +442,11 @@ export interface LiveTranslateOptions {
441
442
  onReady?: (payload: LiveReadyPayload) => void;
442
443
  onTranscript?: (payload: LiveTranscript) => void;
443
444
  onAudio?: (payload: LiveAudioOut) => void;
445
+ /**
446
+ * Barge-in: the model cancelled the in-flight turn. You MUST flush queued
447
+ * playback here so the abandoned translation doesn't talk over new speech.
448
+ */
449
+ onInterrupted?: () => void;
444
450
  onTurnComplete?: (payload: LiveTurnComplete) => void;
445
451
  onError?: (payload: LiveError) => void;
446
452
  onClosed?: (payload: LiveClosed) => void;
@@ -450,6 +456,7 @@ export type LiveTranslateEvent =
450
456
  | 'ready'
451
457
  | 'transcript'
452
458
  | 'audio'
459
+ | 'interrupted'
453
460
  | 'turn_complete'
454
461
  | 'error'
455
462
  | 'closed';
package/src/index.js CHANGED
@@ -616,7 +616,8 @@ export class AIFlowClient {
616
616
  * @param {(p:object)=>void} [opts.onReady]
617
617
  * @param {(p:{role:'input'|'output',text:string,isFinal:boolean})=>void} [opts.onTranscript]
618
618
  * @param {(p:{chunk:string,mimeType:string})=>void} [opts.onAudio]
619
- * @param {(p:{interrupted:boolean})=>void} [opts.onTurnComplete]
619
+ * @param {()=>void} [opts.onInterrupted] Barge-in: the model cancelled the in-flight turn. You MUST flush queued playback here so stale audio doesn't talk over new speech.
620
+ * @param {(p:{interrupted:boolean,turnComplete:boolean})=>void} [opts.onTurnComplete]
620
621
  * @param {(p:{code:string,message:string})=>void} [opts.onError]
621
622
  * @param {(p:{reason:string,usage:object})=>void} [opts.onClosed]
622
623
  * @returns {Promise<LiveTranslateSession>} Resolves once connected.
@@ -632,6 +633,7 @@ export class AIFlowClient {
632
633
  onReady,
633
634
  onTranscript,
634
635
  onAudio,
636
+ onInterrupted,
635
637
  onTurnComplete,
636
638
  onError,
637
639
  onClosed,
@@ -662,6 +664,7 @@ export class AIFlowClient {
662
664
  onReady,
663
665
  onTranscript,
664
666
  onAudio,
667
+ onInterrupted,
665
668
  onTurnComplete,
666
669
  onError,
667
670
  onClosed,
@@ -880,6 +883,7 @@ export class LiveTranslateSession {
880
883
  });
881
884
  fwd('translate:transcript', this._handlers.onTranscript);
882
885
  fwd('translate:audio', this._handlers.onAudio);
886
+ fwd('translate:interrupted', this._handlers.onInterrupted);
883
887
  fwd('translate:turn_complete', this._handlers.onTurnComplete);
884
888
  fwd('translate:error', this._handlers.onError);
885
889
  this.socket.on('translate:closed', (p) => {