@absolutejs/voice 0.0.22-beta.43 → 0.0.22-beta.431

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 (274) hide show
  1. package/README.md +3690 -55
  2. package/dist/agent.d.ts +62 -0
  3. package/dist/agentSquadContract.d.ts +98 -0
  4. package/dist/angular/index.d.ts +19 -0
  5. package/dist/angular/index.js +4647 -1140
  6. package/dist/angular/voice-agent-squad-status.service.d.ts +12 -0
  7. package/dist/angular/voice-call-debugger.service.d.ts +12 -0
  8. package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
  9. package/dist/angular/voice-controller.service.d.ts +1 -0
  10. package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
  11. package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
  12. package/dist/angular/voice-live-ops.service.d.ts +11 -0
  13. package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
  14. package/dist/angular/voice-ops-status.component.d.ts +15 -0
  15. package/dist/angular/voice-ops-status.service.d.ts +12 -0
  16. package/dist/angular/voice-platform-coverage.service.d.ts +12 -0
  17. package/dist/angular/voice-profile-comparison.service.d.ts +12 -0
  18. package/dist/angular/voice-proof-trends.service.d.ts +12 -0
  19. package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
  20. package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
  21. package/dist/angular/voice-readiness-failures.service.d.ts +13 -0
  22. package/dist/angular/voice-routing-status.service.d.ts +11 -0
  23. package/dist/angular/voice-session-snapshot.service.d.ts +13 -0
  24. package/dist/angular/voice-stream.service.d.ts +2 -0
  25. package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
  26. package/dist/angular/voice-turn-latency.service.d.ts +13 -0
  27. package/dist/angular/voice-turn-quality.service.d.ts +12 -0
  28. package/dist/angular/voice-workflow-status.service.d.ts +12 -0
  29. package/dist/audit.d.ts +131 -0
  30. package/dist/auditDeliveryRoutes.d.ts +85 -0
  31. package/dist/auditExport.d.ts +34 -0
  32. package/dist/auditRoutes.d.ts +66 -0
  33. package/dist/auditSinks.d.ts +151 -0
  34. package/dist/bargeInRoutes.d.ts +56 -0
  35. package/dist/browserCallProfiles.d.ts +120 -0
  36. package/dist/browserMediaRoutes.d.ts +62 -0
  37. package/dist/callDebugger.d.ts +66 -0
  38. package/dist/campaign.d.ts +794 -0
  39. package/dist/campaignDialers.d.ts +111 -0
  40. package/dist/client/actions.d.ts +94 -0
  41. package/dist/client/agentSquadStatus.d.ts +37 -0
  42. package/dist/client/agentSquadStatusWidget.d.ts +24 -0
  43. package/dist/client/bargeInMonitor.d.ts +7 -0
  44. package/dist/client/browserMedia.d.ts +8 -0
  45. package/dist/client/callDebugger.d.ts +19 -0
  46. package/dist/client/callDebuggerWidget.d.ts +30 -0
  47. package/dist/client/campaignDialerProof.d.ts +23 -0
  48. package/dist/client/deliveryRuntime.d.ts +34 -0
  49. package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
  50. package/dist/client/duplex.d.ts +1 -1
  51. package/dist/client/htmxBootstrap.js +950 -14
  52. package/dist/client/index.d.ts +87 -0
  53. package/dist/client/index.js +9890 -52
  54. package/dist/client/liveOps.d.ts +22 -0
  55. package/dist/client/liveOpsWidget.d.ts +23 -0
  56. package/dist/client/liveTurnLatency.d.ts +41 -0
  57. package/dist/client/opsActionCenter.d.ts +54 -0
  58. package/dist/client/opsActionCenterWidget.d.ts +29 -0
  59. package/dist/client/opsActionHistory.d.ts +19 -0
  60. package/dist/client/opsActionHistoryWidget.d.ts +11 -0
  61. package/dist/client/opsStatus.d.ts +19 -0
  62. package/dist/client/opsStatusWidget.d.ts +40 -0
  63. package/dist/client/platformCoverage.d.ts +19 -0
  64. package/dist/client/platformCoverageWidget.d.ts +37 -0
  65. package/dist/client/profileComparison.d.ts +19 -0
  66. package/dist/client/profileComparisonWidget.d.ts +41 -0
  67. package/dist/client/profileSwitchRecommendation.d.ts +19 -0
  68. package/dist/client/profileSwitchRecommendationWidget.d.ts +12 -0
  69. package/dist/client/proofTrends.d.ts +19 -0
  70. package/dist/client/proofTrendsWidget.d.ts +37 -0
  71. package/dist/client/providerCapabilities.d.ts +19 -0
  72. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  73. package/dist/client/providerContracts.d.ts +19 -0
  74. package/dist/client/providerContractsWidget.d.ts +37 -0
  75. package/dist/client/providerSimulationControls.d.ts +33 -0
  76. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  77. package/dist/client/providerStatusWidget.d.ts +32 -0
  78. package/dist/client/readinessFailures.d.ts +19 -0
  79. package/dist/client/readinessFailuresWidget.d.ts +42 -0
  80. package/dist/client/routingStatus.d.ts +19 -0
  81. package/dist/client/routingStatusWidget.d.ts +32 -0
  82. package/dist/client/sessionSnapshot.d.ts +21 -0
  83. package/dist/client/sessionSnapshotWidget.d.ts +33 -0
  84. package/dist/client/traceTimeline.d.ts +19 -0
  85. package/dist/client/traceTimelineWidget.d.ts +36 -0
  86. package/dist/client/turnLatency.d.ts +22 -0
  87. package/dist/client/turnLatencyWidget.d.ts +33 -0
  88. package/dist/client/turnQuality.d.ts +19 -0
  89. package/dist/client/turnQualityWidget.d.ts +32 -0
  90. package/dist/client/workflowStatus.d.ts +19 -0
  91. package/dist/competitiveCoverage.d.ts +141 -0
  92. package/dist/dataControl.d.ts +180 -0
  93. package/dist/deliveryRuntime.d.ts +158 -0
  94. package/dist/deliverySinkRoutes.d.ts +117 -0
  95. package/dist/demoReadyRoutes.d.ts +98 -0
  96. package/dist/evalRoutes.d.ts +96 -0
  97. package/dist/fileStore.d.ts +14 -2
  98. package/dist/guardrails.d.ts +128 -0
  99. package/dist/incidentBundle.d.ts +116 -0
  100. package/dist/index.d.ts +161 -18
  101. package/dist/index.js +34906 -6731
  102. package/dist/latencySlo.d.ts +56 -0
  103. package/dist/liveLatency.d.ts +78 -0
  104. package/dist/liveOps.d.ts +190 -0
  105. package/dist/mediaPipelineRoutes.d.ts +117 -0
  106. package/dist/modelAdapters.d.ts +54 -2
  107. package/dist/observabilityExport.d.ts +497 -0
  108. package/dist/openaiTTS.d.ts +18 -0
  109. package/dist/operationalStatus.d.ts +87 -0
  110. package/dist/operationsRecord.d.ts +351 -0
  111. package/dist/opsActionAuditRoutes.d.ts +99 -0
  112. package/dist/opsConsoleRoutes.d.ts +3 -0
  113. package/dist/opsRecovery.d.ts +137 -0
  114. package/dist/opsStatus.d.ts +76 -0
  115. package/dist/opsStatusRoutes.d.ts +33 -0
  116. package/dist/outcomeContract.d.ts +146 -0
  117. package/dist/phoneAgent.d.ts +139 -0
  118. package/dist/phoneAgentProductionSmoke.d.ts +115 -0
  119. package/dist/platformCoverage.d.ts +91 -0
  120. package/dist/postCallAnalysis.d.ts +98 -0
  121. package/dist/postgresStore.d.ts +13 -2
  122. package/dist/productionReadiness.d.ts +698 -0
  123. package/dist/profileSwitchRecommendation.d.ts +350 -0
  124. package/dist/proofAssertions.d.ts +32 -0
  125. package/dist/proofPack.d.ts +206 -0
  126. package/dist/proofRunner.d.ts +79 -0
  127. package/dist/proofTrends.d.ts +715 -0
  128. package/dist/providerAdapters.d.ts +12 -1
  129. package/dist/providerCapabilities.d.ts +92 -0
  130. package/dist/providerDecisionTraces.d.ts +130 -0
  131. package/dist/providerOrchestration.d.ts +109 -0
  132. package/dist/providerRouterTraces.d.ts +35 -0
  133. package/dist/providerRoutingContract.d.ts +71 -0
  134. package/dist/providerSlo.d.ts +142 -0
  135. package/dist/providerStackRecommendations.d.ts +187 -0
  136. package/dist/queue.d.ts +9 -0
  137. package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
  138. package/dist/react/VoiceCallDebuggerLaunch.d.ts +6 -0
  139. package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
  140. package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
  141. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  142. package/dist/react/VoicePlatformCoverage.d.ts +6 -0
  143. package/dist/react/VoiceProfileComparison.d.ts +6 -0
  144. package/dist/react/VoiceProfileSwitchRecommendation.d.ts +6 -0
  145. package/dist/react/VoiceProofTrends.d.ts +6 -0
  146. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  147. package/dist/react/VoiceProviderContracts.d.ts +6 -0
  148. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  149. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  150. package/dist/react/VoiceReadinessFailures.d.ts +6 -0
  151. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  152. package/dist/react/VoiceSessionSnapshot.d.ts +6 -0
  153. package/dist/react/VoiceTraceTimeline.d.ts +6 -0
  154. package/dist/react/VoiceTurnLatency.d.ts +6 -0
  155. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  156. package/dist/react/index.d.ts +40 -0
  157. package/dist/react/index.js +10624 -31
  158. package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
  159. package/dist/react/useVoiceCallDebugger.d.ts +8 -0
  160. package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
  161. package/dist/react/useVoiceController.d.ts +2 -0
  162. package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
  163. package/dist/react/useVoiceLiveOps.d.ts +9 -0
  164. package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
  165. package/dist/react/useVoiceOpsStatus.d.ts +8 -0
  166. package/dist/react/useVoicePlatformCoverage.d.ts +8 -0
  167. package/dist/react/useVoiceProfileComparison.d.ts +8 -0
  168. package/dist/react/useVoiceProfileSwitchRecommendation.d.ts +8 -0
  169. package/dist/react/useVoiceProofTrends.d.ts +8 -0
  170. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  171. package/dist/react/useVoiceProviderContracts.d.ts +8 -0
  172. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  173. package/dist/react/useVoiceReadinessFailures.d.ts +8 -0
  174. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  175. package/dist/react/useVoiceSessionSnapshot.d.ts +9 -0
  176. package/dist/react/useVoiceStream.d.ts +2 -0
  177. package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
  178. package/dist/react/useVoiceTurnLatency.d.ts +9 -0
  179. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  180. package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
  181. package/dist/readinessProfiles.d.ts +38 -0
  182. package/dist/realtimeChannel.d.ts +136 -0
  183. package/dist/realtimeProviderContracts.d.ts +133 -0
  184. package/dist/reconnectContract.d.ts +88 -0
  185. package/dist/resilienceRoutes.d.ts +40 -0
  186. package/dist/sessionReplay.d.ts +12 -0
  187. package/dist/sessionSnapshot.d.ts +109 -0
  188. package/dist/simulationSuite.d.ts +143 -0
  189. package/dist/sloCalibration.d.ts +185 -0
  190. package/dist/sqliteStore.d.ts +13 -2
  191. package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
  192. package/dist/svelte/createVoiceCallDebugger.d.ts +12 -0
  193. package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
  194. package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
  195. package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
  196. package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
  197. package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
  198. package/dist/svelte/createVoicePlatformCoverage.d.ts +7 -0
  199. package/dist/svelte/createVoiceProfileComparison.d.ts +7 -0
  200. package/dist/svelte/createVoiceProofTrends.d.ts +7 -0
  201. package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
  202. package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
  203. package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
  204. package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
  205. package/dist/svelte/createVoiceReadinessFailures.d.ts +7 -0
  206. package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
  207. package/dist/svelte/createVoiceSessionSnapshot.d.ts +13 -0
  208. package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
  209. package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
  210. package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
  211. package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
  212. package/dist/svelte/index.d.ts +20 -0
  213. package/dist/svelte/index.js +6403 -460
  214. package/dist/telephony/contract.d.ts +61 -0
  215. package/dist/telephony/matrix.d.ts +97 -0
  216. package/dist/telephony/plivo.d.ts +303 -0
  217. package/dist/telephony/security.d.ts +182 -0
  218. package/dist/telephony/telnyx.d.ts +291 -0
  219. package/dist/telephony/twilio.d.ts +136 -2
  220. package/dist/telephonyMediaRoutes.d.ts +72 -0
  221. package/dist/telephonyOutcome.d.ts +273 -0
  222. package/dist/testing/index.js +5363 -163
  223. package/dist/testing/telephony.d.ts +25 -0
  224. package/dist/toolContract.d.ts +161 -0
  225. package/dist/toolRuntime.d.ts +50 -0
  226. package/dist/trace.d.ts +40 -1
  227. package/dist/traceDeliveryRoutes.d.ts +86 -0
  228. package/dist/traceTimeline.d.ts +97 -0
  229. package/dist/turnLatency.d.ts +95 -0
  230. package/dist/turnQuality.d.ts +94 -0
  231. package/dist/types.d.ts +157 -3
  232. package/dist/voiceMonitoring.d.ts +444 -0
  233. package/dist/vue/VoiceCallDebuggerLaunch.d.ts +68 -0
  234. package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
  235. package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
  236. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  237. package/dist/vue/VoicePlatformCoverage.d.ts +23 -0
  238. package/dist/vue/VoiceProofTrends.d.ts +21 -0
  239. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  240. package/dist/vue/VoiceProviderContracts.d.ts +21 -0
  241. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  242. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  243. package/dist/vue/VoiceReadinessFailures.d.ts +21 -0
  244. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  245. package/dist/vue/VoiceSessionSnapshot.d.ts +68 -0
  246. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  247. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  248. package/dist/vue/index.d.ts +35 -0
  249. package/dist/vue/index.js +10069 -56
  250. package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
  251. package/dist/vue/useVoiceCallDebugger.d.ts +10 -0
  252. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  253. package/dist/vue/useVoiceController.d.ts +2 -1
  254. package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
  255. package/dist/vue/useVoiceLiveOps.d.ts +9 -0
  256. package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
  257. package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
  258. package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
  259. package/dist/vue/useVoiceProfileComparison.d.ts +9 -0
  260. package/dist/vue/useVoiceProofTrends.d.ts +9 -0
  261. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  262. package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
  263. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  264. package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
  265. package/dist/vue/useVoiceReadinessFailures.d.ts +899 -0
  266. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  267. package/dist/vue/useVoiceSessionSnapshot.d.ts +10 -0
  268. package/dist/vue/useVoiceStream.d.ts +3 -1
  269. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  270. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  271. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  272. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  273. package/dist/workflowContract.d.ts +91 -0
  274. package/package.json +4 -1
