@absolutejs/voice 0.0.22-beta.29 → 0.0.22-beta.290

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 (228) hide show
  1. package/README.md +3234 -228
  2. package/dist/agent.d.ts +62 -0
  3. package/dist/agentSquadContract.d.ts +98 -0
  4. package/dist/angular/index.d.ts +15 -0
  5. package/dist/angular/index.js +3401 -1153
  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-routing-status.service.d.ts +11 -0
  20. package/dist/angular/voice-stream.service.d.ts +1 -0
  21. package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
  22. package/dist/angular/voice-turn-latency.service.d.ts +13 -0
  23. package/dist/angular/voice-turn-quality.service.d.ts +12 -0
  24. package/dist/angular/voice-workflow-status.service.d.ts +12 -0
  25. package/dist/audit.d.ts +128 -0
  26. package/dist/auditDeliveryRoutes.d.ts +85 -0
  27. package/dist/auditExport.d.ts +34 -0
  28. package/dist/auditRoutes.d.ts +66 -0
  29. package/dist/auditSinks.d.ts +151 -0
  30. package/dist/bargeInRoutes.d.ts +56 -0
  31. package/dist/campaign.d.ts +768 -0
  32. package/dist/campaignDialers.d.ts +111 -0
  33. package/dist/client/actions.d.ts +83 -0
  34. package/dist/client/agentSquadStatus.d.ts +37 -0
  35. package/dist/client/agentSquadStatusWidget.d.ts +24 -0
  36. package/dist/client/bargeInMonitor.d.ts +7 -0
  37. package/dist/client/campaignDialerProof.d.ts +23 -0
  38. package/dist/client/deliveryRuntime.d.ts +34 -0
  39. package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
  40. package/dist/client/duplex.d.ts +1 -1
  41. package/dist/client/htmxBootstrap.js +703 -13
  42. package/dist/client/index.d.ts +66 -0
  43. package/dist/client/index.js +5073 -19
  44. package/dist/client/liveOps.d.ts +22 -0
  45. package/dist/client/liveOpsWidget.d.ts +23 -0
  46. package/dist/client/liveTurnLatency.d.ts +41 -0
  47. package/dist/client/opsActionCenter.d.ts +54 -0
  48. package/dist/client/opsActionCenterWidget.d.ts +29 -0
  49. package/dist/client/opsActionHistory.d.ts +19 -0
  50. package/dist/client/opsActionHistoryWidget.d.ts +11 -0
  51. package/dist/client/opsStatus.d.ts +19 -0
  52. package/dist/client/opsStatusWidget.d.ts +40 -0
  53. package/dist/client/platformCoverage.d.ts +19 -0
  54. package/dist/client/platformCoverageWidget.d.ts +37 -0
  55. package/dist/client/proofTrends.d.ts +19 -0
  56. package/dist/client/proofTrendsWidget.d.ts +37 -0
  57. package/dist/client/providerCapabilities.d.ts +19 -0
  58. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  59. package/dist/client/providerContracts.d.ts +19 -0
  60. package/dist/client/providerContractsWidget.d.ts +37 -0
  61. package/dist/client/providerSimulationControls.d.ts +33 -0
  62. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  63. package/dist/client/providerStatusWidget.d.ts +32 -0
  64. package/dist/client/routingStatus.d.ts +19 -0
  65. package/dist/client/routingStatusWidget.d.ts +28 -0
  66. package/dist/client/traceTimeline.d.ts +19 -0
  67. package/dist/client/traceTimelineWidget.d.ts +36 -0
  68. package/dist/client/turnLatency.d.ts +22 -0
  69. package/dist/client/turnLatencyWidget.d.ts +33 -0
  70. package/dist/client/turnQuality.d.ts +19 -0
  71. package/dist/client/turnQualityWidget.d.ts +32 -0
  72. package/dist/client/workflowStatus.d.ts +19 -0
  73. package/dist/dataControl.d.ts +180 -0
  74. package/dist/deliveryRuntime.d.ts +158 -0
  75. package/dist/deliverySinkRoutes.d.ts +117 -0
  76. package/dist/demoReadyRoutes.d.ts +98 -0
  77. package/dist/diagnosticsRoutes.d.ts +44 -0
  78. package/dist/evalRoutes.d.ts +219 -0
  79. package/dist/fileStore.d.ts +14 -2
  80. package/dist/guardrails.d.ts +128 -0
  81. package/dist/handoff.d.ts +15 -1
  82. package/dist/handoffHealth.d.ts +94 -0
  83. package/dist/incidentBundle.d.ts +116 -0
  84. package/dist/index.d.ts +138 -15
  85. package/dist/index.js +26946 -4957
  86. package/dist/latencySlo.d.ts +56 -0
  87. package/dist/liveLatency.d.ts +78 -0
  88. package/dist/liveOps.d.ts +190 -0
  89. package/dist/modelAdapters.d.ts +23 -2
  90. package/dist/observabilityExport.d.ts +481 -0
  91. package/dist/openaiRealtime.d.ts +27 -0
  92. package/dist/openaiTTS.d.ts +18 -0
  93. package/dist/operationsRecord.d.ts +210 -0
  94. package/dist/opsActionAuditRoutes.d.ts +99 -0
  95. package/dist/opsConsoleRoutes.d.ts +80 -0
  96. package/dist/opsRecovery.d.ts +137 -0
  97. package/dist/opsStatus.d.ts +76 -0
  98. package/dist/opsStatusRoutes.d.ts +33 -0
  99. package/dist/outcomeContract.d.ts +146 -0
  100. package/dist/phoneAgent.d.ts +139 -0
  101. package/dist/phoneAgentProductionSmoke.d.ts +115 -0
  102. package/dist/platformCoverage.d.ts +91 -0
  103. package/dist/postCallAnalysis.d.ts +98 -0
  104. package/dist/postgresStore.d.ts +13 -2
  105. package/dist/productionReadiness.d.ts +544 -0
  106. package/dist/proofTrends.d.ts +133 -0
  107. package/dist/providerAdapters.d.ts +48 -0
  108. package/dist/providerCapabilities.d.ts +92 -0
  109. package/dist/providerHealth.d.ts +1 -0
  110. package/dist/providerRoutingContract.d.ts +71 -0
  111. package/dist/providerSlo.d.ts +142 -0
  112. package/dist/providerStackRecommendations.d.ts +187 -0
  113. package/dist/qualityRoutes.d.ts +76 -0
  114. package/dist/queue.d.ts +61 -0
  115. package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
  116. package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
  117. package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
  118. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  119. package/dist/react/VoicePlatformCoverage.d.ts +6 -0
  120. package/dist/react/VoiceProofTrends.d.ts +6 -0
  121. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  122. package/dist/react/VoiceProviderContracts.d.ts +6 -0
  123. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  124. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  125. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  126. package/dist/react/VoiceTraceTimeline.d.ts +6 -0
  127. package/dist/react/VoiceTurnLatency.d.ts +6 -0
  128. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  129. package/dist/react/index.d.ts +30 -0
  130. package/dist/react/index.js +4769 -31
  131. package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
  132. package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
  133. package/dist/react/useVoiceController.d.ts +1 -0
  134. package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
  135. package/dist/react/useVoiceLiveOps.d.ts +9 -0
  136. package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
  137. package/dist/react/useVoiceOpsStatus.d.ts +8 -0
  138. package/dist/react/useVoicePlatformCoverage.d.ts +8 -0
  139. package/dist/react/useVoiceProofTrends.d.ts +8 -0
  140. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  141. package/dist/react/useVoiceProviderContracts.d.ts +8 -0
  142. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  143. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  144. package/dist/react/useVoiceStream.d.ts +1 -0
  145. package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
  146. package/dist/react/useVoiceTurnLatency.d.ts +9 -0
  147. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  148. package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
  149. package/dist/readinessProfiles.d.ts +38 -0
  150. package/dist/reconnectContract.d.ts +88 -0
  151. package/dist/resilienceRoutes.d.ts +143 -0
  152. package/dist/sessionReplay.d.ts +12 -0
  153. package/dist/simulationSuite.d.ts +143 -0
  154. package/dist/sloCalibration.d.ts +185 -0
  155. package/dist/sqliteStore.d.ts +13 -2
  156. package/dist/svelte/createVoiceAgentSquadStatus.d.ts +9 -0
  157. package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
  158. package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
  159. package/dist/svelte/createVoiceLiveOps.d.ts +13 -0
  160. package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
  161. package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
  162. package/dist/svelte/createVoicePlatformCoverage.d.ts +7 -0
  163. package/dist/svelte/createVoiceProofTrends.d.ts +7 -0
  164. package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
  165. package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
  166. package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
  167. package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
  168. package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
  169. package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
  170. package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
  171. package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
  172. package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
  173. package/dist/svelte/index.d.ts +16 -0
  174. package/dist/svelte/index.js +4838 -420
  175. package/dist/telephony/contract.d.ts +61 -0
  176. package/dist/telephony/matrix.d.ts +97 -0
  177. package/dist/telephony/plivo.d.ts +303 -0
  178. package/dist/telephony/security.d.ts +182 -0
  179. package/dist/telephony/telnyx.d.ts +291 -0
  180. package/dist/telephony/twilio.d.ts +135 -2
  181. package/dist/telephonyOutcome.d.ts +273 -0
  182. package/dist/testing/index.d.ts +1 -0
  183. package/dist/testing/index.js +1778 -36
  184. package/dist/testing/ioProviderSimulator.d.ts +41 -0
  185. package/dist/toolContract.d.ts +161 -0
  186. package/dist/toolRuntime.d.ts +50 -0
  187. package/dist/trace.d.ts +19 -1
  188. package/dist/traceDeliveryRoutes.d.ts +86 -0
  189. package/dist/traceTimeline.d.ts +97 -0
  190. package/dist/turnLatency.d.ts +95 -0
  191. package/dist/turnQuality.d.ts +94 -0
  192. package/dist/types.d.ts +127 -3
  193. package/dist/voiceMonitoring.d.ts +444 -0
  194. package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
  195. package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
  196. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  197. package/dist/vue/VoicePlatformCoverage.d.ts +23 -0
  198. package/dist/vue/VoiceProofTrends.d.ts +21 -0
  199. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  200. package/dist/vue/VoiceProviderContracts.d.ts +21 -0
  201. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  202. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  203. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  204. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  205. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  206. package/dist/vue/index.d.ts +28 -0
  207. package/dist/vue/index.js +4550 -56
  208. package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
  209. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  210. package/dist/vue/useVoiceController.d.ts +2 -1
  211. package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
  212. package/dist/vue/useVoiceLiveOps.d.ts +9 -0
  213. package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
  214. package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
  215. package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
  216. package/dist/vue/useVoiceProofTrends.d.ts +9 -0
  217. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  218. package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
  219. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  220. package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
  221. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  222. package/dist/vue/useVoiceStream.d.ts +2 -1
  223. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  224. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  225. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  226. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  227. package/dist/workflowContract.d.ts +91 -0
  228. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { VoiceOpsDispositionTaskPolicies, VoiceOpsTaskAssignmentRule, Voice
3
3
  import type { VoiceIntegrationSink } from './opsSinks';
4
4
  import type { StoredVoiceCallReviewArtifact, VoiceCallReviewArtifact, VoiceCallReviewStore } from './testing/review';
5
5
  import type { VoiceTraceEventStore } from './trace';
6
+ import type { VoiceLiveOpsControlState } from './liveOps';
6
7
  export type AudioFormat = {
7
8
  container: 'raw';
8
9
  encoding: 'alaw' | 'mulaw' | 'pcm_s16le';
@@ -193,6 +194,15 @@ export type RealtimeAdapter<TOptions extends RealtimeAdapterOpenOptions = Realti
193
194
  open: (options: TOptions) => Promise<RealtimeAdapterSession> | RealtimeAdapterSession;
194
195
  };
195
196
  export type VoiceSessionStatus = 'active' | 'reconnecting' | 'completed' | 'failed';
197
+ export type VoiceReconnectClientStatus = 'idle' | 'reconnecting' | 'resumed' | 'exhausted';
198
+ export type VoiceReconnectClientState = {
199
+ attempts: number;
200
+ lastDisconnectAt?: number;
201
+ lastResumedAt?: number;
202
+ maxAttempts: number;
203
+ nextAttemptAt?: number;
204
+ status: VoiceReconnectClientStatus;
205
+ };
196
206
  export type VoiceTurnRecord<TResult = unknown> = {
197
207
  id: string;
198
208
  text: string;
@@ -278,6 +288,34 @@ export type VoiceHandoffResult = {
278
288
  metadata?: Record<string, unknown>;
279
289
  status: VoiceHandoffStatus;
280
290
  };
291
+ export type VoiceHandoffDeliveryQueueStatus = VoiceHandoffStatus | 'pending';
292
+ export type StoredVoiceHandoffDelivery<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
293
+ action: VoiceHandoffAction;
294
+ context: TContext;
295
+ createdAt: number;
296
+ deliveredAt?: number;
297
+ deliveries?: Record<string, VoiceHandoffResult & {
298
+ adapterId: string;
299
+ adapterKind?: string;
300
+ }>;
301
+ deliveryAttempts?: number;
302
+ deliveryError?: string;
303
+ deliveryStatus: VoiceHandoffDeliveryQueueStatus;
304
+ id: string;
305
+ metadata?: Record<string, unknown>;
306
+ reason?: string;
307
+ result?: TResult;
308
+ session: TSession;
309
+ sessionId: string;
310
+ target?: string;
311
+ updatedAt: number;
312
+ };
313
+ export type VoiceHandoffDeliveryStore<TDelivery extends StoredVoiceHandoffDelivery = StoredVoiceHandoffDelivery> = {
314
+ get: (id: string) => Promise<TDelivery | undefined> | TDelivery | undefined;
315
+ list: () => Promise<TDelivery[]> | TDelivery[];
316
+ remove: (id: string) => Promise<void> | void;
317
+ set: (id: string, delivery: TDelivery) => Promise<void> | void;
318
+ };
281
319
  export type VoiceHandoffInput<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
282
320
  action: VoiceHandoffAction;
283
321
  api: VoiceSessionHandle<TContext, TSession, TResult>;
@@ -296,6 +334,8 @@ export type VoiceHandoffAdapter<TContext = unknown, TSession extends VoiceSessio
296
334
  };
