@estuary-ai/sdk 0.1.10 → 0.1.12

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.mts CHANGED
@@ -246,6 +246,7 @@ declare class EstuaryClient extends TypedEventEmitter<EstuaryEventMap> {
246
246
  private _sessionInfo;
247
247
  private actionParsers;
248
248
  private _hasAutoInterrupted;
249
+ private _autoInterruptGraceTimer;
249
250
  constructor(config: EstuaryConfig);
250
251
  /** Memory API client for querying memories, graphs, and facts */
251
252
  get memory(): MemoryClient;
package/dist/index.js CHANGED
@@ -9321,7 +9321,11 @@ var AudioPlayer = class {
9321
9321
  this.currentSource = null;
9322
9322
  this.playNext();
9323
9323
  };
9324
- if (this.audioElement) this.audioElement.muted = false;
9324
+ if (this.audioElement) {
9325
+ this.audioElement.muted = false;
9326
+ this.audioElement.play().catch(() => {
9327
+ });
9328
+ }
9325
9329
  ctx.resume().catch(() => {
9326
9330
  });
9327
9331
  source.start();
@@ -9431,6 +9435,7 @@ var EstuaryClient = class extends TypedEventEmitter {
9431
9435
  _sessionInfo = null;
9432
9436
  actionParsers = /* @__PURE__ */ new Map();
9433
9437
  _hasAutoInterrupted = false;
9438
+ _autoInterruptGraceTimer = null;
9434
9439
  constructor(config) {
9435
9440
  super();
9436
9441
  this.config = config;
@@ -9466,6 +9471,10 @@ var EstuaryClient = class extends TypedEventEmitter {
9466
9471
  /** Disconnect from the server */
9467
9472
  disconnect() {
9468
9473
  this.logger.info("Disconnecting...");
9474
+ if (this._autoInterruptGraceTimer) {
9475
+ clearTimeout(this._autoInterruptGraceTimer);
9476
+ this._autoInterruptGraceTimer = null;
9477
+ }
9469
9478
  this.stopVoice();
9470
9479
  this.audioPlayer?.dispose();
9471
9480
  this.audioPlayer = null;
@@ -9484,6 +9493,10 @@ var EstuaryClient = class extends TypedEventEmitter {
9484
9493
  this.audioPlayer?.setInterruptedMessageId(messageId ?? this.audioPlayer.playingMessageId);
9485
9494
  this.audioPlayer?.clear();
9486
9495
  this._hasAutoInterrupted = true;
9496
+ if (this._autoInterruptGraceTimer) {
9497
+ clearTimeout(this._autoInterruptGraceTimer);
9498
+ this._autoInterruptGraceTimer = null;
9499
+ }
9487
9500
  if (this.config.suppressMicDuringPlayback) {
9488
9501
  this.voiceManager?.setSuppressed?.(false);
9489
9502
  }
@@ -9524,7 +9537,12 @@ var EstuaryClient = class extends TypedEventEmitter {
9524
9537
  if (!this.audioPlayer && typeof AudioContext !== "undefined") {
9525
9538
  this.audioPlayer = new AudioPlayer(sampleRate, (event) => {
9526
9539
  if (event.type === "started") {
9527
- this._hasAutoInterrupted = false;
9540
+ this._hasAutoInterrupted = true;
9541
+ if (this._autoInterruptGraceTimer) clearTimeout(this._autoInterruptGraceTimer);
9542
+ this._autoInterruptGraceTimer = setTimeout(() => {
9543
+ this._hasAutoInterrupted = false;
9544
+ this._autoInterruptGraceTimer = null;
9545
+ }, 1500);
9528
9546
  this.emit("audioPlaybackStarted", event.messageId);
9529
9547
  if (this.config.suppressMicDuringPlayback) {
9530
9548
  this.voiceManager?.setSuppressed?.(true);
@@ -9593,7 +9611,6 @@ var EstuaryClient = class extends TypedEventEmitter {
9593
9611
  this.audioPlayer?.setInterruptedMessageId(data.messageId ?? null);
9594
9612
  this.audioPlayer?.clear();
9595
9613
  this.actionParsers.clear();
9596
- this._hasAutoInterrupted = false;
9597
9614
  if (this.config.suppressMicDuringPlayback) {
9598
9615
  this.voiceManager?.setSuppressed?.(false);
9599
9616
  }