@@ -0,0 +1,94 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { VoiceSessionRecord, VoiceSessionStore, VoiceTranscriptQuality } from './types';
3
+ export type VoiceTurnQualityStatus = 'pass' | 'warn' | 'fail' | 'unknown';
4
+ export type VoiceTurnQualityItem = {
5
+ averageConfidence?: number;
6
+ committedAt: number;
7
+ correctionChanged: boolean;
8
+ correctionProvider?: string;
9
+ correctionReason?: string;
10
+ costUnits?: number;
11
+ fallbackSelectionReason?: string;
12
+ fallbackUsed: boolean;
13
+ finalTranscriptCount: number;
14
+ latencyMs?: number;
15
+ partialTranscriptCount: number;
16
+ selectedTranscriptCount: number;
17
+ sessionId: string;
18
+ source?: VoiceTranscriptQuality['source'];
19
+ status: VoiceTurnQualityStatus;
20
+ text: string;
21
+ turnId: string;
22
+ };
23
+ export type VoiceTurnQualityReport = {
24
+ checkedAt: number;
25
+ failed: number;
26
+ sessions: number;
27
+ status: VoiceTurnQualityStatus;
28
+ total: number;
29
+ turns: VoiceTurnQualityItem[];
30
+ warnings: number;
31
+ };
32
+ export type VoiceTurnQualityOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = {
33
+ confidenceWarnThreshold?: number;
34
+ limit?: number;
35
+ sessionIds?: string[];
36
+ sessions?: TSession[];
37
+ store?: VoiceSessionStore<TSession>;
38
+ };
39
+ export type VoiceTurnQualityHTMLHandlerOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = VoiceTurnQualityOptions<TSession> & {
40
+ headers?: HeadersInit;
41
+ render?: (report: VoiceTurnQualityReport) => string | Promise<string>;
42
+ title?: string;
43
+ };
44
+ export type VoiceTurnQualityRoutesOptions<TSession extends VoiceSessionRecord = VoiceSessionRecord> = VoiceTurnQualityHTMLHandlerOptions<TSession> & {
45
+ htmlPath?: false | string;
46
+ name?: string;
47
+ path?: string;
48
+ };
49
+ export declare const summarizeVoiceTurnQuality: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnQualityOptions<TSession>) => Promise<VoiceTurnQualityReport>;
50
+ export declare const renderVoiceTurnQualityHTML: (report: VoiceTurnQualityReport, options?: {
51
+ title?: string;
52
+ }) => string;
53
+ export declare const createVoiceTurnQualityJSONHandler: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnQualityOptions<TSession>) => () => Promise<VoiceTurnQualityReport>;
54
+ export declare const createVoiceTurnQualityHTMLHandler: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnQualityHTMLHandlerOptions<TSession>) => () => Promise<Response>;
55
+ export declare const createVoiceTurnQualityRoutes: <TSession extends VoiceSessionRecord = VoiceSessionRecord>(options: VoiceTurnQualityRoutesOptions<TSession>) => Elysia<"", {
56
+ decorator: {};
57
+ store: {};
58
+ derive: {};
59
+ resolve: {};
60
+ }, {
61
+ typebox: {};
62
+ error: {};
63
+ }, {
64
+ schema: {};
65
+ standaloneSchema: {};
66
+ macro: {};
67
+ macroFn: {};
68
+ parser: {};
69
+ response: {};
70
+ }, {
71
+ [x: string]: {
72
+ get: {
73
+ body: unknown;
74
+ params: {};
75
+ query: unknown;
76
+ headers: unknown;
77
+ response: {
78
+ 200: VoiceTurnQualityReport;
79
+ };
80
+ };
81
+ };
82
+ }, {
83
+ derive: {};
84
+ resolve: {};
85
+ schema: {};
86
+ standaloneSchema: {};
87
+ response: {};
88
+ }, {
89
+ derive: {};
90
+ resolve: {};
91
+ schema: {};
92
+ standaloneSchema: {};
93
+ response: {};
94
+ }>;
package/dist/types.d.ts CHANGED
@@ -1,8 +1,13 @@
1
1
  import type { SessionStore } from '@absolutejs/absolute';