297
335
  export type VoiceHandoffConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
298
336
  adapters: VoiceHandoffAdapter<TContext, TSession, TResult>[];
337
+ deliveryQueue?: VoiceHandoffDeliveryStore<StoredVoiceHandoffDelivery<TContext, TSession, TResult>>;
338
+ enqueueOnly?: boolean;
299
339
  failMode?: 'record' | 'throw';
300
340
  };
301
341
  export type VoiceSessionStore<TSession extends VoiceSessionRecord = VoiceSessionRecord> = SessionStore<TSession, VoiceSessionSummary>;
@@ -445,6 +485,10 @@ export type VoiceLexiconResolver<TContext = unknown> = (input: {
445
485
  }) => Promise<VoiceLexiconEntry[] | void> | VoiceLexiconEntry[] | void;
446
486
  export type VoiceOnTurnObjectHandler<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = (input: {
447
487
  context: TContext;
488
+ liveOps?: {
489
+ control: VoiceLiveOpsControlState;
490
+ injectedInstruction?: string;
491
+ };
448
492
  session: TSession;
449
493
  turn: VoiceTurnRecord;
450
494
  api: VoiceSessionHandle<TContext, TSession, TResult>;
@@ -566,6 +610,9 @@ export type VoiceRuntimeOpsConfig<TContext = unknown, TSession extends VoiceSess
566
610
  tasks?: VoiceOpsTaskStore;
567
611
  webhook?: VoiceIntegrationWebhookConfig;
568
612
  };
613
+ export type VoiceLiveOpsRuntimeConfig = {
614
+ getControl: (sessionId: string) => Promise<VoiceLiveOpsControlState | null | undefined> | VoiceLiveOpsControlState | null | undefined;
615
+ };
569
616
  export type VoiceNormalizedRouteConfig<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoiceRouteConfig<TContext, TSession, TResult>, 'onTurn'> & {
570
617
  onTurn: VoiceOnTurnObjectHandler<TContext, TSession, TResult>;
571
618
  };
@@ -586,9 +633,11 @@ export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionR
586
633
  lexicon?: VoiceLexiconEntry[] | VoiceLexiconResolver<TContext>;
587
634
  phraseHints?: VoicePhraseHint[] | VoicePhraseHintResolver<TContext>;
588
635
  preset?: VoiceRuntimePreset;
589
- stt: STTAdapter;
636
+ stt?: STTAdapter;
590
637
  sttFallback?: VoiceSTTFallbackConfig;
591
638
  sttLifecycle?: VoiceSTTLifecycle;
639
+ realtime?: RealtimeAdapter;
640
+ realtimeInputFormat?: AudioFormat;
592
641
  tts?: TTSAdapter;
593
642
  session: VoiceSessionStore<NoInfer<TSession>>;
594
643
  reconnect?: VoiceReconnectConfig;
@@ -598,6 +647,7 @@ export type VoicePluginConfig<TContext = unknown, TSession extends VoiceSessionR
598
647
  htmx?: boolean | VoiceHTMXConfig<TSession, NoInfer<TResult>>;
599
648
  handoff?: VoiceHandoffConfig<TContext, TSession, TResult>;
600
649
  ops?: VoiceRuntimeOpsConfig<TContext, TSession, TResult>;
650
+ liveOps?: VoiceLiveOpsRuntimeConfig;
601
651
  trace?: VoiceTraceEventStore;
602
652
  } & VoiceRouteConfig<TContext, TSession, TResult>;
