@absolutejs/voice 0.0.22-beta.34 → 0.0.22-beta.341

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 (242) hide show
  1. package/README.md +3361 -55
  2. package/dist/agent.d.ts +62 -0
  3. package/dist/agentSquadContract.d.ts +98 -0
  4. package/dist/angular/index.d.ts +16 -0
  5. package/dist/angular/index.js +4240 -1128
  6. package/dist/angular/voice-agent-squad-status.service.d.ts +12 -0
  7. package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
  8. package/dist/angular/voice-controller.service.d.ts +1 -0
  9. package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
  10. package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
  11. package/dist/angular/voice-live-ops.service.d.ts +11 -0
  12. package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
  13. package/dist/angular/voice-ops-status.component.d.ts +15 -0
  14. package/dist/angular/voice-ops-status.service.d.ts +12 -0
  15. package/dist/angular/voice-platform-coverage.service.d.ts +12 -0
  16. package/dist/angular/voice-proof-trends.service.d.ts +12 -0
  17. package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
  18. package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
  19. package/dist/angular/voice-readiness-failures.service.d.ts +13 -0
  20. package/dist/angular/voice-routing-status.service.d.ts +11 -0
  21. package/dist/angular/voice-stream.service.d.ts +1 -0
  22. package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
  23. package/dist/angular/voice-turn-latency.service.d.ts +13 -0
  24. package/dist/angular/voice-turn-quality.service.d.ts +12 -0
  25. package/dist/angular/voice-workflow-status.service.d.ts +12 -0
  26. package/dist/audit.d.ts +128 -0
  27. package/dist/auditDeliveryRoutes.d.ts +85 -0
  28. package/dist/auditExport.d.ts +34 -0
  29. package/dist/auditRoutes.d.ts +66 -0
  30. package/dist/auditSinks.d.ts +151 -0
  31. package/dist/bargeInRoutes.d.ts +56 -0
  32. package/dist/browserMediaRoutes.d.ts +62 -0
  33. package/dist/campaign.d.ts +768 -0
  34. package/dist/campaignDialers.d.ts +111 -0
  35. package/dist/client/actions.d.ts +83 -0
  36. package/dist/client/agentSquadStatus.d.ts +37 -0
  37. package/dist/client/agentSquadStatusWidget.d.ts +24 -0
  38. package/dist/client/bargeInMonitor.d.ts +7 -0
  39. package/dist/client/browserMedia.d.ts +8 -0
  40. package/dist/client/campaignDialerProof.d.ts +23 -0
  41. package/dist/client/deliveryRuntime.d.ts +34 -0
  42. package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
  43. package/dist/client/duplex.d.ts +1 -1
  44. package/dist/client/htmxBootstrap.js +937 -14
  45. package/dist/client/index.d.ts +72 -0
  46. package/dist/client/index.js +6554 -50
  47. package/dist/client/liveOps.d.ts +22 -0
  48. package/dist/client/liveOpsWidget.d.ts +23 -0
  49. package/dist/client/liveTurnLatency.d.ts +41 -0
  50. package/dist/client/opsActionCenter.d.ts +54 -0
  51. package/dist/client/opsActionCenterWidget.d.ts +29 -0
  52. package/dist/client/opsActionHistory.d.ts +19 -0
  53. package/dist/client/opsActionHistoryWidget.d.ts +11 -0
  54. package/dist/client/opsStatus.d.ts +19 -0
  55. package/dist/client/opsStatusWidget.d.ts +40 -0
  56. package/dist/client/platformCoverage.d.ts +19 -0
  57. package/dist/client/platformCoverageWidget.d.ts +37 -0
  58. package/dist/client/proofTrends.d.ts +19 -0
  59. package/dist/client/proofTrendsWidget.d.ts +37 -0
  60. package/dist/client/providerCapabilities.d.ts +19 -0
  61. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  62. package/dist/client/providerContracts.d.ts +19 -0
  63. package/dist/client/providerContractsWidget.d.ts +37 -0
  64. package/dist/client/providerSimulationControls.d.ts +33 -0
  65. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  66. package/dist/client/providerStatusWidget.d.ts +32 -0
  67. package/dist/client/readinessFailures.d.ts +19 -0
  68. package/dist/client/readinessFailuresWidget.d.ts +42 -0
  69. package/dist/client/routingStatus.d.ts +19 -0
  70. package/dist/client/routingStatusWidget.d.ts +28 -0
  71. package/dist/client/traceTimeline.d.ts +19 -0
  72. package/dist/client/traceTimelineWidget.d.ts +36 -0
  73. package/dist/client/turnLatency.d.ts +22 -0
  74. package/dist/client/turnLatencyWidget.d.ts +33 -0
  75. package/dist/client/turnQuality.d.ts +19 -0
  76. package/dist/client/turnQualityWidget.d.ts +32 -0
  77. package/dist/client/workflowStatus.d.ts +19 -0
  78. package/dist/competitiveCoverage.d.ts +141 -0
  79. package/dist/dataControl.d.ts +180 -0
  80. package/dist/deliveryRuntime.d.ts +158 -0
  81. package/dist/deliverySinkRoutes.d.ts +117 -0
  82. package/dist/demoReadyRoutes.d.ts +98 -0
  83. package/dist/diagnosticsRoutes.d.ts +44 -0
  84. package/dist/evalRoutes.d.ts +219 -0
  85. package/dist/fileStore.d.ts +14 -2
  86. package/dist/guardrails.d.ts +128 -0
  87. package/dist/incidentBundle.d.ts +116 -0
  88. package/dist/index.d.ts +149 -14
  89. package/dist/index.js +30488 -5611
  90. package/dist/latencySlo.d.ts +56 -0
  91. package/dist/liveLatency.d.ts +78 -0
  92. package/dist/liveOps.d.ts +190 -0
  93. package/dist/mediaPipelineRoutes.d.ts +117 -0
  94. package/dist/modelAdapters.d.ts +54 -2
  95. package/dist/observabilityExport.d.ts +481 -0
  96. package/dist/openaiTTS.d.ts +18 -0
  97. package/dist/operationsRecord.d.ts +351 -0
  98. package/dist/opsActionAuditRoutes.d.ts +99 -0
  99. package/dist/opsConsoleRoutes.d.ts +80 -0
  100. package/dist/opsRecovery.d.ts +137 -0
  101. package/dist/opsStatus.d.ts +76 -0
  102. package/dist/opsStatusRoutes.d.ts +33 -0
  103. package/dist/outcomeContract.d.ts +146 -0
  104. package/dist/phoneAgent.d.ts +139 -0
  105. package/dist/phoneAgentProductionSmoke.d.ts +115 -0
  106. package/dist/platformCoverage.d.ts +91 -0
  107. package/dist/postCallAnalysis.d.ts +98 -0
  108. package/dist/postgresStore.d.ts +13 -2
  109. package/dist/productionReadiness.d.ts +611 -0
  110. package/dist/proofTrends.d.ts +325 -0
  111. package/dist/providerAdapters.d.ts +12 -1
  112. package/dist/providerCapabilities.d.ts +92 -0
  113. package/dist/providerDecisionTraces.d.ts +130 -0
  114. package/dist/providerOrchestration.d.ts +109 -0
  115. package/dist/providerRoutingContract.d.ts +71 -0
  116. package/dist/providerSlo.d.ts +142 -0
  117. package/dist/providerStackRecommendations.d.ts +187 -0
  118. package/dist/qualityRoutes.d.ts +76 -0
  119. package/dist/queue.d.ts +9 -0
  120. package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
  121. package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
  122. package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
  123. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  124. package/dist/react/VoicePlatformCoverage.d.ts +6 -0
  125. package/dist/react/VoiceProofTrends.d.ts +6 -0
  126. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  127. package/dist/react/VoiceProviderContracts.d.ts +6 -0
  128. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  129. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  130. package/dist/react/VoiceReadinessFailures.d.ts +6 -0
  131. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  132. package/dist/react/VoiceTraceTimeline.d.ts +6 -0
  133. package/dist/react/VoiceTurnLatency.d.ts +6 -0
  134. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  135. package/dist/react/index.d.ts +32 -0
  136. package/dist/react/index.js +6324 -31
  137. package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
  138. package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
  139. package/dist/react/useVoiceController.d.ts +1 -0
  140. package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
  141. package/dist/react/useVoiceLiveOps.d.ts +9 -0
  142. package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
  143. package/dist/react/useVoiceOpsStatus.d.ts +8 -0
  144. package/dist/react/useVoicePlatformCoverage.d.ts +8 -0
  145. package/dist/react/useVoiceProofTrends.d.ts +8 -0
  146. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  147. package/dist/react/useVoiceProviderContracts.d.ts +8 -0
  148. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  149. package/dist/react/useVoiceReadinessFailures.d.ts +8 -0
  150. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  151. package/dist/react/useVoiceStream.d.ts +1 -0
  152. package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
  153. package/dist/react/useVoiceTurnLatency.d.ts +9 -0
  154. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  155. package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
  156. package/dist/readinessProfiles.d.ts +38 -0
  157. package/dist/realtimeChannel.d.ts +136 -0
  158. package/dist/realtimeProviderContracts.d.ts +133 -0
  159. package/dist/reconnectContract.d.ts +88 -0
  160. package/dist/resilienceRoutes.d.ts +143 -0
  161. package/dist/sessionReplay.d.ts +12 -0
  162. package/dist/simulationSuite.d.ts +143 -0
  163. package/dist/sloCalibration.d.ts +185 -0
  164. package/dist/sqliteStore.d.ts +13 -2
  165. package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
  166. package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
  167. package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
  168. package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
  169. package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
  170. package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
  171. package/dist/svelte/createVoicePlatformCoverage.d.ts +7 -0
  172. package/dist/svelte/createVoiceProofTrends.d.ts +7 -0
  173. package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
  174. package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
  175. package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
  176. package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
  177. package/dist/svelte/createVoiceReadinessFailures.d.ts +7 -0
  178. package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
  179. package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
  180. package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
  181. package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
  182. package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
  183. package/dist/svelte/index.d.ts +17 -0
  184. package/dist/svelte/index.js +5666 -420
  185. package/dist/telephony/contract.d.ts +61 -0
  186. package/dist/telephony/matrix.d.ts +97 -0
  187. package/dist/telephony/plivo.d.ts +303 -0
  188. package/dist/telephony/security.d.ts +182 -0
  189. package/dist/telephony/telnyx.d.ts +291 -0
  190. package/dist/telephony/twilio.d.ts +136 -2
  191. package/dist/telephonyMediaRoutes.d.ts +72 -0
  192. package/dist/telephonyOutcome.d.ts +273 -0
  193. package/dist/testing/index.d.ts +1 -0
  194. package/dist/testing/index.js +5321 -153
  195. package/dist/testing/ioProviderSimulator.d.ts +41 -0
  196. package/dist/testing/telephony.d.ts +25 -0
  197. package/dist/toolContract.d.ts +161 -0
  198. package/dist/toolRuntime.d.ts +50 -0
  199. package/dist/trace.d.ts +19 -1
  200. package/dist/traceDeliveryRoutes.d.ts +86 -0
  201. package/dist/traceTimeline.d.ts +97 -0
  202. package/dist/turnLatency.d.ts +95 -0
  203. package/dist/turnQuality.d.ts +94 -0
  204. package/dist/types.d.ts +118 -3
  205. package/dist/voiceMonitoring.d.ts +444 -0
  206. package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
  207. package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
  208. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  209. package/dist/vue/VoicePlatformCoverage.d.ts +23 -0
  210. package/dist/vue/VoiceProofTrends.d.ts +21 -0
  211. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  212. package/dist/vue/VoiceProviderContracts.d.ts +21 -0
  213. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  214. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  215. package/dist/vue/VoiceReadinessFailures.d.ts +21 -0
  216. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  217. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  218. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  219. package/dist/vue/index.d.ts +30 -0
  220. package/dist/vue/index.js +6093 -56
  221. package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
  222. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  223. package/dist/vue/useVoiceController.d.ts +2 -1
  224. package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
  225. package/dist/vue/useVoiceLiveOps.d.ts +9 -0
  226. package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
  227. package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
  228. package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
  229. package/dist/vue/useVoiceProofTrends.d.ts +9 -0
  230. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  231. package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
  232. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  233. package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
  234. package/dist/vue/useVoiceReadinessFailures.d.ts +873 -0
  235. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  236. package/dist/vue/useVoiceStream.d.ts +2 -1
  237. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  238. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  239. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  240. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  241. package/dist/workflowContract.d.ts +91 -0
  242. 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,10 @@
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';
6
8
  export type AudioFormat = {
7
9
  container: 'raw';
8
10
  encoding: 'alaw' | 'mulaw' | 'pcm_s16le';
@@ -193,6 +195,15 @@ export type RealtimeAdapter<TOptions extends RealtimeAdapterOpenOptions = Realti
193
195
  open: (options: TOptions) => Promise<RealtimeAdapterSession> | RealtimeAdapterSession;
194
196
  };