2
+ import type { MediaWebRTCStatsCollector, MediaWebRTCStatsReport, MediaWebRTCStatsReportInput, MediaWebRTCStreamContinuityInput, MediaWebRTCStreamContinuityReport } from '@absolutejs/media';
2
3
  import type { VoiceOpsDispositionTaskPolicies, VoiceOpsTaskAssignmentRule, VoiceOpsTaskAssignmentRules, VoiceIntegrationWebhookConfig, StoredVoiceIntegrationEvent, StoredVoiceOpsTask, VoiceIntegrationEventStore, VoiceOpsTaskPolicy, VoiceOpsTask, VoiceOpsTaskStore } from './ops';
3
4
  import type { VoiceIntegrationSink } from './opsSinks';
4
5
  import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from './testing/review';
5
6
  import type { VoiceTraceEventStore } from './trace';
7
+ import type { VoiceLiveOpsControlState } from './liveOps';
8
+ import type { VoiceAuditActor, VoiceAuditEventStore } from './audit';
9
+ import type { VoiceProfileSwitchGuardDecision, VoiceProfileSwitchGuardMode, VoiceProfileSwitchObservedSignals } from './profileSwitchRecommendation';
10
+ import type { VoiceRealCallProfileDefaultsReport, VoiceRealCallProfileHistoryReport } from './proofTrends';
6
11
  export type AudioFormat = {
7
12
  container: 'raw';
8
13
  encoding: 'alaw' | 'mulaw' | 'pcm_s16le';
@@ -193,6 +198,15 @@ export type RealtimeAdapter<TOptions extends RealtimeAdapterOpenOptions = Realti
193
198
  open: (options: TOptions) => Promise<RealtimeAdapterSession> | RealtimeAdapterSession;
194
199
  };