603
653
  export type CreateVoiceSessionOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
@@ -605,7 +655,9 @@ export type CreateVoiceSessionOptions<TContext = unknown, TSession extends Voice
605
655
  id: string;
606
656
  context: TContext;
607
657
  socket: VoiceSocket;
608
- stt: STTAdapter;
658
+ stt?: STTAdapter;
659
+ realtime?: RealtimeAdapter;
660
+ realtimeInputFormat?: AudioFormat;
609
661
  tts?: TTSAdapter;
610
662
  languageStrategy?: VoiceLanguageStrategy;
611
663
  lexicon?: VoiceLexiconEntry[];
@@ -619,6 +671,7 @@ export type CreateVoiceSessionOptions<TContext = unknown, TSession extends Voice
619
671
  turnDetection: VoiceResolvedTurnDetectionConfig;
620
672
  audioConditioning?: VoiceResolvedAudioConditioningConfig;
621
673
  handoff?: VoiceHandoffConfig<TContext, TSession, TResult>;
674
+ liveOps?: VoiceLiveOpsRuntimeConfig;
622
675
  route: VoiceNormalizedRouteConfig<TContext, TSession, TResult>;
623
676
  logger?: VoiceLogger;
624
677
  };
@@ -652,6 +705,16 @@ export type VoiceServerSessionMessage = {
652
705
  status: VoiceSessionStatus;
653
706
  scenarioId?: string;
654
707
  };
