@absolutejs/voice 0.0.22-beta.25 → 0.0.22-beta.251

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 (226) hide show
  1. package/README.md +3234 -228
  2. package/dist/agent.d.ts +62 -0
  3. package/dist/agentSquadContract.d.ts +69 -0
  4. package/dist/angular/index.d.ts +15 -0
  5. package/dist/angular/index.js +3387 -1093
  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 +3 -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 +746 -0
  32. package/dist/campaignDialers.d.ts +90 -0
  33. package/dist/client/actions.d.ts +105 -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/connection.d.ts +3 -0
  39. package/dist/client/deliveryRuntime.d.ts +34 -0
  40. package/dist/client/deliveryRuntimeWidget.d.ts +37 -0
  41. package/dist/client/duplex.d.ts +1 -1
  42. package/dist/client/htmxBootstrap.js +747 -15
  43. package/dist/client/index.d.ts +66 -0
  44. package/dist/client/index.js +4894 -21
  45. package/dist/client/liveOps.d.ts +22 -0
  46. package/dist/client/liveOpsWidget.d.ts +23 -0
  47. package/dist/client/liveTurnLatency.d.ts +41 -0
  48. package/dist/client/opsActionCenter.d.ts +54 -0
  49. package/dist/client/opsActionCenterWidget.d.ts +29 -0
  50. package/dist/client/opsActionHistory.d.ts +19 -0
  51. package/dist/client/opsActionHistoryWidget.d.ts +11 -0
  52. package/dist/client/opsStatus.d.ts +19 -0
  53. package/dist/client/opsStatusWidget.d.ts +40 -0
  54. package/dist/client/platformCoverage.d.ts +19 -0
  55. package/dist/client/platformCoverageWidget.d.ts +37 -0
  56. package/dist/client/proofTrends.d.ts +19 -0
  57. package/dist/client/proofTrendsWidget.d.ts +37 -0
  58. package/dist/client/providerCapabilities.d.ts +19 -0
  59. package/dist/client/providerCapabilitiesWidget.d.ts +32 -0
  60. package/dist/client/providerContracts.d.ts +19 -0
  61. package/dist/client/providerContractsWidget.d.ts +37 -0
  62. package/dist/client/providerSimulationControls.d.ts +33 -0
  63. package/dist/client/providerSimulationControlsWidget.d.ts +20 -0
  64. package/dist/client/providerStatusWidget.d.ts +32 -0
  65. package/dist/client/routingStatus.d.ts +19 -0
  66. package/dist/client/routingStatusWidget.d.ts +28 -0
  67. package/dist/client/traceTimeline.d.ts +19 -0
  68. package/dist/client/traceTimelineWidget.d.ts +36 -0
  69. package/dist/client/turnLatency.d.ts +22 -0
  70. package/dist/client/turnLatencyWidget.d.ts +33 -0
  71. package/dist/client/turnQuality.d.ts +19 -0
  72. package/dist/client/turnQualityWidget.d.ts +32 -0
  73. package/dist/client/workflowStatus.d.ts +19 -0
  74. package/dist/dataControl.d.ts +140 -0
  75. package/dist/deliveryRuntime.d.ts +158 -0
  76. package/dist/deliverySinkRoutes.d.ts +117 -0
  77. package/dist/demoReadyRoutes.d.ts +98 -0
  78. package/dist/diagnosticsRoutes.d.ts +44 -0
  79. package/dist/evalRoutes.d.ts +219 -0
  80. package/dist/fileStore.d.ts +14 -2
  81. package/dist/guardrails.d.ts +128 -0
  82. package/dist/handoff.d.ts +54 -0
  83. package/dist/handoffHealth.d.ts +94 -0
  84. package/dist/incidentBundle.d.ts +116 -0
  85. package/dist/index.d.ts +132 -13
  86. package/dist/index.js +24299 -4986
  87. package/dist/latencySlo.d.ts +56 -0
  88. package/dist/liveLatency.d.ts +78 -0
  89. package/dist/liveOps.d.ts +122 -0
  90. package/dist/modelAdapters.d.ts +23 -2
  91. package/dist/observabilityExport.d.ts +428 -0
  92. package/dist/openaiRealtime.d.ts +27 -0
  93. package/dist/openaiTTS.d.ts +18 -0
  94. package/dist/operationsRecord.d.ts +210 -0
  95. package/dist/opsActionAuditRoutes.d.ts +99 -0
  96. package/dist/opsConsoleRoutes.d.ts +80 -0
  97. package/dist/opsRecovery.d.ts +137 -0
  98. package/dist/opsStatus.d.ts +76 -0
  99. package/dist/opsStatusRoutes.d.ts +33 -0
  100. package/dist/outcomeContract.d.ts +115 -0
  101. package/dist/phoneAgent.d.ts +76 -0
  102. package/dist/phoneAgentProductionSmoke.d.ts +115 -0
  103. package/dist/platformCoverage.d.ts +91 -0
  104. package/dist/postCallAnalysis.d.ts +98 -0
  105. package/dist/postgresStore.d.ts +13 -2
  106. package/dist/productionReadiness.d.ts +484 -0
  107. package/dist/proofTrends.d.ts +108 -0
  108. package/dist/providerAdapters.d.ts +48 -0
  109. package/dist/providerCapabilities.d.ts +92 -0
  110. package/dist/providerHealth.d.ts +1 -0
  111. package/dist/providerRoutingContract.d.ts +38 -0
  112. package/dist/providerSlo.d.ts +142 -0
  113. package/dist/providerStackRecommendations.d.ts +145 -0
  114. package/dist/qualityRoutes.d.ts +76 -0
  115. package/dist/queue.d.ts +61 -0
  116. package/dist/react/VoiceAgentSquadStatus.d.ts +5 -0
  117. package/dist/react/VoiceDeliveryRuntime.d.ts +7 -0
  118. package/dist/react/VoiceOpsActionCenter.d.ts +5 -0
  119. package/dist/react/VoiceOpsStatus.d.ts +6 -0
  120. package/dist/react/VoicePlatformCoverage.d.ts +6 -0
  121. package/dist/react/VoiceProofTrends.d.ts +6 -0
  122. package/dist/react/VoiceProviderCapabilities.d.ts +6 -0
  123. package/dist/react/VoiceProviderContracts.d.ts +6 -0
  124. package/dist/react/VoiceProviderSimulationControls.d.ts +5 -0
  125. package/dist/react/VoiceProviderStatus.d.ts +6 -0
  126. package/dist/react/VoiceRoutingStatus.d.ts +6 -0
  127. package/dist/react/VoiceTraceTimeline.d.ts +6 -0
  128. package/dist/react/VoiceTurnLatency.d.ts +6 -0
  129. package/dist/react/VoiceTurnQuality.d.ts +6 -0
  130. package/dist/react/index.d.ts +30 -0
  131. package/dist/react/index.js +4739 -33
  132. package/dist/react/useVoiceAgentSquadStatus.d.ts +8 -0
  133. package/dist/react/useVoiceCampaignDialerProof.d.ts +10 -0
  134. package/dist/react/useVoiceController.d.ts +3 -0
  135. package/dist/react/useVoiceDeliveryRuntime.d.ts +13 -0
  136. package/dist/react/useVoiceLiveOps.d.ts +9 -0
  137. package/dist/react/useVoiceOpsActionCenter.d.ts +11 -0
  138. package/dist/react/useVoiceOpsStatus.d.ts +8 -0
  139. package/dist/react/useVoicePlatformCoverage.d.ts +8 -0
  140. package/dist/react/useVoiceProofTrends.d.ts +8 -0
  141. package/dist/react/useVoiceProviderCapabilities.d.ts +8 -0
  142. package/dist/react/useVoiceProviderContracts.d.ts +8 -0
  143. package/dist/react/useVoiceProviderSimulationControls.d.ts +10 -0
  144. package/dist/react/useVoiceRoutingStatus.d.ts +8 -0
  145. package/dist/react/useVoiceStream.d.ts +3 -0
  146. package/dist/react/useVoiceTraceTimeline.d.ts +8 -0
  147. package/dist/react/useVoiceTurnLatency.d.ts +9 -0
  148. package/dist/react/useVoiceTurnQuality.d.ts +8 -0
  149. package/dist/react/useVoiceWorkflowStatus.d.ts +8 -0
  150. package/dist/readinessProfiles.d.ts +37 -0
  151. package/dist/reconnectContract.d.ts +87 -0
  152. package/dist/resilienceRoutes.d.ts +143 -0
  153. package/dist/sessionReplay.d.ts +12 -0
  154. package/dist/simulationSuite.d.ts +121 -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 +4754 -439
  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 +254 -0
  178. package/dist/telephony/telnyx.d.ts +247 -0
  179. package/dist/telephony/twilio.d.ts +135 -2
  180. package/dist/telephonyOutcome.d.ts +201 -0
  181. package/dist/testing/index.d.ts +1 -0
  182. package/dist/testing/index.js +2024 -69
  183. package/dist/testing/ioProviderSimulator.d.ts +41 -0
  184. package/dist/toolContract.d.ts +133 -0
  185. package/dist/toolRuntime.d.ts +50 -0
  186. package/dist/trace.d.ts +19 -1
  187. package/dist/traceDeliveryRoutes.d.ts +86 -0
  188. package/dist/traceTimeline.d.ts +97 -0
  189. package/dist/turnLatency.d.ts +95 -0
  190. package/dist/turnQuality.d.ts +94 -0
  191. package/dist/types.d.ts +180 -4
  192. package/dist/vue/VoiceDeliveryRuntime.d.ts +30 -0
  193. package/dist/vue/VoiceOpsActionCenter.d.ts +13 -0
  194. package/dist/vue/VoiceOpsStatus.d.ts +30 -0
  195. package/dist/vue/VoicePlatformCoverage.d.ts +23 -0
  196. package/dist/vue/VoiceProofTrends.d.ts +21 -0
  197. package/dist/vue/VoiceProviderCapabilities.d.ts +51 -0
  198. package/dist/vue/VoiceProviderContracts.d.ts +21 -0
  199. package/dist/vue/VoiceProviderSimulationControls.d.ts +88 -0
  200. package/dist/vue/VoiceProviderStatus.d.ts +51 -0
  201. package/dist/vue/VoiceRoutingStatus.d.ts +51 -0
  202. package/dist/vue/VoiceTurnLatency.d.ts +69 -0
  203. package/dist/vue/VoiceTurnQuality.d.ts +51 -0
  204. package/dist/vue/index.d.ts +28 -0
  205. package/dist/vue/index.js +4519 -57
  206. package/dist/vue/useVoiceAgentSquadStatus.d.ts +9 -0
  207. package/dist/vue/useVoiceCampaignDialerProof.d.ts +11 -0
  208. package/dist/vue/useVoiceController.d.ts +2 -1
  209. package/dist/vue/useVoiceDeliveryRuntime.d.ts +13 -0
  210. package/dist/vue/useVoiceLiveOps.d.ts +9 -0
  211. package/dist/vue/useVoiceOpsActionCenter.d.ts +11 -0
  212. package/dist/vue/useVoiceOpsStatus.d.ts +9 -0
  213. package/dist/vue/useVoicePlatformCoverage.d.ts +9 -0
  214. package/dist/vue/useVoiceProofTrends.d.ts +9 -0
  215. package/dist/vue/useVoiceProviderCapabilities.d.ts +9 -0
  216. package/dist/vue/useVoiceProviderContracts.d.ts +9 -0
  217. package/dist/vue/useVoiceProviderSimulationControls.d.ts +24 -0
  218. package/dist/vue/useVoiceProviderStatus.d.ts +1 -1
  219. package/dist/vue/useVoiceRoutingStatus.d.ts +8 -0
  220. package/dist/vue/useVoiceStream.d.ts +4 -1
  221. package/dist/vue/useVoiceTraceTimeline.d.ts +9 -0
  222. package/dist/vue/useVoiceTurnLatency.d.ts +10 -0
  223. package/dist/vue/useVoiceTurnQuality.d.ts +9 -0
  224. package/dist/vue/useVoiceWorkflowStatus.d.ts +9 -0
  225. package/dist/workflowContract.d.ts +91 -0
  226. package/package.json +1 -1