195
200
  export type VoiceSessionStatus = 'active' | 'reconnecting' | 'completed' | 'failed';
201
+ export type VoiceReconnectClientStatus = 'idle' | 'reconnecting' | 'resumed' | 'exhausted';
202
+ export type VoiceReconnectClientState = {
203
+ attempts: number;
204
+ lastDisconnectAt?: number;
205
+ lastResumedAt?: number;
206
+ maxAttempts: number;
207
+ nextAttemptAt?: number;
208
+ status: VoiceReconnectClientStatus;
209
+ };
196
210
  export type VoiceTurnRecord<TResult = unknown> = {
197
211
  id: string;
198
212
  text: string;
@@ -475,6 +489,10 @@ export type VoiceLexiconResolver<TContext = unknown> = (input: {
475
489
  }) => Promise<VoiceLexiconEntry[] | void> | VoiceLexiconEntry[] | void;
476
490
  export type VoiceOnTurnObjectHandler<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = (input: {
477
491
  context: TContext;
492
+ liveOps?: {
493
+ control: VoiceLiveOpsControlState;
494
+ injectedInstruction?: string;
495
+ };
478
496
  session: TSession;
479
497
  turn: VoiceTurnRecord;
480
498
  api: VoiceSessionHandle<TContext, TSession, TResult>;
@@ -596,6 +614,36 @@ export type VoiceRuntimeOpsConfig<TContext = unknown, TSession extends VoiceSess
596
614
  tasks?: VoiceOpsTaskStore;
597
615
  webhook?: VoiceIntegrationWebhookConfig;
598
616
  };
617
+ export type VoiceLiveOpsRuntimeConfig = {
618
+ getControl: (sessionId: string) => Promise<VoiceLiveOpsControlState | null | undefined> | VoiceLiveOpsControlState | null | undefined;
619
+ };
620
+ export type VoiceProfileSwitchGuardResolverInput<TContext = unknown> = {
621
+ context: TContext;
622
+ scenarioId?: string;
623
+ sessionId: string;
624
+ };
625
+ export type VoicePluginProfileSwitchGuardConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
626
+ actor?: VoiceAuditActor;
627
+ allowedProfileIds?: string[] | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<string[] | undefined> | string[] | undefined);
628
+ audit?: VoiceAuditEventStore;
629
+ blockedProfileIds?: string[] | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<string[] | undefined> | string[] | undefined);
630
+ currentProfileId?: string | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<string | undefined> | string | undefined);
631
+ defaultProfileId?: string;
632
+ defaults: VoiceRealCallProfileDefaultsReport | VoiceRealCallProfileHistoryReport | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<VoiceRealCallProfileDefaultsReport | VoiceRealCallProfileHistoryReport> | VoiceRealCallProfileDefaultsReport | VoiceRealCallProfileHistoryReport);
633
+ metadata?: Record<string, unknown> | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<Record<string, unknown> | undefined> | Record<string, unknown> | undefined);
634
+ minConfidence?: number | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<number | undefined> | number | undefined);
635
+ maxAutoSwitchesPerSession?: number | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<number | undefined> | number | undefined);
636
+ mode?: VoiceProfileSwitchGuardMode | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<VoiceProfileSwitchGuardMode | undefined> | VoiceProfileSwitchGuardMode | undefined);
637
+ observed?: VoiceProfileSwitchObservedSignals | ((input: VoiceProfileSwitchGuardResolverInput<TContext>) => Promise<VoiceProfileSwitchObservedSignals | undefined> | VoiceProfileSwitchObservedSignals | undefined);
638
+ onDecision?: (input: {
639
+ context: TContext;
640
+ decision: VoiceProfileSwitchGuardDecision;
641
+ scenarioId?: string;
642
+ sessionId: string;
643
+ }) => Promise<void> | void;
644
+ sessionMetadataKey?: string | false;
645
+ trace?: false | VoiceTraceEventStore;
646
+ };
599
647
  export type VoiceNormalizedRouteConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoiceRouteConfig<TContext, TSession, TResult>, 'onTurn'> & {
600
648
  onTurn: VoiceOnTurnObjectHandler<TContext, TSession, TResult>;
601
649
  };
