@absolutejs/voice 0.0.22-beta.50 → 0.0.22-beta.500

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.
Files changed (391) hide show
  1. package/README.md +4556 -603
  2. package/dist/agent.d.ts +79 -5
  3. package/dist/agentSquadContract.d.ts +98 -0
  4. package/dist/agentState.d.ts +12 -0
  5. package/dist/agentTools.d.ts +133 -0
  6. package/dist/aiVoiceModel.d.ts +15 -0
  7. package/dist/amdDetector.d.ts +25 -0
  8. package/dist/angular/index.d.ts +26 -5
  9. package/dist/angular/index.js +3350 -313
  10. package/dist/angular/voice-agent-squad-status.service.d.ts +12 -0
  11. package/dist/angular/voice-call-debugger.service.d.ts +12 -0
  12. package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
  13. package/dist/angular/voice-controller.service.d.ts +3 -1
  14. package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
  15. package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
  16. package/dist/angular/voice-live-ops.service.d.ts +11 -0
  17. package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
  18. package/dist/angular/voice-ops-status.component.d.ts +15 -0
  19. package/dist/angular/voice-ops-status.service.d.ts +12 -0
  20. package/dist/angular/voice-platform-coverage.service.d.ts +12 -0
  21. package/dist/angular/voice-profile-comparison.service.d.ts +12 -0
  22. package/dist/angular/voice-proof-trends.service.d.ts +12 -0
  23. package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
  24. package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
  25. package/dist/angular/voice-provider-status.service.d.ts +2 -2
  26. package/dist/angular/voice-readiness-failures.service.d.ts +13 -0
  27. package/dist/angular/voice-reconnect-profile-evidence.service.d.ts +12 -0
  28. package/dist/angular/voice-routing-status.service.d.ts +11 -0
  29. package/dist/angular/voice-session-observability.service.d.ts +12 -0
  30. package/dist/angular/voice-session-snapshot.service.d.ts +13 -0
  31. package/dist/angular/voice-stream.service.d.ts +4 -1
  32. package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
  33. package/dist/angular/voice-turn-latency.service.d.ts +13 -0
  34. package/dist/angular/voice-turn-quality.service.d.ts +12 -0
  35. package/dist/angular/voice-widget.service.d.ts +18 -0
  36. package/dist/angular/voice-workflow-status.service.d.ts +2 -2
  37. package/dist/assistant.d.ts +12 -13
  38. package/dist/assistantHealth.d.ts +6 -6
  39. package/dist/assistantMemory.d.ts +3 -3
  40. package/dist/assistantMode.d.ts +22 -0
  41. package/dist/audioConditioning.d.ts +1 -1
  42. package/dist/audit.d.ts +131 -0
  43. package/dist/auditDeliveryRoutes.d.ts +85 -0
  44. package/dist/auditExport.d.ts +34 -0
  45. package/dist/auditRoutes.d.ts +66 -0
  46. package/dist/auditSinks.d.ts +151 -0
  47. package/dist/backchannel.d.ts +18 -0
  48. package/dist/bargeInRoutes.d.ts +56 -0
  49. package/dist/browserCallProfiles.d.ts +120 -0
  50. package/dist/browserMediaRoutes.d.ts +62 -0
  51. package/dist/callDebugger.d.ts +66 -0
  52. package/dist/callQuota.d.ts +54 -0
  53. package/dist/callerMemory.d.ts +37 -0
  54. package/dist/campaign.d.ts +794 -0
  55. package/dist/campaignControls.d.ts +37 -0
  56. package/dist/campaignDialers.d.ts +111 -0
  57. package/dist/client/actions.d.ts +95 -1
  58. package/dist/client/agentSquadStatus.d.ts +37 -0
  59. package/dist/client/agentSquadStatusWidget.d.ts +24 -0
  60. package/dist/client/audioPlayer.d.ts +2 -2
  61. package/dist/client/bargeInMonitor.d.ts +7 -0
  62. package/dist/client/browserMedia.d.ts +8 -0
  63. package/dist/client/callDebugger.d.ts +19 -0
  64. package/dist/client/callDebuggerWidget.d.ts +30 -0
  65. package/dist/client/campaignDialerProof.d.ts +23 -0
  66. package/dist/client/connection.d.ts +4 -3
  67. package/dist/client/controller.d.ts +1 -1
  68. package/dist/client/costDashboard.d.ts +27 -0
  69. package/dist/client/createVoiceStream.d.ts +1 -1
  70. package/dist/client/deliveryRuntime.d.ts +34 -0
  71. package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
  72. package/dist/client/duplex.d.ts +2 -2
  73. package/dist/client/htmx.d.ts +1 -1
  74. package/dist/client/htmxBootstrap.js +967 -14
  75. package/dist/client/index.d.ts +104 -13
  76. package/dist/client/index.js +10142 -26
  77. package/dist/client/liveCallViewer.d.ts +42 -0
  78. package/dist/client/liveOps.d.ts +22 -0
  79. package/dist/client/liveOpsWidget.d.ts +23 -0
  80. package/dist/client/liveTurnLatency.d.ts +41 -0
  81. package/dist/client/microphone.d.ts +4 -4
  82. package/dist/client/opsActionCenter.d.ts +54 -0
  83. package/dist/client/opsActionCenterWidget.d.ts +29 -0
  84. package/dist/client/opsActionHistory.d.ts +19 -0
  85. package/dist/client/opsActionHistoryWidget.d.ts +11 -0
  86. package/dist/client/opsStatus.d.ts +19 -0
  87. package/dist/client/opsStatusWidget.d.ts +40 -0
  88. package/dist/client/platformCoverage.d.ts +19 -0
  89. package/dist/client/platformCoverageWidget.d.ts +37 -0
  90. package/dist/client/profileComparison.d.ts +19 -0
  91. package/dist/client/profileComparisonWidget.d.ts +41 -0
  92. package/dist/client/profileSwitchRecommendation.d.ts +19 -0
  93. package/dist/client/profileSwitchRecommendationWidget.d.ts +12 -0
  94. package/dist/client/proofTrends.d.ts +19 -0
  95. package/dist/client/proofTrendsWidget.d.ts +37 -0
  96. package/dist/client/providerCapabilities.d.ts +19 -0
  97. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  98. package/dist/client/providerContracts.d.ts +19 -0
  99. package/dist/client/providerContractsWidget.d.ts +37 -0
  100. package/dist/client/providerSimulationControls.d.ts +33 -0
  101. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  102. package/dist/client/providerStatus.d.ts +1 -1
  103. package/dist/client/providerStatusWidget.d.ts +32 -0
  104. package/dist/client/readinessFailures.d.ts +19 -0
  105. package/dist/client/readinessFailuresWidget.d.ts +42 -0
  106. package/dist/client/reconnectProfileEvidence.d.ts +19 -0
  107. package/dist/client/reconnectProfileEvidenceWidget.d.ts +39 -0
  108. package/dist/client/replayTimeline.d.ts +26 -0
  109. package/dist/client/routingStatus.d.ts +19 -0
  110. package/dist/client/routingStatusWidget.d.ts +32 -0
  111. package/dist/client/sessionObservability.d.ts +19 -0
  112. package/dist/client/sessionObservabilityWidget.d.ts +31 -0
  113. package/dist/client/sessionSnapshot.d.ts +21 -0
  114. package/dist/client/sessionSnapshotWidget.d.ts +33 -0
  115. package/dist/client/store.d.ts +1 -1
  116. package/dist/client/traceTimeline.d.ts +19 -0
  117. package/dist/client/traceTimelineWidget.d.ts +36 -0
  118. package/dist/client/turnLatency.d.ts +22 -0
  119. package/dist/client/turnLatencyWidget.d.ts +33 -0
  120. package/dist/client/turnQuality.d.ts +19 -0
  121. package/dist/client/turnQualityWidget.d.ts +32 -0
  122. package/dist/client/voiceWidgetView.d.ts +50 -0
  123. package/dist/client/workflowStatus.d.ts +1 -1
  124. package/dist/competitiveCoverage.d.ts +141 -0
  125. package/dist/correction.d.ts +2 -2
  126. package/dist/costAccounting.d.ts +76 -0
  127. package/dist/dataControl.d.ts +180 -0
  128. package/dist/defineVoiceAssistant.d.ts +68 -0
  129. package/dist/deliveryRuntime.d.ts +158 -0
  130. package/dist/deliverySinkRoutes.d.ts +117 -0
  131. package/dist/demoReadyRoutes.d.ts +98 -0
  132. package/dist/diagnosticsRoutes.d.ts +2 -2
  133. package/dist/evalRoutes.d.ts +10 -4
  134. package/dist/fileStore.d.ts +21 -7
  135. package/dist/generated/htmxBootstrapBundle.d.ts +1 -0
  136. package/dist/guardrails.d.ts +128 -0
  137. package/dist/handoff.d.ts +6 -6
  138. package/dist/handoffHealth.d.ts +5 -5
  139. package/dist/htmx.d.ts +1 -1
  140. package/dist/incidentBundle.d.ts +119 -0
  141. package/dist/incidentTimeline.d.ts +260 -0
  142. package/dist/index.d.ts +278 -74
  143. package/dist/index.js +40611 -6669
  144. package/dist/ivrPlan.d.ts +40 -0
  145. package/dist/latencySlo.d.ts +56 -0
  146. package/dist/liveLatency.d.ts +78 -0
  147. package/dist/liveOps.d.ts +190 -0
  148. package/dist/llmJudge.d.ts +45 -0
  149. package/dist/logger.d.ts +1 -1
  150. package/dist/mediaPipelineRoutes.d.ts +171 -0
  151. package/dist/mediaPipelineSurfaces.d.ts +48 -0
  152. package/dist/memoryStore.d.ts +1 -1
  153. package/dist/midCallSummary.d.ts +27 -0
  154. package/dist/modelAdapters.d.ts +59 -7
  155. package/dist/monitor.d.ts +148 -0
  156. package/dist/multilingualProof.d.ts +77 -0
  157. package/dist/oauth2TokenSource.d.ts +21 -0
  158. package/dist/observabilityExport.d.ts +501 -0
  159. package/dist/openaiTTS.d.ts +18 -0
  160. package/dist/operationalStatus.d.ts +87 -0
  161. package/dist/operationsRecord.d.ts +370 -0
  162. package/dist/ops.d.ts +12 -12
  163. package/dist/opsActionAuditRoutes.d.ts +99 -0
  164. package/dist/opsConsoleRoutes.d.ts +8 -5
  165. package/dist/opsPresets.d.ts +2 -2
  166. package/dist/opsRecovery.d.ts +137 -0
  167. package/dist/opsRuntime.d.ts +6 -6
  168. package/dist/opsSinks.d.ts +13 -13
  169. package/dist/opsStatus.d.ts +76 -0
  170. package/dist/opsStatusRoutes.d.ts +33 -0
  171. package/dist/opsWebhook.d.ts +6 -6
  172. package/dist/otelExporter.d.ts +83 -0
  173. package/dist/outcomeContract.d.ts +146 -0
  174. package/dist/outcomeRecipes.d.ts +4 -4
  175. package/dist/phoneAgent.d.ts +139 -0
  176. package/dist/phoneAgentProductionSmoke.d.ts +115 -0
  177. package/dist/platformCoverage.d.ts +91 -0
  178. package/dist/plugin.d.ts +2 -2
  179. package/dist/postCallAnalysis.d.ts +98 -0
  180. package/dist/postgresStore.d.ts +17 -6
  181. package/dist/presets.d.ts +3 -3
  182. package/dist/productionReadiness.d.ts +756 -0
  183. package/dist/profileSwitchRecommendation.d.ts +350 -0
  184. package/dist/proofAssertions.d.ts +32 -0
  185. package/dist/proofPack.d.ts +211 -0
  186. package/dist/proofRunner.d.ts +79 -0
  187. package/dist/proofTrends.d.ts +966 -0
  188. package/dist/providerAdapters.d.ts +16 -5
  189. package/dist/providerCapabilities.d.ts +92 -0
  190. package/dist/providerDecisionTraces.d.ts +130 -0
  191. package/dist/providerHealth.d.ts +3 -3
  192. package/dist/providerOrchestration.d.ts +109 -0
  193. package/dist/providerRouterTraces.d.ts +35 -0
  194. package/dist/providerRoutingContract.d.ts +71 -0
  195. package/dist/providerSlo.d.ts +142 -0
  196. package/dist/providerStackRecommendations.d.ts +187 -0
  197. package/dist/qualityRoutes.d.ts +4 -4
  198. package/dist/queue.d.ts +23 -14
  199. package/dist/ragTool.d.ts +57 -0
  200. package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
  201. package/dist/react/VoiceCallDebuggerLaunch.d.ts +6 -0
  202. package/dist/react/VoiceCostDashboard.d.ts +10 -0
  203. package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
  204. package/dist/react/VoiceLiveCallViewer.d.ts +9 -0
  205. package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
  206. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  207. package/dist/react/VoicePlatformCoverage.d.ts +6 -0
  208. package/dist/react/VoiceProfileComparison.d.ts +6 -0
  209. package/dist/react/VoiceProfileSwitchRecommendation.d.ts +6 -0
  210. package/dist/react/VoiceProofTrends.d.ts +6 -0
  211. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  212. package/dist/react/VoiceProviderContracts.d.ts +6 -0
  213. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  214. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  215. package/dist/react/VoiceReadinessFailures.d.ts +6 -0
  216. package/dist/react/VoiceReconnectProfileEvidence.d.ts +6 -0
  217. package/dist/react/VoiceReplayTimeline.d.ts +6 -0
  218. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  219. package/dist/react/VoiceSessionObservability.d.ts +6 -0
  220. package/dist/react/VoiceSessionSnapshot.d.ts +6 -0
  221. package/dist/react/VoiceTraceTimeline.d.ts +6 -0
  222. package/dist/react/VoiceTurnLatency.d.ts +6 -0
  223. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  224. package/dist/react/VoiceWidget.d.ts +13 -0
  225. package/dist/react/index.d.ts +55 -5
  226. package/dist/react/index.js +12037 -106
  227. package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
  228. package/dist/react/useVoiceCallDebugger.d.ts +8 -0
  229. package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
  230. package/dist/react/useVoiceController.d.ts +4 -1
  231. package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
  232. package/dist/react/useVoiceLiveOps.d.ts +9 -0
  233. package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
  234. package/dist/react/useVoiceOpsStatus.d.ts +8 -0
  235. package/dist/react/useVoicePlatformCoverage.d.ts +8 -0
  236. package/dist/react/useVoiceProfileComparison.d.ts +8 -0
  237. package/dist/react/useVoiceProfileSwitchRecommendation.d.ts +8 -0
  238. package/dist/react/useVoiceProofTrends.d.ts +8 -0
  239. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  240. package/dist/react/useVoiceProviderContracts.d.ts +8 -0
  241. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  242. package/dist/react/useVoiceProviderStatus.d.ts +1 -1
  243. package/dist/react/useVoiceReadinessFailures.d.ts +8 -0
  244. package/dist/react/useVoiceReconnectProfileEvidence.d.ts +8 -0
  245. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  246. package/dist/react/useVoiceSessionObservability.d.ts +8 -0
  247. package/dist/react/useVoiceSessionSnapshot.d.ts +9 -0
  248. package/dist/react/useVoiceStream.d.ts +4 -1
  249. package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
  250. package/dist/react/useVoiceTurnLatency.d.ts +9 -0
  251. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  252. package/dist/react/useVoiceWorkflowStatus.d.ts +1 -1
  253. package/dist/readinessProfiles.d.ts +45 -0
  254. package/dist/realtimeChannel.d.ts +136 -0
  255. package/dist/realtimeProviderContracts.d.ts +133 -0
  256. package/dist/reconnectContract.d.ts +176 -0
  257. package/dist/recordingRedaction.d.ts +18 -0
  258. package/dist/recordingStore.d.ts +60 -0
  259. package/dist/redaction.d.ts +13 -0
  260. package/dist/resilienceRoutes.d.ts +45 -5
  261. package/dist/retention.d.ts +37 -0
  262. package/dist/routeAuth.d.ts +58 -0
  263. package/dist/routing.d.ts +1 -1
  264. package/dist/runtimeOps.d.ts +3 -3
  265. package/dist/s3Store.d.ts +18 -3
  266. package/dist/semanticTurn.d.ts +27 -0
  267. package/dist/session.d.ts +1 -1
  268. package/dist/sessionObservability.d.ts +145 -0
  269. package/dist/sessionReplay.d.ts +19 -7
  270. package/dist/sessionSnapshot.d.ts +109 -0
  271. package/dist/simulationSuite.d.ts +143 -0
  272. package/dist/sloCalibration.d.ts +185 -0
  273. package/dist/sqliteStore.d.ts +17 -6
  274. package/dist/store.d.ts +1 -1
  275. package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
  276. package/dist/svelte/createVoiceCallDebugger.d.ts +12 -0
  277. package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
  278. package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
  279. package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
  280. package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
  281. package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
  282. package/dist/svelte/createVoicePlatformCoverage.d.ts +7 -0
  283. package/dist/svelte/createVoiceProfileComparison.d.ts +7 -0
  284. package/dist/svelte/createVoiceProofTrends.d.ts +7 -0
  285. package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
  286. package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
  287. package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
  288. package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
  289. package/dist/svelte/createVoiceReadinessFailures.d.ts +7 -0
  290. package/dist/svelte/createVoiceReconnectProfileEvidence.d.ts +7 -0
  291. package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
  292. package/dist/svelte/createVoiceSessionObservability.d.ts +10 -0
  293. package/dist/svelte/createVoiceSessionSnapshot.d.ts +13 -0
  294. package/dist/svelte/createVoiceStream.d.ts +1 -1
  295. package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
  296. package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
  297. package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
  298. package/dist/svelte/createVoiceWidget.d.ts +19 -0
  299. package/dist/svelte/createVoiceWorkflowStatus.d.ts +1 -1
  300. package/dist/svelte/index.d.ts +27 -5
  301. package/dist/svelte/index.js +6117 -546
  302. package/dist/telephony/contract.d.ts +61 -0
  303. package/dist/telephony/matrix.d.ts +97 -0
  304. package/dist/telephony/plivo.d.ts +303 -0
  305. package/dist/telephony/response.d.ts +1 -1
  306. package/dist/telephony/security.d.ts +182 -0
  307. package/dist/telephony/telnyx.d.ts +291 -0
  308. package/dist/telephony/twilio.d.ts +147 -13
  309. package/dist/telephonyMediaRoutes.d.ts +72 -0
  310. package/dist/telephonyOutcome.d.ts +273 -0
  311. package/dist/testing/accuracy.d.ts +1 -1
  312. package/dist/testing/benchmark.d.ts +9 -9
  313. package/dist/testing/corrected.d.ts +5 -5
  314. package/dist/testing/duplex.d.ts +3 -3
  315. package/dist/testing/fixtures.d.ts +3 -3
  316. package/dist/testing/index.d.ts +13 -13
  317. package/dist/testing/index.js +5223 -159
  318. package/dist/testing/ioProviderSimulator.d.ts +5 -5
  319. package/dist/testing/providerSimulator.d.ts +5 -5
  320. package/dist/testing/review.d.ts +4 -4
  321. package/dist/testing/sessionBenchmark.d.ts +3 -3
  322. package/dist/testing/stt.d.ts +3 -3
  323. package/dist/testing/telephony.d.ts +25 -0
  324. package/dist/testing/tts.d.ts +1 -1
  325. package/dist/toolContract.d.ts +161 -0
  326. package/dist/toolRuntime.d.ts +50 -0
  327. package/dist/trace.d.ts +46 -7
  328. package/dist/traceDeliveryRoutes.d.ts +86 -0
  329. package/dist/traceTimeline.d.ts +97 -0
  330. package/dist/turnDetection.d.ts +1 -1
  331. package/dist/turnLatency.d.ts +95 -0
  332. package/dist/turnProfiles.d.ts +2 -2
  333. package/dist/turnQuality.d.ts +94 -0
  334. package/dist/types.d.ts +293 -80
  335. package/dist/vapiAdapter.d.ts +160 -0
  336. package/dist/voiceMonitoring.d.ts +444 -0
  337. package/dist/vue/VoiceCallDebuggerLaunch.d.ts +68 -0
  338. package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
  339. package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
  340. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  341. package/dist/vue/VoicePlatformCoverage.d.ts +23 -0
  342. package/dist/vue/VoiceProofTrends.d.ts +21 -0
  343. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  344. package/dist/vue/VoiceProviderContracts.d.ts +21 -0
  345. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  346. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  347. package/dist/vue/VoiceReadinessFailures.d.ts +21 -0
  348. package/dist/vue/VoiceReconnectProfileEvidence.d.ts +21 -0
  349. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  350. package/dist/vue/VoiceSessionObservability.d.ts +23 -0
  351. package/dist/vue/VoiceSessionSnapshot.d.ts +68 -0
  352. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  353. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  354. package/dist/vue/VoiceWidget.d.ts +77 -0
  355. package/dist/vue/index.d.ts +44 -5
  356. package/dist/vue/index.js +10752 -143
  357. package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
  358. package/dist/vue/useVoiceCallDebugger.d.ts +10 -0
  359. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  360. package/dist/vue/useVoiceController.d.ts +4 -2
  361. package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
  362. package/dist/vue/useVoiceLiveOps.d.ts +9 -0
  363. package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
  364. package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
  365. package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
  366. package/dist/vue/useVoiceProfileComparison.d.ts +9 -0
  367. package/dist/vue/useVoiceProofTrends.d.ts +9 -0
  368. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  369. package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
  370. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  371. package/dist/vue/useVoiceProviderStatus.d.ts +3 -3
  372. package/dist/vue/useVoiceReadinessFailures.d.ts +959 -0
  373. package/dist/vue/useVoiceReconnectProfileEvidence.d.ts +9 -0
  374. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  375. package/dist/vue/useVoiceSessionObservability.d.ts +9 -0
  376. package/dist/vue/useVoiceSessionSnapshot.d.ts +10 -0
  377. package/dist/vue/useVoiceStream.d.ts +5 -2
  378. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  379. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  380. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  381. package/dist/vue/useVoiceWorkflowStatus.d.ts +3 -3
  382. package/dist/webhookVerification.d.ts +27 -0
  383. package/dist/workflowContract.d.ts +8 -8
  384. package/fixtures/manifest.json +356 -197
  385. package/package.json +265 -256
  386. package/dist/angular/voice-app-kit-status.service.d.ts +0 -12
  387. package/dist/appKit.d.ts +0 -83
  388. package/dist/client/appKitStatus.d.ts +0 -19
  389. package/dist/react/useVoiceAppKitStatus.d.ts +0 -8
  390. package/dist/svelte/createVoiceAppKitStatus.d.ts +0 -8
  391. package/dist/vue/useVoiceAppKitStatus.d.ts +0 -9
