@absolutejs/voice 0.0.22-beta.530 → 0.0.22-beta.532
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/index.js +4 -4
- package/dist/angular/voice-call-debugger.service.d.ts +1 -1
- package/dist/angular/voice-campaign-dialer-proof.service.d.ts +1 -1
- package/dist/angular/voice-controller.service.d.ts +1 -1
- package/dist/angular/voice-cost-dashboard.service.d.ts +1 -1
- package/dist/angular/voice-delivery-runtime.service.d.ts +1 -1
- package/dist/angular/voice-ops-status.service.d.ts +1 -1
- package/dist/angular/voice-platform-coverage.service.d.ts +1 -1
- package/dist/angular/voice-profile-comparison.service.d.ts +1 -1
- package/dist/angular/voice-proof-trends.service.d.ts +1 -1
- package/dist/angular/voice-provider-capabilities.service.d.ts +1 -1
- package/dist/angular/voice-provider-contracts.service.d.ts +1 -1
- package/dist/angular/voice-provider-status.service.d.ts +1 -1
- package/dist/angular/voice-readiness-failures.service.d.ts +1 -1
- package/dist/angular/voice-reconnect-profile-evidence.service.d.ts +1 -1
- package/dist/angular/voice-session-observability.service.d.ts +1 -1
- package/dist/angular/voice-session-snapshot.service.d.ts +1 -1
- package/dist/angular/voice-stream.service.d.ts +1 -1
- package/dist/angular/voice-trace-timeline.service.d.ts +1 -1
- package/dist/angular/voice-turn-latency.service.d.ts +1 -1
- package/dist/angular/voice-turn-quality.service.d.ts +1 -1
- package/dist/angular/voice-widget.service.d.ts +1 -1
- package/dist/angular/voice-workflow-status.service.d.ts +1 -1
- package/dist/client/actions.d.ts +1 -1
- package/dist/client/agentSquadStatus.d.ts +1 -1
- package/dist/client/audioPlayer.d.ts +1 -1
- package/dist/client/bargeInMonitor.d.ts +1 -1
- package/dist/client/browserMedia.d.ts +1 -1
- package/dist/client/callDebugger.d.ts +1 -1
- package/dist/client/callPlayer.d.ts +1 -1
- package/dist/client/campaignDialerProof.d.ts +1 -1
- package/dist/client/connection.d.ts +1 -1
- package/dist/client/controller.d.ts +1 -1
- package/dist/client/conversationAnalytics.d.ts +1 -1
- package/dist/client/costDashboard.d.ts +1 -1
- package/dist/client/createVoiceStream.d.ts +1 -1
- package/dist/client/deliveryRuntime.d.ts +1 -1
- package/dist/client/duplex.d.ts +1 -1
- package/dist/client/htmx.d.ts +1 -1
- package/dist/client/htmxBootstrap.js +3 -3
- package/dist/client/htmxDashboardRenderers.d.ts +1 -1
- package/dist/client/index.js +25 -29
- package/dist/client/liveAgentConsole.d.ts +1 -1
- package/dist/client/liveCallViewer.d.ts +1 -1
- package/dist/client/liveOps.d.ts +1 -1
- package/dist/client/liveOpsWidget.d.ts +1 -1
- package/dist/client/liveTurnLatency.d.ts +1 -1
- package/dist/client/microphone.d.ts +1 -1
- package/dist/client/opsActionHistory.d.ts +1 -1
- package/dist/client/opsStatus.d.ts +1 -1
- package/dist/client/opsStatusWidget.d.ts +1 -1
- package/dist/client/platformCoverage.d.ts +1 -1
- package/dist/client/platformCoverageWidget.d.ts +1 -1
- package/dist/client/profileComparison.d.ts +1 -1
- package/dist/client/profileSwitchRecommendation.d.ts +1 -1
- package/dist/client/proofTrends.d.ts +1 -1
- package/dist/client/proofTrendsWidget.d.ts +1 -1
- package/dist/client/providerCapabilities.d.ts +1 -1
- package/dist/client/providerCapabilitiesWidget.d.ts +1 -1
- package/dist/client/providerContracts.d.ts +1 -1
- package/dist/client/providerContractsWidget.d.ts +1 -1
- package/dist/client/providerStatus.d.ts +1 -1
- package/dist/client/providerStatusWidget.d.ts +1 -1
- package/dist/client/readinessFailures.d.ts +1 -1
- package/dist/client/readinessFailuresWidget.d.ts +1 -1
- package/dist/client/reconnectProfileEvidence.d.ts +1 -1
- package/dist/client/routingStatus.d.ts +1 -1
- package/dist/client/routingStatusWidget.d.ts +1 -1
- package/dist/client/sessionObservability.d.ts +1 -1
- package/dist/client/sessionObservabilityWidget.d.ts +1 -1
- package/dist/client/sessionSnapshot.d.ts +1 -1
- package/dist/client/store.d.ts +1 -1
- package/dist/client/traceTimeline.d.ts +1 -1
- package/dist/client/traceTimelineWidget.d.ts +1 -1
- package/dist/client/turnLatency.d.ts +1 -1
- package/dist/client/turnLatencyWidget.d.ts +1 -1
- package/dist/client/turnQuality.d.ts +1 -1
- package/dist/client/turnQualityWidget.d.ts +1 -1
- package/dist/client/voiceWidgetView.d.ts +2 -2
- package/dist/client/workflowStatus.d.ts +1 -1
- package/dist/{dataControl.d.ts → core/dataControl.d.ts} +1 -1
- package/dist/{fileStore.d.ts → core/fileStore.d.ts} +1 -1
- package/dist/{htmxDashboardRoutes.d.ts → core/htmxDashboardRoutes.d.ts} +4 -4
- package/dist/{multilingualProof.d.ts → core/multilingualProof.d.ts} +2 -2
- package/dist/{operationsRecord.d.ts → core/operationsRecord.d.ts} +1 -1
- package/dist/{ops.d.ts → core/ops.d.ts} +1 -1
- package/dist/{outcomeContract.d.ts → core/outcomeContract.d.ts} +1 -1
- package/dist/{phoneAgent.d.ts → core/phoneAgent.d.ts} +5 -5
- package/dist/{phoneAgentProductionSmoke.d.ts → core/phoneAgentProductionSmoke.d.ts} +1 -1
- package/dist/{postCallAnalysis.d.ts → core/postCallAnalysis.d.ts} +1 -1
- package/dist/{postgresStore.d.ts → core/postgresStore.d.ts} +1 -1
- package/dist/{productionReadiness.d.ts → core/productionReadiness.d.ts} +2 -2
- package/dist/{resilienceRoutes.d.ts → core/resilienceRoutes.d.ts} +1 -1
- package/dist/{runtimeOps.d.ts → core/runtimeOps.d.ts} +1 -1
- package/dist/{s3Store.d.ts → core/s3Store.d.ts} +1 -1
- package/dist/{sqliteStore.d.ts → core/sqliteStore.d.ts} +1 -1
- package/dist/{types.d.ts → core/types.d.ts} +3 -3
- package/dist/embed/index.d.ts +1 -1
- package/dist/embed/index.js +4 -4
- package/dist/embed/voice-widget.js +1 -1
- package/dist/index.d.ts +339 -339
- package/dist/index.js +232 -324
- package/dist/internal/evidence.d.ts +10 -0
- package/dist/internal/status.d.ts +0 -2
- package/dist/react/VoiceCallPlayer.d.ts +1 -1
- package/dist/react/VoiceWidget.d.ts +1 -1
- package/dist/react/index.js +21 -17
- package/dist/react/useVoiceController.d.ts +1 -1
- package/dist/react/useVoiceStream.d.ts +1 -1
- package/dist/svelte/createVoiceStream.d.ts +1 -1
- package/dist/svelte/createVoiceWidget.d.ts +1 -1
- package/dist/svelte/index.js +18 -18
- package/dist/telephony/plivo.d.ts +3 -3
- package/dist/telephony/security.d.ts +3 -3
- package/dist/telephony/telnyx.d.ts +3 -3
- package/dist/telephony/twilio.d.ts +2 -2
- package/dist/testing/accuracy.d.ts +1 -1
- package/dist/testing/benchmark.d.ts +1 -1
- package/dist/testing/corrected.d.ts +1 -1
- package/dist/testing/duplex.d.ts +1 -1
- package/dist/testing/fixtures.d.ts +1 -1
- package/dist/testing/index.js +33 -29
- package/dist/testing/ioProviderSimulator.d.ts +1 -1
- package/dist/testing/providerSimulator.d.ts +3 -3
- package/dist/testing/review.d.ts +1 -1
- package/dist/testing/sessionBenchmark.d.ts +1 -1
- package/dist/testing/stt.d.ts +1 -1
- package/dist/testing/telephony.d.ts +2 -2
- package/dist/testing/tts.d.ts +1 -1
- package/dist/vue/VoiceCallPlayer.d.ts +1 -1
- package/dist/vue/VoiceCostDashboard.d.ts +1 -1
- package/dist/vue/VoiceWidget.d.ts +1 -1
- package/dist/vue/index.js +21 -17
- package/dist/vue/useVoiceCallDebugger.d.ts +1 -1
- package/dist/vue/useVoiceCampaignDialerProof.d.ts +1 -1
- package/dist/vue/useVoiceController.d.ts +1 -1
- package/dist/vue/useVoiceDeliveryRuntime.d.ts +1 -1
- package/dist/vue/useVoiceOpsStatus.d.ts +1 -1
- package/dist/vue/useVoicePlatformCoverage.d.ts +1 -1
- package/dist/vue/useVoiceProfileComparison.d.ts +1 -1
- package/dist/vue/useVoiceProofTrends.d.ts +1 -1
- package/dist/vue/useVoiceProviderCapabilities.d.ts +1 -1
- package/dist/vue/useVoiceProviderContracts.d.ts +1 -1
- package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
- package/dist/vue/useVoiceReadinessFailures.d.ts +1 -1
- package/dist/vue/useVoiceReconnectProfileEvidence.d.ts +1 -1
- package/dist/vue/useVoiceSessionObservability.d.ts +1 -1
- package/dist/vue/useVoiceSessionSnapshot.d.ts +1 -1
- package/dist/vue/useVoiceStream.d.ts +1 -1
- package/dist/vue/useVoiceTraceTimeline.d.ts +1 -1
- package/dist/vue/useVoiceTurnLatency.d.ts +1 -1
- package/dist/vue/useVoiceTurnQuality.d.ts +1 -1
- package/dist/vue/useVoiceWorkflowStatus.d.ts +1 -1
- package/package.json +3 -1
- /package/dist/{agent.d.ts → core/agent.d.ts} +0 -0
- /package/dist/{agentPerformanceReport.d.ts → core/agentPerformanceReport.d.ts} +0 -0
- /package/dist/{agentSquadContract.d.ts → core/agentSquadContract.d.ts} +0 -0
- /package/dist/{agentState.d.ts → core/agentState.d.ts} +0 -0
- /package/dist/{agentTools.d.ts → core/agentTools.d.ts} +0 -0
- /package/dist/{aiScorecard.d.ts → core/aiScorecard.d.ts} +0 -0
- /package/dist/{aiVoiceModel.d.ts → core/aiVoiceModel.d.ts} +0 -0
- /package/dist/{amdDetector.d.ts → core/amdDetector.d.ts} +0 -0
- /package/dist/{assistant.d.ts → core/assistant.d.ts} +0 -0
- /package/dist/{assistantExperiment.d.ts → core/assistantExperiment.d.ts} +0 -0
- /package/dist/{assistantHealth.d.ts → core/assistantHealth.d.ts} +0 -0
- /package/dist/{assistantMemory.d.ts → core/assistantMemory.d.ts} +0 -0
- /package/dist/{assistantMode.d.ts → core/assistantMode.d.ts} +0 -0
- /package/dist/{audioConditioning.d.ts → core/audioConditioning.d.ts} +0 -0
- /package/dist/{audit.d.ts → core/audit.d.ts} +0 -0
- /package/dist/{auditDeliveryRoutes.d.ts → core/auditDeliveryRoutes.d.ts} +0 -0
- /package/dist/{auditExport.d.ts → core/auditExport.d.ts} +0 -0
- /package/dist/{auditRoutes.d.ts → core/auditRoutes.d.ts} +0 -0
- /package/dist/{auditSinks.d.ts → core/auditSinks.d.ts} +0 -0
- /package/dist/{backchannel.d.ts → core/backchannel.d.ts} +0 -0
- /package/dist/{bargeInRoutes.d.ts → core/bargeInRoutes.d.ts} +0 -0
- /package/dist/{bookingFlow.d.ts → core/bookingFlow.d.ts} +0 -0
- /package/dist/{browserCallProfiles.d.ts → core/browserCallProfiles.d.ts} +0 -0
- /package/dist/{browserMediaRoutes.d.ts → core/browserMediaRoutes.d.ts} +0 -0
- /package/dist/{calendarAdapter.d.ts → core/calendarAdapter.d.ts} +0 -0
- /package/dist/{calendarSlots.d.ts → core/calendarSlots.d.ts} +0 -0
- /package/dist/{callDebugger.d.ts → core/callDebugger.d.ts} +0 -0
- /package/dist/{callDisposition.d.ts → core/callDisposition.d.ts} +0 -0
- /package/dist/{callQuota.d.ts → core/callQuota.d.ts} +0 -0
- /package/dist/{callScorecard.d.ts → core/callScorecard.d.ts} +0 -0
- /package/dist/{callerCRMLinker.d.ts → core/callerCRMLinker.d.ts} +0 -0
- /package/dist/{callerMemory.d.ts → core/callerMemory.d.ts} +0 -0
- /package/dist/{callingWindow.d.ts → core/callingWindow.d.ts} +0 -0
- /package/dist/{campaign.d.ts → core/campaign.d.ts} +0 -0
- /package/dist/{campaignControls.d.ts → core/campaignControls.d.ts} +0 -0
- /package/dist/{campaignDialers.d.ts → core/campaignDialers.d.ts} +0 -0
- /package/dist/{campaignTemplate.d.ts → core/campaignTemplate.d.ts} +0 -0
- /package/dist/{competitiveCoverage.d.ts → core/competitiveCoverage.d.ts} +0 -0
- /package/dist/{conversationSimulator.d.ts → core/conversationSimulator.d.ts} +0 -0
- /package/dist/{correction.d.ts → core/correction.d.ts} +0 -0
- /package/dist/{costAccounting.d.ts → core/costAccounting.d.ts} +0 -0
- /package/dist/{costPredictor.d.ts → core/costPredictor.d.ts} +0 -0
- /package/dist/{crmCallLogger.d.ts → core/crmCallLogger.d.ts} +0 -0
- /package/dist/{crmContract.d.ts → core/crmContract.d.ts} +0 -0
- /package/dist/{defineVoiceAssistant.d.ts → core/defineVoiceAssistant.d.ts} +0 -0
- /package/dist/{deliveryRuntime.d.ts → core/deliveryRuntime.d.ts} +0 -0
- /package/dist/{deliverySinkRoutes.d.ts → core/deliverySinkRoutes.d.ts} +0 -0
- /package/dist/{demoReadyRoutes.d.ts → core/demoReadyRoutes.d.ts} +0 -0
- /package/dist/{diagnosticsRoutes.d.ts → core/diagnosticsRoutes.d.ts} +0 -0
- /package/dist/{dncRegistry.d.ts → core/dncRegistry.d.ts} +0 -0
- /package/dist/{dtmfCollector.d.ts → core/dtmfCollector.d.ts} +0 -0
- /package/dist/{evalRoutes.d.ts → core/evalRoutes.d.ts} +0 -0
- /package/dist/{guardrails.d.ts → core/guardrails.d.ts} +0 -0
- /package/dist/{handoff.d.ts → core/handoff.d.ts} +0 -0
- /package/dist/{handoffHealth.d.ts → core/handoffHealth.d.ts} +0 -0
- /package/dist/{holdAudio.d.ts → core/holdAudio.d.ts} +0 -0
- /package/dist/{htmx.d.ts → core/htmx.d.ts} +0 -0
- /package/dist/{iceServers.d.ts → core/iceServers.d.ts} +0 -0
- /package/dist/{incidentBundle.d.ts → core/incidentBundle.d.ts} +0 -0
- /package/dist/{incidentTimeline.d.ts → core/incidentTimeline.d.ts} +0 -0
- /package/dist/{ivrPlan.d.ts → core/ivrPlan.d.ts} +0 -0
- /package/dist/{latencySlo.d.ts → core/latencySlo.d.ts} +0 -0
- /package/dist/{liveCoach.d.ts → core/liveCoach.d.ts} +0 -0
- /package/dist/{liveLatency.d.ts → core/liveLatency.d.ts} +0 -0
- /package/dist/{liveOps.d.ts → core/liveOps.d.ts} +0 -0
- /package/dist/{llmJudge.d.ts → core/llmJudge.d.ts} +0 -0
- /package/dist/{logger.d.ts → core/logger.d.ts} +0 -0
- /package/dist/{mcpToolset.d.ts → core/mcpToolset.d.ts} +0 -0
- /package/dist/{mediaPipelineRoutes.d.ts → core/mediaPipelineRoutes.d.ts} +0 -0
- /package/dist/{mediaPipelineSurfaces.d.ts → core/mediaPipelineSurfaces.d.ts} +0 -0
- /package/dist/{memoryStore.d.ts → core/memoryStore.d.ts} +0 -0
- /package/dist/{midCallSummary.d.ts → core/midCallSummary.d.ts} +0 -0
- /package/dist/{modelAdapters.d.ts → core/modelAdapters.d.ts} +0 -0
- /package/dist/{monitor.d.ts → core/monitor.d.ts} +0 -0
- /package/dist/{noShowPredictor.d.ts → core/noShowPredictor.d.ts} +0 -0
- /package/dist/{oauth2TokenSource.d.ts → core/oauth2TokenSource.d.ts} +0 -0
- /package/dist/{observabilityExport.d.ts → core/observabilityExport.d.ts} +0 -0
- /package/dist/{openaiTTS.d.ts → core/openaiTTS.d.ts} +0 -0
- /package/dist/{operationalStatus.d.ts → core/operationalStatus.d.ts} +0 -0
- /package/dist/{opsActionAuditRoutes.d.ts → core/opsActionAuditRoutes.d.ts} +0 -0
- /package/dist/{opsConsoleRoutes.d.ts → core/opsConsoleRoutes.d.ts} +0 -0
- /package/dist/{opsPresets.d.ts → core/opsPresets.d.ts} +0 -0
- /package/dist/{opsRecovery.d.ts → core/opsRecovery.d.ts} +0 -0
- /package/dist/{opsRuntime.d.ts → core/opsRuntime.d.ts} +0 -0
- /package/dist/{opsSinks.d.ts → core/opsSinks.d.ts} +0 -0
- /package/dist/{opsStatus.d.ts → core/opsStatus.d.ts} +0 -0
- /package/dist/{opsStatusRoutes.d.ts → core/opsStatusRoutes.d.ts} +0 -0
- /package/dist/{opsWebhook.d.ts → core/opsWebhook.d.ts} +0 -0
- /package/dist/{otelExporter.d.ts → core/otelExporter.d.ts} +0 -0
- /package/dist/{outcomeRecipes.d.ts → core/outcomeRecipes.d.ts} +0 -0
- /package/dist/{pathway.d.ts → core/pathway.d.ts} +0 -0
- /package/dist/{pathwayCompiler.d.ts → core/pathwayCompiler.d.ts} +0 -0
- /package/dist/{pathwayGenerator.d.ts → core/pathwayGenerator.d.ts} +0 -0
- /package/dist/{pathwayRuntime.d.ts → core/pathwayRuntime.d.ts} +0 -0
- /package/dist/{pathwaySlotCollector.d.ts → core/pathwaySlotCollector.d.ts} +0 -0
- /package/dist/{pathwayVisualizer.d.ts → core/pathwayVisualizer.d.ts} +0 -0
- /package/dist/{phoneProvisioning.d.ts → core/phoneProvisioning.d.ts} +0 -0
- /package/dist/{platformCoverage.d.ts → core/platformCoverage.d.ts} +0 -0
- /package/dist/{plugin.d.ts → core/plugin.d.ts} +0 -0
- /package/dist/{postCallSurvey.d.ts → core/postCallSurvey.d.ts} +0 -0
- /package/dist/{presets.d.ts → core/presets.d.ts} +0 -0
- /package/dist/{profileSwitchRecommendation.d.ts → core/profileSwitchRecommendation.d.ts} +0 -0
- /package/dist/{promptInjectionGuard.d.ts → core/promptInjectionGuard.d.ts} +0 -0
- /package/dist/{proofAssertions.d.ts → core/proofAssertions.d.ts} +0 -0
- /package/dist/{proofPack.d.ts → core/proofPack.d.ts} +0 -0
- /package/dist/{proofRunner.d.ts → core/proofRunner.d.ts} +0 -0
- /package/dist/{proofTrends.d.ts → core/proofTrends.d.ts} +0 -0
- /package/dist/{providerAdapters.d.ts → core/providerAdapters.d.ts} +0 -0
- /package/dist/{providerCapabilities.d.ts → core/providerCapabilities.d.ts} +0 -0
- /package/dist/{providerDecisionTraces.d.ts → core/providerDecisionTraces.d.ts} +0 -0
- /package/dist/{providerHealth.d.ts → core/providerHealth.d.ts} +0 -0
- /package/dist/{providerOrchestration.d.ts → core/providerOrchestration.d.ts} +0 -0
- /package/dist/{providerRouterTraces.d.ts → core/providerRouterTraces.d.ts} +0 -0
- /package/dist/{providerRoutingContract.d.ts → core/providerRoutingContract.d.ts} +0 -0
- /package/dist/{providerSlo.d.ts → core/providerSlo.d.ts} +0 -0
- /package/dist/{providerStackRecommendations.d.ts → core/providerStackRecommendations.d.ts} +0 -0
- /package/dist/{qualityDriftDetector.d.ts → core/qualityDriftDetector.d.ts} +0 -0
- /package/dist/{qualityRoutes.d.ts → core/qualityRoutes.d.ts} +0 -0
- /package/dist/{queue.d.ts → core/queue.d.ts} +0 -0
- /package/dist/{ragTool.d.ts → core/ragTool.d.ts} +0 -0
- /package/dist/{readinessProfiles.d.ts → core/readinessProfiles.d.ts} +0 -0
- /package/dist/{realtimeChannel.d.ts → core/realtimeChannel.d.ts} +0 -0
- /package/dist/{realtimeProviderContracts.d.ts → core/realtimeProviderContracts.d.ts} +0 -0
- /package/dist/{reconnectContract.d.ts → core/reconnectContract.d.ts} +0 -0
- /package/dist/{recordingRedaction.d.ts → core/recordingRedaction.d.ts} +0 -0
- /package/dist/{recordingStore.d.ts → core/recordingStore.d.ts} +0 -0
- /package/dist/{redaction.d.ts → core/redaction.d.ts} +0 -0
- /package/dist/{reminderScheduler.d.ts → core/reminderScheduler.d.ts} +0 -0
- /package/dist/{retention.d.ts → core/retention.d.ts} +0 -0
- /package/dist/{retryPolicy.d.ts → core/retryPolicy.d.ts} +0 -0
- /package/dist/{routeAuth.d.ts → core/routeAuth.d.ts} +0 -0
- /package/dist/{routing.d.ts → core/routing.d.ts} +0 -0
- /package/dist/{scorecardCalibration.d.ts → core/scorecardCalibration.d.ts} +0 -0
- /package/dist/{semanticTurn.d.ts → core/semanticTurn.d.ts} +0 -0
- /package/dist/{session.d.ts → core/session.d.ts} +0 -0
- /package/dist/{sessionObservability.d.ts → core/sessionObservability.d.ts} +0 -0
- /package/dist/{sessionReplay.d.ts → core/sessionReplay.d.ts} +0 -0
- /package/dist/{sessionSnapshot.d.ts → core/sessionSnapshot.d.ts} +0 -0
- /package/dist/{simulationSuite.d.ts → core/simulationSuite.d.ts} +0 -0
- /package/dist/{sloCalibration.d.ts → core/sloCalibration.d.ts} +0 -0
- /package/dist/{store.d.ts → core/store.d.ts} +0 -0
- /package/dist/{supervisorPermissions.d.ts → core/supervisorPermissions.d.ts} +0 -0
- /package/dist/{supervisorPresence.d.ts → core/supervisorPresence.d.ts} +0 -0
- /package/dist/{telephonyMediaRoutes.d.ts → core/telephonyMediaRoutes.d.ts} +0 -0
- /package/dist/{telephonyOutcome.d.ts → core/telephonyOutcome.d.ts} +0 -0
- /package/dist/{toolContract.d.ts → core/toolContract.d.ts} +0 -0
- /package/dist/{toolRuntime.d.ts → core/toolRuntime.d.ts} +0 -0
- /package/dist/{trace.d.ts → core/trace.d.ts} +0 -0
- /package/dist/{traceDeliveryRoutes.d.ts → core/traceDeliveryRoutes.d.ts} +0 -0
- /package/dist/{traceTimeline.d.ts → core/traceTimeline.d.ts} +0 -0
- /package/dist/{transcriptAnnotator.d.ts → core/transcriptAnnotator.d.ts} +0 -0
- /package/dist/{turnDetection.d.ts → core/turnDetection.d.ts} +0 -0
- /package/dist/{turnLatency.d.ts → core/turnLatency.d.ts} +0 -0
- /package/dist/{turnProfiles.d.ts → core/turnProfiles.d.ts} +0 -0
- /package/dist/{turnQuality.d.ts → core/turnQuality.d.ts} +0 -0
- /package/dist/{vapiAdapter.d.ts → core/vapiAdapter.d.ts} +0 -0
- /package/dist/{variableAnalytics.d.ts → core/variableAnalytics.d.ts} +0 -0
- /package/dist/{voiceConfiguration.d.ts → core/voiceConfiguration.d.ts} +0 -0
- /package/dist/{voiceMonitoring.d.ts → core/voiceMonitoring.d.ts} +0 -0
- /package/dist/{webhookFanout.d.ts → core/webhookFanout.d.ts} +0 -0
- /package/dist/{webhookVerification.d.ts → core/webhookVerification.d.ts} +0 -0
- /package/dist/{whisperChannel.d.ts → core/whisperChannel.d.ts} +0 -0
- /package/dist/{workflowContract.d.ts → core/workflowContract.d.ts} +0 -0
- /package/dist/{zeroDataRetention.d.ts → core/zeroDataRetention.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VoiceProofTrendReport } from "../proofTrends";
|
|
1
|
+
import { type VoiceProofTrendReport } from "../core/proofTrends";
|
|
2
2
|
import { type VoiceProofTrendsClientOptions, type VoiceProofTrendsSnapshot } from "./proofTrends";
|
|
3
3
|
export type VoiceProofTrendsMetricView = {
|
|
4
4
|
label: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceProviderCapabilitySummary } from "../providerCapabilities";
|
|
1
|
+
import type { VoiceProviderCapabilitySummary } from "../core/providerCapabilities";
|
|
2
2
|
import { type VoiceProviderCapabilitiesClientOptions, type VoiceProviderCapabilitiesSnapshot } from "./providerCapabilities";
|
|
3
3
|
export type VoiceProviderCapabilityCardView<TProvider extends string = string> = VoiceProviderCapabilitySummary<TProvider> & {
|
|
4
4
|
detail: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceProviderContractMatrixReport } from "../providerStackRecommendations";
|
|
1
|
+
import type { VoiceProviderContractMatrixReport } from "../core/providerStackRecommendations";
|
|
2
2
|
export type VoiceProviderContractsClientOptions = {
|
|
3
3
|
fetch?: typeof fetch;
|
|
4
4
|
intervalMs?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceProviderContractMatrixRow } from "../providerStackRecommendations";
|
|
1
|
+
import type { VoiceProviderContractMatrixRow } from "../core/providerStackRecommendations";
|
|
2
2
|
import { type VoiceProviderContractsClientOptions, type VoiceProviderContractsSnapshot } from "./providerContracts";
|
|
3
3
|
export type VoiceProviderContractRowView<TProvider extends string = string> = VoiceProviderContractMatrixRow<TProvider> & {
|
|
4
4
|
detail: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceProviderHealthSummary } from "../providerHealth";
|
|
1
|
+
import type { VoiceProviderHealthSummary } from "../core/providerHealth";
|
|
2
2
|
import { type VoiceProviderStatusClientOptions, type VoiceProviderStatusSnapshot } from "./providerStatus";
|
|
3
3
|
export type VoiceProviderStatusCardView<TProvider extends string = string> = VoiceProviderHealthSummary<TProvider> & {
|
|
4
4
|
detail: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceProductionReadinessCheck } from "../productionReadiness";
|
|
1
|
+
import type { VoiceProductionReadinessCheck } from "../core/productionReadiness";
|
|
2
2
|
import { type VoiceReadinessFailuresClientOptions, type VoiceReadinessFailuresSnapshot } from "./readinessFailures";
|
|
3
3
|
export type VoiceReadinessFailureView = {
|
|
4
4
|
evidenceHref?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceRoutingDecisionSummary } from "../resilienceRoutes";
|
|
1
|
+
import type { VoiceRoutingDecisionSummary } from "../core/resilienceRoutes";
|
|
2
2
|
import { type VoiceRoutingStatusClientOptions, type VoiceRoutingStatusSnapshot } from "./routingStatus";
|
|
3
3
|
export type VoiceRoutingStatusViewModel = {
|
|
4
4
|
activeStack: Array<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceSessionObservabilityLink, VoiceSessionObservabilityTurn } from "../sessionObservability";
|
|
1
|
+
import type { VoiceSessionObservabilityLink, VoiceSessionObservabilityTurn } from "../core/sessionObservability";
|
|
2
2
|
import { type VoiceSessionObservabilityClientOptions, type VoiceSessionObservabilitySnapshot } from "./sessionObservability";
|
|
3
3
|
export type VoiceSessionObservabilityTurnView = VoiceSessionObservabilityTurn & {
|
|
4
4
|
durationLabel: string;
|
package/dist/client/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceStreamState, VoiceStoreAction } from "../types";
|
|
1
|
+
import type { VoiceStreamState, VoiceStoreAction } from "../core/types";
|
|
2
2
|
export declare const createVoiceStreamStore: <TResult = unknown>() => {
|
|
3
3
|
dispatch: (action: VoiceStoreAction<TResult>) => void;
|
|
4
4
|
getServerSnapshot: () => VoiceStreamState<TResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceTraceTimelineSession } from "../traceTimeline";
|
|
1
|
+
import type { VoiceTraceTimelineSession } from "../core/traceTimeline";
|
|
2
2
|
import { type VoiceTraceTimelineClientOptions, type VoiceTraceTimelineSnapshot } from "./traceTimeline";
|
|
3
3
|
export type VoiceTraceTimelineSessionView = VoiceTraceTimelineSession & {
|
|
4
4
|
detailHref: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceTurnLatencyItem } from "../turnLatency";
|
|
1
|
+
import type { VoiceTurnLatencyItem } from "../core/turnLatency";
|
|
2
2
|
import { type VoiceTurnLatencyClientOptions, type VoiceTurnLatencySnapshot } from "./turnLatency";
|
|
3
3
|
export type VoiceTurnLatencyCardView = VoiceTurnLatencyItem & {
|
|
4
4
|
label: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VoiceTurnQualityItem } from "../turnQuality";
|
|
1
|
+
import type { VoiceTurnQualityItem } from "../core/turnQuality";
|
|
2
2
|
import { type VoiceTurnQualityClientOptions, type VoiceTurnQualitySnapshot } from "./turnQuality";
|
|
3
3
|
export type VoiceTurnQualityCardView = VoiceTurnQualityItem & {
|
|
4
4
|
detail: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { VoiceAgentUIState } from "../agentState";
|
|
2
|
-
import type { VoiceControllerState } from "../types";
|
|
1
|
+
import type { VoiceAgentUIState } from "../core/agentState";
|
|
2
|
+
import type { VoiceControllerState } from "../core/types";
|
|
3
3
|
export type VoiceWidgetTheme = {
|
|
4
4
|
accent?: string;
|
|
5
5
|
background?: string;
|
|
@@ -5,7 +5,7 @@ import { exportVoiceAuditTrail } from "./auditExport";
|
|
|
5
5
|
import type { VoiceAuditSinkDeliveryStore } from "./auditSinks";
|
|
6
6
|
import type { VoiceIntegrationEventStore, VoiceOpsTaskStore } from "./ops";
|
|
7
7
|
import type { VoiceIncidentBundleStore } from "./incidentBundle";
|
|
8
|
-
import type { VoiceCallReviewStore } from "
|
|
8
|
+
import type { VoiceCallReviewStore } from "../testing/review";
|
|
9
9
|
import type { VoiceTraceEventStore, VoiceTracePruneFilter, VoiceTraceSinkDeliveryStore } from "./trace";
|
|
10
10
|
import type { VoiceSessionStore } from "./types";
|
|
11
11
|
export declare const voiceComplianceRedactionDefaults: {
|
|
@@ -5,7 +5,7 @@ import { type VoiceAssistantMemoryRecord, type VoiceAssistantMemoryStore } from
|
|
|
5
5
|
import type { StoredVoiceIncidentBundleArtifact, VoiceIncidentBundleStore } from "./incidentBundle";
|
|
6
6
|
import { type StoredVoiceTraceEvent, type VoiceTraceSinkDeliveryRecord, type VoiceTraceSinkDeliveryStore, type VoiceTraceEventStore } from "./trace";
|
|
7
7
|
import type { StoredVoiceIntegrationEvent, StoredVoiceExternalObjectMap, StoredVoiceOpsTask, VoiceExternalObjectMap, VoiceExternalObjectMapStore, VoiceIntegrationEvent, VoiceIntegrationEventStore, VoiceOpsTask, VoiceOpsTaskStore } from "./ops";
|
|
8
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from "
|
|
8
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
9
9
|
import type { VoiceSessionRecord, VoiceSessionStore } from "./types";
|
|
10
10
|
import type { VoiceRecordingStore } from "./recordingStore";
|
|
11
11
|
export type VoiceFileStoreOptions = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Elysia } from "elysia";
|
|
2
2
|
import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from "./trace";
|
|
3
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "
|
|
4
|
-
import type { LiveCallViewer } from "
|
|
5
|
-
import { type VoiceDashboardHTMXRendererConfig } from "
|
|
6
|
-
import type { VoiceCostDashboardOptions } from "
|
|
3
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
4
|
+
import type { LiveCallViewer } from "../client/liveCallViewer";
|
|
5
|
+
import { type VoiceDashboardHTMXRendererConfig } from "../client/htmxDashboardRenderers";
|
|
6
|
+
import type { VoiceCostDashboardOptions } from "../client/costDashboard";
|
|
7
7
|
export type VoiceHTMXDashboardRoutesShared = {
|
|
8
8
|
name?: string;
|
|
9
9
|
render?: VoiceDashboardHTMXRendererConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { STTAdapter } from "./types";
|
|
2
|
-
import { type VoiceTestFixture } from "
|
|
3
|
-
import { type VoiceSTTBenchmarkOptions, type VoiceSTTBenchmarkReport } from "
|
|
2
|
+
import { type VoiceTestFixture } from "../testing/fixtures";
|
|
3
|
+
import { type VoiceSTTBenchmarkOptions, type VoiceSTTBenchmarkReport } from "../testing/benchmark";
|
|
4
4
|
export type VoiceMultilingualLanguageCode = string;
|
|
5
5
|
export type VoiceMultilingualProofLanguageThresholds = {
|
|
6
6
|
label?: string;
|
|
@@ -4,7 +4,7 @@ import { type StoredVoiceAuditEvent, type VoiceAuditEventStore } from "./audit";
|
|
|
4
4
|
import type { VoiceMediaPipelineReport } from "./mediaPipelineRoutes";
|
|
5
5
|
import type { StoredVoiceIntegrationEvent, StoredVoiceOpsTask, VoiceIntegrationEventStore, VoiceOpsTaskStore } from "./ops";
|
|
6
6
|
import { type VoiceSessionReplay } from "./sessionReplay";
|
|
7
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "
|
|
7
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
8
8
|
import { type VoiceTraceTimelineEvent, type VoiceTraceTimelineProviderSummary } from "./traceTimeline";
|
|
9
9
|
import { type StoredVoiceTraceEvent, type VoiceTraceEvaluationOptions, type VoiceTraceEventStore, type VoiceTraceRedactionConfig, type VoiceTraceSummary } from "./trace";
|
|
10
10
|
export type VoiceOperationsRecordStatus = "failed" | "healthy" | "warning";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VoiceCallDisposition, VoiceSessionRecord, VoiceSessionSummary } from "./types";
|
|
2
|
-
import type { StoredVoiceCallReviewArtifact } from "
|
|
2
|
+
import type { StoredVoiceCallReviewArtifact } from "../testing/review";
|
|
3
3
|
export type VoiceOpsTaskStatus = "open" | "in-progress" | "done";
|
|
4
4
|
export type VoiceOpsTaskKind = "appointment-booking" | "callback" | "escalation" | "lead-qualification" | "transfer-check" | "retry-review" | "support-triage";
|
|
5
5
|
export type VoiceOpsTaskPriority = "low" | "normal" | "high" | "urgent";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Elysia } from "elysia";
|
|
2
2
|
import type { StoredVoiceHandoffDelivery, VoiceCallDisposition, VoiceHandoffAction, VoiceHandoffDeliveryStore, VoiceSessionRecord, VoiceSessionStore } from "./types";
|
|
3
3
|
import type { StoredVoiceIntegrationEvent, StoredVoiceOpsTask, VoiceIntegrationEventType } from "./ops";
|
|
4
|
-
import type { StoredVoiceCallReviewArtifact } from "
|
|
4
|
+
import type { StoredVoiceCallReviewArtifact } from "../testing/review";
|
|
5
5
|
export type VoiceOutcomeContractStatus = "pass" | "fail";
|
|
6
6
|
export type VoiceOutcomeContractDefinition = {
|
|
7
7
|
description?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Elysia } from "elysia";
|
|
2
|
-
import { type PlivoVoiceRoutesOptions } from "
|
|
3
|
-
import { type TelnyxVoiceRoutesOptions } from "
|
|
4
|
-
import { type TwilioVoiceRoutesOptions } from "
|
|
5
|
-
import { type VoiceTelephonyCarrierMatrix, type VoiceTelephonyCarrierMatrixRoutesOptions } from "
|
|
2
|
+
import { type PlivoVoiceRoutesOptions } from "../telephony/plivo";
|
|
3
|
+
import { type TelnyxVoiceRoutesOptions } from "../telephony/telnyx";
|
|
4
|
+
import { type TwilioVoiceRoutesOptions } from "../telephony/twilio";
|
|
5
|
+
import { type VoiceTelephonyCarrierMatrix, type VoiceTelephonyCarrierMatrixRoutesOptions } from "../telephony/matrix";
|
|
6
6
|
import { type VoicePhoneAgentProductionSmokeRoutesOptions } from "./phoneAgentProductionSmoke";
|
|
7
7
|
import { type VoiceCampaignDialerProofAssertionReport, type VoiceCampaignDialerProofProvider, type VoiceCampaignDialerProofReport } from "./campaignDialers";
|
|
8
|
-
import type { VoiceTelephonyProvider } from "
|
|
8
|
+
import type { VoiceTelephonyProvider } from "../telephony/contract";
|
|
9
9
|
import type { VoicePhoneAgentProductionSmokeReport } from "./phoneAgentProductionSmoke";
|
|
10
10
|
import type { VoiceSessionRecord } from "./types";
|
|
11
11
|
export type VoicePhoneAgentLifecycleStage = "ringing" | "answered" | "media-started" | "transcript" | "assistant-response" | "transfer" | "voicemail" | "no-answer" | "completed" | "failed";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from "elysia";
|
|
2
2
|
import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from "./trace";
|
|
3
|
-
import type { VoiceTelephonyContractReport, VoiceTelephonyProvider } from "
|
|
3
|
+
import type { VoiceTelephonyContractReport, VoiceTelephonyProvider } from "../telephony/contract";
|
|
4
4
|
export type VoicePhoneAgentProductionSmokeRequirement = "assistant-response" | "carrier-contract" | "fresh-trace" | "lifecycle-outcome" | "media-started" | "no-session-error" | "transcript";
|
|
5
5
|
export type VoicePhoneAgentProductionSmokeIssue = {
|
|
6
6
|
message: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from "elysia";
|
|
2
2
|
import type { StoredVoiceIntegrationEvent, StoredVoiceOpsTask, VoiceIntegrationEventStore, VoiceOpsTaskKind, VoiceOpsTaskStore } from "./ops";
|
|
3
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "
|
|
3
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
4
4
|
export type VoicePostCallAnalysisStatus = "fail" | "pass" | "warn";
|
|
5
5
|
export type VoicePostCallAnalysisFieldRequirement = {
|
|
6
6
|
label?: string;
|
|
@@ -2,7 +2,7 @@ import { type StoredVoiceTraceEvent, type VoiceTraceSinkDeliveryRecord, type Voi
|
|
|
2
2
|
import { type StoredVoiceAuditEvent, type VoiceAuditEventStore } from "./audit";
|
|
3
3
|
import type { VoiceAuditSinkDeliveryRecord, VoiceAuditSinkDeliveryStore } from "./auditSinks";
|
|
4
4
|
import type { StoredVoiceIntegrationEvent, StoredVoiceExternalObjectMap, StoredVoiceOpsTask, VoiceExternalObjectMapStore, VoiceIntegrationEventStore, VoiceOpsTaskStore } from "./ops";
|
|
5
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "
|
|
5
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
6
6
|
import type { VoiceTelephonyWebhookIdempotencyStore } from "./telephonyOutcome";
|
|
7
7
|
import type { VoiceCampaignStore } from "./campaign";
|
|
8
8
|
import type { VoiceSessionRecord, VoiceSessionStore } from "./types";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Elysia } from "elysia";
|
|
2
2
|
import { type VoiceProviderFallbackRecoverySummary } from "./sessionReplay";
|
|
3
|
-
import { type VoiceTelephonyCarrierMatrixInput } from "
|
|
4
|
-
import { type VoiceTelephonyWebhookSecurityOptions, type VoiceTelephonyWebhookSecurityReport } from "
|
|
3
|
+
import { type VoiceTelephonyCarrierMatrixInput } from "../telephony/matrix";
|
|
4
|
+
import { type VoiceTelephonyWebhookSecurityOptions, type VoiceTelephonyWebhookSecurityReport } from "../telephony/security";
|
|
5
5
|
import type { VoiceMonitorNotifierDeliveryReport, VoiceMonitorRunReport } from "./voiceMonitoring";
|
|
6
6
|
import { type StoredVoiceTraceEvent, type VoiceTraceEventStore } from "./trace";
|
|
7
7
|
import type { VoiceTraceSinkDeliveryStore } from "./trace";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Elysia } from "elysia";
|
|
2
2
|
import { type VoiceProviderHealthSummary } from "./providerHealth";
|
|
3
3
|
import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from "./trace";
|
|
4
|
-
import type { VoiceIOProviderFailureSimulationMode, VoiceIOProviderFailureSimulationResult } from "
|
|
4
|
+
import type { VoiceIOProviderFailureSimulationMode, VoiceIOProviderFailureSimulationResult } from "../testing/ioProviderSimulator";
|
|
5
5
|
export type VoiceRoutingEventKind = "llm" | "stt" | "tts";
|
|
6
6
|
export type VoiceRoutingEvent = {
|
|
7
7
|
at: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact } from "
|
|
1
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact } from "../testing/review";
|
|
2
2
|
import type { VoiceOpsTask } from "./ops";
|
|
3
3
|
import type { VoiceCallDisposition, VoiceRuntimeOpsConfig, VoiceSessionHandle, VoiceSessionRecord } from "./types";
|
|
4
4
|
export declare const createVoiceCallReviewFromSession: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(input: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { S3Client, S3Options } from "bun";
|
|
2
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "
|
|
2
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
3
3
|
import type { VoiceRecordingStore } from "./recordingStore";
|
|
4
4
|
export type VoiceS3ReviewStoreFile = {
|
|
5
5
|
delete: () => Promise<void>;
|
|
@@ -2,7 +2,7 @@ import { type StoredVoiceTraceEvent, type VoiceTraceSinkDeliveryRecord, type Voi
|
|
|
2
2
|
import { type StoredVoiceAuditEvent, type VoiceAuditEventStore } from "./audit";
|
|
3
3
|
import type { VoiceAuditSinkDeliveryRecord, VoiceAuditSinkDeliveryStore } from "./auditSinks";
|
|
4
4
|
import type { StoredVoiceIntegrationEvent, StoredVoiceExternalObjectMap, StoredVoiceOpsTask, VoiceExternalObjectMapStore, VoiceIntegrationEventStore, VoiceOpsTaskStore } from "./ops";
|
|
5
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "
|
|
5
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
6
6
|
import type { VoiceTelephonyWebhookIdempotencyStore } from "./telephonyOutcome";
|
|
7
7
|
import type { VoiceCampaignStore } from "./campaign";
|
|
8
8
|
import type { VoiceSessionRecord, VoiceSessionStore } from "./types";
|
|
@@ -2,7 +2,7 @@ import type { SessionStore } from "@absolutejs/absolute";
|
|
|
2
2
|
import type { MediaWebRTCStatsCollector, MediaWebRTCStatsReport, MediaWebRTCStatsReportInput, MediaWebRTCStreamContinuityInput, MediaWebRTCStreamContinuityReport } from "@absolutejs/media";
|
|
3
3
|
import type { VoiceOpsDispositionTaskPolicies, VoiceOpsTaskAssignmentRule, VoiceOpsTaskAssignmentRules, VoiceIntegrationWebhookConfig, StoredVoiceIntegrationEvent, StoredVoiceOpsTask, VoiceIntegrationEventStore, VoiceOpsTaskPolicy, VoiceOpsTask, VoiceOpsTaskStore } from "./ops";
|
|
4
4
|
import type { VoiceIntegrationSink } from "./opsSinks";
|
|
5
|
-
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from "
|
|
5
|
+
import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from "../testing/review";
|
|
6
6
|
import type { VoiceTraceEventStore } from "./trace";
|
|
7
7
|
import type { VoiceLiveOpsControlState } from "./liveOps";
|
|
8
8
|
import type { VoiceAuditActor, VoiceAuditEventStore } from "./audit";
|
|
@@ -824,10 +824,10 @@ export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionR
|
|
|
824
824
|
simulationSuite?: VoiceSurfaceConfig<import("./simulationSuite").VoiceSimulationSuiteRoutesOptions>;
|
|
825
825
|
sloCalibration?: VoiceSurfaceConfig<import("./sloCalibration").VoiceSloCalibrationRoutesOptions>;
|
|
826
826
|
sloReadinessThreshold?: VoiceSurfaceConfig<import("./sloCalibration").VoiceSloReadinessThresholdRoutesOptions>;
|
|
827
|
-
telephonyCarrierMatrix?: VoiceSurfaceConfig<import("
|
|
827
|
+
telephonyCarrierMatrix?: VoiceSurfaceConfig<import("../telephony/matrix").VoiceTelephonyCarrierMatrixRoutesOptions>;
|
|
828
828
|
telephonyMedia?: VoiceSurfaceConfig<import("./telephonyMediaRoutes").VoiceTelephonyMediaRoutesOptions>;
|
|
829
829
|
telephonyWebhook?: VoiceSurfaceConfig<import("./telephonyOutcome").VoiceTelephonyWebhookRoutesOptions>;
|
|
830
|
-
telephonyWebhookSecurity?: VoiceSurfaceConfig<import("
|
|
830
|
+
telephonyWebhookSecurity?: VoiceSurfaceConfig<import("../telephony/security").VoiceTelephonyWebhookSecurityRoutesOptions>;
|
|
831
831
|
toolContract?: VoiceSurfaceConfig<import("./toolContract").VoiceToolContractRoutesOptions>;
|
|
832
832
|
traceDelivery?: VoiceSurfaceConfig<import("./traceDeliveryRoutes").VoiceTraceDeliveryRoutesOptions>;
|
|
833
833
|
traceTimeline?: VoiceSurfaceConfig<import("./traceTimeline").VoiceTraceTimelineRoutesOptions>;
|
package/dist/embed/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createVoiceController } from "../client/controller";
|
|
2
2
|
import { type VoiceWidgetLabels, type VoiceWidgetTheme } from "../client/voiceWidgetView";
|
|
3
|
-
import type { VoiceControllerOptions } from "../types";
|
|
3
|
+
import type { VoiceControllerOptions } from "../core/types";
|
|
4
4
|
export type VoiceEmbedMountOptions = {
|
|
5
5
|
/** WebSocket route the voice runtime is mounted at. Defaults to "/voice". */
|
|
6
6
|
path?: string;
|
package/dist/embed/index.js
CHANGED
|
@@ -1032,7 +1032,7 @@ var createVoiceStream = (path, options = {}) => {
|
|
|
1032
1032
|
};
|
|
1033
1033
|
};
|
|
1034
1034
|
|
|
1035
|
-
// src/audioConditioning.ts
|
|
1035
|
+
// src/core/audioConditioning.ts
|
|
1036
1036
|
var DEFAULT_TARGET_LEVEL = 0.08;
|
|
1037
1037
|
var DEFAULT_MAX_GAIN = 3;
|
|
1038
1038
|
var DEFAULT_NOISE_GATE_THRESHOLD = 0.006;
|
|
@@ -1050,7 +1050,7 @@ var resolveAudioConditioningConfig = (config) => {
|
|
|
1050
1050
|
};
|
|
1051
1051
|
};
|
|
1052
1052
|
|
|
1053
|
-
// src/turnProfiles.ts
|
|
1053
|
+
// src/core/turnProfiles.ts
|
|
1054
1054
|
var TURN_PROFILE_DEFAULTS = {
|
|
1055
1055
|
balanced: {
|
|
1056
1056
|
qualityProfile: "general",
|
|
@@ -1105,7 +1105,7 @@ var resolveTurnDetectionConfig = (config) => {
|
|
|
1105
1105
|
};
|
|
1106
1106
|
};
|
|
1107
1107
|
|
|
1108
|
-
// src/presets.ts
|
|
1108
|
+
// src/core/presets.ts
|
|
1109
1109
|
var PRESET_INPUTS = {
|
|
1110
1110
|
chat: {
|
|
1111
1111
|
audioConditioning: {
|
|
@@ -1503,7 +1503,7 @@ var createVoiceController = (path, options = {}) => {
|
|
|
1503
1503
|
// src/internal/html.ts
|
|
1504
1504
|
var escapeHtml = (value) => String(value).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
1505
1505
|
|
|
1506
|
-
// src/agentState.ts
|
|
1506
|
+
// src/core/agentState.ts
|
|
1507
1507
|
var deriveVoiceAgentUIState = (input) => {
|
|
1508
1508
|
if (!input.isConnected) {
|
|
1509
1509
|
return "idle";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var{defineProperty:H,getOwnPropertyNames:oc,getOwnPropertyDescriptor:lc}=Object,Ac=Object.prototype.hasOwnProperty;function Cc(c){return this[c]}var ic=(c)=>{var n=(Y??=new WeakMap).get(c),o;if(n)return n;if(n=H({},"__esModule",{value:!0}),c&&typeof c==="object"||typeof c==="function"){for(var g of oc(c))if(!Ac.call(n,g))H(n,g,{get:Cc.bind(c,g),enumerable:!(o=lc(c,g))||o.enumerable})}return Y.set(c,n),n},Y;var Tc=(c)=>c;function yc(c,n){this[c]=Tc.bind(null,n)}var Vc=(c,n)=>{for(var o in n)H(c,o,{get:n[o],enumerable:!0,configurable:!0,set:yc.bind(n,o)})};var Bc={};Vc(Bc,{mount:()=>p,default:()=>Kc,VOICE_EMBED_VERSION:()=>cc});var Ic=(c)=>{if(typeof c!=="string")return c;return document.querySelector(c)},Rc=(c,n,o,g)=>{let l=n??c.getAttribute("hx-get")??"";if(!l)return"";let i=new URL(l,window.location.origin);if(g)i.searchParams.set(o,g);else i.searchParams.delete(o);return`${i.pathname}${i.search}${i.hash}`},Q=(c,n)=>{if(typeof window>"u"||typeof document>"u")return()=>{};let o=Ic(n.element);if(!o)return()=>{};let g=n.eventName??"voice-refresh",l=n.sessionQueryParam??"sessionId",i=()=>{let V=window,I=Rc(o,n.route,l,c.sessionId);if(I)o.setAttribute("hx-get",I);V.htmx?.process?.(o),V.htmx?.trigger?.(o,g)},C=c.subscribe(i);return i(),()=>{C()}};var hc=(c)=>Math.max(-1,Math.min(1,c)),dc=(c)=>{let n=new Int16Array(c.length);for(let o=0;o<c.length;o+=1){let g=hc(c[o]??0);n[o]=g<0?g*32768:g*32767}return new Uint8Array(n.buffer)},Sc=(c)=>{let n=c instanceof Uint8Array?c:new Uint8Array(c);if(n.byteLength<2)return 0;let o=new Int16Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/2));if(o.length===0)return 0;let g=0;for(let l of o){let i=l/32768;g+=i*i}return Math.min(1,Math.max(0,Math.sqrt(g/o.length)*5.5))},_c=(c,n,o)=>{if(n===o)return c;let g=n/o,l=Math.round(c.length/g),i=new Float32Array(l),C=0,V=0;while(C<i.length){let I=Math.round((C+1)*g),d=0,y=0;for(let h=V;h<I&&h<c.length;h+=1)d+=c[h]??0,y+=1;i[C]=y>0?d/y:0,C+=1,V=I}return i},J=(c)=>{let n=null,o=null,g=null,l=null;return{start:async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getUserMedia)throw Error("Browser microphone capture requires navigator.mediaDevices.getUserMedia.");let V=(typeof window<"u"?window.AudioContext??window.webkitAudioContext:void 0)??AudioContext;if(!V)throw Error("Browser microphone capture requires AudioContext support.");l=await navigator.mediaDevices.getUserMedia({audio:{channelCount:c.channelCount??1}}),n=new V,o=n.createMediaStreamSource(l),g=n.createScriptProcessor(4096,1,1),g.onaudioprocess=(I)=>{let d=I.inputBuffer.getChannelData(0),y=_c(d,n?.sampleRate??48000,c.sampleRateHz??16000),h=dc(y);c.onLevel?.(Sc(h)),c.onAudio(h)},o.connect(g),g.connect(n.destination)},stop:()=>{g?.disconnect(),o?.disconnect(),l?.getTracks().forEach((V)=>V.stop()),n?.close(),c.onLevel?.(0),n=null,l=null,g=null,o=null}}};var G=(c)=>{if(typeof c==="string"&&c.trim())return c;if(c instanceof Error&&c.message.trim())return c.message;if(c&&typeof c==="object"){let n=c;for(let o of["message","reason","description"]){let g=n[o];if(typeof g==="string"&&g.trim())return g}if("error"in n)return G(n.error);if("cause"in n)return G(n.cause);try{return JSON.stringify(c)}catch{}}return"Unexpected error"},q=(c)=>{switch(c.type){case"audio":return{chunk:Uint8Array.from(atob(c.chunkBase64),(n)=>n.charCodeAt(0)),format:c.format,receivedAt:c.receivedAt,turnId:c.turnId,type:"audio"};case"assistant":return{text:c.text,type:"assistant"};case"complete":return{sessionId:c.sessionId,type:"complete"};case"connection":return{reconnect:c.reconnect,type:"connection"};case"call_lifecycle":return{event:c.event,sessionId:c.sessionId,type:"call_lifecycle"};case"error":return{message:G(c.message),type:"error"};case"final":return{transcript:c.transcript,type:"final"};case"partial":return{transcript:c.transcript,type:"partial"};case"replay":return{assistantTexts:c.assistantTexts,call:c.call,partial:c.partial,scenarioId:c.scenarioId,sessionId:c.sessionId,sessionMetadata:c.sessionMetadata,status:c.status,turns:c.turns,type:"replay"};case"session":return{sessionId:c.sessionId,sessionMetadata:c.sessionMetadata,scenarioId:c.scenarioId,status:c.status,type:"session"};case"turn":return{turn:c.turn,type:"turn"};default:return null}};var tc=Math.PI*2;var D=(c,n,o,g)=>{c.push({code:o,message:g,severity:n})};var wc=(c)=>c.length===0?void 0:c.reduce((n,o)=>n+o,0)/c.length,$=(c)=>c.length===0?void 0:Math.max(...c);var _=(c,n)=>{let o=c[n];return typeof o==="number"&&Number.isFinite(o)?o:void 0},N=(c,n)=>{let o=c[n];return typeof o==="boolean"?o:void 0},w=(c,n)=>{let o=c[n];return typeof o==="string"?o:void 0},X=(c)=>String(c.id??w(c,"ssrc")??_(c,"ssrc")??w(c,"trackIdentifier")??w(c,"mid")??"unknown"),Z=(c)=>c===void 0?void 0:c*1000;var Lc=(c)=>{let n={};for(let[o,g]of Object.entries(c))if(g===null||typeof g==="boolean"||typeof g==="number"||typeof g==="string")n[o]=g;return n};var z=(c={})=>{let n=c.stats??[],o=[],g=n.filter((A)=>A.type==="inbound-rtp"&&w(A,"kind")!=="video"),l=n.filter((A)=>A.type==="outbound-rtp"&&w(A,"kind")!=="video"),i=n.filter((A)=>A.type==="candidate-pair"),C=n.filter((A)=>(A.type==="track"||A.type==="media-source")&&w(A,"kind")==="audio"),V=i.filter((A)=>N(A,"selected")===!0||N(A,"nominated")===!0||w(A,"state")==="succeeded").length,I=C.filter((A)=>w(A,"readyState")!=="ended"&&w(A,"trackState")!=="ended"&&N(A,"ended")!==!0).length,d=C.filter((A)=>w(A,"readyState")==="ended"||w(A,"trackState")==="ended"||N(A,"ended")===!0).length,y=g.reduce((A,S)=>A+(_(S,"packetsReceived")??0),0),h=l.reduce((A,S)=>A+(_(S,"packetsSent")??0),0),T=[...g,...l].reduce((A,S)=>A+Math.max(0,_(S,"packetsLost")??0),0),L=y+T,R=L===0?0:T/L,E=g.reduce((A,S)=>A+(_(S,"bytesReceived")??0),0),b=l.reduce((A,S)=>A+(_(S,"bytesSent")??0),0),M=$(i.map((A)=>Z(_(A,"currentRoundTripTime")??_(A,"roundTripTime"))).filter((A)=>A!==void 0)),O=$([...g,...l].map((A)=>Z(_(A,"jitter"))).filter((A)=>A!==void 0)),W=$(g.map((A)=>{let S=_(A,"jitterBufferDelay"),U=_(A,"jitterBufferEmittedCount");return S!==void 0&&U!==void 0&&U>0?S/U*1000:void 0}).filter((A)=>A!==void 0)),P=C.map((A)=>_(A,"audioLevel")).filter((A)=>A!==void 0);if(c.requireConnectedCandidatePair&&i.length>0&&V===0)D(o,"error","media.webrtc_candidate_pair_missing","No active WebRTC candidate pair was observed.");if(c.requireLiveAudioTrack&&I===0)D(o,"error","media.webrtc_audio_track_missing","No live WebRTC audio track was observed.");if(c.maxPacketLossRatio!==void 0&&R>c.maxPacketLossRatio)D(o,"warning","media.webrtc_packet_loss",`Observed WebRTC packet loss ratio ${String(R)} above ${String(c.maxPacketLossRatio)}.`);if(c.maxRoundTripTimeMs!==void 0&&M!==void 0&&M>c.maxRoundTripTimeMs)D(o,"warning","media.webrtc_round_trip_time",`Observed WebRTC RTT ${String(M)}ms above ${String(c.maxRoundTripTimeMs)}ms.`);if(c.maxJitterMs!==void 0&&O!==void 0&&O>c.maxJitterMs)D(o,"warning","media.webrtc_jitter",`Observed WebRTC jitter ${String(O)}ms above ${String(c.maxJitterMs)}ms.`);return{activeCandidatePairs:V,audioLevelAverage:wc(P),bytesReceived:E,bytesSent:b,checkedAt:Date.now(),endedAudioTracks:d,inboundPackets:y,issues:o,jitterBufferDelayMs:W,jitterMs:O,liveAudioTracks:I,outboundPackets:h,packetLossRatio:R,packetsLost:T,roundTripTimeMs:M,status:o.some((A)=>A.severity==="error")?"fail":o.length>0?"warn":"pass",totalStats:n.length}},B=async(c)=>{return[...(await c.peerConnection.getStats(c.selector??null)).values()].map(Lc)};var K=(c={})=>{let n=c.stats??[],o=c.previousStats??[],g=[],l=new Map(o.map((T)=>[X(T),T])),C=n.filter((T)=>(T.type==="inbound-rtp"||T.type==="outbound-rtp")&&w(T,"kind")!=="video"&&w(T,"mediaType")!=="video").map((T)=>{let L=T.type==="outbound-rtp"?"outbound":"inbound",R=L==="outbound"?"packetsSent":"packetsReceived",E=L==="outbound"?"bytesSent":"bytesReceived",b=l.get(X(T)),M=_(T,R),O=b?_(b,R):void 0,W=_(T,E),P=b?_(b,E):void 0,A=T.timestamp!==void 0&&b?.timestamp!==void 0?T.timestamp-b.timestamp:void 0;return{bytesDelta:W!==void 0&&P!==void 0?W-P:void 0,currentPackets:M,direction:L,id:X(T),packetDelta:M!==void 0&&O!==void 0?M-O:void 0,previousPackets:O,timeDeltaMs:A}}),V=C.filter((T)=>T.direction==="inbound"),I=C.filter((T)=>T.direction==="outbound"),d=$(C.map((T)=>T.timeDeltaMs).filter((T)=>T!==void 0)),y=V.filter((T)=>c.maxInboundPacketStallMs!==void 0&&T.timeDeltaMs!==void 0&&T.timeDeltaMs>=c.maxInboundPacketStallMs&&T.packetDelta!==void 0&&T.packetDelta<=0).length,h=I.filter((T)=>c.maxOutboundPacketStallMs!==void 0&&T.timeDeltaMs!==void 0&&T.timeDeltaMs>=c.maxOutboundPacketStallMs&&T.packetDelta!==void 0&&T.packetDelta<=0).length;if(c.requireInboundAudio&&V.length===0)D(g,"error","media.webrtc_inbound_audio_missing","No inbound WebRTC audio RTP stream was observed.");if(c.requireOutboundAudio&&I.length===0)D(g,"error","media.webrtc_outbound_audio_missing","No outbound WebRTC audio RTP stream was observed.");if(c.maxGapMs!==void 0&&d!==void 0&&d>c.maxGapMs)D(g,"warning","media.webrtc_stream_gap",`Observed WebRTC stream sample gap ${String(d)}ms above ${String(c.maxGapMs)}ms.`);if(y>0)D(g,"error","media.webrtc_inbound_stalled",`${String(y)} inbound WebRTC audio stream(s) stopped receiving packets.`);if(h>0)D(g,"error","media.webrtc_outbound_stalled",`${String(h)} outbound WebRTC audio stream(s) stopped sending packets.`);return{checkedAt:Date.now(),inboundAudioStreams:V.length,issues:g,maxObservedGapMs:d,outboundAudioStreams:I.length,stalledInboundStreams:y,stalledOutboundStreams:h,status:g.some((T)=>T.severity==="error")?"fail":g.length>0?"warn":"pass",streams:C,totalStats:n.length}};var Uc="/api/voice/browser-media",bc=5000,Mc=async(c)=>c.peerConnection??await c.getPeerConnection?.()??null,Oc=async(c,n)=>{let o=n.fetch??globalThis.fetch;if(!o)return;await o(n.path??Uc,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST"})},j=(c)=>{let n=null,o=[],g=async()=>{let C=await Mc(c);if(!C)return;let V=await B({peerConnection:C}),I=z({...c,stats:V}),d=c.continuity===!1?void 0:K({...c.continuity,previousStats:o,stats:V}),y={at:Date.now(),continuity:d,report:I,scenarioId:c.getScenarioId?.()??null,sessionId:c.getSessionId?.()??null};return o=V,c.onReport?.(y),await Oc(y,c),y},l=()=>{g().catch((C)=>{c.onError?.(C)})},i=()=>{if(n)clearInterval(n),n=null};return{close:i,reportOnce:g,start:()=>{if(n)return;l(),n=setInterval(l,c.intervalMs??bc)},stop:i}};var x=()=>{},Dc=()=>x,sc={callControl:x,close:x,endTurn:x,getReadyState:()=>3,getScenarioId:()=>"",getSessionId:()=>"",send:x,sendAudio:x,simulateDisconnect:x,start:()=>{},subscribe:Dc},xc=()=>crypto.randomUUID(),Ec=(c,n,o)=>{let{hostname:g,port:l,protocol:i}=window.location,C=i==="https:"?"wss:":"ws:",V=l?`:${l}`:"",I=new URL(`${C}//${g}${V}${c}`);if(I.searchParams.set("sessionId",n),o)I.searchParams.set("scenarioId",o);return I.toString()},Wc=(c)=>{if(!c||typeof c!=="object"||!("type"in c))return!1;switch(c.type){case"audio":case"assistant":case"call_lifecycle":case"complete":case"connection":case"error":case"final":case"partial":case"pong":case"replay":case"session":case"turn":return!0;default:return!1}},Pc=(c)=>{if(typeof c.data!=="string")return null;try{let n=JSON.parse(c.data);return Wc(n)?n:null}catch{return null}},f=(c,n={})=>{if(typeof window>"u")return sc;let o=new Set,g=n.reconnect!==!1,l=n.maxReconnectAttempts??10,i=n.pingInterval??30000,C={isConnected:!1,pendingMessages:[],scenarioId:n.scenarioId??null,pingInterval:null,reconnectAttempts:0,reconnectTimeout:null,sessionId:n.sessionId??xc(),ws:null},V=(A)=>{o.forEach((S)=>S(A))},I=()=>{if(C.pingInterval)clearInterval(C.pingInterval),C.pingInterval=null;if(C.reconnectTimeout)clearTimeout(C.reconnectTimeout),C.reconnectTimeout=null},d=()=>{if(C.ws?.readyState!==1)return;while(C.pendingMessages.length>0){let A=C.pendingMessages.shift();if(A!==void 0)C.ws.send(A)}},y=()=>{let A=Date.now()+500;C.reconnectAttempts+=1,V({reconnect:{attempts:C.reconnectAttempts,lastDisconnectAt:Date.now(),maxAttempts:l,nextAttemptAt:A,status:"reconnecting"},type:"connection"}),C.reconnectTimeout=setTimeout(()=>{if(C.reconnectAttempts>l){V({reconnect:{attempts:C.reconnectAttempts,maxAttempts:l,status:"exhausted"},type:"connection"});return}h()},500)},h=()=>{let A=new WebSocket(Ec(c,C.sessionId,C.scenarioId));A.binaryType="arraybuffer",A.onopen=()=>{let S=C.reconnectAttempts>0;if(C.isConnected=!0,d(),S)V({reconnect:{attempts:C.reconnectAttempts,lastResumedAt:Date.now(),maxAttempts:l,status:"resumed"},type:"connection"}),C.reconnectAttempts=0;o.forEach((U)=>U({scenarioId:C.scenarioId??void 0,sessionId:C.sessionId,status:"active",type:"session"})),C.pingInterval=setInterval(()=>{if(A.readyState===1)A.send(JSON.stringify({type:"ping"}))},i)},A.onmessage=(S)=>{let U=Pc(S);if(!U)return;if(U.type==="session")C.sessionId=U.sessionId,C.scenarioId=U.scenarioId??C.scenarioId;o.forEach((gc)=>gc(U))},A.onclose=(S)=>{if(C.isConnected=!1,I(),g&&S.code!==1000&&C.reconnectAttempts<l)y();else if(g&&S.code!==1000)V({reconnect:{attempts:C.reconnectAttempts,lastDisconnectAt:Date.now(),maxAttempts:l,status:"exhausted"},type:"connection"})},C.ws=A},T=(A)=>{if(C.ws?.readyState===1){C.ws.send(A);return}C.pendingMessages.push(A)},L=(A)=>{T(JSON.stringify(A))},R=(A={})=>{if(A.sessionId)C.sessionId=A.sessionId;if(A.scenarioId)C.scenarioId=A.scenarioId;L({type:"start",sessionId:C.sessionId,scenarioId:C.scenarioId??void 0})},E=(A)=>{T(A)},b=()=>{L({type:"end_turn"})},M=(A)=>{L({...A,type:"call_control"})},O=()=>{if(I(),C.ws)C.ws.close(1000),C.ws=null;C.isConnected=!1,o.clear()},W=()=>{if(C.ws?.readyState===1)C.ws.close(4000,"absolutejs-voice-reconnect-proof")},P=(A)=>{return o.add(A),()=>{o.delete(A)}};return h(),{callControl:M,close:O,endTurn:b,getReadyState:()=>C.ws?.readyState??3,getScenarioId:()=>C.scenarioId??"",getSessionId:()=>C.sessionId,send:L,sendAudio:E,simulateDisconnect:W,start:R,subscribe:P}};var Nc=()=>({attempts:0,maxAttempts:0,status:"idle"}),$c=()=>({assistantAudio:[],assistantTexts:[],call:null,error:null,isConnected:!1,sessionMetadata:null,scenarioId:null,partial:"",reconnect:Nc(),sessionId:null,status:"idle",turns:[]}),e=()=>{let c=$c(),n=new Set,o=()=>{n.forEach((l)=>l())};return{dispatch:(l)=>{switch(l.type){case"audio":c={...c,assistantAudio:[...c.assistantAudio,{chunk:l.chunk,format:l.format,receivedAt:l.receivedAt,turnId:l.turnId}]};break;case"assistant":c={...c,assistantTexts:[...c.assistantTexts,l.text]};break;case"complete":c={...c,sessionId:l.sessionId,status:"completed"};break;case"call_lifecycle":c={...c,call:{...c.call,disposition:l.event.type==="end"?l.event.disposition:c.call?.disposition,endedAt:l.event.type==="end"?l.event.at:c.call?.endedAt,events:[...c.call?.events??[],l.event],lastEventAt:l.event.at,startedAt:c.call?.startedAt??l.event.at},sessionId:l.sessionId};break;case"connected":c={...c,isConnected:!0,reconnect:c.reconnect.status==="reconnecting"?{...c.reconnect,lastResumedAt:Date.now(),nextAttemptAt:void 0,status:"resumed"}:c.reconnect};break;case"connection":c={...c,reconnect:l.reconnect};break;case"disconnected":c={...c,isConnected:!1};break;case"error":c={...c,error:l.message};break;case"final":c={...c,partial:l.transcript.text,turns:c.turns.map((i)=>i)};break;case"partial":c={...c,partial:l.transcript.text};break;case"replay":c={...c,assistantTexts:[...l.assistantTexts],call:l.call??null,error:null,isConnected:l.status==="active",partial:l.partial,reconnect:c.reconnect.status==="reconnecting"?{...c.reconnect,lastResumedAt:Date.now(),nextAttemptAt:void 0,status:"resumed"}:c.reconnect,scenarioId:l.scenarioId??c.scenarioId,sessionId:l.sessionId,sessionMetadata:l.sessionMetadata??c.sessionMetadata,status:l.status,turns:[...l.turns]};break;case"session":c={...c,error:null,scenarioId:l.scenarioId??c.scenarioId,isConnected:l.status==="active",sessionId:l.sessionId,sessionMetadata:l.sessionMetadata??c.sessionMetadata,status:l.status};break;case"turn":c={...c,partial:"",turns:[...c.turns,l.turn]};break}o()},getServerSnapshot:()=>c,getSnapshot:()=>c,subscribe:(l)=>{return n.add(l),()=>{n.delete(l)}}}};var k=(c,n={})=>{let o=f(c,n),g=e(),l=n.browserMedia&&typeof window<"u"?j({...n.browserMedia,getScenarioId:()=>n.browserMedia?n.browserMedia.getScenarioId?.()??o.getScenarioId():o.getScenarioId(),getSessionId:()=>n.browserMedia?n.browserMedia.getSessionId?.()??o.getSessionId():o.getSessionId()}):null,i=new Set,C=(y)=>Promise.resolve().then(()=>{if(!y?.sessionId&&!y?.scenarioId)return;o.start(y),l?.start()}),V=()=>{i.forEach((y)=>y())},I=()=>{if(!n.reconnectReportPath||typeof fetch>"u")return;let y=g.getSnapshot(),h=JSON.stringify({at:Date.now(),reconnect:y.reconnect,scenarioId:y.scenarioId,sessionId:o.getSessionId(),turnIds:y.turns.map((T)=>T.id)});fetch(n.reconnectReportPath,{body:h,headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST"}).catch(()=>{})},d=o.subscribe((y)=>{let h=q(y);if(h){if(g.dispatch(h),y.type==="connection")I();V()}});return{callControl(y){o.callControl(y)},close(){d(),l?.close(),o.close(),g.dispatch({type:"disconnected"}),V()},endTurn(){o.endTurn()},get error(){return g.getSnapshot().error},getServerSnapshot(){return g.getServerSnapshot()},getSnapshot(){return g.getSnapshot()},get isConnected(){return g.getSnapshot().isConnected},get scenarioId(){return g.getSnapshot().scenarioId},get sessionMetadata(){return g.getSnapshot().sessionMetadata},start:C,get partial(){return g.getSnapshot().partial},get reconnect(){return g.getSnapshot().reconnect},get sessionId(){return o.getSessionId()},get status(){return g.getSnapshot().status},get turns(){return g.getSnapshot().turns},get assistantTexts(){return g.getSnapshot().assistantTexts},get assistantAudio(){return g.getSnapshot().assistantAudio},get call(){return g.getSnapshot().call},sendAudio(y){o.sendAudio(y)},simulateDisconnect(){o.simulateDisconnect()},subscribe(y){return i.add(y),()=>{i.delete(y)}}}};var t=(c)=>{if(!c||c.enabled===!1)return;return{enabled:!0,maxGain:c.maxGain??3,noiseGateAttenuation:c.noiseGateAttenuation??0.15,noiseGateThreshold:c.noiseGateThreshold??0.006,targetLevel:c.targetLevel??0.08}};var Hc={balanced:{qualityProfile:"general",silenceMs:1400,speechThreshold:0.012,transcriptStabilityMs:1000},fast:{qualityProfile:"general",silenceMs:700,speechThreshold:0.015,transcriptStabilityMs:450},"long-form":{qualityProfile:"general",silenceMs:2200,speechThreshold:0.01,transcriptStabilityMs:1500}},Gc={general:{},"accent-heavy":{silenceMs:1200,speechThreshold:0.01,transcriptStabilityMs:1200},"noisy-room":{silenceMs:2000,speechThreshold:0.02,transcriptStabilityMs:1600},"short-command":{silenceMs:500,speechThreshold:0.016,transcriptStabilityMs:420}};var F=(c)=>{let n=c?.profile??"fast",o=c?.qualityProfile??"general",g=Hc[n],l=Gc[o];return{profile:n,qualityProfile:o,silenceMs:c?.silenceMs??l.silenceMs??g.silenceMs,speechThreshold:c?.speechThreshold??l.speechThreshold??g.speechThreshold,transcriptStabilityMs:c?.transcriptStabilityMs??l.transcriptStabilityMs??g.transcriptStabilityMs}};var Xc={chat:{audioConditioning:{enabled:!0,maxGain:2.5,noiseGateAttenuation:0,noiseGateThreshold:0.004,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:10,pingInterval:30000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"short-command",profile:"balanced"}},default:{capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:10,pingInterval:30000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"general",profile:"fast"}},dictation:{audioConditioning:{enabled:!0,maxGain:2.25,noiseGateAttenuation:0.05,noiseGateThreshold:0.003,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:12,pingInterval:30000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"accent-heavy",profile:"long-form"}},"guided-intake":{audioConditioning:{enabled:!0,maxGain:2.5,noiseGateAttenuation:0,noiseGateThreshold:0.004,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:12,pingInterval:30000,reconnect:!0},sttLifecycle:"turn-scoped",turnDetection:{qualityProfile:"accent-heavy",profile:"long-form"}},"noisy-room":{audioConditioning:{enabled:!0,maxGain:3,noiseGateAttenuation:0.12,noiseGateThreshold:0.006,targetLevel:0.085},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:14,pingInterval:45000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"noisy-room",profile:"long-form",silenceMs:2100,speechThreshold:0.02,transcriptStabilityMs:1650}},"pstn-balanced":{audioConditioning:{enabled:!0,maxGain:2.8,noiseGateAttenuation:0.07,noiseGateThreshold:0.005,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:14,pingInterval:45000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"noisy-room",profile:"long-form",silenceMs:660,speechThreshold:0.012,transcriptStabilityMs:300}},"pstn-fast":{audioConditioning:{enabled:!0,maxGain:2.75,noiseGateAttenuation:0.06,noiseGateThreshold:0.005,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:14,pingInterval:45000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"noisy-room",profile:"long-form",silenceMs:620,speechThreshold:0.012,transcriptStabilityMs:280}},reliability:{audioConditioning:{enabled:!0,maxGain:2.9,noiseGateAttenuation:0.08,noiseGateThreshold:0.005,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:14,pingInterval:45000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"noisy-room",profile:"long-form"}}},r=(c="default")=>{let n=Xc[c];return{audioConditioning:t(n.audioConditioning),capture:{channelCount:n.capture?.channelCount??1,sampleRateHz:n.capture?.sampleRateHz??16000},connection:{...n.connection},name:c,sttLifecycle:n.sttLifecycle??"continuous",turnDetection:F(n.turnDetection)}};var Yc=(c)=>({assistantAudio:[...c.assistantAudio],assistantTexts:[...c.assistantTexts],call:c.call,error:c.error,isConnected:c.isConnected,isRecording:!1,partial:c.partial,reconnect:c.reconnect,recordingError:null,sessionId:c.sessionId,sessionMetadata:c.sessionMetadata,scenarioId:c.scenarioId,status:c.status,turns:[...c.turns]}),a=(c,n={})=>{let o=r(n.preset),g=k(c,{...o.connection,...n.connection}),l=null,i=Yc(g),C=new Set,V=()=>{for(let R of C)R()},I=()=>{if(i={...i,assistantAudio:[...g.assistantAudio],assistantTexts:[...g.assistantTexts],call:g.call,error:g.error,isConnected:g.isConnected,partial:g.partial,reconnect:g.reconnect,sessionId:g.sessionId,sessionMetadata:g.sessionMetadata,scenarioId:g.scenarioId,status:g.status,turns:[...g.turns]},n.autoStopOnComplete!==!1&&i.status==="completed"&&i.isRecording)l?.stop(),l=null,i={...i,isRecording:!1};V()},d=g.subscribe(I);I();let y=()=>{if(l)return l;return l=J({channelCount:n.capture?.channelCount??o.capture.channelCount,onLevel:n.capture?.onLevel,onAudio:(R)=>{if(n.capture?.onAudio){n.capture.onAudio(R,g.sendAudio);return}g.sendAudio(R)},sampleRateHz:n.capture?.sampleRateHz??o.capture.sampleRateHz}),l},h=()=>{l?.stop(),l=null,i={...i,isRecording:!1},V()},T=async()=>{if(i.isRecording)return;try{i={...i,recordingError:null},V(),await y().start(),i={...i,isRecording:!0},V()}catch(R){throw l=null,i={...i,isRecording:!1,recordingError:R instanceof Error?R.message:String(R)},V(),R}};return{bindHTMX(R){return Q(g,R)},callControl:(R)=>g.callControl(R),close:()=>{d(),h(),g.close()},endTurn:()=>g.endTurn(),get error(){return i.error},getServerSnapshot:()=>i,getSnapshot:()=>i,get isConnected(){return i.isConnected},get isRecording(){return i.isRecording},get partial(){return i.partial},get recordingError(){return i.recordingError},get reconnect(){return i.reconnect},sendAudio:(R)=>g.sendAudio(R),simulateDisconnect:()=>g.simulateDisconnect(),get sessionId(){return i.sessionId},get sessionMetadata(){return i.sessionMetadata},get scenarioId(){return i.scenarioId},startRecording:T,get status(){return i.status},stopRecording:h,subscribe:(R)=>{return C.add(R),()=>{C.delete(R)}},toggleRecording:async()=>{if(i.isRecording){h();return}await T()},get turns(){return i.turns},get assistantTexts(){return i.assistantTexts},get assistantAudio(){return i.assistantAudio},get call(){return i.call}}};var s=(c)=>String(c).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'");var v=(c)=>{if(!c.isConnected)return"idle";if(c.isPlaying)return"speaking";if(c.isRecording&&c.hasActivePartial)return"listening";if(c.isRecording)return"listening";if(c.lastTranscriptAt&&!c.lastAssistantAt)return"thinking";if(c.lastTranscriptAt&&c.lastAssistantAt&&c.lastTranscriptAt>c.lastAssistantAt)return"thinking";return"idle"};var Qc={accent:"#3b82f6",background:"#0f172a",errorAccent:"#ef4444",fontFamily:'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',foreground:"#f8fafc",radius:16},Jc={callEnded:"Call ended",connecting:"Connecting…",endCall:"End call",idle:"Idle",listening:"Listening",mute:"Mute",speaking:"Speaking",startCall:"Start call",thinking:"Thinking",unmute:"Unmute"},qc=(c,n)=>{switch(c){case"listening":return n.listening;case"speaking":return n.speaking;case"thinking":return n.thinking;case"idle":return n.idle}},u=(c)=>{let n={...Qc,...c.theme},o={...Jc,...c.labels},g=c.state.assistantAudio.at(-1)?.receivedAt,l=c.state.turns.at(-1)?.committedAt,i=v({hasActivePartial:c.state.partial.length>0,isConnected:c.state.isConnected,isPlaying:!1,isRecording:c.state.isRecording,lastAssistantAt:g,lastTranscriptAt:l}),C=!c.state.isConnected&&c.state.status!=="idle"&&!c.state.error,V=c.state.error?"Error":C?o.connecting:c.state.status==="completed"?o.callEnded:qc(i,o);return{agentState:i,classes:{container:`absolute-voice-widget absolute-voice-widget--${i}`,dot:`absolute-voice-widget__dot${c.state.error?" absolute-voice-widget__dot--error":""}`},controls:{canEnd:c.state.isConnected,canMute:c.state.isRecording,canStart:!c.state.isRecording&&c.state.status!=="completed"},errorMessage:c.state.error??void 0,labels:o,partial:c.state.partial||void 0,statusLabel:V,theme:n,title:c.title??"Voice"}},Zc=(c)=>typeof c==="number"?`${c}px`:c,m=(c)=>{let n=c.theme,o=`background:${n.background};border-radius:${Zc(n.radius)};color:${n.foreground};font-family:${n.fontFamily};min-width:240px;padding:20px 22px;`,g=`background:${c.errorMessage?n.errorAccent:c.agentState==="idle"?"rgba(148,163,184,0.6)":n.accent};border-radius:50%;height:10px;width:10px;`,l=[];if(c.controls.canStart)l.push(`<button type="button" data-action="start" style="background:${n.accent};border:none;border-radius:12px;color:${n.foreground};cursor:pointer;font-size:14px;font-weight:500;padding:10px 14px;">${s(c.labels.startCall)}</button>`);if(c.controls.canMute)l.push(`<button type="button" data-action="mute" style="background:transparent;border:1px solid rgba(255,255,255,0.18);border-radius:12px;color:${n.foreground};cursor:pointer;font-size:14px;font-weight:500;padding:10px 14px;">${s(c.labels.mute)}</button>`);if(c.controls.canEnd)l.push(`<button type="button" data-action="end" style="background:${n.errorAccent};border:none;border-radius:12px;color:${n.foreground};cursor:pointer;font-size:14px;font-weight:500;padding:10px 14px;">${s(c.labels.endCall)}</button>`);return`<div role="region" aria-live="polite" data-agent-state="${c.agentState}" class="${s(c.classes.container)}" style="${o}">
|
|
1
|
+
(()=>{var{defineProperty:H,getOwnPropertyNames:oc,getOwnPropertyDescriptor:lc}=Object,Ac=Object.prototype.hasOwnProperty;function Cc(c){return this[c]}var ic=(c)=>{var n=(Y??=new WeakMap).get(c),o;if(n)return n;if(n=H({},"__esModule",{value:!0}),c&&typeof c==="object"||typeof c==="function"){for(var g of oc(c))if(!Ac.call(n,g))H(n,g,{get:Cc.bind(c,g),enumerable:!(o=lc(c,g))||o.enumerable})}return Y.set(c,n),n},Y;var Tc=(c)=>c;function yc(c,n){this[c]=Tc.bind(null,n)}var Vc=(c,n)=>{for(var o in n)H(c,o,{get:n[o],enumerable:!0,configurable:!0,set:yc.bind(n,o)})};var Bc={};Vc(Bc,{mount:()=>p,default:()=>Kc,VOICE_EMBED_VERSION:()=>cc});var Ic=(c)=>{if(typeof c!=="string")return c;return document.querySelector(c)},Rc=(c,n,o,g)=>{let l=n??c.getAttribute("hx-get")??"";if(!l)return"";let i=new URL(l,window.location.origin);if(g)i.searchParams.set(o,g);else i.searchParams.delete(o);return`${i.pathname}${i.search}${i.hash}`},Q=(c,n)=>{if(typeof window>"u"||typeof document>"u")return()=>{};let o=Ic(n.element);if(!o)return()=>{};let g=n.eventName??"voice-refresh",l=n.sessionQueryParam??"sessionId",i=()=>{let V=window,I=Rc(o,n.route,l,c.sessionId);if(I)o.setAttribute("hx-get",I);V.htmx?.process?.(o),V.htmx?.trigger?.(o,g)},C=c.subscribe(i);return i(),()=>{C()}};var hc=(c)=>Math.max(-1,Math.min(1,c)),dc=(c)=>{let n=new Int16Array(c.length);for(let o=0;o<c.length;o+=1){let g=hc(c[o]??0);n[o]=g<0?g*32768:g*32767}return new Uint8Array(n.buffer)},Sc=(c)=>{let n=c instanceof Uint8Array?c:new Uint8Array(c);if(n.byteLength<2)return 0;let o=new Int16Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/2));if(o.length===0)return 0;let g=0;for(let l of o){let i=l/32768;g+=i*i}return Math.min(1,Math.max(0,Math.sqrt(g/o.length)*5.5))},_c=(c,n,o)=>{if(n===o)return c;let g=n/o,l=Math.round(c.length/g),i=new Float32Array(l),C=0,V=0;while(C<i.length){let I=Math.round((C+1)*g),d=0,y=0;for(let h=V;h<I&&h<c.length;h+=1)d+=c[h]??0,y+=1;i[C]=y>0?d/y:0,C+=1,V=I}return i},J=(c)=>{let n=null,o=null,g=null,l=null;return{start:async()=>{if(typeof navigator>"u"||!navigator.mediaDevices?.getUserMedia)throw Error("Browser microphone capture requires navigator.mediaDevices.getUserMedia.");let V=(typeof window<"u"?window.AudioContext??window.webkitAudioContext:void 0)??AudioContext;if(!V)throw Error("Browser microphone capture requires AudioContext support.");l=await navigator.mediaDevices.getUserMedia({audio:{channelCount:c.channelCount??1}}),n=new V,o=n.createMediaStreamSource(l),g=n.createScriptProcessor(4096,1,1),g.onaudioprocess=(I)=>{let d=I.inputBuffer.getChannelData(0),y=_c(d,n?.sampleRate??48000,c.sampleRateHz??16000),h=dc(y);c.onLevel?.(Sc(h)),c.onAudio(h)},o.connect(g),g.connect(n.destination)},stop:()=>{g?.disconnect(),o?.disconnect(),l?.getTracks().forEach((V)=>V.stop()),n?.close(),c.onLevel?.(0),n=null,l=null,g=null,o=null}}};var G=(c)=>{if(typeof c==="string"&&c.trim())return c;if(c instanceof Error&&c.message.trim())return c.message;if(c&&typeof c==="object"){let n=c;for(let o of["message","reason","description"]){let g=n[o];if(typeof g==="string"&&g.trim())return g}if("error"in n)return G(n.error);if("cause"in n)return G(n.cause);try{return JSON.stringify(c)}catch{}}return"Unexpected error"},q=(c)=>{switch(c.type){case"audio":return{chunk:Uint8Array.from(atob(c.chunkBase64),(n)=>n.charCodeAt(0)),format:c.format,receivedAt:c.receivedAt,turnId:c.turnId,type:"audio"};case"assistant":return{text:c.text,type:"assistant"};case"complete":return{sessionId:c.sessionId,type:"complete"};case"connection":return{reconnect:c.reconnect,type:"connection"};case"call_lifecycle":return{event:c.event,sessionId:c.sessionId,type:"call_lifecycle"};case"error":return{message:G(c.message),type:"error"};case"final":return{transcript:c.transcript,type:"final"};case"partial":return{transcript:c.transcript,type:"partial"};case"replay":return{assistantTexts:c.assistantTexts,call:c.call,partial:c.partial,scenarioId:c.scenarioId,sessionId:c.sessionId,sessionMetadata:c.sessionMetadata,status:c.status,turns:c.turns,type:"replay"};case"session":return{sessionId:c.sessionId,sessionMetadata:c.sessionMetadata,scenarioId:c.scenarioId,status:c.status,type:"session"};case"turn":return{turn:c.turn,type:"turn"};default:return null}};var tc=Math.PI*2;var D=(c,n,o,g)=>{c.push({code:o,message:g,severity:n})};var wc=(c)=>c.length===0?void 0:c.reduce((n,o)=>n+o,0)/c.length,$=(c)=>c.length===0?void 0:Math.max(...c);var _=(c,n)=>{let o=c[n];return typeof o==="number"&&Number.isFinite(o)?o:void 0},N=(c,n)=>{let o=c[n];return typeof o==="boolean"?o:void 0},w=(c,n)=>{let o=c[n];return typeof o==="string"?o:void 0},X=(c)=>String(c.id??w(c,"ssrc")??_(c,"ssrc")??w(c,"trackIdentifier")??w(c,"mid")??"unknown"),Z=(c)=>c===void 0?void 0:c*1000;var Lc=(c)=>{let n={};for(let[o,g]of Object.entries(c))if(g===null||typeof g==="boolean"||typeof g==="number"||typeof g==="string")n[o]=g;return n};var z=(c={})=>{let n=c.stats??[],o=[],g=n.filter((A)=>A.type==="inbound-rtp"&&w(A,"kind")!=="video"),l=n.filter((A)=>A.type==="outbound-rtp"&&w(A,"kind")!=="video"),i=n.filter((A)=>A.type==="candidate-pair"),C=n.filter((A)=>(A.type==="track"||A.type==="media-source")&&w(A,"kind")==="audio"),V=i.filter((A)=>N(A,"selected")===!0||N(A,"nominated")===!0||w(A,"state")==="succeeded").length,I=C.filter((A)=>w(A,"readyState")!=="ended"&&w(A,"trackState")!=="ended"&&N(A,"ended")!==!0).length,d=C.filter((A)=>w(A,"readyState")==="ended"||w(A,"trackState")==="ended"||N(A,"ended")===!0).length,y=g.reduce((A,S)=>A+(_(S,"packetsReceived")??0),0),h=l.reduce((A,S)=>A+(_(S,"packetsSent")??0),0),T=[...g,...l].reduce((A,S)=>A+Math.max(0,_(S,"packetsLost")??0),0),L=y+T,R=L===0?0:T/L,E=g.reduce((A,S)=>A+(_(S,"bytesReceived")??0),0),b=l.reduce((A,S)=>A+(_(S,"bytesSent")??0),0),M=$(i.map((A)=>Z(_(A,"currentRoundTripTime")??_(A,"roundTripTime"))).filter((A)=>A!==void 0)),O=$([...g,...l].map((A)=>Z(_(A,"jitter"))).filter((A)=>A!==void 0)),W=$(g.map((A)=>{let S=_(A,"jitterBufferDelay"),U=_(A,"jitterBufferEmittedCount");return S!==void 0&&U!==void 0&&U>0?S/U*1000:void 0}).filter((A)=>A!==void 0)),P=C.map((A)=>_(A,"audioLevel")).filter((A)=>A!==void 0);if(c.requireConnectedCandidatePair&&i.length>0&&V===0)D(o,"error","media.webrtc_candidate_pair_missing","No active WebRTC candidate pair was observed.");if(c.requireLiveAudioTrack&&I===0)D(o,"error","media.webrtc_audio_track_missing","No live WebRTC audio track was observed.");if(c.maxPacketLossRatio!==void 0&&R>c.maxPacketLossRatio)D(o,"warning","media.webrtc_packet_loss",`Observed WebRTC packet loss ratio ${String(R)} above ${String(c.maxPacketLossRatio)}.`);if(c.maxRoundTripTimeMs!==void 0&&M!==void 0&&M>c.maxRoundTripTimeMs)D(o,"warning","media.webrtc_round_trip_time",`Observed WebRTC RTT ${String(M)}ms above ${String(c.maxRoundTripTimeMs)}ms.`);if(c.maxJitterMs!==void 0&&O!==void 0&&O>c.maxJitterMs)D(o,"warning","media.webrtc_jitter",`Observed WebRTC jitter ${String(O)}ms above ${String(c.maxJitterMs)}ms.`);return{activeCandidatePairs:V,audioLevelAverage:wc(P),bytesReceived:E,bytesSent:b,checkedAt:Date.now(),endedAudioTracks:d,inboundPackets:y,issues:o,jitterBufferDelayMs:W,jitterMs:O,liveAudioTracks:I,outboundPackets:h,packetLossRatio:R,packetsLost:T,roundTripTimeMs:M,status:o.some((A)=>A.severity==="error")?"fail":o.length>0?"warn":"pass",totalStats:n.length}},B=async(c)=>{return[...(await c.peerConnection.getStats(c.selector??null)).values()].map(Lc)};var K=(c={})=>{let n=c.stats??[],o=c.previousStats??[],g=[],l=new Map(o.map((T)=>[X(T),T])),C=n.filter((T)=>(T.type==="inbound-rtp"||T.type==="outbound-rtp")&&w(T,"kind")!=="video"&&w(T,"mediaType")!=="video").map((T)=>{let L=T.type==="outbound-rtp"?"outbound":"inbound",R=L==="outbound"?"packetsSent":"packetsReceived",E=L==="outbound"?"bytesSent":"bytesReceived",b=l.get(X(T)),M=_(T,R),O=b?_(b,R):void 0,W=_(T,E),P=b?_(b,E):void 0,A=T.timestamp!==void 0&&b?.timestamp!==void 0?T.timestamp-b.timestamp:void 0;return{bytesDelta:W!==void 0&&P!==void 0?W-P:void 0,currentPackets:M,direction:L,id:X(T),packetDelta:M!==void 0&&O!==void 0?M-O:void 0,previousPackets:O,timeDeltaMs:A}}),V=C.filter((T)=>T.direction==="inbound"),I=C.filter((T)=>T.direction==="outbound"),d=$(C.map((T)=>T.timeDeltaMs).filter((T)=>T!==void 0)),y=V.filter((T)=>c.maxInboundPacketStallMs!==void 0&&T.timeDeltaMs!==void 0&&T.timeDeltaMs>=c.maxInboundPacketStallMs&&T.packetDelta!==void 0&&T.packetDelta<=0).length,h=I.filter((T)=>c.maxOutboundPacketStallMs!==void 0&&T.timeDeltaMs!==void 0&&T.timeDeltaMs>=c.maxOutboundPacketStallMs&&T.packetDelta!==void 0&&T.packetDelta<=0).length;if(c.requireInboundAudio&&V.length===0)D(g,"error","media.webrtc_inbound_audio_missing","No inbound WebRTC audio RTP stream was observed.");if(c.requireOutboundAudio&&I.length===0)D(g,"error","media.webrtc_outbound_audio_missing","No outbound WebRTC audio RTP stream was observed.");if(c.maxGapMs!==void 0&&d!==void 0&&d>c.maxGapMs)D(g,"warning","media.webrtc_stream_gap",`Observed WebRTC stream sample gap ${String(d)}ms above ${String(c.maxGapMs)}ms.`);if(y>0)D(g,"error","media.webrtc_inbound_stalled",`${String(y)} inbound WebRTC audio stream(s) stopped receiving packets.`);if(h>0)D(g,"error","media.webrtc_outbound_stalled",`${String(h)} outbound WebRTC audio stream(s) stopped sending packets.`);return{checkedAt:Date.now(),inboundAudioStreams:V.length,issues:g,maxObservedGapMs:d,outboundAudioStreams:I.length,stalledInboundStreams:y,stalledOutboundStreams:h,status:g.some((T)=>T.severity==="error")?"fail":g.length>0?"warn":"pass",streams:C,totalStats:n.length}};var Uc="/api/voice/browser-media",bc=5000,Mc=async(c)=>c.peerConnection??await c.getPeerConnection?.()??null,Oc=async(c,n)=>{let o=n.fetch??globalThis.fetch;if(!o)return;await o(n.path??Uc,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST"})},j=(c)=>{let n=null,o=[],g=async()=>{let C=await Mc(c);if(!C)return;let V=await B({peerConnection:C}),I=z({...c,stats:V}),d=c.continuity===!1?void 0:K({...c.continuity,previousStats:o,stats:V}),y={at:Date.now(),continuity:d,report:I,scenarioId:c.getScenarioId?.()??null,sessionId:c.getSessionId?.()??null};return o=V,c.onReport?.(y),await Oc(y,c),y},l=()=>{g().catch((C)=>{c.onError?.(C)})},i=()=>{if(n)clearInterval(n),n=null};return{close:i,reportOnce:g,start:()=>{if(n)return;l(),n=setInterval(l,c.intervalMs??bc)},stop:i}};var x=()=>{},Dc=()=>x,sc={callControl:x,close:x,endTurn:x,getReadyState:()=>3,getScenarioId:()=>"",getSessionId:()=>"",send:x,sendAudio:x,simulateDisconnect:x,start:()=>{},subscribe:Dc},xc=()=>crypto.randomUUID(),Ec=(c,n,o)=>{let{hostname:g,port:l,protocol:i}=window.location,C=i==="https:"?"wss:":"ws:",V=l?`:${l}`:"",I=new URL(`${C}//${g}${V}${c}`);if(I.searchParams.set("sessionId",n),o)I.searchParams.set("scenarioId",o);return I.toString()},Wc=(c)=>{if(!c||typeof c!=="object"||!("type"in c))return!1;switch(c.type){case"audio":case"assistant":case"call_lifecycle":case"complete":case"connection":case"error":case"final":case"partial":case"pong":case"replay":case"session":case"turn":return!0;default:return!1}},Pc=(c)=>{if(typeof c.data!=="string")return null;try{let n=JSON.parse(c.data);return Wc(n)?n:null}catch{return null}},e=(c,n={})=>{if(typeof window>"u")return sc;let o=new Set,g=n.reconnect!==!1,l=n.maxReconnectAttempts??10,i=n.pingInterval??30000,C={isConnected:!1,pendingMessages:[],scenarioId:n.scenarioId??null,pingInterval:null,reconnectAttempts:0,reconnectTimeout:null,sessionId:n.sessionId??xc(),ws:null},V=(A)=>{o.forEach((S)=>S(A))},I=()=>{if(C.pingInterval)clearInterval(C.pingInterval),C.pingInterval=null;if(C.reconnectTimeout)clearTimeout(C.reconnectTimeout),C.reconnectTimeout=null},d=()=>{if(C.ws?.readyState!==1)return;while(C.pendingMessages.length>0){let A=C.pendingMessages.shift();if(A!==void 0)C.ws.send(A)}},y=()=>{let A=Date.now()+500;C.reconnectAttempts+=1,V({reconnect:{attempts:C.reconnectAttempts,lastDisconnectAt:Date.now(),maxAttempts:l,nextAttemptAt:A,status:"reconnecting"},type:"connection"}),C.reconnectTimeout=setTimeout(()=>{if(C.reconnectAttempts>l){V({reconnect:{attempts:C.reconnectAttempts,maxAttempts:l,status:"exhausted"},type:"connection"});return}h()},500)},h=()=>{let A=new WebSocket(Ec(c,C.sessionId,C.scenarioId));A.binaryType="arraybuffer",A.onopen=()=>{let S=C.reconnectAttempts>0;if(C.isConnected=!0,d(),S)V({reconnect:{attempts:C.reconnectAttempts,lastResumedAt:Date.now(),maxAttempts:l,status:"resumed"},type:"connection"}),C.reconnectAttempts=0;o.forEach((U)=>U({scenarioId:C.scenarioId??void 0,sessionId:C.sessionId,status:"active",type:"session"})),C.pingInterval=setInterval(()=>{if(A.readyState===1)A.send(JSON.stringify({type:"ping"}))},i)},A.onmessage=(S)=>{let U=Pc(S);if(!U)return;if(U.type==="session")C.sessionId=U.sessionId,C.scenarioId=U.scenarioId??C.scenarioId;o.forEach((gc)=>gc(U))},A.onclose=(S)=>{if(C.isConnected=!1,I(),g&&S.code!==1000&&C.reconnectAttempts<l)y();else if(g&&S.code!==1000)V({reconnect:{attempts:C.reconnectAttempts,lastDisconnectAt:Date.now(),maxAttempts:l,status:"exhausted"},type:"connection"})},C.ws=A},T=(A)=>{if(C.ws?.readyState===1){C.ws.send(A);return}C.pendingMessages.push(A)},L=(A)=>{T(JSON.stringify(A))},R=(A={})=>{if(A.sessionId)C.sessionId=A.sessionId;if(A.scenarioId)C.scenarioId=A.scenarioId;L({type:"start",sessionId:C.sessionId,scenarioId:C.scenarioId??void 0})},E=(A)=>{T(A)},b=()=>{L({type:"end_turn"})},M=(A)=>{L({...A,type:"call_control"})},O=()=>{if(I(),C.ws)C.ws.close(1000),C.ws=null;C.isConnected=!1,o.clear()},W=()=>{if(C.ws?.readyState===1)C.ws.close(4000,"absolutejs-voice-reconnect-proof")},P=(A)=>{return o.add(A),()=>{o.delete(A)}};return h(),{callControl:M,close:O,endTurn:b,getReadyState:()=>C.ws?.readyState??3,getScenarioId:()=>C.scenarioId??"",getSessionId:()=>C.sessionId,send:L,sendAudio:E,simulateDisconnect:W,start:R,subscribe:P}};var Nc=()=>({attempts:0,maxAttempts:0,status:"idle"}),$c=()=>({assistantAudio:[],assistantTexts:[],call:null,error:null,isConnected:!1,sessionMetadata:null,scenarioId:null,partial:"",reconnect:Nc(),sessionId:null,status:"idle",turns:[]}),f=()=>{let c=$c(),n=new Set,o=()=>{n.forEach((l)=>l())};return{dispatch:(l)=>{switch(l.type){case"audio":c={...c,assistantAudio:[...c.assistantAudio,{chunk:l.chunk,format:l.format,receivedAt:l.receivedAt,turnId:l.turnId}]};break;case"assistant":c={...c,assistantTexts:[...c.assistantTexts,l.text]};break;case"complete":c={...c,sessionId:l.sessionId,status:"completed"};break;case"call_lifecycle":c={...c,call:{...c.call,disposition:l.event.type==="end"?l.event.disposition:c.call?.disposition,endedAt:l.event.type==="end"?l.event.at:c.call?.endedAt,events:[...c.call?.events??[],l.event],lastEventAt:l.event.at,startedAt:c.call?.startedAt??l.event.at},sessionId:l.sessionId};break;case"connected":c={...c,isConnected:!0,reconnect:c.reconnect.status==="reconnecting"?{...c.reconnect,lastResumedAt:Date.now(),nextAttemptAt:void 0,status:"resumed"}:c.reconnect};break;case"connection":c={...c,reconnect:l.reconnect};break;case"disconnected":c={...c,isConnected:!1};break;case"error":c={...c,error:l.message};break;case"final":c={...c,partial:l.transcript.text,turns:c.turns.map((i)=>i)};break;case"partial":c={...c,partial:l.transcript.text};break;case"replay":c={...c,assistantTexts:[...l.assistantTexts],call:l.call??null,error:null,isConnected:l.status==="active",partial:l.partial,reconnect:c.reconnect.status==="reconnecting"?{...c.reconnect,lastResumedAt:Date.now(),nextAttemptAt:void 0,status:"resumed"}:c.reconnect,scenarioId:l.scenarioId??c.scenarioId,sessionId:l.sessionId,sessionMetadata:l.sessionMetadata??c.sessionMetadata,status:l.status,turns:[...l.turns]};break;case"session":c={...c,error:null,scenarioId:l.scenarioId??c.scenarioId,isConnected:l.status==="active",sessionId:l.sessionId,sessionMetadata:l.sessionMetadata??c.sessionMetadata,status:l.status};break;case"turn":c={...c,partial:"",turns:[...c.turns,l.turn]};break}o()},getServerSnapshot:()=>c,getSnapshot:()=>c,subscribe:(l)=>{return n.add(l),()=>{n.delete(l)}}}};var k=(c,n={})=>{let o=e(c,n),g=f(),l=n.browserMedia&&typeof window<"u"?j({...n.browserMedia,getScenarioId:()=>n.browserMedia?n.browserMedia.getScenarioId?.()??o.getScenarioId():o.getScenarioId(),getSessionId:()=>n.browserMedia?n.browserMedia.getSessionId?.()??o.getSessionId():o.getSessionId()}):null,i=new Set,C=(y)=>Promise.resolve().then(()=>{if(!y?.sessionId&&!y?.scenarioId)return;o.start(y),l?.start()}),V=()=>{i.forEach((y)=>y())},I=()=>{if(!n.reconnectReportPath||typeof fetch>"u")return;let y=g.getSnapshot(),h=JSON.stringify({at:Date.now(),reconnect:y.reconnect,scenarioId:y.scenarioId,sessionId:o.getSessionId(),turnIds:y.turns.map((T)=>T.id)});fetch(n.reconnectReportPath,{body:h,headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST"}).catch(()=>{})},d=o.subscribe((y)=>{let h=q(y);if(h){if(g.dispatch(h),y.type==="connection")I();V()}});return{callControl(y){o.callControl(y)},close(){d(),l?.close(),o.close(),g.dispatch({type:"disconnected"}),V()},endTurn(){o.endTurn()},get error(){return g.getSnapshot().error},getServerSnapshot(){return g.getServerSnapshot()},getSnapshot(){return g.getSnapshot()},get isConnected(){return g.getSnapshot().isConnected},get scenarioId(){return g.getSnapshot().scenarioId},get sessionMetadata(){return g.getSnapshot().sessionMetadata},start:C,get partial(){return g.getSnapshot().partial},get reconnect(){return g.getSnapshot().reconnect},get sessionId(){return o.getSessionId()},get status(){return g.getSnapshot().status},get turns(){return g.getSnapshot().turns},get assistantTexts(){return g.getSnapshot().assistantTexts},get assistantAudio(){return g.getSnapshot().assistantAudio},get call(){return g.getSnapshot().call},sendAudio(y){o.sendAudio(y)},simulateDisconnect(){o.simulateDisconnect()},subscribe(y){return i.add(y),()=>{i.delete(y)}}}};var t=(c)=>{if(!c||c.enabled===!1)return;return{enabled:!0,maxGain:c.maxGain??3,noiseGateAttenuation:c.noiseGateAttenuation??0.15,noiseGateThreshold:c.noiseGateThreshold??0.006,targetLevel:c.targetLevel??0.08}};var Hc={balanced:{qualityProfile:"general",silenceMs:1400,speechThreshold:0.012,transcriptStabilityMs:1000},fast:{qualityProfile:"general",silenceMs:700,speechThreshold:0.015,transcriptStabilityMs:450},"long-form":{qualityProfile:"general",silenceMs:2200,speechThreshold:0.01,transcriptStabilityMs:1500}},Gc={general:{},"accent-heavy":{silenceMs:1200,speechThreshold:0.01,transcriptStabilityMs:1200},"noisy-room":{silenceMs:2000,speechThreshold:0.02,transcriptStabilityMs:1600},"short-command":{silenceMs:500,speechThreshold:0.016,transcriptStabilityMs:420}};var F=(c)=>{let n=c?.profile??"fast",o=c?.qualityProfile??"general",g=Hc[n],l=Gc[o];return{profile:n,qualityProfile:o,silenceMs:c?.silenceMs??l.silenceMs??g.silenceMs,speechThreshold:c?.speechThreshold??l.speechThreshold??g.speechThreshold,transcriptStabilityMs:c?.transcriptStabilityMs??l.transcriptStabilityMs??g.transcriptStabilityMs}};var Xc={chat:{audioConditioning:{enabled:!0,maxGain:2.5,noiseGateAttenuation:0,noiseGateThreshold:0.004,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:10,pingInterval:30000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"short-command",profile:"balanced"}},default:{capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:10,pingInterval:30000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"general",profile:"fast"}},dictation:{audioConditioning:{enabled:!0,maxGain:2.25,noiseGateAttenuation:0.05,noiseGateThreshold:0.003,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:12,pingInterval:30000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"accent-heavy",profile:"long-form"}},"guided-intake":{audioConditioning:{enabled:!0,maxGain:2.5,noiseGateAttenuation:0,noiseGateThreshold:0.004,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:12,pingInterval:30000,reconnect:!0},sttLifecycle:"turn-scoped",turnDetection:{qualityProfile:"accent-heavy",profile:"long-form"}},"noisy-room":{audioConditioning:{enabled:!0,maxGain:3,noiseGateAttenuation:0.12,noiseGateThreshold:0.006,targetLevel:0.085},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:14,pingInterval:45000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"noisy-room",profile:"long-form",silenceMs:2100,speechThreshold:0.02,transcriptStabilityMs:1650}},"pstn-balanced":{audioConditioning:{enabled:!0,maxGain:2.8,noiseGateAttenuation:0.07,noiseGateThreshold:0.005,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:14,pingInterval:45000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"noisy-room",profile:"long-form",silenceMs:660,speechThreshold:0.012,transcriptStabilityMs:300}},"pstn-fast":{audioConditioning:{enabled:!0,maxGain:2.75,noiseGateAttenuation:0.06,noiseGateThreshold:0.005,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:14,pingInterval:45000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"noisy-room",profile:"long-form",silenceMs:620,speechThreshold:0.012,transcriptStabilityMs:280}},reliability:{audioConditioning:{enabled:!0,maxGain:2.9,noiseGateAttenuation:0.08,noiseGateThreshold:0.005,targetLevel:0.08},capture:{channelCount:1,sampleRateHz:16000},connection:{maxReconnectAttempts:14,pingInterval:45000,reconnect:!0},sttLifecycle:"continuous",turnDetection:{qualityProfile:"noisy-room",profile:"long-form"}}},r=(c="default")=>{let n=Xc[c];return{audioConditioning:t(n.audioConditioning),capture:{channelCount:n.capture?.channelCount??1,sampleRateHz:n.capture?.sampleRateHz??16000},connection:{...n.connection},name:c,sttLifecycle:n.sttLifecycle??"continuous",turnDetection:F(n.turnDetection)}};var Yc=(c)=>({assistantAudio:[...c.assistantAudio],assistantTexts:[...c.assistantTexts],call:c.call,error:c.error,isConnected:c.isConnected,isRecording:!1,partial:c.partial,reconnect:c.reconnect,recordingError:null,sessionId:c.sessionId,sessionMetadata:c.sessionMetadata,scenarioId:c.scenarioId,status:c.status,turns:[...c.turns]}),a=(c,n={})=>{let o=r(n.preset),g=k(c,{...o.connection,...n.connection}),l=null,i=Yc(g),C=new Set,V=()=>{for(let R of C)R()},I=()=>{if(i={...i,assistantAudio:[...g.assistantAudio],assistantTexts:[...g.assistantTexts],call:g.call,error:g.error,isConnected:g.isConnected,partial:g.partial,reconnect:g.reconnect,sessionId:g.sessionId,sessionMetadata:g.sessionMetadata,scenarioId:g.scenarioId,status:g.status,turns:[...g.turns]},n.autoStopOnComplete!==!1&&i.status==="completed"&&i.isRecording)l?.stop(),l=null,i={...i,isRecording:!1};V()},d=g.subscribe(I);I();let y=()=>{if(l)return l;return l=J({channelCount:n.capture?.channelCount??o.capture.channelCount,onLevel:n.capture?.onLevel,onAudio:(R)=>{if(n.capture?.onAudio){n.capture.onAudio(R,g.sendAudio);return}g.sendAudio(R)},sampleRateHz:n.capture?.sampleRateHz??o.capture.sampleRateHz}),l},h=()=>{l?.stop(),l=null,i={...i,isRecording:!1},V()},T=async()=>{if(i.isRecording)return;try{i={...i,recordingError:null},V(),await y().start(),i={...i,isRecording:!0},V()}catch(R){throw l=null,i={...i,isRecording:!1,recordingError:R instanceof Error?R.message:String(R)},V(),R}};return{bindHTMX(R){return Q(g,R)},callControl:(R)=>g.callControl(R),close:()=>{d(),h(),g.close()},endTurn:()=>g.endTurn(),get error(){return i.error},getServerSnapshot:()=>i,getSnapshot:()=>i,get isConnected(){return i.isConnected},get isRecording(){return i.isRecording},get partial(){return i.partial},get recordingError(){return i.recordingError},get reconnect(){return i.reconnect},sendAudio:(R)=>g.sendAudio(R),simulateDisconnect:()=>g.simulateDisconnect(),get sessionId(){return i.sessionId},get sessionMetadata(){return i.sessionMetadata},get scenarioId(){return i.scenarioId},startRecording:T,get status(){return i.status},stopRecording:h,subscribe:(R)=>{return C.add(R),()=>{C.delete(R)}},toggleRecording:async()=>{if(i.isRecording){h();return}await T()},get turns(){return i.turns},get assistantTexts(){return i.assistantTexts},get assistantAudio(){return i.assistantAudio},get call(){return i.call}}};var s=(c)=>String(c).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'");var v=(c)=>{if(!c.isConnected)return"idle";if(c.isPlaying)return"speaking";if(c.isRecording&&c.hasActivePartial)return"listening";if(c.isRecording)return"listening";if(c.lastTranscriptAt&&!c.lastAssistantAt)return"thinking";if(c.lastTranscriptAt&&c.lastAssistantAt&&c.lastTranscriptAt>c.lastAssistantAt)return"thinking";return"idle"};var Qc={accent:"#3b82f6",background:"#0f172a",errorAccent:"#ef4444",fontFamily:'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',foreground:"#f8fafc",radius:16},Jc={callEnded:"Call ended",connecting:"Connecting…",endCall:"End call",idle:"Idle",listening:"Listening",mute:"Mute",speaking:"Speaking",startCall:"Start call",thinking:"Thinking",unmute:"Unmute"},qc=(c,n)=>{switch(c){case"listening":return n.listening;case"speaking":return n.speaking;case"thinking":return n.thinking;case"idle":return n.idle}},u=(c)=>{let n={...Qc,...c.theme},o={...Jc,...c.labels},g=c.state.assistantAudio.at(-1)?.receivedAt,l=c.state.turns.at(-1)?.committedAt,i=v({hasActivePartial:c.state.partial.length>0,isConnected:c.state.isConnected,isPlaying:!1,isRecording:c.state.isRecording,lastAssistantAt:g,lastTranscriptAt:l}),C=!c.state.isConnected&&c.state.status!=="idle"&&!c.state.error,V=c.state.error?"Error":C?o.connecting:c.state.status==="completed"?o.callEnded:qc(i,o);return{agentState:i,classes:{container:`absolute-voice-widget absolute-voice-widget--${i}`,dot:`absolute-voice-widget__dot${c.state.error?" absolute-voice-widget__dot--error":""}`},controls:{canEnd:c.state.isConnected,canMute:c.state.isRecording,canStart:!c.state.isRecording&&c.state.status!=="completed"},errorMessage:c.state.error??void 0,labels:o,partial:c.state.partial||void 0,statusLabel:V,theme:n,title:c.title??"Voice"}},Zc=(c)=>typeof c==="number"?`${c}px`:c,m=(c)=>{let n=c.theme,o=`background:${n.background};border-radius:${Zc(n.radius)};color:${n.foreground};font-family:${n.fontFamily};min-width:240px;padding:20px 22px;`,g=`background:${c.errorMessage?n.errorAccent:c.agentState==="idle"?"rgba(148,163,184,0.6)":n.accent};border-radius:50%;height:10px;width:10px;`,l=[];if(c.controls.canStart)l.push(`<button type="button" data-action="start" style="background:${n.accent};border:none;border-radius:12px;color:${n.foreground};cursor:pointer;font-size:14px;font-weight:500;padding:10px 14px;">${s(c.labels.startCall)}</button>`);if(c.controls.canMute)l.push(`<button type="button" data-action="mute" style="background:transparent;border:1px solid rgba(255,255,255,0.18);border-radius:12px;color:${n.foreground};cursor:pointer;font-size:14px;font-weight:500;padding:10px 14px;">${s(c.labels.mute)}</button>`);if(c.controls.canEnd)l.push(`<button type="button" data-action="end" style="background:${n.errorAccent};border:none;border-radius:12px;color:${n.foreground};cursor:pointer;font-size:14px;font-weight:500;padding:10px 14px;">${s(c.labels.endCall)}</button>`);return`<div role="region" aria-live="polite" data-agent-state="${c.agentState}" class="${s(c.classes.container)}" style="${o}">
|
|
2
2
|
<div style="align-items:center;display:flex;gap:10px;margin-bottom:12px;">
|
|
3
3
|
<span aria-hidden="true" class="${s(c.classes.dot)}" style="${g}"></span>
|
|
4
4
|
<strong style="font-size:15px;">${s(c.title)}</strong>
|