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

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 +3250 -73
  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
@@ -0,0 +1,291 @@
1
+ import { Database } from 'bun:sqlite';
2
+ import type { RedisClient } from 'bun';
3
+ import { Elysia } from 'elysia';
4
+ import { type VoiceTelephonyContractReport, type VoiceTelephonySetupStatus, type VoiceTelephonySmokeCheck, type VoiceTelephonySmokeReport } from './contract';
5
+ import { type VoiceTelephonyOutcomePolicy, type VoiceTelephonyWebhookRoutesOptions, type VoiceTelephonyWebhookVerificationResult } from '../telephonyOutcome';
6
+ import type { VoiceServerMessage, VoiceSessionRecord } from '../types';
7
+ import { type TwilioMediaStreamBridgeOptions } from './twilio';
8
+ import type { VoicePostgresClient } from '../postgresStore';
9
+ export type TelnyxMediaPayload = {
10
+ chunk?: string;
11
+ payload: string;
12
+ timestamp?: string;
13
+ track?: 'inbound' | 'outbound' | 'inbound_track' | 'outbound_track';
14
+ };
15
+ export type TelnyxInboundMessage = {
16
+ event: 'connected';
17
+ version?: string;
18
+ } | {
19
+ event: 'start';
20
+ sequence_number?: string;
21
+ start?: {
22
+ call_control_id?: string;
23
+ call_leg_id?: string;
24
+ call_session_id?: string;
25
+ custom_parameters?: Record<string, string>;
26
+ media_format?: {
27
+ channels?: number;
28
+ encoding?: string;
29
+ sample_rate?: number;
30
+ };
31
+ user_id?: string;
32
+ };
33
+ stream_id?: string;
34
+ } | {
35
+ event: 'media';
36
+ media: TelnyxMediaPayload;
37
+ sequence_number?: string;
38
+ stream_id?: string;
39
+ } | {
40
+ event: 'mark';
41
+ mark?: {
42
+ name?: string;
43
+ };
44
+ sequence_number?: string;
45
+ stream_id?: string;
46
+ } | {
47
+ event: 'dtmf';
48
+ dtmf?: {
49
+ digit?: string;
50
+ };
51
+ sequence_number?: string;
52
+ stream_id?: string;
53
+ } | {
54
+ event: 'error';
55
+ payload?: {
56
+ code?: number;
57
+ detail?: string;
58
+ title?: string;
59
+ };
60
+ stream_id?: string;
61
+ } | {
62
+ event: 'stop';
63
+ sequence_number?: string;
64
+ stop?: {
65
+ call_control_id?: string;
66
+ user_id?: string;
67
+ };
68
+ stream_id?: string;
69
+ };
70
+ export type TelnyxOutboundMediaMessage = {
71
+ event: 'media';
72
+ media: {
73
+ payload: string;
74
+ };
75
+ };
76
+ export type TelnyxOutboundClearMessage = {
77
+ event: 'clear';
78
+ };
79
+ export type TelnyxOutboundMarkMessage = {
80
+ event: 'mark';
81
+ mark: {
82
+ name: string;
83
+ };
84
+ };
85
+ export type TelnyxOutboundMessage = TelnyxOutboundMediaMessage | TelnyxOutboundClearMessage | TelnyxOutboundMarkMessage;
86
+ export type TelnyxMediaStreamSocket = {
87
+ close: (code?: number, reason?: string) => void | Promise<void>;
88
+ send: (data: string) => void | Promise<void>;
89
+ };
90
+ export type TelnyxMediaStreamBridgeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<TwilioMediaStreamBridgeOptions<TContext, TSession, TResult>, 'onVoiceMessage'> & {
91
+ onVoiceMessage?: (input: {
92
+ callControlId?: string;
93
+ message: VoiceServerMessage<TResult>;
94
+ sessionId: string;
95
+ streamId?: string;
96
+ }) => Promise<void> | void;
97
+ };
98
+ export type TelnyxMediaStreamBridge = {
99
+ close: (reason?: string) => Promise<void>;
100
+ getSessionId: () => string | null;
101
+ getStreamId: () => string | null;
102
+ handleMessage: (raw: string | TelnyxInboundMessage) => Promise<void>;
103
+ };
104
+ export type TelnyxVoiceResponseOptions = {
105
+ bidirectionalCodec?: 'AMR-WB' | 'G722' | 'OPUS' | 'PCMA' | 'PCMU';
106
+ bidirectionalMode?: 'mp3' | 'rtp';
107
+ codec?: 'AMR-WB' | 'G722' | 'OPUS' | 'PCMA' | 'PCMU' | 'default';
108
+ streamName?: string;
109
+ streamUrl: string;
110
+ track?: 'both_tracks' | 'inbound_track' | 'outbound_track';
111
+ };
112
+ export type TelnyxVoiceSetupStatus = VoiceTelephonySetupStatus<'telnyx'> & {
113
+ urls: VoiceTelephonySetupStatus<'telnyx'>['urls'] & {
114
+ texml: string;
115
+ };
116
+ };
117
+ export type TelnyxVoiceSetupOptions = {
118
+ path?: false | string;
119
+ requiredEnv?: Record<string, string | undefined>;
120
+ title?: string;
121
+ };
122
+ export type TelnyxVoiceSmokeCheck = VoiceTelephonySmokeCheck;
123
+ export type TelnyxVoiceSmokeReport = VoiceTelephonySmokeReport<'telnyx'> & {
124
+ contract: VoiceTelephonyContractReport<'telnyx'>;
125
+ setup: TelnyxVoiceSetupStatus;
126
+ texml?: {
127
+ status: number;
128
+ streamUrl?: string;
129
+ };
130
+ };
131
+ export type TelnyxVoiceSmokeOptions = {
132
+ callControlId?: string;
133
+ callLegId?: string;
134
+ eventType?: string;
135
+ path?: false | string;
136
+ sessionId?: string;
137
+ title?: string;
138
+ };
139
+ export type TelnyxVoiceRoutesOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = {
140
+ bridge?: TelnyxMediaStreamBridgeOptions<TContext, TSession, TResult>;
141
+ context?: TContext;
142
+ name?: string;
143
+ outcomePolicy?: VoiceTelephonyOutcomePolicy;
144
+ setup?: TelnyxVoiceSetupOptions;
145
+ smoke?: TelnyxVoiceSmokeOptions;
146
+ streamPath?: string;
147
+ texml?: {
148
+ path?: string;
149
+ response?: Omit<TelnyxVoiceResponseOptions, 'streamUrl'>;
150
+ streamUrl?: string | ((input: {
151
+ query: Record<string, unknown>;
152
+ request: Request;
153
+ streamPath: string;
154
+ }) => Promise<string> | string);
155
+ };
156
+ webhook?: Omit<VoiceTelephonyWebhookRoutesOptions<TContext, TSession, TResult>, 'context' | 'path' | 'policy' | 'provider'> & {
157
+ eventStore?: VoiceTelnyxWebhookEventStore;
158
+ path?: string;
159
+ policy?: VoiceTelephonyOutcomePolicy;
160
+ publicKey?: string;
161
+ toleranceSeconds?: number;
162
+ };
163
+ };
164
+ export type VoiceTelnyxWebhookEventStore = {
165
+ claim?: (eventId: string) => Promise<boolean> | boolean;
166
+ has: (eventId: string) => Promise<boolean> | boolean;
167
+ set: (eventId: string) => Promise<void> | void;
168
+ };
169
+ export type VoiceTelnyxWebhookEventStoreOptions = {
170
+ ttlSeconds?: number;
171
+ };
172
+ export type VoiceSQLiteTelnyxWebhookEventStoreOptions = VoiceTelnyxWebhookEventStoreOptions & {
173
+ database?: Database;
174
+ path?: string;
175
+ tableName?: string;
176
+ tablePrefix?: string;
177
+ };
178
+ export type VoicePostgresTelnyxWebhookEventStoreOptions = VoiceTelnyxWebhookEventStoreOptions & {
179
+ connectionString?: string;
180
+ schemaName?: string;
181
+ sql?: VoicePostgresClient;
182
+ tableName?: string;
183
+ tablePrefix?: string;
184
+ };
185
+ export type VoiceRedisTelnyxWebhookEventClient = Pick<RedisClient, 'exists' | 'set'>;
186
+ export type VoiceRedisTelnyxWebhookEventStoreOptions = VoiceTelnyxWebhookEventStoreOptions & {
187
+ client?: VoiceRedisTelnyxWebhookEventClient;
188
+ keyPrefix?: string;
189
+ url?: string;
190
+ };
191
+ export type VoiceTelnyxWebhookVerifierOptions = {
192
+ eventStore?: VoiceTelnyxWebhookEventStore;
193
+ publicKey?: string;
194
+ toleranceSeconds?: number;
195
+ };
196
+ export declare const createTelnyxVoiceResponse: (options: TelnyxVoiceResponseOptions) => string;
197
+ export declare const createTelnyxMediaStreamBridge: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(socket: TelnyxMediaStreamSocket, options: TelnyxMediaStreamBridgeOptions<TContext, TSession, TResult>) => TelnyxMediaStreamBridge;
198
+ export declare const verifyVoiceTelnyxWebhookSignature: (input: {
199
+ body: string;
200
+ headers: Headers;
201
+ publicKey?: string;
202
+ toleranceSeconds?: number;
203
+ }) => Promise<VoiceTelephonyWebhookVerificationResult>;
204
+ export declare const createMemoryVoiceTelnyxWebhookEventStore: () => VoiceTelnyxWebhookEventStore;
205
+ export declare const createVoiceSQLiteTelnyxWebhookEventStore: (options: VoiceSQLiteTelnyxWebhookEventStoreOptions) => VoiceTelnyxWebhookEventStore;
206
+ export declare const createVoicePostgresTelnyxWebhookEventStore: (options?: VoicePostgresTelnyxWebhookEventStoreOptions) => VoiceTelnyxWebhookEventStore;
207
+ export declare const createVoiceRedisTelnyxWebhookEventStore: (options?: VoiceRedisTelnyxWebhookEventStoreOptions) => VoiceTelnyxWebhookEventStore;
208
+ export declare const createVoiceTelnyxWebhookVerifier: (options: VoiceTelnyxWebhookVerifierOptions) => (input: {
209
+ rawBody: string;
210
+ headers: Headers;
211
+ }) => Promise<VoiceTelephonyWebhookVerificationResult>;
212
+ export declare const createTelnyxVoiceRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options?: TelnyxVoiceRoutesOptions<TContext, TSession, TResult>) => Elysia<"", {
213
+ decorator: {};
214
+ store: {};
215
+ derive: {};
216
+ resolve: {};
217
+ }, {
218
+ typebox: {};
219
+ error: {};
220
+ }, {
221
+ schema: {};
222
+ standaloneSchema: {};
223
+ macro: {};
224
+ macroFn: {};
225
+ parser: {};
226
+ response: {};
227
+ }, {
228
+ [x: string]: {
229
+ get: {
230
+ body: unknown;
231
+ params: {};
232
+ query: unknown;
233
+ headers: unknown;
234
+ response: {
235
+ 200: Response;
236
+ };
237
+ };
238
+ };
239
+ } & {
240
+ [x: string]: {
241
+ post: {
242
+ body: unknown;
243
+ params: {};
244
+ query: unknown;
245
+ headers: unknown;
246
+ response: {
247
+ 200: Response;
248
+ };
249
+ };
250
+ };
251
+ } & {
252
+ [x: string]: {
253
+ subscribe: {
254
+ body: unknown;
255
+ params: {};
256
+ query: unknown;
257
+ headers: unknown;
258
+ response: {};
259
+ };
260
+ };
261
+ } & {
262
+ [x: string]: {
263
+ post: {
264
+ body: unknown;
265
+ params: {};
266
+ query: unknown;
267
+ headers: unknown;
268
+ response: {
269
+ 200: Response | import("..").VoiceTelephonyWebhookDecision<TResult>;
270
+ };
271
+ };
272
+ };
273
+ }, {
274
+ derive: {};
275
+ resolve: {};
276
+ schema: {};
277
+ standaloneSchema: {};
278
+ response: {};
279
+ }, {
280
+ derive: {};
281
+ resolve: {};
282
+ schema: {};
283
+ standaloneSchema: {};
284
+ response: {};
285
+ } & {
286
+ derive: {};
287
+ resolve: {};
288
+ schema: {};
289
+ standaloneSchema: {};
290
+ response: {};
291
+ }>;
@@ -1,5 +1,8 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { VoiceTelephonySetupStatus, VoiceTelephonySmokeCheck, VoiceTelephonySmokeReport } from './contract';
3
+ import { type VoiceTelephonyOutcomePolicy, type VoiceTelephonyWebhookRoutesOptions } from '../telephonyOutcome';
1
4
  import { type VoiceCallReviewArtifact, type VoiceCallReviewConfig } from '../testing/review';
