@absolutejs/voice 0.0.22-beta.32 → 0.0.22-beta.321

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 (240) hide show
  1. package/README.md +3354 -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 +3911 -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 +61 -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 +875 -14
  45. package/dist/client/index.d.ts +72 -0
  46. package/dist/client/index.js +5671 -19
  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 +146 -13
  89. package/dist/index.js +28615 -5228
  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 +254 -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 +594 -0
  110. package/dist/proofTrends.d.ts +133 -0
  111. package/dist/providerAdapters.d.ts +48 -0
  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 +5472 -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 +5337 -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 +135 -2
  191. package/dist/telephonyOutcome.d.ts +273 -0
  192. package/dist/testing/index.d.ts +1 -0
  193. package/dist/testing/index.js +2172 -76
  194. package/dist/testing/ioProviderSimulator.d.ts +41 -0
  195. package/dist/toolContract.d.ts +161 -0
  196. package/dist/toolRuntime.d.ts +50 -0
  197. package/dist/trace.d.ts +19 -1
  198. package/dist/traceDeliveryRoutes.d.ts +86 -0
  199. package/dist/traceTimeline.d.ts +97 -0
  200. package/dist/turnLatency.d.ts +95 -0
  201. package/dist/turnQuality.d.ts +94 -0
  202. package/dist/types.d.ts +116 -3
  203. package/dist/voiceMonitoring.d.ts +444 -0
  204. package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
  205. package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
  206. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  207. package/dist/vue/VoicePlatformCoverage.d.ts +23 -0
  208. package/dist/vue/VoiceProofTrends.d.ts +21 -0
  209. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  210. package/dist/vue/VoiceProviderContracts.d.ts +21 -0
  211. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  212. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  213. package/dist/vue/VoiceReadinessFailures.d.ts +21 -0
  214. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  215. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  216. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  217. package/dist/vue/index.d.ts +30 -0
  218. package/dist/vue/index.js +5241 -56
  219. package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
  220. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  221. package/dist/vue/useVoiceController.d.ts +2 -1
  222. package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
  223. package/dist/vue/useVoiceLiveOps.d.ts +9 -0
  224. package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
  225. package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
  226. package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
  227. package/dist/vue/useVoiceProofTrends.d.ts +9 -0
  228. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  229. package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
  230. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  231. package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
  232. package/dist/vue/useVoiceReadinessFailures.d.ts +837 -0
  233. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  234. package/dist/vue/useVoiceStream.d.ts +2 -1
  235. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  236. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  237. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  238. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  239. package/dist/workflowContract.d.ts +91 -0
  240. package/package.json +4 -1
package/dist/types.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import type { SessionStore } from '@absolutejs/absolute';
2
+ import type { MediaWebRTCStatsCollector, MediaWebRTCStatsReport, MediaWebRTCStatsReportInput } 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,41 @@ 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
+ report: MediaWebRTCStatsReport;
778
+ scenarioId?: string | null;
779
+ sessionId?: string | null;
780
+ };
781
+ export type VoiceBrowserMediaReporterOptions = Omit<MediaWebRTCStatsReportInput, 'peerConnection'> & {
782
+ fetch?: typeof fetch;
783
+ getPeerConnection?: (() => MediaWebRTCStatsCollector | null | undefined) | (() => Promise<MediaWebRTCStatsCollector | null | undefined>);
784
+ getScenarioId?: () => string | null | undefined;
785
+ getSessionId?: () => string | null | undefined;
786
+ intervalMs?: number;
787
+ onError?: (error: unknown) => void;
788
+ onReport?: (payload: VoiceBrowserMediaReportPayload) => void;
789
+ path?: string;
790
+ peerConnection?: MediaWebRTCStatsCollector;
791
+ };
735
792
  export type VoiceCaptureOptions = {
736
793
  channelCount?: 1 | 2;
794
+ onAudio?: (audio: Uint8Array | ArrayBuffer, sendAudio: (audio: Uint8Array | ArrayBuffer) => void) => void;
737
795
  onLevel?: (level: number) => void;
738
796
  sampleRateHz?: number;
739
797
  };