195
197
  export type VoiceSessionStatus = 'active' | 'reconnecting' | 'completed' | 'failed';
198
+ export type VoiceReconnectClientStatus = 'idle' | 'reconnecting' | 'resumed' | 'exhausted';
199
+ export type VoiceReconnectClientState = {
200
+ attempts: number;
201
+ lastDisconnectAt?: number;
202
+ lastResumedAt?: number;
203
+ maxAttempts: number;
204
+ nextAttemptAt?: number;
205
+ status: VoiceReconnectClientStatus;
206
+ };
196
207
  export type VoiceTurnRecord<TResult = unknown> = {
197
208
  id: string;
198
209
  text: string;
@@ -475,6 +486,10 @@ export type VoiceLexiconResolver<TContext = unknown> = (input: {
475
486
  }) => Promise<VoiceLexiconEntry[] | void> | VoiceLexiconEntry[] | void;
476
487
  export type VoiceOnTurnObjectHandler<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = (input: {
477
488
  context: TContext;
489
+ liveOps?: {
490
+ control: VoiceLiveOpsControlState;
491
+ injectedInstruction?: string;
492
+ };
478
493
  session: TSession;
479
494
  turn: VoiceTurnRecord;
480
495
  api: VoiceSessionHandle<TContext, TSession, TResult>;
@@ -596,6 +611,9 @@ export type VoiceRuntimeOpsConfig<TContext = unknown, TSession extends VoiceSess
596
611
  tasks?: VoiceOpsTaskStore;
597
612
  webhook?: VoiceIntegrationWebhookConfig;
598
613
  };
614
+ export type VoiceLiveOpsRuntimeConfig = {
615
+ getControl: (sessionId: string) => Promise<VoiceLiveOpsControlState | null | undefined> | VoiceLiveOpsControlState | null | undefined;
616
+ };
599
617
  export type VoiceNormalizedRouteConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoiceRouteConfig<TContext, TSession, TResult>, 'onTurn'> & {
600
618
  onTurn: VoiceOnTurnObjectHandler<TContext, TSession, TResult>;
601
619
  };
@@ -616,9 +634,11 @@ export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionR
616
634
  lexicon?: VoiceLexiconEntry[] | VoiceLexiconResolver<TContext>;
617
635
  phraseHints?: VoicePhraseHint[] | VoicePhraseHintResolver<TContext>;
618
636
  preset?: VoiceRuntimePreset;
619
- stt: STTAdapter;
637
+ stt?: STTAdapter;
620
638
  sttFallback?: VoiceSTTFallbackConfig;
621
639
  sttLifecycle?: VoiceSTTLifecycle;
640
+ realtime?: RealtimeAdapter;
641
+ realtimeInputFormat?: AudioFormat;
622
642
  tts?: TTSAdapter;
623
643
  session: VoiceSessionStore<NoInfer<TSession>>;
624
644
  reconnect?: VoiceReconnectConfig;
@@ -628,6 +648,7 @@ export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionR
628
648
  htmx?: boolean | VoiceHTMXConfig<TSession, NoInfer<TResult>>;
629
649
  handoff?: VoiceHandoffConfig<TContext, TSession, TResult>;
630
650
  ops?: VoiceRuntimeOpsConfig<TContext, TSession, TResult>;
651
+ liveOps?: VoiceLiveOpsRuntimeConfig;
631
652
  trace?: VoiceTraceEventStore;
632
653
  } & VoiceRouteConfig<TContext, TSession, TResult>;
633
654
  export type CreateVoiceSessionOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
@@ -635,7 +656,9 @@ export type CreateVoiceSessionOptions<TContext = unknown, TSession extends Voice
635
656
  id: string;
636
657
  context: TContext;
637
658
  socket: VoiceSocket;
638
- stt: STTAdapter;
659
+ stt?: STTAdapter;
660
+ realtime?: RealtimeAdapter;
661
+ realtimeInputFormat?: AudioFormat;
639
662
  tts?: TTSAdapter;
640
663
  languageStrategy?: VoiceLanguageStrategy;
641
664
  lexicon?: VoiceLexiconEntry[];
@@ -649,6 +672,7 @@ export type CreateVoiceSessionOptions<TContext = unknown, TSession extends Voice
649
672
  turnDetection: VoiceResolvedTurnDetectionConfig;
650
673
  audioConditioning?: VoiceResolvedAudioConditioningConfig;
651
674
  handoff?: VoiceHandoffConfig<TContext, TSession, TResult>;
675
+ liveOps?: VoiceLiveOpsRuntimeConfig;
652
676
  route: VoiceNormalizedRouteConfig<TContext, TSession, TResult>;
653
677
  logger?: VoiceLogger;
654
678
  };