@@ -0,0 +1,117 @@
1
+ import { Elysia } from "elysia";
2
+ import { type VoiceAuditSinkDeliveryStore, type VoiceAuditSinkDeliveryQueueSummary } from "./auditSinks";
3
+ import { type VoiceTraceSinkDeliveryQueueSummary } from "./queue";
4
+ import type { VoiceTraceSinkDeliveryStore } from "./trace";
5
+ export type VoiceDeliverySinkKind = "file" | "postgres" | "s3" | "sqlite" | "webhook" | (string & {});
6
+ export type VoiceDeliverySinkDescriptor = {
7
+ description?: string;
8
+ href?: string;
9
+ id: string;
10
+ kind: VoiceDeliverySinkKind;
11
+ label: string;
12
+ mode?: string;
13
+ target?: string;
14
+ };
15
+ export type VoiceDeliverySinkDescriptorInput = {
16
+ description?: string;
17
+ href?: string;
18
+ id?: string;
19
+ kind: VoiceDeliverySinkKind;
20
+ label?: string;
21
+ mode?: string;
22
+ target?: string;
23
+ };
24
+ export type VoiceDeliverySinkPairOptions = {
25
+ auditHref?: string;
26
+ auditId?: string;
27
+ auditLabel?: string;
28
+ description?: string;
29
+ kind: VoiceDeliverySinkKind;
30
+ mode?: string;
31
+ target?: string;
32
+ traceHref?: string;
33
+ traceId?: string;
34
+ traceLabel?: string;
35
+ };
36
+ export type VoiceDeliverySinkReport = {
37
+ auditDeliveries?: VoiceTraceDeliverySinkSurface<VoiceAuditSinkDeliveryQueueSummary>;
38
+ checkedAt: number;
39
+ sinks: VoiceDeliverySinkDescriptor[];
40
+ status: "fail" | "pass" | "warn";
41
+ traceDeliveries?: VoiceTraceDeliverySinkSurface<VoiceTraceSinkDeliveryQueueSummary>;
42
+ };
43
+ export type VoiceTraceDeliverySinkSurface<TSummary> = {
44
+ href?: string;
45
+ label: string;
46
+ summary: TSummary;
47
+ };
48
+ export type VoiceDeliverySinkRoutesOptions = {
49
+ auditDeliveries?: {
50
+ href?: string;
51
+ label?: string;
52
+ store: VoiceAuditSinkDeliveryStore;
53
+ };
54
+ headers?: HeadersInit;
55
+ htmlPath?: false | string;
56
+ name?: string;
57
+ path?: string;
58
+ render?: (report: VoiceDeliverySinkReport) => string | Promise<string>;
59
+ sinks?: readonly VoiceDeliverySinkDescriptor[];
60
+ title?: string;
61
+ traceDeliveries?: {
62
+ href?: string;
63
+ label?: string;
64
+ store: VoiceTraceSinkDeliveryStore;
65
+ };
66
+ };
67
+ export declare const createVoiceDeliverySinkDescriptor: (input: VoiceDeliverySinkDescriptorInput) => VoiceDeliverySinkDescriptor;
68
+ export declare const createVoiceFileDeliverySink: (input?: Omit<VoiceDeliverySinkDescriptorInput, "kind">) => VoiceDeliverySinkDescriptor;
69
+ export declare const createVoiceWebhookDeliverySink: (input?: Omit<VoiceDeliverySinkDescriptorInput, "kind">) => VoiceDeliverySinkDescriptor;
70
+ export declare const createVoiceS3DeliverySink: (input?: Omit<VoiceDeliverySinkDescriptorInput, "kind">) => VoiceDeliverySinkDescriptor;
71
+ export declare const createVoicePostgresDeliverySink: (input?: Omit<VoiceDeliverySinkDescriptorInput, "kind">) => VoiceDeliverySinkDescriptor;
72
+ export declare const createVoiceSQLiteDeliverySink: (input?: Omit<VoiceDeliverySinkDescriptorInput, "kind">) => VoiceDeliverySinkDescriptor;
73
+ export declare const createVoiceDeliverySinkPair: (options: VoiceDeliverySinkPairOptions) => VoiceDeliverySinkDescriptor[];
74
+ export declare const buildVoiceDeliverySinkReport: (options: VoiceDeliverySinkRoutesOptions) => Promise<VoiceDeliverySinkReport>;
75
+ export declare const renderVoiceDeliverySinkHTML: (report: VoiceDeliverySinkReport, options?: {
76
+ title?: string;
77
+ }) => string;
78
+ export declare const createVoiceDeliverySinkRoutes: (options: VoiceDeliverySinkRoutesOptions) => Elysia<"", {
79
+ decorator: {};
80
+ store: {};
81
+ derive: {};
82
+ resolve: {};
83
+ }, {
84
+ typebox: {};
85
+ error: {};
86
+ }, {
87
+ schema: {};
88
+ standaloneSchema: {};
89
+ macro: {};
90
+ macroFn: {};
91
+ parser: {};
92
+ response: {};
93
+ }, {
94
+ [x: string]: {
95
+ get: {
96
+ body: unknown;
97
+ params: {};
98
+ query: unknown;
99
+ headers: unknown;
100
+ response: {
101
+ 200: VoiceDeliverySinkReport;
102
+ };
103
+ };
104
+ };
105
+ }, {
106
+ derive: {};
107
+ resolve: {};
108
+ schema: {};
109
+ standaloneSchema: {};
110
+ response: {};
111
+ }, {
112
+ derive: {};
113
+ resolve: {};
114
+ schema: {};
115
+ standaloneSchema: {};
116
+ response: {};
117
+ }>;
@@ -0,0 +1,98 @@
1
+ import { Elysia } from "elysia";
2
+ import type { VoiceOpsStatusReport } from "./opsStatus";
3
+ import type { VoicePhoneAgentProductionSmokeReport } from "./phoneAgentProductionSmoke";
4
+ import type { VoicePhoneAgentSetupReport } from "./phoneAgent";
5
+ import type { VoiceProductionReadinessReport } from "./productionReadiness";
6
+ export type VoiceDemoReadyStatus = "fail" | "pass" | "warn";
7
+ export type VoiceDemoReadySection = {
8
+ description?: string;
9
+ href?: string;
10
+ label: string;
11
+ status: VoiceDemoReadyStatus;
12
+ value?: number | string;
13
+ };
14
+ export type VoiceDemoReadyReport = {
15
+ checkedAt: number;
16
+ sections: VoiceDemoReadySection[];
17
+ status: VoiceDemoReadyStatus;
18
+ summary: {
19
+ opsStatus?: Pick<VoiceOpsStatusReport, "failed" | "passed" | "status" | "total">;
20
+ phoneSetup?: {
21
+ carriers: number;
22
+ ready: boolean;
23
+ };
24
+ phoneSmoke?: {
25
+ issues: number;
26
+ pass: boolean;
27
+ provider?: string;
28
+ sessionId?: string;
29
+ };
30
+ productionReadiness?: {
31
+ checks: number;
32
+ status: VoiceProductionReadinessReport["status"];
33
+ };
34
+ };
35
+ title: string;
36
+ };
37
+ type VoiceDemoReadyLoader<TValue> = TValue | ((input: {
38
+ query: Record<string, unknown>;
39
+ request: Request;
40
+ }) => Promise<TValue | undefined> | TValue | undefined);
41
+ export type VoiceDemoReadyRoutesOptions = {
42
+ opsStatus?: false | {
43
+ href?: string;
44
+ load: VoiceDemoReadyLoader<VoiceOpsStatusReport>;
45
+ };
46
+ headers?: HeadersInit;
47
+ htmlPath?: false | string;
48
+ name?: string;
49
+ path?: string;
50
+ phoneSetup?: false | {
51
+ href?: string;
52
+ load: VoiceDemoReadyLoader<VoicePhoneAgentSetupReport>;
53
+ };
54
+ phoneSmoke?: false | {
55
+ href?: string;
56
+ load: VoiceDemoReadyLoader<VoicePhoneAgentProductionSmokeReport>;
57
+ };
58
+ productionReadiness?: false | {
59
+ href?: string;
60
+ load: VoiceDemoReadyLoader<VoiceProductionReadinessReport>;
61
+ };
62
+ render?: (report: VoiceDemoReadyReport) => Promise<string> | string;
63
+ title?: string;
64
+ };
65
+ export declare const buildVoiceDemoReadyReport: (options: VoiceDemoReadyRoutesOptions, input?: {
66
+ query?: Record<string, unknown>;
67
+ request?: Request;
68
+ }) => Promise<VoiceDemoReadyReport>;
69
+ export declare const renderVoiceDemoReadyHTML: (report: VoiceDemoReadyReport) => string;
70
+ export declare const createVoiceDemoReadyRoutes: (options: VoiceDemoReadyRoutesOptions) => Elysia<"", {
71
+ decorator: {};
72
+ store: {};
73
+ derive: {};
74
+ resolve: {};
75
+ }, {
76
+ typebox: {};
77
+ error: {};
78
+ }, {
79
+ schema: {};
80
+ standaloneSchema: {};
81
+ macro: {};
82
+ macroFn: {};
83
+ parser: {};
84
+ response: {};
85
+ }, {}, {
86
+ derive: {};
87
+ resolve: {};
88
+ schema: {};
89
+ standaloneSchema: {};
90
+ response: {};
91
+ }, {
92
+ derive: {};
93
+ resolve: {};
94
+ schema: {};
95
+ standaloneSchema: {};
96
+ response: {};
97
+ }>;
98
+ export {};
@@ -1,5 +1,5 @@
1
- import { Elysia } from 'elysia';
2
- import { evaluateVoiceTrace, type StoredVoiceTraceEvent, type VoiceTraceEventFilter, type VoiceTraceEventStore, type VoiceTraceRedactionConfig } from './trace';
1
+ import { Elysia } from "elysia";
2
+ import { evaluateVoiceTrace, type StoredVoiceTraceEvent, type VoiceTraceEventFilter, type VoiceTraceEventStore, type VoiceTraceRedactionConfig } from "./trace";
3
3
  export type VoiceDiagnosticsRoutesOptions = {
4
4
  evaluation?: Parameters<typeof evaluateVoiceTrace>[1];
5
5
  headers?: HeadersInit;
@@ -1,10 +1,11 @@
1
- import { Elysia } from 'elysia';
2
- import { type VoiceQualityReport, type VoiceQualityThresholds } from './qualityRoutes';
3
- import { summarizeVoiceTrace, type StoredVoiceTraceEvent, type VoiceTraceEventStore } from './trace';
4
- export type VoiceEvalStatus = 'pass' | 'fail';
1
+ import { Elysia } from "elysia";
2
+ import { type VoiceQualityReport, type VoiceQualityThresholds } from "./qualityRoutes";
3
+ import { summarizeVoiceTrace, type StoredVoiceTraceEvent, type VoiceTraceEventStore } from "./trace";
4
+ export type VoiceEvalStatus = "pass" | "fail";
5
5
  export type VoiceEvalSessionReport = {
6
6
  endedAt?: number;
7
7
  eventCount: number;
8
+ operationsRecordHref?: string;
8
9
  quality: VoiceQualityReport;
9
10
  scenarioId?: string;
10
11
  sessionId: string;
@@ -81,6 +82,7 @@ export type VoiceScenarioEvalDefinition = {
81
82
  export type VoiceScenarioEvalSessionResult = {
82
83
  eventCount: number;
83
84
  issues: string[];
85
+ operationsRecordHref?: string;
84
86
  sessionId: string;
85
87
  status: VoiceEvalStatus;
86
88
  };
@@ -142,6 +144,7 @@ export type VoiceEvalRoutesOptions = {
142
144
  links?: VoiceEvalLink[];
143
145
  limit?: number;
144
146
  name?: string;
147
+ operationsRecordHref?: false | string | ((sessionId: string) => string);
145
148
  path?: string;
146
149
  scenarios?: VoiceScenarioEvalDefinition[];
147
150
  store?: VoiceTraceEventStore;
@@ -151,17 +154,20 @@ export type VoiceEvalRoutesOptions = {
151
154
  export declare const runVoiceSessionEvals: (options?: {
152
155
  events?: StoredVoiceTraceEvent[];
153
156
  limit?: number;
157
+ operationsRecordHref?: false | string | ((sessionId: string) => string);
154
158
  store?: VoiceTraceEventStore;
155
159
  thresholds?: VoiceQualityThresholds;
156
160
  }) => Promise<VoiceEvalReport>;
157
161
  export declare const runVoiceScenarioEvals: (options?: {
158
162
  events?: StoredVoiceTraceEvent[];
163
+ operationsRecordHref?: false | string | ((sessionId: string) => string);
159
164
  scenarios?: VoiceScenarioEvalDefinition[];
160
165
  store?: VoiceTraceEventStore;
161
166
  }) => Promise<VoiceScenarioEvalReport>;
162
167
  export declare const runVoiceScenarioFixtureEvals: (options?: {
163
168
  fixtures?: VoiceScenarioFixture[];
164
169
  fixtureStore?: VoiceScenarioFixtureStore;
170
+ operationsRecordHref?: false | string | ((sessionId: string) => string);
165
171
  scenarios?: VoiceScenarioEvalDefinition[];
166
172
  }) => Promise<VoiceScenarioFixtureEvalReport>;
167
173
  export declare const compareVoiceEvalBaseline: (currentReport: VoiceEvalReport, baselineReport: VoiceEvalReport, options?: VoiceEvalBaselineComparisonOptions) => VoiceEvalBaselineComparison;
@@ -1,15 +1,24 @@
1
- import { type VoiceAssistantMemoryRecord, type VoiceAssistantMemoryStore } from './assistantMemory';
2
- import { type StoredVoiceTraceEvent, type VoiceTraceSinkDeliveryRecord, type VoiceTraceSinkDeliveryStore, type VoiceTraceEventStore } from './trace';
3
- import type { StoredVoiceIntegrationEvent, StoredVoiceExternalObjectMap, StoredVoiceOpsTask, VoiceExternalObjectMap, VoiceExternalObjectMapStore, VoiceIntegrationEvent, VoiceIntegrationEventStore, VoiceOpsTask, VoiceOpsTaskStore } from './ops';
4
- import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from './testing/review';
5
- import type { VoiceSessionRecord, VoiceSessionStore } from './types';
1
+ import { type StoredVoiceAuditEvent, type VoiceAuditEventStore } from "./audit";
2
+ import type { VoiceAuditSinkDeliveryRecord, VoiceAuditSinkDeliveryStore } from "./auditSinks";
3
+ import type { VoiceCampaignStore } from "./campaign";
4
+ import { type VoiceAssistantMemoryRecord, type VoiceAssistantMemoryStore } from "./assistantMemory";
5
+ import type { StoredVoiceIncidentBundleArtifact, VoiceIncidentBundleStore } from "./incidentBundle";
6
+ import { type StoredVoiceTraceEvent, type VoiceTraceSinkDeliveryRecord, type VoiceTraceSinkDeliveryStore, type VoiceTraceEventStore } from "./trace";
7
+ import type { StoredVoiceIntegrationEvent, StoredVoiceExternalObjectMap, StoredVoiceOpsTask, VoiceExternalObjectMap, VoiceExternalObjectMapStore, VoiceIntegrationEvent, VoiceIntegrationEventStore, VoiceOpsTask, VoiceOpsTaskStore } from "./ops";
8
+ import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from "./testing/review";
9
+ import type { VoiceSessionRecord, VoiceSessionStore } from "./types";
10
+ import type { VoiceRecordingStore } from "./recordingStore";
6
11
  export type VoiceFileStoreOptions = {
7
12
  directory: string;
8
13
  pretty?: boolean;
9
14
  };
10
- export type VoiceFileRuntimeStorage<TSession extends VoiceSessionRecord = VoiceSessionRecord, TReview extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact, TTask extends StoredVoiceOpsTask = StoredVoiceOpsTask, TEvent extends StoredVoiceIntegrationEvent = StoredVoiceIntegrationEvent, TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap, TTrace extends StoredVoiceTraceEvent = StoredVoiceTraceEvent, TTraceDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord, TMemory extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord> = {
15
+ export type VoiceFileRuntimeStorage<TSession extends VoiceSessionRecord = VoiceSessionRecord, TReview extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact, TTask extends StoredVoiceOpsTask = StoredVoiceOpsTask, TEvent extends StoredVoiceIntegrationEvent = StoredVoiceIntegrationEvent, TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap, TTrace extends StoredVoiceTraceEvent = StoredVoiceTraceEvent, TTraceDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord, TAudit extends StoredVoiceAuditEvent = StoredVoiceAuditEvent, TAuditDelivery extends VoiceAuditSinkDeliveryRecord = VoiceAuditSinkDeliveryRecord, TIncident extends StoredVoiceIncidentBundleArtifact = StoredVoiceIncidentBundleArtifact, TMemory extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord> = {
16
+ audit: VoiceAuditEventStore<TAudit>;
17
+ auditDeliveries: VoiceAuditSinkDeliveryStore<TAuditDelivery>;
18
+ campaigns: VoiceCampaignStore;
11
19
  events: VoiceIntegrationEventStore<TEvent>;
12
20
  externalObjects: VoiceExternalObjectMapStore<TMapping>;
21
+ incidentBundles: VoiceIncidentBundleStore<TIncident>;
13
22
  memories: VoiceAssistantMemoryStore<TMemory>;
14
23
  reviews: VoiceCallReviewStore<TReview>;
15
24
  session: VoiceSessionStore<TSession>;
@@ -20,12 +29,16 @@ export type VoiceFileRuntimeStorage<TSession extends VoiceSessionRecord = VoiceS
20
29
  export declare const createVoiceFileSessionStore: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceFileStoreOptions) => VoiceSessionStore<TSession>;
21
30
  export declare const createVoiceFileReviewStore: <TArtifact extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact>(options: VoiceFileStoreOptions) => VoiceCallReviewStore<TArtifact>;
22
31
  export declare const createVoiceFileTaskStore: <TTask extends StoredVoiceOpsTask = StoredVoiceOpsTask>(options: VoiceFileStoreOptions) => VoiceOpsTaskStore<TTask>;
32
+ export declare const createVoiceFileCampaignStore: (options: VoiceFileStoreOptions) => VoiceCampaignStore;
23
33
  export declare const createVoiceFileIntegrationEventStore: <TEvent extends StoredVoiceIntegrationEvent = StoredVoiceIntegrationEvent>(options: VoiceFileStoreOptions) => VoiceIntegrationEventStore<TEvent>;
24
34
  export declare const createVoiceFileExternalObjectMapStore: <TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap>(options: VoiceFileStoreOptions) => VoiceExternalObjectMapStore<TMapping>;
25
35
  export declare const createVoiceFileTraceEventStore: <TEvent extends StoredVoiceTraceEvent = StoredVoiceTraceEvent>(options: VoiceFileStoreOptions) => VoiceTraceEventStore<TEvent>;
26
36
  export declare const createVoiceFileTraceSinkDeliveryStore: <TDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord>(options: VoiceFileStoreOptions) => VoiceTraceSinkDeliveryStore<TDelivery>;
37
+ export declare const createVoiceFileAuditEventStore: <TEvent extends StoredVoiceAuditEvent = StoredVoiceAuditEvent>(options: VoiceFileStoreOptions) => VoiceAuditEventStore<TEvent>;
38
+ export declare const createVoiceFileAuditSinkDeliveryStore: <TDelivery extends VoiceAuditSinkDeliveryRecord = VoiceAuditSinkDeliveryRecord>(options: VoiceFileStoreOptions) => VoiceAuditSinkDeliveryStore<TDelivery>;
27
39
  export declare const createVoiceFileAssistantMemoryStore: <TRecord extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord>(options: VoiceFileStoreOptions) => VoiceAssistantMemoryStore<TRecord>;
28
- export declare const createVoiceFileRuntimeStorage: <TSession extends VoiceSessionRecord = VoiceSessionRecord, TReview extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact, TTask extends StoredVoiceOpsTask = StoredVoiceOpsTask, TEvent extends StoredVoiceIntegrationEvent = StoredVoiceIntegrationEvent, TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap, TTrace extends StoredVoiceTraceEvent = StoredVoiceTraceEvent, TTraceDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord, TMemory extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord>(options: VoiceFileStoreOptions) => VoiceFileRuntimeStorage<TSession, TReview, TTask, TEvent, TMapping, TTrace, TTraceDelivery, TMemory>;
40
+ export declare const createVoiceFileIncidentBundleStore: <TArtifact extends StoredVoiceIncidentBundleArtifact = StoredVoiceIncidentBundleArtifact>(options: VoiceFileStoreOptions) => VoiceIncidentBundleStore<TArtifact>;
41
+ export declare const createVoiceFileRuntimeStorage: <TSession extends VoiceSessionRecord = VoiceSessionRecord, TReview extends StoredVoiceCallReviewArtifact = StoredVoiceCallReviewArtifact, TTask extends StoredVoiceOpsTask = StoredVoiceOpsTask, TEvent extends StoredVoiceIntegrationEvent = StoredVoiceIntegrationEvent, TMapping extends StoredVoiceExternalObjectMap = StoredVoiceExternalObjectMap, TTrace extends StoredVoiceTraceEvent = StoredVoiceTraceEvent, TTraceDelivery extends VoiceTraceSinkDeliveryRecord = VoiceTraceSinkDeliveryRecord, TAudit extends StoredVoiceAuditEvent = StoredVoiceAuditEvent, TAuditDelivery extends VoiceAuditSinkDeliveryRecord = VoiceAuditSinkDeliveryRecord, TIncident extends StoredVoiceIncidentBundleArtifact = StoredVoiceIncidentBundleArtifact, TMemory extends VoiceAssistantMemoryRecord = VoiceAssistantMemoryRecord>(options: VoiceFileStoreOptions) => VoiceFileRuntimeStorage<TSession, TReview, TTask, TEvent, TMapping, TTrace, TTraceDelivery, TAudit, TAuditDelivery, TIncident, TMemory>;
29
42
  export declare const createStoredVoiceCallReviewArtifact: <TArtifact extends VoiceCallReviewArtifact = VoiceCallReviewArtifact>(id: string, artifact: TArtifact) => TArtifact & {
30
43
  id: string;
31
44
  };
@@ -38,3 +51,4 @@ export declare const createStoredVoiceIntegrationEvent: <TEvent extends Omit<Voi
38
51
  export declare const createStoredVoiceExternalObjectMap: <TMapping extends Omit<VoiceExternalObjectMap, "id" | "createdAt" | "updatedAt"> = Omit<VoiceExternalObjectMap, "id" | "createdAt" | "updatedAt">>(mapping: TMapping & {
39
52
  at?: number;
40
53
  }) => VoiceExternalObjectMap;
54
+ export declare const createVoiceFileRecordingStore: (options: VoiceFileStoreOptions) => VoiceRecordingStore;
@@ -0,0 +1 @@
1
+ export declare const HTMX_BOOTSTRAP_BUNDLE = "var Nn=(n)=>{if(typeof n!==\"string\")return n;return document.querySelector(n)},Hn=(n,e,o,c)=>{let i=e??n.getAttribute(\"hx-get\")??\"\";if(!i)return\"\";let s=new URL(i,window.location.origin);if(c)s.searchParams.set(o,c);else s.searchParams.delete(o);return`${s.pathname}${s.search}${s.hash}`},gn=(n,e)=>{if(typeof window>\"u\"||typeof document>\"u\")return()=>{};let o=Nn(e.element);if(!o)return()=>{};let c=e.eventName??\"voice-refresh\",i=e.sessionQueryParam??\"sessionId\",s=()=>{let r=window,g=Hn(o,e.route,i,n.sessionId);if(g)o.setAttribute(\"hx-get\",g);r.htmx?.process?.(o),r.htmx?.trigger?.(o,c)},t=n.subscribe(s);return s(),()=>{t()}};var Gn=(n)=>Math.max(-1,Math.min(1,n)),Bn=(n)=>{let e=new Int16Array(n.length);for(let o=0;o<n.length;o+=1){let c=Gn(n[o]??0);e[o]=c<0?c*32768:c*32767}return new Uint8Array(e.buffer)},Wn=(n)=>{let e=n instanceof Uint8Array?n:new Uint8Array(n);if(e.byteLength<2)return 0;let o=new Int16Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/2));if(o.length===0)return 0;let c=0;for(let i of o){let s=i/32768;c+=s*s}return Math.min(1,Math.max(0,Math.sqrt(c/o.length)*5.5))},$n=(n,e,o)=>{if(e===o)return n;let c=e/o,i=Math.round(n.length/c),s=new Float32Array(i),t=0,r=0;while(t<s.length){let g=Math.round((t+1)*c),y=0,d=0;for(let h=r;h<g&&h<n.length;h+=1)y+=n[h]??0,d+=1;s[t]=d>0?y/d:0,t+=1,r=g}return s},An=(n)=>{let e=null,o=null,c=null,i=null;return{start:async()=>{if(typeof navigator>\"u\"||!navigator.mediaDevices?.getUserMedia)throw Error(\"Browser microphone capture requires navigator.mediaDevices.getUserMedia.\");let r=(typeof window<\"u\"?window.AudioContext??window.webkitAudioContext:void 0)??AudioContext;if(!r)throw Error(\"Browser microphone capture requires AudioContext support.\");i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:n.channelCount??1}}),e=new r,o=e.createMediaStreamSource(i),c=e.createScriptProcessor(4096,1,1),c.onaudioprocess=(g)=>{let y=g.inputBuffer.getChannelData(0),d=$n(y,e?.sampleRate??48000,n.sampleRateHz??16000),h=Bn(d);n.onLevel?.(Wn(h)),n.onAudio(h)},o.connect(c),c.connect(e.destination)},stop:()=>{c?.disconnect(),o?.disconnect(),i?.getTracks().forEach((r)=>r.stop()),e?.close(),n.onLevel?.(0),e=null,i=null,c=null,o=null}}};var nn=(n)=>{if(typeof n===\"string\"&&n.trim())return n;if(n instanceof Error&&n.message.trim())return n.message;if(n&&typeof n===\"object\"){let e=n;for(let o of[\"message\",\"reason\",\"description\"]){let c=e[o];if(typeof c===\"string\"&&c.trim())return c}if(\"error\"in e)return nn(e.error);if(\"cause\"in e)return nn(e.cause);try{return JSON.stringify(n)}catch{}}return\"Unexpected error\"},hn=(n)=>{switch(n.type){case\"audio\":return{chunk:Uint8Array.from(atob(n.chunkBase64),(e)=>e.charCodeAt(0)),format:n.format,receivedAt:n.receivedAt,turnId:n.turnId,type:\"audio\"};case\"assistant\":return{text:n.text,type:\"assistant\"};case\"complete\":return{sessionId:n.sessionId,type:\"complete\"};case\"connection\":return{reconnect:n.reconnect,type:\"connection\"};case\"call_lifecycle\":return{event:n.event,sessionId:n.sessionId,type:\"call_lifecycle\"};case\"error\":return{message:nn(n.message),type:\"error\"};case\"final\":return{transcript:n.transcript,type:\"final\"};case\"partial\":return{transcript:n.transcript,type:\"partial\"};case\"replay\":return{assistantTexts:n.assistantTexts,call:n.call,partial:n.partial,scenarioId:n.scenarioId,sessionId:n.sessionId,sessionMetadata:n.sessionMetadata,status:n.status,turns:n.turns,type:\"replay\"};case\"session\":return{sessionId:n.sessionId,sessionMetadata:n.sessionMetadata,scenarioId:n.scenarioId,status:n.status,type:\"session\"};case\"turn\":return{turn:n.turn,type:\"turn\"};default:return null}};var H=(n,e,o,c)=>{n.push({code:o,message:c,severity:e})};var qn=(n)=>n.length===0?void 0:n.reduce((e,o)=>e+o,0)/n.length,K=(n)=>n.length===0?void 0:Math.max(...n);var _=(n,e)=>{let o=n[e];return typeof o===\"number\"&&Number.isFinite(o)?o:void 0},Z=(n,e)=>{let o=n[e];return typeof o===\"boolean\"?o:void 0},O=(n,e)=>{let o=n[e];return typeof o===\"string\"?o:void 0},en=(n)=>String(n.id??O(n,\"ssrc\")??_(n,\"ssrc\")??O(n,\"trackIdentifier\")??O(n,\"mid\")??\"unknown\"),yn=(n)=>n===void 0?void 0:n*1000;var Xn=(n)=>{let e={};for(let[o,c]of Object.entries(n))if(c===null||typeof c===\"boolean\"||typeof c===\"number\"||typeof c===\"string\")e[o]=c;return e};var Cn=(n={})=>{let e=n.stats??[],o=[],c=e.filter((l)=>l.type===\"inbound-rtp\"&&O(l,\"kind\")!==\"video\"),i=e.filter((l)=>l.type===\"outbound-rtp\"&&O(l,\"kind\")!==\"video\"),s=e.filter((l)=>l.type===\"candidate-pair\"),t=e.filter((l)=>(l.type===\"track\"||l.type===\"media-source\")&&O(l,\"kind\")===\"audio\"),r=s.filter((l)=>Z(l,\"selected\")===!0||Z(l,\"nominated\")===!0||O(l,\"state\")===\"succeeded\").length,g=t.filter((l)=>O(l,\"readyState\")!==\"ended\"&&O(l,\"trackState\")!==\"ended\"&&Z(l,\"ended\")!==!0).length,y=t.filter((l)=>O(l,\"readyState\")===\"ended\"||O(l,\"trackState\")===\"ended\"||Z(l,\"ended\")===!0).length,d=c.reduce((l,S)=>l+(_(S,\"packetsReceived\")??0),0),h=i.reduce((l,S)=>l+(_(S,\"packetsSent\")??0),0),a=[...c,...i].reduce((l,S)=>l+Math.max(0,_(S,\"packetsLost\")??0),0),M=d+a,C=M===0?0:a/M,I=c.reduce((l,S)=>l+(_(S,\"bytesReceived\")??0),0),L=i.reduce((l,S)=>l+(_(S,\"bytesSent\")??0),0),b=K(s.map((l)=>yn(_(l,\"currentRoundTripTime\")??_(l,\"roundTripTime\"))).filter((l)=>l!==void 0)),w=K([...c,...i].map((l)=>yn(_(l,\"jitter\"))).filter((l)=>l!==void 0)),u=K(c.map((l)=>{let S=_(l,\"jitterBufferDelay\"),R=_(l,\"jitterBufferEmittedCount\");return S!==void 0&&R!==void 0&&R>0?S/R*1000:void 0}).filter((l)=>l!==void 0)),U=t.map((l)=>_(l,\"audioLevel\")).filter((l)=>l!==void 0);if(n.requireConnectedCandidatePair&&s.length>0&&r===0)H(o,\"error\",\"media.webrtc_candidate_pair_missing\",\"No active WebRTC candidate pair was observed.\");if(n.requireLiveAudioTrack&&g===0)H(o,\"error\",\"media.webrtc_audio_track_missing\",\"No live WebRTC audio track was observed.\");if(n.maxPacketLossRatio!==void 0&&C>n.maxPacketLossRatio)H(o,\"warning\",\"media.webrtc_packet_loss\",`Observed WebRTC packet loss ratio ${String(C)} above ${String(n.maxPacketLossRatio)}.`);if(n.maxRoundTripTimeMs!==void 0&&b!==void 0&&b>n.maxRoundTripTimeMs)H(o,\"warning\",\"media.webrtc_round_trip_time\",`Observed WebRTC RTT ${String(b)}ms above ${String(n.maxRoundTripTimeMs)}ms.`);if(n.maxJitterMs!==void 0&&w!==void 0&&w>n.maxJitterMs)H(o,\"warning\",\"media.webrtc_jitter\",`Observed WebRTC jitter ${String(w)}ms above ${String(n.maxJitterMs)}ms.`);return{activeCandidatePairs:r,audioLevelAverage:qn(U),bytesReceived:I,bytesSent:L,checkedAt:Date.now(),endedAudioTracks:y,inboundPackets:d,issues:o,jitterBufferDelayMs:u,jitterMs:w,liveAudioTracks:g,outboundPackets:h,packetLossRatio:C,packetsLost:a,roundTripTimeMs:b,status:o.some((l)=>l.severity===\"error\")?\"fail\":o.length>0?\"warn\":\"pass\",totalStats:e.length}},fn=async(n)=>{return[...(await n.peerConnection.getStats(n.selector??null)).values()].map(Xn)};var Tn=(n={})=>{let e=n.stats??[],o=n.previousStats??[],c=[],i=new Map(o.map((a)=>[en(a),a])),t=e.filter((a)=>(a.type===\"inbound-rtp\"||a.type===\"outbound-rtp\")&&O(a,\"kind\")!==\"video\"&&O(a,\"mediaType\")!==\"video\").map((a)=>{let M=a.type===\"outbound-rtp\"?\"outbound\":\"inbound\",C=M===\"outbound\"?\"packetsSent\":\"packetsReceived\",I=M===\"outbound\"?\"bytesSent\":\"bytesReceived\",L=i.get(en(a)),b=_(a,C),w=L?_(L,C):void 0,u=_(a,I),U=L?_(L,I):void 0,l=a.timestamp!==void 0&&L?.timestamp!==void 0?a.timestamp-L.timestamp:void 0;return{bytesDelta:u!==void 0&&U!==void 0?u-U:void 0,currentPackets:b,direction:M,id:en(a),packetDelta:b!==void 0&&w!==void 0?b-w:void 0,previousPackets:w,timeDeltaMs:l}}),r=t.filter((a)=>a.direction===\"inbound\"),g=t.filter((a)=>a.direction===\"outbound\"),y=K(t.map((a)=>a.timeDeltaMs).filter((a)=>a!==void 0)),d=r.filter((a)=>n.maxInboundPacketStallMs!==void 0&&a.timeDeltaMs!==void 0&&a.timeDeltaMs>=n.maxInboundPacketStallMs&&a.packetDelta!==void 0&&a.packetDelta<=0).length,h=g.filter((a)=>n.maxOutboundPacketStallMs!==void 0&&a.timeDeltaMs!==void 0&&a.timeDeltaMs>=n.maxOutboundPacketStallMs&&a.packetDelta!==void 0&&a.packetDelta<=0).length;if(n.requireInboundAudio&&r.length===0)H(c,\"error\",\"media.webrtc_inbound_audio_missing\",\"No inbound WebRTC audio RTP stream was observed.\");if(n.requireOutboundAudio&&g.length===0)H(c,\"error\",\"media.webrtc_outbound_audio_missing\",\"No outbound WebRTC audio RTP stream was observed.\");if(n.maxGapMs!==void 0&&y!==void 0&&y>n.maxGapMs)H(c,\"warning\",\"media.webrtc_stream_gap\",`Observed WebRTC stream sample gap ${String(y)}ms above ${String(n.maxGapMs)}ms.`);if(d>0)H(c,\"error\",\"media.webrtc_inbound_stalled\",`${String(d)} inbound WebRTC audio stream(s) stopped receiving packets.`);if(h>0)H(c,\"error\",\"media.webrtc_outbound_stalled\",`${String(h)} outbound WebRTC audio stream(s) stopped sending packets.`);return{checkedAt:Date.now(),inboundAudioStreams:r.length,issues:c,maxObservedGapMs:y,outboundAudioStreams:g.length,stalledInboundStreams:d,stalledOutboundStreams:h,status:c.some((a)=>a.severity===\"error\")?\"fail\":c.length>0?\"warn\":\"pass\",streams:t,totalStats:e.length}};var zn=\"/api/voice/browser-media\",kn=5000,Yn=async(n)=>n.peerConnection??await n.getPeerConnection?.()??null,Jn=async(n,e)=>{let o=e.fetch??globalThis.fetch;if(!o)return;await o(e.path??zn,{body:JSON.stringify(n),headers:{\"Content-Type\":\"application/json\"},keepalive:!0,method:\"POST\"})},Sn=(n)=>{let e=null,o=[],c=async()=>{let t=await Yn(n);if(!t)return;let r=await fn({peerConnection:t}),g=Cn({...n,stats:r}),y=n.continuity===!1?void 0:Tn({...n.continuity,previousStats:o,stats:r}),d={at:Date.now(),continuity:y,report:g,scenarioId:n.getScenarioId?.()??null,sessionId:n.getSessionId?.()??null};return o=r,n.onReport?.(d),await Jn(d,n),d},i=()=>{c().catch((t)=>{n.onError?.(t)})},s=()=>{if(e)clearInterval(e),e=null};return{close:s,reportOnce:c,start:()=>{if(e)return;i(),e=setInterval(i,n.intervalMs??kn)},stop:s}};var B=()=>{},Qn=()=>B,Zn={callControl:B,close:B,endTurn:B,getReadyState:()=>3,getScenarioId:()=>\"\",getSessionId:()=>\"\",send:B,sendAudio:B,simulateDisconnect:B,start:()=>{},subscribe:Qn},Kn=()=>crypto.randomUUID(),jn=(n,e,o)=>{let{hostname:c,port:i,protocol:s}=window.location,t=s===\"https:\"?\"wss:\":\"ws:\",r=i?`:${i}`:\"\",g=new URL(`${t}//${c}${r}${n}`);if(g.searchParams.set(\"sessionId\",e),o)g.searchParams.set(\"scenarioId\",o);return g.toString()},mn=(n)=>{if(!n||typeof n!==\"object\"||!(\"type\"in n))return!1;switch(n.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}},Fn=(n)=>{if(typeof n.data!==\"string\")return null;try{let e=JSON.parse(n.data);return mn(e)?e:null}catch{return null}},Mn=(n,e={})=>{if(typeof window>\"u\")return Zn;let o=new Set,c=e.reconnect!==!1,i=e.maxReconnectAttempts??10,s=e.pingInterval??30000,t={isConnected:!1,pendingMessages:[],scenarioId:e.scenarioId??null,pingInterval:null,reconnectAttempts:0,reconnectTimeout:null,sessionId:e.sessionId??Kn(),ws:null},r=(l)=>{o.forEach((S)=>S(l))},g=()=>{if(t.pingInterval)clearInterval(t.pingInterval),t.pingInterval=null;if(t.reconnectTimeout)clearTimeout(t.reconnectTimeout),t.reconnectTimeout=null},y=()=>{if(t.ws?.readyState!==1)return;while(t.pendingMessages.length>0){let l=t.pendingMessages.shift();if(l!==void 0)t.ws.send(l)}},d=()=>{let l=Date.now()+500;t.reconnectAttempts+=1,r({reconnect:{attempts:t.reconnectAttempts,lastDisconnectAt:Date.now(),maxAttempts:i,nextAttemptAt:l,status:\"reconnecting\"},type:\"connection\"}),t.reconnectTimeout=setTimeout(()=>{if(t.reconnectAttempts>i){r({reconnect:{attempts:t.reconnectAttempts,maxAttempts:i,status:\"exhausted\"},type:\"connection\"});return}h()},500)},h=()=>{let l=new WebSocket(jn(n,t.sessionId,t.scenarioId));l.binaryType=\"arraybuffer\",l.onopen=()=>{let S=t.reconnectAttempts>0;if(t.isConnected=!0,y(),S)r({reconnect:{attempts:t.reconnectAttempts,lastResumedAt:Date.now(),maxAttempts:i,status:\"resumed\"},type:\"connection\"}),t.reconnectAttempts=0;o.forEach((R)=>R({scenarioId:t.scenarioId??void 0,sessionId:t.sessionId,status:\"active\",type:\"session\"})),t.pingInterval=setInterval(()=>{if(l.readyState===1)l.send(JSON.stringify({type:\"ping\"}))},s)},l.onmessage=(S)=>{let R=Fn(S);if(!R)return;if(R.type===\"session\")t.sessionId=R.sessionId,t.scenarioId=R.scenarioId??t.scenarioId;o.forEach((z)=>z(R))},l.onclose=(S)=>{if(t.isConnected=!1,g(),c&&S.code!==1000&&t.reconnectAttempts<i)d();else if(c&&S.code!==1000)r({reconnect:{attempts:t.reconnectAttempts,lastDisconnectAt:Date.now(),maxAttempts:i,status:\"exhausted\"},type:\"connection\"})},t.ws=l},a=(l)=>{if(t.ws?.readyState===1){t.ws.send(l);return}t.pendingMessages.push(l)},M=(l)=>{a(JSON.stringify(l))},C=(l={})=>{if(l.sessionId)t.sessionId=l.sessionId;if(l.scenarioId)t.scenarioId=l.scenarioId;M({type:\"start\",sessionId:t.sessionId,scenarioId:t.scenarioId??void 0})},I=(l)=>{a(l)},L=()=>{M({type:\"end_turn\"})},b=(l)=>{M({...l,type:\"call_control\"})},w=()=>{if(g(),t.ws)t.ws.close(1000),t.ws=null;t.isConnected=!1,o.clear()},u=()=>{if(t.ws?.readyState===1)t.ws.close(4000,\"absolutejs-voice-reconnect-proof\")},U=(l)=>{return o.add(l),()=>{o.delete(l)}};return h(),{callControl:b,close:w,endTurn:L,getReadyState:()=>t.ws?.readyState??3,getScenarioId:()=>t.scenarioId??\"\",getSessionId:()=>t.sessionId,send:M,sendAudio:I,simulateDisconnect:u,start:C,subscribe:U}};var vn=()=>({attempts:0,maxAttempts:0,status:\"idle\"}),pn=()=>({assistantAudio:[],assistantTexts:[],call:null,error:null,isConnected:!1,sessionMetadata:null,scenarioId:null,partial:\"\",reconnect:vn(),sessionId:null,status:\"idle\",turns:[]}),In=()=>{let n=pn(),e=new Set,o=()=>{e.forEach((i)=>i())};return{dispatch:(i)=>{switch(i.type){case\"audio\":n={...n,assistantAudio:[...n.assistantAudio,{chunk:i.chunk,format:i.format,receivedAt:i.receivedAt,turnId:i.turnId}]};break;case\"assistant\":n={...n,assistantTexts:[...n.assistantTexts,i.text]};break;case\"complete\":n={...n,sessionId:i.sessionId,status:\"completed\"};break;case\"call_lifecycle\":n={...n,call:{...n.call,disposition:i.event.type===\"end\"?i.event.disposition:n.call?.disposition,endedAt:i.event.type===\"end\"?i.event.at:n.call?.endedAt,events:[...n.call?.events??[],i.event],lastEventAt:i.event.at,startedAt:n.call?.startedAt??i.event.at},sessionId:i.sessionId};break;case\"connected\":n={...n,isConnected:!0,reconnect:n.reconnect.status===\"reconnecting\"?{...n.reconnect,lastResumedAt:Date.now(),nextAttemptAt:void 0,status:\"resumed\"}:n.reconnect};break;case\"connection\":n={...n,reconnect:i.reconnect};break;case\"disconnected\":n={...n,isConnected:!1};break;case\"error\":n={...n,error:i.message};break;case\"final\":n={...n,partial:i.transcript.text,turns:n.turns.map((s)=>s)};break;case\"partial\":n={...n,partial:i.transcript.text};break;case\"replay\":n={...n,assistantTexts:[...i.assistantTexts],call:i.call??null,error:null,isConnected:i.status===\"active\",partial:i.partial,reconnect:n.reconnect.status===\"reconnecting\"?{...n.reconnect,lastResumedAt:Date.now(),nextAttemptAt:void 0,status:\"resumed\"}:n.reconnect,scenarioId:i.scenarioId??n.scenarioId,sessionId:i.sessionId,sessionMetadata:i.sessionMetadata??n.sessionMetadata,status:i.status,turns:[...i.turns]};break;case\"session\":n={...n,error:null,scenarioId:i.scenarioId??n.scenarioId,isConnected:i.status===\"active\",sessionId:i.sessionId,sessionMetadata:i.sessionMetadata??n.sessionMetadata,status:i.status};break;case\"turn\":n={...n,partial:\"\",turns:[...n.turns,i.turn]};break}o()},getServerSnapshot:()=>n,getSnapshot:()=>n,subscribe:(i)=>{return e.add(i),()=>{e.delete(i)}}}};var Vn=(n,e={})=>{let o=Mn(n,e),c=In(),i=e.browserMedia&&typeof window<\"u\"?Sn({...e.browserMedia,getScenarioId:()=>e.browserMedia?e.browserMedia.getScenarioId?.()??o.getScenarioId():o.getScenarioId(),getSessionId:()=>e.browserMedia?e.browserMedia.getSessionId?.()??o.getSessionId():o.getSessionId()}):null,s=new Set,t=(d)=>Promise.resolve().then(()=>{if(!d?.sessionId&&!d?.scenarioId)return;o.start(d),i?.start()}),r=()=>{s.forEach((d)=>d())},g=()=>{if(!e.reconnectReportPath||typeof fetch>\"u\")return;let d=c.getSnapshot(),h=JSON.stringify({at:Date.now(),reconnect:d.reconnect,scenarioId:d.scenarioId,sessionId:o.getSessionId(),turnIds:d.turns.map((a)=>a.id)});fetch(e.reconnectReportPath,{body:h,headers:{\"Content-Type\":\"application/json\"},keepalive:!0,method:\"POST\"}).catch(()=>{})},y=o.subscribe((d)=>{let h=hn(d);if(h){if(c.dispatch(h),d.type===\"connection\")g();r()}});return{callControl(d){o.callControl(d)},close(){y(),i?.close(),o.close(),c.dispatch({type:\"disconnected\"}),r()},endTurn(){o.endTurn()},get error(){return c.getSnapshot().error},getServerSnapshot(){return c.getServerSnapshot()},getSnapshot(){return c.getSnapshot()},get isConnected(){return c.getSnapshot().isConnected},get scenarioId(){return c.getSnapshot().scenarioId},get sessionMetadata(){return c.getSnapshot().sessionMetadata},start:t,get partial(){return c.getSnapshot().partial},get reconnect(){return c.getSnapshot().reconnect},get sessionId(){return o.getSessionId()},get status(){return c.getSnapshot().status},get turns(){return c.getSnapshot().turns},get assistantTexts(){return c.getSnapshot().assistantTexts},get assistantAudio(){return c.getSnapshot().assistantAudio},get call(){return c.getSnapshot().call},sendAudio(d){o.sendAudio(d)},simulateDisconnect(){o.simulateDisconnect()},subscribe(d){return s.add(d),()=>{s.delete(d)}}}};var Ln=(n)=>{if(!n||n.enabled===!1)return;return{enabled:!0,maxGain:n.maxGain??3,noiseGateAttenuation:n.noiseGateAttenuation??0.15,noiseGateThreshold:n.noiseGateThreshold??0.006,targetLevel:n.targetLevel??0.08}};var ne={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}},ee={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 Rn=(n)=>{let e=n?.profile??\"fast\",o=n?.qualityProfile??\"general\",c=ne[e],i=ee[o];return{profile:e,qualityProfile:o,silenceMs:n?.silenceMs??i.silenceMs??c.silenceMs,speechThreshold:n?.speechThreshold??i.speechThreshold??c.speechThreshold,transcriptStabilityMs:n?.transcriptStabilityMs??i.transcriptStabilityMs??c.transcriptStabilityMs}};var ce={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\"}}},wn=(n=\"default\")=>{let e=ce[n];return{audioConditioning:Ln(e.audioConditioning),capture:{channelCount:e.capture?.channelCount??1,sampleRateHz:e.capture?.sampleRateHz??16000},connection:{...e.connection},name:n,sttLifecycle:e.sttLifecycle??\"continuous\",turnDetection:Rn(e.turnDetection)}};var oe=(n)=>({assistantAudio:[...n.assistantAudio],assistantTexts:[...n.assistantTexts],call:n.call,error:n.error,isConnected:n.isConnected,isRecording:!1,partial:n.partial,reconnect:n.reconnect,recordingError:null,sessionId:n.sessionId,sessionMetadata:n.sessionMetadata,scenarioId:n.scenarioId,status:n.status,turns:[...n.turns]}),j=(n,e={})=>{let o=wn(e.preset),c=Vn(n,{...o.connection,...e.connection}),i=null,s=oe(c),t=new Set,r=()=>{for(let C of t)C()},g=()=>{if(s={...s,assistantAudio:[...c.assistantAudio],assistantTexts:[...c.assistantTexts],call:c.call,error:c.error,isConnected:c.isConnected,partial:c.partial,reconnect:c.reconnect,sessionId:c.sessionId,sessionMetadata:c.sessionMetadata,scenarioId:c.scenarioId,status:c.status,turns:[...c.turns]},e.autoStopOnComplete!==!1&&s.status===\"completed\"&&s.isRecording)i?.stop(),i=null,s={...s,isRecording:!1};r()},y=c.subscribe(g);g();let d=()=>{if(i)return i;return i=An({channelCount:e.capture?.channelCount??o.capture.channelCount,onLevel:e.capture?.onLevel,onAudio:(C)=>{if(e.capture?.onAudio){e.capture.onAudio(C,c.sendAudio);return}c.sendAudio(C)},sampleRateHz:e.capture?.sampleRateHz??o.capture.sampleRateHz}),i},h=()=>{i?.stop(),i=null,s={...s,isRecording:!1},r()},a=async()=>{if(s.isRecording)return;try{s={...s,recordingError:null},r(),await d().start(),s={...s,isRecording:!0},r()}catch(C){throw i=null,s={...s,isRecording:!1,recordingError:C instanceof Error?C.message:String(C)},r(),C}};return{bindHTMX(C){return gn(c,C)},callControl:(C)=>c.callControl(C),close:()=>{y(),h(),c.close()},endTurn:()=>c.endTurn(),get error(){return s.error},getServerSnapshot:()=>s,getSnapshot:()=>s,get isConnected(){return s.isConnected},get isRecording(){return s.isRecording},get partial(){return s.partial},get recordingError(){return s.recordingError},get reconnect(){return s.reconnect},sendAudio:(C)=>c.sendAudio(C),simulateDisconnect:()=>c.simulateDisconnect(),get sessionId(){return s.sessionId},get sessionMetadata(){return s.sessionMetadata},get scenarioId(){return s.scenarioId},startRecording:a,get status(){return s.status},stopRecording:h,subscribe:(C)=>{return t.add(C),()=>{t.delete(C)}},toggleRecording:async()=>{if(s.isRecording){h();return}await a()},get turns(){return s.turns},get assistantTexts(){return s.assistantTexts},get assistantAudio(){return s.assistantAudio},get call(){return s.call}}};var te=()=>({activeSourceCount:0,error:null,isActive:!1,isPlaying:!1,lastInterruptLatencyMs:void 0,lastPlaybackStopLatencyMs:void 0,processedChunkCount:0,queuedChunkCount:0}),ie=()=>{if(typeof window>\"u\")return typeof AudioContext>\"u\"?void 0:AudioContext;return window.AudioContext??window.webkitAudioContext},se=(n,e)=>{let o=e.format;if(o.container!==\"raw\"||o.encoding!==\"pcm_s16le\")throw Error(`Unsupported assistant audio format: ${o.container}/${o.encoding}`);let c=e.chunk,i=Math.max(1,o.channels),s=Math.floor(c.byteLength/2),t=Math.max(1,Math.floor(s/i)),r=n.createBuffer(i,t,o.sampleRateHz),g=new DataView(c.buffer,c.byteOffset,c.byteLength);for(let y=0;y<i;y+=1){let d=r.getChannelData(y);for(let h=0;h<t;h+=1){let M=(h*i+y)*2;if(M+1>=c.byteLength){d[h]=0;continue}d[h]=g.getInt16(M,!0)/32768}}return r},m=(n,e={})=>{let o=new Set,c=new Set,i=(e.lookaheadMs??15)/1000,s=te(),t=null,r=null,g=0,y=Promise.resolve(),d=null,h=null,a=null,M=null,C=()=>{for(let A of o)A()},I=(A)=>{s={...s,...A},C()},L=()=>{if(s.error!==null)I({error:null})},b=()=>{if(M!==null)clearTimeout(M),M=null},w=(A)=>{b(),d=null,I({activeSourceCount:c.size,isPlaying:!1,lastInterruptLatencyMs:A,lastPlaybackStopLatencyMs:s.lastPlaybackStopLatencyMs??A}),a?.(),a=null,h=null},u=(A)=>{if(!A)return 0;return Math.max(0,((A.baseLatency??0)+(A.outputLatency??0))*1000)},U=(A)=>{if(!r)return;let f=1;if(r.gain.setValueAtTime){r.gain.setValueAtTime(f,A?.currentTime??0);return}r.gain.value=f},l=(A)=>{if(!r)return;let f=0;if(r.gain.setValueAtTime){r.gain.setValueAtTime(f,A?.currentTime??0);return}r.gain.value=f},S=()=>{if(d===null||c.size>0)return;w(Date.now()-d)},R=async()=>{if(t)return t;if(e.createAudioContext)t=e.createAudioContext();else{let A=ie();if(!A)throw Error(\"Assistant audio playback requires AudioContext support.\");t=new A}if(t.createGain)r=t.createGain(),r.connect?.(t.destination);return g=t.currentTime,t},z=async(A)=>{let f=await R(),P=se(f,A),V=f.createBufferSource();V.buffer=P,V.connect(r??f.destination),V.onended=()=>{c.delete(V),V.disconnect?.(),I({activeSourceCount:c.size,isPlaying:c.size>0&&s.isActive}),S()};let Y=Math.max(f.currentTime+i,g);g=Y+P.duration,c.add(V),I({activeSourceCount:c.size,isPlaying:!0}),V.start(Y)},E=(A)=>{for(let f of[...c])f.stop?.();if(g=t?t.currentTime:0,A?.forceClear){for(let f of c)f.disconnect?.();c.clear(),S()}},W=async()=>{if(!s.isActive)return;let A=n.assistantAudio.slice(s.processedChunkCount);if(A.length===0)return;try{L();for(let f of A)await z(f);I({processedChunkCount:n.assistantAudio.length,queuedChunkCount:s.queuedChunkCount+A.length})}catch(f){I({error:f instanceof Error?f.message:String(f)})}},D=()=>{return y=y.then(()=>W(),()=>W()),y},$=n.subscribe(()=>{if(e.autoStart&&!s.isActive&&n.assistantAudio.length>0){N.start();return}if(s.isActive)D()}),N={close:async()=>{if($(),E({forceClear:!0}),b(),a?.(),a=null,h=null,d=null,t&&t.state!==\"closed\")await t.close();t=null,r?.disconnect?.(),r=null,g=0,I({activeSourceCount:0,isActive:!1,isPlaying:!1})},get activeSourceCount(){return s.activeSourceCount},get error(){return s.error},getSnapshot:()=>s,get isActive(){return s.isActive},get isPlaying(){return s.isPlaying},interrupt:async()=>{let A=Date.now(),f=await R();d=A,l(f);let P=Date.now()-A+u(f);if(I({isActive:!1,isPlaying:c.size>0,lastPlaybackStopLatencyMs:P}),c.size===0){w(P);return}if(!h)h=new Promise((V)=>{a=V});b(),M=setTimeout(()=>{for(let V of c)V.disconnect?.();c.clear(),w(Date.now()-A)},250),E(),await h},get lastInterruptLatencyMs(){return s.lastInterruptLatencyMs},get lastPlaybackStopLatencyMs(){return s.lastPlaybackStopLatencyMs},pause:async()=>{if(!t){I({activeSourceCount:0,isActive:!1,isPlaying:!1});return}await t.suspend(),I({activeSourceCount:c.size,isActive:!1,isPlaying:!1})},get processedChunkCount(){return s.processedChunkCount},get queuedChunkCount(){return s.queuedChunkCount},start:async()=>{try{L();let A=await R();if(U(A),A.state===\"suspended\")await A.resume();I({activeSourceCount:c.size,isActive:!0,isPlaying:A.state===\"running\"}),await D()}catch(A){throw I({error:A instanceof Error?A.message:String(A),isActive:!1,isPlaying:!1}),A}},subscribe:(A)=>{return o.add(A),()=>{o.delete(A)}}};return N};var le=()=>`barge-in:${Date.now()}:${crypto.randomUUID?.()??Math.random().toString(36).slice(2)}`,re=(n,e)=>{let o=n.filter((t)=>t.status===\"stopped\"),c=o.map((t)=>t.latencyMs).filter((t)=>typeof t===\"number\"),i=o.filter((t)=>typeof t.latencyMs===\"number\"&&t.latencyMs>e).length,s=o.length-i;return{averageLatencyMs:c.length>0?Math.round(c.reduce((t,r)=>t+r,0)/c.length):void 0,events:[...n],failed:i,lastEvent:n.at(-1),passed:s,status:n.length===0?\"empty\":i>0?\"fail\":o.length===0?\"warn\":\"pass\",thresholdMs:e,total:o.length}},bn=(n={})=>{let e=new Set,o=n.thresholdMs??250,c=n.fetch??globalThis.fetch,i=[],s=()=>{for(let g of e)g()},t=(g)=>{if(!n.path||typeof c!==\"function\")return;c(n.path,{body:JSON.stringify(g),headers:{\"Content-Type\":\"application/json\"},method:\"POST\"}).catch(()=>{})},r=(g,y)=>{let d={at:Date.now(),id:le(),latencyMs:y.latencyMs,playbackStopLatencyMs:y.playbackStopLatencyMs,reason:y.reason,sessionId:y.sessionId,status:g,thresholdMs:o};return i.push(d),t(d),s(),d};return{getSnapshot:()=>re(i,o),recordRequested:(g)=>r(\"requested\",g),recordSkipped:(g)=>r(\"skipped\",g),recordStopped:(g)=>r(\"stopped\",g),subscribe:(g)=>{return e.add(g),()=>{e.delete(g)}}}};var ae=0.08,de=(n,e={})=>(e.enabled??!0)&&n>=(e.interruptThreshold??ae),cn=(n,e,o={})=>{let c=n.partial,i=(t)=>{if(!e.isPlaying||o.enabled===!1){o.monitor?.recordSkipped({reason:t,sessionId:n.sessionId});return}o.monitor?.recordRequested({reason:t,sessionId:n.sessionId}),e.interrupt().then(()=>{o.monitor?.recordStopped({latencyMs:e.lastInterruptLatencyMs,playbackStopLatencyMs:e.lastPlaybackStopLatencyMs,reason:t,sessionId:n.sessionId})})},s=n.subscribe(()=>{if(o.interruptOnPartial===!1){c=n.partial;return}if(!c&&n.partial)i(\"partial-transcript\");c=n.partial});return{close:()=>{s()},handleLevel:(t)=>{if(de(t,o))i(\"input-level\")},sendAudio:(t)=>{i(\"manual-audio\"),n.sendAudio(t)}}};var rn=48,ge=320,Ae=88,he=\"Guided test\",ye=\"General recording\",Ce=\"Pick a scenario to begin the demo.\",fe=\"I can walk you through a short guided voice test.\",Te=\"I can capture one freeform recording and confirm that it landed.\",Se=\"Choose a scenario to begin. Guided test asks follow-up prompts. General recording just captures what you say.\",Me=\"Click Start general recording to capture one freeform answer.\",Pn=\"Speak freely. When you pause, the recording will be captured.\",sn=\"Recording saved. Start again if you want another capture.\",Dn=\"Guided test complete. Review the saved summary below.\",On=\"All prompts are covered. You can stop the microphone or keep speaking for extra detail.\",Ie=\"Ready. Start guided test or general recording to begin.\",Ve=\"Live. Answer the prompt, then click Stop microphone when finished.\",_n=[\"Start with a quick introduction about who you are.\",\"Now describe what you are trying to do or test.\",\"Finish with any detail that feels blocked, risky, or unclear.\"],xn=(n,e,o)=>Math.min(o,Math.max(e,n)),X=(n)=>n.replaceAll(\"&\",\"&amp;\").replaceAll(\"<\",\"&lt;\").replaceAll(\">\",\"&gt;\").replaceAll('\"',\"&quot;\").replaceAll(\"'\",\"&#39;\"),on=(n,e)=>{let o=n[e];if(typeof o===\"string\"&&o.trim())return o;return null},ln=(n)=>{if(typeof n===\"string\"&&n.trim())return n;if(n instanceof Error&&n.message.trim())return n.message;if(n&&typeof n===\"object\"){let e=n,o=on(e,\"message\")??on(e,\"reason\")??on(e,\"description\");if(o)return o;if(\"error\"in e)return ln(e.error);if(\"cause\"in e)return ln(e.cause);try{return JSON.stringify(n)}catch{}}return\"Unexpected error\"},Le=(n)=>{let e=[n.status];if(n.attempts>0||n.maxAttempts>0)e.push(`${n.attempts}/${n.maxAttempts} attempts`);if(n.nextAttemptAt){let o=Math.max(0,n.nextAttemptAt-Date.now());e.push(`retry in ${Math.ceil(o/100)/10}s`)}return e.join(\" \u00B7 \")},F=(n=rn)=>Array.from({length:n},()=>0),En=(n,e,o=rn)=>{let c=n.slice(-(o-1));c.push(xn(e,0,1));while(c.length<o)c.unshift(0);return c},Re=(n,e=ge,o=Ae)=>{let c=n.length>1?n:F(rn),i=e/(c.length-1),s=o/2,t=o*0.34;if(Math.max(...c,0)<=0.015)return`M 0 ${s} L ${e} ${s}`;let g=c.map((d,h)=>{let a=h*0.76,M=Math.sin(a)*0.78+Math.sin(a*0.41)*0.22,C=d*t,I=i*h,L=xn(s+M*C,8,o-8);return{x:I,y:L}});if(g.length===0)return`M 0 ${s} L ${e} ${s}`;let y=`M ${g[0]?.x??0} ${g[0]?.y??s}`;for(let d=1;d<g.length;d+=1){let h=g[d-1],a=g[d];if(!h||!a)continue;let M=(h.x+a.x)/2;y+=` Q ${M} ${h.y} ${a.x} ${a.y}`}return y},we=(n)=>{if(!n)return _n;try{let e=JSON.parse(n);if(Array.isArray(e)){let o=e.filter((c)=>typeof c===\"string\").map((c)=>c.trim()).filter(Boolean);if(o.length>0)return o}}catch{}return _n},tn=(n)=>{if(!n)return;let e=Number(n);return Number.isFinite(e)?e:void 0},be=(n,e,o)=>{if(!e)return null;let c=document.querySelector(e);return c instanceof o?c:null},x=(n,e,o,c)=>{let i=e?document.querySelector(e):null;if(i instanceof o)return i;let s=n.querySelector(`#${c}`);if(s instanceof o)return s;throw Error(`Voice HTMX bootstrap could not find the required element \"${c}\".`)},_e=(n)=>{if(!n.mode)return Ce;if(!n.hasStarted)return n.mode===\"guided\"?fe:Te;if(n.status===\"completed\")return n.mode===\"guided\"?Dn:sn;if(n.mode===\"general\")return Pn;return n.guidedPrompts[n.turnCount]??On},Ee=(n)=>{if(!n.mode)return Se;if(n.status===\"completed\")return n.mode===\"guided\"?Dn:sn;if(!n.hasStarted)return n.mode===\"guided\"?`Click Start guided test to begin. First prompt: ${n.guidedPrompts[0]??\"Answer the first prompt.\"}`:Me;if(n.mode===\"general\")return n.turnCount===0?Pn:sn;return n.guidedPrompts[n.turnCount]??On},Pe=(n)=>{let e=n.dataset.voiceGuidedPath,o=n.dataset.voiceGeneralPath;if(!e||!o)throw Error(\"Voice HTMX bootstrap requires data-voice-guided-path and data-voice-general-path.\");let c=we(n.dataset.voiceGuidedPrompts),i=n.dataset.voiceGuidedLabel??he,s=n.dataset.voiceGeneralLabel??ye,t=n.dataset.voiceReconnectReportPath,r=n.dataset.voiceBargeInPath,g=r?bn({path:r,thresholdMs:tn(n.dataset.voiceBargeInThresholdMs)}):null,y=tn(n.dataset.voiceBargeInRecentWindowMs)??4000,d=tn(n.dataset.voiceBargeInSpeechThreshold)??0.04,h=x(document,n.dataset.voiceSync,HTMLElement,\"voice-htmx-sync\"),a=x(n,n.dataset.voiceConnection,HTMLElement,\"metric-connection\"),M=x(n,n.dataset.voiceError,HTMLElement,\"status-error\"),C=x(n,n.dataset.voiceMicrophone,HTMLElement,\"status-mic\"),I=x(n,n.dataset.voicePrompt,HTMLElement,\"status-prompt\"),L=be(n,n.dataset.voiceReconnect,HTMLElement),b=x(n,n.dataset.voiceChat,HTMLElement,\"chat-list\"),w=x(n,n.dataset.voiceStartGuided,HTMLButtonElement,\"start-guided\"),u=x(n,n.dataset.voiceStartGeneral,HTMLButtonElement,\"start-general\"),U=x(n,n.dataset.voiceStop,HTMLButtonElement,\"stop-mic\"),l=x(n,n.dataset.voiceMonitor,HTMLElement,\"voice-monitor\"),S=x(n,n.dataset.voiceMonitorCopy,HTMLElement,\"voice-monitor-copy\"),R=x(n,n.dataset.voiceWaveGlow,SVGPathElement,\"voice-wave-glow\"),z=x(n,n.dataset.voiceWavePath,SVGPathElement,\"voice-wave-path\"),E=null,W={general:!1,guided:!1},D=!1,$=null,N=F(),A=null,f=null,P=j(e,{capture:{onAudio:(T,G)=>{if(A){A.sendAudio(T);return}G(T)},onLevel:(T)=>{A?.handleLevel(T),N=En(N,T),v()}},connection:{reconnectReportPath:t},preset:\"guided-intake\"}),V=j(o,{capture:{onAudio:(T,G)=>{if(f){f.sendAudio(T);return}G(T)},onLevel:(T)=>{f?.handleLevel(T),N=En(N,T),v()}},connection:{reconnectReportPath:t},preset:\"dictation\"}),Y=P.bindHTMX({element:h}),un=V.bindHTMX({element:h}),J=m(P),Q=m(V);A=cn(P,J,{interruptThreshold:d,monitor:g??void 0}),f=cn(V,Q,{interruptThreshold:d,monitor:g??void 0});let k=()=>E===\"general\"?V:P,Oe=()=>E===\"general\"?Q:J,v=()=>{let T=Re(N);R.setAttribute(\"d\",T),z.setAttribute(\"d\",T),S.innerHTML=`<span class=\"voice-live-dot\"></span>${D?\"Microphone live\":\"Microphone idle\"}`,S.classList.toggle(\"is-live\",D),l.classList.toggle(\"is-live\",D)},q=()=>{let T=k(),G=(E?W[E]:!1)||T.turns.length>0,dn=T.status;if(a.textContent=T.isConnected?\"Connected\":\"Waiting\",M.textContent=$||T.error||\"None\",L)L.textContent=Le(T.reconnect);C.textContent=D?Ve:Ie,I.textContent=Ee({guidedPrompts:c,hasStarted:G,mode:E,status:dn,turnCount:T.turns.length}),w.hidden=D,u.hidden=D,U.hidden=!D,b.innerHTML=`<article class=\"voice-chat-message assistant\">\n <div class=\"voice-chat-role\">${X(E===\"general\"?s:E===\"guided\"?i:\"Voice demo\")}</div>\n <p class=\"voice-turn-text\">${X(_e({generalLabel:s,guidedLabel:i,guidedPrompts:c,hasStarted:G,mode:E,status:dn,turnCount:T.turns.length}))}</p>\n</article>${T.turns.map((p)=>`<div class=\"voice-chat-stack\">\n <article class=\"voice-chat-message user\">\n <div class=\"voice-chat-role\">You</div>\n <p class=\"voice-turn-text\">${X(p.text)}</p>\n </article>\n ${p.assistantText?`<article class=\"voice-chat-message assistant\">\n <div class=\"voice-chat-role\">${X(E===\"general\"?s:E===\"guided\"?i:\"Guide\")}</div>\n <p class=\"voice-turn-text\">${X(p.assistantText)}</p>\n </article>`:\"\"}\n</div>`).join(\"\")}${T.partial?`<article class=\"voice-chat-message user pending\">\n <div class=\"voice-chat-role\">Speaking</div>\n <p class=\"voice-turn-text\">${X(T.partial)}</p>\n</article>`:\"\"}`,v()},Un=()=>{k().stopRecording(),D=!1,$=null,N=F(),q()},an=async(T)=>{E=T,W={...W,[T]:!0};try{await k().startRecording(),$=null,D=!0,q()}catch(G){k().stopRecording(),D=!1,N=F(),$=ln(G),q()}};P.subscribe(()=>{if(P.assistantAudio.length>0)J.start().catch(()=>{});q()}),V.subscribe(()=>{if(V.assistantAudio.length>0)Q.start().catch(()=>{});q()}),w.addEventListener(\"click\",()=>{an(\"guided\")}),u.addEventListener(\"click\",()=>{an(\"general\")}),U.addEventListener(\"click\",()=>{Un()}),n.addEventListener(\"absolute-voice-simulate-disconnect\",()=>{k().simulateDisconnect()}),window.addEventListener(\"beforeunload\",()=>{P.stopRecording(),V.stopRecording(),A?.close(),f?.close(),J.close(),Q.close(),Y(),un(),P.close(),V.close()}),q()},De=()=>{if(typeof window>\"u\"||typeof document>\"u\")return;let n=Array.from(document.querySelectorAll(\"[data-voice-htmx]\"));for(let e of n)if(e instanceof HTMLElement)Pe(e)};De();export{De as initVoiceHTMX};\n";
@@ -0,0 +1,128 @@
1
+ import { Elysia } from "elysia";
2
+ import type { VoiceAgentTool } from "./agent";
3
+ import type { VoiceTraceEventStore } from "./trace";
4
+ import type { VoiceOnTurnObjectHandler, VoiceRouteResult, VoiceSessionRecord } from "./types";
5
+ import type { VoiceAssistantGuardrails } from "./assistant";
6
+ export type VoiceGuardrailStage = "assistant-output" | "handoff" | "model-input" | "tool-input" | "tool-output" | "transcript";
7
+ export type VoiceGuardrailSeverity = "block" | "warn";
8
+ export type VoiceGuardrailStatus = "blocked" | "pass" | "warn";
9
+ export type VoiceGuardrailRule = {
10
+ action?: VoiceGuardrailSeverity;
11
+ description?: string;
12
+ id: string;
13
+ label?: string;
14
+ match: RegExp | string | ((input: VoiceGuardrailEvaluationInput) => boolean | Promise<boolean>);
15
+ redactWith?: string;
16
+ stages?: VoiceGuardrailStage[];
17
+ };
18
+ export type VoiceGuardrailEvaluationInput = {
19
+ content?: unknown;
20
+ metadata?: Record<string, unknown>;
21
+ sessionId?: string;
22
+ stage: VoiceGuardrailStage;
23
+ turnId?: string;
24
+ };
25
+ export type VoiceGuardrailFinding = {
26
+ action: VoiceGuardrailSeverity;
27
+ description?: string;
28
+ label: string;
29
+ ruleId: string;
30
+ stage: VoiceGuardrailStage;
31
+ };
32
+ export type VoiceGuardrailDecision = {
33
+ allowed: boolean;
34
+ checkedAt: number;
35
+ content?: unknown;
36
+ findings: VoiceGuardrailFinding[];
37
+ redactedContent?: unknown;
38
+ sessionId?: string;
39
+ stage: VoiceGuardrailStage;
40
+ status: VoiceGuardrailStatus;
41
+ turnId?: string;
42
+ };
43
+ export type VoiceGuardrailPolicy = {
44
+ defaultAction?: VoiceGuardrailSeverity;
45
+ id: string;
46
+ label?: string;
47
+ rules: VoiceGuardrailRule[];
48
+ };
49
+ export type VoiceGuardrailReport = {
50
+ checkedAt: number;
51
+ decisions: VoiceGuardrailDecision[];
52
+ failed: number;
53
+ policies: Array<{
54
+ id: string;
55
+ label?: string;
56
+ rules: number;
57
+ }>;
58
+ status: "fail" | "pass" | "warn";
59
+ summary: {
60
+ blocked: number;
61
+ passed: number;
62
+ warned: number;
63
+ };
64
+ total: number;
65
+ };
66
+ export type VoiceGuardrailRoutesOptions = {
67
+ headers?: HeadersInit;
68
+ name?: string;
69
+ path?: string;
70
+ policies?: VoiceGuardrailPolicy[];
71
+ source?: ((input: VoiceGuardrailEvaluationInput) => Promise<VoiceGuardrailDecision | VoiceGuardrailReport> | VoiceGuardrailDecision | VoiceGuardrailReport) | VoiceGuardrailDecision | VoiceGuardrailReport;
72
+ trace?: VoiceTraceEventStore;
73
+ };
74
+ export type VoiceGuardrailRuntimeBlockInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Parameters<VoiceOnTurnObjectHandler<TContext, TSession, TResult>>[0] & {
75
+ decision: VoiceGuardrailDecision;
76
+ stage: VoiceGuardrailStage;
77
+ };
78
+ export type VoiceGuardrailRuntimeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
79
+ blockResult?: (input: VoiceGuardrailRuntimeBlockInput<TContext, TSession, TResult>) => Promise<VoiceRouteResult<TResult>> | VoiceRouteResult<TResult>;
80
+ name?: string;
81
+ policies: VoiceGuardrailPolicy[];
82
+ trace?: VoiceTraceEventStore;
83
+ };
84
+ export type VoiceGuardrailRuntime<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
85
+ assistantGuardrails: VoiceAssistantGuardrails<TContext, TSession, TResult>;
86
+ evaluate: (input: VoiceGuardrailEvaluationInput) => Promise<VoiceGuardrailDecision>;
87
+ wrapTool: <TArgs extends Record<string, unknown>, TToolResult>(tool: VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TResult>) => VoiceAgentTool<TContext, TSession, TArgs, TToolResult, TResult>;
88
+ wrapTools: (tools: Array<VoiceAgentTool<TContext, TSession, Record<string, unknown>, unknown, TResult>>) => Array<VoiceAgentTool<TContext, TSession, Record<string, unknown>, unknown, TResult>>;
89
+ };
90
+ export declare const evaluateVoiceGuardrailPolicy: (policy: VoiceGuardrailPolicy, input: VoiceGuardrailEvaluationInput) => Promise<VoiceGuardrailDecision>;
91
+ export declare const buildVoiceGuardrailReport: (input?: {
92
+ decisions: VoiceGuardrailDecision[];
93
+ policies?: VoiceGuardrailPolicy[];
94
+ }) => VoiceGuardrailReport;
95
+ export declare const createVoiceGuardrailPolicy: (policy: VoiceGuardrailPolicy) => VoiceGuardrailPolicy;
96
+ export declare const createVoiceGuardrailRuntime: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: VoiceGuardrailRuntimeOptions<TContext, TSession, TResult>) => VoiceGuardrailRuntime<TContext, TSession, TResult>;
97
+ export declare const voiceGuardrailPolicyPresets: {
98
+ supportSafeDefaults: VoiceGuardrailPolicy;
99
+ };
100
+ export declare const renderVoiceGuardrailMarkdown: (report: VoiceGuardrailReport) => string;
101
+ export declare const createVoiceGuardrailRoutes: (options?: VoiceGuardrailRoutesOptions) => Elysia<"", {
102
+ decorator: {};
103
+ store: {};
104
+ derive: {};
105
+ resolve: {};
106
+ }, {
107
+ typebox: {};
108
+ error: {};
109
+ }, {
110
+ schema: {};
111
+ standaloneSchema: {};
112
+ macro: {};
113
+ macroFn: {};
114
+ parser: {};
115
+ response: {};
116
+ }, {}, {
117
+ derive: {};
118
+ resolve: {};
119
+ schema: {};
120
+ standaloneSchema: {};
121
+ response: {};
122
+ }, {
123
+ derive: {};
124
+ resolve: {};
125
+ schema: {};
126
+ standaloneSchema: {};
127
+ response: {};
128
+ }>;
package/dist/handoff.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { VoiceHandoffAction, VoiceHandoffAdapter, VoiceHandoffConfig, VoiceHandoffDeliveryStore, VoiceHandoffInput, VoiceHandoffResult, VoiceSessionRecord, StoredVoiceHandoffDelivery } from './types';
1
+ import type { VoiceHandoffAction, VoiceHandoffAdapter, VoiceHandoffConfig, VoiceHandoffDeliveryStore, VoiceHandoffInput, VoiceHandoffResult, VoiceSessionRecord, StoredVoiceHandoffDelivery } from "./types";
2
2
  type MaybePromise<T> = T | Promise<T>;
3
3
  export type VoiceHandoffDelivery = VoiceHandoffResult & {
4
4
  adapterId: string;
@@ -8,16 +8,16 @@ export type VoiceHandoffDeliveryRecord<TContext = unknown, TSession extends Voic
8
8
  export type VoiceHandoffFanoutResult = {
9
9
  action: VoiceHandoffAction;
10
10
  deliveries: Record<string, VoiceHandoffDelivery>;
11
- status: VoiceHandoffResult['status'];
11
+ status: VoiceHandoffResult["status"];
12
12
  };
13
- export type VoiceHandoffDeliveryRecordInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoiceHandoffInput<TContext, TSession, TResult>, 'api'> & {
13
+ export type VoiceHandoffDeliveryRecordInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoiceHandoffInput<TContext, TSession, TResult>, "api"> & {
14
14
  id?: string;
15
15
  };
16
16
  export type VoiceQueuedHandoffDeliveryOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
17
17
  adapters: VoiceHandoffAdapter<TContext, TSession, TResult>[];
18
- api: VoiceHandoffInput<TContext, TSession, TResult>['api'];
18
+ api: VoiceHandoffInput<TContext, TSession, TResult>["api"];
19
19
  delivery: VoiceHandoffDeliveryRecord<TContext, TSession, TResult>;
20
- failMode?: VoiceHandoffConfig<TContext, TSession, TResult>['failMode'];
20
+ failMode?: VoiceHandoffConfig<TContext, TSession, TResult>["failMode"];
21
21
  };
22
22
  export type VoiceWebhookHandoffAdapterOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
23
23
  actions?: VoiceHandoffAction[];
@@ -26,7 +26,7 @@ export type VoiceWebhookHandoffAdapterOptions<TContext = unknown, TSession exten
26
26
  headers?: Record<string, string>;
27
27
  id: string;
28
28
  kind?: string;
29
- method?: 'POST' | 'PUT' | 'PATCH';
29
+ method?: "POST" | "PUT" | "PATCH";
30
30
  signingSecret?: string;
31
31
  timeoutMs?: number;
32
32
  url: string;
@@ -1,6 +1,6 @@
1
- import { Elysia } from 'elysia';
2
- import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from './trace';
3
- export type VoiceHandoffHealthStatus = 'delivered' | 'failed' | 'skipped';
1
+ import { Elysia } from "elysia";
2
+ import type { StoredVoiceTraceEvent, VoiceTraceEventStore } from "./trace";
3
+ export type VoiceHandoffHealthStatus = "delivered" | "failed" | "skipped";
4
4
  export type VoiceHandoffHealthDelivery = {
5
5
  adapterId: string;
6
6
  adapterKind?: string;
@@ -31,8 +31,8 @@ export type VoiceHandoffHealthSummaryOptions = {
31
31
  events?: StoredVoiceTraceEvent[];
32
32
  limit?: number;
33
33
  q?: string;
34
- replayHref?: false | string | ((event: Omit<VoiceHandoffHealthEvent, 'replayHref'>) => string);
35
- status?: VoiceHandoffHealthStatus | 'all';
34
+ replayHref?: false | string | ((event: Omit<VoiceHandoffHealthEvent, "replayHref">) => string);
35
+ status?: VoiceHandoffHealthStatus | "all";
36
36
  store?: VoiceTraceEventStore;
37
37
  };
38
38
  export type VoiceHandoffHealthHTMLHandlerOptions = VoiceHandoffHealthSummaryOptions & {
package/dist/htmx.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { VoiceHTMXConfig, VoiceHTMXRenderConfig, VoiceHTMXRenderInput, VoiceHTMXTargets, VoiceSessionRecord } from './types';
1
+ import type { VoiceHTMXConfig, VoiceHTMXRenderConfig, VoiceHTMXRenderInput, VoiceHTMXTargets, VoiceSessionRecord } from "./types";
2
2
  type ResolvedVoiceHTMXRenderConfig<TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Required<VoiceHTMXRenderConfig<TSession, TResult>>;
3
3
  export declare const resolveVoiceHTMXTargets: (custom?: Partial<VoiceHTMXTargets>) => VoiceHTMXTargets;
4
4
  export declare const resolveVoiceHTMXRenderers: <TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(custom?: VoiceHTMXConfig<TSession, TResult>) => ResolvedVoiceHTMXRenderConfig<TSession, TResult>;