@@ -747,6 +805,46 @@ export type VoiceBargeInOptions = {
747
805
  enabled?: boolean;
748
806
  interruptOnPartial?: boolean;
749
807
  interruptThreshold?: number;
808
+ monitor?: VoiceBargeInMonitor;
809
+ };
810
+ export type VoiceBargeInTriggerReason = 'input-level' | 'manual-audio' | 'manual-interrupt' | 'partial-transcript';
811
+ export type VoiceBargeInMonitorEvent = {
812
+ at: number;
813
+ id: string;
814
+ latencyMs?: number;
815
+ playbackStopLatencyMs?: number;
816
+ reason: VoiceBargeInTriggerReason;
817
+ sessionId?: string | null;
818
+ status: 'requested' | 'stopped' | 'skipped';
819
+ thresholdMs?: number;
820
+ };
821
+ export type VoiceBargeInMonitorSnapshot = {
822
+ averageLatencyMs?: number;
823
+ events: VoiceBargeInMonitorEvent[];
824
+ failed: number;
825
+ lastEvent?: VoiceBargeInMonitorEvent;
826
+ passed: number;
827
+ status: 'empty' | 'fail' | 'pass' | 'warn';
828
+ thresholdMs: number;
829
+ total: number;
830
+ };
831
+ export type VoiceBargeInMonitor = {
832
+ getSnapshot: () => VoiceBargeInMonitorSnapshot;
833
+ recordRequested: (input: {
834
+ reason: VoiceBargeInTriggerReason;
835
+ sessionId?: string | null;
836
+ }) => VoiceBargeInMonitorEvent;
837
+ recordSkipped: (input: {
838
+ reason: VoiceBargeInTriggerReason;
839
+ sessionId?: string | null;
840
+ }) => VoiceBargeInMonitorEvent;
841
+ recordStopped: (input: {
842
+ latencyMs?: number;
843
+ playbackStopLatencyMs?: number;
844
+ reason: VoiceBargeInTriggerReason;
845
+ sessionId?: string | null;
846
+ }) => VoiceBargeInMonitorEvent;
847
+ subscribe: (subscriber: () => void) => () => void;
750
848
  };
