@absolutejs/voice 0.0.22-beta.17 → 0.0.22-beta.170

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 (189) hide show
  1. package/README.md +1057 -5
  2. package/dist/agent.d.ts +24 -0
  3. package/dist/agentSquadContract.d.ts +64 -0
  4. package/dist/angular/index.d.ts +12 -0
  5. package/dist/angular/index.js +3196 -1111
  6. package/dist/angular/voice-campaign-dialer-proof.service.d.ts +14 -0
  7. package/dist/angular/voice-controller.service.d.ts +1 -0
  8. package/dist/angular/voice-delivery-runtime.component.d.ts +17 -0
  9. package/dist/angular/voice-delivery-runtime.service.d.ts +16 -0
  10. package/dist/angular/voice-ops-action-center.service.d.ts +13 -0
  11. package/dist/angular/voice-ops-status.component.d.ts +15 -0
  12. package/dist/angular/voice-ops-status.service.d.ts +12 -0
  13. package/dist/angular/voice-provider-capabilities.service.d.ts +12 -0
  14. package/dist/angular/voice-provider-contracts.service.d.ts +12 -0
  15. package/dist/angular/voice-routing-status.service.d.ts +11 -0
  16. package/dist/angular/voice-stream.service.d.ts +3 -0
  17. package/dist/angular/voice-trace-timeline.service.d.ts +12 -0
  18. package/dist/angular/voice-turn-latency.service.d.ts +13 -0
  19. package/dist/angular/voice-turn-quality.service.d.ts +12 -0
  20. package/dist/angular/voice-workflow-status.service.d.ts +12 -0
  21. package/dist/assistantHealth.d.ts +81 -0
  22. package/dist/audit.d.ts +128 -0
  23. package/dist/auditDeliveryRoutes.d.ts +85 -0
  24. package/dist/auditExport.d.ts +34 -0
  25. package/dist/auditRoutes.d.ts +66 -0
  26. package/dist/auditSinks.d.ts +151 -0
  27. package/dist/bargeInRoutes.d.ts +56 -0
  28. package/dist/campaign.d.ts +610 -0
  29. package/dist/campaignDialers.d.ts +90 -0
  30. package/dist/client/actions.d.ts +105 -0
  31. package/dist/client/bargeInMonitor.d.ts +7 -0
  32. package/dist/client/campaignDialerProof.d.ts +23 -0
  33. package/dist/client/connection.d.ts +3 -0
  34. package/dist/client/deliveryRuntime.d.ts +34 -0
  35. package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
  36. package/dist/client/duplex.d.ts +1 -1
  37. package/dist/client/htmxBootstrap.js +747 -15
  38. package/dist/client/index.d.ts +54 -0
  39. package/dist/client/index.js +2944 -20
  40. package/dist/client/liveTurnLatency.d.ts +41 -0
  41. package/dist/client/opsActionCenter.d.ts +54 -0
  42. package/dist/client/opsActionCenterWidget.d.ts +29 -0
  43. package/dist/client/opsActionHistory.d.ts +19 -0
  44. package/dist/client/opsActionHistoryWidget.d.ts +11 -0
  45. package/dist/client/opsStatus.d.ts +19 -0
  46. package/dist/client/opsStatusWidget.d.ts +40 -0
  47. package/dist/client/providerCapabilities.d.ts +19 -0
  48. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  49. package/dist/client/providerContracts.d.ts +19 -0
  50. package/dist/client/providerContractsWidget.d.ts +37 -0
  51. package/dist/client/providerSimulationControls.d.ts +33 -0
  52. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  53. package/dist/client/providerStatusWidget.d.ts +32 -0
  54. package/dist/client/routingStatus.d.ts +19 -0
  55. package/dist/client/routingStatusWidget.d.ts +28 -0
  56. package/dist/client/traceTimeline.d.ts +19 -0
  57. package/dist/client/traceTimelineWidget.d.ts +32 -0
  58. package/dist/client/turnLatency.d.ts +22 -0
  59. package/dist/client/turnLatencyWidget.d.ts +33 -0
  60. package/dist/client/turnQuality.d.ts +19 -0
  61. package/dist/client/turnQualityWidget.d.ts +32 -0
  62. package/dist/client/workflowStatus.d.ts +19 -0
  63. package/dist/dataControl.d.ts +47 -0
  64. package/dist/deliveryRuntime.d.ts +158 -0
  65. package/dist/deliverySinkRoutes.d.ts +117 -0
  66. package/dist/demoReadyRoutes.d.ts +98 -0
  67. package/dist/diagnosticsRoutes.d.ts +44 -0
  68. package/dist/evalRoutes.d.ts +213 -0
  69. package/dist/fileStore.d.ts +11 -2
  70. package/dist/handoff.d.ts +54 -0
  71. package/dist/handoffHealth.d.ts +94 -0
  72. package/dist/index.d.ts +114 -11
  73. package/dist/index.js +18454 -4316
  74. package/dist/liveLatency.d.ts +78 -0
  75. package/dist/modelAdapters.d.ts +23 -2
  76. package/dist/openaiRealtime.d.ts +27 -0
  77. package/dist/openaiTTS.d.ts +18 -0
  78. package/dist/opsActionAuditRoutes.d.ts +99 -0
  79. package/dist/opsConsoleRoutes.d.ts +80 -0
  80. package/dist/opsStatus.d.ts +76 -0
  81. package/dist/opsStatusRoutes.d.ts +33 -0
  82. package/dist/opsWebhook.d.ts +126 -0
  83. package/dist/outcomeContract.d.ts +112 -0
  84. package/dist/phoneAgent.d.ts +62 -0
  85. package/dist/phoneAgentProductionSmoke.d.ts +115 -0
  86. package/dist/postgresStore.d.ts +13 -2
  87. package/dist/productionReadiness.d.ts +368 -0
  88. package/dist/providerAdapters.d.ts +48 -0
  89. package/dist/providerCapabilities.d.ts +92 -0
  90. package/dist/providerHealth.d.ts +1 -0
  91. package/dist/providerRoutingContract.d.ts +38 -0
  92. package/dist/providerStackRecommendations.d.ts +145 -0
  93. package/dist/qualityRoutes.d.ts +76 -0
  94. package/dist/queue.d.ts +61 -0
  95. package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
  96. package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
  97. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  98. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  99. package/dist/react/VoiceProviderContracts.d.ts +6 -0
  100. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  101. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  102. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  103. package/dist/react/VoiceTraceTimeline.d.ts +6 -0
  104. package/dist/react/VoiceTurnLatency.d.ts +6 -0
  105. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  106. package/dist/react/index.d.ts +23 -0
  107. package/dist/react/index.js +3695 -33
  108. package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
  109. package/dist/react/useVoiceController.d.ts +3 -0
  110. package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
  111. package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
  112. package/dist/react/useVoiceOpsStatus.d.ts +8 -0
  113. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  114. package/dist/react/useVoiceProviderContracts.d.ts +8 -0
  115. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  116. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  117. package/dist/react/useVoiceStream.d.ts +3 -0
  118. package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
  119. package/dist/react/useVoiceTurnLatency.d.ts +9 -0
  120. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  121. package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
  122. package/dist/readinessProfiles.d.ts +35 -0
  123. package/dist/reconnectContract.d.ts +87 -0
  124. package/dist/resilienceRoutes.d.ts +142 -0
  125. package/dist/sessionReplay.d.ts +185 -0
  126. package/dist/simulationSuite.d.ts +120 -0
  127. package/dist/sqliteStore.d.ts +13 -2
  128. package/dist/svelte/createVoiceCampaignDialerProof.d.ts +9 -0
  129. package/dist/svelte/createVoiceDeliveryRuntime.d.ts +11 -0
  130. package/dist/svelte/createVoiceOpsActionCenter.d.ts +10 -0
  131. package/dist/svelte/createVoiceOpsStatus.d.ts +9 -0
  132. package/dist/svelte/createVoiceProviderCapabilities.d.ts +10 -0
  133. package/dist/svelte/createVoiceProviderContracts.d.ts +10 -0
  134. package/dist/svelte/createVoiceProviderSimulationControls.d.ts +11 -0
  135. package/dist/svelte/createVoiceProviderStatus.d.ts +4 -2
  136. package/dist/svelte/createVoiceRoutingStatus.d.ts +10 -0
  137. package/dist/svelte/createVoiceTraceTimeline.d.ts +10 -0
  138. package/dist/svelte/createVoiceTurnLatency.d.ts +11 -0
  139. package/dist/svelte/createVoiceTurnQuality.d.ts +10 -0
  140. package/dist/svelte/createVoiceWorkflowStatus.d.ts +8 -0
  141. package/dist/svelte/index.d.ts +12 -0
  142. package/dist/svelte/index.js +3095 -439
  143. package/dist/telephony/contract.d.ts +61 -0
  144. package/dist/telephony/matrix.d.ts +97 -0
  145. package/dist/telephony/plivo.d.ts +254 -0
  146. package/dist/telephony/telnyx.d.ts +247 -0
  147. package/dist/telephony/twilio.d.ts +135 -2
  148. package/dist/telephonyOutcome.d.ts +201 -0
  149. package/dist/testing/index.d.ts +1 -0
  150. package/dist/testing/index.js +2008 -69
  151. package/dist/testing/ioProviderSimulator.d.ts +41 -0
  152. package/dist/testing/providerSimulator.d.ts +8 -0
  153. package/dist/toolContract.d.ts +130 -0
  154. package/dist/toolRuntime.d.ts +50 -0
  155. package/dist/trace.d.ts +19 -1
  156. package/dist/traceDeliveryRoutes.d.ts +86 -0
  157. package/dist/traceTimeline.d.ts +93 -0
  158. package/dist/turnLatency.d.ts +95 -0
  159. package/dist/turnQuality.d.ts +94 -0
  160. package/dist/types.d.ts +170 -4
  161. package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
  162. package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
  163. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  164. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  165. package/dist/vue/VoiceProviderContracts.d.ts +21 -0
  166. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  167. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  168. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  169. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  170. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  171. package/dist/vue/index.d.ts +22 -0
  172. package/dist/vue/index.js +3617 -53
  173. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  174. package/dist/vue/useVoiceController.d.ts +2 -1
  175. package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
  176. package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
  177. package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
  178. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  179. package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
  180. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  181. package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
  182. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  183. package/dist/vue/useVoiceStream.d.ts +4 -1
  184. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  185. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  186. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  187. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  188. package/dist/workflowContract.d.ts +91 -0
  189. package/package.json +1 -1