@@ -616,9 +664,11 @@ export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionR
616
664
  lexicon?: VoiceLexiconEntry[] | VoiceLexiconResolver<TContext>;
617
665
  phraseHints?: VoicePhraseHint[] | VoicePhraseHintResolver<TContext>;
618
666
  preset?: VoiceRuntimePreset;
619
- stt: STTAdapter;
667
+ stt?: STTAdapter;
620
668
  sttFallback?: VoiceSTTFallbackConfig;
621
669
  sttLifecycle?: VoiceSTTLifecycle;
670
+ realtime?: RealtimeAdapter;
671
+ realtimeInputFormat?: AudioFormat;
622
672
  tts?: TTSAdapter;
623
673
  session: VoiceSessionStore<NoInfer<TSession>>;
624
674
  reconnect?: VoiceReconnectConfig;
@@ -628,6 +678,8 @@ export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionR
628
678
  htmx?: boolean | VoiceHTMXConfig<TSession, NoInfer<TResult>>;
629
679
  handoff?: VoiceHandoffConfig<TContext, TSession, TResult>;
630
680
  ops?: VoiceRuntimeOpsConfig<TContext, TSession, TResult>;
681
+ liveOps?: VoiceLiveOpsRuntimeConfig;
682
+ profileSwitchGuard?: VoicePluginProfileSwitchGuardConfig<TContext, TSession, TResult>;
631
683
  trace?: VoiceTraceEventStore;