751
849
  export type VoiceAudioPlayerOptions = {
752
850
  autoStart?: boolean;
@@ -805,6 +903,7 @@ export type VoiceStreamState<TResult = unknown> = {
805
903
  sessionId: string | null;
806
904
  scenarioId: string | null;
807
905
  status: VoiceSessionStatus | 'idle';
906
+ reconnect: VoiceReconnectClientState;
808
907
  partial: string;
809
908
  turns: VoiceTurnRecord<TResult>[];
810
909
  assistantTexts: string[];
@@ -831,6 +930,7 @@ export type VoiceStream<TResult = unknown> = {
831
930
  getSnapshot: () => VoiceStreamState<TResult>;
832
931
  isConnected: boolean;
833
932
  partial: string;
933
+ reconnect: VoiceReconnectClientState;
834
934
  sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
835
935
  sessionId: string | null;
836
936
  scenarioId: string | null;
@@ -900,6 +1000,7 @@ export type VoiceController<TResult = unknown> = {
900
1000
  isConnected: boolean;
901
1001
  isRecording: boolean;
902
1002
  partial: string;
1003
+ reconnect: VoiceReconnectClientState;
903
1004
  recordingError: string | null;
904
1005
  sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
905
1006
  sessionId: string | null;
@@ -933,6 +1034,15 @@ export type VoiceStoreAction<TResult = unknown> = {
933
1034
  sessionId: string;
934
1035
  scenarioId?: string;
935
1036
  status: VoiceSessionStatus;
1037
+ } | {
1038
+ type: 'replay';
1039
+ assistantTexts: string[];
1040
+ call?: VoiceCallLifecycleState;
1041
+ partial: string;
1042
+ scenarioId?: string;
1043
+ sessionId: string;
1044
+ status: VoiceSessionStatus;
1045
+ turns: VoiceTurnRecord<TResult>[];
936
1046
  } | {
937
1047
  type: 'call_lifecycle';
938
1048
  event: VoiceCallLifecycleEvent;
@@ -963,6 +1073,9 @@ export type VoiceStoreAction<TResult = unknown> = {
963
1073
  message: string;
964
1074
  } | {
965
1075
  type: 'connected';
1076
+ } | {
1077
+ type: 'connection';
1078
+ reconnect: VoiceReconnectClientState;
966
1079
  } | {
967
1080
  type: 'disconnected';
968
1081
  };
@@ -0,0 +1,444 @@
1
+ import { Elysia } from 'elysia';
2
+ export type VoiceMonitorStatus = 'fail' | 'pass' | 'warn';
3
+ export type VoiceMonitorSeverity = 'critical' | 'info' | 'warn';
4
+ export type VoiceMonitorIssueStatus = 'acknowledged' | 'muted' | 'open' | 'resolved';
5
+ export type VoiceMonitorEvaluationInput<TEvidence = unknown> = {
6
+ evidence: TEvidence;
7
+ now: number;
8
+ };
9
+ export type VoiceMonitorEvaluation = {
10
+ detail?: string;
11
+ impactedSessions?: readonly string[];
12
+ operationsRecordHrefs?: readonly string[];
13
+ status: VoiceMonitorStatus;
14
+ threshold?: number | string;
15
+ value?: number | string;
16
+ };
17
+ export type VoiceMonitorDefinition<TEvidence = unknown> = {
18
+ description?: string;
19
+ id: string;
20
+ label: string;
21
+ severity?: VoiceMonitorSeverity;
22
+ windowMs?: number;
23
+ evaluate: (input: VoiceMonitorEvaluationInput<TEvidence>) => Promise<VoiceMonitorEvaluation> | VoiceMonitorEvaluation;
24
+ };
25
+ export type VoiceMonitorRun = VoiceMonitorEvaluation & {
26
+ checkedAt: number;
27
+ description?: string;
28
+ id: string;
29
+ label: string;
30
+ severity: VoiceMonitorSeverity;
31
+ windowMs?: number;
32
+ };
33
+ export type VoiceMonitorIssue = {
34
+ acknowledgedAt?: number;
35
+ acknowledgedBy?: string;
36
+ createdAt: number;
37
+ detail?: string;
38
+ id: string;
39
+ impactedSessions: string[];
40
+ label: string;
41
+ lastSeenAt: number;
42
+ monitorId: string;
43
+ mutedAt?: number;
44
+ mutedBy?: string;
45
+ operationsRecordHrefs: string[];
46
+ resolvedAt?: number;
47
+ resolvedBy?: string;
48
+ severity: VoiceMonitorSeverity;
49
+ status: VoiceMonitorIssueStatus;
50
+ threshold?: number | string;
51
+ value?: number | string;
52
+ };
53
+ export type VoiceMonitorIssueStore = {
54
+ list: () => Promise<VoiceMonitorIssue[]> | VoiceMonitorIssue[];
55
+ upsert: (issue: VoiceMonitorIssue) => Promise<VoiceMonitorIssue> | VoiceMonitorIssue;
56
+ update: (id: string, patch: Partial<VoiceMonitorIssue>) => Promise<VoiceMonitorIssue | undefined> | VoiceMonitorIssue | undefined;
57
+ };
58
+ export type VoiceMonitorNotifier = {
59
+ deliver: (input: VoiceMonitorNotifierDeliveryInput) => Promise<VoiceMonitorNotifierDeliveryResult> | VoiceMonitorNotifierDeliveryResult;
60
+ id: string;
61
+ label: string;
62
+ };
63
+ export type VoiceMonitorNotifierDeliveryInput = {
64
+ issue: VoiceMonitorIssue;
65
+ now: number;
66
+ };
67
+ export type VoiceMonitorNotifierDeliveryResult = {
68
+ detail?: string;
69
+ status: 'failed' | 'sent' | 'skipped';
70
+ };
71
+ export type VoiceMonitorNotifierDeliveryReceipt = {
72
+ detail?: string;
73
+ id: string;
74
+ issueId: string;
75
+ notifierId: string;
76
+ notifierLabel: string;
77
+ sentAt: number;
78
+ status: 'failed' | 'sent' | 'skipped';
79
+ };
80
+ export type VoiceMonitorNotifierDeliveryReceiptStore = {
81
+ list: () => Promise<VoiceMonitorNotifierDeliveryReceipt[]> | VoiceMonitorNotifierDeliveryReceipt[];
82
+ set: (id: string, receipt: VoiceMonitorNotifierDeliveryReceipt) => Promise<VoiceMonitorNotifierDeliveryReceipt> | VoiceMonitorNotifierDeliveryReceipt;
83
+ };
84
+ export type VoiceMonitorNotifierDeliveryReport = {
85
+ checkedAt: number;
86
+ elapsedMs: number;
87
+ receipts: VoiceMonitorNotifierDeliveryReceipt[];
88
+ status: VoiceMonitorStatus;
89
+ summary: {
90
+ failed: number;
91
+ notifiers: number;
92
+ sent: number;
93
+ skipped: number;
94
+ total: number;
95
+ };
96
+ };
97
+ export type VoiceMonitorRunReport = {
98
+ checkedAt: number;
99
+ elapsedMs: number;
100
+ issues: VoiceMonitorIssue[];
101
+ runs: VoiceMonitorRun[];
102
+ status: VoiceMonitorStatus;
103
+ summary: {
104
+ acknowledged: number;
105
+ criticalOpen: number;
106
+ failed: number;
107
+ muted: number;
108
+ open: number;
109
+ passed: number;
110
+ resolved: number;
111
+ total: number;
112
+ warned: number;
113
+ };
114
+ };
115
+ export type VoiceMonitorRunOptions<TEvidence = unknown> = {
116
+ evidence: TEvidence;
117
+ issueStore?: VoiceMonitorIssueStore;
118
+ monitors: readonly VoiceMonitorDefinition<TEvidence>[];
119
+ now?: number;
120
+ };
121
+ export type VoiceMonitorNotifierDeliveryOptions = {
122
+ issueStore: VoiceMonitorIssueStore;
123
+ notifiers: readonly VoiceMonitorNotifier[];
124
+ now?: number;
125
+ receiptStore?: VoiceMonitorNotifierDeliveryReceiptStore;
126
+ statuses?: readonly VoiceMonitorIssueStatus[];
127
+ };
128
+ export type VoiceMonitorWebhookNotifierOptions = {
129
+ fetch?: typeof fetch;
130
+ headers?: HeadersInit;
131
+ id: string;
132
+ label?: string;
133
+ mapIssue?: (issue: VoiceMonitorIssue) => unknown;
134
+ url: string;
135
+ };
136
+ export type VoiceMonitorRoutesOptions<TEvidence = unknown> = VoiceMonitorRunOptions<TEvidence> & {
137
+ headers?: HeadersInit;
138
+ htmlPath?: false | string;
139
+ issuePath?: string;
140
+ name?: string;
141
+ notifierPath?: false | string;
142
+ notifiers?: readonly VoiceMonitorNotifier[];
143
+ path?: string;
144
+ receiptStore?: VoiceMonitorNotifierDeliveryReceiptStore;
145
+ render?: (report: VoiceMonitorRunReport) => Promise<string> | string;
146
+ title?: string;
147
+ };
148
+ export type VoiceMonitorRunnerTickResult = {
149
+ completedAt: number;
150
+ monitoring: VoiceMonitorRunReport;
151
+ notifierDelivery?: VoiceMonitorNotifierDeliveryReport;
152
+ startedAt: number;
153
+ };
154
+ export type VoiceMonitorRunner = {
155
+ isRunning: () => boolean;
156
+ start: () => void;
157
+ stop: () => void;
158
+ tick: () => Promise<VoiceMonitorRunnerTickResult>;
159
+ };
160
+ export type VoiceMonitorRunnerOptions<TEvidence = unknown> = {
161
+ evidence?: TEvidence;
162
+ issueStore?: VoiceMonitorIssueStore;
163
+ loadEvidence?: () => Promise<TEvidence> | TEvidence;
164
+ monitors: readonly VoiceMonitorDefinition<TEvidence>[];
165
+ notifiers?: readonly VoiceMonitorNotifier[];
166
+ now?: () => number;
167
+ pollIntervalMs?: number;
168
+ receiptStore?: VoiceMonitorNotifierDeliveryReceiptStore;
169
+ };
170
+ export type VoiceMonitorRunnerRoutesOptions = {
171
+ headers?: HeadersInit;
172
+ name?: string;
173
+ path?: string;
174
+ runner: VoiceMonitorRunner;
175
+ };
176
+ export declare const createVoiceMemoryMonitorIssueStore: (initial?: readonly VoiceMonitorIssue[]) => VoiceMonitorIssueStore;
177
+ export declare const createVoiceMemoryMonitorNotifierDeliveryReceiptStore: (initial?: readonly VoiceMonitorNotifierDeliveryReceipt[]) => VoiceMonitorNotifierDeliveryReceiptStore;
178
+ export declare const buildVoiceMonitorRunReport: <TEvidence = unknown>(options: VoiceMonitorRunOptions<TEvidence>) => Promise<VoiceMonitorRunReport>;
179
+ export declare const acknowledgeVoiceMonitorIssue: (store: VoiceMonitorIssueStore, id: string, input?: {
180
+ actorId?: string;
181
+ now?: number;
182
+ }) => Promise<VoiceMonitorIssue | undefined>;
183
+ export declare const resolveVoiceMonitorIssue: (store: VoiceMonitorIssueStore, id: string, input?: {
184
+ actorId?: string;
185
+ now?: number;
186
+ }) => Promise<VoiceMonitorIssue | undefined>;
187
+ export declare const muteVoiceMonitorIssue: (store: VoiceMonitorIssueStore, id: string, input?: {
188
+ actorId?: string;
189
+ now?: number;
190
+ }) => Promise<VoiceMonitorIssue | undefined>;
191
+ export declare const createVoiceMonitorWebhookNotifier: (options: VoiceMonitorWebhookNotifierOptions) => VoiceMonitorNotifier;
192
+ export declare const deliverVoiceMonitorIssueNotifications: (options: VoiceMonitorNotifierDeliveryOptions) => Promise<VoiceMonitorNotifierDeliveryReport>;
193
+ export declare const createVoiceMonitorRunner: <TEvidence = unknown>(options: VoiceMonitorRunnerOptions<TEvidence>) => VoiceMonitorRunner;
194
+ export declare const renderVoiceMonitorMarkdown: (report: VoiceMonitorRunReport) => string;
195
+ export declare const renderVoiceMonitorHTML: (report: VoiceMonitorRunReport, options?: {
196
+ title?: string;
197
+ }) => string;
198
+ export declare const createVoiceMonitorRoutes: <TEvidence = unknown>(options: VoiceMonitorRoutesOptions<TEvidence>) => Elysia<"", {
199
+ decorator: {};
200
+ store: {};
201
+ derive: {};
202
+ resolve: {};
203
+ }, {
204
+ typebox: {};
205
+ error: {};
206
+ }, {
207
+ schema: {};
208
+ standaloneSchema: {};
209
+ macro: {};
210
+ macroFn: {};
211
+ parser: {};
212
+ response: {};
213
+ }, {
214
+ [x: string]: {
215
+ get: {
216
+ body: unknown;
217
+ params: {};
218
+ query: unknown;
219
+ headers: unknown;
220
+ response: {
221
+ 200: VoiceMonitorRunReport;
222
+ };
223
+ };
224
+ };
225
+ } & {
226
+ [x: `${string}.md`]: {
227
+ get: {
228
+ body: unknown;
229
+ params: {};
230
+ query: unknown;
231
+ headers: unknown;
232
+ response: {
233
+ 200: Response;
234
+ };
235
+ };
236
+ };
237
+ } & {
238
+ [x: string]: {
239
+ get: {
240
+ body: unknown;
241
+ params: {};
242
+ query: unknown;
243
+ headers: unknown;
244
+ response: {
245
+ 200: VoiceMonitorIssue[];
246
+ };
247
+ };
248
+ };
249
+ } & {
250
+ [x: string]: {
251
+ notifications: {
252
+ get: {
253
+ body: unknown;
254
+ params: {};
255
+ query: unknown;
256
+ headers: unknown;
257
+ response: {
258
+ 200: VoiceMonitorNotifierDeliveryReceipt[];
259
+ };
260
+ };
261
+ };
262
+ };
263
+ } & {
264
+ [x: string]: {
265
+ ":id": {
266
+ acknowledge: {
267
+ post: {
268
+ body: unknown;
269
+ params: {
270
+ id: string;
271
+ } & {};
272
+ query: unknown;
273
+ headers: unknown;
274
+ response: {
275
+ 200: Response | VoiceMonitorIssue;
276
+ 422: {
277
+ type: "validation";
278
+ on: string;
279
+ summary?: string;
280
+ message?: string;
281
+ found?: unknown;
282
+ property?: string;
283
+ expected?: string;
284
+ };
285
+ };
286
+ };
287
+ };
288
+ };
289
+ };
290
+ } & {
291
+ [x: string]: {
292
+ ":id": {
293
+ resolve: {
294
+ post: {
295
+ body: unknown;
296
+ params: {
297
+ id: string;
298
+ } & {};
299
+ query: unknown;
300
+ headers: unknown;
301
+ response: {
302
+ 200: Response | VoiceMonitorIssue;
303
+ 422: {
304
+ type: "validation";
305
+ on: string;
306
+ summary?: string;
307
+ message?: string;
308
+ found?: unknown;
309
+ property?: string;
310
+ expected?: string;
311
+ };
312
+ };
313
+ };
314
+ };
315
+ };
316
+ };
317
+ } & {
318
+ [x: string]: {
319
+ ":id": {
320
+ mute: {
321
+ post: {
322
+ body: unknown;
323
+ params: {
324
+ id: string;
325
+ } & {};
326
+ query: unknown;
327
+ headers: unknown;
328
+ response: {
329
+ 200: Response | VoiceMonitorIssue;
330
+ 422: {
331
+ type: "validation";
332
+ on: string;
333
+ summary?: string;
334
+ message?: string;
335
+ found?: unknown;
336
+ property?: string;
337
+ expected?: string;
338
+ };
339
+ };
340
+ };
341
+ };
342
+ };
343
+ };
344
+ }, {
345
+ derive: {};
346
+ resolve: {};
347
+ schema: {};
348
+ standaloneSchema: {};
349
+ response: {};
350
+ }, {
351
+ derive: {};
352
+ resolve: {};
353
+ schema: {};
354
+ standaloneSchema: {};
355
+ response: {};
356
+ }>;
357
+ export declare const createVoiceMonitorRunnerRoutes: (options: VoiceMonitorRunnerRoutesOptions) => Elysia<"", {
358
+ decorator: {};
359
+ store: {};
360
+ derive: {};
361
+ resolve: {};
362
+ }, {
363
+ typebox: {};
364
+ error: {};
365
+ }, {
366
+ schema: {};
367
+ standaloneSchema: {};
368
+ macro: {};
369
+ macroFn: {};
370
+ parser: {};
371
+ response: {};
372
+ }, {
373
+ [x: string]: {
374
+ get: {
375
+ body: unknown;
376
+ params: {};
377
+ query: unknown;
378
+ headers: unknown;
379
+ response: {
380
+ 200: {
381
+ isRunning: boolean;
382
+ };
383
+ };
384
+ };
385
+ };
386
+ } & {
387
+ [x: string]: {
388
+ tick: {
389
+ post: {
390
+ body: unknown;
391
+ params: {};
392
+ query: unknown;
393
+ headers: unknown;
394
+ response: {
395
+ 200: VoiceMonitorRunnerTickResult;
396
+ };
397
+ };
398
+ };
399
+ };
400
+ } & {
401
+ [x: string]: {
402
+ start: {
403
+ post: {
404
+ body: unknown;
405
+ params: {};
406
+ query: unknown;
407
+ headers: unknown;
408
+ response: {
409
+ 200: {
410
+ isRunning: boolean;
411
+ };
412
+ };
413
+ };
414
+ };
415
+ };
416
+ } & {
417
+ [x: string]: {
418
+ stop: {
419
+ post: {
420
+ body: unknown;
421
+ params: {};
422
+ query: unknown;
423
+ headers: unknown;
424
+ response: {
425
+ 200: {
426
+ isRunning: boolean;
427
+ };
428
+ };
429
+ };
430
+ };
431
+ };
432
+ }, {
433
+ derive: {};
434
+ resolve: {};
435
+ schema: {};
436
+ standaloneSchema: {};
437
+ response: {};
438
+ }, {
439
+ derive: {};
440
+ resolve: {};
441
+ schema: {};
442
+ standaloneSchema: {};
443
+ response: {};
444
+ }>;