@@ -0,0 +1,610 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { VoiceRedisTaskLeaseCoordinator } from './queue';
3
+ import type { VoiceTelephonyOutcomeDecision, VoiceTelephonyOutcomeProviderEvent, VoiceTelephonyWebhookDecision } from './telephonyOutcome';
4
+ export type VoiceCampaignStatus = 'canceled' | 'completed' | 'draft' | 'paused' | 'running';
5
+ export type VoiceCampaignRecipientStatus = 'canceled' | 'completed' | 'failed' | 'pending' | 'queued';
6
+ export type VoiceCampaignAttemptStatus = 'canceled' | 'failed' | 'queued' | 'running' | 'succeeded';
7
+ export type VoiceCampaignRecipient = {
8
+ attempts: number;
9
+ completedAt?: number;
10
+ createdAt: number;
11
+ error?: string;
12
+ id: string;
13
+ metadata?: Record<string, unknown>;
14
+ name?: string;
15
+ phone: string;
16
+ status: VoiceCampaignRecipientStatus;
17
+ updatedAt: number;
18
+ variables?: Record<string, string | number | boolean | undefined>;
19
+ };
20
+ export type VoiceCampaignAttempt = {
21
+ campaignId: string;
22
+ completedAt?: number;
23
+ createdAt: number;
24
+ error?: string;
25
+ externalCallId?: string;
26
+ id: string;
27
+ metadata?: Record<string, unknown>;
28
+ recipientId: string;
29
+ startedAt?: number;
30
+ status: VoiceCampaignAttemptStatus;
31
+ updatedAt: number;
32
+ };
33
+ export type VoiceCampaign = {
34
+ createdAt: number;
35
+ description?: string;
36
+ id: string;
37
+ maxAttempts: number;
38
+ maxConcurrentAttempts: number;
39
+ metadata?: Record<string, unknown>;
40
+ name: string;
41
+ status: VoiceCampaignStatus;
42
+ updatedAt: number;
43
+ };
44
+ export type VoiceCampaignRecord = {
45
+ attempts: VoiceCampaignAttempt[];
46
+ campaign: VoiceCampaign;
47
+ recipients: VoiceCampaignRecipient[];
48
+ };
49
+ export type VoiceCampaignStore = {
50
+ get: (id: string) => Promise<VoiceCampaignRecord | undefined> | VoiceCampaignRecord | undefined;
51
+ list: () => Promise<VoiceCampaignRecord[]> | VoiceCampaignRecord[];
52
+ remove: (id: string) => Promise<void> | void;
53
+ set: (id: string, record: VoiceCampaignRecord) => Promise<void> | void;
54
+ };
55
+ export type VoiceCampaignDialerInput = {
56
+ attempt: VoiceCampaignAttempt;
57
+ campaign: VoiceCampaign;
58
+ recipient: VoiceCampaignRecipient;
59
+ };
60
+ export type VoiceCampaignDialerResult = {
61
+ externalCallId?: string;
62
+ metadata?: Record<string, unknown>;
63
+ status?: 'queued' | 'running' | 'succeeded';
64
+ };
65
+ export type VoiceCampaignDialer = (input: VoiceCampaignDialerInput) => Promise<VoiceCampaignDialerResult> | VoiceCampaignDialerResult;
66
+ export type VoiceCampaignCreateInput = {
67
+ description?: string;
68
+ id?: string;
69
+ maxAttempts?: number;
70
+ maxConcurrentAttempts?: number;
71
+ metadata?: Record<string, unknown>;
72
+ name: string;
73
+ };
74
+ export type VoiceCampaignRecipientInput = {
75
+ id?: string;
76
+ metadata?: Record<string, unknown>;
77
+ name?: string;
78
+ phone: string;
79
+ variables?: VoiceCampaignRecipient['variables'];
80
+ };
81
+ export type VoiceCampaignAttemptResultInput = {
82
+ error?: string;
83
+ externalCallId?: string;
84
+ metadata?: Record<string, unknown>;
85
+ status: 'failed' | 'succeeded';
86
+ };
87
+ export type VoiceCampaignTickResult = {
88
+ attempted: number;
89
+ campaignId: string;
90
+ errors: Array<{
91
+ error: string;
92
+ recipientId: string;
93
+ }>;
94
+ started: VoiceCampaignAttempt[];
95
+ };
96
+ export type VoiceCampaignProofOptions = {
97
+ campaign?: VoiceCampaignCreateInput;
98
+ completeAttempts?: boolean;
99
+ recipients?: VoiceCampaignRecipientInput[];
100
+ runtime?: VoiceCampaignRuntime;
101
+ store?: VoiceCampaignStore;
102
+ };
103
+ export type VoiceCampaignProofReport = {
104
+ campaign: VoiceCampaignRecord;
105
+ created: VoiceCampaignRecord;
106
+ final: VoiceCampaignRecord;
107
+ proof: 'voice-campaign';
108
+ recipients: VoiceCampaignRecord;
109
+ summary: VoiceCampaignSummary;
110
+ tick: VoiceCampaignTickResult;
111
+ };
112
+ export type VoiceCampaignSummary = {
113
+ attempts: {
114
+ failed: number;
115
+ queued: number;
116
+ running: number;
117
+ succeeded: number;
118
+ total: number;
119
+ };
120
+ campaigns: {
121
+ canceled: number;
122
+ completed: number;
123
+ draft: number;
124
+ paused: number;
125
+ running: number;
126
+ total: number;
127
+ };
128
+ recipients: {
129
+ canceled: number;
130
+ completed: number;
131
+ failed: number;
132
+ pending: number;
133
+ queued: number;
134
+ total: number;
135
+ };
136
+ };
137
+ export type VoiceCampaignRuntimeOptions = {
138
+ dialer?: VoiceCampaignDialer;
139
+ store: VoiceCampaignStore;
140
+ };
141
+ export type VoiceCampaignRuntime = {
142
+ addRecipients: (campaignId: string, recipients: VoiceCampaignRecipientInput[]) => Promise<VoiceCampaignRecord>;
143
+ cancel: (campaignId: string) => Promise<VoiceCampaignRecord>;
144
+ completeAttempt: (campaignId: string, attemptId: string, result: VoiceCampaignAttemptResultInput) => Promise<VoiceCampaignRecord>;
145
+ create: (input: VoiceCampaignCreateInput) => Promise<VoiceCampaignRecord>;
146
+ enqueue: (campaignId: string) => Promise<VoiceCampaignRecord>;
147
+ get: (campaignId: string) => Promise<VoiceCampaignRecord | undefined>;
148
+ list: () => Promise<VoiceCampaignRecord[]>;
149
+ pause: (campaignId: string) => Promise<VoiceCampaignRecord>;
150
+ remove: (campaignId: string) => Promise<void>;
151
+ resume: (campaignId: string) => Promise<VoiceCampaignRecord>;
152
+ summarize: () => Promise<VoiceCampaignSummary>;
153
+ tick: (campaignId: string) => Promise<VoiceCampaignTickResult>;
154
+ };
155
+ export type VoiceCampaignRoutesOptions = VoiceCampaignRuntimeOptions & {
156
+ headers?: HeadersInit;
157
+ htmlPath?: false | string;
158
+ observability?: VoiceCampaignObservabilityOptions;
159
+ name?: string;
160
+ path?: string;
161
+ title?: string;
162
+ };
163
+ export type VoiceCampaignWorkerOptions = {
164
+ campaignIds?: string[];
165
+ leaseMs?: number;
166
+ leases: VoiceRedisTaskLeaseCoordinator;
167
+ maxCampaigns?: number;
168
+ runtime?: VoiceCampaignRuntime;
169
+ statuses?: VoiceCampaignStatus[];
170
+ store?: VoiceCampaignStore;
171
+ workerId: string;
172
+ };
173
+ export type VoiceCampaignWorkerResult = {
174
+ attempted: number;
175
+ campaigns: number;
176
+ errors: Array<{
177
+ campaignId: string;
178
+ error: string;
179
+ }>;
180
+ skipped: number;
181
+ started: VoiceCampaignAttempt[];
182
+ };
183
+ export type VoiceCampaignWorker = {
184
+ drain: () => Promise<VoiceCampaignWorkerResult>;
185
+ };
186
+ export type VoiceCampaignWorkerLoopOptions = {
187
+ onError?: (error: unknown) => void | Promise<void>;
188
+ pollIntervalMs?: number;
189
+ worker: VoiceCampaignWorker;
190
+ };
191
+ export type VoiceCampaignWorkerLoop = {
192
+ isRunning: () => boolean;
193
+ start: () => void;
194
+ stop: () => void;
195
+ tick: () => Promise<VoiceCampaignWorkerResult>;
196
+ };
197
+ export type VoiceCampaignObservabilityOptions = {
198
+ leases?: VoiceRedisTaskLeaseCoordinator;
199
+ now?: number;
200
+ rateWindowMs?: number;
201
+ stuckAfterMs?: number;
202
+ };
203
+ export type VoiceCampaignObservabilityReport = {
204
+ attemptRate: {
205
+ failed: number;
206
+ started: number;
207
+ succeeded: number;
208
+ windowMs: number;
209
+ };
210
+ campaigns: Array<{
211
+ activeAttempts: number;
212
+ campaignId: string;
213
+ lease?: {
214
+ expiresAt: number;
215
+ workerId: string;
216
+ };
217
+ name: string;
218
+ queueDepth: number;
219
+ status: VoiceCampaignStatus;
220
+ stuckAttempts: number;
221
+ stuckRecipients: number;
222
+ updatedAt: number;
223
+ }>;
224
+ failureReasons: Array<{
225
+ count: number;
226
+ reason: string;
227
+ }>;
228
+ generatedAt: number;
229
+ leases: {
230
+ active: number;
231
+ known: boolean;
232
+ };
233
+ queue: {
234
+ activeAttempts: number;
235
+ queuedRecipients: number;
236
+ runningCampaigns: number;
237
+ };
238
+ stuck: {
239
+ attempts: Array<{
240
+ attemptId: string;
241
+ campaignId: string;
242
+ recipientId: string;
243
+ status: VoiceCampaignAttemptStatus;
244
+ updatedAt: number;
245
+ }>;
246
+ recipients: Array<{
247
+ campaignId: string;
248
+ recipientId: string;
249
+ status: VoiceCampaignRecipientStatus;
250
+ updatedAt: number;
251
+ }>;
252
+ };
253
+ summary: VoiceCampaignSummary;
254
+ };
255
+ export type VoiceCampaignTelephonyOutcomeInput<TResult = unknown> = {
256
+ campaignId?: string;
257
+ decision: VoiceTelephonyOutcomeDecision;
258
+ event?: VoiceTelephonyOutcomeProviderEvent;
259
+ externalCallId?: string;
260
+ routeResult?: TResult;
261
+ sessionId?: string;
262
+ attemptId?: string;
263
+ };
264
+ export type VoiceCampaignTelephonyOutcomeStatus = 'failed' | 'ignore' | 'succeeded';
265
+ export type VoiceCampaignTelephonyOutcomeOptions<TResult = unknown> = {
266
+ resolveCampaignId?: (input: VoiceCampaignTelephonyOutcomeInput<TResult>) => Promise<string | undefined> | string | undefined;
267
+ resolveExternalCallId?: (input: VoiceCampaignTelephonyOutcomeInput<TResult>) => Promise<string | undefined> | string | undefined;
268
+ resolveAttemptId?: (input: VoiceCampaignTelephonyOutcomeInput<TResult>) => Promise<string | undefined> | string | undefined;
269
+ runtime?: VoiceCampaignRuntime;
270
+ statusForDecision?: (input: VoiceCampaignTelephonyOutcomeInput<TResult>) => Promise<VoiceCampaignTelephonyOutcomeStatus> | VoiceCampaignTelephonyOutcomeStatus;
271
+ store?: VoiceCampaignStore;
272
+ };
273
+ export type VoiceCampaignTelephonyOutcomeResult = {
274
+ applied: boolean;
275
+ campaignId?: string;
276
+ error?: string;
277
+ externalCallId?: string;
278
+ reason?: 'ignored' | 'missing-attempt' | 'missing-campaign' | 'missing-runtime' | 'terminal-attempt';
279
+ status?: 'failed' | 'succeeded';
280
+ attemptId?: string;
281
+ };
282
+ export declare const createVoiceMemoryCampaignStore: () => VoiceCampaignStore;
283
+ export declare const summarizeVoiceCampaigns: (records: VoiceCampaignRecord[]) => VoiceCampaignSummary;
284
+ export declare const buildVoiceCampaignObservabilityReport: (records: VoiceCampaignRecord[], options?: VoiceCampaignObservabilityOptions) => Promise<VoiceCampaignObservabilityReport>;
285
+ export declare const createVoiceCampaign: (options: VoiceCampaignRuntimeOptions) => VoiceCampaignRuntime;
286
+ export declare const createVoiceCampaignWorker: (options: VoiceCampaignWorkerOptions) => VoiceCampaignWorker;
287
+ export declare const createVoiceCampaignWorkerLoop: (options: VoiceCampaignWorkerLoopOptions) => VoiceCampaignWorkerLoop;
288
+ export declare const applyVoiceCampaignTelephonyOutcome: <TResult = unknown>(input: VoiceCampaignTelephonyOutcomeInput<TResult>, options?: VoiceCampaignTelephonyOutcomeOptions<TResult>) => Promise<VoiceCampaignTelephonyOutcomeResult>;
289
+ export declare const createVoiceCampaignTelephonyOutcomeHandler: <TResult = unknown>(options: VoiceCampaignTelephonyOutcomeOptions<TResult>) => (input: VoiceTelephonyWebhookDecision<TResult>) => Promise<VoiceCampaignTelephonyOutcomeResult>;
290
+ export declare const runVoiceCampaignProof: (options?: VoiceCampaignProofOptions) => Promise<VoiceCampaignProofReport>;
291
+ export declare const renderVoiceCampaignsHTML: (records: VoiceCampaignRecord[], options?: {
292
+ title?: string;
293
+ }) => string;
294
+ export declare const renderVoiceCampaignObservabilityHTML: (report: VoiceCampaignObservabilityReport, options?: {
295
+ title?: string;
296
+ }) => string;
297
+ export declare const createVoiceCampaignRoutes: (options: VoiceCampaignRoutesOptions) => Elysia<"", {
298
+ decorator: {};
299
+ store: {};
300
+ derive: {};
301
+ resolve: {};
302
+ }, {
303
+ typebox: {};
304
+ error: {};
305
+ }, {
306
+ schema: {};
307
+ standaloneSchema: {};
308
+ macro: {};
309
+ macroFn: {};
310
+ parser: {};
311
+ response: {};
312
+ }, {
313
+ [x: string]: {
314
+ get: {
315
+ body: unknown;
316
+ params: {};
317
+ query: unknown;
318
+ headers: unknown;
319
+ response: {
320
+ 200: {
321
+ campaigns: VoiceCampaignRecord[];
322
+ summary: VoiceCampaignSummary;
323
+ };
324
+ };
325
+ };
326
+ };
327
+ } & {
328
+ [x: string]: {
329
+ observability: {
330
+ get: {
331
+ body: unknown;
332
+ params: {};
333
+ query: unknown;
334
+ headers: unknown;
335
+ response: {
336
+ 200: VoiceCampaignObservabilityReport;
337
+ };
338
+ };
339
+ };
340
+ };
341
+ } & {
342
+ [x: string]: {
343
+ post: {
344
+ body: unknown;
345
+ params: {};
346
+ query: unknown;
347
+ headers: unknown;
348
+ response: {
349
+ 200: VoiceCampaignRecord;
350
+ };
351
+ };
352
+ };
353
+ } & {
354
+ [x: string]: {
355
+ ":campaignId": {
356
+ get: {
357
+ body: unknown;
358
+ params: {
359
+ campaignId: string;
360
+ } & {};
361
+ query: unknown;
362
+ headers: unknown;
363
+ response: {
364
+ 422: {
365
+ type: "validation";
366
+ on: string;
367
+ summary?: string;
368
+ message?: string;
369
+ found?: unknown;
370
+ property?: string;
371
+ expected?: string;
372
+ };
373
+ };
374
+ };
375
+ };
376
+ };
377
+ } & {
378
+ [x: string]: {
379
+ ":campaignId": {
380
+ delete: {
381
+ body: unknown;
382
+ params: {
383
+ campaignId: string;
384
+ } & {};
385
+ query: unknown;
386
+ headers: unknown;
387
+ response: {
388
+ 200: {
389
+ ok: boolean;
390
+ };
391
+ 422: {
392
+ type: "validation";
393
+ on: string;
394
+ summary?: string;
395
+ message?: string;
396
+ found?: unknown;
397
+ property?: string;
398
+ expected?: string;
399
+ };
400
+ };
401
+ };
402
+ };
403
+ };
404
+ } & {
405
+ [x: string]: {
406
+ ":campaignId": {
407
+ recipients: {
408
+ post: {
409
+ body: unknown;
410
+ params: {
411
+ campaignId: string;
412
+ } & {};
413
+ query: unknown;
414
+ headers: unknown;
415
+ response: {
416
+ 200: VoiceCampaignRecord;
417
+ 422: {
418
+ type: "validation";
419
+ on: string;
420
+ summary?: string;
421
+ message?: string;
422
+ found?: unknown;
423
+ property?: string;
424
+ expected?: string;
425
+ };
426
+ };
427
+ };
428
+ };
429
+ };
430
+ };
431
+ } & {
432
+ [x: string]: {
433
+ ":campaignId": {
434
+ enqueue: {
435
+ post: {
436
+ body: unknown;
437
+ params: {
438
+ campaignId: string;
439
+ } & {};
440
+ query: unknown;
441
+ headers: unknown;
442
+ response: {
443
+ 200: VoiceCampaignRecord;
444
+ 422: {
445
+ type: "validation";
446
+ on: string;
447
+ summary?: string;
448
+ message?: string;
449
+ found?: unknown;
450
+ property?: string;
451
+ expected?: string;
452
+ };
453
+ };
454
+ };
455
+ };
456
+ };
457
+ };
458
+ } & {
459
+ [x: string]: {
460
+ ":campaignId": {
461
+ pause: {
462
+ post: {
463
+ body: unknown;
464
+ params: {
465
+ campaignId: string;
466
+ } & {};
467
+ query: unknown;
468
+ headers: unknown;
469
+ response: {
470
+ 200: VoiceCampaignRecord;
471
+ 422: {
472
+ type: "validation";
473
+ on: string;
474
+ summary?: string;
475
+ message?: string;
476
+ found?: unknown;
477
+ property?: string;
478
+ expected?: string;
479
+ };
480
+ };
481
+ };
482
+ };
483
+ };
484
+ };
485
+ } & {
486
+ [x: string]: {
487
+ ":campaignId": {
488
+ resume: {
489
+ post: {
490
+ body: unknown;
491
+ params: {
492
+ campaignId: string;
493
+ } & {};
494
+ query: unknown;
495
+ headers: unknown;
496
+ response: {
497
+ 200: VoiceCampaignRecord;
498
+ 422: {
499
+ type: "validation";
500
+ on: string;
501
+ summary?: string;
502
+ message?: string;
503
+ found?: unknown;
504
+ property?: string;
505
+ expected?: string;
506
+ };
507
+ };
508
+ };
509
+ };
510
+ };
511
+ };
512
+ } & {
513
+ [x: string]: {
514
+ ":campaignId": {
515
+ cancel: {
516
+ post: {
517
+ body: unknown;
518
+ params: {
519
+ campaignId: string;
520
+ } & {};
521
+ query: unknown;
522
+ headers: unknown;
523
+ response: {
524
+ 200: VoiceCampaignRecord;
525
+ 422: {
526
+ type: "validation";
527
+ on: string;
528
+ summary?: string;
529
+ message?: string;
530
+ found?: unknown;
531
+ property?: string;
532
+ expected?: string;
533
+ };
534
+ };
535
+ };
536
+ };
537
+ };
538
+ };
539
+ } & {
540
+ [x: string]: {
541
+ ":campaignId": {
542
+ tick: {
543
+ post: {
544
+ body: unknown;
545
+ params: {
546
+ campaignId: string;
547
+ } & {};
548
+ query: unknown;
549
+ headers: unknown;
550
+ response: {
551
+ 200: VoiceCampaignTickResult;
552
+ 422: {
553
+ type: "validation";
554
+ on: string;
555
+ summary?: string;
556
+ message?: string;
557
+ found?: unknown;
558
+ property?: string;
559
+ expected?: string;
560
+ };
561
+ };
562
+ };
563
+ };
564
+ };
565
+ };
566
+ } & {
567
+ [x: string]: {
568
+ ":campaignId": {
569
+ attempts: {
570
+ ":attemptId": {
571
+ result: {
572
+ post: {
573
+ body: unknown;
574
+ params: {
575
+ campaignId: string;
576
+ attemptId: string;
577
+ } & {};
578
+ query: unknown;
579
+ headers: unknown;
580
+ response: {
581
+ 200: VoiceCampaignRecord;
582
+ 422: {
583
+ type: "validation";
584
+ on: string;
585
+ summary?: string;
586
+ message?: string;
587
+ found?: unknown;
588
+ property?: string;
589
+ expected?: string;
590
+ };
591
+ };
592
+ };
593
+ };
594
+ };
595
+ };
596
+ };
597
+ };
598
+ }, {
599
+ derive: {};
600
+ resolve: {};
601
+ schema: {};
602
+ standaloneSchema: {};
603
+ response: {};
604
+ }, {
605
+ derive: {};
606
+ resolve: {};
607
+ schema: {};
608
+ standaloneSchema: {};
609
+ response: {};
610
+ }>;
@@ -0,0 +1,90 @@
1
+ import { applyVoiceCampaignTelephonyOutcome, VoiceCampaignDialer, VoiceCampaignDialerInput, type VoiceCampaignRecord, type VoiceCampaignStore, type VoiceCampaignTickResult } from './campaign';
2
+ type VoiceCampaignDialerFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3
+ type VoiceCampaignDialerMetadataInput = VoiceCampaignDialerInput & {
4
+ provider: 'plivo' | 'telnyx' | 'twilio';
5
+ };
6
+ type VoiceCampaignDialerMetadata = Record<string, string | number | boolean | undefined> | ((input: VoiceCampaignDialerMetadataInput) => Record<string, string | number | boolean | undefined> | Promise<Record<string, string | number | boolean | undefined>>);
7
+ type VoiceCampaignURLInput = {
8
+ attempt: VoiceCampaignDialerInput['attempt'];
9
+ campaign: VoiceCampaignDialerInput['campaign'];
10
+ recipient: VoiceCampaignDialerInput['recipient'];
11
+ };
12
+ type VoiceCampaignURLResolver = string | ((input: VoiceCampaignURLInput) => string | Promise<string>);
13
+ export type VoiceTwilioCampaignDialerOptions = {
14
+ accountSid: string;
15
+ answerMethod?: 'GET' | 'POST';
16
+ answerUrl: VoiceCampaignURLResolver;
17
+ apiBaseUrl?: string;
18
+ authToken: string;
19
+ fetch?: VoiceCampaignDialerFetch;
20
+ from: string;
21
+ machineDetection?: string;
22
+ metadata?: VoiceCampaignDialerMetadata;
23
+ statusCallbackEvents?: string[];
24
+ statusCallbackMethod?: 'GET' | 'POST';
25
+ statusCallbackUrl?: VoiceCampaignURLResolver;
26
+ };
27
+ export type VoiceTelnyxCampaignDialerOptions = {
28
+ apiBaseUrl?: string;
29
+ apiKey: string;
30
+ clientState?: VoiceCampaignDialerMetadata;
31
+ connectionId: string;
32
+ fetch?: VoiceCampaignDialerFetch;
33
+ from: string;
34
+ webhookUrl?: VoiceCampaignURLResolver;
35
+ webhookUrlMethod?: 'GET' | 'POST';
36
+ };
37
+ export type VoicePlivoCampaignDialerOptions = {
38
+ answerMethod?: 'GET' | 'POST';
39
+ answerUrl: VoiceCampaignURLResolver;
40
+ apiBaseUrl?: string;
41
+ authId: string;
42
+ authToken: string;
43
+ callbackMethod?: 'GET' | 'POST';
44
+ callbackUrl?: VoiceCampaignURLResolver;
45
+ fetch?: VoiceCampaignDialerFetch;
46
+ from: string;
47
+ metadata?: VoiceCampaignDialerMetadata;
48
+ };
49
+ export type VoiceCampaignDialerProofProvider = 'plivo' | 'telnyx' | 'twilio';
50
+ export type VoiceCampaignDialerProofCarrierRequest = {
51
+ body: unknown;
52
+ method: string;
53
+ provider: VoiceCampaignDialerProofProvider;
54
+ url: string;
55
+ };
56
+ export type VoiceCampaignDialerProofProviderResult = {
57
+ campaignId: string;
58
+ carrierRequests: VoiceCampaignDialerProofCarrierRequest[];
59
+ final?: VoiceCampaignRecord;
60
+ outcomes: Awaited<ReturnType<typeof applyVoiceCampaignTelephonyOutcome>>[];
61
+ provider: VoiceCampaignDialerProofProvider;
62
+ tick: VoiceCampaignTickResult;
63
+ };
64
+ export type VoiceCampaignDialerProofReport = {
65
+ generatedAt: number;
66
+ mode: 'dry-run';
67
+ ok: boolean;
68
+ providers: VoiceCampaignDialerProofProviderResult[];
69
+ };
70
+ export type VoiceCampaignDialerProofStatus = {
71
+ generatedAt: number;
72
+ mode: 'dry-run';
73
+ ok: boolean;
74
+ providers: VoiceCampaignDialerProofProvider[];
75
+ runPath?: string;
76
+ safe: true;
77
+ };
78
+ export type VoiceCampaignDialerProofOptions = {
79
+ baseUrl?: string;
80
+ from?: string;
81
+ providers?: VoiceCampaignDialerProofProvider[];
82
+ runPath?: string;
83
+ store?: VoiceCampaignStore;
84
+ };
85
+ export declare const createVoiceTwilioCampaignDialer: (options: VoiceTwilioCampaignDialerOptions) => VoiceCampaignDialer;
86
+ export declare const createVoiceTelnyxCampaignDialer: (options: VoiceTelnyxCampaignDialerOptions) => VoiceCampaignDialer;
87
+ export declare const createVoicePlivoCampaignDialer: (options: VoicePlivoCampaignDialerOptions) => VoiceCampaignDialer;
88
+ export declare const getVoiceCampaignDialerProofStatus: (options?: Pick<VoiceCampaignDialerProofOptions, "providers" | "runPath">) => VoiceCampaignDialerProofStatus;
89
+ export declare const runVoiceCampaignDialerProof: (options?: VoiceCampaignDialerProofOptions) => Promise<VoiceCampaignDialerProofReport>;
90
+ export {};