632
684
  } & VoiceRouteConfig<TContext, TSession, TResult>;
633
685
  export type CreateVoiceSessionOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
@@ -635,7 +687,9 @@ export type CreateVoiceSessionOptions<TContext = unknown, TSession extends Voice
635
687
  id: string;
636
688
  context: TContext;
637
689
  socket: VoiceSocket;
638
- stt: STTAdapter;
690
+ stt?: STTAdapter;
691
+ realtime?: RealtimeAdapter;
692
+ realtimeInputFormat?: AudioFormat;
639
693
  tts?: TTSAdapter;
640
694
  languageStrategy?: VoiceLanguageStrategy;
641
695
  lexicon?: VoiceLexiconEntry[];
@@ -644,11 +698,13 @@ export type CreateVoiceSessionOptions<TContext = unknown, TSession extends Voice
644
698
  trace?: VoiceTraceEventStore;
645
699
  reconnect: Required<VoiceReconnectConfig>;
646
700
  phraseHints?: VoicePhraseHint[];
701
+ sessionMetadata?: Record<string, unknown>;
647
702
  scenarioId?: string;
648
703
  sttLifecycle: VoiceSTTLifecycle;
649
704
  turnDetection: VoiceResolvedTurnDetectionConfig;
650
705
  audioConditioning?: VoiceResolvedAudioConditioningConfig;
651
706
  handoff?: VoiceHandoffConfig<TContext, TSession, TResult>;
707
+ liveOps?: VoiceLiveOpsRuntimeConfig;
652
708
  route: VoiceNormalizedRouteConfig<TContext, TSession, TResult>;
653
709
  logger?: VoiceLogger;
654
710
  };