@@ -0,0 +1,746 @@
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 VoiceCampaignTimeWindow = {
8
+ daysOfWeek?: number[];
9
+ endHour: number;
10
+ startHour: number;
11
+ timeZoneOffsetMinutes?: number;
12
+ };
13
+ export type VoiceCampaignRateLimit = {
14
+ maxAttempts: number;
15
+ windowMs: number;
16
+ };
17
+ export type VoiceCampaignRetryPolicy = {
18
+ backoffMs?: number | number[];
19
+ maxBackoffMs?: number;
20
+ };
21
+ export type VoiceCampaignSchedule = {
22
+ attemptWindow?: VoiceCampaignTimeWindow;
23
+ quietHours?: VoiceCampaignTimeWindow;
24
+ rateLimit?: VoiceCampaignRateLimit;
25
+ retryPolicy?: VoiceCampaignRetryPolicy;
26
+ };
27
+ export type VoiceCampaignRecipient = {
28
+ attempts: number;
29
+ completedAt?: number;
30
+ createdAt: number;
31
+ error?: string;
32
+ id: string;
33
+ metadata?: Record<string, unknown>;
34
+ name?: string;
35
+ phone: string;
36
+ status: VoiceCampaignRecipientStatus;
37
+ updatedAt: number;
38
+ variables?: Record<string, string | number | boolean | undefined>;
39
+ };
40
+ export type VoiceCampaignAttempt = {
41
+ campaignId: string;
42
+ completedAt?: number;
43
+ createdAt: number;
44
+ error?: string;
45
+ externalCallId?: string;
46
+ id: string;
47
+ metadata?: Record<string, unknown>;
48
+ recipientId: string;
49
+ startedAt?: number;
50
+ status: VoiceCampaignAttemptStatus;
51
+ updatedAt: number;
52
+ };
53
+ export type VoiceCampaign = {
54
+ createdAt: number;
55
+ description?: string;
56
+ id: string;
57
+ maxAttempts: number;
58
+ maxConcurrentAttempts: number;
59
+ metadata?: Record<string, unknown>;
60
+ name: string;
61
+ schedule?: VoiceCampaignSchedule;
62
+ status: VoiceCampaignStatus;
63
+ updatedAt: number;
64
+ };
65
+ export type VoiceCampaignRecord = {
66
+ attempts: VoiceCampaignAttempt[];
67
+ campaign: VoiceCampaign;
68
+ recipients: VoiceCampaignRecipient[];
69
+ };
70
+ export type VoiceCampaignStore = {
71
+ get: (id: string) => Promise<VoiceCampaignRecord | undefined> | VoiceCampaignRecord | undefined;
72
+ list: () => Promise<VoiceCampaignRecord[]> | VoiceCampaignRecord[];
73
+ remove: (id: string) => Promise<void> | void;
74
+ set: (id: string, record: VoiceCampaignRecord) => Promise<void> | void;
75
+ };
76
+ export type VoiceCampaignDialerInput = {
77
+ attempt: VoiceCampaignAttempt;
78
+ campaign: VoiceCampaign;
79
+ recipient: VoiceCampaignRecipient;
80
+ };
81
+ export type VoiceCampaignDialerResult = {
82
+ externalCallId?: string;
83
+ metadata?: Record<string, unknown>;
84
+ status?: 'queued' | 'running' | 'succeeded';
85
+ };
86
+ export type VoiceCampaignDialer = (input: VoiceCampaignDialerInput) => Promise<VoiceCampaignDialerResult> | VoiceCampaignDialerResult;
87
+ export type VoiceCampaignCreateInput = {
88
+ description?: string;
89
+ id?: string;
90
+ maxAttempts?: number;
91
+ maxConcurrentAttempts?: number;
92
+ metadata?: Record<string, unknown>;
93
+ name: string;
94
+ schedule?: VoiceCampaignSchedule;
95
+ };
96
+ export type VoiceCampaignRecipientInput = {
97
+ id?: string;
98
+ metadata?: Record<string, unknown>;
99
+ name?: string;
100
+ phone: string;
101
+ variables?: VoiceCampaignRecipient['variables'];
102
+ };
103
+ export type VoiceCampaignRecipientImportRow = Record<string, unknown>;
104
+ export type VoiceCampaignRecipientImportIssueCode = 'duplicate' | 'missing-consent' | 'missing-phone' | 'invalid-phone';
105
+ export type VoiceCampaignRecipientImportIssue = {
106
+ code: VoiceCampaignRecipientImportIssueCode;
107
+ message: string;
108
+ row: number;
109
+ value?: unknown;
110
+ };
111
+ export type VoiceCampaignRecipientImportOptions = {
112
+ consentColumn?: string;
113
+ csv?: string;
114
+ dedupe?: boolean;
115
+ idColumn?: string;
116
+ metadataColumns?: string[];
117
+ nameColumn?: string;
118
+ phoneColumn?: string;
119
+ requireConsent?: boolean;
120
+ rows?: VoiceCampaignRecipientImportRow[];
121
+ variableColumns?: string[];
122
+ };
123
+ export type VoiceCampaignRecipientImportResult = {
124
+ accepted: VoiceCampaignRecipientInput[];
125
+ duplicates: number;
126
+ rejected: VoiceCampaignRecipientImportIssue[];
127
+ total: number;
128
+ };
129
+ export type VoiceCampaignAttemptResultInput = {
130
+ error?: string;
131
+ externalCallId?: string;
132
+ metadata?: Record<string, unknown>;
133
+ status: 'failed' | 'succeeded';
134
+ };
135
+ export type VoiceCampaignTickResult = {
136
+ attempted: number;
137
+ blocked: Array<{
138
+ reason: 'outside-attempt-window' | 'quiet-hours' | 'rate-limit' | 'retry-backoff';
139
+ recipientId?: string;
140
+ until?: number;
141
+ }>;
142
+ campaignId: string;
143
+ errors: Array<{
144
+ error: string;
145
+ recipientId: string;
146
+ }>;
147
+ started: VoiceCampaignAttempt[];
148
+ };
149
+ export type VoiceCampaignProofOptions = {
150
+ campaign?: VoiceCampaignCreateInput;
151
+ completeAttempts?: boolean;
152
+ recipients?: VoiceCampaignRecipientInput[];
153
+ runtime?: VoiceCampaignRuntime;
154
+ store?: VoiceCampaignStore;
155
+ };
156
+ export type VoiceCampaignProofReport = {
157
+ campaign: VoiceCampaignRecord;
158
+ created: VoiceCampaignRecord;
159
+ final: VoiceCampaignRecord;
160
+ proof: 'voice-campaign';
161
+ recipients: VoiceCampaignRecord;
162
+ summary: VoiceCampaignSummary;
163
+ tick: VoiceCampaignTickResult;
164
+ };
165
+ export type VoiceCampaignReadinessCheck = {
166
+ details?: Record<string, unknown>;
167
+ name: string;
168
+ status: 'fail' | 'pass';
169
+ };
170
+ export type VoiceCampaignReadinessProofOptions = {
171
+ store?: VoiceCampaignStore;
172
+ };
173
+ export type VoiceCampaignReadinessProofReport = {
174
+ campaigns: {
175
+ retry: VoiceCampaignRecord;
176
+ scheduled: VoiceCampaignRecord;
177
+ };
178
+ checks: VoiceCampaignReadinessCheck[];
179
+ generatedAt: number;
180
+ import: VoiceCampaignRecipientImportResult;
181
+ ok: boolean;
182
+ proof: 'voice-campaign-readiness';
183
+ ticks: {
184
+ allowed: VoiceCampaignTickResult;
185
+ quietHours: VoiceCampaignTickResult;
186
+ rateLimited: VoiceCampaignTickResult;
187
+ retryAllowed: VoiceCampaignTickResult;
188
+ retryBackoff: VoiceCampaignTickResult;
189
+ retryInitial: VoiceCampaignTickResult;
190
+ windowBlocked: VoiceCampaignTickResult;
191
+ };
192
+ };
193
+ export type VoiceCampaignSummary = {
194
+ attempts: {
195
+ failed: number;
196
+ queued: number;
197
+ running: number;
198
+ succeeded: number;
199
+ total: number;
200
+ };
201
+ campaigns: {
202
+ canceled: number;
203
+ completed: number;
204
+ draft: number;
205
+ paused: number;
206
+ running: number;
207
+ total: number;
208
+ };
209
+ recipients: {
210
+ canceled: number;
211
+ completed: number;
212
+ failed: number;
213
+ pending: number;
214
+ queued: number;
215
+ total: number;
216
+ };
217
+ };
218
+ export type VoiceCampaignRuntimeOptions = {
219
+ dialer?: VoiceCampaignDialer;
220
+ now?: () => number;
221
+ store: VoiceCampaignStore;
222
+ };
223
+ export type VoiceCampaignRuntime = {
224
+ addRecipients: (campaignId: string, recipients: VoiceCampaignRecipientInput[]) => Promise<VoiceCampaignRecord>;
225
+ cancel: (campaignId: string) => Promise<VoiceCampaignRecord>;
226
+ completeAttempt: (campaignId: string, attemptId: string, result: VoiceCampaignAttemptResultInput) => Promise<VoiceCampaignRecord>;
227
+ create: (input: VoiceCampaignCreateInput) => Promise<VoiceCampaignRecord>;
228
+ enqueue: (campaignId: string) => Promise<VoiceCampaignRecord>;
229
+ get: (campaignId: string) => Promise<VoiceCampaignRecord | undefined>;
230
+ importRecipients: (campaignId: string, input: VoiceCampaignRecipientImportOptions) => Promise<VoiceCampaignRecord & {
231
+ import: VoiceCampaignRecipientImportResult;
232
+ }>;
233
+ list: () => Promise<VoiceCampaignRecord[]>;
234
+ pause: (campaignId: string) => Promise<VoiceCampaignRecord>;
235
+ remove: (campaignId: string) => Promise<void>;
236
+ resume: (campaignId: string) => Promise<VoiceCampaignRecord>;
237
+ summarize: () => Promise<VoiceCampaignSummary>;
238
+ tick: (campaignId: string) => Promise<VoiceCampaignTickResult>;
239
+ };
240
+ export type VoiceCampaignRoutesOptions = VoiceCampaignRuntimeOptions & {
241
+ headers?: HeadersInit;
242
+ htmlPath?: false | string;
243
+ observability?: VoiceCampaignObservabilityOptions;
244
+ operationsRecordHref?: false | string | ((input: {
245
+ attempt: VoiceCampaignAttempt;
246
+ campaign: VoiceCampaign;
247
+ recipient?: VoiceCampaignRecipient;
248
+ sessionId?: string;
249
+ }) => string | undefined);
250
+ name?: string;
251
+ path?: string;
252
+ title?: string;
253
+ };
254
+ export type VoiceCampaignWorkerOptions = {
255
+ campaignIds?: string[];
256
+ leaseMs?: number;
257
+ leases: VoiceRedisTaskLeaseCoordinator;
258
+ maxCampaigns?: number;
259
+ runtime?: VoiceCampaignRuntime;
260
+ statuses?: VoiceCampaignStatus[];
261
+ store?: VoiceCampaignStore;
262
+ workerId: string;
263
+ };
264
+ export type VoiceCampaignWorkerResult = {
265
+ attempted: number;
266
+ campaigns: number;
267
+ errors: Array<{
268
+ campaignId: string;
269
+ error: string;
270
+ }>;
271
+ skipped: number;
272
+ started: VoiceCampaignAttempt[];
273
+ };
274
+ export type VoiceCampaignWorker = {
275
+ drain: () => Promise<VoiceCampaignWorkerResult>;
276
+ };
277
+ export type VoiceCampaignWorkerLoopOptions = {
278
+ onError?: (error: unknown) => void | Promise<void>;
279
+ pollIntervalMs?: number;
280
+ worker: VoiceCampaignWorker;
281
+ };
282
+ export type VoiceCampaignWorkerLoop = {
283
+ isRunning: () => boolean;
284
+ start: () => void;
285
+ stop: () => void;
286
+ tick: () => Promise<VoiceCampaignWorkerResult>;
287
+ };
288
+ export type VoiceCampaignObservabilityOptions = {
289
+ leases?: VoiceRedisTaskLeaseCoordinator;
290
+ now?: number;
291
+ rateWindowMs?: number;
292
+ stuckAfterMs?: number;
293
+ };
294
+ export type VoiceCampaignObservabilityReport = {
295
+ attemptRate: {
296
+ failed: number;
297
+ started: number;
298
+ succeeded: number;
299
+ windowMs: number;
300
+ };
301
+ campaigns: Array<{
302
+ activeAttempts: number;
303
+ campaignId: string;
304
+ lease?: {
305
+ expiresAt: number;
306
+ workerId: string;
307
+ };
308
+ name: string;
309
+ queueDepth: number;
310
+ status: VoiceCampaignStatus;
311
+ stuckAttempts: number;
312
+ stuckRecipients: number;
313
+ updatedAt: number;
314
+ }>;
315
+ failureReasons: Array<{
316
+ count: number;
317
+ reason: string;
318
+ }>;
319
+ generatedAt: number;
320
+ leases: {
321
+ active: number;
322
+ known: boolean;
323
+ };
324
+ queue: {
325
+ activeAttempts: number;
326
+ queuedRecipients: number;
327
+ runningCampaigns: number;
328
+ };
329
+ stuck: {
330
+ attempts: Array<{
331
+ attemptId: string;
332
+ campaignId: string;
333
+ recipientId: string;
334
+ status: VoiceCampaignAttemptStatus;
335
+ updatedAt: number;
336
+ }>;
337
+ recipients: Array<{
338
+ campaignId: string;
339
+ recipientId: string;
340
+ status: VoiceCampaignRecipientStatus;
341
+ updatedAt: number;
342
+ }>;
343
+ };
344
+ summary: VoiceCampaignSummary;
345
+ };
346
+ export type VoiceCampaignTelephonyOutcomeInput<TResult = unknown> = {
347
+ campaignId?: string;
348
+ decision: VoiceTelephonyOutcomeDecision;
349
+ event?: VoiceTelephonyOutcomeProviderEvent;
350
+ externalCallId?: string;
351
+ routeResult?: TResult;
352
+ sessionId?: string;
353
+ attemptId?: string;
354
+ };
355
+ export type VoiceCampaignTelephonyOutcomeStatus = 'failed' | 'ignore' | 'succeeded';
356
+ export type VoiceCampaignTelephonyOutcomeOptions<TResult = unknown> = {
357
+ resolveCampaignId?: (input: VoiceCampaignTelephonyOutcomeInput<TResult>) => Promise<string | undefined> | string | undefined;
358
+ resolveExternalCallId?: (input: VoiceCampaignTelephonyOutcomeInput<TResult>) => Promise<string | undefined> | string | undefined;
359
+ resolveAttemptId?: (input: VoiceCampaignTelephonyOutcomeInput<TResult>) => Promise<string | undefined> | string | undefined;
360
+ runtime?: VoiceCampaignRuntime;
361
+ statusForDecision?: (input: VoiceCampaignTelephonyOutcomeInput<TResult>) => Promise<VoiceCampaignTelephonyOutcomeStatus> | VoiceCampaignTelephonyOutcomeStatus;
362
+ store?: VoiceCampaignStore;
363
+ };
364
+ export type VoiceCampaignTelephonyOutcomeResult = {
365
+ applied: boolean;
366
+ campaignId?: string;
367
+ error?: string;
368
+ externalCallId?: string;
369
+ reason?: 'ignored' | 'missing-attempt' | 'missing-campaign' | 'missing-runtime' | 'terminal-attempt';
370
+ status?: 'failed' | 'succeeded';
371
+ attemptId?: string;
372
+ };
373
+ export declare const importVoiceCampaignRecipients: (options: VoiceCampaignRecipientImportOptions) => VoiceCampaignRecipientImportResult;
374
+ export declare const createVoiceMemoryCampaignStore: () => VoiceCampaignStore;
375
+ export declare const summarizeVoiceCampaigns: (records: VoiceCampaignRecord[]) => VoiceCampaignSummary;
376
+ export declare const buildVoiceCampaignObservabilityReport: (records: VoiceCampaignRecord[], options?: VoiceCampaignObservabilityOptions) => Promise<VoiceCampaignObservabilityReport>;
377
+ export declare const createVoiceCampaign: (options: VoiceCampaignRuntimeOptions) => VoiceCampaignRuntime;
378
+ export declare const createVoiceCampaignWorker: (options: VoiceCampaignWorkerOptions) => VoiceCampaignWorker;
379
+ export declare const createVoiceCampaignWorkerLoop: (options: VoiceCampaignWorkerLoopOptions) => VoiceCampaignWorkerLoop;
380
+ export declare const applyVoiceCampaignTelephonyOutcome: <TResult = unknown>(input: VoiceCampaignTelephonyOutcomeInput<TResult>, options?: VoiceCampaignTelephonyOutcomeOptions<TResult>) => Promise<VoiceCampaignTelephonyOutcomeResult>;
381
+ export declare const createVoiceCampaignTelephonyOutcomeHandler: <TResult = unknown>(options: VoiceCampaignTelephonyOutcomeOptions<TResult>) => (input: VoiceTelephonyWebhookDecision<TResult>) => Promise<VoiceCampaignTelephonyOutcomeResult>;
382
+ export declare const runVoiceCampaignProof: (options?: VoiceCampaignProofOptions) => Promise<VoiceCampaignProofReport>;
383
+ export declare const runVoiceCampaignReadinessProof: (options?: VoiceCampaignReadinessProofOptions) => Promise<VoiceCampaignReadinessProofReport>;
384
+ export declare const renderVoiceCampaignsHTML: (records: VoiceCampaignRecord[], options?: Pick<VoiceCampaignRoutesOptions, "operationsRecordHref" | "title">) => string;
385
+ export declare const renderVoiceCampaignObservabilityHTML: (report: VoiceCampaignObservabilityReport, options?: {
386
+ title?: string;
387
+ }) => string;
388
+ export declare const createVoiceCampaignRoutes: (options: VoiceCampaignRoutesOptions) => Elysia<"", {
389
+ decorator: {};
390
+ store: {};
391
+ derive: {};
392
+ resolve: {};
393
+ }, {
394
+ typebox: {};
395
+ error: {};
396
+ }, {
397
+ schema: {};
398
+ standaloneSchema: {};
399
+ macro: {};
400
+ macroFn: {};
401
+ parser: {};
402
+ response: {};
403
+ }, {
404
+ [x: string]: {
405
+ get: {
406
+ body: unknown;
407
+ params: {};
408
+ query: unknown;
409
+ headers: unknown;
410
+ response: {
411
+ 200: {
412
+ campaigns: VoiceCampaignRecord[];
413
+ summary: VoiceCampaignSummary;
414
+ };
415
+ };
416
+ };
417
+ };
418
+ } & {
419
+ [x: string]: {
420
+ observability: {
421
+ get: {
422
+ body: unknown;
423
+ params: {};
424
+ query: unknown;
425
+ headers: unknown;
426
+ response: {
427
+ 200: VoiceCampaignObservabilityReport;
428
+ };
429
+ };
430
+ };
431
+ };
432
+ } & {
433
+ [x: string]: {
434
+ "readiness-proof": {
435
+ get: {
436
+ body: unknown;
437
+ params: {};
438
+ query: unknown;
439
+ headers: unknown;
440
+ response: {
441
+ 200: VoiceCampaignReadinessProofReport;
442
+ };
443
+ };
444
+ };
445
+ };
446
+ } & {
447
+ [x: string]: {
448
+ post: {
449
+ body: unknown;
450
+ params: {};
451
+ query: unknown;
452
+ headers: unknown;
453
+ response: {
454
+ 200: VoiceCampaignRecord;
455
+ };
456
+ };
457
+ };
458
+ } & {
459
+ [x: string]: {
460
+ ":campaignId": {
461
+ get: {
462
+ body: unknown;
463
+ params: {
464
+ campaignId: string;
465
+ } & {};
466
+ query: unknown;
467
+ headers: unknown;
468
+ response: {
469
+ 422: {
470
+ type: "validation";
471
+ on: string;
472
+ summary?: string;
473
+ message?: string;
474
+ found?: unknown;
475
+ property?: string;
476
+ expected?: string;
477
+ };
478
+ };
479
+ };
480
+ };
481
+ };
482
+ } & {
483
+ [x: string]: {
484
+ ":campaignId": {
485
+ delete: {
486
+ body: unknown;
487
+ params: {
488
+ campaignId: string;
489
+ } & {};
490
+ query: unknown;
491
+ headers: unknown;
492
+ response: {
493
+ 200: {
494
+ ok: boolean;
495
+ };
496
+ 422: {
497
+ type: "validation";
498
+ on: string;
499
+ summary?: string;
500
+ message?: string;
501
+ found?: unknown;
502
+ property?: string;
503
+ expected?: string;
504
+ };
505
+ };
506
+ };
507
+ };
508
+ };
509
+ } & {
510
+ [x: string]: {
511
+ ":campaignId": {
512
+ recipients: {
513
+ post: {
514
+ body: unknown;
515
+ params: {
516
+ campaignId: string;
517
+ } & {};
518
+ query: unknown;
519
+ headers: unknown;
520
+ response: {
521
+ 200: VoiceCampaignRecord;
522
+ 422: {
523
+ type: "validation";
524
+ on: string;
525
+ summary?: string;
526
+ message?: string;
527
+ found?: unknown;
528
+ property?: string;
529
+ expected?: string;
530
+ };
531
+ };
532
+ };
533
+ };
534
+ };
535
+ };
536
+ } & {
537
+ [x: string]: {
538
+ ":campaignId": {
539
+ recipients: {
540
+ import: {
541
+ post: {
542
+ body: unknown;
543
+ params: {
544
+ campaignId: string;
545
+ } & {};
546
+ query: unknown;
547
+ headers: unknown;
548
+ response: {
549
+ 200: VoiceCampaignRecord & {
550
+ import: VoiceCampaignRecipientImportResult;
551
+ };
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
+ } & {
568
+ [x: string]: {
569
+ ":campaignId": {
570
+ enqueue: {
571
+ post: {
572
+ body: unknown;
573
+ params: {
574
+ campaignId: string;
575
+ } & {};
576
+ query: unknown;
577
+ headers: unknown;
578
+ response: {
579
+ 200: VoiceCampaignRecord;
580
+ 422: {
581
+ type: "validation";
582
+ on: string;
583
+ summary?: string;
584
+ message?: string;
585
+ found?: unknown;
586
+ property?: string;
587
+ expected?: string;
588
+ };
589
+ };
590
+ };
591
+ };
592
+ };
593
+ };
594
+ } & {
595
+ [x: string]: {
596
+ ":campaignId": {
597
+ pause: {
598
+ post: {
599
+ body: unknown;
600
+ params: {
601
+ campaignId: string;
602
+ } & {};
603
+ query: unknown;
604
+ headers: unknown;
605
+ response: {
606
+ 200: VoiceCampaignRecord;
607
+ 422: {
608
+ type: "validation";
609
+ on: string;
610
+ summary?: string;
611
+ message?: string;
612
+ found?: unknown;
613
+ property?: string;
614
+ expected?: string;
615
+ };
616
+ };
617
+ };
618
+ };
619
+ };
620
+ };
621
+ } & {
622
+ [x: string]: {
623
+ ":campaignId": {
624
+ resume: {
625
+ post: {
626
+ body: unknown;
627
+ params: {
628
+ campaignId: string;
629
+ } & {};
630
+ query: unknown;
631
+ headers: unknown;
632
+ response: {
633
+ 200: VoiceCampaignRecord;
634
+ 422: {
635
+ type: "validation";
636
+ on: string;
637
+ summary?: string;
638
+ message?: string;
639
+ found?: unknown;
640
+ property?: string;
641
+ expected?: string;
642
+ };
643
+ };
644
+ };
645
+ };
646
+ };
647
+ };
648
+ } & {
649
+ [x: string]: {
650
+ ":campaignId": {
651
+ cancel: {
652
+ post: {
653
+ body: unknown;
654
+ params: {
655
+ campaignId: string;
656
+ } & {};
657
+ query: unknown;
658
+ headers: unknown;
659
+ response: {
660
+ 200: VoiceCampaignRecord;
661
+ 422: {
662
+ type: "validation";
663
+ on: string;
664
+ summary?: string;
665
+ message?: string;
666
+ found?: unknown;
667
+ property?: string;
668
+ expected?: string;
669
+ };
670
+ };
671
+ };
672
+ };
673
+ };
674
+ };
675
+ } & {
676
+ [x: string]: {
677
+ ":campaignId": {
678
+ tick: {
679
+ post: {
680
+ body: unknown;
681
+ params: {
682
+ campaignId: string;
683
+ } & {};
684
+ query: unknown;
685
+ headers: unknown;
686
+ response: {
687
+ 200: VoiceCampaignTickResult;
688
+ 422: {
689
+ type: "validation";
690
+ on: string;
691
+ summary?: string;
692
+ message?: string;
693
+ found?: unknown;
694
+ property?: string;
695
+ expected?: string;
696
+ };
697
+ };
698
+ };
699
+ };
700
+ };
701
+ };
702
+ } & {
703
+ [x: string]: {
704
+ ":campaignId": {
705
+ attempts: {
706
+ ":attemptId": {
707
+ result: {
708
+ post: {
709
+ body: unknown;
710
+ params: {
711
+ campaignId: string;
712
+ attemptId: string;
713
+ } & {};
714
+ query: unknown;
715
+ headers: unknown;
716
+ response: {
717
+ 200: VoiceCampaignRecord;
718
+ 422: {
719
+ type: "validation";
720
+ on: string;
721
+ summary?: string;
722
+ message?: string;
723
+ found?: unknown;
724
+ property?: string;
725
+ expected?: string;
726
+ };
727
+ };
728
+ };
729
+ };
730
+ };
731
+ };
732
+ };
733
+ };
734
+ }, {
735
+ derive: {};
736
+ resolve: {};
737
+ schema: {};
738
+ standaloneSchema: {};
739
+ response: {};
740
+ }, {
741
+ derive: {};
742
+ resolve: {};
743
+ schema: {};
744
+ standaloneSchema: {};
745
+ response: {};
746
+ }>;