@absolutejs/voice 0.0.22-beta.61 → 0.0.22-beta.610
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/LICENSE +88 -0
- package/README.md +4543 -1181
- package/dist/angular/index.d.ts +36 -6
- package/dist/angular/index.js +4203 -457
- package/dist/angular/voice-agent-squad-status.service.d.ts +12 -0
- package/dist/angular/voice-call-debugger.service.d.ts +12 -0
- package/dist/angular/voice-call-player.service.d.ts +19 -0
- package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
- package/dist/angular/voice-controller.service.d.ts +4 -1
- package/dist/angular/voice-cost-dashboard.service.d.ts +15 -0
- package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
- package/dist/angular/voice-live-agent-console.service.d.ts +16 -0
- package/dist/angular/voice-live-call-viewer.service.d.ts +16 -0
- package/dist/angular/voice-live-ops.service.d.ts +11 -0
- package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
- package/dist/angular/voice-ops-status.service.d.ts +12 -0
- package/dist/angular/voice-platform-coverage.service.d.ts +12 -0
- package/dist/angular/voice-profile-comparison.service.d.ts +12 -0
- package/dist/angular/voice-proof-trends.service.d.ts +12 -0
- package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
- package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
- package/dist/angular/voice-provider-status.service.d.ts +2 -2
- package/dist/angular/voice-readiness-failures.service.d.ts +13 -0
- package/dist/angular/voice-reconnect-profile-evidence.service.d.ts +12 -0
- package/dist/angular/voice-replay-timeline.service.d.ts +13 -0
- package/dist/angular/voice-routing-status.service.d.ts +1 -1
- package/dist/angular/voice-session-observability.service.d.ts +12 -0
- package/dist/angular/voice-session-snapshot.service.d.ts +13 -0
- package/dist/angular/voice-stream.service.d.ts +5 -1
- package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
- package/dist/angular/voice-turn-latency.service.d.ts +13 -0
- package/dist/angular/voice-turn-quality.service.d.ts +12 -0
- package/dist/angular/voice-widget.service.d.ts +18 -0
- package/dist/angular/voice-workflow-status.service.d.ts +2 -2
- package/dist/client/actions.d.ts +128 -2
- package/dist/client/agentSquadStatus.d.ts +37 -0
- package/dist/client/agentSquadStatusWidget.d.ts +24 -0
- package/dist/client/audioPlayer.d.ts +12 -2
- package/dist/client/bargeInMonitor.d.ts +7 -0
- package/dist/client/browserMedia.d.ts +8 -0
- package/dist/client/browserNoiseSuppression.d.ts +42 -0
- package/dist/client/browserVoiceSupport.d.ts +22 -0
- package/dist/client/callDebugger.d.ts +21 -0
- package/dist/client/callDebuggerWidget.d.ts +30 -0
- package/dist/client/callPlayer.d.ts +41 -0
- package/dist/client/campaignDialerProof.d.ts +25 -0
- package/dist/client/connection.d.ts +8 -3
- package/dist/client/controller.d.ts +1 -1
- package/dist/client/conversationAnalytics.d.ts +30 -0
- package/dist/client/costDashboard.d.ts +27 -0
- package/dist/client/createVoiceStream.d.ts +1 -1
- package/dist/client/deliveryRuntime.d.ts +36 -0
- package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
- package/dist/client/duplex.d.ts +2 -2
- package/dist/client/htmx.d.ts +1 -1
- package/dist/client/htmxAttributes.d.ts +24 -0
- package/dist/client/htmxBootstrap.js +1345 -84
- package/dist/client/htmxDashboardRenderers.d.ts +71 -0
- package/dist/client/index.d.ts +107 -25
- package/dist/client/index.js +10531 -462
- package/dist/client/liveAgentConsole.d.ts +28 -0
- package/dist/client/liveCallViewer.d.ts +42 -0
- package/dist/client/liveOps.d.ts +22 -0
- package/dist/client/liveOpsWidget.d.ts +23 -0
- package/dist/client/liveTurnLatency.d.ts +41 -0
- package/dist/client/microphone.d.ts +5 -4
- package/dist/client/opsActionCenter.d.ts +56 -0
- package/dist/client/opsActionCenterWidget.d.ts +29 -0
- package/dist/client/opsActionHistory.d.ts +21 -0
- package/dist/client/opsActionHistoryWidget.d.ts +11 -0
- package/dist/client/opsStatus.d.ts +21 -0
- package/dist/client/opsStatusWidget.d.ts +10 -10
- package/dist/client/platformCoverage.d.ts +21 -0
- package/dist/client/platformCoverageWidget.d.ts +38 -0
- package/dist/client/profileComparison.d.ts +21 -0
- package/dist/client/profileComparisonWidget.d.ts +41 -0
- package/dist/client/profileSwitchRecommendation.d.ts +21 -0
- package/dist/client/profileSwitchRecommendationWidget.d.ts +12 -0
- package/dist/client/proofTrends.d.ts +21 -0
- package/dist/client/proofTrendsWidget.d.ts +38 -0
- package/dist/client/providerCapabilities.d.ts +21 -0
- package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
- package/dist/client/providerContracts.d.ts +21 -0
- package/dist/client/providerContractsWidget.d.ts +37 -0
- package/dist/client/providerSimulationControls.d.ts +3 -3
- package/dist/client/providerSimulationControlsWidget.d.ts +5 -5
- package/dist/client/providerStatus.d.ts +5 -3
- package/dist/client/providerStatusWidget.d.ts +6 -6
- package/dist/client/reactiveSource.d.ts +8 -0
- package/dist/client/readinessFailures.d.ts +21 -0
- package/dist/client/readinessFailuresWidget.d.ts +42 -0
- package/dist/client/reconnectProfileEvidence.d.ts +21 -0
- package/dist/client/reconnectProfileEvidenceWidget.d.ts +39 -0
- package/dist/client/replayTimeline.d.ts +26 -0
- package/dist/client/routingStatus.d.ts +5 -3
- package/dist/client/routingStatusWidget.d.ts +10 -6
- package/dist/client/sessionObservability.d.ts +21 -0
- package/dist/client/sessionObservabilityWidget.d.ts +31 -0
- package/dist/client/sessionSnapshot.d.ts +23 -0
- package/dist/client/sessionSnapshotWidget.d.ts +33 -0
- package/dist/client/store.d.ts +1 -1
- package/dist/client/timeStretch.d.ts +5 -0
- package/dist/client/traceTimeline.d.ts +21 -0
- package/dist/client/traceTimelineWidget.d.ts +36 -0
- package/dist/client/turnLatency.d.ts +24 -0
- package/dist/client/turnLatencyWidget.d.ts +33 -0
- package/dist/client/turnQuality.d.ts +21 -0
- package/dist/client/turnQualityWidget.d.ts +32 -0
- package/dist/client/voiceWidgetView.d.ts +48 -0
- package/dist/client/workflowStatus.d.ts +5 -3
- package/dist/{agent.d.ts → core/agent.d.ts} +111 -6
- package/dist/core/agentPerformanceReport.d.ts +40 -0
- package/dist/core/agentSquadContract.d.ts +98 -0
- package/dist/core/agentState.d.ts +12 -0
- package/dist/core/agentTools.d.ts +132 -0
- package/dist/core/aiScorecard.d.ts +32 -0
- package/dist/core/aiVoiceModel.d.ts +15 -0
- package/dist/core/amdDetector.d.ts +25 -0
- package/dist/{assistant.d.ts → core/assistant.d.ts} +21 -14
- package/dist/core/assistantExperiment.d.ts +42 -0
- package/dist/{assistantHealth.d.ts → core/assistantHealth.d.ts} +9 -9
- package/dist/{assistantMemory.d.ts → core/assistantMemory.d.ts} +10 -10
- package/dist/core/assistantMode.d.ts +22 -0
- package/dist/{audioConditioning.d.ts → core/audioConditioning.d.ts} +2 -2
- package/dist/core/audit.d.ts +131 -0
- package/dist/core/auditDeliveryRoutes.d.ts +85 -0
- package/dist/core/auditExport.d.ts +34 -0
- package/dist/core/auditRoutes.d.ts +66 -0
- package/dist/core/auditSinks.d.ts +151 -0
- package/dist/core/backchannel.d.ts +25 -0
- package/dist/core/bargeInRoutes.d.ts +56 -0
- package/dist/core/bookingFlow.d.ts +43 -0
- package/dist/core/browserCallProfiles.d.ts +120 -0
- package/dist/core/browserMediaRoutes.d.ts +62 -0
- package/dist/core/cachedTTS.d.ts +54 -0
- package/dist/core/calendarAdapter.d.ts +47 -0
- package/dist/core/calendarSlots.d.ts +35 -0
- package/dist/core/callDebugger.d.ts +66 -0
- package/dist/core/callDisposition.d.ts +38 -0
- package/dist/core/callQuota.d.ts +54 -0
- package/dist/core/callScorecard.d.ts +53 -0
- package/dist/core/callerCRMLinker.d.ts +29 -0
- package/dist/core/callerMemory.d.ts +37 -0
- package/dist/core/callingWindow.d.ts +26 -0
- package/dist/core/campaign.d.ts +795 -0
- package/dist/core/campaignControls.d.ts +37 -0
- package/dist/core/campaignDialers.d.ts +111 -0
- package/dist/core/campaignTemplate.d.ts +16 -0
- package/dist/core/competitiveCoverage.d.ts +141 -0
- package/dist/core/conversationSimulator.d.ts +73 -0
- package/dist/{correction.d.ts → core/correction.d.ts} +5 -4
- package/dist/core/costAccounting.d.ts +76 -0
- package/dist/core/costPredictor.d.ts +74 -0
- package/dist/core/crmCallLogger.d.ts +37 -0
- package/dist/core/crmContract.d.ts +70 -0
- package/dist/core/dataControl.d.ts +180 -0
- package/dist/core/debugTiming.d.ts +11 -0
- package/dist/core/defineVoiceAssistant.d.ts +68 -0
- package/dist/core/deliveryRuntime.d.ts +159 -0
- package/dist/core/deliverySinkRoutes.d.ts +117 -0
- package/dist/core/demoReadyRoutes.d.ts +98 -0
- package/dist/{diagnosticsRoutes.d.ts → core/diagnosticsRoutes.d.ts} +2 -2
- package/dist/core/dncRegistry.d.ts +38 -0
- package/dist/core/dtmfCollector.d.ts +37 -0
- package/dist/{evalRoutes.d.ts → core/evalRoutes.d.ts} +26 -20
- package/dist/{fileStore.d.ts → core/fileStore.d.ts} +34 -20
- package/dist/core/guardrails.d.ts +128 -0
- package/dist/{handoff.d.ts → core/handoff.d.ts} +10 -10
- package/dist/{handoffHealth.d.ts → core/handoffHealth.d.ts} +9 -9
- package/dist/core/hardenedFetch.d.ts +3 -0
- package/dist/core/holdAudio.d.ts +23 -0
- package/dist/{htmx.d.ts → core/htmx.d.ts} +2 -2
- package/dist/core/htmxDashboardRoutes.d.ts +250 -0
- package/dist/core/iceServers.d.ts +34 -0
- package/dist/core/incidentBundle.d.ts +119 -0
- package/dist/core/incidentTimeline.d.ts +260 -0
- package/dist/core/ivrPlan.d.ts +40 -0
- package/dist/core/latencySlo.d.ts +56 -0
- package/dist/core/liveCoach.d.ts +43 -0
- package/dist/core/liveLatency.d.ts +78 -0
- package/dist/core/liveOps.d.ts +190 -0
- package/dist/core/llmJudge.d.ts +45 -0
- package/dist/{logger.d.ts → core/logger.d.ts} +1 -2
- package/dist/core/mcpToolset.d.ts +58 -0
- package/dist/core/mediaPipelineRoutes.d.ts +171 -0
- package/dist/core/mediaPipelineSurfaces.d.ts +48 -0
- package/dist/{memoryStore.d.ts → core/memoryStore.d.ts} +1 -1
- package/dist/core/midCallSummary.d.ts +27 -0
- package/dist/{modelAdapters.d.ts → core/modelAdapters.d.ts} +52 -7
- package/dist/core/monitor.d.ts +148 -0
- package/dist/core/multilingualProof.d.ts +77 -0
- package/dist/core/noShowPredictor.d.ts +46 -0
- package/dist/core/oauth2TokenSource.d.ts +21 -0
- package/dist/core/observabilityExport.d.ts +501 -0
- package/dist/core/openaiTTS.d.ts +18 -0
- package/dist/core/operationalStatus.d.ts +87 -0
- package/dist/core/operationsRecord.d.ts +371 -0
- package/dist/{ops.d.ts → core/ops.d.ts} +70 -70
- package/dist/core/opsActionAuditRoutes.d.ts +99 -0
- package/dist/{opsConsoleRoutes.d.ts → core/opsConsoleRoutes.d.ts} +11 -8
- package/dist/{opsPresets.d.ts → core/opsPresets.d.ts} +2 -2
- package/dist/core/opsRecovery.d.ts +137 -0
- package/dist/{opsRuntime.d.ts → core/opsRuntime.d.ts} +6 -6
- package/dist/{opsSinks.d.ts → core/opsSinks.d.ts} +19 -19
- package/dist/core/opsStatus.d.ts +76 -0
- package/dist/core/opsStatusRoutes.d.ts +33 -0
- package/dist/{opsWebhook.d.ts → core/opsWebhook.d.ts} +15 -15
- package/dist/core/otelExporter.d.ts +83 -0
- package/dist/core/outcomeContract.d.ts +146 -0
- package/dist/{outcomeRecipes.d.ts → core/outcomeRecipes.d.ts} +4 -4
- package/dist/core/pathway.d.ts +94 -0
- package/dist/core/pathwayCompiler.d.ts +31 -0
- package/dist/core/pathwayGenerator.d.ts +27 -0
- package/dist/core/pathwayRuntime.d.ts +57 -0
- package/dist/core/pathwaySlotCollector.d.ts +29 -0
- package/dist/core/pathwayVisualizer.d.ts +8 -0
- package/dist/core/phoneAgent.d.ts +139 -0
- package/dist/core/phoneAgentProductionSmoke.d.ts +115 -0
- package/dist/core/phoneProvisioning.d.ts +29 -0
- package/dist/core/platformCoverage.d.ts +91 -0
- package/dist/{plugin.d.ts → core/plugin.d.ts} +2 -2
- package/dist/core/postCallAnalysis.d.ts +98 -0
- package/dist/core/postCallSurvey.d.ts +41 -0
- package/dist/{postgresStore.d.ts → core/postgresStore.d.ts} +20 -9
- package/dist/{presets.d.ts → core/presets.d.ts} +3 -3
- package/dist/core/productionReadiness.d.ts +757 -0
- package/dist/core/profileSwitchRecommendation.d.ts +350 -0
- package/dist/core/promptInjectionGuard.d.ts +30 -0
- package/dist/core/proofAssertions.d.ts +32 -0
- package/dist/core/proofPack.d.ts +211 -0
- package/dist/core/proofRunner.d.ts +79 -0
- package/dist/core/proofTrends.d.ts +966 -0
- package/dist/{providerAdapters.d.ts → core/providerAdapters.d.ts} +5 -5
- package/dist/core/providerCapabilities.d.ts +92 -0
- package/dist/core/providerDecisionTraces.d.ts +130 -0
- package/dist/{providerHealth.d.ts → core/providerHealth.d.ts} +15 -5
- package/dist/core/providerOrchestration.d.ts +109 -0
- package/dist/core/providerRouterTraces.d.ts +35 -0
- package/dist/core/providerRoutingContract.d.ts +71 -0
- package/dist/core/providerSlo.d.ts +142 -0
- package/dist/core/providerStackRecommendations.d.ts +188 -0
- package/dist/core/qualityDriftDetector.d.ts +44 -0
- package/dist/{qualityRoutes.d.ts → core/qualityRoutes.d.ts} +7 -7
- package/dist/{queue.d.ts → core/queue.d.ts} +48 -39
- package/dist/core/ragTool.d.ts +52 -0
- package/dist/core/readinessProfiles.d.ts +45 -0
- package/dist/core/realtimeChannel.d.ts +136 -0
- package/dist/core/realtimeProviderContracts.d.ts +133 -0
- package/dist/core/reconnectContract.d.ts +177 -0
- package/dist/core/recordingRedaction.d.ts +47 -0
- package/dist/core/recordingStore.d.ts +60 -0
- package/dist/core/redaction.d.ts +13 -0
- package/dist/core/reminderScheduler.d.ts +43 -0
- package/dist/{resilienceRoutes.d.ts → core/resilienceRoutes.d.ts} +34 -5
- package/dist/core/retention.d.ts +37 -0
- package/dist/core/retryPolicy.d.ts +38 -0
- package/dist/core/routeAuth.d.ts +58 -0
- package/dist/{routing.d.ts → core/routing.d.ts} +2 -2
- package/dist/{runtimeOps.d.ts → core/runtimeOps.d.ts} +3 -3
- package/dist/{s3Store.d.ts → core/s3Store.d.ts} +12 -3
- package/dist/core/scorecardCalibration.d.ts +31 -0
- package/dist/core/scribe.d.ts +50 -0
- package/dist/core/semanticTurn.d.ts +37 -0
- package/dist/{session.d.ts → core/session.d.ts} +1 -1
- package/dist/core/sessionObservability.d.ts +145 -0
- package/dist/{sessionReplay.d.ts → core/sessionReplay.d.ts} +31 -19
- package/dist/core/sessionSnapshot.d.ts +109 -0
- package/dist/core/simulationSuite.d.ts +144 -0
- package/dist/core/sloCalibration.d.ts +185 -0
- package/dist/{sqliteStore.d.ts → core/sqliteStore.d.ts} +20 -9
- package/dist/{store.d.ts → core/store.d.ts} +1 -1
- package/dist/core/supervisorPermissions.d.ts +33 -0
- package/dist/core/supervisorPresence.d.ts +49 -0
- package/dist/core/telephonyMediaRoutes.d.ts +72 -0
- package/dist/core/telephonyOutcome.d.ts +269 -0
- package/dist/core/toolContract.d.ts +161 -0
- package/dist/core/toolRuntime.d.ts +50 -0
- package/dist/{trace.d.ts → core/trace.d.ts} +61 -22
- package/dist/core/traceDeliveryRoutes.d.ts +86 -0
- package/dist/core/traceTimeline.d.ts +97 -0
- package/dist/core/transcriptAnnotator.d.ts +41 -0
- package/dist/{turnDetection.d.ts → core/turnDetection.d.ts} +2 -1
- package/dist/core/turnLatency.d.ts +95 -0
- package/dist/core/turnProfiles.d.ts +3 -0
- package/dist/core/turnQuality.d.ts +94 -0
- package/dist/core/types.d.ts +1521 -0
- package/dist/core/vapiAdapter.d.ts +160 -0
- package/dist/core/variableAnalytics.d.ts +47 -0
- package/dist/core/voiceConfiguration.d.ts +8 -0
- package/dist/core/voiceMonitoring.d.ts +444 -0
- package/dist/core/webhookFanout.d.ts +48 -0
- package/dist/core/webhookVerification.d.ts +27 -0
- package/dist/core/whisperChannel.d.ts +50 -0
- package/dist/{workflowContract.d.ts → core/workflowContract.d.ts} +21 -21
- package/dist/core/writeBehindStore.d.ts +41 -0
- package/dist/core/zeroDataRetention.d.ts +31 -0
- package/dist/drizzle/assistantMemory.d.ts +100 -0
- package/dist/drizzle/eval.d.ts +55 -0
- package/dist/drizzle/handoff.d.ts +56 -0
- package/dist/drizzle/incidentBundle.d.ts +55 -0
- package/dist/drizzle/index.d.ts +991 -0
- package/dist/drizzle/index.js +3059 -0
- package/dist/drizzle/observabilityExport.d.ts +55 -0
- package/dist/drizzle/proofTrends.d.ts +114 -0
- package/dist/drizzle/runtimeStorage.d.ts +1183 -0
- package/dist/drizzle/shared.d.ts +69 -0
- package/dist/embed/index.d.ts +38 -0
- package/dist/embed/index.js +1775 -0
- package/dist/embed/voice-widget.js +10 -0
- package/dist/index.d.ts +376 -74
- package/dist/index.js +47069 -7487
- package/dist/internal/evidence.d.ts +10 -0
- package/dist/internal/html.d.ts +6 -0
- package/dist/internal/status.d.ts +7 -0
- package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
- package/dist/react/VoiceCallDebuggerLaunch.d.ts +6 -0
- package/dist/react/VoiceCallPlayer.d.ts +11 -0
- package/dist/react/VoiceCostDashboard.d.ts +10 -0
- package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
- package/dist/react/VoiceLiveAgentConsole.d.ts +11 -0
- package/dist/react/VoiceLiveCallViewer.d.ts +9 -0
- package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
- package/dist/react/VoiceOpsStatus.d.ts +1 -1
- package/dist/react/VoicePlatformCoverage.d.ts +6 -0
- package/dist/react/VoiceProfileComparison.d.ts +6 -0
- package/dist/react/VoiceProfileSwitchRecommendation.d.ts +6 -0
- package/dist/react/VoiceProofTrends.d.ts +6 -0
- package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
- package/dist/react/VoiceProviderContracts.d.ts +6 -0
- package/dist/react/VoiceProviderSimulationControls.d.ts +1 -1
- package/dist/react/VoiceProviderStatus.d.ts +1 -1
- package/dist/react/VoiceReadinessFailures.d.ts +6 -0
- package/dist/react/VoiceReconnectProfileEvidence.d.ts +6 -0
- package/dist/react/VoiceReplayTimeline.d.ts +6 -0
- package/dist/react/VoiceRoutingStatus.d.ts +1 -1
- package/dist/react/VoiceSessionObservability.d.ts +6 -0
- package/dist/react/VoiceSessionSnapshot.d.ts +6 -0
- package/dist/react/VoiceTraceTimeline.d.ts +6 -0
- package/dist/react/VoiceTurnLatency.d.ts +6 -0
- package/dist/react/VoiceTurnQuality.d.ts +6 -0
- package/dist/react/VoiceWidget.d.ts +13 -0
- package/dist/react/index.d.ts +80 -11
- package/dist/react/index.js +13545 -1593
- package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
- package/dist/react/useVoiceCallDebugger.d.ts +8 -0
- package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
- package/dist/react/useVoiceController.d.ts +5 -1
- package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/react/useVoiceLiveOps.d.ts +9 -0
- package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
- package/dist/react/useVoiceOpsStatus.d.ts +8 -0
- package/dist/react/useVoicePlatformCoverage.d.ts +8 -0
- package/dist/react/useVoiceProfileComparison.d.ts +8 -0
- package/dist/react/useVoiceProfileSwitchRecommendation.d.ts +8 -0
- package/dist/react/useVoiceProofTrends.d.ts +8 -0
- package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
- package/dist/react/useVoiceProviderContracts.d.ts +8 -0
- package/dist/react/useVoiceProviderSimulationControls.d.ts +1 -1
- package/dist/react/useVoiceProviderStatus.d.ts +1 -1
- package/dist/react/useVoiceReadinessFailures.d.ts +8 -0
- package/dist/react/useVoiceReconnectProfileEvidence.d.ts +8 -0
- package/dist/react/useVoiceRoutingStatus.d.ts +1 -1
- package/dist/react/useVoiceSessionObservability.d.ts +8 -0
- package/dist/react/useVoiceSessionSnapshot.d.ts +9 -0
- package/dist/react/useVoiceStream.d.ts +5 -1
- package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
- package/dist/react/useVoiceTurnLatency.d.ts +9 -0
- package/dist/react/useVoiceTurnQuality.d.ts +8 -0
- package/dist/react/useVoiceWorkflowStatus.d.ts +1 -1
- package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
- package/dist/svelte/createVoiceCallDebugger.d.ts +10 -0
- package/dist/svelte/createVoiceCallPlayer.d.ts +33 -0
- package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
- package/dist/svelte/createVoiceCostDashboard.d.ts +13 -0
- package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
- package/dist/svelte/createVoiceLiveAgentConsole.d.ts +23 -0
- package/dist/svelte/createVoiceLiveCallViewer.d.ts +26 -0
- package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
- package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
- package/dist/svelte/createVoiceOpsStatus.d.ts +4 -4
- package/dist/svelte/createVoicePlatformCoverage.d.ts +7 -0
- package/dist/svelte/createVoiceProfileComparison.d.ts +7 -0
- package/dist/svelte/createVoiceProofTrends.d.ts +7 -0
- package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
- package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
- package/dist/svelte/createVoiceProviderSimulationControls.d.ts +2 -2
- package/dist/svelte/createVoiceProviderStatus.d.ts +2 -2
- package/dist/svelte/createVoiceReadinessFailures.d.ts +7 -0
- package/dist/svelte/createVoiceReconnectProfileEvidence.d.ts +7 -0
- package/dist/svelte/createVoiceReplayTimeline.d.ts +13 -0
- package/dist/svelte/createVoiceRoutingStatus.d.ts +2 -2
- package/dist/svelte/createVoiceSessionObservability.d.ts +10 -0
- package/dist/svelte/createVoiceSessionSnapshot.d.ts +11 -0
- package/dist/svelte/createVoiceStream.d.ts +1 -1
- package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
- package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
- package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
- package/dist/svelte/createVoiceWidget.d.ts +19 -0
- package/dist/svelte/createVoiceWorkflowStatus.d.ts +2 -2
- package/dist/svelte/index.d.ts +37 -8
- package/dist/svelte/index.js +7177 -1306
- package/dist/telephony/contract.d.ts +61 -0
- package/dist/telephony/matrix.d.ts +97 -0
- package/dist/telephony/plivo.d.ts +303 -0
- package/dist/telephony/response.d.ts +1 -1
- package/dist/telephony/security.d.ts +182 -0
- package/dist/telephony/telnyx.d.ts +291 -0
- package/dist/telephony/twilio.d.ts +152 -15
- package/dist/testing/accuracy.d.ts +1 -1
- package/dist/testing/benchmark.d.ts +15 -15
- package/dist/testing/corrected.d.ts +9 -9
- package/dist/testing/duplex.d.ts +5 -5
- package/dist/testing/fixtures.d.ts +4 -4
- package/dist/testing/index.d.ts +13 -13
- package/dist/testing/index.js +7281 -926
- package/dist/testing/ioProviderSimulator.d.ts +5 -5
- package/dist/testing/providerSimulator.d.ts +5 -5
- package/dist/testing/review.d.ts +8 -8
- package/dist/testing/sessionBenchmark.d.ts +13 -13
- package/dist/testing/stt.d.ts +3 -3
- package/dist/testing/telephony.d.ts +27 -2
- package/dist/testing/tts.d.ts +2 -2
- package/dist/vue/VoiceCallDebuggerLaunch.d.ts +72 -0
- package/dist/vue/VoiceCallPlayer.d.ts +40 -0
- package/dist/vue/VoiceCostDashboard.d.ts +57 -0
- package/dist/vue/VoiceDeliveryRuntime.d.ts +34 -0
- package/dist/vue/VoiceLiveAgentConsole.d.ts +50 -0
- package/dist/vue/VoiceLiveCallViewer.d.ts +35 -0
- package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
- package/dist/vue/VoiceOpsStatus.d.ts +4 -0
- package/dist/vue/VoicePlatformCoverage.d.ts +27 -0
- package/dist/vue/VoiceProofTrends.d.ts +25 -0
- package/dist/vue/VoiceProviderCapabilities.d.ts +55 -0
- package/dist/vue/VoiceProviderContracts.d.ts +25 -0
- package/dist/vue/VoiceProviderSimulationControls.d.ts +2 -2
- package/dist/vue/VoiceProviderStatus.d.ts +4 -0
- package/dist/vue/VoiceReadinessFailures.d.ts +25 -0
- package/dist/vue/VoiceReconnectProfileEvidence.d.ts +25 -0
- package/dist/vue/VoiceReplayTimeline.d.ts +17 -0
- package/dist/vue/VoiceRoutingStatus.d.ts +4 -0
- package/dist/vue/VoiceSessionObservability.d.ts +27 -0
- package/dist/vue/VoiceSessionSnapshot.d.ts +72 -0
- package/dist/vue/VoiceTurnLatency.d.ts +73 -0
- package/dist/vue/VoiceTurnQuality.d.ts +55 -0
- package/dist/vue/VoiceWidget.d.ts +77 -0
- package/dist/vue/index.d.ts +49 -11
- package/dist/vue/index.js +12844 -1711
- package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
- package/dist/vue/useVoiceCallDebugger.d.ts +10 -0
- package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
- package/dist/vue/useVoiceController.d.ts +10 -7
- package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
- package/dist/vue/useVoiceLiveOps.d.ts +9 -0
- package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
- package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
- package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
- package/dist/vue/useVoiceProfileComparison.d.ts +9 -0
- package/dist/vue/useVoiceProofTrends.d.ts +9 -0
- package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
- package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
- package/dist/vue/useVoiceProviderSimulationControls.d.ts +2 -2
- package/dist/vue/useVoiceProviderStatus.d.ts +3 -3
- package/dist/vue/useVoiceReadinessFailures.d.ts +959 -0
- package/dist/vue/useVoiceReconnectProfileEvidence.d.ts +9 -0
- package/dist/vue/useVoiceRoutingStatus.d.ts +2 -2
- package/dist/vue/useVoiceSessionObservability.d.ts +9 -0
- package/dist/vue/useVoiceSessionSnapshot.d.ts +10 -0
- package/dist/vue/useVoiceStream.d.ts +10 -6
- package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
- package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
- package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
- package/dist/vue/useVoiceWorkflowStatus.d.ts +3 -3
- package/package.json +155 -256
- package/dist/angular/voice-app-kit-status.service.d.ts +0 -12
- package/dist/angular/voice-ops-status.component.d.ts +0 -15
- package/dist/appKit.d.ts +0 -92
- package/dist/client/appKitStatus.d.ts +0 -19
- package/dist/react/useVoiceAppKitStatus.d.ts +0 -8
- package/dist/svelte/createVoiceAppKitStatus.d.ts +0 -8
- package/dist/turnProfiles.d.ts +0 -6
- package/dist/types.d.ts +0 -968
- package/dist/vue/useVoiceAppKitStatus.d.ts +0 -9
- package/fixtures/README.md +0 -57
- package/fixtures/manifest.json +0 -199
- package/fixtures/pcm/dialogue-three-clean.pcm +0 -0
- package/fixtures/pcm/dialogue-three-mixed.pcm +0 -0
- package/fixtures/pcm/dialogue-two-clean.pcm +0 -0
- package/fixtures/pcm/dialogue-two-noisy.pcm +0 -0
- package/fixtures/pcm/multiturn-three-mixed.pcm +0 -0
- package/fixtures/pcm/multiturn-two-clean.pcm +0 -0
- package/fixtures/pcm/quietly-alone-clean.pcm +0 -0
- package/fixtures/pcm/rainstorms-noisy.pcm +0 -0
- package/fixtures/pcm/stella-bulgaria-bulgarian20.pcm +0 -0
- package/fixtures/pcm/stella-ghana-english507.pcm +0 -0
- package/fixtures/pcm/stella-india-english37.pcm +0 -0
- package/fixtures/pcm/stella-jamaica-jamaican-creole-english1.pcm +0 -0
- package/fixtures/pcm/stella-liberia-liberian-pidgin-english2.pcm +0 -0
- package/fixtures/pcm/stella-pakistan-english519.pcm +0 -0
- package/fixtures/pcm/stella-sierra-leone-krio5.pcm +0 -0
- package/fixtures/pcm/stella-singapore-english655.pcm +0 -0
- package/fixtures/pcm/traveled-back-route-clean.pcm +0 -0
|
@@ -0,0 +1,1521 @@
|
|
|
1
|
+
import type { MediaWebRTCStatsCollector, MediaWebRTCStatsReport, MediaWebRTCStatsReportInput, MediaWebRTCStreamContinuityInput, MediaWebRTCStreamContinuityReport } from "@absolutejs/media";
|
|
2
|
+
import type { VoiceOpsDispositionTaskPolicies, VoiceOpsTaskAssignmentRule, VoiceOpsTaskAssignmentRules, VoiceIntegrationWebhookConfig, StoredVoiceIntegrationEvent, StoredVoiceOpsTask, VoiceIntegrationEventStore, VoiceOpsTaskPolicy, VoiceOpsTask, VoiceOpsTaskStore } from "./ops";
|
|
3
|
+
import type { VoiceIntegrationSink } from "./opsSinks";
|
|
4
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
5
|
+
import type { VoiceTraceEventStore } from "./trace";
|
|
6
|
+
import type { VoiceLiveOpsControlState } from "./liveOps";
|
|
7
|
+
import type { VoiceAuditActor, VoiceAuditEventStore } from "./audit";
|
|
8
|
+
import type { VoiceProfileSwitchGuardDecision, VoiceProfileSwitchGuardMode, VoiceProfileSwitchObservedSignals } from "./profileSwitchRecommendation";
|
|
9
|
+
import type { VoiceRealCallProfileDefaultsReport, VoiceRealCallProfileHistoryReport } from "./proofTrends";
|
|
10
|
+
export type AudioFormat = {
|
|
11
|
+
container: "raw";
|
|
12
|
+
encoding: "alaw" | "mulaw" | "pcm_s16le";
|
|
13
|
+
sampleRateHz: number;
|
|
14
|
+
channels: 1 | 2;
|
|
15
|
+
};
|
|
16
|
+
export type AudioChunk = ArrayBuffer | ArrayBufferView;
|
|
17
|
+
/**
|
|
18
|
+
* Structural contract for an inbound noise suppressor applied before STT.
|
|
19
|
+
* Matches `@absolutejs/media`'s `NoiseSuppressor`, so any media suppressor
|
|
20
|
+
* (`createFFmpegNoiseSuppressor`, `createEnergyGateNoiseSuppressor`, a Krisp
|
|
21
|
+
* adapter, etc.) satisfies it without a hard import.
|
|
22
|
+
*/
|
|
23
|
+
export type VoiceNoiseSuppressor = {
|
|
24
|
+
readonly kind: string;
|
|
25
|
+
process: (input: {
|
|
26
|
+
format: AudioFormat;
|
|
27
|
+
pcm: ArrayBuffer | ArrayBufferView;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
bytes: Uint8Array;
|
|
30
|
+
format: AudioFormat;
|
|
31
|
+
}> | {
|
|
32
|
+
bytes: Uint8Array;
|
|
33
|
+
format: AudioFormat;
|
|
34
|
+
};
|
|
35
|
+
close?: () => Promise<void> | void;
|
|
36
|
+
};
|
|
37
|
+
export type VoiceLanguageStrategy = {
|
|
38
|
+
mode: "auto-detect";
|
|
39
|
+
allowedLanguages?: string[];
|
|
40
|
+
} | {
|
|
41
|
+
mode: "fixed";
|
|
42
|
+
primaryLanguage: string;
|
|
43
|
+
secondaryLanguages?: string[];
|
|
44
|
+
} | {
|
|
45
|
+
mode: "allow-switching";
|
|
46
|
+
primaryLanguage?: string;
|
|
47
|
+
secondaryLanguages: string[];
|
|
48
|
+
};
|
|
49
|
+
export type VoicePhraseHint = {
|
|
50
|
+
text: string;
|
|
51
|
+
aliases?: string[];
|
|
52
|
+
boost?: number;
|
|
53
|
+
metadata?: Record<string, unknown>;
|
|
54
|
+
};
|
|
55
|
+
export type VoiceCorrectionRiskTier = "safe" | "balanced" | "risky";
|
|
56
|
+
export type VoiceDomainTerm = {
|
|
57
|
+
text: string;
|
|
58
|
+
aliases?: string[];
|
|
59
|
+
boost?: number;
|
|
60
|
+
language?: string;
|
|
61
|
+
metadata?: Record<string, unknown>;
|
|
62
|
+
pronunciation?: string;
|
|
63
|
+
};
|
|
64
|
+
export type VoiceLexiconEntry = {
|
|
65
|
+
text: string;
|
|
66
|
+
aliases?: string[];
|
|
67
|
+
language?: string;
|
|
68
|
+
metadata?: Record<string, unknown>;
|
|
69
|
+
pronunciation?: string;
|
|
70
|
+
};
|
|
71
|
+
export type VoiceTranscriptSentiment = {
|
|
72
|
+
label: "negative" | "neutral" | "positive" | (string & {});
|
|
73
|
+
metadata?: Record<string, unknown>;
|
|
74
|
+
score?: number;
|
|
75
|
+
};
|
|
76
|
+
export type Transcript = {
|
|
77
|
+
id: string;
|
|
78
|
+
text: string;
|
|
79
|
+
isFinal: boolean;
|
|
80
|
+
confidence?: number;
|
|
81
|
+
language?: string;
|
|
82
|
+
sentiment?: VoiceTranscriptSentiment;
|
|
83
|
+
speaker?: string | number;
|
|
84
|
+
startedAtMs?: number;
|
|
85
|
+
endedAtMs?: number;
|
|
86
|
+
vendor?: string;
|
|
87
|
+
};
|
|
88
|
+
export type VoiceTranscriptQuality = {
|
|
89
|
+
averageConfidence?: number;
|
|
90
|
+
confidenceSampleCount: number;
|
|
91
|
+
correction?: VoiceTurnCorrectionDiagnostics;
|
|
92
|
+
cost?: VoiceTurnCostEstimate;
|
|
93
|
+
fallbackUsed: boolean;
|
|
94
|
+
finalTranscriptCount: number;
|
|
95
|
+
fallback?: VoiceFallbackDiagnostics;
|
|
96
|
+
partialTranscriptCount: number;
|
|
97
|
+
selectedTranscriptCount: number;
|
|
98
|
+
source: "fallback" | "primary";
|
|
99
|
+
};
|
|
100
|
+
export type VoiceTurnCorrectionDiagnostics = {
|
|
101
|
+
attempted: boolean;
|
|
102
|
+
changed: boolean;
|
|
103
|
+
correctedText: string;
|
|
104
|
+
metadata?: Record<string, unknown>;
|
|
105
|
+
originalText: string;
|
|
106
|
+
provider?: string;
|
|
107
|
+
reason?: string;
|
|
108
|
+
};
|
|
109
|
+
export type VoiceTurnCostEstimate = {
|
|
110
|
+
estimatedRelativeCostUnits: number;
|
|
111
|
+
fallbackAttemptCount: number;
|
|
112
|
+
fallbackReplayAudioMs: number;
|
|
113
|
+
primaryAudioMs: number;
|
|
114
|
+
totalBillableAudioMs: number;
|
|
115
|
+
};
|
|
116
|
+
export type VoiceFallbackSelectionReason = "fallback-empty" | "primary-empty" | "word-count-margin" | "confidence-margin" | "word-count-tiebreak" | "kept-primary";
|
|
117
|
+
export type VoiceFallbackDiagnostics = {
|
|
118
|
+
attempted: boolean;
|
|
119
|
+
fallbackConfidence?: number;
|
|
120
|
+
fallbackText?: string;
|
|
121
|
+
fallbackWordCount?: number;
|
|
122
|
+
primaryConfidence: number;
|
|
123
|
+
primaryText: string;
|
|
124
|
+
primaryWordCount: number;
|
|
125
|
+
selected: boolean;
|
|
126
|
+
selectionReason: VoiceFallbackSelectionReason;
|
|
127
|
+
trigger: "empty-turn" | "low-confidence" | "empty-or-low-confidence" | "always";
|
|
128
|
+
};
|
|
129
|
+
export type VoicePartialEvent = {
|
|
130
|
+
type: "partial";
|
|
131
|
+
transcript: Transcript;
|
|
132
|
+
receivedAt: number;
|
|
133
|
+
};
|
|
134
|
+
export type VoiceFinalEvent = {
|
|
135
|
+
type: "final";
|
|
136
|
+
transcript: Transcript;
|
|
137
|
+
receivedAt: number;
|
|
138
|
+
};
|
|
139
|
+
export type VoiceEndOfTurnEvent = {
|
|
140
|
+
type: "endOfTurn";
|
|
141
|
+
reason: "vendor" | "silence" | "manual";
|
|
142
|
+
receivedAt: number;
|
|
143
|
+
};
|
|
144
|
+
export type VoiceErrorEvent = {
|
|
145
|
+
type: "error";
|
|
146
|
+
error: Error;
|
|
147
|
+
recoverable: boolean;
|
|
148
|
+
code?: string;
|
|
149
|
+
};
|
|
150
|
+
export type VoiceCloseEvent = {
|
|
151
|
+
type: "close";
|
|
152
|
+
code?: number;
|
|
153
|
+
reason?: string;
|
|
154
|
+
recoverable?: boolean;
|
|
155
|
+
};
|
|
156
|
+
export type STTSessionEventMap = {
|
|
157
|
+
partial: VoicePartialEvent;
|
|
158
|
+
final: VoiceFinalEvent;
|
|
159
|
+
endOfTurn: VoiceEndOfTurnEvent;
|
|
160
|
+
error: VoiceErrorEvent;
|
|
161
|
+
close: VoiceCloseEvent;
|
|
162
|
+
};
|
|
163
|
+
export type STTAdapterSession = {
|
|
164
|
+
on: <K extends keyof STTSessionEventMap>(event: K, handler: (payload: STTSessionEventMap[K]) => void | Promise<void>) => () => void;
|
|
165
|
+
send: (audio: AudioChunk) => Promise<void>;
|
|
166
|
+
close: (reason?: string) => Promise<void>;
|
|
167
|
+
};
|
|
168
|
+
export type STTAdapterOpenOptions = {
|
|
169
|
+
sessionId: string;
|
|
170
|
+
format: AudioFormat;
|
|
171
|
+
languageStrategy?: VoiceLanguageStrategy;
|
|
172
|
+
lexicon?: VoiceLexiconEntry[];
|
|
173
|
+
phraseHints?: VoicePhraseHint[];
|
|
174
|
+
signal?: AbortSignal;
|
|
175
|
+
};
|
|
176
|
+
export type STTAdapter<TOptions extends STTAdapterOpenOptions = STTAdapterOpenOptions> = {
|
|
177
|
+
kind: "stt";
|
|
178
|
+
open: (options: TOptions) => Promise<STTAdapterSession> | STTAdapterSession;
|
|
179
|
+
};
|
|
180
|
+
export type TTSAudioEvent = {
|
|
181
|
+
type: "audio";
|
|
182
|
+
chunk: AudioChunk;
|
|
183
|
+
format: AudioFormat;
|
|
184
|
+
receivedAt: number;
|
|
185
|
+
};
|
|
186
|
+
export type TTSSessionEventMap = {
|
|
187
|
+
audio: TTSAudioEvent;
|
|
188
|
+
error: VoiceErrorEvent;
|
|
189
|
+
close: VoiceCloseEvent;
|
|
190
|
+
};
|
|
191
|
+
export type TTSAdapterSession = {
|
|
192
|
+
on: <K extends keyof TTSSessionEventMap>(event: K, handler: (payload: TTSSessionEventMap[K]) => void | Promise<void>) => () => void;
|
|
193
|
+
send: (text: string) => Promise<void>;
|
|
194
|
+
cancel?: (reason?: string) => Promise<void>;
|
|
195
|
+
close: (reason?: string) => Promise<void>;
|
|
196
|
+
};
|
|
197
|
+
export declare const ttsAdapterSessionCanCancel: (session: TTSAdapterSession) => session is TTSAdapterSession & {
|
|
198
|
+
cancel: (reason?: string) => Promise<void>;
|
|
199
|
+
};
|
|
200
|
+
export type VoiceTTSProsody = {
|
|
201
|
+
emphasis?: number;
|
|
202
|
+
pitch?: number;
|
|
203
|
+
speed?: number;
|
|
204
|
+
style?: string;
|
|
205
|
+
};
|
|
206
|
+
export type TTSAdapterOpenOptions = {
|
|
207
|
+
sessionId: string;
|
|
208
|
+
lexicon?: VoiceLexiconEntry[];
|
|
209
|
+
prosody?: VoiceTTSProsody;
|
|
210
|
+
signal?: AbortSignal;
|
|
211
|
+
};
|
|
212
|
+
export type TTSAdapter<TOptions extends TTSAdapterOpenOptions = TTSAdapterOpenOptions> = {
|
|
213
|
+
kind: "tts";
|
|
214
|
+
open: (options: TOptions) => Promise<TTSAdapterSession> | TTSAdapterSession;
|
|
215
|
+
};
|
|
216
|
+
export type RealtimeSessionEventMap = STTSessionEventMap & {
|
|
217
|
+
audio: TTSAudioEvent;
|
|
218
|
+
};
|
|
219
|
+
export type RealtimeAdapterSession = {
|
|
220
|
+
on: <K extends keyof RealtimeSessionEventMap>(event: K, handler: (payload: RealtimeSessionEventMap[K]) => void | Promise<void>) => () => void;
|
|
221
|
+
send: (input: AudioChunk | string) => Promise<void>;
|
|
222
|
+
close: (reason?: string) => Promise<void>;
|
|
223
|
+
};
|
|
224
|
+
export type RealtimeAdapterOpenOptions = {
|
|
225
|
+
sessionId: string;
|
|
226
|
+
format: AudioFormat;
|
|
227
|
+
languageStrategy?: VoiceLanguageStrategy;
|
|
228
|
+
lexicon?: VoiceLexiconEntry[];
|
|
229
|
+
modalities?: ReadonlyArray<"audio" | "text">;
|
|
230
|
+
phraseHints?: VoicePhraseHint[];
|
|
231
|
+
promptCacheKey?: string;
|
|
232
|
+
semanticVAD?: import("./assistantMode").VoiceSemanticVADConfig;
|
|
233
|
+
signal?: AbortSignal;
|
|
234
|
+
};
|
|
235
|
+
export type RealtimeAdapter<TOptions extends RealtimeAdapterOpenOptions = RealtimeAdapterOpenOptions> = {
|
|
236
|
+
kind: "realtime";
|
|
237
|
+
open: (options: TOptions) => Promise<RealtimeAdapterSession> | RealtimeAdapterSession;
|
|
238
|
+
};
|
|
239
|
+
export type VoiceSessionStatus = "active" | "reconnecting" | "completed" | "failed";
|
|
240
|
+
export type VoiceReconnectClientStatus = "idle" | "reconnecting" | "resumed" | "exhausted";
|
|
241
|
+
export type VoiceReconnectClientState = {
|
|
242
|
+
attempts: number;
|
|
243
|
+
lastDisconnectAt?: number;
|
|
244
|
+
lastResumedAt?: number;
|
|
245
|
+
maxAttempts: number;
|
|
246
|
+
nextAttemptAt?: number;
|
|
247
|
+
status: VoiceReconnectClientStatus;
|
|
248
|
+
};
|
|
249
|
+
export type VoiceTurnCitation = {
|
|
250
|
+
chunkId: string;
|
|
251
|
+
score: number;
|
|
252
|
+
source?: string;
|
|
253
|
+
title?: string;
|
|
254
|
+
};
|
|
255
|
+
export type VoiceTurnRecord<TResult = unknown> = {
|
|
256
|
+
id: string;
|
|
257
|
+
text: string;
|
|
258
|
+
quality?: VoiceTranscriptQuality;
|
|
259
|
+
transcripts: Transcript[];
|
|
260
|
+
assistantText?: string;
|
|
261
|
+
attachments?: import("./agent").VoiceAgentMessageAttachment[];
|
|
262
|
+
citations?: VoiceTurnCitation[];
|
|
263
|
+
committedAt: number;
|
|
264
|
+
result?: TResult;
|
|
265
|
+
};
|
|
266
|
+
export type VoiceCostTelemetryConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
267
|
+
fallbackPassCostUnit?: number;
|
|
268
|
+
onTurnCost?: (input: {
|
|
269
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
270
|
+
context: TContext;
|
|
271
|
+
estimate: VoiceTurnCostEstimate;
|
|
272
|
+
session: TSession;
|
|
273
|
+
turn: VoiceTurnRecord<TResult>;
|
|
274
|
+
}) => Promise<void> | void;
|
|
275
|
+
primaryPassCostUnit?: number;
|
|
276
|
+
};
|
|
277
|
+
export type VoiceSessionRecord<TMeta = Record<string, never>, TResult = unknown> = {
|
|
278
|
+
id: string;
|
|
279
|
+
createdAt: number;
|
|
280
|
+
lastActivityAt?: number;
|
|
281
|
+
status: VoiceSessionStatus;
|
|
282
|
+
transcripts: Transcript[];
|
|
283
|
+
currentTurn: {
|
|
284
|
+
transcripts: Transcript[];
|
|
285
|
+
partialText: string;
|
|
286
|
+
partialStartedAt?: number;
|
|
287
|
+
partialEndedAt?: number;
|
|
288
|
+
finalText: string;
|
|
289
|
+
lastAudioAt?: number;
|
|
290
|
+
lastSpeechAt?: number;
|
|
291
|
+
lastTranscriptAt?: number;
|
|
292
|
+
silenceStartedAt?: number;
|
|
293
|
+
};
|
|
294
|
+
turns: VoiceTurnRecord<TResult>[];
|
|
295
|
+
committedTurnIds: string[];
|
|
296
|
+
reconnect: {
|
|
297
|
+
attempts: number;
|
|
298
|
+
lastDisconnectAt?: number;
|
|
299
|
+
};
|
|
300
|
+
lastCommittedTurn?: {
|
|
301
|
+
signature: string;
|
|
302
|
+
text: string;
|
|
303
|
+
transcriptIds: string[];
|
|
304
|
+
committedAt: number;
|
|
305
|
+
};
|
|
306
|
+
call?: VoiceCallLifecycleState;
|
|
307
|
+
metadata?: TMeta;
|
|
308
|
+
scenarioId?: string;
|
|
309
|
+
};
|
|
310
|
+
export type VoiceSessionSummary = {
|
|
311
|
+
id: string;
|
|
312
|
+
createdAt: number;
|
|
313
|
+
lastActivityAt?: number;
|
|
314
|
+
status: VoiceSessionStatus;
|
|
315
|
+
turnCount: number;
|
|
316
|
+
};
|
|
317
|
+
export type VoiceCallDisposition = "completed" | "transferred" | "escalated" | "voicemail" | "no-answer" | "failed" | "silence-timeout" | "closed";
|
|
318
|
+
export type VoiceCallLifecycleEvent = {
|
|
319
|
+
at: number;
|
|
320
|
+
type: "start" | "end" | "transfer" | "escalation" | "voicemail" | "no-answer";
|
|
321
|
+
disposition?: VoiceCallDisposition;
|
|
322
|
+
metadata?: Record<string, unknown>;
|
|
323
|
+
reason?: string;
|
|
324
|
+
target?: string;
|
|
325
|
+
};
|
|
326
|
+
export type VoiceCallLifecycleState = {
|
|
327
|
+
disposition?: VoiceCallDisposition;
|
|
328
|
+
endedAt?: number;
|
|
329
|
+
events: VoiceCallLifecycleEvent[];
|
|
330
|
+
lastEventAt: number;
|
|
331
|
+
startedAt: number;
|
|
332
|
+
};
|
|
333
|
+
export type VoiceHandoffAction = "escalate" | "no-answer" | "transfer" | "voicemail";
|
|
334
|
+
export type VoiceHandoffStatus = "delivered" | "failed" | "skipped";
|
|
335
|
+
export type VoiceHandoffResult = {
|
|
336
|
+
deliveredAt?: number;
|
|
337
|
+
deliveredTo?: string;
|
|
338
|
+
error?: string;
|
|
339
|
+
metadata?: Record<string, unknown>;
|
|
340
|
+
status: VoiceHandoffStatus;
|
|
341
|
+
};
|
|
342
|
+
export type VoiceHandoffDeliveryQueueStatus = VoiceHandoffStatus | "pending";
|
|
343
|
+
export type StoredVoiceHandoffDelivery<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
344
|
+
action: VoiceHandoffAction;
|
|
345
|
+
context: TContext;
|
|
346
|
+
createdAt: number;
|
|
347
|
+
deliveredAt?: number;
|
|
348
|
+
deliveries?: Record<string, VoiceHandoffResult & {
|
|
349
|
+
adapterId: string;
|
|
350
|
+
adapterKind?: string;
|
|
351
|
+
}>;
|
|
352
|
+
deliveryAttempts?: number;
|
|
353
|
+
deliveryError?: string;
|
|
354
|
+
deliveryStatus: VoiceHandoffDeliveryQueueStatus;
|
|
355
|
+
id: string;
|
|
356
|
+
metadata?: Record<string, unknown>;
|
|
357
|
+
reason?: string;
|
|
358
|
+
result?: TResult;
|
|
359
|
+
session: TSession;
|
|
360
|
+
sessionId: string;
|
|
361
|
+
target?: string;
|
|
362
|
+
updatedAt: number;
|
|
363
|
+
};
|
|
364
|
+
export type VoiceHandoffDeliveryStore<TDelivery extends StoredVoiceHandoffDelivery = StoredVoiceHandoffDelivery> = {
|
|
365
|
+
get: (id: string) => Promise<TDelivery | undefined> | TDelivery | undefined;
|
|
366
|
+
list: () => Promise<TDelivery[]> | TDelivery[];
|
|
367
|
+
remove: (id: string) => Promise<void> | void;
|
|
368
|
+
set: (id: string, delivery: TDelivery) => Promise<void> | void;
|
|
369
|
+
};
|
|
370
|
+
export type VoiceHandoffInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
371
|
+
action: VoiceHandoffAction;
|
|
372
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
373
|
+
context: TContext;
|
|
374
|
+
metadata?: Record<string, unknown>;
|
|
375
|
+
reason?: string;
|
|
376
|
+
result?: TResult;
|
|
377
|
+
session: TSession;
|
|
378
|
+
target?: string;
|
|
379
|
+
};
|
|
380
|
+
export type VoiceHandoffAdapter<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
381
|
+
actions?: VoiceHandoffAction[];
|
|
382
|
+
handoff: (input: VoiceHandoffInput<TContext, TSession, TResult>) => Promise<VoiceHandoffResult> | VoiceHandoffResult;
|
|
383
|
+
id: string;
|
|
384
|
+
kind?: string;
|
|
385
|
+
};
|
|
386
|
+
export type VoiceHandoffConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
387
|
+
adapters: VoiceHandoffAdapter<TContext, TSession, TResult>[];
|
|
388
|
+
deliveryQueue?: VoiceHandoffDeliveryStore<StoredVoiceHandoffDelivery<TContext, TSession, TResult>>;
|
|
389
|
+
enqueueOnly?: boolean;
|
|
390
|
+
failMode?: "record" | "throw";
|
|
391
|
+
};
|
|
392
|
+
export type VoiceSessionStore<TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
|
|
393
|
+
get: (id: string) => Promise<TSession | undefined>;
|
|
394
|
+
getOrCreate: (id: string) => Promise<TSession>;
|
|
395
|
+
set: (id: string, value: TSession) => Promise<void>;
|
|
396
|
+
list: () => Promise<VoiceSessionSummary[]>;
|
|
397
|
+
remove: (id: string) => Promise<void>;
|
|
398
|
+
};
|
|
399
|
+
export type VoiceLogger = {
|
|
400
|
+
debug?: (message: string, meta?: Record<string, unknown>) => void;
|
|
401
|
+
info?: (message: string, meta?: Record<string, unknown>) => void;
|
|
402
|
+
warn?: (message: string, meta?: Record<string, unknown>) => void;
|
|
403
|
+
error?: (message: string, meta?: Record<string, unknown>) => void;
|
|
404
|
+
};
|
|
405
|
+
export type VoiceReconnectConfig = {
|
|
406
|
+
strategy?: "resume-last-turn" | "restart" | "fail";
|
|
407
|
+
timeout?: number;
|
|
408
|
+
maxAttempts?: number;
|
|
409
|
+
};
|
|
410
|
+
export type VoiceRuntimePreset = "default" | "chat" | "guided-intake" | "dictation" | "noisy-room" | "pstn-balanced" | "pstn-fast" | "reliability";
|
|
411
|
+
export type VoiceSTTLifecycle = "continuous" | "turn-scoped";
|
|
412
|
+
export type VoiceTurnProfile = "fast" | "balanced" | "long-form";
|
|
413
|
+
export type VoiceTurnQualityProfile = "general" | "accent-heavy" | "noisy-room" | "short-command";
|
|
414
|
+
export type VoiceTurnFallbackTrigger = "empty-turn" | "low-confidence" | "empty-or-low-confidence" | "always";
|
|
415
|
+
export type VoiceSTTFallbackConfig = {
|
|
416
|
+
adapter: STTAdapter;
|
|
417
|
+
trigger?: VoiceTurnFallbackTrigger;
|
|
418
|
+
confidenceThreshold?: number;
|
|
419
|
+
minTextLength?: number;
|
|
420
|
+
replayWindowMs?: number;
|
|
421
|
+
settleMs?: number;
|
|
422
|
+
completionTimeoutMs?: number;
|
|
423
|
+
maxAttemptsPerTurn?: number;
|
|
424
|
+
};
|
|
425
|
+
export type VoiceResolvedSTTFallbackConfig = {
|
|
426
|
+
adapter: STTAdapter;
|
|
427
|
+
trigger: VoiceTurnFallbackTrigger;
|
|
428
|
+
confidenceThreshold: number;
|
|
429
|
+
minTextLength: number;
|
|
430
|
+
replayWindowMs: number;
|
|
431
|
+
settleMs: number;
|
|
432
|
+
completionTimeoutMs: number;
|
|
433
|
+
maxAttemptsPerTurn: number;
|
|
434
|
+
};
|
|
435
|
+
export type VoiceTurnDetectionConfig = {
|
|
436
|
+
profile?: VoiceTurnProfile;
|
|
437
|
+
qualityProfile?: VoiceTurnQualityProfile;
|
|
438
|
+
silenceMs?: number;
|
|
439
|
+
minSilenceMs?: number;
|
|
440
|
+
speechThreshold?: number;
|
|
441
|
+
transcriptStabilityMs?: number;
|
|
442
|
+
};
|
|
443
|
+
export type VoiceResolvedTurnDetectionConfig = {
|
|
444
|
+
qualityProfile: VoiceTurnQualityProfile;
|
|
445
|
+
profile: VoiceTurnProfile;
|
|
446
|
+
silenceMs: number;
|
|
447
|
+
minSilenceMs: number;
|
|
448
|
+
speechThreshold: number;
|
|
449
|
+
transcriptStabilityMs: number;
|
|
450
|
+
};
|
|
451
|
+
export type VoiceAudioConditioningConfig = {
|
|
452
|
+
enabled?: boolean;
|
|
453
|
+
targetLevel?: number;
|
|
454
|
+
maxGain?: number;
|
|
455
|
+
noiseGateThreshold?: number;
|
|
456
|
+
noiseGateAttenuation?: number;
|
|
457
|
+
};
|
|
458
|
+
export type VoiceResolvedAudioConditioningConfig = {
|
|
459
|
+
enabled: true;
|
|
460
|
+
targetLevel: number;
|
|
461
|
+
maxGain: number;
|
|
462
|
+
noiseGateThreshold: number;
|
|
463
|
+
noiseGateAttenuation: number;
|
|
464
|
+
};
|
|
465
|
+
export type VoiceSocket = {
|
|
466
|
+
send: (data: string | Uint8Array | ArrayBuffer) => void | Promise<void>;
|
|
467
|
+
close: (code?: number, reason?: string) => void | Promise<void>;
|
|
468
|
+
/**
|
|
469
|
+
* Discard any audio already buffered downstream (e.g. a telephony carrier's
|
|
470
|
+
* outbound media buffer). Called on barge-in so the caller stops hearing the
|
|
471
|
+
* assistant immediately, even when frames have already been flushed to the
|
|
472
|
+
* transport. Optional: transports without a flush concept omit it.
|
|
473
|
+
*/
|
|
474
|
+
clear?: () => void | Promise<void>;
|
|
475
|
+
};
|
|
476
|
+
export type VoiceMonitorRuntimeSessionBinding = {
|
|
477
|
+
deregister: (reason?: string) => void;
|
|
478
|
+
emitAudio: (chunk: Uint8Array | ArrayBuffer, options?: {
|
|
479
|
+
source?: "assistant" | "caller" | (string & {});
|
|
480
|
+
}) => void;
|
|
481
|
+
};
|
|
482
|
+
export type VoiceMonitorRuntimeRegisterInput = {
|
|
483
|
+
handle: VoiceSessionHandle<unknown, VoiceSessionRecord, unknown>;
|
|
484
|
+
metadata?: Record<string, unknown>;
|
|
485
|
+
sessionId: string;
|
|
486
|
+
};
|
|
487
|
+
export type VoiceMonitorRuntimeBinding = {
|
|
488
|
+
registerSession: (input: VoiceMonitorRuntimeRegisterInput) => VoiceMonitorRuntimeSessionBinding;
|
|
489
|
+
};
|
|
490
|
+
export type VoiceSessionHandle<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
491
|
+
id: string;
|
|
492
|
+
connect: (socket: VoiceSocket) => Promise<void>;
|
|
493
|
+
receiveAudio: (audio: AudioChunk) => Promise<void>;
|
|
494
|
+
attachUserMedia: (attachment: import("./agent").VoiceAgentMessageAttachment) => Promise<void>;
|
|
495
|
+
commitTurn: (reason?: VoiceEndOfTurnEvent["reason"]) => Promise<void>;
|
|
496
|
+
disconnect: (event?: VoiceCloseEvent) => Promise<void>;
|
|
497
|
+
complete: (result?: TResult) => Promise<void>;
|
|
498
|
+
escalate: (input: {
|
|
499
|
+
metadata?: Record<string, unknown>;
|
|
500
|
+
reason: string;
|
|
501
|
+
result?: TResult;
|
|
502
|
+
}) => Promise<void>;
|
|
503
|
+
fail: (error: unknown) => Promise<void>;
|
|
504
|
+
markNoAnswer: (input?: {
|
|
505
|
+
metadata?: Record<string, unknown>;
|
|
506
|
+
result?: TResult;
|
|
507
|
+
}) => Promise<void>;
|
|
508
|
+
markVoicemail: (input?: {
|
|
509
|
+
metadata?: Record<string, unknown>;
|
|
510
|
+
result?: TResult;
|
|
511
|
+
}) => Promise<void>;
|
|
512
|
+
transfer: (input: {
|
|
513
|
+
metadata?: Record<string, unknown>;
|
|
514
|
+
reason?: string;
|
|
515
|
+
result?: TResult;
|
|
516
|
+
target: string;
|
|
517
|
+
transferMode?: "cold" | "warm";
|
|
518
|
+
}) => Promise<void>;
|
|
519
|
+
close: (reason?: string) => Promise<void>;
|
|
520
|
+
snapshot: () => Promise<TSession>;
|
|
521
|
+
/**
|
|
522
|
+
* Mutate the live turn-detection config for this session — useful when a
|
|
523
|
+
* tool call wants to dial silenceMs up ("the caller asked for more time")
|
|
524
|
+
* or down. The change takes effect on the NEXT silence-timer schedule, so
|
|
525
|
+
* an in-flight commit isn't cancelled. Returns the merged config so the
|
|
526
|
+
* caller can confirm.
|
|
527
|
+
*/
|
|
528
|
+
setTurnDetection: (patch: Partial<VoiceTurnDetectionConfig>) => Promise<{
|
|
529
|
+
silenceMs: number;
|
|
530
|
+
speechThreshold: number;
|
|
531
|
+
transcriptStabilityMs: number;
|
|
532
|
+
}>;
|
|
533
|
+
};
|
|
534
|
+
export type VoiceRouteResult<TResult = unknown> = {
|
|
535
|
+
complete?: boolean;
|
|
536
|
+
result?: TResult;
|
|
537
|
+
assistantText?: string;
|
|
538
|
+
citations?: ReadonlyArray<VoiceTurnCitation>;
|
|
539
|
+
transfer?: {
|
|
540
|
+
metadata?: Record<string, unknown>;
|
|
541
|
+
reason?: string;
|
|
542
|
+
target: string;
|
|
543
|
+
transferMode?: "cold" | "warm";
|
|
544
|
+
};
|
|
545
|
+
escalate?: {
|
|
546
|
+
metadata?: Record<string, unknown>;
|
|
547
|
+
reason: string;
|
|
548
|
+
};
|
|
549
|
+
voicemail?: {
|
|
550
|
+
metadata?: Record<string, unknown>;
|
|
551
|
+
};
|
|
552
|
+
noAnswer?: {
|
|
553
|
+
metadata?: Record<string, unknown>;
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
export type VoiceTurnCorrectionResult = string | {
|
|
557
|
+
text: string;
|
|
558
|
+
reason?: string;
|
|
559
|
+
provider?: string;
|
|
560
|
+
metadata?: Record<string, unknown>;
|
|
561
|
+
};
|
|
562
|
+
export type VoiceTurnCorrectionHandler<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = (input: {
|
|
563
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
564
|
+
context: TContext;
|
|
565
|
+
fallback?: VoiceFallbackDiagnostics;
|
|
566
|
+
lexicon: VoiceLexiconEntry[];
|
|
567
|
+
phraseHints: VoicePhraseHint[];
|
|
568
|
+
session: TSession;
|
|
569
|
+
text: string;
|
|
570
|
+
transcripts: Transcript[];
|
|
571
|
+
}) => Promise<VoiceTurnCorrectionResult | void> | VoiceTurnCorrectionResult | void;
|
|
572
|
+
export type VoicePhraseHintResolver<TContext = unknown> = (input: {
|
|
573
|
+
context: TContext;
|
|
574
|
+
scenarioId?: string;
|
|
575
|
+
sessionId: string;
|
|
576
|
+
}) => Promise<VoicePhraseHint[] | void> | VoicePhraseHint[] | void;
|
|
577
|
+
export type VoiceLexiconResolver<TContext = unknown> = (input: {
|
|
578
|
+
context: TContext;
|
|
579
|
+
scenarioId?: string;
|
|
580
|
+
sessionId: string;
|
|
581
|
+
}) => Promise<VoiceLexiconEntry[] | void> | VoiceLexiconEntry[] | void;
|
|
582
|
+
export type VoiceOnTurnObjectHandler<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = (input: {
|
|
583
|
+
context: TContext;
|
|
584
|
+
liveOps?: {
|
|
585
|
+
control: VoiceLiveOpsControlState;
|
|
586
|
+
injectedInstruction?: string;
|
|
587
|
+
};
|
|
588
|
+
onTextDelta?: (delta: string) => void;
|
|
589
|
+
session: TSession;
|
|
590
|
+
turn: VoiceTurnRecord;
|
|
591
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
592
|
+
speculativeReply?: {
|
|
593
|
+
text: string;
|
|
594
|
+
};
|
|
595
|
+
}) => Promise<VoiceRouteResult<TResult> | void> | VoiceRouteResult<TResult> | void;
|
|
596
|
+
export type VoiceOnTurnHandler<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = VoiceOnTurnObjectHandler<TContext, TSession, TResult> | ((session: TSession, turn: VoiceTurnRecord, api: VoiceSessionHandle<TContext, TSession, TResult>, context: TContext) => Promise<VoiceRouteResult<TResult> | void> | VoiceRouteResult<TResult> | void);
|
|
597
|
+
export type VoiceRouteConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
598
|
+
onCallStart?: (input: {
|
|
599
|
+
context: TContext;
|
|
600
|
+
session: TSession;
|
|
601
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
602
|
+
}) => Promise<void> | void;
|
|
603
|
+
onCallEnd?: (input: {
|
|
604
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
605
|
+
context: TContext;
|
|
606
|
+
disposition: VoiceCallDisposition;
|
|
607
|
+
metadata?: Record<string, unknown>;
|
|
608
|
+
reason?: string;
|
|
609
|
+
session: TSession;
|
|
610
|
+
target?: string;
|
|
611
|
+
}) => Promise<void> | void;
|
|
612
|
+
onSession?: (input: {
|
|
613
|
+
context: TContext;
|
|
614
|
+
session: TSession;
|
|
615
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
616
|
+
}) => Promise<void> | void;
|
|
617
|
+
/** Fires when a connect RESUMES an existing session (a reconnect, or a fresh
|
|
618
|
+
* process after a restart finding the session in a persistent store) instead
|
|
619
|
+
* of starting a new call — onCallStart/onSession do NOT fire on a resume.
|
|
620
|
+
* Use it to rebuild any per-session in-memory state (caller context, paced
|
|
621
|
+
* flags) that didn't survive the process, so the resumed call keeps the
|
|
622
|
+
* personalization the original had. Runs before the resume re-greeting. */
|
|
623
|
+
onResume?: (input: {
|
|
624
|
+
context: TContext;
|
|
625
|
+
session: TSession;
|
|
626
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
627
|
+
}) => Promise<void> | void;
|
|
628
|
+
correctTurn?: VoiceTurnCorrectionHandler<TContext, TSession, TResult>;
|
|
629
|
+
speculate?: (input: {
|
|
630
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
631
|
+
context: TContext;
|
|
632
|
+
session: TSession;
|
|
633
|
+
turn: VoiceTurnRecord;
|
|
634
|
+
signal?: AbortSignal;
|
|
635
|
+
}) => Promise<{
|
|
636
|
+
text: string;
|
|
637
|
+
} | null | void>;
|
|
638
|
+
onTurn: VoiceOnTurnHandler<TContext, TSession, TResult>;
|
|
639
|
+
onComplete: (input: {
|
|
640
|
+
context: TContext;
|
|
641
|
+
session: TSession;
|
|
642
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
643
|
+
}) => Promise<void> | void;
|
|
644
|
+
onError?: (input: {
|
|
645
|
+
context: TContext;
|
|
646
|
+
sessionId: string;
|
|
647
|
+
session?: TSession;
|
|
648
|
+
error: unknown;
|
|
649
|
+
api?: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
650
|
+
}) => Promise<void> | void;
|
|
651
|
+
onEscalation?: (input: {
|
|
652
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
653
|
+
context: TContext;
|
|
654
|
+
metadata?: Record<string, unknown>;
|
|
655
|
+
reason: string;
|
|
656
|
+
session: TSession;
|
|
657
|
+
}) => Promise<void> | void;
|
|
658
|
+
onNoAnswer?: (input: {
|
|
659
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
660
|
+
context: TContext;
|
|
661
|
+
metadata?: Record<string, unknown>;
|
|
662
|
+
session: TSession;
|
|
663
|
+
}) => Promise<void> | void;
|
|
664
|
+
onTransfer?: (input: {
|
|
665
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
666
|
+
context: TContext;
|
|
667
|
+
metadata?: Record<string, unknown>;
|
|
668
|
+
reason?: string;
|
|
669
|
+
session: TSession;
|
|
670
|
+
target: string;
|
|
671
|
+
}) => Promise<void> | void;
|
|
672
|
+
onVoicemail?: (input: {
|
|
673
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
674
|
+
context: TContext;
|
|
675
|
+
metadata?: Record<string, unknown>;
|
|
676
|
+
session: TSession;
|
|
677
|
+
}) => Promise<void> | void;
|
|
678
|
+
};
|
|
679
|
+
export type VoiceRuntimeOpsConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
680
|
+
buildReview?: (input: {
|
|
681
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
682
|
+
context: TContext;
|
|
683
|
+
disposition: VoiceCallDisposition;
|
|
684
|
+
metadata?: Record<string, unknown>;
|
|
685
|
+
reason?: string;
|
|
686
|
+
result?: TResult;
|
|
687
|
+
session: TSession;
|
|
688
|
+
target?: string;
|
|
689
|
+
}) => Promise<VoiceCallReviewArtifact | StoredVoiceCallReviewArtifact | void> | VoiceCallReviewArtifact | StoredVoiceCallReviewArtifact | void;
|
|
690
|
+
createTaskFromReview?: (input: {
|
|
691
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
692
|
+
context: TContext;
|
|
693
|
+
disposition: VoiceCallDisposition;
|
|
694
|
+
review: StoredVoiceCallReviewArtifact;
|
|
695
|
+
session: TSession;
|
|
696
|
+
}) => Promise<Omit<VoiceOpsTask, "id"> | VoiceOpsTask | StoredVoiceOpsTask | null | void> | Omit<VoiceOpsTask, "id"> | VoiceOpsTask | StoredVoiceOpsTask | null | void;
|
|
697
|
+
resolveTaskPolicy?: (input: {
|
|
698
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
699
|
+
context: TContext;
|
|
700
|
+
disposition: VoiceCallDisposition;
|
|
701
|
+
metadata?: Record<string, unknown>;
|
|
702
|
+
reason?: string;
|
|
703
|
+
review?: StoredVoiceCallReviewArtifact;
|
|
704
|
+
session: TSession;
|
|
705
|
+
target?: string;
|
|
706
|
+
task: StoredVoiceOpsTask;
|
|
707
|
+
}) => Promise<VoiceOpsTaskPolicy | void> | VoiceOpsTaskPolicy | void;
|
|
708
|
+
resolveTaskAssignment?: (input: {
|
|
709
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
710
|
+
context: TContext;
|
|
711
|
+
disposition: VoiceCallDisposition;
|
|
712
|
+
metadata?: Record<string, unknown>;
|
|
713
|
+
reason?: string;
|
|
714
|
+
review?: StoredVoiceCallReviewArtifact;
|
|
715
|
+
session: TSession;
|
|
716
|
+
target?: string;
|
|
717
|
+
task: StoredVoiceOpsTask;
|
|
718
|
+
}) => Promise<VoiceOpsTaskAssignmentRule | void> | VoiceOpsTaskAssignmentRule | void;
|
|
719
|
+
taskAssignmentRules?: VoiceOpsTaskAssignmentRules;
|
|
720
|
+
taskPolicies?: VoiceOpsDispositionTaskPolicies;
|
|
721
|
+
events?: VoiceIntegrationEventStore;
|
|
722
|
+
onEvent?: (input: {
|
|
723
|
+
api: VoiceSessionHandle<TContext, TSession, TResult>;
|
|
724
|
+
context: TContext;
|
|
725
|
+
event: StoredVoiceIntegrationEvent;
|
|
726
|
+
session: TSession;
|
|
727
|
+
}) => Promise<void> | void;
|
|
728
|
+
reviews?: VoiceCallReviewStore;
|
|
729
|
+
sinks?: VoiceIntegrationSink[];
|
|
730
|
+
tasks?: VoiceOpsTaskStore;
|
|
731
|
+
webhook?: VoiceIntegrationWebhookConfig;
|
|
732
|
+
};
|
|
733
|
+
export type VoiceLiveOpsRuntimeConfig = {
|
|
734
|
+
getControl: (sessionId: string) => Promise<VoiceLiveOpsControlState | null | undefined> | VoiceLiveOpsControlState | null | undefined;
|
|
735
|
+
};
|
|
736
|
+
export type VoiceProfileSwitchGuardResolverInput<TContext = unknown> = {
|
|
737
|
+
context: TContext;
|
|
738
|
+
scenarioId?: string;
|
|
739
|
+
sessionId: string;
|
|
740
|
+
};
|
|
741
|
+
export type VoicePluginProfileSwitchGuardConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
742
|
+
actor?: VoiceAuditActor;
|
|
743
|
+
allowedProfileIds?: string[] | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<string[] | undefined> | string[] | undefined);
|
|
744
|
+
audit?: VoiceAuditEventStore;
|
|
745
|
+
blockedProfileIds?: string[] | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<string[] | undefined> | string[] | undefined);
|
|
746
|
+
currentProfileId?: string | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<string | undefined> | string | undefined);
|
|
747
|
+
defaultProfileId?: string;
|
|
748
|
+
defaults: VoiceRealCallProfileDefaultsReport | VoiceRealCallProfileHistoryReport | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<VoiceRealCallProfileDefaultsReport | VoiceRealCallProfileHistoryReport> | VoiceRealCallProfileDefaultsReport | VoiceRealCallProfileHistoryReport);
|
|
749
|
+
metadata?: Record<string, unknown> | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<Record<string, unknown> | undefined> | Record<string, unknown> | undefined);
|
|
750
|
+
minConfidence?: number | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<number | undefined> | number | undefined);
|
|
751
|
+
maxAutoSwitchesPerSession?: number | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<number | undefined> | number | undefined);
|
|
752
|
+
mode?: VoiceProfileSwitchGuardMode | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<VoiceProfileSwitchGuardMode | undefined> | VoiceProfileSwitchGuardMode | undefined);
|
|
753
|
+
observed?: VoiceProfileSwitchObservedSignals | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<VoiceProfileSwitchObservedSignals | undefined> | VoiceProfileSwitchObservedSignals | undefined);
|
|
754
|
+
onDecision?: (input: {
|
|
755
|
+
context: TContext;
|
|
756
|
+
decision: VoiceProfileSwitchGuardDecision;
|
|
757
|
+
scenarioId?: string;
|
|
758
|
+
sessionId: string;
|
|
759
|
+
}) => Promise<void> | void;
|
|
760
|
+
sessionMetadataKey?: string | false;
|
|
761
|
+
trace?: false | VoiceTraceEventStore;
|
|
762
|
+
};
|
|
763
|
+
export type VoiceNormalizedRouteConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoiceRouteConfig<TContext, TSession, TResult>, "onTurn"> & {
|
|
764
|
+
onTurn: VoiceOnTurnObjectHandler<TContext, TSession, TResult>;
|
|
765
|
+
};
|
|
766
|
+
export type VoiceScenario = {
|
|
767
|
+
id: string;
|
|
768
|
+
name?: string;
|
|
769
|
+
description?: string;
|
|
770
|
+
metadata?: Record<string, unknown>;
|
|
771
|
+
};
|
|
772
|
+
export type VoiceExpectedSpeakerTurn = {
|
|
773
|
+
speaker: string;
|
|
774
|
+
text: string;
|
|
775
|
+
};
|
|
776
|
+
/**
|
|
777
|
+
* Configures one of the plugin's optional route surfaces. Pass that surface's
|
|
778
|
+
* options object to mount it, `false` (or omit) to leave it off. Surfaces whose
|
|
779
|
+
* options are entirely optional may also be enabled with `true` for defaults.
|
|
780
|
+
*/
|
|
781
|
+
export type VoiceSurfaceConfig<O> = false | O | (Record<string, never> extends O ? true : never);
|
|
782
|
+
export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
783
|
+
costTelemetry?: VoiceCostTelemetryConfig<TContext, TSession, TResult>;
|
|
784
|
+
path: string;
|
|
785
|
+
greeting?: string | ((input: {
|
|
786
|
+
session: TSession;
|
|
787
|
+
}) => string | Promise<string>);
|
|
788
|
+
resumeGreeting?: string | ((input: {
|
|
789
|
+
session: TSession;
|
|
790
|
+
}) => string | Promise<string>);
|
|
791
|
+
languageStrategy?: VoiceLanguageStrategy;
|
|
792
|
+
lexicon?: VoiceLexiconEntry[] | VoiceLexiconResolver<TContext>;
|
|
793
|
+
phraseHints?: VoicePhraseHint[] | VoicePhraseHintResolver<TContext>;
|
|
794
|
+
preset?: VoiceRuntimePreset;
|
|
795
|
+
stt?: STTAdapter;
|
|
796
|
+
sttFallback?: VoiceSTTFallbackConfig;
|
|
797
|
+
sttLifecycle?: VoiceSTTLifecycle;
|
|
798
|
+
realtime?: RealtimeAdapter;
|
|
799
|
+
realtimeInputFormat?: AudioFormat;
|
|
800
|
+
tts?: TTSAdapter;
|
|
801
|
+
session: VoiceSessionStore<NoInfer<TSession>>;
|
|
802
|
+
reconnect?: VoiceReconnectConfig;
|
|
803
|
+
turnDetection?: VoiceTurnDetectionConfig;
|
|
804
|
+
semanticTurnDetector?: import("./semanticTurn").VoiceSemanticTurnDetector;
|
|
805
|
+
bargeInMinPartialWords?: number;
|
|
806
|
+
/**
|
|
807
|
+
* When true, a pure listening cue ("mm-hm", "yeah", "right", "got it") spoken
|
|
808
|
+
* WHILE the assistant is talking does NOT barge-in — the assistant keeps going
|
|
809
|
+
* and the cue is dropped so it never becomes the caller's next turn. A bare
|
|
810
|
+
* "yeah" said AFTER the assistant finishes is a normal answer, unaffected.
|
|
811
|
+
* Default false (any in-speech words interrupt, the prior behavior).
|
|
812
|
+
*/
|
|
813
|
+
backchannelBargeInGuard?: boolean;
|
|
814
|
+
fillerPhrases?: ReadonlyArray<string>;
|
|
815
|
+
fillerDelayMs?: number;
|
|
816
|
+
fillerFor?: (input: {
|
|
817
|
+
sessionId: string;
|
|
818
|
+
turnId: string;
|
|
819
|
+
userText: string;
|
|
820
|
+
}) => Promise<string | null>;
|
|
821
|
+
fillerForTimeoutMs?: number;
|
|
822
|
+
backchannel?: import("./backchannel").VoiceBackchannelConfig;
|
|
823
|
+
defaultSilentTurnAck?: string;
|
|
824
|
+
routeOnTurnTimeoutMs?: number;
|
|
825
|
+
audioConditioning?: VoiceAudioConditioningConfig;
|
|
826
|
+
noiseSuppressor?: VoiceNoiseSuppressor;
|
|
827
|
+
noiseSuppressorFormat?: AudioFormat;
|
|
828
|
+
logger?: VoiceLogger;
|
|
829
|
+
htmx?: boolean | VoiceHTMXConfig<TSession, NoInfer<TResult>>;
|
|
830
|
+
handoff?: VoiceHandoffConfig<TContext, TSession, TResult>;
|
|
831
|
+
ops?: VoiceRuntimeOpsConfig<TContext, TSession, TResult>;
|
|
832
|
+
liveOps?: VoiceLiveOpsRuntimeConfig;
|
|
833
|
+
monitor?: VoiceMonitorRuntimeBinding;
|
|
834
|
+
profileSwitchGuard?: VoicePluginProfileSwitchGuardConfig<TContext, TSession, TResult>;
|
|
835
|
+
trace?: VoiceTraceEventStore;
|
|
836
|
+
assistantHealth?: VoiceSurfaceConfig<import("./assistantHealth").VoiceAssistantHealthRoutesOptions>;
|
|
837
|
+
auditDelivery?: VoiceSurfaceConfig<import("./auditDeliveryRoutes").VoiceAuditDeliveryRoutesOptions>;
|
|
838
|
+
auditTrail?: VoiceSurfaceConfig<import("./auditRoutes").VoiceAuditTrailRoutesOptions>;
|
|
839
|
+
bargeIn?: VoiceSurfaceConfig<import("./bargeInRoutes").VoiceBargeInRoutesOptions>;
|
|
840
|
+
browserCallProfile?: VoiceSurfaceConfig<import("./browserCallProfiles").VoiceBrowserCallProfileRoutesOptions>;
|
|
841
|
+
browserMedia?: VoiceSurfaceConfig<import("./browserMediaRoutes").VoiceBrowserMediaRoutesOptions>;
|
|
842
|
+
callDebugger?: VoiceSurfaceConfig<import("./callDebugger").VoiceCallDebuggerRoutesOptions>;
|
|
843
|
+
campaign?: VoiceSurfaceConfig<import("./campaign").VoiceCampaignRoutesOptions>;
|
|
844
|
+
competitiveCoverage?: VoiceSurfaceConfig<import("./competitiveCoverage").VoiceCompetitiveCoverageRoutesOptions>;
|
|
845
|
+
dataControl?: VoiceSurfaceConfig<import("./dataControl").VoiceDataControlRoutesOptions>;
|
|
846
|
+
deliveryRuntime?: VoiceSurfaceConfig<import("./deliveryRuntime").VoiceDeliveryRuntimeRoutesOptions>;
|
|
847
|
+
deliverySink?: VoiceSurfaceConfig<import("./deliverySinkRoutes").VoiceDeliverySinkRoutesOptions>;
|
|
848
|
+
demoReady?: VoiceSurfaceConfig<import("./demoReadyRoutes").VoiceDemoReadyRoutesOptions>;
|
|
849
|
+
diagnostics?: VoiceSurfaceConfig<import("./diagnosticsRoutes").VoiceDiagnosticsRoutesOptions>;
|
|
850
|
+
eval?: VoiceSurfaceConfig<import("./evalRoutes").VoiceEvalRoutesOptions>;
|
|
851
|
+
guardrail?: VoiceSurfaceConfig<import("./guardrails").VoiceGuardrailRoutesOptions>;
|
|
852
|
+
handoffHealth?: VoiceSurfaceConfig<import("./handoffHealth").VoiceHandoffHealthRoutesOptions>;
|
|
853
|
+
htmxDashboard?: VoiceSurfaceConfig<import("./htmxDashboardRoutes").VoiceHTMXDashboardRoutesOptions>;
|
|
854
|
+
incidentBundle?: VoiceSurfaceConfig<import("./incidentBundle").VoiceIncidentBundleRoutesOptions>;
|
|
855
|
+
incidentTimeline?: VoiceSurfaceConfig<import("./incidentTimeline").VoiceIncidentTimelineRoutesOptions>;
|
|
856
|
+
liveLatency?: VoiceSurfaceConfig<import("./liveLatency").VoiceLiveLatencyRoutesOptions>;
|
|
857
|
+
liveMonitor?: VoiceSurfaceConfig<import("./monitor").VoiceLiveMonitorRoutesOptions>;
|
|
858
|
+
liveOpsConsole?: VoiceSurfaceConfig<import("./liveOps").VoiceLiveOpsRoutesOptions>;
|
|
859
|
+
mediaPipeline?: VoiceSurfaceConfig<import("./mediaPipelineRoutes").VoiceMediaPipelineRoutesOptions>;
|
|
860
|
+
monitorReport?: VoiceSurfaceConfig<import("./voiceMonitoring").VoiceMonitorRoutesOptions>;
|
|
861
|
+
monitorRunner?: VoiceSurfaceConfig<import("./voiceMonitoring").VoiceMonitorRunnerRoutesOptions>;
|
|
862
|
+
observabilityExport?: VoiceSurfaceConfig<import("./observabilityExport").VoiceObservabilityExportRoutesOptions>;
|
|
863
|
+
observabilityExportReplay?: VoiceSurfaceConfig<import("./observabilityExport").VoiceObservabilityExportReplayRoutesOptions>;
|
|
864
|
+
operationalStatus?: VoiceSurfaceConfig<import("./operationalStatus").VoiceOperationalStatusRoutesOptions>;
|
|
865
|
+
operationsRecord?: VoiceSurfaceConfig<import("./operationsRecord").VoiceOperationsRecordRoutesOptions>;
|
|
866
|
+
opsActionAudit?: VoiceSurfaceConfig<import("./opsActionAuditRoutes").VoiceOpsActionAuditRoutesOptions>;
|
|
867
|
+
opsConsole?: VoiceSurfaceConfig<import("./opsConsoleRoutes").VoiceOpsConsoleRoutesOptions>;
|
|
868
|
+
opsRecovery?: VoiceSurfaceConfig<import("./opsRecovery").VoiceOpsRecoveryRoutesOptions>;
|
|
869
|
+
opsStatus?: VoiceSurfaceConfig<import("./opsStatus").VoiceOpsStatusRoutesOptions>;
|
|
870
|
+
opsWebhookReceiver?: VoiceSurfaceConfig<import("./opsWebhook").VoiceOpsWebhookReceiverRoutesOptions>;
|
|
871
|
+
outcomeContract?: VoiceSurfaceConfig<import("./outcomeContract").VoiceOutcomeContractRoutesOptions>;
|
|
872
|
+
phoneAgentProductionSmoke?: VoiceSurfaceConfig<import("./phoneAgentProductionSmoke").VoicePhoneAgentProductionSmokeRoutesOptions>;
|
|
873
|
+
platformCoverage?: VoiceSurfaceConfig<import("./platformCoverage").VoicePlatformCoverageRoutesOptions>;
|
|
874
|
+
postCallAnalysis?: VoiceSurfaceConfig<import("./postCallAnalysis").VoicePostCallAnalysisRoutesOptions>;
|
|
875
|
+
productionReadiness?: VoiceSurfaceConfig<import("./productionReadiness").VoiceProductionReadinessRoutesOptions>;
|
|
876
|
+
profileSwitchLiveDecision?: VoiceSurfaceConfig<import("./profileSwitchRecommendation").VoiceProfileSwitchLiveDecisionRoutesOptions>;
|
|
877
|
+
profileSwitchPolicyProof?: VoiceSurfaceConfig<import("./profileSwitchRecommendation").VoiceProfileSwitchPolicyProofRoutesOptions>;
|
|
878
|
+
profileSwitchReadiness?: VoiceSurfaceConfig<import("./profileSwitchRecommendation").VoiceProfileSwitchReadinessRoutesOptions>;
|
|
879
|
+
proofPack?: VoiceSurfaceConfig<import("./proofPack").VoiceProofPackRoutesOptions>;
|
|
880
|
+
proofTrend?: VoiceSurfaceConfig<import("./proofTrends").VoiceProofTrendRoutesOptions>;
|
|
881
|
+
proofTrendRecommendation?: VoiceSurfaceConfig<import("./proofTrends").VoiceProofTrendRecommendationRoutesOptions>;
|
|
882
|
+
providerCapability?: VoiceSurfaceConfig<import("./providerCapabilities").VoiceProviderCapabilityRoutesOptions>;
|
|
883
|
+
providerContractMatrix?: VoiceSurfaceConfig<import("./providerStackRecommendations").VoiceProviderContractMatrixRoutesOptions>;
|
|
884
|
+
providerDecisionTrace?: VoiceSurfaceConfig<import("./providerDecisionTraces").VoiceProviderDecisionTraceRoutesOptions>;
|
|
885
|
+
providerHealth?: VoiceSurfaceConfig<import("./providerHealth").VoiceProviderHealthRoutesOptions>;
|
|
886
|
+
providerOrchestration?: VoiceSurfaceConfig<import("./providerOrchestration").VoiceProviderOrchestrationRoutesOptions>;
|
|
887
|
+
providerSlo?: VoiceSurfaceConfig<import("./providerSlo").VoiceProviderSloRoutesOptions>;
|
|
888
|
+
quality?: VoiceSurfaceConfig<import("./qualityRoutes").VoiceQualityRoutesOptions>;
|
|
889
|
+
realCallEvidenceRuntime?: VoiceSurfaceConfig<import("./proofTrends").VoiceRealCallEvidenceRuntimeRoutesOptions>;
|
|
890
|
+
realCallProfileHistory?: VoiceSurfaceConfig<import("./proofTrends").VoiceRealCallProfileHistoryRoutesOptions>;
|
|
891
|
+
realCallProfileRecoveryAction?: VoiceSurfaceConfig<import("./proofTrends").VoiceRealCallProfileRecoveryActionRoutesOptions>;
|
|
892
|
+
realtimeChannel?: VoiceSurfaceConfig<import("./realtimeChannel").VoiceRealtimeChannelRoutesOptions>;
|
|
893
|
+
realtimeProviderContract?: VoiceSurfaceConfig<import("./realtimeProviderContracts").VoiceRealtimeProviderContractRoutesOptions>;
|
|
894
|
+
reconnectContract?: VoiceSurfaceConfig<import("./reconnectContract").VoiceReconnectContractRoutesOptions>;
|
|
895
|
+
reconnectProof?: VoiceSurfaceConfig<import("./reconnectContract").VoiceReconnectProofRoutesOptions>;
|
|
896
|
+
resilience?: VoiceSurfaceConfig<import("./resilienceRoutes").VoiceResilienceRoutesOptions>;
|
|
897
|
+
sessionList?: VoiceSurfaceConfig<import("./sessionReplay").VoiceSessionListRoutesOptions>;
|
|
898
|
+
sessionObservability?: VoiceSurfaceConfig<import("./sessionObservability").VoiceSessionObservabilityRoutesOptions>;
|
|
899
|
+
sessionReplay?: VoiceSurfaceConfig<import("./sessionReplay").VoiceSessionReplayRoutesOptions>;
|
|
900
|
+
sessionSnapshot?: VoiceSurfaceConfig<import("./sessionSnapshot").VoiceSessionSnapshotRoutesOptions>;
|
|
901
|
+
simulationSuite?: VoiceSurfaceConfig<import("./simulationSuite").VoiceSimulationSuiteRoutesOptions>;
|
|
902
|
+
sloCalibration?: VoiceSurfaceConfig<import("./sloCalibration").VoiceSloCalibrationRoutesOptions>;
|
|
903
|
+
sloReadinessThreshold?: VoiceSurfaceConfig<import("./sloCalibration").VoiceSloReadinessThresholdRoutesOptions>;
|
|
904
|
+
telephonyCarrierMatrix?: VoiceSurfaceConfig<import("../telephony/matrix").VoiceTelephonyCarrierMatrixRoutesOptions>;
|
|
905
|
+
telephonyMedia?: VoiceSurfaceConfig<import("./telephonyMediaRoutes").VoiceTelephonyMediaRoutesOptions>;
|
|
906
|
+
telephonyWebhook?: VoiceSurfaceConfig<import("./telephonyOutcome").VoiceTelephonyWebhookRoutesOptions>;
|
|
907
|
+
telephonyWebhookSecurity?: VoiceSurfaceConfig<import("../telephony/security").VoiceTelephonyWebhookSecurityRoutesOptions>;
|
|
908
|
+
toolContract?: VoiceSurfaceConfig<import("./toolContract").VoiceToolContractRoutesOptions>;
|
|
909
|
+
traceDelivery?: VoiceSurfaceConfig<import("./traceDeliveryRoutes").VoiceTraceDeliveryRoutesOptions>;
|
|
910
|
+
traceTimeline?: VoiceSurfaceConfig<import("./traceTimeline").VoiceTraceTimelineRoutesOptions>;
|
|
911
|
+
turnLatency?: VoiceSurfaceConfig<import("./turnLatency").VoiceTurnLatencyRoutesOptions>;
|
|
912
|
+
turnQuality?: VoiceSurfaceConfig<import("./turnQuality").VoiceTurnQualityRoutesOptions>;
|
|
913
|
+
} & VoiceRouteConfig<TContext, TSession, TResult>;
|
|
914
|
+
export type VoiceSessionRecordingConfig = {
|
|
915
|
+
channels?: ReadonlyArray<"assistant" | "user">;
|
|
916
|
+
maxBytesPerChannel?: number;
|
|
917
|
+
store: import("./recordingStore").VoiceRecordingStore;
|
|
918
|
+
userInputFormat?: AudioFormat;
|
|
919
|
+
};
|
|
920
|
+
export type CreateVoiceSessionOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
921
|
+
costTelemetry?: VoiceCostTelemetryConfig<TContext, TSession, TResult>;
|
|
922
|
+
id: string;
|
|
923
|
+
context: TContext;
|
|
924
|
+
socket: VoiceSocket;
|
|
925
|
+
greeting?: string | ((input: {
|
|
926
|
+
session: TSession;
|
|
927
|
+
}) => string | Promise<string>);
|
|
928
|
+
/** Spoken on a RESUME (reconnect / restart) of a call that already had at
|
|
929
|
+
* least one committed turn — a short re-orientation ("Sorry, you cut out —
|
|
930
|
+
* you were telling me about X; go on") so the caller knows they're back,
|
|
931
|
+
* since the in-flight assistant audio didn't survive. Receives the session so
|
|
932
|
+
* it can reference the last turn. No resume greeting fires if unset. */
|
|
933
|
+
resumeGreeting?: string | ((input: {
|
|
934
|
+
session: TSession;
|
|
935
|
+
}) => string | Promise<string>);
|
|
936
|
+
stt?: STTAdapter;
|
|
937
|
+
realtime?: RealtimeAdapter;
|
|
938
|
+
realtimeInputFormat?: AudioFormat;
|
|
939
|
+
tts?: TTSAdapter;
|
|
940
|
+
languageStrategy?: VoiceLanguageStrategy;
|
|
941
|
+
lexicon?: VoiceLexiconEntry[];
|
|
942
|
+
sttFallback?: VoiceResolvedSTTFallbackConfig;
|
|
943
|
+
store: VoiceSessionStore<TSession>;
|
|
944
|
+
trace?: VoiceTraceEventStore;
|
|
945
|
+
recording?: VoiceSessionRecordingConfig;
|
|
946
|
+
callSilenceTimeoutMs?: number;
|
|
947
|
+
amd?: import("./amdDetector").VoiceAMDDetector<TContext, TSession, TResult>;
|
|
948
|
+
costAccountant?: import("./costAccounting").VoiceCostAccountant;
|
|
949
|
+
costTelephony?: {
|
|
950
|
+
provider?: string;
|
|
951
|
+
};
|
|
952
|
+
redact?: import("./redaction").VoiceTranscriptRedactor;
|
|
953
|
+
semanticTurnDetector?: import("./semanticTurn").VoiceSemanticTurnDetector;
|
|
954
|
+
/**
|
|
955
|
+
* Pre-rendered filler phrases the runtime plays in the gap between
|
|
956
|
+
* user-turn-commit and real assistant audio (typically 800-1500ms). The
|
|
957
|
+
* caller hears something within ~150-300ms of stopping speaking, so the
|
|
958
|
+
* LLM/TTS latency feels like the bot thinking instead of dead air. Boardy's
|
|
959
|
+
* killer UX feature.
|
|
960
|
+
*
|
|
961
|
+
* Behavior:
|
|
962
|
+
* - After a turn commits, a timer fires at `fillerDelayMs` (default
|
|
963
|
+
* 250ms). At that point, if the real assistant audio for this turn
|
|
964
|
+
* hasn't started flowing yet, a random phrase is rendered via the
|
|
965
|
+
* configured `tts` adapter and pushed to the socket.
|
|
966
|
+
* - When the real assistant audio's first chunk arrives, any in-flight
|
|
967
|
+
* filler is cancelled (`cancelActiveTTS` clears the carrier buffer).
|
|
968
|
+
* - Cooldown protects against double-fillers per turn.
|
|
969
|
+
*
|
|
970
|
+
* Set `fillerPhrases: []` (or omit) to disable. Reasonable defaults if
|
|
971
|
+
* you enable: `["Hmm.", "Got it.", "Right.", "Mm-hm.", "Let me think.", "Okay."]`.
|
|
972
|
+
*/
|
|
973
|
+
/**
|
|
974
|
+
* Minimum word count in an STT partial transcript before speech-gated
|
|
975
|
+
* barge-in cancels the in-flight assistant TTS. Default 1 (any non-empty
|
|
976
|
+
* partial triggers barge-in — backwards-compatible).
|
|
977
|
+
*
|
|
978
|
+
* Set to 2 (or higher) on phone routes where the caller's brief
|
|
979
|
+
* acknowledgements ("yeah", "uh-huh", "you", "am i") would otherwise
|
|
980
|
+
* cut the bot off mid-question. Each extra word added typically delays
|
|
981
|
+
* barge-in by ~100-200ms (one extra STT partial cycle) — cheap compared
|
|
982
|
+
* to losing the bot's response.
|
|
983
|
+
*
|
|
984
|
+
* Word splitting is whitespace-based. Punctuation is left attached.
|
|
985
|
+
*/
|
|
986
|
+
bargeInMinPartialWords?: number;
|
|
987
|
+
/**
|
|
988
|
+
* When true, a pure listening cue ("mm-hm", "yeah", "right", "got it") spoken
|
|
989
|
+
* WHILE the assistant is talking does NOT barge-in — the assistant keeps going
|
|
990
|
+
* and the cue is dropped so it never becomes the caller's next turn. A bare
|
|
991
|
+
* "yeah" said AFTER the assistant finishes is a normal answer, unaffected.
|
|
992
|
+
* Default false (any in-speech words interrupt, the prior behavior).
|
|
993
|
+
*/
|
|
994
|
+
backchannelBargeInGuard?: boolean;
|
|
995
|
+
fillerPhrases?: ReadonlyArray<string>;
|
|
996
|
+
/** Milliseconds after turn-commit before the filler fires. Default 250ms — short enough to feel instant, long enough to skip if the LLM is very fast. */
|
|
997
|
+
fillerDelayMs?: number;
|
|
998
|
+
/**
|
|
999
|
+
* Latency Theater — content-aware filler (Boardy parity move). When
|
|
1000
|
+
* defined, the runtime calls `fillerFor({ userText, ... })` in parallel
|
|
1001
|
+
* with the main LLM call to generate a brief acknowledgement of what the
|
|
1002
|
+
* caller just said ("Freelance CFOs — interesting.", "Yeah, I hear you.").
|
|
1003
|
+
* The runtime races the promise against `fillerForTimeoutMs` (default
|
|
1004
|
+
* 600ms). If `fillerFor` returns a non-empty string in time, it's spoken
|
|
1005
|
+
* INSTEAD of a random `fillerPhrases` entry. On timeout or null return,
|
|
1006
|
+
* the runtime falls back to a static random phrase, so a slow / failed
|
|
1007
|
+
* acknowledgement call never costs you the filler entirely.
|
|
1008
|
+
*
|
|
1009
|
+
* Return `null` (or an empty string) to explicitly skip filler for this
|
|
1010
|
+
* turn — useful when `userText` is so short ("yes", "no", "okay") that
|
|
1011
|
+
* acknowledging it back sounds robotic. Return throws are caught and
|
|
1012
|
+
* treated as null.
|
|
1013
|
+
*
|
|
1014
|
+
* Cost-aware: callers typically wire this to a cheap nano/haiku model
|
|
1015
|
+
* (gpt-4.1-nano, claude-haiku-4-5) that returns 2–5 words.
|
|
1016
|
+
*/
|
|
1017
|
+
fillerFor?: (input: {
|
|
1018
|
+
sessionId: string;
|
|
1019
|
+
turnId: string;
|
|
1020
|
+
userText: string;
|
|
1021
|
+
}) => Promise<string | null>;
|
|
1022
|
+
/** Ceiling for the `fillerFor` call before we fall back to a static phrase. Default 600ms. */
|
|
1023
|
+
fillerForTimeoutMs?: number;
|
|
1024
|
+
/**
|
|
1025
|
+
* Backchannel cues — short "mm-hm"/"right" acknowledgements played while the
|
|
1026
|
+
* CALLER is mid-turn (a long answer) so they feel heard, the way a human
|
|
1027
|
+
* listener interjects. Plays on the same non-turn TTS path as fillers, so it
|
|
1028
|
+
* never registers as the assistant's turn or trips barge-in. Off unless
|
|
1029
|
+
* `enabled` is set. Fires only while the assistant is silent.
|
|
1030
|
+
*/
|
|
1031
|
+
backchannel?: import("./backchannel").VoiceBackchannelConfig;
|
|
1032
|
+
/**
|
|
1033
|
+
* Default spoken ack if the model returns ONLY tool calls (no text) and the
|
|
1034
|
+
* turn isn't ending. Without this, the caller hears total silence after
|
|
1035
|
+
* their turn and assumes the line dropped. Default is "Sorry, one moment."
|
|
1036
|
+
* Set to "" to opt out entirely.
|
|
1037
|
+
*/
|
|
1038
|
+
defaultSilentTurnAck?: string;
|
|
1039
|
+
/**
|
|
1040
|
+
* Hard timeout on a single `route.onTurn` call. If onTurn hasn't resolved
|
|
1041
|
+
* in this many ms, it's rejected with a hard-timeout error which falls
|
|
1042
|
+
* through to defaultSilentTurnAck. Default 45s — generous for normal
|
|
1043
|
+
* conversational LLM calls (1-3s typical), but catches hangs where the
|
|
1044
|
+
* model adapter's own timeout doesn't fire. Set to 0 to disable.
|
|
1045
|
+
*/
|
|
1046
|
+
routeOnTurnTimeoutMs?: number;
|
|
1047
|
+
assistantMode?: import("./assistantMode").VoiceAssistantMode;
|
|
1048
|
+
modalities?: ReadonlyArray<"audio" | "text">;
|
|
1049
|
+
prosody?: VoiceTTSProsody;
|
|
1050
|
+
reconnect: Required<VoiceReconnectConfig>;
|
|
1051
|
+
phraseHints?: VoicePhraseHint[];
|
|
1052
|
+
sessionMetadata?: Record<string, unknown>;
|
|
1053
|
+
scenarioId?: string;
|
|
1054
|
+
sttLifecycle: VoiceSTTLifecycle;
|
|
1055
|
+
turnDetection: VoiceResolvedTurnDetectionConfig;
|
|
1056
|
+
audioConditioning?: VoiceResolvedAudioConditioningConfig;
|
|
1057
|
+
noiseSuppressor?: VoiceNoiseSuppressor;
|
|
1058
|
+
noiseSuppressorFormat?: AudioFormat;
|
|
1059
|
+
handoff?: VoiceHandoffConfig<TContext, TSession, TResult>;
|
|
1060
|
+
liveOps?: VoiceLiveOpsRuntimeConfig;
|
|
1061
|
+
route: VoiceNormalizedRouteConfig<TContext, TSession, TResult>;
|
|
1062
|
+
logger?: VoiceLogger;
|
|
1063
|
+
};
|
|
1064
|
+
export type CreateVoiceSession = <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: CreateVoiceSessionOptions<TContext, TSession, TResult>) => VoiceSessionHandle<TContext, TSession, TResult>;
|
|
1065
|
+
export type VoiceClientStartMessage = {
|
|
1066
|
+
type: "start";
|
|
1067
|
+
sessionId?: string;
|
|
1068
|
+
scenarioId?: string;
|
|
1069
|
+
};
|
|
1070
|
+
export type VoiceClientEndTurnMessage = {
|
|
1071
|
+
type: "end_turn";
|
|
1072
|
+
};
|
|
1073
|
+
export type VoiceClientCloseMessage = {
|
|
1074
|
+
type: "close";
|
|
1075
|
+
reason?: string;
|
|
1076
|
+
};
|
|
1077
|
+
export type VoiceClientCallControlMessage = {
|
|
1078
|
+
type: "call_control";
|
|
1079
|
+
action: "complete" | "escalate" | "no-answer" | "transfer" | "voicemail";
|
|
1080
|
+
metadata?: Record<string, unknown>;
|
|
1081
|
+
reason?: string;
|
|
1082
|
+
target?: string;
|
|
1083
|
+
};
|
|
1084
|
+
export type VoiceClientPingMessage = {
|
|
1085
|
+
type: "ping";
|
|
1086
|
+
};
|
|
1087
|
+
export type VoiceClientMessage = VoiceClientStartMessage | VoiceClientEndTurnMessage | VoiceClientCloseMessage | VoiceClientCallControlMessage | VoiceClientPingMessage;
|
|
1088
|
+
export type VoiceServerSessionMessage = {
|
|
1089
|
+
type: "session";
|
|
1090
|
+
sessionId: string;
|
|
1091
|
+
status: VoiceSessionStatus;
|
|
1092
|
+
scenarioId?: string;
|
|
1093
|
+
sessionMetadata?: Record<string, unknown>;
|
|
1094
|
+
};
|
|
1095
|
+
export type VoiceServerReplayMessage<TResult = unknown> = {
|
|
1096
|
+
type: "replay";
|
|
1097
|
+
assistantTexts: string[];
|
|
1098
|
+
call?: VoiceCallLifecycleState;
|
|
1099
|
+
partial: string;
|
|
1100
|
+
scenarioId?: string;
|
|
1101
|
+
sessionId: string;
|
|
1102
|
+
sessionMetadata?: Record<string, unknown>;
|
|
1103
|
+
status: VoiceSessionStatus;
|
|
1104
|
+
turns: VoiceTurnRecord<TResult>[];
|
|
1105
|
+
};
|
|
1106
|
+
export type VoiceServerPartialMessage = {
|
|
1107
|
+
type: "partial";
|
|
1108
|
+
transcript: Transcript;
|
|
1109
|
+
};
|
|
1110
|
+
export type VoiceServerFinalMessage = {
|
|
1111
|
+
type: "final";
|
|
1112
|
+
transcript: Transcript;
|
|
1113
|
+
};
|
|
1114
|
+
export type VoiceServerTurnMessage<TResult = unknown> = {
|
|
1115
|
+
type: "turn";
|
|
1116
|
+
turn: VoiceTurnRecord<TResult>;
|
|
1117
|
+
};
|
|
1118
|
+
export type VoiceServerAssistantMessage = {
|
|
1119
|
+
type: "assistant";
|
|
1120
|
+
text: string;
|
|
1121
|
+
turnId?: string;
|
|
1122
|
+
};
|
|
1123
|
+
export type VoiceServerAssistantDeltaMessage = {
|
|
1124
|
+
type: "assistant_delta";
|
|
1125
|
+
delta: string;
|
|
1126
|
+
turnId?: string;
|
|
1127
|
+
};
|
|
1128
|
+
export type VoiceServerAudioMessage = {
|
|
1129
|
+
type: "audio";
|
|
1130
|
+
chunkBase64: string;
|
|
1131
|
+
format: AudioFormat;
|
|
1132
|
+
receivedAt: number;
|
|
1133
|
+
turnId?: string;
|
|
1134
|
+
};
|
|
1135
|
+
export type VoiceServerCompleteMessage = {
|
|
1136
|
+
type: "complete";
|
|
1137
|
+
sessionId: string;
|
|
1138
|
+
};
|
|
1139
|
+
export type VoiceServerCallLifecycleMessage = {
|
|
1140
|
+
type: "call_lifecycle";
|
|
1141
|
+
event: VoiceCallLifecycleEvent;
|
|
1142
|
+
sessionId: string;
|
|
1143
|
+
};
|
|
1144
|
+
export type VoiceServerErrorMessage = {
|
|
1145
|
+
type: "error";
|
|
1146
|
+
message: string;
|
|
1147
|
+
recoverable?: boolean;
|
|
1148
|
+
};
|
|
1149
|
+
export type VoiceServerPongMessage = {
|
|
1150
|
+
type: "pong";
|
|
1151
|
+
};
|
|
1152
|
+
export type VoiceServerConnectionMessage = {
|
|
1153
|
+
type: "connection";
|
|
1154
|
+
reconnect: VoiceReconnectClientState;
|
|
1155
|
+
};
|
|
1156
|
+
export type VoiceServerMessage<TResult = unknown> = VoiceServerSessionMessage | VoiceServerReplayMessage<TResult> | VoiceServerPartialMessage | VoiceServerFinalMessage | VoiceServerTurnMessage<TResult> | VoiceServerAssistantMessage | VoiceServerAssistantDeltaMessage | VoiceServerAudioMessage | VoiceServerCallLifecycleMessage | VoiceServerCompleteMessage | VoiceServerErrorMessage | VoiceServerPongMessage | VoiceServerConnectionMessage;
|
|
1157
|
+
export type VoiceConnectionOptions = {
|
|
1158
|
+
browserMedia?: false | VoiceBrowserMediaReporterOptions;
|
|
1159
|
+
protocols?: string[];
|
|
1160
|
+
scenarioId?: string;
|
|
1161
|
+
reconnect?: boolean;
|
|
1162
|
+
reconnectReportPath?: string;
|
|
1163
|
+
maxReconnectAttempts?: number;
|
|
1164
|
+
/** Cap on the exponential reconnect backoff (ms). The delay doubles from 500ms
|
|
1165
|
+
* up to this ceiling each attempt, so the total retry window is roughly
|
|
1166
|
+
* maxReconnectAttempts spread across it. Default 8000 — with the default 15
|
|
1167
|
+
* attempts that's a ~95s window, enough to ride out a server redeploy without
|
|
1168
|
+
* the caller losing the call. */
|
|
1169
|
+
reconnectMaxDelayMs?: number;
|
|
1170
|
+
pingInterval?: number;
|
|
1171
|
+
sessionId?: string;
|
|
1172
|
+
};
|
|
1173
|
+
export type VoiceBrowserMediaReportPayload = {
|
|
1174
|
+
at: number;
|
|
1175
|
+
continuity?: MediaWebRTCStreamContinuityReport;
|
|
1176
|
+
report: MediaWebRTCStatsReport;
|
|
1177
|
+
scenarioId?: string | null;
|
|
1178
|
+
sessionId?: string | null;
|
|
1179
|
+
};
|
|
1180
|
+
export type VoiceBrowserMediaReporterOptions = Omit<MediaWebRTCStatsReportInput, "peerConnection"> & {
|
|
1181
|
+
fetch?: typeof fetch;
|
|
1182
|
+
getPeerConnection?: (() => MediaWebRTCStatsCollector | null | undefined) | (() => Promise<MediaWebRTCStatsCollector | null | undefined>);
|
|
1183
|
+
getScenarioId?: () => string | null | undefined;
|
|
1184
|
+
getSessionId?: () => string | null | undefined;
|
|
1185
|
+
intervalMs?: number;
|
|
1186
|
+
continuity?: false | Omit<MediaWebRTCStreamContinuityInput, "previousStats" | "stats">;
|
|
1187
|
+
onError?: (error: unknown) => void;
|
|
1188
|
+
onReport?: (payload: VoiceBrowserMediaReportPayload) => void;
|
|
1189
|
+
path?: string;
|
|
1190
|
+
peerConnection?: MediaWebRTCStatsCollector;
|
|
1191
|
+
};
|
|
1192
|
+
export type VoiceCaptureOptions = {
|
|
1193
|
+
channelCount?: 1 | 2;
|
|
1194
|
+
onAudio?: (audio: Uint8Array | ArrayBuffer, sendAudio: (audio: Uint8Array | ArrayBuffer) => void) => void;
|
|
1195
|
+
onLevel?: (level: number) => void;
|
|
1196
|
+
sampleRateHz?: number;
|
|
1197
|
+
/**
|
|
1198
|
+
* A pre-acquired microphone MediaStream. When set, capture uses it instead of
|
|
1199
|
+
* calling getUserMedia — so a host that requested permission UP FRONT (before
|
|
1200
|
+
* connecting, so the prompt can't interrupt the assistant's greeting) can hand
|
|
1201
|
+
* the SAME stream in rather than release-and-reacquire (a second getUserMedia
|
|
1202
|
+
* + a track stop can trigger an audio-device change that suspends playback and
|
|
1203
|
+
* cuts the greeting). Capture owns it after handoff and stops it on close.
|
|
1204
|
+
*/
|
|
1205
|
+
stream?: MediaStream;
|
|
1206
|
+
};
|
|
1207
|
+
export type VoiceControllerOptions = {
|
|
1208
|
+
preset?: VoiceRuntimePreset;
|
|
1209
|
+
connection?: VoiceConnectionOptions;
|
|
1210
|
+
capture?: VoiceCaptureOptions;
|
|
1211
|
+
autoStopOnComplete?: boolean;
|
|
1212
|
+
};
|
|
1213
|
+
export type VoiceBargeInOptions = {
|
|
1214
|
+
enabled?: boolean;
|
|
1215
|
+
interruptOnPartial?: boolean;
|
|
1216
|
+
interruptThreshold?: number;
|
|
1217
|
+
monitor?: VoiceBargeInMonitor;
|
|
1218
|
+
};
|
|
1219
|
+
export type VoiceBargeInTriggerReason = "input-level" | "manual-audio" | "manual-interrupt" | "partial-transcript";
|
|
1220
|
+
export type VoiceBargeInMonitorEvent = {
|
|
1221
|
+
at: number;
|
|
1222
|
+
id: string;
|
|
1223
|
+
latencyMs?: number;
|
|
1224
|
+
playbackStopLatencyMs?: number;
|
|
1225
|
+
reason: VoiceBargeInTriggerReason;
|
|
1226
|
+
sessionId?: string | null;
|
|
1227
|
+
status: "requested" | "stopped" | "skipped";
|
|
1228
|
+
thresholdMs?: number;
|
|
1229
|
+
};
|
|
1230
|
+
export type VoiceBargeInMonitorSnapshot = {
|
|
1231
|
+
averageLatencyMs?: number;
|
|
1232
|
+
events: VoiceBargeInMonitorEvent[];
|
|
1233
|
+
failed: number;
|
|
1234
|
+
lastEvent?: VoiceBargeInMonitorEvent;
|
|
1235
|
+
passed: number;
|
|
1236
|
+
status: "empty" | "fail" | "pass" | "warn";
|
|
1237
|
+
thresholdMs: number;
|
|
1238
|
+
total: number;
|
|
1239
|
+
};
|
|
1240
|
+
export type VoiceBargeInMonitor = {
|
|
1241
|
+
getSnapshot: () => VoiceBargeInMonitorSnapshot;
|
|
1242
|
+
recordRequested: (input: {
|
|
1243
|
+
reason: VoiceBargeInTriggerReason;
|
|
1244
|
+
sessionId?: string | null;
|
|
1245
|
+
}) => VoiceBargeInMonitorEvent;
|
|
1246
|
+
recordSkipped: (input: {
|
|
1247
|
+
reason: VoiceBargeInTriggerReason;
|
|
1248
|
+
sessionId?: string | null;
|
|
1249
|
+
}) => VoiceBargeInMonitorEvent;
|
|
1250
|
+
recordStopped: (input: {
|
|
1251
|
+
latencyMs?: number;
|
|
1252
|
+
playbackStopLatencyMs?: number;
|
|
1253
|
+
reason: VoiceBargeInTriggerReason;
|
|
1254
|
+
sessionId?: string | null;
|
|
1255
|
+
}) => VoiceBargeInMonitorEvent;
|
|
1256
|
+
subscribe: (subscriber: () => void) => () => void;
|
|
1257
|
+
};
|
|
1258
|
+
export type VoiceAudioPlayerOptions = {
|
|
1259
|
+
autoStart?: boolean;
|
|
1260
|
+
createAudioContext?: () => AudioContext;
|
|
1261
|
+
lookaheadMs?: number;
|
|
1262
|
+
/**
|
|
1263
|
+
* Playback speed multiplier for the assistant's speech. 1 = normal. Clamped
|
|
1264
|
+
* to [0.5, 2]. Pitch shifts with the rate (Web Audio playbackRate), so keep
|
|
1265
|
+
* UI ranges modest (≈0.85–1.25) to stay natural. Can be changed live via
|
|
1266
|
+
* setPlaybackRate — already-scheduled chunks keep their rate; new chunks
|
|
1267
|
+
* adopt the new one.
|
|
1268
|
+
*/
|
|
1269
|
+
playbackRate?: number;
|
|
1270
|
+
volume?: number;
|
|
1271
|
+
};
|
|
1272
|
+
export type VoiceDuplexControllerOptions = VoiceControllerOptions & {
|
|
1273
|
+
audioPlayer?: VoiceAudioPlayerOptions;
|
|
1274
|
+
bargeIn?: VoiceBargeInOptions;
|
|
1275
|
+
};
|
|
1276
|
+
export type VoiceSTTRoutingGoal = "best" | "low-cost";
|
|
1277
|
+
export type VoiceSTTRoutingCorrectionMode = "generic" | "none" | "risky-turn";
|
|
1278
|
+
export type VoiceSTTRoutingStrategy = {
|
|
1279
|
+
benchmarkSessionTarget: "deepgram-corrected" | "deepgram-flux";
|
|
1280
|
+
correctionMode: VoiceSTTRoutingCorrectionMode;
|
|
1281
|
+
goal: VoiceSTTRoutingGoal;
|
|
1282
|
+
notes: string[];
|
|
1283
|
+
preset: VoiceRuntimePreset;
|
|
1284
|
+
sttLifecycle: VoiceSTTLifecycle;
|
|
1285
|
+
};
|
|
1286
|
+
export type VoiceHTMXRenderInput<TResult = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
|
|
1287
|
+
assistantTexts: string[];
|
|
1288
|
+
partial: string;
|
|
1289
|
+
scenarioId?: string;
|
|
1290
|
+
result?: TResult;
|
|
1291
|
+
session?: TSession;
|
|
1292
|
+
sessionId?: string;
|
|
1293
|
+
status: VoiceSessionStatus | "idle";
|
|
1294
|
+
turnCount: number;
|
|
1295
|
+
turns: VoiceTurnRecord<TResult>[];
|
|
1296
|
+
};
|
|
1297
|
+
export type VoiceHTMXRenderConfig<TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
|
|
1298
|
+
metrics?: (input: VoiceHTMXRenderInput<TResult, TSession>) => string;
|
|
1299
|
+
status?: (input: VoiceHTMXRenderInput<TResult, TSession>) => string;
|
|
1300
|
+
turns?: (input: VoiceHTMXRenderInput<TResult, TSession>) => string;
|
|
1301
|
+
assistant?: (input: VoiceHTMXRenderInput<TResult, TSession>) => string;
|
|
1302
|
+
result?: (input: VoiceHTMXRenderInput<TResult, TSession>) => string;
|
|
1303
|
+
emptyState?: (kind: keyof VoiceHTMXTargets, input: VoiceHTMXRenderInput<TResult, TSession>) => string;
|
|
1304
|
+
};
|
|
1305
|
+
export type VoiceHTMXRenderer<TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = (input: VoiceHTMXRenderInput<TResult, TSession>) => string;
|
|
1306
|
+
export type VoiceHTMXTargets = {
|
|
1307
|
+
assistant: string;
|
|
1308
|
+
metrics: string;
|
|
1309
|
+
result: string;
|
|
1310
|
+
status: string;
|
|
1311
|
+
turns: string;
|
|
1312
|
+
};
|
|
1313
|
+
export type VoiceHTMXOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = VoiceHTMXRenderConfig<TSession, TResult> & {
|
|
1314
|
+
bootstrapRoute?: string;
|
|
1315
|
+
route?: string;
|
|
1316
|
+
targets?: Partial<VoiceHTMXTargets>;
|
|
1317
|
+
};
|
|
1318
|
+
export type VoiceHTMXConfig<TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = VoiceHTMXRenderer<TSession, TResult> | VoiceHTMXOptions<TSession, TResult>;
|
|
1319
|
+
export type VoiceStreamState<TResult = unknown> = {
|
|
1320
|
+
call: VoiceCallLifecycleState | null;
|
|
1321
|
+
sessionMetadata: Record<string, unknown> | null;
|
|
1322
|
+
sessionId: string | null;
|
|
1323
|
+
scenarioId: string | null;
|
|
1324
|
+
status: VoiceSessionStatus | "idle";
|
|
1325
|
+
reconnect: VoiceReconnectClientState;
|
|
1326
|
+
partial: string;
|
|
1327
|
+
turns: VoiceTurnRecord<TResult>[];
|
|
1328
|
+
assistantTexts: string[];
|
|
1329
|
+
assistantStreamingText: string;
|
|
1330
|
+
assistantAudio: Array<{
|
|
1331
|
+
chunk: Uint8Array;
|
|
1332
|
+
format: AudioFormat;
|
|
1333
|
+
receivedAt: number;
|
|
1334
|
+
turnId?: string;
|
|
1335
|
+
}>;
|
|
1336
|
+
error: string | null;
|
|
1337
|
+
isConnected: boolean;
|
|
1338
|
+
};
|
|
1339
|
+
export type VoiceStream<TResult = unknown> = {
|
|
1340
|
+
call: VoiceCallLifecycleState | null;
|
|
1341
|
+
callControl: (message: Omit<VoiceClientCallControlMessage, "type">) => void;
|
|
1342
|
+
close: () => void;
|
|
1343
|
+
start: (input?: {
|
|
1344
|
+
scenarioId?: string;
|
|
1345
|
+
sessionId?: string;
|
|
1346
|
+
}) => Promise<void>;
|
|
1347
|
+
endTurn: () => void;
|
|
1348
|
+
error: string | null;
|
|
1349
|
+
getServerSnapshot: () => VoiceStreamState<TResult>;
|
|
1350
|
+
getSnapshot: () => VoiceStreamState<TResult>;
|
|
1351
|
+
isConnected: boolean;
|
|
1352
|
+
partial: string;
|
|
1353
|
+
reconnect: VoiceReconnectClientState;
|
|
1354
|
+
sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
|
|
1355
|
+
simulateDisconnect: () => void;
|
|
1356
|
+
sessionId: string | null;
|
|
1357
|
+
sessionMetadata: Record<string, unknown> | null;
|
|
1358
|
+
scenarioId: string | null;
|
|
1359
|
+
status: VoiceSessionStatus | "idle";
|
|
1360
|
+
subscribe: (subscriber: () => void) => () => void;
|
|
1361
|
+
turns: VoiceTurnRecord<TResult>[];
|
|
1362
|
+
assistantTexts: string[];
|
|
1363
|
+
assistantStreamingText: string;
|
|
1364
|
+
assistantAudio: Array<{
|
|
1365
|
+
chunk: Uint8Array;
|
|
1366
|
+
format: AudioFormat;
|
|
1367
|
+
receivedAt: number;
|
|
1368
|
+
turnId?: string;
|
|
1369
|
+
}>;
|
|
1370
|
+
};
|
|
1371
|
+
export type VoiceControllerState<TResult = unknown> = VoiceStreamState<TResult> & {
|
|
1372
|
+
isRecording: boolean;
|
|
1373
|
+
recordingError: string | null;
|
|
1374
|
+
};
|
|
1375
|
+
export type VoiceAudioPlayerState = {
|
|
1376
|
+
activeSourceCount: number;
|
|
1377
|
+
error: string | null;
|
|
1378
|
+
isActive: boolean;
|
|
1379
|
+
isPlaying: boolean;
|
|
1380
|
+
lastInterruptLatencyMs?: number;
|
|
1381
|
+
lastPlaybackStopLatencyMs?: number;
|
|
1382
|
+
processedChunkCount: number;
|
|
1383
|
+
queuedChunkCount: number;
|
|
1384
|
+
};
|
|
1385
|
+
export type VoiceAudioPlayerSource = {
|
|
1386
|
+
assistantAudio: VoiceStreamState["assistantAudio"];
|
|
1387
|
+
subscribe: (subscriber: () => void) => () => void;
|
|
1388
|
+
};
|
|
1389
|
+
export type VoiceAudioPlayer = {
|
|
1390
|
+
close: () => Promise<void>;
|
|
1391
|
+
error: string | null;
|
|
1392
|
+
/** Instantaneous RMS amplitude (0..1) of the assistant's audio output — for
|
|
1393
|
+
* driving a visualizer from the actual voice. 0 when idle / no analyser. */
|
|
1394
|
+
getOutputLevel: () => number;
|
|
1395
|
+
getSnapshot: () => VoiceAudioPlayerState;
|
|
1396
|
+
activeSourceCount: number;
|
|
1397
|
+
isActive: boolean;
|
|
1398
|
+
isPlaying: boolean;
|
|
1399
|
+
interrupt: () => Promise<void>;
|
|
1400
|
+
lastInterruptLatencyMs?: number;
|
|
1401
|
+
lastPlaybackStopLatencyMs?: number;
|
|
1402
|
+
pause: () => Promise<void>;
|
|
1403
|
+
playbackRate: number;
|
|
1404
|
+
processedChunkCount: number;
|
|
1405
|
+
queuedChunkCount: number;
|
|
1406
|
+
setPlaybackRate: (rate: number) => void;
|
|
1407
|
+
setVolume: (volume: number) => void;
|
|
1408
|
+
start: () => Promise<void>;
|
|
1409
|
+
subscribe: (subscriber: () => void) => () => void;
|
|
1410
|
+
volume: number;
|
|
1411
|
+
};
|
|
1412
|
+
export type VoiceBargeInBinding = {
|
|
1413
|
+
close: () => void;
|
|
1414
|
+
handleLevel: (level: number) => void;
|
|
1415
|
+
sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
|
|
1416
|
+
};
|
|
1417
|
+
export type VoiceController<TResult = unknown> = {
|
|
1418
|
+
bindHTMX: (options: VoiceHTMXBindingOptions) => () => void;
|
|
1419
|
+
call: VoiceCallLifecycleState | null;
|
|
1420
|
+
callControl: (message: Omit<VoiceClientCallControlMessage, "type">) => void;
|
|
1421
|
+
close: () => void;
|
|
1422
|
+
endTurn: () => void;
|
|
1423
|
+
start: (input?: {
|
|
1424
|
+
scenarioId?: string;
|
|
1425
|
+
sessionId?: string;
|
|
1426
|
+
}) => Promise<void>;
|
|
1427
|
+
error: string | null;
|
|
1428
|
+
getServerSnapshot: () => VoiceControllerState<TResult>;
|
|
1429
|
+
getSnapshot: () => VoiceControllerState<TResult>;
|
|
1430
|
+
isConnected: boolean;
|
|
1431
|
+
isRecording: boolean;
|
|
1432
|
+
partial: string;
|
|
1433
|
+
reconnect: VoiceReconnectClientState;
|
|
1434
|
+
recordingError: string | null;
|
|
1435
|
+
sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
|
|
1436
|
+
simulateDisconnect: () => void;
|
|
1437
|
+
sessionId: string | null;
|
|
1438
|
+
sessionMetadata: Record<string, unknown> | null;
|
|
1439
|
+
scenarioId: string | null;
|
|
1440
|
+
startRecording: () => Promise<void>;
|
|
1441
|
+
status: VoiceSessionStatus | "idle";
|
|
1442
|
+
stopRecording: () => void;
|
|
1443
|
+
subscribe: (subscriber: () => void) => () => void;
|
|
1444
|
+
toggleRecording: () => Promise<void>;
|
|
1445
|
+
turns: VoiceTurnRecord<TResult>[];
|
|
1446
|
+
assistantTexts: string[];
|
|
1447
|
+
assistantStreamingText: string;
|
|
1448
|
+
assistantAudio: Array<{
|
|
1449
|
+
chunk: Uint8Array;
|
|
1450
|
+
format: AudioFormat;
|
|
1451
|
+
receivedAt: number;
|
|
1452
|
+
turnId?: string;
|
|
1453
|
+
}>;
|
|
1454
|
+
};
|
|
1455
|
+
export type VoiceDuplexController<TResult = unknown> = VoiceController<TResult> & {
|
|
1456
|
+
audioPlayer: VoiceAudioPlayer;
|
|
1457
|
+
interruptAssistant: () => Promise<void>;
|
|
1458
|
+
};
|
|
1459
|
+
export type VoiceHTMXBindingOptions = {
|
|
1460
|
+
element: Element | string;
|
|
1461
|
+
eventName?: string;
|
|
1462
|
+
route?: string;
|
|
1463
|
+
sessionQueryParam?: string;
|
|
1464
|
+
};
|
|
1465
|
+
export type VoiceStoreAction<TResult = unknown> = {
|
|
1466
|
+
type: "session";
|
|
1467
|
+
sessionId: string;
|
|
1468
|
+
sessionMetadata?: Record<string, unknown>;
|
|
1469
|
+
scenarioId?: string;
|
|
1470
|
+
status: VoiceSessionStatus;
|
|
1471
|
+
} | {
|
|
1472
|
+
type: "replay";
|
|
1473
|
+
assistantTexts: string[];
|
|
1474
|
+
call?: VoiceCallLifecycleState;
|
|
1475
|
+
partial: string;
|
|
1476
|
+
scenarioId?: string;
|
|
1477
|
+
sessionId: string;
|
|
1478
|
+
sessionMetadata?: Record<string, unknown>;
|
|
1479
|
+
status: VoiceSessionStatus;
|
|
1480
|
+
turns: VoiceTurnRecord<TResult>[];
|
|
1481
|
+
} | {
|
|
1482
|
+
type: "call_lifecycle";
|
|
1483
|
+
event: VoiceCallLifecycleEvent;
|
|
1484
|
+
sessionId: string;
|
|
1485
|
+
} | {
|
|
1486
|
+
type: "partial";
|
|
1487
|
+
transcript: Transcript;
|
|
1488
|
+
} | {
|
|
1489
|
+
type: "final";
|
|
1490
|
+
transcript: Transcript;
|
|
1491
|
+
} | {
|
|
1492
|
+
type: "turn";
|
|
1493
|
+
turn: VoiceTurnRecord<TResult>;
|
|
1494
|
+
} | {
|
|
1495
|
+
type: "assistant";
|
|
1496
|
+
text: string;
|
|
1497
|
+
turnId?: string;
|
|
1498
|
+
} | {
|
|
1499
|
+
type: "assistant_delta";
|
|
1500
|
+
delta: string;
|
|
1501
|
+
turnId?: string;
|
|
1502
|
+
} | {
|
|
1503
|
+
type: "audio";
|
|
1504
|
+
chunk: Uint8Array;
|
|
1505
|
+
format: AudioFormat;
|
|
1506
|
+
receivedAt: number;
|
|
1507
|
+
turnId?: string;
|
|
1508
|
+
} | {
|
|
1509
|
+
type: "complete";
|
|
1510
|
+
sessionId: string;
|
|
1511
|
+
} | {
|
|
1512
|
+
type: "error";
|
|
1513
|
+
message: string;
|
|
1514
|
+
} | {
|
|
1515
|
+
type: "connected";
|
|
1516
|
+
} | {
|
|
1517
|
+
type: "connection";
|
|
1518
|
+
reconnect: VoiceReconnectClientState;
|
|
1519
|
+
} | {
|
|
1520
|
+
type: "disconnected";
|
|
1521
|
+
};
|