@eshal-bot/chat-widget 0.2.45 → 0.2.47

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.
@@ -1 +1 @@
1
- export{S as default}from"./chat-widget-index-BMVyeU-x.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
1
+ export{S as default}from"./chat-widget-index-MI4rHyOE.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
@@ -9210,6 +9210,20 @@
9210
9210
  */
9211
9211
  const BARGE_IN_RESUME_AFTER_MS = 4000;
9212
9212
 
9213
+ /**
9214
+ * Whether a sound the speech gate hears pauses what is playing. Not the
9215
+ * greeting: at call start the speakers' echo opens the gate before echo
9216
+ * cancellation settles, and the greeting sat paused waiting for the server's
9217
+ * verdict. Dev, 11 Nov 2026: 2 of 8 preview calls paused it about 1 s in with
9218
+ * no one speaking, and a caller took the pause for their turn. The server
9219
+ * still stops the greeting on the caller's real words (`interrupted`) and
9220
+ * ignores its own echo (voice-runtime barge_in.py).
9221
+ * Mirrors packages/frontend/src/lib/audio/bargeIn.ts.
9222
+ */
9223
+ function pausesForSound(greetingPlaying) {
9224
+ return !greetingPlaying;
9225
+ }
9226
+
9213
9227
  /** "resume" | "discard" | null (the event says nothing about the sound). */
9214
9228
  function bargeInVerdict(event) {
9215
9229
  if (!event) return null;
@@ -15194,12 +15208,12 @@
15194
15208
  prevIds: prev.map(m => ({
15195
15209
  id: m.id,
15196
15210
  role: m.role,
15197
- content: m.content?.substring(0, 30)
15211
+ contentLength: m.content?.length || 0
15198
15212
  })),
15199
15213
  resultIds: result.map(m => ({
15200
15214
  id: m.id,
15201
15215
  role: m.role,
15202
- content: m.content?.substring(0, 30)
15216
+ contentLength: m.content?.length || 0
15203
15217
  }))
15204
15218
  });
15205
15219
  return prev; // Return previous state to prevent data loss
@@ -15214,7 +15228,7 @@
15214
15228
  const appendAssistantContent = reactExports.useCallback((text, finished = false) => {
15215
15229
  setIsLoading(false);
15216
15230
  console.log("[BIDI] appendAssistantContent called", {
15217
- text: text?.substring(0, 50),
15231
+ textLength: text?.length || 0,
15218
15232
  finished,
15219
15233
  currentAssistantId: currentAssistantMessageIdRef.current,
15220
15234
  currentInputId: currentInputMessageIdRef.current
@@ -15405,12 +15419,12 @@
15405
15419
  prevIds: prev.map(m => ({
15406
15420
  id: m.id,
15407
15421
  role: m.role,
15408
- content: m.content?.substring(0, 30)
15422
+ contentLength: m.content?.length || 0
15409
15423
  })),
15410
15424
  resultIds: result.map(m => ({
15411
15425
  id: m.id,
15412
15426
  role: m.role,
15413
- content: m.content?.substring(0, 30)
15427
+ contentLength: m.content?.length || 0
15414
15428
  }))
15415
15429
  });
15416
15430
  // Return previous state to prevent data loss
@@ -15464,7 +15478,7 @@
15464
15478
  if (!audioOnly && part.text) {
15465
15479
  accumulatedText += part.text;
15466
15480
  console.log("[BIDI] handleContentParts: accumulated text part", {
15467
- text: part.text.substring(0, 50),
15481
+ textLength: part.text.length,
15468
15482
  index,
15469
15483
  totalAccumulated: accumulatedText.length
15470
15484
  });
@@ -15636,7 +15650,6 @@
15636
15650
  const transcriptionText = event.inputTranscription.text || '';
15637
15651
  const transcriptionFinished = Boolean(event.inputTranscription.finished);
15638
15652
  console.log("[BIDI] handleBidiEvent: processing inputTranscription", {
15639
- text: transcriptionText.substring(0, 50),
15640
15653
  textLength: transcriptionText.length,
15641
15654
  finished: transcriptionFinished,
15642
15655
  hasText: !!transcriptionText
@@ -15868,10 +15881,13 @@
15868
15881
  // then resumes the audio or drops it (lib/audio/bargeIn.js): emptying
15869
15882
  // the player here lost the rest of a reply to a cough (dev, 16 Oct).
15870
15883
  onSpeechStart: () => {
15871
- audioPlayerNodeRef.current?.port.postMessage({
15872
- command: "pause"
15873
- });
15874
- bargeInPendingRef.current = true;
15884
+ // The greeting plays on over a sound (lib/audio/bargeIn.js).
15885
+ if (pausesForSound(greetingActiveRef.current && !userHasSpokenRef.current)) {
15886
+ audioPlayerNodeRef.current?.port.postMessage({
15887
+ command: "pause"
15888
+ });
15889
+ bargeInPendingRef.current = true;
15890
+ }
15875
15891
  if (bargeInTimerRef.current) clearTimeout(bargeInTimerRef.current);
15876
15892
  bargeInTimerRef.current = null;
15877
15893
  const ws = websocketRef.current;
@@ -15963,7 +15979,9 @@
15963
15979
  };
15964
15980
  ws.onmessage = event => {
15965
15981
  try {
15966
- const dataPreview = typeof event.data === 'string' ? event.data.substring(0, 200) : 'binary';
15982
+ // The message kind only: a frame's text is what the caller or the
15983
+ // agent said, and transcripts stay out of browser logs (voice board paper, gate D).
15984
+ const dataPreview = typeof event.data === 'string' ? event.data.match(/^\{"([^"]+)"/)?.[1] || 'text' : 'binary';
15967
15985
  console.log("[BIDI] WebSocket message received", {
15968
15986
  dataLength: event.data?.length,
15969
15987
  dataPreview
@@ -16385,8 +16403,7 @@
16385
16403
  role: m.role,
16386
16404
  contentLength: m.content?.length || 0,
16387
16405
  isProcessing: m.isProcessing,
16388
- hasContent: !!m.content,
16389
- contentPreview: m.content?.substring(0, 50)
16406
+ hasContent: !!m.content
16390
16407
  }))
16391
16408
  });
16392
16409
  }
@@ -23944,7 +23961,7 @@
23944
23961
  * value by its own test (that constant sat at 0.1.113 while this package was
23945
23962
  * at 0.2.2 precisely because nothing enforced it - EV-2431).
23946
23963
  */
23947
- const WIDGET_VERSION = '0.2.45';
23964
+ const WIDGET_VERSION = '0.2.47';
23948
23965
 
23949
23966
  /**
23950
23967
  * API utility functions