@absolutejs/voice 0.0.22-beta.673 → 0.0.22-beta.675

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.
@@ -8254,40 +8254,40 @@ var fetchVoiceWorkflowStatus = async (path = "/evals/scenarios/json", options =
8254
8254
  // src/svelte/createVoiceWorkflowStatus.ts
8255
8255
  var createVoiceWorkflowStatus = (path = "/evals/scenarios/json", options = {}) => createVoiceWorkflowStatusStore(path, options);
8256
8256
  export {
8257
- renderVoiceReplayTimelineHTML,
8258
- renderVoiceLiveCallViewerHTML,
8259
- renderVoiceLiveAgentConsoleHTML,
8260
- renderVoiceCostDashboardHTML,
8261
- renderVoiceCallPlayerHTML,
8262
- createVoiceWorkflowStatus,
8263
- createVoiceWidget,
8264
- createVoiceTurnQuality,
8265
- createVoiceTurnLatency,
8266
- createVoiceTraceTimeline,
8267
- createVoiceStream2 as createVoiceStream,
8268
- createVoiceSessionSnapshot,
8269
- createVoiceSessionObservability,
8270
- createVoiceRoutingStatus,
8271
- createVoiceReplayTimeline,
8272
- createVoiceReconnectProfileEvidence,
8273
- createVoiceReadinessFailures,
8274
- createVoiceProviderStatus,
8275
- createVoiceProviderSimulationControls,
8276
- createVoiceProviderContracts,
8277
- createVoiceProviderCapabilities,
8278
- createVoiceProofTrends,
8279
- createVoiceProfileComparison,
8280
- createVoicePlatformCoverage,
8281
- createVoiceOpsStatus,
8282
- createVoiceOpsActionCenter,
8283
- createVoiceLiveOps,
8284
- createVoiceLiveCallViewer,
8285
- createVoiceLiveAgentConsole,
8286
- createVoiceDeliveryRuntime,
8287
- createVoiceCostDashboard,
8288
- createVoiceController,
8289
- createVoiceCampaignDialerProof,
8290
- createVoiceCallPlayer2 as createVoiceCallPlayer,
8257
+ createVoiceAgentSquadStatus,
8291
8258
  createVoiceCallDebugger,
8292
- createVoiceAgentSquadStatus
8259
+ createVoiceCallPlayer2 as createVoiceCallPlayer,
8260
+ createVoiceCampaignDialerProof,
8261
+ createVoiceController,
8262
+ createVoiceCostDashboard,
8263
+ createVoiceDeliveryRuntime,
8264
+ createVoiceLiveAgentConsole,
8265
+ createVoiceLiveCallViewer,
8266
+ createVoiceLiveOps,
8267
+ createVoiceOpsActionCenter,
8268
+ createVoiceOpsStatus,
8269
+ createVoicePlatformCoverage,
8270
+ createVoiceProfileComparison,
8271
+ createVoiceProofTrends,
8272
+ createVoiceProviderCapabilities,
8273
+ createVoiceProviderContracts,
8274
+ createVoiceProviderSimulationControls,
8275
+ createVoiceProviderStatus,
8276
+ createVoiceReadinessFailures,
8277
+ createVoiceReconnectProfileEvidence,
8278
+ createVoiceReplayTimeline,
8279
+ createVoiceRoutingStatus,
8280
+ createVoiceSessionObservability,
8281
+ createVoiceSessionSnapshot,
8282
+ createVoiceStream2 as createVoiceStream,
8283
+ createVoiceTraceTimeline,
8284
+ createVoiceTurnLatency,
8285
+ createVoiceTurnQuality,
8286
+ createVoiceWidget,
8287
+ createVoiceWorkflowStatus,
8288
+ renderVoiceCallPlayerHTML,
8289
+ renderVoiceCostDashboardHTML,
8290
+ renderVoiceLiveAgentConsoleHTML,
8291
+ renderVoiceLiveCallViewerHTML,
8292
+ renderVoiceReplayTimelineHTML
8293
8293
  };
@@ -2228,6 +2228,49 @@ var createVoiceAudioPlayer = (source, options = {}) => {
2228
2228
  let maxGapMs = 0;
2229
2229
  let errorCount = 0;
2230
2230
  let hasScheduledAnyChunk = false;
2231
+ let buffersScheduled = 0;
2232
+ let lastScheduledTurnId;
2233
+ const audioFormats = new Set;
2234
+ let lastAudioFormat = null;
2235
+ let formatChangeCount = 0;
2236
+ let incompleteFrameChunkCount = 0;
2237
+ let discardedPartialFrameBytes = 0;
2238
+ let pendingFrameBytes = new Uint8Array;
2239
+ let pendingFrameFormat = null;
2240
+ let pendingFrameTurnId;
2241
+ const formatKey = (format) => `${format.container}/${format.encoding}/${String(format.channels)}ch/${String(format.sampleRateHz)}hz`;
2242
+ const frameAlignedChunk = (chunk) => {
2243
+ const format = formatKey(chunk.format);
2244
+ audioFormats.add(format);
2245
+ if (lastAudioFormat !== null && lastAudioFormat !== format) {
2246
+ formatChangeCount += 1;
2247
+ }
2248
+ lastAudioFormat = format;
2249
+ if (pendingFrameBytes.byteLength > 0 && (pendingFrameFormat !== format || pendingFrameTurnId !== chunk.turnId)) {
2250
+ discardedPartialFrameBytes += pendingFrameBytes.byteLength;
2251
+ pendingFrameBytes = new Uint8Array;
2252
+ }
2253
+ const joined = pendingFrameBytes.byteLength === 0 ? chunk.chunk : (() => {
2254
+ const bytes2 = new Uint8Array(pendingFrameBytes.byteLength + chunk.chunk.byteLength);
2255
+ bytes2.set(pendingFrameBytes);
2256
+ bytes2.set(chunk.chunk, pendingFrameBytes.byteLength);
2257
+ return bytes2;
2258
+ })();
2259
+ const frameBytes = Math.max(1, chunk.format.channels) * 2;
2260
+ const completeBytes = joined.byteLength - joined.byteLength % frameBytes;
2261
+ const remainderBytes = joined.byteLength - completeBytes;
2262
+ if (remainderBytes > 0) {
2263
+ incompleteFrameChunkCount += 1;
2264
+ pendingFrameBytes = joined.slice(completeBytes);
2265
+ pendingFrameFormat = format;
2266
+ pendingFrameTurnId = chunk.turnId;
2267
+ } else {
2268
+ pendingFrameBytes = new Uint8Array;
2269
+ pendingFrameFormat = null;
2270
+ pendingFrameTurnId = undefined;
2271
+ }
2272
+ return completeBytes > 0 ? { ...chunk, chunk: joined.subarray(0, completeBytes) } : null;
2273
+ };
2231
2274
  const sampleConcurrency = () => {
2232
2275
  if (activeAudioPlayers.size > observedPeakConcurrency) {
2233
2276
  observedPeakConcurrency = activeAudioPlayers.size;
@@ -2347,7 +2390,7 @@ var createVoiceAudioPlayer = (source, options = {}) => {
2347
2390
  queueEndTime = audioContext.currentTime;
2348
2391
  return audioContext;
2349
2392
  };
2350
- const scheduleBuffer = (context, buffer, rate) => {
2393
+ const scheduleBuffer = (context, buffer, rate, turnId) => {
2351
2394
  const node = context.createBufferSource();
2352
2395
  node.buffer = buffer;
2353
2396
  if (node.playbackRate) {
@@ -2365,13 +2408,15 @@ var createVoiceAudioPlayer = (source, options = {}) => {
2365
2408
  };
2366
2409
  const earliestStart = context.currentTime + lookaheadSeconds;
2367
2410
  const startAt = Math.max(earliestStart, queueEndTime);
2368
- if (hasScheduledAnyChunk && earliestStart > queueEndTime + GAP_EPSILON_S) {
2411
+ if (hasScheduledAnyChunk && turnId !== undefined && turnId === lastScheduledTurnId && earliestStart > queueEndTime + GAP_EPSILON_S) {
2369
2412
  const gapMs = (earliestStart - queueEndTime) * 1000;
2370
2413
  gapCount += 1;
2371
2414
  totalGapMs += gapMs;
2372
2415
  maxGapMs = Math.max(maxGapMs, gapMs);
2373
2416
  }
2374
2417
  hasScheduledAnyChunk = true;
2418
+ lastScheduledTurnId = turnId;
2419
+ buffersScheduled += 1;
2375
2420
  scheduledDurationMs += buffer.duration / rate * 1000;
2376
2421
  sampleConcurrency();
2377
2422
  queueEndTime = startAt + buffer.duration / rate;
@@ -2384,10 +2429,13 @@ var createVoiceAudioPlayer = (source, options = {}) => {
2384
2429
  };
2385
2430
  const scheduleChunk = async (chunk) => {
2386
2431
  const context = await ensureAudioContext();
2387
- const buffer = decodePCM16LEChunk(context, chunk);
2432
+ const alignedChunk = frameAlignedChunk(chunk);
2433
+ if (!alignedChunk)
2434
+ return;
2435
+ const buffer = decodePCM16LEChunk(context, alignedChunk);
2388
2436
  if (Math.abs(playbackRate - 1) <= STRETCH_BYPASS_EPSILON) {
2389
2437
  stretcher?.reset();
2390
- scheduleBuffer(context, buffer, playbackRate);
2438
+ scheduleBuffer(context, buffer, playbackRate, chunk.turnId);
2391
2439
  return;
2392
2440
  }
2393
2441
  const channels = Math.max(1, chunk.format.channels);
@@ -2408,13 +2456,14 @@ var createVoiceAudioPlayer = (source, options = {}) => {
2408
2456
  continue;
2409
2457
  outBuffer.getChannelData(channelIndex).set(channelOut);
2410
2458
  }
2411
- scheduleBuffer(context, outBuffer, 1);
2459
+ scheduleBuffer(context, outBuffer, 1, chunk.turnId);
2412
2460
  };
2413
2461
  const stopQueuedPlayback = (options2) => {
2414
2462
  for (const node of [...sourceNodes]) {
2415
2463
  node.stop?.();
2416
2464
  }
2417
2465
  queueEndTime = audioContext ? audioContext.currentTime : 0;
2466
+ lastScheduledTurnId = undefined;
2418
2467
  if (options2?.forceClear) {
2419
2468
  for (const node of sourceNodes) {
2420
2469
  node.disconnect?.();
@@ -2509,13 +2558,19 @@ var createVoiceAudioPlayer = (source, options = {}) => {
2509
2558
  const chunksReceived = source.assistantAudio.length;
2510
2559
  const chunksScheduled = state.processedChunkCount;
2511
2560
  return {
2561
+ audioFormatCount: audioFormats.size,
2562
+ buffersScheduled,
2512
2563
  chunksReceived,
2513
2564
  chunksScheduled,
2565
+ discardedPartialFrameBytes,
2514
2566
  errorCount,
2567
+ formatChangeCount,
2515
2568
  gapCount,
2569
+ incompleteFrameChunkCount,
2516
2570
  maxConcurrentPlayers: observedPeakConcurrency,
2517
2571
  maxGapMs: Math.round(maxGapMs),
2518
- ok: observedPeakConcurrency <= 1 && errorCount === 0 && chunksScheduled >= chunksReceived,
2572
+ pendingPartialFrameBytes: pendingFrameBytes.byteLength,
2573
+ ok: observedPeakConcurrency <= 1 && errorCount === 0 && chunksScheduled >= chunksReceived && discardedPartialFrameBytes === 0 && pendingFrameBytes.byteLength === 0,
2519
2574
  scheduledDurationMs: Math.round(scheduledDurationMs),
2520
2575
  totalGapMs: Math.round(totalGapMs)
2521
2576
  };
@@ -9974,6 +10029,8 @@ var createVoiceSession = (options) => {
9974
10029
  };
9975
10030
  const disconnectInternal = async (event) => {
9976
10031
  clearSilenceTimer();
10032
+ clearStuckCloseWatchdog();
10033
+ clearIdleRepromptWatchdog();
9977
10034
  await closeTTSSession(event?.reason);
9978
10035
  await closeAdapter(event?.reason);
9979
10036
  rewindFallbackTurnAudio();
@@ -16590,72 +16647,72 @@ var summarizeTTSBenchmark = (adapterId, fixtures) => {
16590
16647
  };
16591
16648
  };
16592
16649
  export {
16593
- withVoiceCallReviewId,
16594
- verifyVoiceBenchmarkArtifact,
16595
- summarizeVoiceTelephonyBenchmark,
16596
- summarizeVoiceSessionBenchmarkSeries,
16597
- summarizeVoiceSessionBenchmark,
16598
- summarizeVoiceDuplexBenchmark,
16599
- summarizeVoiceBenchmarkOutcomes,
16600
- summarizeTTSBenchmark,
16601
- summarizeSTTBenchmarkSeries,
16602
- summarizeSTTBenchmark,
16603
- stableBenchmarkJson,
16604
- sha256Bytes,
16605
- scoreVoiceCriticalFields,
16606
- scoreTranscriptAccuracy,
16607
- scoreCorrectedExpectedTerms,
16608
- runVoiceTelephonyMediaOperationsSmoke,
16609
- runVoiceTelephonyBenchmarkScenario,
16610
- runVoiceTelephonyBenchmark,
16611
- runVoiceSessionBenchmarkSeries,
16612
- runVoiceSessionBenchmarkScenario,
16613
- runVoiceSessionBenchmark,
16614
- runVoiceResilienceBenchmark,
16615
- runVoiceDuplexBenchmarkScenario,
16616
- runVoiceDuplexBenchmark,
16617
- runTTSAdapterFixture,
16618
- runTTSAdapterBenchmark,
16619
- runSTTAdapterFixture,
16620
- runSTTAdapterBenchmarkSeries,
16621
- runSTTAdapterBenchmark,
16622
- resolveVoiceFixtureDirectories,
16623
- resolveFixtureEnvironment,
16624
- renderVoiceCallReviewMarkdown,
16625
- renderVoiceCallReviewHTML,
16626
- mergeFinalTranscriptText,
16627
- loadVoiceTestFixtures,
16628
- isCorrectionHoldoutFixtureId,
16629
- getVoiceFixtureDirectory,
16630
- getDefaultVoiceTelephonyBenchmarkScenarios,
16631
- getDefaultVoiceDuplexBenchmarkScenarios,
16632
- getDefaultTTSBenchmarkFixtures,
16633
- evaluateVoiceSTTRouting,
16634
- evaluateSTTBenchmarkAcceptance,
16635
- evaluateSTTAdapterConformance,
16636
- createVoiceProviderFailureSimulator,
16637
- createVoiceIOProviderFailureSimulator,
16638
- createVoiceCallReviewRecorder,
16639
- createVoiceCallReviewFromLiveTelephonyReport,
16640
- createTelephonyVoiceTestFixtures,
16641
- createMultiSpeakerVoiceTestFixtures,
16642
- createJargonVoiceTestFixtures,
16643
- createCodeSwitchBenchmarkCorrectionHandler,
16644
- createBenchmarkCorrectionHandler,
16645
- compareSTTBenchmarks,
16646
- comparePairedMetrics,
16647
- calibrateVoiceConfidence,
16648
- buildVoiceBenchmarkArtifact,
16649
- buildVoiceAudioMatrix,
16650
- buildSessionCorrectionAudit,
16651
- buildFixturePhraseHints,
16652
- buildCorrectionBenchmarkAudit,
16653
- buildCodeSwitchBenchmarkPhraseHints,
16654
- buildCodeSwitchBenchmarkLexicon,
16655
- applyVoiceAudioCondition,
16656
- applyLexiconCorrectedBenchmarkReport,
16657
- applyExperimentalBenchmarkReport,
16658
- applyCorrectedBenchmarkReport,
16650
+ aggregateTranscriptAccuracy,
16659
16651
  alignTranscriptWords,
16660
- aggregateTranscriptAccuracy
16652
+ applyCorrectedBenchmarkReport,
16653
+ applyExperimentalBenchmarkReport,
16654
+ applyLexiconCorrectedBenchmarkReport,
16655
+ applyVoiceAudioCondition,
16656
+ buildCodeSwitchBenchmarkLexicon,
16657
+ buildCodeSwitchBenchmarkPhraseHints,
16658
+ buildCorrectionBenchmarkAudit,
16659
+ buildFixturePhraseHints,
16660
+ buildSessionCorrectionAudit,
16661
+ buildVoiceAudioMatrix,
16662
+ buildVoiceBenchmarkArtifact,
16663
+ calibrateVoiceConfidence,
16664
+ comparePairedMetrics,
16665
+ compareSTTBenchmarks,
16666
+ createBenchmarkCorrectionHandler,
16667
+ createCodeSwitchBenchmarkCorrectionHandler,
16668
+ createJargonVoiceTestFixtures,
16669
+ createMultiSpeakerVoiceTestFixtures,
16670
+ createTelephonyVoiceTestFixtures,
16671
+ createVoiceCallReviewFromLiveTelephonyReport,
16672
+ createVoiceCallReviewRecorder,
16673
+ createVoiceIOProviderFailureSimulator,
16674
+ createVoiceProviderFailureSimulator,
16675
+ evaluateSTTAdapterConformance,
16676
+ evaluateSTTBenchmarkAcceptance,
16677
+ evaluateVoiceSTTRouting,
16678
+ getDefaultTTSBenchmarkFixtures,
16679
+ getDefaultVoiceDuplexBenchmarkScenarios,
16680
+ getDefaultVoiceTelephonyBenchmarkScenarios,
16681
+ getVoiceFixtureDirectory,
16682
+ isCorrectionHoldoutFixtureId,
16683
+ loadVoiceTestFixtures,
16684
+ mergeFinalTranscriptText,
16685
+ renderVoiceCallReviewHTML,
16686
+ renderVoiceCallReviewMarkdown,
16687
+ resolveFixtureEnvironment,
16688
+ resolveVoiceFixtureDirectories,
16689
+ runSTTAdapterBenchmark,
16690
+ runSTTAdapterBenchmarkSeries,
16691
+ runSTTAdapterFixture,
16692
+ runTTSAdapterBenchmark,
16693
+ runTTSAdapterFixture,
16694
+ runVoiceDuplexBenchmark,
16695
+ runVoiceDuplexBenchmarkScenario,
16696
+ runVoiceResilienceBenchmark,
16697
+ runVoiceSessionBenchmark,
16698
+ runVoiceSessionBenchmarkScenario,
16699
+ runVoiceSessionBenchmarkSeries,
16700
+ runVoiceTelephonyBenchmark,
16701
+ runVoiceTelephonyBenchmarkScenario,
16702
+ runVoiceTelephonyMediaOperationsSmoke,
16703
+ scoreCorrectedExpectedTerms,
16704
+ scoreTranscriptAccuracy,
16705
+ scoreVoiceCriticalFields,
16706
+ sha256Bytes,
16707
+ stableBenchmarkJson,
16708
+ summarizeSTTBenchmark,
16709
+ summarizeSTTBenchmarkSeries,
16710
+ summarizeTTSBenchmark,
16711
+ summarizeVoiceBenchmarkOutcomes,
16712
+ summarizeVoiceDuplexBenchmark,
16713
+ summarizeVoiceSessionBenchmark,
16714
+ summarizeVoiceSessionBenchmarkSeries,
16715
+ summarizeVoiceTelephonyBenchmark,
16716
+ verifyVoiceBenchmarkArtifact,
16717
+ withVoiceCallReviewId
16661
16718
  };
package/dist/vue/index.js CHANGED
@@ -14012,52 +14012,52 @@ function useVoiceWorkflowStatus(path = "/evals/scenarios/json", options = {}) {
14012
14012
  };
14013
14013
  }
14014
14014
  export {
14015
- useVoiceWorkflowStatus,
14016
- useVoiceTurnQuality,
14017
- useVoiceTurnLatency,
14018
- useVoiceTraceTimeline,
14019
- useVoiceStream,
14020
- useVoiceSessionSnapshot,
14021
- useVoiceSessionObservability,
14022
- useVoiceRoutingStatus,
14023
- useVoiceReconnectProfileEvidence,
14024
- useVoiceReadinessFailures,
14025
- useVoiceProviderStatus,
14026
- useVoiceProviderSimulationControls,
14027
- useVoiceProviderContracts,
14028
- useVoiceProviderCapabilities,
14029
- useVoiceProofTrends,
14030
- useVoiceProfileComparison,
14031
- useVoicePlatformCoverage,
14032
- useVoiceOpsStatus,
14033
- useVoiceOpsActionCenter,
14034
- useVoiceLiveOps,
14035
- useVoiceDeliveryRuntime,
14036
- useVoiceController,
14037
- useVoiceCampaignDialerProof,
14038
- useVoiceCallDebugger,
14039
- useVoiceAgentSquadStatus,
14040
- VoiceWidget,
14041
- VoiceTurnQuality,
14042
- VoiceTurnLatency,
14043
- VoiceSessionSnapshot,
14044
- VoiceSessionObservability,
14045
- VoiceRoutingStatus,
14046
- VoiceReplayTimeline,
14047
- VoiceReconnectProfileEvidence,
14048
- VoiceReadinessFailures,
14049
- VoiceProviderStatus,
14050
- VoiceProviderSimulationControls,
14051
- VoiceProviderContracts,
14052
- VoiceProviderCapabilities,
14053
- VoiceProofTrends,
14054
- VoicePlatformCoverage,
14055
- VoiceOpsStatus,
14056
- VoiceOpsActionCenter,
14057
- VoiceLiveCallViewer,
14058
- VoiceLiveAgentConsole,
14059
- VoiceDeliveryRuntime,
14060
- VoiceCostDashboard,
14015
+ VoiceCallDebuggerLaunch,
14061
14016
  VoiceCallPlayer,
14062
- VoiceCallDebuggerLaunch
14017
+ VoiceCostDashboard,
14018
+ VoiceDeliveryRuntime,
14019
+ VoiceLiveAgentConsole,
14020
+ VoiceLiveCallViewer,
14021
+ VoiceOpsActionCenter,
14022
+ VoiceOpsStatus,
14023
+ VoicePlatformCoverage,
14024
+ VoiceProofTrends,
14025
+ VoiceProviderCapabilities,
14026
+ VoiceProviderContracts,
14027
+ VoiceProviderSimulationControls,
14028
+ VoiceProviderStatus,
14029
+ VoiceReadinessFailures,
14030
+ VoiceReconnectProfileEvidence,
14031
+ VoiceReplayTimeline,
14032
+ VoiceRoutingStatus,
14033
+ VoiceSessionObservability,
14034
+ VoiceSessionSnapshot,
14035
+ VoiceTurnLatency,
14036
+ VoiceTurnQuality,
14037
+ VoiceWidget,
14038
+ useVoiceAgentSquadStatus,
14039
+ useVoiceCallDebugger,
14040
+ useVoiceCampaignDialerProof,
14041
+ useVoiceController,
14042
+ useVoiceDeliveryRuntime,
14043
+ useVoiceLiveOps,
14044
+ useVoiceOpsActionCenter,
14045
+ useVoiceOpsStatus,
14046
+ useVoicePlatformCoverage,
14047
+ useVoiceProfileComparison,
14048
+ useVoiceProofTrends,
14049
+ useVoiceProviderCapabilities,
14050
+ useVoiceProviderContracts,
14051
+ useVoiceProviderSimulationControls,
14052
+ useVoiceProviderStatus,
14053
+ useVoiceReadinessFailures,
14054
+ useVoiceReconnectProfileEvidence,
14055
+ useVoiceRoutingStatus,
14056
+ useVoiceSessionObservability,
14057
+ useVoiceSessionSnapshot,
14058
+ useVoiceStream,
14059
+ useVoiceTraceTimeline,
14060
+ useVoiceTurnLatency,
14061
+ useVoiceTurnQuality,
14062
+ useVoiceWorkflowStatus
14063
14063
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.673",
3
+ "version": "0.0.22-beta.675",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",