@pagelines/sdk 1.0.934 → 1.0.936

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/provider2.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./rolldown-runtime.js";
2
- import { c as e } from "./sdkClient.js";
3
- import { r as t } from "./provider.js";
2
+ import { r as e } from "./provider.js";
3
+ import { c as t } from "./sdkClient.js";
4
4
  import { voiceBudgets as n, zVoiceSessionEnd as r } from "@pagelines/core";
5
5
  // ../../node_modules/.pnpm/livekit-client@2.23.0_@types+dom-mediacapture-record@1.0.22/node_modules/livekit-client/dist/livekit-client.esm.mjs
6
6
  function _mergeNamespaces(e, t) {
@@ -9348,7 +9348,7 @@ var Kr = 300, FrameMetadataExtractor = class {
9348
9348
  return;
9349
9349
  }
9350
9350
  let r = new FrameMetadataExtractor(), i = e.mediaStreamID;
9351
- this.extractors.set(i, r), e.frameMetadataExtractor = r, !this.room?.hasE2EESetup && this.setupWorkerReceiver(n, i, !0);
9351
+ this.extractors.set(i, r), e.frameMetadataExtractor = r, this.room?.hasE2EESetup || this.setupWorkerReceiver(n, i, !0);
9352
9352
  }
9353
9353
  setupPassthroughReceiver(e, t) {
9354
9354
  shouldUseFrameMetadataScriptTransform() ? "transform" in e && (e.transform = null) : (this.worker && isFrameMetadataSupported({ worker: this.worker }) && !this.workerPipelines.has(e) || this.worker && this.workerPipelines.has(e)) && this.setupWorkerReceiver(e, t, !1);
@@ -13269,7 +13269,7 @@ var ia = 5e3, LocalVideoTrack = class extends LocalTrack {
13269
13269
  startMonitor(e) {
13270
13270
  if (this.signalClient = e, !isWeb()) return;
13271
13271
  let t = this.sender?.getParameters();
13272
- t && (this.encodings = t.encodings), !this.monitorInterval && (this.monitorInterval = setInterval(() => {
13272
+ t && (this.encodings = t.encodings), this.monitorInterval || (this.monitorInterval = setInterval(() => {
13273
13273
  this.monitorSender();
13274
13274
  }, Ur));
13275
13275
  }
@@ -14150,7 +14150,7 @@ var da = 64e3, RTCEngine = class extends k.EventEmitter {
14150
14150
  }
14151
14151
  scheduleLostQualityReconnect() {
14152
14152
  this.lostQualityTimeout || (this.lostQualityTimeout = CriticalTimers.setTimeout(() => {
14153
- this.lostQualityTimeout = void 0, !(this._isClosed || this.pcState !== G.Connected || this.attemptingReconnect) && this.hasActivePublisherSenders() && (this.log.warn("local connection quality lost while publishing, triggering full reconnect", this.logContext), this.fullReconnectOnNext = !0, this.handleDisconnect("connection quality lost", Ce.RR_PUBLISHER_FAILED));
14153
+ this.lostQualityTimeout = void 0, this._isClosed || this.pcState !== G.Connected || this.attemptingReconnect || this.hasActivePublisherSenders() && (this.log.warn("local connection quality lost while publishing, triggering full reconnect", this.logContext), this.fullReconnectOnNext = !0, this.handleDisconnect("connection quality lost", Ce.RR_PUBLISHER_FAILED));
14154
14154
  }, sa));
14155
14155
  }
14156
14156
  clearLostQualityTimeout() {
@@ -19018,7 +19018,7 @@ var Ao = class Room extends k.EventEmitter {
19018
19018
  e.element.srcObject = document.hidden ? null : e.stream, document.hidden || (this.log.debug("page visible again, triggering startAudio to resume playback and update playback status"), this.startAudio().catch((e) => this.log.warn("Could not restart audio on page becoming visible", Object.assign(Object.assign({}, this.logContext), { error: e }))));
19019
19019
  };
19020
19020
  return document.addEventListener("visibilitychange", handleVisibilityChange), this.releaseDummyAudioElement = () => {
19021
- this.releaseDummyAudioElement = void 0, document.removeEventListener("visibilitychange", handleVisibilityChange), --e.refCount, !(e.refCount > 0) && (e.element.srcObject = null, e.element.remove(), ko = void 0, releaseEmptyAudioStreamTrack(e.track).catch((e) => this.log.warn("Could not release the dummy audio element track", Object.assign(Object.assign({}, this.logContext), { error: e }))));
19021
+ this.releaseDummyAudioElement = void 0, document.removeEventListener("visibilitychange", handleVisibilityChange), --e.refCount, e.refCount > 0 || (e.element.srcObject = null, e.element.remove(), ko = void 0, releaseEmptyAudioStreamTrack(e.track).catch((e) => this.log.warn("Could not release the dummy audio element track", Object.assign(Object.assign({}, this.logContext), { error: e }))));
19022
19022
  }, e.element;
19023
19023
  }
19024
19024
  acquireEmptyAudioStreamTrack() {
@@ -19625,8 +19625,8 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
19625
19625
  _defineProperty(JWSSignatureVerificationFailed, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
19626
19626
  // bot/voice/providers/livekit/provider.ts
19627
19627
  var Mo = "lk.agent.state", LiveKitVoiceProvider = class {
19628
- constructor(t, n = {}) {
19629
- e(this, "mint", void 0), e(this, "room", void 0), e(this, "createAnalyser", void 0), e(this, "handlers", void 0), e(this, "cancelReadyWait", void 0), e(this, "analysers", []), e(this, "levelSources", []), e(this, "attachedElements", []), e(this, "closing", !1), e(this, "userSpeaking", !1), e(this, "botActiveSpeaker", !1), e(this, "botStateSpeaking", !1), e(this, "lastSpeaking", void 0), e(this, "endReason", void 0), this.mint = t, this.room = n.createRoom?.() ?? new Ao(), this.createAnalyser = n.createAnalyser;
19628
+ constructor(e, n = {}) {
19629
+ t(this, "mint", void 0), t(this, "room", void 0), t(this, "createAnalyser", void 0), t(this, "handlers", void 0), t(this, "cancelReadyWait", void 0), t(this, "analysers", []), t(this, "levelSources", []), t(this, "attachedElements", []), t(this, "closing", !1), t(this, "userSpeaking", !1), t(this, "botActiveSpeaker", !1), t(this, "botStateSpeaking", !1), t(this, "lastSpeaking", void 0), t(this, "endReason", void 0), this.mint = e, this.room = n.createRoom?.() ?? new Ao(), this.createAnalyser = n.createAnalyser;
19630
19630
  }
19631
19631
  async connect(e) {
19632
19632
  this.handlers = e, this.room.registerRpcMethod("pagelines.voice.end", async ({ callerIdentity: e, payload: t }) => {
@@ -19709,11 +19709,11 @@ var Mo = "lk.agent.state", LiveKitVoiceProvider = class {
19709
19709
  this.room.on(N.ParticipantConnected, onParticipant), this.room.on(N.ParticipantAttributesChanged, onAttributes), this.cancelReadyWait = () => finish();
19710
19710
  });
19711
19711
  }
19712
- analyserFor(e) {
19712
+ analyserFor(t) {
19713
19713
  try {
19714
- if (this.createAnalyser) return this.createAnalyser(e);
19715
- if (!(e instanceof LocalAudioTrack || e instanceof RemoteAudioTrack)) return;
19716
- let { analyser: n, calculateVolume: r, cleanup: i } = createAudioAnalyser(e, {
19714
+ if (this.createAnalyser) return this.createAnalyser(t);
19715
+ if (!(t instanceof LocalAudioTrack || t instanceof RemoteAudioTrack)) return;
19716
+ let { analyser: n, calculateVolume: r, cleanup: i } = createAudioAnalyser(t, {
19717
19717
  fftSize: 512,
19718
19718
  smoothingTimeConstant: .65,
19719
19719
  minDecibels: -85,
@@ -19721,7 +19721,7 @@ var Mo = "lk.agent.state", LiveKitVoiceProvider = class {
19721
19721
  }), a = new Uint8Array(n.frequencyBinCount), c = n.context;
19722
19722
  return c.state === "suspended" && c.resume().catch(() => {}), {
19723
19723
  calculateVolume: r,
19724
- calculateBands: () => (n.getByteFrequencyData(a), t(a, c.sampleRate, n.fftSize)),
19724
+ calculateBands: () => (n.getByteFrequencyData(a), e(a, c.sampleRate, n.fftSize)),
19725
19725
  cleanup: i
19726
19726
  };
19727
19727
  } catch {