2
- import type { AudioFormat, VoiceLogger, VoicePluginConfig, VoiceSessionRecord, VoiceServerMessage } from '../types';
5
+ import type { AudioFormat, STTAdapter, VoiceLogger, VoicePluginConfig, VoiceSessionRecord, VoiceServerMessage } from '../types';
3
6
  type TwilioMediaPayload = {
4
7
  chunk?: string;
5
8
  payload: string;
@@ -75,7 +78,7 @@ export type TwilioMediaStreamSocket = {
75
78
  close: (code?: number, reason?: string) => void | Promise<void>;
76
79
  send: (data: string) => void | Promise<void>;
77
80
  };
78
- export type TwilioMediaStreamBridgeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoicePluginConfig<TContext, TSession, TResult>, 'htmx' | 'path'> & {
81
+ export type TwilioMediaStreamBridgeOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = Omit<VoicePluginConfig<TContext, TSession, TResult>, 'htmx' | 'path' | 'stt'> & {
79
82
  clearOnInboundMedia?: boolean;
80
83
  context: TContext;
81
84
  logger?: VoiceLogger;
@@ -94,6 +97,7 @@ export type TwilioMediaStreamBridgeOptions<TContext = unknown, TSession extends
94
97
  };
95
98
  scenarioId?: string;
96
99
  sessionId?: string;
100
+ stt: STTAdapter;
97
101
  };
98
102
  export type TwilioMediaStreamBridge = {
99
103
  close: (reason?: string) => Promise<void>;
@@ -107,10 +111,139 @@ export type TwilioVoiceResponseOptions = {
107
111
  streamUrl: string;
108
112
  track?: 'both_tracks' | 'inbound_track' | 'outbound_track';
109
113
  };
114
+ export type TwilioVoiceRouteParameters = Record<string, string | number | boolean | undefined> | ((input: {
115
+ query: Record<string, unknown>;
116
+ request: Request;
117
+ }) => Promise<Record<string, string | number | boolean | undefined>> | Record<string, string | number | boolean | undefined>);
118
+ export type TwilioVoiceSetupStatus = VoiceTelephonySetupStatus<'twilio'> & {
119
+ urls: VoiceTelephonySetupStatus<'twilio'>['urls'] & {
120
+ twiml: string;
121
+ };
122
+ };
123
+ export type TwilioVoiceSetupOptions = {
124
+ path?: false | string;
125
+ requiredEnv?: Record<string, string | undefined>;
126
+ title?: string;
127
+ };
128
+ export type TwilioVoiceSmokeCheck = VoiceTelephonySmokeCheck;
129
+ export type TwilioVoiceSmokeReport = VoiceTelephonySmokeReport<'twilio'> & {
130
+ setup: TwilioVoiceSetupStatus;
131
+ };
132
+ export type TwilioVoiceSmokeOptions = {
133
+ callSid?: string;
134
+ path?: false | string;
135
+ scenarioId?: string;
136
+ sessionId?: string;
137
+ sipCode?: number;
138
+ status?: string;
139
+ title?: string;
140
+ };
141
+ export type TwilioVoiceRoutesOptions<TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown> = TwilioMediaStreamBridgeOptions<TContext, TSession, TResult> & {
142
+ name?: string;
143
+ outcomePolicy?: VoiceTelephonyOutcomePolicy;
144
+ smoke?: TwilioVoiceSmokeOptions;
145
+ setup?: TwilioVoiceSetupOptions;
146
+ streamPath?: string;
147
+ twiml?: {
148
+ parameters?: TwilioVoiceRouteParameters;
149
+ path?: string;
150
+ streamName?: string;
151
+ streamUrl?: string | ((input: {
152
+ query: Record<string, unknown>;
153
+ request: Request;
154
+ streamPath: string;
155
+ }) => Promise<string> | string);
156
+ track?: TwilioVoiceResponseOptions['track'];
157
+ };
158
+ webhook?: Omit<VoiceTelephonyWebhookRoutesOptions<TContext, TSession, TResult>, 'context' | 'path' | 'policy' | 'provider'> & {
159
+ path?: string;
160
+ policy?: VoiceTelephonyOutcomePolicy;
161
+ };
162
+ };
110
163
  export declare const decodeTwilioMulawBase64: (payload: string) => Int16Array<ArrayBuffer>;
111
164
  export declare const encodeTwilioMulawBase64: (samples: Int16Array) => string;
112
165
  export declare const transcodeTwilioInboundPayloadToPCM16: (payload: string) => Uint8Array<ArrayBuffer>;
113
166
  export declare const transcodePCMToTwilioOutboundPayload: (chunk: Uint8Array, format: AudioFormat) => string;
114
167
  export declare const createTwilioVoiceResponse: (options: TwilioVoiceResponseOptions) => string;
115
168
  export declare const createTwilioMediaStreamBridge: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(socket: TwilioMediaStreamSocket, options: TwilioMediaStreamBridgeOptions<TContext, TSession, TResult>) => TwilioMediaStreamBridge;
169
+ export declare const createTwilioVoiceRoutes: <TContext = unknown, TSession extends VoiceSessionRecord = VoiceSessionRecord, TResult = unknown>(options: TwilioVoiceRoutesOptions<TContext, TSession, TResult>) => Elysia<"", {
170
+ decorator: {};
171
+ store: {};
172
+ derive: {};
173
+ resolve: {};
174
+ }, {
175
+ typebox: {};
176
+ error: {};
177
+ }, {
178
+ schema: {};
179
+ standaloneSchema: {};
180
+ macro: {};
181
+ macroFn: {};
182
+ parser: {};
183
+ response: {};
184
+ }, {
185
+ [x: string]: {
186
+ get: {
187
+ body: unknown;
188
+ params: {};
189
+ query: unknown;
190
+ headers: unknown;
191
+ response: {
192
+ 200: Response;
193
+ };
194
+ };
195
+ };
196
+ } & {
197
+ [x: string]: {
198
+ post: {
199
+ body: unknown;
200
+ params: {};
201
+ query: unknown;
202
+ headers: unknown;
203
+ response: {
204
+ 200: Response;
205
+ };
206
+ };
207
+ };
208
+ } & {
209
+ [x: string]: {
210
+ subscribe: {
211
+ body: unknown;
212
+ params: {};
213
+ query: unknown;
214
+ headers: unknown;
215
+ response: {};
216
+ };
217
+ };
218
+ } & {
219
+ [x: string]: {
220
+ post: {
221
+ body: unknown;
222
+ params: {};
223
+ query: unknown;
224
+ headers: unknown;
225
+ response: {
226
+ 200: Response | import("..").VoiceTelephonyWebhookDecision<TResult>;
227
+ };
228
+ };
229
+ };
230
+ }, {
231
+ derive: {};
232
+ resolve: {};
233
+ schema: {};
234
+ standaloneSchema: {};
235
+ response: {};
236
+ }, {
237
+ derive: {};
238
+ resolve: {};
239
+ schema: {};
240
+ standaloneSchema: {};
241
+ response: {};
242
+ } & {
243
+ derive: {};
244
+ resolve: {};
245
+ schema: {};
246
+ standaloneSchema: {};
247
+ response: {};
248
+ }>;
116
249
  export {};