@@ -681,6 +737,18 @@ export type VoiceServerSessionMessage = {
681
737
  sessionId: string;
682
738
  status: VoiceSessionStatus;
683
739
  scenarioId?: string;
740
+ sessionMetadata?: Record<string, unknown>;
741
+ };
742
+ export type VoiceServerReplayMessage<TResult = unknown> = {
743
+ type: 'replay';
744
+ assistantTexts: string[];
745
+ call?: VoiceCallLifecycleState;
746
+ partial: string;
747
+ scenarioId?: string;
748
+ sessionId: string;
749
+ sessionMetadata?: Record<string, unknown>;
750
+ status: VoiceSessionStatus;
751
+ turns: VoiceTurnRecord<TResult>[];
684
752
  };
685
753
  export type VoiceServerPartialMessage = {
686
754
  type: 'partial';
@@ -723,17 +791,43 @@ export type VoiceServerErrorMessage = {
723
791
  export type VoiceServerPongMessage = {
724
792
  type: 'pong';
725
793
  };
726
- export type VoiceServerMessage<TResult = unknown> = VoiceServerSessionMessage | VoiceServerPartialMessage | VoiceServerFinalMessage | VoiceServerTurnMessage<TResult> | VoiceServerAssistantMessage | VoiceServerAudioMessage | VoiceServerCallLifecycleMessage | VoiceServerCompleteMessage | VoiceServerErrorMessage | VoiceServerPongMessage;
794
+ export type VoiceServerConnectionMessage = {
795
+ type: 'connection';
796
+ reconnect: VoiceReconnectClientState;
797
+ };
798
+ export type VoiceServerMessage<TResult = unknown> = VoiceServerSessionMessage | VoiceServerReplayMessage<TResult> | VoiceServerPartialMessage | VoiceServerFinalMessage | VoiceServerTurnMessage<TResult> | VoiceServerAssistantMessage | VoiceServerAudioMessage | VoiceServerCallLifecycleMessage | VoiceServerCompleteMessage | VoiceServerErrorMessage | VoiceServerPongMessage | VoiceServerConnectionMessage;
727
799
  export type VoiceConnectionOptions = {
800
+ browserMedia?: false | VoiceBrowserMediaReporterOptions;
728
801
  protocols?: string[];
729
802
  scenarioId?: string;
730
803
  reconnect?: boolean;
804
+ reconnectReportPath?: string;
731
805
  maxReconnectAttempts?: number;
732
806
  pingInterval?: number;
733
807
  sessionId?: string;
734
808
  };
809
+ export type VoiceBrowserMediaReportPayload = {
810
+ at: number;
811
+ continuity?: MediaWebRTCStreamContinuityReport;
812
+ report: MediaWebRTCStatsReport;
813
+ scenarioId?: string | null;
814
+ sessionId?: string | null;
815
+ };
816
+ export type VoiceBrowserMediaReporterOptions = Omit<MediaWebRTCStatsReportInput, 'peerConnection'> & {
817
+ fetch?: typeof fetch;
818
+ getPeerConnection?: (() => MediaWebRTCStatsCollector | null | undefined) | (() => Promise<MediaWebRTCStatsCollector | null | undefined>);
819
+ getScenarioId?: () => string | null | undefined;
820
+ getSessionId?: () => string | null | undefined;
821
+ intervalMs?: number;
822
+ continuity?: false | Omit<MediaWebRTCStreamContinuityInput, 'previousStats' | 'stats'>;
823
+ onError?: (error: unknown) => void;
824
+ onReport?: (payload: VoiceBrowserMediaReportPayload) => void;
825
+ path?: string;
826
+ peerConnection?: MediaWebRTCStatsCollector;
827
+ };
735
828
  export type VoiceCaptureOptions = {
736
829
  channelCount?: 1 | 2;
830
+ onAudio?: (audio: Uint8Array | ArrayBuffer, sendAudio: (audio: Uint8Array | ArrayBuffer) => void) => void;
737
831
  onLevel?: (level: number) => void;
738
832
  sampleRateHz?: number;
739
833
  };
@@ -747,6 +841,46 @@ export type VoiceBargeInOptions = {
747
841
  enabled?: boolean;
748
842
  interruptOnPartial?: boolean;
749
843
  interruptThreshold?: number;
844
+ monitor?: VoiceBargeInMonitor;
845
+ };
846
+ export type VoiceBargeInTriggerReason = 'input-level' | 'manual-audio' | 'manual-interrupt' | 'partial-transcript';
847
+ export type VoiceBargeInMonitorEvent = {
848
+ at: number;
849
+ id: string;
850
+ latencyMs?: number;
851
+ playbackStopLatencyMs?: number;
852
+ reason: VoiceBargeInTriggerReason;
853
+ sessionId?: string | null;
854
+ status: 'requested' | 'stopped' | 'skipped';
855
+ thresholdMs?: number;
856
+ };
857
+ export type VoiceBargeInMonitorSnapshot = {
858
+ averageLatencyMs?: number;
859
+ events: VoiceBargeInMonitorEvent[];
860
+ failed: number;
861
+ lastEvent?: VoiceBargeInMonitorEvent;
862
+ passed: number;
863
+ status: 'empty' | 'fail' | 'pass' | 'warn';
864
+ thresholdMs: number;
865
+ total: number;
866
+ };
867
+ export type VoiceBargeInMonitor = {
868
+ getSnapshot: () => VoiceBargeInMonitorSnapshot;
869
+ recordRequested: (input: {
870
+ reason: VoiceBargeInTriggerReason;
871
+ sessionId?: string | null;
872
+ }) => VoiceBargeInMonitorEvent;
873
+ recordSkipped: (input: {
874
+ reason: VoiceBargeInTriggerReason;
875
+ sessionId?: string | null;
876
+ }) => VoiceBargeInMonitorEvent;
877
+ recordStopped: (input: {
878
+ latencyMs?: number;
879
+ playbackStopLatencyMs?: number;
880
+ reason: VoiceBargeInTriggerReason;
881
+ sessionId?: string | null;
882
+ }) => VoiceBargeInMonitorEvent;
883
+ subscribe: (subscriber: () => void) => () => void;
750
884
  };
751
885
  export type VoiceAudioPlayerOptions = {
752
886
  autoStart?: boolean;
@@ -802,9 +936,11 @@ export type VoiceHTMXOptions<TSession extends VoiceSessionRecord = VoiceSessionR
802
936
  export type VoiceHTMXConfig<TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = VoiceHTMXRenderer<TSession, TResult> | VoiceHTMXOptions<TSession, TResult>;
803
937
  export type VoiceStreamState<TResult = unknown> = {
804
938
  call: VoiceCallLifecycleState | null;
939
+ sessionMetadata: Record<string, unknown> | null;
805
940
  sessionId: string | null;
806
941
  scenarioId: string | null;
807
942
  status: VoiceSessionStatus | 'idle';
943
+ reconnect: VoiceReconnectClientState;
808
944
  partial: string;
809
945
  turns: VoiceTurnRecord<TResult>[];
810
946
  assistantTexts: string[];
@@ -831,8 +967,10 @@ export type VoiceStream<TResult = unknown> = {
831
967
  getSnapshot: () => VoiceStreamState<TResult>;
832
968
  isConnected: boolean;
833
969
  partial: string;
970
+ reconnect: VoiceReconnectClientState;
834
971
  sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
835
972
  sessionId: string | null;
973
+ sessionMetadata: Record<string, unknown> | null;
836
974
  scenarioId: string | null;
837
975
  status: VoiceSessionStatus | 'idle';
838
976
  subscribe: (subscriber: () => void) => () => void;
@@ -900,9 +1038,11 @@ export type VoiceController<TResult = unknown> = {
900
1038
  isConnected: boolean;
901
1039
  isRecording: boolean;
902
1040
  partial: string;
1041
+ reconnect: VoiceReconnectClientState;
903
1042
  recordingError: string | null;
904
1043
  sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
905
1044
  sessionId: string | null;
1045
+ sessionMetadata: Record<string, unknown> | null;
906
1046
  scenarioId: string | null;
907
1047
  startRecording: () => Promise<void>;
908
1048
  status: VoiceSessionStatus | 'idle';
@@ -931,8 +1071,19 @@ export type VoiceHTMXBindingOptions = {
931
1071
  export type VoiceStoreAction<TResult = unknown> = {
932
1072
  type: 'session';
933
1073
  sessionId: string;
1074
+ sessionMetadata?: Record<string, unknown>;
934
1075
  scenarioId?: string;
935
1076
  status: VoiceSessionStatus;
1077
+ } | {
1078
+ type: 'replay';
1079
+ assistantTexts: string[];
1080
+ call?: VoiceCallLifecycleState;
1081
+ partial: string;
1082
+ scenarioId?: string;
1083
+ sessionId: string;
1084
+ sessionMetadata?: Record<string, unknown>;
1085
+ status: VoiceSessionStatus;
1086
+ turns: VoiceTurnRecord<TResult>[];
936
1087
  } | {
937
1088
  type: 'call_lifecycle';
938
1089
  event: VoiceCallLifecycleEvent;
@@ -963,6 +1114,9 @@ export type VoiceStoreAction<TResult = unknown> = {
963
1114
  message: string;
964
1115
  } | {
965
1116
  type: 'connected';
1117
+ } | {
1118
+ type: 'connection';
1119
+ reconnect: VoiceReconnectClientState;
966
1120
  } | {
967
1121
  type: 'disconnected';
968
1122
  };