@absolutejs/voice 0.0.22-beta.592 → 0.0.22-beta.593

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.js CHANGED
@@ -6289,9 +6289,21 @@ var createVoiceSession = (options) => {
6289
6289
  amdFirstAudioAt = Date.now();
6290
6290
  }
6291
6291
  speechDetected = true;
6292
- clearSilenceTimer();
6293
6292
  kickCallSilenceWatchdog();
6294
6293
  backchannelDriver?.noteSpeech();
6294
+ const latest = await readSession();
6295
+ const sttQuietMs = latest.currentTurn.lastTranscriptAt !== undefined ? Date.now() - latest.currentTurn.lastTranscriptAt : Number.POSITIVE_INFINITY;
6296
+ const hasTurnTextDespiteNoise = Boolean(buildTurnText(latest.currentTurn.transcripts, latest.currentTurn.partialText, {
6297
+ partialEndedAtMs: latest.currentTurn.partialEndedAt,
6298
+ partialStartedAtMs: latest.currentTurn.partialStartedAt
6299
+ }));
6300
+ if (hasTurnTextDespiteNoise && sttQuietMs >= turnDetection.silenceMs) {
6301
+ if (!silenceTimer) {
6302
+ scheduleSilenceCommit(0);
6303
+ }
6304
+ } else {
6305
+ clearSilenceTimer();
6306
+ }
6295
6307
  } else if (speechDetected) {
6296
6308
  backchannelDriver?.noteSilence();
6297
6309
  const currentSession = await readSession();
@@ -8516,9 +8516,21 @@ var createVoiceSession = (options) => {
8516
8516
  amdFirstAudioAt = Date.now();
8517
8517
  }
8518
8518
  speechDetected = true;
8519
- clearSilenceTimer();
8520
8519
  kickCallSilenceWatchdog();
8521
8520
  backchannelDriver?.noteSpeech();
8521
+ const latest = await readSession();
8522
+ const sttQuietMs = latest.currentTurn.lastTranscriptAt !== undefined ? Date.now() - latest.currentTurn.lastTranscriptAt : Number.POSITIVE_INFINITY;
8523
+ const hasTurnTextDespiteNoise = Boolean(buildTurnText(latest.currentTurn.transcripts, latest.currentTurn.partialText, {
8524
+ partialEndedAtMs: latest.currentTurn.partialEndedAt,
8525
+ partialStartedAtMs: latest.currentTurn.partialStartedAt
8526
+ }));
8527
+ if (hasTurnTextDespiteNoise && sttQuietMs >= turnDetection.silenceMs) {
8528
+ if (!silenceTimer) {
8529
+ scheduleSilenceCommit(0);
8530
+ }
8531
+ } else {
8532
+ clearSilenceTimer();
8533
+ }
8522
8534
  } else if (speechDetected) {
8523
8535
  backchannelDriver?.noteSilence();
8524
8536
  const currentSession = await readSession();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.592",
3
+ "version": "0.0.22-beta.593",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",