ttp-agent-sdk 2.46.1 → 2.46.3

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.
@@ -11993,7 +11993,7 @@ var TextChatSDK = /*#__PURE__*/function (_EventEmitter) {
11993
11993
 
11994
11994
  // SDK build time for debugging
11995
11995
  if (true) {
11996
- helloMessage.lastBuildTime = "2026-07-13T08:30:44.984Z";
11996
+ helloMessage.lastBuildTime = "2026-07-13T09:55:44.731Z";
11997
11997
  }
11998
11998
  try {
11999
11999
  this.ws.send(JSON.stringify(helloMessage));
@@ -21205,8 +21205,8 @@ var VoiceSDK = _v2_VoiceSDK_js__WEBPACK_IMPORTED_MODULE_0__["default"];
21205
21205
 
21206
21206
 
21207
21207
  // Version - injected at build time from package.json via webpack DefinePlugin
21208
- var VERSION = "2.46.1";
21209
- var BUILD_TIME = "2026-07-13T08:30:44.984Z";
21208
+ var VERSION = "2.46.3";
21209
+ var BUILD_TIME = "2026-07-13T09:55:44.731Z";
21210
21210
  console.log("%c TTP Agent SDK v".concat(VERSION, " (").concat(BUILD_TIME, ") "), 'background: #4f46e5; color: white; font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 4px;');
21211
21211
 
21212
21212
  // Named exports
@@ -27491,6 +27491,28 @@ var AudioPlayer = /*#__PURE__*/function (_EventEmitter) {
27491
27491
  * Mark that a new sentence is starting.
27492
27492
  * Call this when audio_start is received, before audio chunks arrive.
27493
27493
  */
27494
+ /**
27495
+ * Clear the stopped flag and reset scheduling state WITHOUT a new sentence marker.
27496
+ * Monitor (listen-only supervision) streams have no audio_start messages, so after a
27497
+ * relayed stop_playing flush nothing would ever clear _isStopped and all later audio
27498
+ * would be rejected. The SDK calls this when the next binary frame arrives — WS
27499
+ * ordering guarantees it is live post-barge-in audio.
27500
+ */
27501
+ }, {
27502
+ key: "resumeAfterStop",
27503
+ value: function resumeAfterStop() {
27504
+ if (!this._isStopped) {
27505
+ return;
27506
+ }
27507
+ console.log('▶️ AudioPlayer: resumeAfterStop - clearing stopped flag (no sentence marker)');
27508
+ this._isStopped = false;
27509
+ // Same reset as markNewSentence's post-barge-in branch: schedule fresh, drop leftovers.
27510
+ this.nextStartTime = 0;
27511
+ this.scheduledBuffers = 0;
27512
+ this.preparedBuffer = [];
27513
+ this.pcmChunkQueue = [];
27514
+ this.isProcessingPcmQueue = false;
27515
+ }
27494
27516
  }, {
27495
27517
  key: "markNewSentence",
27496
27518
  value: function markNewSentence(text, synced, segmentId) {
@@ -28702,6 +28724,16 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
28702
28724
  // Release wake lock on disconnect
28703
28725
  _this5._releaseWakeLock();
28704
28726
 
28727
+ // Monitor (listen-only supervision): the socket closing means the call ended —
28728
+ // flush any agent audio still queued in the player so listening stops immediately.
28729
+ if (_this5.isMonitor() && _this5.audioPlayer) {
28730
+ try {
28731
+ _this5.stopAudioPlayback();
28732
+ } catch (e) {
28733
+ console.warn('VoiceSDK v2: monitor close flush failed:', e);
28734
+ }
28735
+ }
28736
+
28705
28737
  // Reject all pending data injections on disconnect
28706
28738
  if (_this5.pendingInjections.size > 0) {
28707
28739
  console.warn("VoiceSDK v2: Rejecting ".concat(_this5.pendingInjections.size, " pending data injections due to disconnect"));
@@ -28877,7 +28909,7 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
28877
28909
 
28878
28910
  // Include SDK build time for debugging
28879
28911
  if (true) {
28880
- helloMessage.lastBuildTime = "2026-07-13T08:30:44.984Z";
28912
+ helloMessage.lastBuildTime = "2026-07-13T09:55:44.731Z";
28881
28913
  }
28882
28914
 
28883
28915
  // Page context is intentionally NOT attached to the hello message.
@@ -30101,6 +30133,15 @@ var VoiceSDK_v2 = /*#__PURE__*/function (_EventEmitter) {
30101
30133
  return _regenerator().w(function (_context7) {
30102
30134
  while (1) switch (_context7.p = _context7.n) {
30103
30135
  case 0:
30136
+ // Monitor (listen-only supervision): no audio_start messages exist to clear the
30137
+ // player's stopped flag after a relayed stop_playing (caller barge-in flush), so
30138
+ // resume on the next binary frame — the server emits in order, so anything after
30139
+ // the stop marker is live post-barge-in audio.
30140
+ if (this.isMonitor() && this.audioPlayer && this.audioPlayer._isStopped) {
30141
+ this.audioPlayer.resumeAfterStop();
30142
+ }
30143
+
30144
+ // Convert Blob to ArrayBuffer if needed
30104
30145
  if (!(data instanceof Blob)) {
30105
30146
  _context7.n = 2;
30106
30147
  break;
@@ -34904,7 +34945,7 @@ var TTPChatWidget = /*#__PURE__*/function () {
34904
34945
  return;
34905
34946
  }
34906
34947
  this._ensureAboutStyles();
34907
- var version = true ? "2.46.1" : 0;
34948
+ var version = true ? "2.46.3" : 0;
34908
34949
  var convId = this._getLastConversationId();
34909
34950
  var t = function t(k, fb) {
34910
34951
  try {