708
+ export type VoiceServerReplayMessage<TResult = unknown> = {
709
+ type: 'replay';
710
+ assistantTexts: string[];
711
+ call?: VoiceCallLifecycleState;
712
+ partial: string;
713
+ scenarioId?: string;
714
+ sessionId: string;
715
+ status: VoiceSessionStatus;
716
+ turns: VoiceTurnRecord<TResult>[];
717
+ };
655
718
  export type VoiceServerPartialMessage = {
656
719
  type: 'partial';
657
720
  transcript: Transcript;
@@ -693,17 +756,23 @@ export type VoiceServerErrorMessage = {
693
756
  export type VoiceServerPongMessage = {
694
757
  type: 'pong';
695
758
  };
696
- export type VoiceServerMessage<TResult = unknown> = VoiceServerSessionMessage | VoiceServerPartialMessage | VoiceServerFinalMessage | VoiceServerTurnMessage<TResult> | VoiceServerAssistantMessage | VoiceServerAudioMessage | VoiceServerCallLifecycleMessage | VoiceServerCompleteMessage | VoiceServerErrorMessage | VoiceServerPongMessage;
759
+ export type VoiceServerConnectionMessage = {
760
+ type: 'connection';
761
+ reconnect: VoiceReconnectClientState;
762
+ };
763
+ export type VoiceServerMessage<TResult = unknown> = VoiceServerSessionMessage | VoiceServerReplayMessage<TResult> | VoiceServerPartialMessage | VoiceServerFinalMessage | VoiceServerTurnMessage<TResult> | VoiceServerAssistantMessage | VoiceServerAudioMessage | VoiceServerCallLifecycleMessage | VoiceServerCompleteMessage | VoiceServerErrorMessage | VoiceServerPongMessage | VoiceServerConnectionMessage;
697
764
  export type VoiceConnectionOptions = {
698
765
  protocols?: string[];
699
766
  scenarioId?: string;
700
767
  reconnect?: boolean;
768
+ reconnectReportPath?: string;
701
769
  maxReconnectAttempts?: number;
702
770
  pingInterval?: number;
703
771
  sessionId?: string;
704
772
  };
705
773
  export type VoiceCaptureOptions = {
706
774
  channelCount?: 1 | 2;
775
+ onAudio?: (audio: Uint8Array | ArrayBuffer, sendAudio: (audio: Uint8Array | ArrayBuffer) => void) => void;
707
776
  onLevel?: (level: number) => void;
708
777
  sampleRateHz?: number;
709
778
  };
@@ -717,6 +786,46 @@ export type VoiceBargeInOptions = {
717
786
  enabled?: boolean;
718
787
  interruptOnPartial?: boolean;
719
788
  interruptThreshold?: number;
789
+ monitor?: VoiceBargeInMonitor;
790
+ };
791
+ export type VoiceBargeInTriggerReason = 'input-level' | 'manual-audio' | 'manual-interrupt' | 'partial-transcript';
792
+ export type VoiceBargeInMonitorEvent = {
793
+ at: number;
794
+ id: string;
795
+ latencyMs?: number;
796
+ playbackStopLatencyMs?: number;
797
+ reason: VoiceBargeInTriggerReason;
798
+ sessionId?: string | null;
799
+ status: 'requested' | 'stopped' | 'skipped';
800
+ thresholdMs?: number;
801
+ };
802
+ export type VoiceBargeInMonitorSnapshot = {
803
+ averageLatencyMs?: number;
804
+ events: VoiceBargeInMonitorEvent[];
805
+ failed: number;
806
+ lastEvent?: VoiceBargeInMonitorEvent;
807
+ passed: number;
808
+ status: 'empty' | 'fail' | 'pass' | 'warn';
809
+ thresholdMs: number;
810
+ total: number;
811
+ };
812
+ export type VoiceBargeInMonitor = {
813
+ getSnapshot: () => VoiceBargeInMonitorSnapshot;
814
+ recordRequested: (input: {
815
+ reason: VoiceBargeInTriggerReason;
816
+ sessionId?: string | null;
817
+ }) => VoiceBargeInMonitorEvent;
818
+ recordSkipped: (input: {
819
+ reason: VoiceBargeInTriggerReason;
820
+ sessionId?: string | null;
821
+ }) => VoiceBargeInMonitorEvent;
822
+ recordStopped: (input: {
823
+ latencyMs?: number;
824
+ playbackStopLatencyMs?: number;
825
+ reason: VoiceBargeInTriggerReason;
826
+ sessionId?: string | null;
827
+ }) => VoiceBargeInMonitorEvent;
828
+ subscribe: (subscriber: () => void) => () => void;
720
829
  };
721
830
  export type VoiceAudioPlayerOptions = {
722
831
  autoStart?: boolean;
@@ -775,6 +884,7 @@ export type VoiceStreamState<TResult = unknown> = {
775
884
  sessionId: string | null;
776
885
  scenarioId: string | null;
777
886
  status: VoiceSessionStatus | 'idle';
887
+ reconnect: VoiceReconnectClientState;
778
888
  partial: string;
779
889
  turns: VoiceTurnRecord<TResult>[];
780
890
  assistantTexts: string[];
@@ -801,6 +911,7 @@ export type VoiceStream<TResult = unknown> = {
801
911
  getSnapshot: () => VoiceStreamState<TResult>;
802
912
  isConnected: boolean;
803
913
  partial: string;
914
+ reconnect: VoiceReconnectClientState;
804
915
  sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
805
916
  sessionId: string | null;
806
917
  scenarioId: string | null;
@@ -870,6 +981,7 @@ export type VoiceController<TResult = unknown> = {
870
981
  isConnected: boolean;
871
982
  isRecording: boolean;
872
983
  partial: string;
984
+ reconnect: VoiceReconnectClientState;
873
985
  recordingError: string | null;
874
986
  sendAudio: (audio: Uint8Array | ArrayBuffer) => void;
875
987
  sessionId: string | null;
@@ -903,6 +1015,15 @@ export type VoiceStoreAction<TResult = unknown> = {
903
1015
  sessionId: string;
904
1016
  scenarioId?: string;
905
1017
  status: VoiceSessionStatus;
1018
+ } | {
1019
+ type: 'replay';
1020
+ assistantTexts: string[];
1021
+ call?: VoiceCallLifecycleState;
1022
+ partial: string;
1023
+ scenarioId?: string;
1024
+ sessionId: string;
1025
+ status: VoiceSessionStatus;
1026
+ turns: VoiceTurnRecord<TResult>[];
906
1027
  } | {
907
1028
  type: 'call_lifecycle';
908
1029
  event: VoiceCallLifecycleEvent;
@@ -933,6 +1054,9 @@ export type VoiceStoreAction<TResult = unknown> = {
933
1054
  message: string;
934
1055
  } | {
935
1056
  type: 'connected';
1057
+ } | {
1058
+ type: 'connection';
1059
+ reconnect: VoiceReconnectClientState;
936
1060
  } | {
937
1061
  type: 'disconnected';
938
1062
  };
@@ -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
+ }>;