@@ -682,6 +706,16 @@ export type VoiceServerSessionMessage = {
682
706
  status: VoiceSessionStatus;
683
707
  scenarioId?: string;
684
708
  };
709
+ export type VoiceServerReplayMessage<TResult = unknown> = {
710
+ type: 'replay';
711
+ assistantTexts: string[];
712
+ call?: VoiceCallLifecycleState;
713
+ partial: string;
714
+ scenarioId?: string;
715
+ sessionId: string;
716
+ status: VoiceSessionStatus;
717
+ turns: VoiceTurnRecord<TResult>[];
718
+ };
685
719
  export type VoiceServerPartialMessage = {
686
720
  type: 'partial';
687
721
  transcript: Transcript;
@@ -723,17 +757,43 @@ export type VoiceServerErrorMessage = {
723
757
  export type VoiceServerPongMessage = {
724
758
  type: 'pong';
725
759
  };
726
- export type VoiceServerMessage<TResult = unknown> = VoiceServerSessionMessage | VoiceServerPartialMessage | VoiceServerFinalMessage | VoiceServerTurnMessage<TResult> | VoiceServerAssistantMessage | VoiceServerAudioMessage | VoiceServerCallLifecycleMessage | VoiceServerCompleteMessage | VoiceServerErrorMessage | VoiceServerPongMessage;
760
+ export type VoiceServerConnectionMessage = {
761
+ type: 'connection';
762
+ reconnect: VoiceReconnectClientState;
763
+ };
764
+ export type VoiceServerMessage<TResult = unknown> = VoiceServerSessionMessage | VoiceServerReplayMessage<TResult> | VoiceServerPartialMessage | VoiceServerFinalMessage | VoiceServerTurnMessage<TResult> | VoiceServerAssistantMessage | VoiceServerAudioMessage | VoiceServerCallLifecycleMessage | VoiceServerCompleteMessage | VoiceServerErrorMessage | VoiceServerPongMessage | VoiceServerConnectionMessage;
727
765
  export type VoiceConnectionOptions = {
766
+ browserMedia?: false | VoiceBrowserMediaReporterOptions;
728
767
  protocols?: string[];
729
768
  scenarioId?: string;
730
769
  reconnect?: boolean;
770
+ reconnectReportPath?: string;
731
771
  maxReconnectAttempts?: number;
732
772
  pingInterval?: number;
733
773
  sessionId?: string;
734
774
  };
775
+ export type VoiceBrowserMediaReportPayload = {
776
+ at: number;
777
+ continuity?: MediaWebRTCStreamContinuityReport;
778
+ report: MediaWebRTCStatsReport;
779
+ scenarioId?: string | null;
780
+ sessionId?: string | null;
781
+ };
782
+ export type VoiceBrowserMediaReporterOptions = Omit<MediaWebRTCStatsReportInput, 'peerConnection'> & {
783
+ fetch?: typeof fetch;
784
+ getPeerConnection?: (() => MediaWebRTCStatsCollector | null | undefined) | (() => Promise<MediaWebRTCStatsCollector | null | undefined>);
785
+ getScenarioId?: () => string | null | undefined;
786
+ getSessionId?: () => string | null | undefined;
787
+ intervalMs?: number;
788
+ continuity?: false | Omit<MediaWebRTCStreamContinuityInput, 'previousStats' | 'stats'>;
789
+ onError?: (error: unknown) => void;
790
+ onReport?: (payload: VoiceBrowserMediaReportPayload) => void;
791
+ path?: string;
792
+ peerConnection?: MediaWebRTCStatsCollector;
793
+ };
735
794
  export type VoiceCaptureOptions = {
736
795
  channelCount?: 1 | 2;
796
+ onAudio?: (audio: Uint8Array | ArrayBuffer, sendAudio: (audio: Uint8Array | ArrayBuffer) => void) => void;
737
797
  onLevel?: (level: number) => void;
738
798
  sampleRateHz?: number;
739
799
  };
@@ -747,6 +807,46 @@ export type VoiceBargeInOptions = {
747
807
  enabled?: boolean;
748
808
  interruptOnPartial?: boolean;
749
809
  interruptThreshold?: number;
810
+ monitor?: VoiceBargeInMonitor;
811
+ };
812
+ export type VoiceBargeInTriggerReason = 'input-level' | 'manual-audio' | 'manual-interrupt' | 'partial-transcript';
813
+ export type VoiceBargeInMonitorEvent = {
814
+ at: number;
815
+ id: string;
816
+ latencyMs?: number;
817
+ playbackStopLatencyMs?: number;
818
+ reason: VoiceBargeInTriggerReason;
819
+ sessionId?: string | null;
820
+ status: 'requested' | 'stopped' | 'skipped';
821
+ thresholdMs?: number;
822
+ };
823
+ export type VoiceBargeInMonitorSnapshot = {
824
+ averageLatencyMs?: number;
825
+ events: VoiceBargeInMonitorEvent[];
826
+ failed: number;
827
+ lastEvent?: VoiceBargeInMonitorEvent;
828
+ passed: number;
829
+ status: 'empty' | 'fail' | 'pass' | 'warn';
830
+ thresholdMs: number;
831
+ total: number;
832
+ };
833
+ export type VoiceBargeInMonitor = {
834
+ getSnapshot: () => VoiceBargeInMonitorSnapshot;
835
+ recordRequested: (input: {
836
+ reason: VoiceBargeInTriggerReason;
837
+ sessionId?: string | null;
838
+ }) => VoiceBargeInMonitorEvent;
839
+ recordSkipped: (input: {
840
+ reason: VoiceBargeInTriggerReason;
841
+ sessionId?: string | null;
842
+ }) => VoiceBargeInMonitorEvent;
843
+ recordStopped: (input: {
844
+ latencyMs?: number;
845
+ playbackStopLatencyMs?: number;
846
+ reason: VoiceBargeInTriggerReason;
847
+ sessionId?: string | null;
848
+ }) => VoiceBargeInMonitorEvent;
849
+ subscribe: (subscriber: () => void) => () => void;
750
850
  };
751
851
  export type VoiceAudioPlayerOptions = {
752
852
  autoStart?: boolean;
@@ -805,6 +905,7 @@ export type VoiceStreamState<TResult = unknown> = {
805
905
  sessionId: string | null;
806
906
  scenarioId: string | null;
807
907
  status: VoiceSessionStatus | 'idle';
908
+ reconnect: VoiceReconnectClientState;
808
909
  partial: string;
809
910
  turns: VoiceTurnRecord<TResult>[];
810
911
  assistantTexts: string[];
@@ -831,6 +932,7 @@ export type VoiceStream<TResult = unknown> = {
831
932
  getSnapshot: () => VoiceStreamState<TResult>;
832
933
  isConnected: boolean;
833
934
  partial: string;
935
+ reconnect: VoiceReconnectClientState;
834
936
  sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
835
937
  sessionId: string | null;
836
938
  scenarioId: string | null;
@@ -900,6 +1002,7 @@ export type VoiceController<TResult = unknown> = {
900
1002
  isConnected: boolean;
901
1003
  isRecording: boolean;
902
1004
  partial: string;
1005
+ reconnect: VoiceReconnectClientState;
903
1006
  recordingError: string | null;
904
1007
  sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
905
1008
  sessionId: string | null;
@@ -933,6 +1036,15 @@ export type VoiceStoreAction<TResult = unknown> = {
933
1036
  sessionId: string;
934
1037
  scenarioId?: string;
935
1038
  status: VoiceSessionStatus;
1039
+ } | {
1040
+ type: 'replay';
1041
+ assistantTexts: string[];
1042
+ call?: VoiceCallLifecycleState;
1043
+ partial: string;
1044
+ scenarioId?: string;
1045
+ sessionId: string;
1046
+ status: VoiceSessionStatus;
1047
+ turns: VoiceTurnRecord<TResult>[];
936
1048
  } | {
937
1049
  type: 'call_lifecycle';
938
1050
  event: VoiceCallLifecycleEvent;
@@ -963,6 +1075,9 @@ export type VoiceStoreAction<TResult = unknown> = {
963
1075
  message: string;
964
1076
  } | {
965
1077
  type: 'connected';
1078
+ } | {
1079
+ type: 'connection';
1080
+ reconnect: VoiceReconnectClientState;
966
1081
  } | {
967
1082
  type: 'disconnected';
968
1083
  };